Re: possible bug in xpath function

From: Andrey Kapliev <a(dot)kapliev(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: possible bug in xpath function
Date: 2022-03-11 16:09:16
Message-ID: AM8PR04MB7380CC16C61DA2E9BC742FEBA70C9@AM8PR04MB7380.eurprd04.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi, I did not mensioned it but there is no difference in behavoir with relative and absolute paths. It throws error - invalid XPath statement in any case when I'm trying to use any of name(), local-name(), namespace-uri() functionse irrelative of path stated

Best regards,
Andrey

Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Sent: Friday, March 11, 2022 6:53:15 PM
To: Andrey Kapliev <a(dot)kapliev(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: possible bug in xpath function

Andrey Kapliev <a(dot)kapliev(at)gmail(dot)com> writes:
> It looks like XPATH name() function called from xpath() PostgreSQL
> function behave differently than when called from XMLTABLE()
> PATH.

Your examples are by no means equivalent: in particular the XMLTABLE
example is using an absolute path //* while the xpath example
is implicitly using a relative path.

> This
> behavior is different from that of 9.6 version where xpath correctly
> returns names of the nodes.

I think this was an intentional change in v11. The 11.0 release
notes mention

* Correctly handle relative path expressions in xmltable(), xpath(), and
other XML-handling functions (Markus Winand)

Per the SQL standard, relative paths start from the document node of
the XML input document, not the root node as these functions
previously did.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-03-11 17:23:24 Re: BUG #17409: Unable to alter data type of clustered column which is referenced by foreign key
Previous Message Tom Lane 2022-03-11 15:53:15 Re: possible bug in xpath function