pgsql: Avoid failure when selecting a namespace node in XMLTABLE.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pgsql: Avoid failure when selecting a namespace node in XMLTABLE.

Tom Lane-2
Avoid failure when selecting a namespace node in XMLTABLE.

It appears that libxml2 doesn't bother to set the "children" field of
an XML_NAMESPACE_DECL node to null; that field just contains garbage.
In v10 and v11, this can result in a crash in XMLTABLE().  The rewrite
done in commit 251cf2e27 fixed this, somewhat accidentally, in v12.
We're not going to back-patch 251cf2e27, however.  The case apparently
doesn't have wide use, so rather than risk introducing other problems,
just add a safety check to throw an error.

Even though no bug manifests in v12/HEAD, add the relevant test case
there too, to prevent future regressions.

Chapman Flack (per private report)

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/592a16321bd760d21220d0b2648bf151065816a5

Modified Files
--------------
src/test/regress/expected/xml.out   | 8 ++++++++
src/test/regress/expected/xml_1.out | 8 ++++++++
src/test/regress/expected/xml_2.out | 8 ++++++++
src/test/regress/sql/xml.sql        | 4 ++++
4 files changed, 28 insertions(+)