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

From jconway
Subject Re: array constructor can't construct empty array
Date
Msg-id 3F539B99.2000205@joeconway.com
Whole thread Raw
In response to Re: array constructor can't construct empty array  (Pavel Stehule <stehule@kix.fsv.cvut.cz>)
Responses Re: array constructor can't construct empty array  (Pavel Stehule <stehule@kix.fsv.cvut.cz>)
List pgsql-hackers
Pavel Stehule wrote:
>>>CREATE FUNCTION foo(date, date, INTEGER[]) RETURNS INTEGER 
>>>
>>>Array and array's functions works fine, but I need call this function 
>>>with empty array. I can't use array constructor for empty array. When 
>>>I call function foo with e.a. ,I get syntax error. I can call with '{}'.
>>
>>Are you running 7.4beta?
>>
> 
> I am sorry, yes, of course :->,
> testdb=> SELECT version();
>                                   version
> ---------------------------------------------------------------------------
>  PostgreSQL 7.4beta1 on i586-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2

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





pgsql-hackers by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: thread safety
Next
From: Peter Eisentraut
Date:
Subject: Re: pg_dump and REVOKE on function