pgsql: Get rid of the global variable holding the error state

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Get rid of the global variable holding the error state
Date: 2011-01-22 20:14:36
Message-ID: E1Pgjr2-0005Fw-MZ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Get rid of the global variable holding the error state

Global error handling led to confusion and was hard to manage. With
this change, errors from PostgreSQL are immediately reported to Python
as exceptions. This requires setting a Python exception after
reporting the caught PostgreSQL error as a warning, because PLy_elog
destroys the Python exception state.

Ideally, all places where PostgreSQL errors need to be reported back
to Python should be wrapped in subtransactions, to make going back to
Python from a longjmp safe. This will be handled in a separate patch.

Jan Urbański

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=116ce2f4d01b929cc7c3bd0f7e6bca631f83da50

Modified Files
--------------
src/pl/plpython/expected/plpython_error.out | 15 ++-
src/pl/plpython/expected/plpython_test.out | 2 +-
src/pl/plpython/plpython.c | 171 ++++++++++++++++-----------
3 files changed, 114 insertions(+), 74 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-01-22 21:36:50 Re: pgsql: Get rid of the global variable holding the error state
Previous Message Tom Lane 2011-01-22 20:03:21 Re: [COMMITTERS] pgsql: Move test_fsync to /contrib.

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2011-01-22 20:53:41 Re: pl/python refactoring
Previous Message Tom Lane 2011-01-22 20:03:21 Re: [COMMITTERS] pgsql: Move test_fsync to /contrib.