Skip site navigation (1) Skip section navigation (2)

Re: Dereferencing a 2-dimensional array in plpgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sven Willenberger <sven(at)dmv(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Dereferencing a 2-dimensional array in plpgsql
Date: 2005-01-31 21:41:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Sven Willenberger <sven(at)dmv(dot)com> writes:
> Tom Lane wrote:
>> I think we changed this in 8.0.  Before 8.0, trying to assign to an
>> element of a NULL array yielded a NULL result array, but I think now
>> we let you produce a one-element array that way.
> Using a 8.0 testbox I find that the arrays still need to be initialized:

[ looks at code... ]  Hmm, we changed the main executor but missed plpgsql.
I think this is a bug, since plpgsql is now inconsistent with what
happens in a SQL UPDATE command:

regression=# create table foo (f1 int[]);
regression=# insert into foo values(null);
INSERT 155342 1
regression=# update foo set f1[1] = 33;
regression=# select * from foo;
(1 row)


I'll see about making plpgsql behave similarly for 8.0.2.

			regards, tom lane

In response to

pgsql-general by date

Next:From: Richard HuxtonDate: 2005-01-31 21:43:51
Subject: Re: table name restiction
Previous:From: Scott MarloweDate: 2005-01-31 21:38:38
Subject: Re: postgres session termination

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group