Re: array constructor can't construct empty array - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: array constructor can't construct empty array
Date
Msg-id Pine.LNX.4.44.0309020716020.13499-100000@kix.fsv.cvut.cz
Whole thread Raw
In response to Re: array constructor can't construct empty array  (jconway <mail@joeconway.com>)
Responses Re: array constructor can't construct empty array
List 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 by date:

Previous
From: Larry Rosenman
Date:
Subject: Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)
Next
From: Joe Conway
Date:
Subject: Re: array constructor can't construct empty array