pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexandre <ultrago@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5859: XML result in line and column
Date: Tue, 01 Feb 2011 13:22:43 -0500
Message-ID: <29614.1296584563@sss.pgh.pa.us> (raw)
In-Reply-To: <201102011520.p11FKpLt022295@wwwmaster.postgresql.org>
References: <201102011520.p11FKpLt022295@wwwmaster.postgresql.org>

"Alexandre" <ultrago@gmail.com> writes:
> SELECT * FROM
> xpath_table('sequencia',
>             'registro',
>             'auditoria_anterior',
>             'name(/ROOT/CLIENTES/*)|/ROOT/CLIENTES/*',
>             'sequencia = 1')
> AS t(sequencia integer, coluna text, valor text)

> --Incorrect result-----------------------------------
> sequencia   coluna            valor
> integer     text              text
> --------------------------------------------------
> 1           CGC_CPF_CLIENTE   12345678901
> 1           CGC_CPF_CLIENTE   1
> 1           CGC_CPF_CLIENTE   F
> 1           CGC_CPF_CLIENTE   JOAO DA SILVA


> --Result that would be right to be presented----------
> sequencia   coluna            valor
> integer     text              text
> --------------------------------------------------
> 1           CGC_CPF_CLIENTE   12345678901
> 1           TIPO              1
> 1           PESSOA            F
> 1           NOME              JOAO DA SILVA

I can reproduce this on Fedora 13 (with libxml2-2.7.7-1.fc13.x86_64).
I traced through it and find that libxml returns a simple XPATH_STRING
result for the name() query, whereas the second query returns an
XPATH_NODESET containing the four values shown.  So either this behavior
is correct, or it's a libxml bug not ours.  I don't know XPath well
enough to know whether name() ought to return more than one value here.

Note that there are some other pretty serious known issues in this
same area, see
http://archives.postgresql.org/pgsql-hackers/2010-02/msg02424.php
Overall it seems like the libxml API is not designed to handle multiple
parallel queries, or maybe we just don't know how to use it for that.

			regards, tom lane



view thread (3+ messages)

Message-ID: <29614.1296584563@sss.pgh.pa.us>
Permalink:  ../29614.1296584563@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29614.1296584563@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ultrago@gmail.com
  Subject: Re: BUG #5859: XML result in line and column
  In-Reply-To: <29614.1296584563@sss.pgh.pa.us>
  References: <201102011520.p11FKpLt022295@wwwmaster.postgresql.org> <29614.1296584563@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox