On 11.04.24 01:02, Tom Lane wrote:
>> And if not, why can't I write a stored procedure
>> or function that returns multiple result sets?
>
> [ shrug... ] Lack of round tuits, perhaps. We don't have any
> mechanism today whereby a stored procedure could say "please ship
> this resultset off to the client, but I want to continue afterwards".
> But you can do that in other RDBMSes and probably somebody will be
> motivated to make it possible in Postgres.
The development of this feature was the subject of this thread:
https://www.postgresql.org/message-id/flat/6e747f98-835f-2e05-cde5-86ee444a7140@2ndquadrant.com
But it has not concluded successfully yet.