Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Axel Rau <Axel(dot)Rau(at)chaos1(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause
Date: 2010-10-29 17:07:16
Message-ID: AANLkTim9X9FnKegxhm9EdwUfT4SPC_rbmG54d1-reh8R@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hey Axel,

How about this solution:
UPDATE foo SET x = y WHERE ANY(string_to_array(blah, ',')) = id;
?

2010/10/25 Axel Rau <Axel(dot)Rau(at)chaos1(dot)de>

> Good morning,
>
> 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 );
> or need I revert to dynamic SQL (EXECUTE...) ?
>
> Thanks, Axel
> ---
> axel(dot)rau(at)chaos1(dot)de PGP-Key:29E99DD6 +49 151 2300 9283 computing @ chaos
> claudius
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

--
// Dmitriy.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Dmitriy Igrishin 2010-10-29 17:11:31 Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause
Previous Message venkat 2010-10-29 05:29:59 Re: [SQL] How to Convert Integer to Serial