Add example for the function with output parameters and RETURN NEXT with no expression

Started by PG Bug reporting form8 months ago1 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/plpgsql-control-structures.html
Description:

https://www.postgresql.org/docs/current/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING-RETURN-NEXT

If you declared the function with output parameters, write just RETURN

NEXT with no expression. On each execution, the current values of the output
parameter variable(s) will be saved for eventual return as a row of the
result. Note that you must declare the function as returning SETOF record
when there are multiple output parameters, or SETOF sometype when there is
just one output parameter of type sometype, in order to create a
set-returning function with output parameters.

For me it is hard to imagine how to fill `OUT args` and then use `RETURN
NEXT` with no expression.
It would be nice if documentation have an example for that case.

Thank you.