Alastair McKinley <a.mckinley@xxxxxxxxxxxxxxxxxxxx> writes: > Thanks for solving the mystery. I think this might be a missing point in section 15.2 in the docs. > I wonder will this ever be improved or should I just write to temporary tables instead of return query? I just posted a patch to improve that [1], but it's not something we'd be likely to back-patch into existing releases. regards, tom lane [1] https://www.postgresql.org/message-id/1741.1584847383%40sss.pgh.pa.us