Re: PostgreSQL vs SQL/XML Standards

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Chapman Flack <chap(at)anastigmatix(dot)net>, Markus Winand <markus(dot)winand(at)winand(dot)at>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL vs SQL/XML Standards
Date: 2019-03-08 18:13:23
Message-ID: CAFj8pRDW_vqQxoyEz31b5r_fQvzMzwOm=KaVjJtJDm12_wzxXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pá 8. 3. 2019 v 15:31 odesílatel Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
napsal:

> On 2019-Mar-08, Pavel Stehule wrote:
>
> > looks like error in xmlXPathCompiledEval function, that produce little
> bit
> > broken result for XML_DOCUMENT_NODE type. I hadn't this problem with
> > libxml2 2.7.6 64bit, but I seen this issue on same version on 32bit.
> >
> > Currently I had not fresh 32 bit system to check it.
> >
> > I found a workaround - in this case copy (and release xmlNode) is not
> > necessary.
>
> Hmm ... going over the libxml2 2.7.6 source, I noticed that
> xmlFreeNodeList seem to get this right -- it uses xmlFreeDoc for
> XML_DOCUMENT_NODE. Maybe a sufficient answer is to change the
> xmlFreeNode there to xmlFreeNodeList.
>

It fixes current issue, but I afraid so these two routines are not
replaceable. xmlFreeNodeList doesn't release xmlFreeDtd, XML_ATTRIBUTE_NODE
is not checked.

You can see, from xmlNodeGetContent, XML_DOCUMENT_NODE type should to
ignore content value, and newer returns this value. Other interesting is
xmlXPathOrderDocElems where content is used for counting, and probably from
there is -1.

Maybe we can call explicitly xmlFreeDoc instead xmlFreeNode

some like

if (cur_copy->type == XML_DOCUMENT_NODE)
xmlFreeDoc((xmlDocPtr) cur_copy);
else
xmlFreeNode(cur_copy);

This looks most correct fix for me. What do you think?

Pavel

> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2019-03-08 18:14:11 Hash index initial size is too large given NULLs or partial indexes
Previous Message Tom Lane 2019-03-08 18:10:30 Re: Should we increase the default vacuum_cost_limit?