Re: Another issue with invalid XML values
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Florian Pflug <fgp@phlo.org>
Cc: Noah Misch <noah@2ndQuadrant.com>, Bernd Helmle <mailings@oopsware.de>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-07-26T14:22:55Z
Lists: pgsql-hackers
Florian Pflug <fgp@phlo.org> writes: > On further reflection, instead of checking whether we can restore the error > handler in pg_xml_init_library(), we could simply upgrade the elog(WARNING) > in pg_xml_done() to ereport(ERROR), and include a hint that explains the > probably cause. > The upside being that we only fail when we actually need to restore the > error handler. Since there's one caller (parse_xml_decl) who calls > pg_xml_init_library() but not pg_xml_init()/pg_xml_done(), the difference > isn't only academic. At least XML would output will continue to work > work after libxml is upgraded from < 2.7.4 to >= 2.7.4. Good point. But what about failing in pg_xml_init? That is, after calling xmlSetStructuredErrorFunc, check that it set the variable we expected it to set. The purpose of the check in pg_xml_done is not to detect library issues, but to detect omitted save/restore pairs and similar coding mistakes. I don't want to upgrade it to an ERROR, and I don't want to confuse people by hinting that the problem is with libxml. regards, tom lane