Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 412721337999 for ; Tue, 1 Feb 2011 14:22:53 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 86020-01 for ; Tue, 1 Feb 2011 18:22:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id B13BD13364DE for ; Tue, 1 Feb 2011 14:22:45 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p11IMhfn029615; Tue, 1 Feb 2011 13:22:43 -0500 (EST) To: "Alexandre" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5859: XML result in line and column In-reply-to: <201102011520.p11FKpLt022295@wwwmaster.postgresql.org> References: <201102011520.p11FKpLt022295@wwwmaster.postgresql.org> Comments: In-reply-to "Alexandre" message dated "Tue, 01 Feb 2011 15:20:51 +0000" Date: Tue, 01 Feb 2011 13:22:43 -0500 Message-ID: <29614.1296584563@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/13 X-Sequence-Number: 29285 "Alexandre" 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