> > 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