1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Add new return codes SPI_OK_INSERT_RETURNING etc to the SPI API.

Fix all the standard PLs to be able to return tuples from FOO_RETURNING
statements as well as utility statements that return tuples.  Also,
fix oversight that SPI_processed wasn't set for a utility statement
returning tuples.  Per recent discussion.
This commit is contained in:
Tom Lane
2006-08-27 23:47:58 +00:00
parent 7a2fe85b03
commit ea2e263539
7 changed files with 102 additions and 61 deletions

View File

@ -1,7 +1,7 @@
/**********************************************************************
* plpython.c - python as a procedural language for PostgreSQL
*
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.85 2006/08/08 19:15:09 tgl Exp $
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.86 2006/08/27 23:47:58 tgl Exp $
*
*********************************************************************
*/
@ -2193,24 +2193,19 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, int rows, int status)
Py_DECREF(result->status);
result->status = PyInt_FromLong(status);
if (status == SPI_OK_UTILITY)
{
Py_DECREF(result->nrows);
result->nrows = PyInt_FromLong(0);
}
else if (status != SPI_OK_SELECT)
if (status > 0 && tuptable == NULL)
{
Py_DECREF(result->nrows);
result->nrows = PyInt_FromLong(rows);
}
else
else if (status > 0 && tuptable != NULL)
{
PLyTypeInfo args;
int i;
PLy_typeinfo_init(&args);
Py_DECREF(result->nrows);
result->nrows = PyInt_FromLong(rows);
PLy_typeinfo_init(&args);
oldcontext = CurrentMemoryContext;
PG_TRY();