Re: Argument type list

Поиск
Список
Период
Сортировка
От Gustavo Tonini
Тема Re: Argument type list
Дата
Msg-id 9c31dd0d0708231324u5e405cc5o4a2ca547ce3a123a@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Argument type list  (Erik Jones <erik@myemma.com>)
Список pgsql-general
Ok. It works well, but my argument type must be varchar (because java
conversions in my application). Then I want to convert varchar in
format "{int, int, ...}" to an integer array. Is there a function that
converts varchar -> integer [] ? I tried with casts and got no
success.

Tanks,
Gustavo.

On 8/23/07, Erik Jones <erik@myemma.com> wrote:
> On Aug 23, 2007, at 1:27 PM, Tom Lane wrote:
>
> > 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)
>
> Yes, I always forget about using ANY.  Thx.
>
> Erik Jones
>
> Software Developer | Emma(r)
> erik@myemma.com
> 800.595.4401 or 615.292.5888
> 615.292.0777 (fax)
>
> Emma helps organizations everywhere communicate & market in style.
> Visit us online at http://www.myemma.com
>
>
>

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

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: PostgreSQL vs Firebird feature comparison finished
Следующее
От: Terry Yapt
Дата:
Сообщение: Re: FATAL: could not reattach to shared memory (Win32)