Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause [re-post]

Поиск
Список
Период
Сортировка
От Richard Broersma
Тема Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause [re-post]
Дата
Msg-id AANLkTim9K8g6uCEYU95BU2zAZZSUmMr3+Xi96wxsyGYi@mail.gmail.com
обсуждение исходный текст
Ответ на Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause [re-post]  (Axel Rau <Axel.Rau@Chaos1.DE>)
Ответы Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause [re-post]  (Axel Rau <Axel.Rau@chaos1.de>)
Список 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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Axel Rau
Дата:
Сообщение: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause [re-post]
Следующее
От: Sergey Konoplev
Дата:
Сообщение: Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause [re-post]