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