From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Make xpath() do something useful with XPath expressions that ret |
Date: | 2011-07-21 15:33:10 |
Message-ID: | E1QjvFO-0007pM-O6@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Make xpath() do something useful with XPath expressions that return scalars.
Previously, xpath() simply returned an empty array if the expression did
not yield a node set. This is useless for expressions that return scalars,
such as one with name() at the top level. Arrange to return the scalar
value as a single-element xml array, instead. (String values will be
suitably escaped.)
This change will also cause xpath_exists() to return true, not false,
for such expressions.
Florian Pflug, reviewed by Radoslaw Smogura
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/0ce7676aa03a2501fde949fea211ba5cd84c2ded
Modified Files
--------------
doc/src/sgml/func.sgml | 2 +
src/backend/utils/adt/xml.c | 114 ++++++++++++++++++++++++++++-------
src/test/regress/expected/xml.out | 48 +++++++++++++++
src/test/regress/expected/xml_1.out | 48 +++++++++++++++
src/test/regress/sql/xml.sql | 8 +++
5 files changed, 198 insertions(+), 22 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-07-21 16:25:48 | pgsql: Fix PQsetvalue() to avoid possible crash when adding a new tuple |
Previous Message | Tom Lane | 2011-07-20 22:45:01 | pgsql: Ensure that xpath() escapes special characters in string values. |