Re: Prepared statements with a variable number of parameters
В списке pgsql-general по дате отправления:
| От | Raymond O'Donnell |
|---|---|
| Тема | Re: Prepared statements with a variable number of parameters |
| Дата | |
| Msg-id | 4AD0FE83.90105@iol.ie обсуждение исходный текст |
| Ответ на | Re: Prepared statements with a variable number of parameters (Pavel Stehule <pavel.stehule@gmail.com>) |
| Список | pgsql-general |
On 10/10/2009 18:52, Pavel Stehule wrote:
> 2009/10/10 Raymond O'Donnell <rod@iol.ie>:
>> My question is, what do people normally do when there's a variable
>> number of parameters? - for example:
>>
>> select ..... where item_id in ( ... );
>>
>
> You can use arrays here.
>
> select ... where item_id = ANY(string_to_array($1, ','))
Nice one! Thanks Pavel.
My item_id values are integers, so I added ::integer[] to the above and
all works nicely:
...where item_id = any(string_to_array($1, ',')::integer[])
Thanks again,
Ray.
------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера