Re: xpath_list() function

From: "Andy Dale" <andy(dot)dale(at)gmail(dot)com>
To: "George Weaver" <gweaver(at)shaw(dot)ca>
Cc: "pgsql general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: xpath_list() function
Date: 2007-03-22 15:45:17
Message-ID: faa313130703220845x4fd824d4g43ad28698e4548aa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Unfortunately the suggestion by Geogre did not work, but i solved it like
so:

SELECT film_name FROM filminfo
WHERE '1973' = ANY (STRING_TO_ARRAY((xpath_list(description, 'year')),','))

Thanks,

Andy

On 22/03/07, George Weaver <gweaver(at)shaw(dot)ca> wrote:
>
>
> 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
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bob Pawley 2007-03-22 15:49:41 Server
Previous Message Douglas McNaught 2007-03-22 15:33:18 Re: using 'ALTER ROLE' in a function