Select 到 plpgsql 中的复合类型数组

Select into an array of composite types in plpgsql

复合类型数组是在 plpgsql 中模拟 "function scoped" table 的正确方法吗?

我想存储整个函数访问的查询结果, 但我不想使用临时 table 因为单个会话可能同时执行多个函数调用。

DECLARE 
projectDocuments document_tracking.docmaster[];

SELECT * INTO projectDocuments FROM document_tracking.docmaster WHERE jobnumber = jobnumberparam;

产生格式错误的数组文字错误,我应该使用聚合函数,还是:=?

考虑使用

ON COMMIT DELETE ROWS

https://www.postgresql.org/docs/current/static/sql-createtable.html

All rows in the temporary table will be deleted at the end of each transaction block. Essentially, an automatic TRUNCATE is done at each commit.