Re: PostgreSQL vs SQL/XML Standards
Chapman Flack <chap@anastigmatix.net>
From: Chapman Flack <chap@anastigmatix.net>
To: Pavel Stehule <pavel.stehule@gmail.com>,
Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2018-10-25T22:40:00Z
Lists: pgsql-hackers
On 10/25/18 11:15, Pavel Stehule wrote: > čt 25. 10. 2018 v 17:09 odesílatel Alvaro Herrera <alvherre@2ndquadrant.com> > napsal: >> Maybe the best way forward is to implement all the JSON functionality >> and remove the SQL/XML bits. > > It can be bigger compatibility break in Postgres history. SQL/XML functions > are widely used. It seems to me that evolution to the 2006+ standard version could be done mostly non-disruptively (provided an agreeable library can be found). I think Tom's suggestion[1] to just make XML OPTION CONTENT mean what it means in 2006+ would be an easy change to make immediately, and would not disrupt anybody ... it would only make some things succeed that now fail, and it would match what our documentation already says. It would make our XML type equivalent to 2006+ XML(CONTENT(ANY)). Beyond that, further steps toward 2006+ could largely avoid disruption. If we implement the typmod'ed XML types, surely the parser would simply treat untypmod'ed 'XML' as meaning XML(CONTENT(ANY)). (The standard does allow for the typmod to be missing, and leaves it "implementation-defined whether SEQUENCE, CONTENT(ANY), or CONTENT(UNTYPED) is implicit", so that's all by the book.) The existing functions xpath and xpath_exists can be kept unchanged, as their names are distinct from anything in the standard. A library that supports XQuery is likely also to support XPath in "1.0 compatibility mode", so those functions could keep their semantics. The current xmlvalidate() has the wrong semantics and return type, but it also does nothing but ereport unimplemented, so no current uses would be hurt by redefining it. XMLTABLE would be the headache. Using the standard name for something that ain't the standard function has not left any painless way that the standard function could be added. OTOH, it has only been in the wild since 10, so renaming it to something else (xpath_table?) will probably be more painless if done soon than it ever would be later. On 10/25/18 11:23, Andreas Karlsson wrote: > The libraries we depend on should really either be available in the > package repositories of the major Linux distribution or be something > we can put in our own repository and maintain without too much pain. > So using Saxon/C does not seem like a realistic option. That makes good sense. The approach I proposed in [2] would be to target the XQC API as an integration point. If there is one library that might be most acceptable (it seems xqilla is in several repositories), it could become a preferred or supported choice, but others could be available if an administrator wanted to separately obtain them, perhaps because of better performance on a particular workload, or avoidance of some bug that a given workload turns up. -Chap [1]: https://www.postgresql.org/message-id/22271.1540458133%40sss.pgh.pa.us [2]: https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL/XML_Standards#One_proposal
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
-
Add volatile qualifier missed in commit 2e616dee9.
- b2b819019f44 12.0 landed
-
Fix crash with old libxml2
- 2e616dee9e60 12.0 landed
-
Fix minor deficiencies in XMLTABLE, xpath(), xmlexists()
- 251cf2e27bec 12.0 cited
-
Fix the BY {REF,VALUE} clause of XMLEXISTS/XMLTABLE
- eaaa5986ad03 12.0 landed
-
doc: Update README.links
- b060e6c1f5b4 12.0 landed
-
XPath fixes:
- 3963574d1338 8.3.0 cited