Re: Fix XML handling with DOCTYPE
Chapman Flack <chap@anastigmatix.net>
From: Chapman Flack <chap@anastigmatix.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ryan Lambert <ryan@rustprooflabs.com>, pgsql-hackers@postgresql.org
Date: 2019-03-17T22:31:00Z
Lists: pgsql-hackers
Attachments
- xml-functions-type-docfix-3.patch (text/x-patch) patch
- xml-content-2006-3.patch (text/x-patch) patch 2006
On 03/17/19 15:06, Tom Lane wrote: > The error message issue is indeed a concern, but I don't see why it's > complicated if you agree that > >> If the query asked for CONTENT, any error result should be one you could get >> when parsing as CONTENT. > > That just requires us to save the first error message and be sure to issue > that one not the DOCUMENT one, no? I confess I haven't looked hard yet at how to do that. The way errors come out of libxml is more involved than "here's a message", so there's a choice of (a) try to copy off that struct in a way that's sure to survive re-executing the parser, and then use the copy, or (b) generate a message right away from the structured information and save that, and I guess b might not be too bad; a might not be too bad, or it might, and slide right back into the kind of libxml-behavior-assumptions you're wanting to avoid. Meanwhile, here is a patch on the lines I proposed earlier, with a pre-check. Any performance hit that it could entail (which I'd really expect to be de minimis, though I haven't benchmarked) ought to be compensated by the strlen I changed to strnlen in parse_xml_decl (as there's really no need to run off and count the whole rest of the input just to know if 1, 2, 3, or 4 bytes are available to decode a UTF-8 char). ... and, yes, I know that could be an independent patch, and then the performance effect here should be measured from there. But it was near what I was doing anyway, so I included it here. Attaching both still-outstanding patches (this one and docfix) so the CF app doesn't lose one. Regards, -Chap
Commits
-
Improve documentation about our XML functionality
- 728c49779ba8 11.6 landed
- 603a28b44973 10.11 landed
-
Improve documentation about our XML functionality.
- 12d46ac392d0 12.0 landed
-
Doc: clarify that REASSIGN OWNED doesn't handle default privileges.
- 50973687f185 9.6.13 cited
- 24df8662e4a4 11.3 cited
-
Suppress Append and MergeAppend plan nodes that have a single child.
- 8edd0e79460b 12.0 cited
-
Accept XML documents when xmloption = content, as required by SQL:2006+.
- 8d1dadb25bb5 12.0 landed
- da45927cef78 9.5.17 landed
- d7cfd5ee4591 9.6.13 landed
- 849f87a1c334 11.3 landed
- 78f84fe0f478 9.4.22 landed
- 754ffcd42006 10.8 landed
-
Ensure xmloption = content while restoring pg_dump output.
- 4870dce37fab 12.0 landed
- 8ba485422933 9.4.22 landed
- 08d8cfe3cfd6 9.5.17 landed
- de922529fe62 10.8 landed
- 7c89f350f109 11.3 landed
- 687acb598308 9.6.13 landed