• Peter Eisentraut's avatar
    Get rid of the global variable holding the error state · 116ce2f4
    Peter Eisentraut authored
    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
    116ce2f4
plpython_error.out 3.91 KB