Nitpick: please see c4dcd9144ba6.
> From: Justin Pryzby <pryzbyj@telsasoft.com>
> Date: Wed, 11 Mar 2020 10:09:18 -0500
> Subject: [PATCH] SRF: avoid leaking resources if not run to completion
>
> Change to return a tuplestore populated immediately and returned in full.
>
> Discussion: https://www.postgresql.org/message-id/20200308173103.GC1357%40telsasoft.com
I wonder if this isn't saying that the whole value-per-call protocol is
bogus, in that it seems impossible to write a useful function with it.
Maybe we should add one final call with a special flag "function
shutdown" or something, so that these resources can be released if the
SRF isn't run to completion?
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services