Re: PL/Perl: spi_prepare() and RETURNING - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PL/Perl: spi_prepare() and RETURNING
Date
Msg-id 8690.1156446082@sss.pgh.pa.us
Whole thread Raw
In response to Re: PL/Perl: spi_prepare() and RETURNING  (David Fetter <david@fetter.org>)
Responses Re: PL/Perl: spi_prepare() and RETURNING  (Andrew Dunstan <andrew@dunslane.net>)
Re: PL/Perl: spi_prepare() and RETURNING  ("Jonah H. Harris" <jonah.harris@gmail.com>)
List pgsql-hackers
David Fetter <david@fetter.org> writes:
>> I've found a little lacuna in the RETURNING feature, that being in
>> PL/Perl's spi_prepare()/spi_execute_prepared() as illustrated in the
>> attached file on CVS TIP.

It looks like plperl_spi_execute_fetch_result only expects to find
tuples returned if the status is SPI_OK_SELECT.  pltcl and plpython
have likely got similar issues.

This reminds me of a consideration I had been intending to bring up on
the mailing lists: what exactly do we want to do with the SPI API for
RETURNING queries?  The current behavior is that it still returns
SPI_OK_INSERT and so on, but also creates a SPI_tuptable.  Is this
what we want?  Perhaps we should invent additional return codes
SPI_OK_INSERT_RETURNING etc.

Another issue I noted in that same area is that spi.c does not set
SPI_processed for a utility statement, even if the utility statement
returns tuples.  Is this a bug, or should we leave it alone?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Zoltan Boszormenyi
Date:
Subject: Re: [PATCHES] COPY view
Next
From: Bernd Helmle
Date:
Subject: Re: [PATCHES] Updatable views