Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 1C8DE636D07 for ; Wed, 26 Aug 2009 11:59:46 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 41450-03-5 for ; Wed, 26 Aug 2009 14:59:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f184.google.com (mail-px0-f184.google.com [209.85.216.184]) by mail.postgresql.org (Postfix) with ESMTP id 02632633549 for ; Wed, 26 Aug 2009 11:58:33 -0300 (ADT) Received: by pxi14 with SMTP id 14so138163pxi.19 for ; Wed, 26 Aug 2009 07:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=wV/7urWfFvMXLFQnywveUKa2eOfQt82b6Zi686q1KpU=; b=R7LuT8Cyt2mjSWp/q4IwF/NvXWb6jBU0UP1XRU7V/BQWMqx3ivUHbfdaWeTbcps8mo Fbh3oFiiiOu6soPxdJtuCUK72uwHCU32mgkslGznndWrobQ7oW6sCo0FUd869E+1Doy2 mbYTl7gcpxBY188/Sswbee4/T1dB4rnHCWrbc= 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:content-transfer-encoding; b=Z5bBh8TNGMH2iK2h6tM4UtC/AnyQ9Pb+rSbTjXHeCSp01V1GxjJ0quvQdH7arhFJg6 mBzM+fHMZvIBc2k1srptwoiKjdE4d5cA4aTdmun+cRr3qH9Mgz8pscCPKDFT6FAe4pSu fXxCbSmOj0hMlVMnKMx5d2SYHOZsVoP9Kh+uk= MIME-Version: 1.0 Received: by 10.141.44.18 with SMTP id w18mr3603296rvj.272.1251298711704; Wed, 26 Aug 2009 07:58:31 -0700 (PDT) In-Reply-To: References: <20090826133036.GK32599@a-kretschmer.de> <11645.1251295508@sss.pgh.pa.us> Date: Wed, 26 Aug 2009 16:58:31 +0200 Message-ID: <162867790908260758t370d8adekbcad4342bf545e1d@mail.gmail.com> Subject: Re: Selecting values from comma separated string From: Pavel Stehule To: Nacef LABIDI Cc: Tom Lane , "A. Kretschmer" , pgsql-sql@postgresql.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/133 X-Sequence-Number: 33042 2009/8/26 Nacef LABIDI : > Here I come again to ask how can I pass an array of values to a pgsql > function when I call this function from a delphi program for example. > the driver have to support it. But why? simply you can use varchar and string_to_array function. Pavel > Nacef > > > > On Wed, Aug 26, 2009 at 3:05 PM, Tom Lane wrote: >> >> "A. Kretschmer" writes: >> > In response to Nacef LABIDI : >> >> I want to write a function that takes as param a comma separated valu= es >> >> string >> >> and perform a select matching these values. >> >> > Use EXECUTE sql_string, >> >> Safer to use string_to_array, for instance >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0... WHERE id =3D ANY(string_to_array('1,3,7,8= ', ',')::int[]) ... >> >> Of course this just begs the question of why the OP doesn't use an >> array in the first place. >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0regards, tom lane >> >> -- >> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-sql > > > > -- > Nacef LABIDI > nacef.l@gmail.com >