wrong inicializied array in plpgsql

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: pgsql-bugs(at)postgresql(dot)org
Subject: wrong inicializied array in plpgsql
Date: 2003-09-14 17:12:24
Message-ID: Pine.LNX.4.44.0309141904420.18759-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

I am testing long array values. I tryed write simple function in plpgsql
for this. I found maybe a bug. Array in plpgsql without explicit init
(empty array) don't work;

CREATE OR REPLACE FUNCTION foo1() RETURNS FLOAT AS '
DECLARE f FLOAT [];
BEGIN
f[1] := 10.0;
RETURN f[1];
END' LANGUAGE plpgsql;

cyril=> select foo1();
foo1
------

(1 row)

CREATE OR REPLACE FUNCTION foo2() RETURNS FLOAT AS '
DECLARE f FLOAT [] DEFAULT ''{}'';
BEGIN
f[1] := 10.0;
RETURN f[1];
END' LANGUAGE plpgsql;

cyril=> select foo2();
foo2
------
10
(1 row)

regards
Pavel Stehule

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-09-14 17:41:47 Re: wrong inicializied array in plpgsql
Previous Message Payman 2003-09-14 02:00:10 PostgreSql 7.3.4 & 7.4 on MacOS X