Sample Header Ad - 728x90

What is the difference between RETURNS `SETOF integer` and RETURNS TABLE(name int)`?

3 votes
1 answer
4556 views
Given the two definitions below, is there any difference?
CREATE FUNCTION foo(OUT foobar int4)
RETURNS SETOF int4
AS 'MODULE_PATHNAME', 'foo'
LANGUAGE C STRICT VOLATILE;
And,
CREATE FUNCTION foo()
RETURNS TABLE(foobar int4)
AS 'MODULE_PATHNAME', 'foo'
LANGUAGE C STRICT VOLATILE;
That is to say is there a difference between the _"Result data type"_ as displayed with \df between * TABLE(foobar integer) * and, SETOF interger where the Argument data types includes OUT foobar integer
Asked by Evan Carroll (65502 rep)
Nov 6, 2021, 07:34 PM
Last activity: Dec 9, 2022, 08:04 PM