Re: Selecting values from comma separated string

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Nacef LABIDI <nacef(dot)l(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Selecting values from comma separated string
Date: 2009-08-26 14:58:31
Message-ID: 162867790908260758t370d8adekbcad4342bf545e1d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2009/8/26 Nacef LABIDI <nacef(dot)l(at)gmail(dot)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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>> "A. Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)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(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-sql
>
>
>
> --
> Nacef LABIDI
> nacef(dot)l(at)gmail(dot)com
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Erik Jones 2009-08-26 18:20:39 Re: Advice returning data as an array
Previous Message Nacef LABIDI 2009-08-26 14:13:39 Re: Selecting values from comma separated string