Re: functions returning sets

From: Jeff Rogers <jrogers(at)findlaw(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: functions returning sets
Date: 2003-12-16 00:20:04
Message-ID: 200312160020.hBG0K4r01615@findlaw.com.
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> > select file from xml_files where 'foo' in (select pgxml_xpath(doc,'/top/nod
> e'))
> > parses, but it doesn't seem to give correct results.
>
> That should work as far as I know. Can you give more detail?
>
> regards, tom lane

Cut & paste from a window:

xml=# create table foo (id text, doc text) ;
CREATE TABLE
xml=# insert into foo values (1,'<top><node>a</node><node>b</node></top>');
INSERT 22106552 1
xml=# insert into foo values (2,'<top><node>a</node><node>b</node></top>');
INSERT 22106553 1
xml=# insert into foo values (3,'<top><node>a</node><node>b</node></top>');
INSERT 22106554 1
xml=# select id,pgxml_xpath(doc,'/top/node') from foo ;
id | pgxml_xpath
----+-------------
1 | a
1 | b
2 | a
2 | b
3 | a
3 | b
(6 rows)

xml=# select id from foo where 'a' in (select pgxml_xpath(doc,'/top/node'));
id
----
1
3
(2 rows)

I expect this latter to return all the ids, but it seems to only return every
other one.

-J

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2003-12-16 00:37:50 Re: ISO 8601 "Time Intervals" of the "format with time-unit
Previous Message Peter Eisentraut 2003-12-16 00:12:44 Re: [NOVICE] PostgreSQL Training