aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpython.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-08-27 23:47:58 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-08-27 23:47:58 +0000
commitea2e263539df6a7df33e58e44236c504eb268e68 (patch)
tree7eaf045b3e96f2cd97bfa7910309e5b891159a55 /src/pl/plpython/plpython.c
parent7a2fe85b03b31f748614cae7a7b3808dba4f65ce (diff)
downloadpostgresql-ea2e263539df6a7df33e58e44236c504eb268e68.tar.gz
postgresql-ea2e263539df6a7df33e58e44236c504eb268e68.zip
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.
Diffstat (limited to 'src/pl/plpython/plpython.c')
-rw-r--r--src/pl/plpython/plpython.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 289ab2e7b73..f45ecd72222 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -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();