cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.96k stars 3.79k forks source link

plpgsql: implement set-returning PLpgSQL functions #105240

Open DrewKimball opened 1 year ago

DrewKimball commented 1 year ago

Postgres PLpgSQL allows for RETURN NEXT and RETURN QUERY syntax in order to return multiple rows from a PLpgSQL set-returning function. See the section 43.6.1.2. RETURN NEXT And RETURN QUERY in the postgres docs: https://www.postgresql.org/docs/current/plpgsql-control-structures.html

This issue tracks implementing that syntax. This will likely require implementing a new relational operator, RelCase, which conditionally executes relational expressions. This is necessary because PLpgSQL control flow requires the ability to conditionally execute functions, and the current scalar Case operator cannot handle set-returning functions.

Jira issue: CRDB-28933

DrewKimball commented 1 year ago

This work is not slated for 23.2.