pgxml & xpath_table

From: "Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch>
To: <pgsql-general(at)postgresql(dot)org>
Cc: <jeroen(at)design(dot)nl>
Subject: pgxml & xpath_table
Date: 2006-06-09 06:43:51
Message-ID: 6C0CF58A187DA5479245E0830AF84F421D0DB8@poweredge.attiksystem.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

Hi,

I'm playing with the contrib/pgxml library under PG 8.1.4, and I'm not sure if what I found with pgxml is a feature of a bug:

I've got the following table:

--------------------
CREATE TABLE test
(
id int4 NOT NULL,
xml varchar(200),
CONSTRAINT pk PRIMARY KEY (id)
)
WITHOUT OIDS;

INSERT INTO test VALUES (1, '<doc num="C1"><line num="L1"><a>1</a><b>2</b><c>3</c></line><line num="L2"><a>11</a><b>22</b><c>33</c></line></doc>');

INSERT INTO test VALUES (2, '<doc num="C2"><line num="L1"><a>111</a><b>222</b><c>333</c></line><line num="L2"><a>111</a><b>222</b><c>333</c></line></doc>');
--------------------

If I launch this query:

--------------------
select * from

xpath_table('id','xml','test', '/doc/@num|/doc/line/@num|/doc/line/a|/doc/line/b|/doc/line/c','1=1') AS t(id int4, doc_num varchar(10), line_num varchar(10), val1 int4, val2 int4, val3 int4)

where id = 1

order by doc_num, line_num
--------------------

I get:

--------------------
id doc_num line_num val1 val2 val3
1 C1 L1 1 2 3
1 L2 11 22 33
--------------------

I was expecting doc_num would receive twice the C1 value, just like with a normal sql join.

Regards,

----------------------------------
Philippe Lang, Ing. Dipl. EPFL
Attik System
rte de la Fonderie 2
1700 Fribourg
Switzerland
http://www.attiksystem.ch

Tel: +41 (26) 422 13 75
Fax: +41 (26) 422 13 76

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Qingqing Zhou 2006-06-09 07:05:31 Re: Insert into partition table hangs
Previous Message Matthew T. O'Connor 2006-06-09 05:37:23 Re: UTF8 problem

Browse pgsql-patches by date

  From Date Subject
Next Message Andreas Pflug 2006-06-09 09:34:23 Re: Patch for - Allow server logs to be remotely read
Previous Message Dhanaraj M 2006-06-09 05:35:03 Re: Patch for - Allow server logs to be remotely read