Re: BUG #16091: xpath fails to compute "name()", regression

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: cherio(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16091: xpath fails to compute "name()", regression
Date: 2019-10-30 18:10:26
Message-ID: 15301.1572459026@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> After upgrading postgresql from 9 to 12 the following statement no longer
> produces the same result: SELECT xpath('name()', '<abc>xyz</abc>'::XML)

> PostgreSQL 9 returns '{abc}'
> PostgreSQL 12 returns '{""}'

> This behavior changed in version 11 and perpetuated into 12.

This looks to me to be an intentional change in xpath's behavior.
The v11 release notes call out the incompatibility:

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.

Perhaps 'name(/*)' would do what you want now.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2019-10-30 18:16:12 Re: memory problems and crash of db when deleting data from table with thousands of partitions
Previous Message PG Bug reporting form 2019-10-30 16:58:33 BUG #16091: xpath fails to compute "name()", regression