Re: Selecting values from comma separated string - Mailing list pgsql-sql

From Tom Lane
Subject Re: Selecting values from comma separated string
Date
Msg-id 11645.1251295508@sss.pgh.pa.us
Whole thread Raw
In response to Re: Selecting values from comma separated string  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Responses Re: Selecting values from comma separated string  (Nacef LABIDI <nacef.l@gmail.com>)
List pgsql-sql
"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


pgsql-sql by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Selecting values from comma separated string
Next
From: Nacef LABIDI
Date:
Subject: Re: Selecting values from comma separated string