pgsql: Fix XMLTABLE on older libxml2

Lists: pgsql-committers
From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix XMLTABLE on older libxml2
Date: 2017-03-08 16:30:46
Message-ID: E1cleUA-0001QS-1r@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Fix XMLTABLE on older libxml2

libxml2 older than 2.9.1 does not have xmlXPathSetContextNode (released
in 2013, so reasonable platforms have trouble). That function is fairly
trivial, so I have inlined it in the one added caller. This passes
tests on my machine; let's see what the buildfarm thinks about it.

Per joint complaint from Tom Lane and buildfarm.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a9f66f92533b2bfd7abf289219152091b7697e87

Modified Files
--------------
src/backend/utils/adt/xml.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix XMLTABLE on older libxml2
Date: 2017-03-08 17:51:11
Message-ID: 9178.1488995471@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> Fix XMLTABLE on older libxml2
> libxml2 older than 2.9.1 does not have xmlXPathSetContextNode (released
> in 2013, so reasonable platforms have trouble). That function is fairly
> trivial, so I have inlined it in the one added caller. This passes
> tests on my machine; let's see what the buildfarm thinks about it.

> Per joint complaint from Tom Lane and buildfarm.

Thanks, this works for me. At some point we might need to do this more
honestly, ie add a configure probe and do

#ifdef HAVE_XMLXPATHSETCONTEXTNODE
xmlXPathSetContextNode(cur, xtCxt->xpathcxt);
#else
xtCxt->xpathcxt->node = cur;
#endif

but that can probably wait until libxml does something that breaks
the direct-assignment coding. If the latter is the way you were
supposed to do it before, I think they'd be hesitant to break it.

regards, tom lane