gotchasqlMinor
What is the difference between RETURNS `SETOF integer` and RETURNS TABLE(name int)`?
Viewed 0 times
thewhatsetofdifferencebetweennamereturnsandintinteger
Problem
Given the two definitions below, is there any difference?
And,
That is to say is there a difference between the "Result data type" as displayed with
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 betweenTABLE(foobar integer)
- and,
SETOF intergerwhere theArgument data typesincludesOUT foobar integer
Solution
The docs say this on
The name of an output column in the
CREATE FUNCTIONThe name of an output column in the
RETURNS TABLE syntax. This is effectively another way of declaring a named OUT parameter, except that RETURNS TABLE also implies RETURNS SETOF.Context
StackExchange Database Administrators Q#302239, answer score: 3
Revisions (0)
No revisions yet.