Re: Using PL/pgSQL text argument in 'IN (INT, INT, ...)' clause [re-post]
Richard Broersma <richard.broersma@gmail.com>
From: Richard Broersma <richard.broersma@gmail.com>
To: Axel Rau <Axel.Rau@chaos1.de>
Cc: pgsql-sql@postgresql.org
Date: 2010-10-25T16:17:01Z
Lists: pgsql-sql
On Mon, Oct 25, 2010 at 9:07 AM, Axel Rau <Axel.Rau@chaos1.de> wrote: > I have a function argument blah of type text containing something like > 33,44,55,66 > . Can I cast it in some way to use it in an IN clause as integers like > UPDATE foo SET x = y WHERE id IN ( blah ); Here is what I think should work: UPDATE foo Set x = y WHERE id = ANY( CAST( string_to_array( '1,2,3,4', ',' ) AS INTEGER[] )); -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug