From: Pavel Stehule <pavel.stehule@gmail.com>
To: Nacef LABIDI <nacef.l@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: A. Kretschmer <andreas.kretschmer@schollglas.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Selecting values from comma separated string
Date: Wed, 26 Aug 2009 16:58:31 +0200
Message-ID: <162867790908260758t370d8adekbcad4342bf545e1d@mail.gmail.com> (raw)
In-Reply-To: <f16f7ea00908260713lf27490cha9c66400ff5f14c5@mail.gmail.com>
References: <f16f7ea00908260619t59555d37u66bebfe47132304f@mail.gmail.com>
<20090826133036.GK32599@a-kretschmer.de>
<11645.1251295508@sss.pgh.pa.us>
<f16f7ea00908260713lf27490cha9c66400ff5f14c5@mail.gmail.com>
2009/8/26 Nacef LABIDI <nacef.l@gmail.com>:
> 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 <tgl@sss.pgh.pa.us> wrote:
>>
>> "A. Kretschmer" <andreas.kretschmer@schollglas.com> writes:
>> > In response to Nacef LABIDI :
>> >> I want to write a function that takes as param a comma separated values
>> >> string
>> >> and perform a select matching these values.
>>
>> > Use EXECUTE sql_string,
>>
>> Safer to use string_to_array, for instance
>>
>> ... WHERE id = 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.
>>
>> regards, 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
>
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: pavel.stehule@gmail.com, nacef.l@gmail.com, tgl@sss.pgh.pa.us, andreas.kretschmer@schollglas.com
Subject: Re: Selecting values from comma separated string
In-Reply-To: <162867790908260758t370d8adekbcad4342bf545e1d@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