XPath to search for elements in a sequence

From: Brad Balmer <bbalmer(at)peapod(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: XPath to search for elements in a sequence
Date: 2009-01-13 20:45:50
Message-ID: 24983175.113511231879550147.JavaMail.root@pmsvl02
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

With XML similar to:

< a >
< b >
< c > 1 </ c >
< c > 2 </ c >
< c > 3 </ c >
</ b >

I'm trying to create an xpath expression (for a postgresql query) that will return if is a particular value and not that is all three values.

What I currently have (which does not work) is:

select * from someTable where xpath ('//uim:a/text()', job, ARRAY[ ARRAY['uim',' http://www.cmpy.com/uim '] ])::text[] IN (ARRAY['1','3']);

If I try with ARRAY['1'] this will not return any values but with ARRAY['1','2','3'] it will return all three.

How can I select based on a single element in a sequence?

Thanks.

Browse pgsql-general by date

  From Date Subject
Next Message Mohamed 2009-01-13 20:56:56 Returning number of matches on a query when using limit
Previous Message Steve Atkins 2009-01-13 20:41:44 Re: Use PSQLFS for photo storage