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)
xpath
--------
{4776}
(1 fila)
and with pgsql 11.4:
select xpath('@idc', '<p idc="4776" rc="Cuadro" idrg="5"/>'::xml ) ;
xpath
-------
{}
(1 fila)
xpath
-------
{}
(1 fila)
Now, if change the _expression_ with "//":
select xpath('//@idc', '<p idc="4776" rc="Cuadro" idrg="5"/>'::xml ) ; xpath
--------
{4776}
(1 fila)
--------
{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!