Re: [SQL] Selecting values from comma separated string

2009-08-26 Thread Tom Lane
"A. Kretschmer" 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_

Re: [SQL] Selecting values from comma separated string

2009-08-26 Thread Pavel Stehule
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 We

Re: [SQL] Selecting values from comma separated string

2009-08-26 Thread 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. 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

Re: [SQL] Selecting values from comma separated string

2009-08-26 Thread Pavel Stehule
2009/8/26 A. Kretschmer : > In response to Nacef LABIDI : >> Hi all, >> >> I want to write a function that takes as param a comma separated values >> string >> and perform a select matching these values. >> >> Here is the string '1,3,7,8' >> >> And I wan to perform a : SELECT * FROM my_table WHERE

Re: [SQL] Selecting values from comma separated string

2009-08-26 Thread Pavel Stehule
Hello postgres=# select * from foo; +---+---+ | i | a | +---+---+ | 1 | a | | 2 | b | | 3 | c | +---+---+ (3 rows) Time: 0,654 ms postgres=# select * from foo where i = ANY (string_to_array('1,3',',')::int[]); +---+---+ | i | a | +---+---+ | 1 | a | | 3 | c | +---+---+ (2 rows) Time: 0,914 ms r

Re: [SQL] Selecting values from comma separated string

2009-08-26 Thread A. Kretschmer
In response to Nacef LABIDI : > Hi all, > > I want to write a function that takes as param a comma separated values string > and perform a select matching these values. > > Here is the string '1,3,7,8' > > And I wan to perform a : SELECT * FROM my_table WHERE id IN (1, 3, 7, 8); Use EXECUTE sql

[SQL] Selecting values from comma separated string

2009-08-26 Thread Nacef LABIDI
Hi all, I want to write a function that takes as param a comma separated values string and perform a select matching these values. Here is the string '1,3,7,8' And I wan to perform a : SELECT * FROM my_table WHERE id IN (1, 3, 7, 8); Does anyone have a clue ? Thanks Nacef