Assigning null to an array element in plpgsql

From: Eugene Chow <gene(at)paragonam(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Assigning null to an array element in plpgsql
Date: 2005-11-16 01:25:37
Message-ID: 09088120-DC05-467B-AC1E-C4E2AF0579DE@paragonam.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi all,

I believe this is a bug. The following function returns 'foo' instead
of null:
---------------
create or replace function test() returns varchar as '
declare
s varchar[] := ''{}'';
begin
s[1] := ''foo'';
s[1] := null;

return s[1];
end;
' language 'plpgsql';
----------------

If s is not initialized to an empty set in the declaration, the
function works as expected. I'm running 7.4.9 on FreeBSD 5.4.

Gene

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2005-11-16 01:25:40 Re: BUG #2045: test_fsync "-f" option
Previous Message Alvaro Herrera 2005-11-15 17:16:23 Re: BUG #2046: defective date_trunc