pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedpgxml & xpath_table
2+ messages / 2 participants
[nested] [flat]
* pgxml & xpath_table
@ 2006-06-08 16:00 Philippe Lang <philippe.lang@attiksystem.ch>
0 siblings, 1 reply; 2+ messages in thread
From: Philippe Lang @ 2006-06-08 16:00 UTC (permalink / raw)
To: pgsql-sql
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
Attachments:
smime.p7s (application/x-pkcs7-signature, 3.1K) download
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: pgxml & xpath_table
@ 2006-06-08 23:09 Jim C. Nasby <jnasby@pervasive.com>
parent: Philippe Lang <philippe.lang@attiksystem.ch>
0 siblings, 0 replies; 2+ messages in thread
From: Jim C. Nasby @ 2006-06-08 23:09 UTC (permalink / raw)
To: Philippe Lang <philippe.lang@attiksystem.ch>; +Cc: pgsql-sql
There's a good chance the author isn't on this list. You'd be better off
on pgsql-general, or just emailing the author of pgxml directly.
On Thu, Jun 08, 2006 at 06:00:42PM +0200, Philippe Lang wrote:
> 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
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-06-08 23:09 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-06-08 16:00 pgxml & xpath_table Philippe Lang <philippe.lang@attiksystem.ch>
2006-06-08 23:09 ` Jim C. Nasby <jnasby@pervasive.com>
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