PostgreSQL vs SQL/XML Standards

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
112 messages Options
1 ... 3456
Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Alvaro Herrera-9
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.

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

Reply | Threaded
Open this post in threaded view
|

Re: House style for DocBook documentation?

Chapman Flack
In reply to this post by Peter Eisentraut-6
On 3/8/19 7:38 AM, Peter Eisentraut wrote:
> On 2019-03-08 05:04, Chapman Flack wrote:
>> -o  If you want to supply text, use <link>, else <xref>
>> +o  If you want to supply text, use <link> or <ulink>, else <xref>
>
> The choice of <link> vs <xref> is for internal links.  For external
> links you have to use <ulink>.

Understood, but I was thinking of the unintended message possibly
taken by a fast reader who wants to create an external link but also
wants to supply text. "I want to supply text! Is ulink not an option?"

Perhaps:

o  For an internal link, use <link> if you will supply text, else <xref>
o  For an external link, use <ulink> with or without link text

-Chap

Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Pavel Stehule
In reply to this post by Alvaro Herrera-9


pá 8. 3. 2019 v 15:31 odesílatel Alvaro Herrera <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Alvaro Herrera-9
(I spent some time trying to reproduce the original bug, but was
interrupted for lunch before getting a useful installation.  I find it a
bit strange that it doesn't crash in x86_64, mind ...)

On 2019-Mar-08, Pavel Stehule wrote:

> 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.

:-(

> 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?

Seems like that should work, yeah ...

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

Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Alvaro Herrera-9
On 2019-Mar-08, Alvaro Herrera wrote:

> > 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?
>
> Seems like that should work, yeah ...
Something like this perhaps?  Less repetitive ...

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

xml-more-robust-handling-3.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Pavel Stehule


pá 8. 3. 2019 v 19:44 odesílatel Alvaro Herrera <[hidden email]> napsal:
On 2019-Mar-08, Alvaro Herrera wrote:

> > 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?
>
> Seems like that should work, yeah ...

Something like this perhaps?  Less repetitive ...

+1

Pavel


--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Pavel Stehule


pá 8. 3. 2019 v 19:48 odesílatel Pavel Stehule <[hidden email]> napsal:


pá 8. 3. 2019 v 19:44 odesílatel Alvaro Herrera <[hidden email]> napsal:
On 2019-Mar-08, Alvaro Herrera wrote:

> > 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?
>
> Seems like that should work, yeah ...

Something like this perhaps?  Less repetitive ...

Thank you for commit.

the commit message is not correct. xmlCopyNodes does owns works well, but the node is broken already, and because we should to call xmlFreeNode, we have a problem.

regards

Pavel


+1

Pavel


--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Pavel Stehule
In reply to this post by Alvaro Herrera-9
Hi

pá 8. 3. 2019 v 19:44 odesílatel Alvaro Herrera <[hidden email]> napsal:
On 2019-Mar-08, Alvaro Herrera wrote:

> > 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?
>
> Seems like that should work, yeah ...

Something like this perhaps?  Less repetitive ...

I looking to code

        void        (*nodefree) (xmlNodePtr) = NULL;
        volatile xmlBufferPtr buf = NULL;

should not be "nodefree" volatile too?

Pavel
 

--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Alvaro Herrera-9
On 2019-Mar-14, Pavel Stehule wrote:

> I looking to code
>
>         void        (*nodefree) (xmlNodePtr) = NULL;
>         volatile xmlBufferPtr buf = NULL;
>
> should not be "nodefree" volatile too?

Ah, good question.  I remember I had it volatile and removed it for some
reason, though I don't remember why.

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

Reply | Threaded
Open this post in threaded view
|

Re: House style for DocBook documentation?

Peter Eisentraut-6
In reply to this post by Chapman Flack
On 2019-03-08 15:38, Chapman Flack wrote:
> Perhaps:
>
> o  For an internal link, use <link> if you will supply text, else <xref>
> o  For an external link, use <ulink> with or without link text

I have pushed an update to this effect.

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Alvaro Herrera-9
In reply to this post by Chapman Flack
On 2018-Oct-24, Chapman Flack wrote:

> Inspired by the wiki page on PostgreSQL vs SQL Standard in general,
> I have made another wiki page specifically about $subject. I hope
> this was not presumptuous, and invite review / comment. I have not
> linked to it from any other page yet.

In the SQL Standards session at the Unconference, I found out that the
committee produced this technical report in 2011:
https://www.iso.org/standard/41528.html "XQuery Regular Expression
Support in SQL"; it furthers our lack of support for XQuery in our
implementation SQL/XML.  That content is probably relevant for this
topic, even if we cannot do much about it.

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


Reply | Threaded
Open this post in threaded view
|

Re: PostgreSQL vs SQL/XML Standards

Chapman Flack
On 05/31/19 16:04, Alvaro Herrera wrote:

> https://www.iso.org/standard/41528.html "XQuery Regular Expression
> Support in SQL"

Although I hadn't seen that particular document, I did see those in the
SQL spec and mention them in the wiki page [1].

I should point out that's also a conformance note in the new SQL/JSON
support [2], as the standard specifies XQuery regular expressions for
jsonpath's like_regex predicate, where we're applying POSIX ones
instead.

Doesn't change my thinking much ... I think we should support the
stuff. :) ... using a non-in-house-developed XQuery library to do it,
or better yet, a choice of non-in-house-developed XQuery libraries.

I still think the second idea I suggested on the wiki seems like the
most promising road map [3], though it'll involve a few preparatory
stops along the way.

-Chap



[1]
https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL/XML_Standards#XML_Query_regular_expressions

[2]
https://github.com/obartunov/sqljsondoc/blob/master/README.jsonpath.md#sqljson-conformance

[3]
https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL/XML_Standards#Proposal_2:_desugaring_to_calls_on_normal_extension_functions


1 ... 3456