wrong inicializied array in plpgsql - Mailing list pgsql-bugs

From Pavel Stehule
Subject wrong inicializied array in plpgsql
Date
Msg-id Pine.LNX.4.44.0309141904420.18759-100000@kix.fsv.cvut.cz
Whole thread Raw
Responses Re: wrong inicializied array in plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Error during Installation
Next
From: Tom Lane
Date:
Subject: Re: wrong inicializied array in plpgsql