Re: possible bug in xpath function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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
Date: 2022-03-11 15:53:15
Message-ID: 877002.1647013995@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey Kapliev 2022-03-11 16:09:16 Re: possible bug in xpath function
Previous Message Masahiko Sawada 2022-03-11 15:39:53 Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end