Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 1581A1337B6C for ; Fri, 29 Oct 2010 14:07:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 73700-09 for ; Fri, 29 Oct 2010 17:07:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qy0-f174.google.com (mail-qy0-f174.google.com [209.85.216.174]) by mail.postgresql.org (Postfix) with ESMTP id CFD08133740B for ; Fri, 29 Oct 2010 14:07:20 -0300 (ADT) Received: by qyk12 with SMTP id 12so6916730qyk.19 for ; Fri, 29 Oct 2010 10:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=35NXCviG9ollAUV/133LQqT5TV/NUA3g4UnL9Voh57w=; b=mSm1llcolqFzWobWg+zLeTZHnIokhDuwAXgcX1JRVe1+5/wK5JTTuceL6bx36m8Pw/ Y1SenC6zGonblJ+hS99AF9xLoY7bIutaWZ3xJmJwdXWkdvCsijCi1kfBaw04YCaE72jt ThCNASBDnZrgFkaMhERO34U2WJT6wku9Nw6kQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=vlV7Zj63F50jVo6EbcfQUFLspoCKgzUr/ahrIVbkzc4ORcOKAs8zTiEwwIq5u7OnC0 0xeUbOIYGwhnGv++TZq5SAycL7sky3oB92WikpgbVaNj1ndtftlr0k/VZ4FtmBBoS6lX mTli5h0J41fimrajWxDCWj+DMIF1nzEApnM7w= MIME-Version: 1.0 Received: by 10.224.191.129 with SMTP id dm1mr5996578qab.31.1288372040289; Fri, 29 Oct 2010 10:07:20 -0700 (PDT) Received: by 10.229.184.70 with HTTP; Fri, 29 Oct 2010 10:07:16 -0700 (PDT) In-Reply-To: References: Date: Fri, 29 Oct 2010 21:07:16 +0400 Message-ID: Subject: Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause From: Dmitriy Igrishin To: Axel Rau Cc: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=20cf300fb3dbccce670493c47d74 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/71 X-Sequence-Number: 34722 --20cf300fb3dbccce670493c47d74 Content-Type: text/plain; charset=UTF-8 Hey Axel, How about this solution: UPDATE foo SET x = y WHERE ANY(string_to_array(blah, ',')) = id; ? 2010/10/25 Axel Rau > 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.rau@chaos1.de PGP-Key:29E99DD6 +49 151 2300 9283 computing @ chaos > claudius > > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > -- // Dmitriy. --20cf300fb3dbccce670493c47d74 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hey Axel,

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

2010/10/25 Axel Rau <Axel.Rau@chaos1.de>
Good morning,

I have a function argument blah of type text containing something like
=C2=A0 =C2=A033,44,55,66
. Can I cast it in some way to use it in an IN clause as integers like
=C2=A0 =C2=A0UPDATE foo SET x =3D y WHERE id IN ( blah );
or need I revert to dynamic SQL (EXECUTE...) ?

Thanks, Axel
---
axel.rau@chaos1.de<= /a> =C2=A0PGP-Key:29E99DD6 =C2=A0+49 151 2300 9283 =C2=A0computing @ chaos = claudius


--
Sent via pgsql-sql mailing list (
pgsql-sql@postgresql.org)
To make changes to your subscription:
= http://www.postgresql.org/mailpref/pgsql-sql



--
// Dmitriy.
<= br>
--20cf300fb3dbccce670493c47d74--