pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitriy Igrishin <dmitigr@gmail.com>
To: Axel Rau <Axel.Rau@chaos1.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause
Date: Fri, 29 Oct 2010 21:07:16 +0400
Message-ID: <AANLkTim9X9FnKegxhm9EdwUfT4SPC_rbmG54d1-reh8R@mail.gmail.com> (raw)
In-Reply-To: <BE3606F5-FE4F-4661-B6B1-36DC10488BD6@Chaos1.DE>
References: <BE3606F5-FE4F-4661-B6B1-36DC10488BD6@Chaos1.DE>

Hey Axel,

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

2010/10/25 Axel Rau <Axel.Rau@chaos1.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.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.

view thread (7+ messages)  latest in thread

Message-ID: <AANLkTim9X9FnKegxhm9EdwUfT4SPC_rbmG54d1-reh8R@mail.gmail.com>
Permalink:  ../AANLkTim9X9FnKegxhm9EdwUfT4SPC_rbmG54d1-reh8R@mail.gmail.com/
Also on:    postgresql.org/message-id/AANLkTim9X9FnKegxhm9EdwUfT4SPC_rbmG54d1-reh8R@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dmitigr@gmail.com, Axel.Rau@chaos1.de
  Subject: Re: Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause
  In-Reply-To: <AANLkTim9X9FnKegxhm9EdwUfT4SPC_rbmG54d1-reh8R@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox