Re: Stored procedures and out parameters

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Shay Rojansky" <roji(at)roji(dot)org>
Cc: "Vladimir Sitnikov" <sitnikov(dot)vladimir(at)gmail(dot)com>,"David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>,"Andrew Gierth" <andrew(at)tao11(dot)riddles(dot)org(dot)uk>,"Robert Haas" <robertmhaas(at)gmail(dot)com>,"PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Stored procedures and out parameters
Date: 2018-08-04 13:00:55
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Shay Rojansky wrote:

> In one way that's good, but I wonder how this squares with the following
> written by David above:
> > 1. A stored procedure should be able to return multiple resultsets with
> different structures.
> > 2. A stored procedure can decide dynamically of the structure of the
> resultset(s) it returns, and the caller will discover it as they're
> returned, not before.

> Both of the above seem to be simply incompatible with the current
> PostgreSQL protocol. Describe currently returns a single RowDescription,
> which describes a single resultset, not more. And as I wrote before, I
> don't see how it's possible with the current protocol for the caller to
> discover the structure of the resultset(s) "as they're returned"

It works at least with the simple query mode, where it's similar
to handling results from a query string containing multiple
statements separated by semicolons.

But it's not clear whether this could work with the extended query
protocol. The doc says that the necessary RowDescription message(s)
would be missing:

"The possible responses to Execute are the same as those described
above for queries issued via simple query protocol, except that
Execute doesn't cause ReadyForQuery or RowDescription to be issued",

Best regards,
Daniel Vérité
PostgreSQL-powered mailer:
Twitter: @DanielVerite

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Surafel Temesgen 2018-08-04 13:09:51 Conflict handling for COPY FROM
Previous Message Fabien COELHO 2018-08-04 09:40:33 Re: doc - improve description of default privileges