Re: array constructor can't construct empty array

From: jconway <mail(at)joeconway(dot)com>
To: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
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-01 19:18:49
Message-ID: 3F539B99.2000205@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-09-01 19:21:10 Re: pg_dump and REVOKE on function
Previous Message Bruno Wolff III 2003-09-01 19:18:28 Re: thread safety