Re: SQL-Invoked Procedures for 8.1 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SQL-Invoked Procedures for 8.1
Date
Msg-id 26090.1095951241@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL-Invoked Procedures for 8.1  (Hannu Krosing <hannu@tm.ee>)
Responses Re: SQL-Invoked Procedures for 8.1  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-hackers
Hannu Krosing <hannu@tm.ee> writes:
> IIRC support for returning multiple recordsets was removed from
> postgresql fe-be protocol years ago as "nobody ever needs it" ;)

The protocol can still do it, and so can the backend, but it will
certainly break most if not all clients.  Here's an example:

regression=# create table surprise(f1 text);
CREATE TABLE
regression=# create rule r1 as on insert to surprise do
regression-# ( select 'hello' ; select 'how are you' );
CREATE RULE
regression=# insert into surprise values ('boo'); ?column?
-------------how are you
(1 row)

regression=#

The 'hello' result was in fact computed and sent by the backend, but it
was discarded in libpq (see the documentation about PQexec: only the
last resultset returned by a querystring is returned to the caller).
psql could have printed both results, but it would need to use
PQsendQuery/PQgetResult instead of PQexec.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Use of zlib
Next
From: Andrew Dunstan
Date:
Subject: Re: Use of zlib