From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Cc: | Vik Fearing <vik(at)postgresfriends(dot)org>, Chapman Flack <chap(at)anastigmatix(dot)net> |
Subject: | XMLSerialize: version and explicit XML declaration |
Date: | 2024-09-25 12:51:45 |
Message-ID: | 0427cced-93df-4e50-aaa0-645438a2dbe4@uni-muenster.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I'm working on the flags VERSION (X076), INCLUDING XMLDECLARATION, and
EXCLUDING XMLDECLARATION (X078) for XMLSerialize, and I have a question
for SQL/XML experts on the list.
Is there any validation mechanism for VERSION <character string
literal>? The SQL/XML spec says
"The <character string literal> immediately contained in <XML serialize
version> shall be '1.0' or '1.1', or it shall identify some successor to
XML 1.0 and XML 1.1."
I was wondering if a validation here would make any sense, since
XMLSerialize is only supposed to print a string --- not to mention that
validating "some successor to XML 1.0 and XML 1.1" can be challenging :)
But again, printing an "invalid" XML string also doesn't seem very nice.
The oracle implementation accepts pretty much anything:
SQL> SELECT xmlserialize(DOCUMENT xmltype('<foo><bar>42</bar></foo>')
VERSION 'foo') AS xml FROM dual;
XML
--------------------------------------------------------------------------------
<?xml version="foo"?>
<foo>
<bar>42</bar>
</foo>
In db2, anything other than '1.0' raises an error:
db2 => SELECT XMLSERIALIZE(CONTENT XMLELEMENT(NAME "db2",service_level)
AS varchar(100) VERSION '1.0' INCLUDING XMLDECLARATION) FROM
sysibmadm.env_inst_info;
1
----------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?><db2>DB2
v11.5.9.0</db2>
1 record(s) selected.
db2 => SELECT XMLSERIALIZE(CONTENT XMLELEMENT(NAME "db2",service_level)
AS varchar(100) VERSION '1.1' INCLUDING XMLDECLARATION) FROM
sysibmadm.env_inst_info;
SQL0171N The statement was not processed because the data type, length or
value of the argument for the parameter in position "2" of routine
"XMLSERIALIZE" is incorrect. Parameter name: "". SQLSTATE=42815
Any thoughts on how we should approach this feature?
Thanks!
Best, Jim
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2024-09-25 13:39:11 | Re: Add support to TLS 1.3 cipher suites and curves lists |
Previous Message | Jehan-Guillaume de Rorthais | 2024-09-25 12:42:40 | Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails |