xpath differences between postgres 11.4 and 10.3

From: Felipe de Jesús Molina Bravo <fjmolinabravo(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: xpath differences between postgres 11.4 and 10.3
Date: 2019-07-05 19:22:55
Message-ID: CALrs2KPc7eNGTa344bsUq1PpuQEdgL4MDyhaEH5JfNRVJUba8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!!

I have an strange behavior between 11.4 and 10.3 with xpath function:

With pgsql 10.3 i have:
select xpath('@idc', '<p idc="4776" rc="Cuadro" idrg="5"/>' ) ;
xpath
--------
{4776}
(1 fila)

and with pgsql 11.4:
select xpath('@idc', '<p idc="4776" rc="Cuadro" idrg="5"/>'::xml ) ;
xpath
-------
{}
(1 fila)

Now, if change the expression with "//":
select xpath('//@idc', '<p idc="4776" rc="Cuadro" idrg="5"/>'::xml ) ;
xpath
--------
{4776}
(1 fila)

In release notes for postgresql 11 say:

-

*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.*

Despite this note I do not undertand why it behaves differently ... or
maybe I do not understand the note well ... what do you think?

thanks in advance!

regards!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message PegoraroF10 2019-07-05 20:01:00 Re: Converting to identity columns with domains on PK columns
Previous Message Michael Lewis 2019-07-05 18:59:29 Re: PostgreSQL upgrade from 9.4.2 to 9.6.12