pgsql: Fix error handling in PLy_spi_execute_fetch_result().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix error handling in PLy_spi_execute_fetch_result().
Date: 2013-07-20 16:45:14
Message-ID: E1V0aHS-0005E7-KO@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix error handling in PLy_spi_execute_fetch_result().

If an error is thrown out of the datatype I/O functions called by this
function, we need to do subtransaction cleanup, which the previous coding
entirely failed to do. Fortunately, both existing callers of this function
already have proper cleanup logic, so re-throwing the exception is enough.

Also, postpone creation of the resultset tupdesc until after the I/O
conversions are complete, so that we won't leak memory in TopMemoryContext
when such an error happens.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/b3b10c39038c20457ef058c7f4e5589c28a84f1c

Modified Files
--------------
src/pl/plpython/plpy_spi.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2013-07-22 15:12:08 pgsql: Add infrastructure for mapping relfilenodes to relation OIDs.
Previous Message Peter Eisentraut 2013-07-20 10:49:47 pgsql: Clean up new JSON API typedefs