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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid failure when selecting a namespace node in XMLTABLE.
Date: 2019-10-25 19:23:30
Message-ID: E1iO5BK-0006sG-MA@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9f7a664fe35c40cc9b1a4ebec4fc990dc45370f3

Modified Files
--------------
src/backend/utils/adt/xml.c | 7 ++++++-
src/test/regress/expected/xml.out | 4 ++++
src/test/regress/expected/xml_1.out | 8 ++++++++
src/test/regress/expected/xml_2.out | 4 ++++
src/test/regress/sql/xml.sql | 4 ++++
5 files changed, 26 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2019-10-25 19:37:39 pgsql: Remove obsolete information schema tables
Previous Message Peter Eisentraut 2019-10-25 18:50:31 pgsql: doc: Use proper em and en dashes