mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
Report Python errors from iterators with PLy_elog
This improves reporting, as the error string now includes the actual Python exception. As a side effect, this no longer sets the errcode to ERRCODE_DATA_EXCEPTION, which might be considered a feature, as it's not documented and not clear why iterator errors should be treated differently. Jan Urbański
This commit is contained in:
parent
cfcdc99db6
commit
8f76324352
@ -1157,9 +1157,7 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure *proc)
|
|||||||
PLy_function_delete_args(proc);
|
PLy_function_delete_args(proc);
|
||||||
|
|
||||||
if (has_error)
|
if (has_error)
|
||||||
ereport(ERROR,
|
PLy_elog(ERROR, "error fetching next item from iterator");
|
||||||
(errcode(ERRCODE_DATA_EXCEPTION),
|
|
||||||
errmsg("error fetching next item from iterator")));
|
|
||||||
|
|
||||||
/* Disconnect from the SPI manager before returning */
|
/* Disconnect from the SPI manager before returning */
|
||||||
if (SPI_finish() != SPI_OK_FINISH)
|
if (SPI_finish() != SPI_OK_FINISH)
|
||||||
|
Loading…
Reference in New Issue
Block a user