Re: Argument type list

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Argument type list
Дата
Msg-id 10494.1187893628@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Argument type list  (Erik Jones <erik@myemma.com>)
Ответы Re: Argument type list
Список pgsql-general
Erik Jones <erik@myemma.com> writes:
> On Aug 23, 2007, at 11:56 AM, Gustavo Tonini wrote:
>> I want to create a function that receive a list argument and filter
>> data with IN operator. Example:

> CREATE OR REPLACE FUNCTION public.ffoo(list sometype[]) RETURNS VOID

this is right ...

>   execute 'select * from foo where foo_column::text in (' ||
> array_to_string(list, ',') || ');';

this is pretty horrid.  Use = ANY(array) instead of trying to construct
an IN on the fly.

    select * from foo where foo_column = any(list)

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Lewis Cunningham
Дата:
Сообщение: Re: PostgreSQL vs Firebird feature comparison finished
Следующее
От: Christian Schröder
Дата:
Сообщение: Re: "out of memory" error