pgsql: Set correct context for XPath evaluation

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема pgsql: Set correct context for XPath evaluation
Дата
Msg-id E1fW5ie-0003eO-I8@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Set correct context for XPath evaluation

According to the SQL standard, the context of XMLTABLE's XPath
row_expression is the document node of the XML input document, not the
root node.  This becomes visible when a relative path rather than
absolute is used as row expression.  Absolute paths is what was used in
original tests and docs (and the most common form used in examples
throughout the interwebs), which explains why this wasn't noticed
before.

Other functions such as xpath() and xpath_exists() also have this
problem.  While not specified by the SQL standard, it would be pretty
odd to leave those functions to behave differently than XMLTABLE, so
change them too.  However, this is a backwards-incompatible change.

No backpatch, out of fear of breaking code depending on the original
broken behavior.

Author: Markus Winand
Reported-By: Markus Winand
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/0684A598-002C-42A2-AE12-F024A324EAE4@winand.at

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e474c2b7e4b656895d6afcbd36857c9ebb0fcedd

Modified Files
--------------
src/backend/utils/adt/xml.c         | 10 ++--------
src/test/regress/expected/xml.out   |  8 +++++++-
src/test/regress/expected/xml_1.out | 12 +++++++++---
src/test/regress/expected/xml_2.out |  8 +++++++-
src/test/regress/sql/xml.sql        |  3 ++-
5 files changed, 27 insertions(+), 14 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve requirements documentation for ldap test suite.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix partial aggregation for variance(int4) and relatedaggregate