Bring some order and sanity to error handling in the xml patch.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 24 Dec 2006 18:25:58 +0000 (18:25 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 24 Dec 2006 18:25:58 +0000 (18:25 +0000)
commitcb68aac46fdfb99d8b8ae085adde8aaadf07e7be
tree1ddaa4fcbd2bd08128602129079ec71fea5512d1
parent956ad687709af692b0458c4c9bb569cab690b7f1
Bring some order and sanity to error handling in the xml patch.
Use a TRY block instead of (inadequate) ad-hoc coding to ensure that
libxml is cleaned up after a failure.  Report the intended SQLCODE
instead of defaulting to XX000.  Avoid risking use of a dangling
pointer by keeping the persistent error buffer in TopMemoryContext.
Be less trusting that error messages don't contain %.

This patch doesn't do anything about changing the way the messages
are put together --- this is just about mechanism.
src/backend/utils/adt/xml.c