Re: xpath_list() function

From: George Weaver <gweaver(at)shaw(dot)ca>
To: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: xpath_list() function
Date: 2007-03-22 15:05:08
Message-ID: 006901c76c93$7bcf6450$6400a8c0@Dell4500
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Original Message From Andy Dale

>Hi,

>testdb=# SELECT film_name, xpath_list(description, 'year') FROM filminfo;
>film_name | xpath_list
>--------------- +------------
>Casablanca | 1942
>Rear Window | 1954
>The Godfather | 1972
>Test film | 1973,1972

>It would seem reasonable in this example that the 1973,1972 gained from
>xpath_list could be reused in a WHERE clause like so

>SELECT film_name WHERE '1973' IN (xpath_list(description, 'year'));

How about SELECT film_name WHERE (ARRAY['1973'] <@
STRING_TO_ARRAY((xpath_list(description, 'year')), ',' ); ?

(not tested...)

Regards,
George

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-03-22 15:11:01 Re: questions about query design
Previous Message Tom Lane 2007-03-22 15:02:02 Re: Insert fail: could not open relation with OID 3221204992