pgsql: Fix assorted small bugs in ThrowErrorData(). - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix assorted small bugs in ThrowErrorData().
Date
Msg-id E1bdLin-0000x4-JK@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix assorted small bugs in ThrowErrorData().

Copy the palloc'd strings into the correct context, ie ErrorContext
not wherever the source ErrorData is.  This would be a large bug,
except that it appears that all catchers of thrown errors do either
EmitErrorReport or CopyErrorData before doing anything that would
cause transient memory contexts to be cleaned up.  Still, it's wrong
and it will bite somebody someday.

Fix failure to copy cursorpos and internalpos.

Utter the appropriate incantations involving recursion_depth, so that
we'll behave sanely if we get an error inside pstrdup.  (In general,
the body of this function ought to act like, eg, errdetail().)

Per code reading induced by Jakob Egger's report.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8529036b53298c0555670b4a81ed7349c44aeeb4

Modified Files
--------------
src/backend/utils/error/elog.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix assorted small bugs in ThrowErrorData().
Next
From: Tom Lane
Date:
Subject: pgsql: Put static forward declarations in elog.c back into same order a