Re: (When) can a single SQL statement return multiple result sets? - Mailing list pgsql-general

From Tom Lane
Subject Re: (When) can a single SQL statement return multiple result sets?
Date
Msg-id 169805.1712844454@sss.pgh.pa.us
Whole thread Raw
In response to Re: (When) can a single SQL statement return multiple result sets?  (Thomas Kellerer <shammat@gmx.net>)
List pgsql-general
Thomas Kellerer <shammat@gmx.net> writes:
> Tom Lane schrieb am 11.04.2024 um 01:02:
>> Jan Behrens <jbe-mlist@magnetkern.de> writes:
>>> While writing a PostgreSQL client library for Lua supporting
>>> Pipelining (using PQsendQueryParams), I have been wondering if there
>>> are any single SQL commands that return multiple result sets.

>> Right now, I don't think so.

> Hmm, what about functions returning multiple refcursors?

Sure, but let's distinguish between "here's an ugly workaround"
and "it just works".  Aside from being tedious, the refcursor
approach is restrictive: I don't think you can readily make
a refcursor on the result of INSERT/UPDATE/DELETE RETURNING,
nor on utility statements such as EXPLAIN.  (There might be
a way around the former restriction with WITH, but I'm
certain that won't work for EXPLAIN.)

            regards, tom lane



pgsql-general by date:

Previous
From: ilya Basin
Date:
Subject: [MASSMAIL] subquery plan rows = 1, but it's merge joined instead of index lookup
Next
From: Laurenz Albe
Date:
Subject: Re: subquery plan rows = 1, but it's merge joined instead of index lookup