Re: xpath changes in the recent back branches

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: xpath changes in the recent back branches
Date: 2015-03-04 16:18:53
Message-ID: CA+TgmoYqskRPsANMVCDhyqwvQ9YTpVeHDCKDKkwM2-VDf+zisQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 19, 2015 at 5:53 AM, Marko Tiikkaja <marko(at)joh(dot)to> wrote:
> 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.

That certainly sucks.

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

I'm guessing that the fact that it changes behavior in cases like this
wasn't recognized, but I suppose Peter will have to be the one to
comment on that.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2015-03-04 16:25:16 Re: improve pgbench syntax error messages
Previous Message Robert Haas 2015-03-04 16:11:28 Re: Combining Aggregates