Re: array constructor can't construct empty array

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: array constructor can't construct empty array
Дата
Msg-id Pine.LNX.4.44.0309020716020.13499-100000@kix.fsv.cvut.cz
обсуждение исходный текст
Ответ на Re: array constructor can't construct empty array  (jconway <mail@joeconway.com>)
Ответы Re: array constructor can't construct empty array  (Joe Conway <mail@joeconway.com>)
Список pgsql-hackers
On Mon, 1 Sep 2003, jconway wrote:

> 
> You haven't shown us your function or how you're trying to call it. In
> any case, works here:
> 
> regression=# CREATE FUNCTION foo(INTEGER[], INTEGER) RETURNS INTEGER AS
> 'select ss.f[1] from (select $1 || $2 as f) as ss' language sql;
> CREATE FUNCTION
> regression=# select foo('{}'::int4[], 3);
>    foo
> -----
>      3
> (1 row)
> 
> Joe

I didn't show my function, because this function is unimportant. Header of 
my function was important. My question was about using array constructor 
ARRAY. Is possible construct empty array via this constructor? . For 
example

I can select foo('{}'::int4[]) -- ok select foo('{}')         -- ok too
but select foo(array[])      -- syntax error, 

my function can by like

Function FirstDay(date, integer[]) returns date as '
declare s;
begin s := $1; loop   if extract(dow from s) = ANY($2) then     s := s + 1;   else     return s;   end if end loop
end' language plpgsq;

Sometime I need call this function with empty array. That is all.

Regards
Pavel Stehule




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

Предыдущее
От: Larry Rosenman
Дата:
Сообщение: Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)
Следующее
От: Joe Conway
Дата:
Сообщение: Re: array constructor can't construct empty array