On 15/11/2013 13:34, Luca Ferroni wrote:
> you are right, here is the example. In writing it I noticed an
> interesting behaviour.
> Prepared statements work with query like:
>
> prepare psyco_1 as SELECT * FROM "prova" WHERE "name" = $1
>
> but they raise ProgrammingError (syntaxerror SQL) with the operator IN
>
> prepare psyco_1 as SELECT * FROM "prova" WHERE "name" IN $1
IN has always had problems, not just when used thorugh psycopg. My
suggestion is to substitute it with ANY:
prepare psyco_1 as SELECT * FROM "prova" WHERE "name" = ANY($1).
Note that $1 should be an array (but isn't a problem when using psycopg,
just pass a list).
federico
--
Federico Di Gregorio federico.digregorio@dndg.it
Di Nunzio & Di Gregorio srl http://dndg.it
If a process is potentially good, but 90%+ of the time smart and
well-intentioned people screw it up, then it's a bad process.
-- Steve Yegge