Re: Secure "where in(a,b,c)" clause. - Mailing list pgsql-general

From William Temperley
Subject Re: Secure "where in(a,b,c)" clause.
Date
Msg-id 439dc11e0804040211k48ce9047wad6c52bb1289b736@mail.gmail.com
Whole thread Raw
In response to Secure "where in(a,b,c)" clause.  ("William Temperley" <willtemperley@gmail.com>)
List pgsql-general
Thanks for the replies,

"Rodrigo E. De León Plicet" <rdeleonp@gmail.com> wrote:
>Use a prepared query and ANY, e.g.:
>select st_collect(the_geom) from tiles
>where tilename = any('{foo,bar,baz}');

Thanks, that's what I was looking for!
$sql = "select uid, accredited as acc, x(the_geom), y(the_geom) from clubs
where st_within(the_geom, (select st_collect(the_geom) from tiles
where tilename = any($1)))";

$result = pg_query_params($sql, array('{'.$tilearr.'}'));

Though a regex would do as well I guess.

Cheers

Will

pgsql-general by date:

Previous
From: windwxc@sina.com
Date:
Subject: how to insert values into complex type field
Next
From: Gregory Stark
Date:
Subject: Re: is it helpful for the optimiser/planner to add LIMIT 1