xpath changes in the recent back branches - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject xpath changes in the recent back branches
Date
Msg-id 54E5C0B1.6040001@joh.to
Whole thread Raw
Responses Re: xpath changes in the recent back branches  (Robert Haas <robertmhaas@gmail.com>)
Re: xpath changes in the recent back branches  (Mike Rylander <mrylander@gmail.com>)
List pgsql-hackers
Hi,

Commit 79af9a1d2668c9edc8171f03c39e7fed571eeb98 changed xpath handling 
with regard to namespaces, and it seems to be fixing an actual issue. 
However, it was also backpatched to all branches despite it breaking for 
example code like this:

do $$
declare
_x xml;
begin
_x := (xpath('/x:Foo/x:Bar', xml '<Foo 
xmlns="teh:urn"><Bar><Baz>1</Baz><Bat>2</Bat></Bar></Foo>', 
array[['x','teh:urn']]))[1];
raise notice '%', xpath('/Bar/Baz/text()', _x);
raise notice '%', xpath('/Bar/Bat/text()', _x);
end
$$;

The problem is that there's no way to write the code like this in such a 
way that it would work on both versions.  If I add the namespace, it's 
broken on 9.1.14.  Without it it's broken on 9.1.15.

I'm now thinking of adding a workaround which strips namespaces, but 
that doesn't seem to be easy to do, even with PL/Perl.  Is there a 
better workaround here that I'm not seeing?

I'm not sure how changing behavior like this in a minor release was 
considered acceptable.


.m



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: pg_basebackup may fail to send feedbacks.
Next
From: Heikki Linnakangas
Date:
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE} 2.0