A summary of the RETURN SETOF variants
You learned that you can return table-like datasets from a function using one of the following:
RETURNS |
RECORD structure |
INSIDE function |
---|---|---|
|
This is obtained from the type definition |
DECLARE row variable of the ROW or RECORD type ASSIGN to row variable RETURN NEXT var; |
|
This is the same as the table or view structure | |
|
Dynamic using AS (name type, …) at call site | |
|
This uses the |
RETURN NEXT ; |
|
This is declared inline, in parentheses, after the |
Get PostgreSQL Server Programming - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.