Re: PL/Perl: spi_prepare() and RETURNING

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/Perl: spi_prepare() and RETURNING
Date: 2006-08-24 19:01:22
Message-ID: 8690.1156446082@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter <david(at)fetter(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2006-08-24 19:08:32 Re: [HACKERS] Updatable views
Previous Message Zoltan Boszormenyi 2006-08-24 18:58:18 Re: [HACKERS] COPY view