Re: array constructor can't construct empty array

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: jconway <mail(at)joeconway(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: array constructor can't construct empty array
Date: 2003-09-02 05:29:38
Message-ID: Pine.LNX.4.44.0309020716020.13499-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2003-09-02 05:34:34 Re: array constructor can't construct empty array
Previous Message Larry Rosenman 2003-09-02 05:24:07 Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)