Dmitry Karasik <dmitry(at)karasik(dot)eu(dot)org> writes:
> I'm not sure whether I've stumbled over a bug or a feature, so I'm
> curious if someone might explain that.
It's a bug --- _SPI_execute_plan isn't handling the possibility that
a utility command could create a tupletable that could be passed back
to the caller. So the tuptable gets leaked. I'll try to fix this
for 8.1, not sure if it'd be wise to try to back-patch.
regards, tom lane