Re: BUG #5859: XML result in line and column

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Alexandre" <ultrago(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5859: XML result in line and column
Date: 2011-02-01 18:22:43
Message-ID: 29614.1296584563@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Alexandre" <ultrago(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Steve White 2011-02-01 18:50:04 Re: Feature request: include script file into function body
Previous Message Bruce Momjian 2011-02-01 18:12:15 Re: Feature request: include script file into function body