If got several stored procedures (functions in PG) that need to pass around an intermediate result set between them (1K rows at most)
I can do this in other DBMS's but would like to know how to accomplish this in native PostgreSQL.
Specifically does PG support:
CREATE TYPE MyTable AS TABLE(...)
Also can we do this completely in memory?
I want to pass a "MyTable" between several procs as input and output.
Or possibly could I build this result set and pass it around as a JSONB parameter?
I need this to be blazingly fast, no matter how it's done.
The question is a bit unclear, but the best way is probably to pass a cursor between the functions.
Here is a toy example, see the documenation for more:
That example works like this: