]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix assorted small bugs in ThrowErrorData().
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 26 Aug 2016 18:15:47 +0000 (14:15 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 26 Aug 2016 18:15:58 +0000 (14:15 -0400)
commit51b5008c7fdbdc762ce2103c1d907278c0882909
tree3405e3fb9f0e1bfbe93c3351c4526201ec798ea1
parent8c907045f63257859f84b073c0648d2012f7919c
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.
src/backend/utils/error/elog.c