changing xpath() and xpath_exists()

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: changing xpath() and xpath_exists()
Date: 2018-06-20 23:35:32
Message-ID: 20180620233532.fk6gwhwrf4fn5u7t@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

Per discussion at
https://postgr.es/m/0684A598-002C-42A2-AE12-F024A324EAE4@winand.at
I intend to change xpath() and xpath_exists() in a subtly backwards-
incompatible way, so that they match the behavior of SQL-standard-
specified XMLTABLE. It seems sane to keep them in sync. Anybody wants
to object so that we keep the historical functions alone and only change
XMLTABLE?

Previously, this query would return empty:
SELECT xpath('root', '<root/>');

xpath
───────
{}
(1 fila)

After this patch, it will return the root node:

xpath
───────────
{<root/>}
(1 fila)

Note that if an absolute path is used, the behavior is unchanged:

alvherre=# SELECT xpath('/root', '<root/>');
xpath
───────────
{<root/>}
(1 fila)

Please speak up if you think the former behavior should be kept.

--
Álvaro Herrera

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-06-20 23:38:23 Re: XML/XPath issues: text/CDATA in XMLTABLE, XPath evaluated with wrong context
Previous Message Andres Freund 2018-06-20 22:29:21 Re: Excessive CPU usage in StandbyReleaseLocks()