Re: PG 7.4 BETA 3: Bug in NULL arrays updating - Mailing list pgsql-bugs

From Joe Conway
Subject Re: PG 7.4 BETA 3: Bug in NULL arrays updating
Date
Msg-id 3F71243E.2040906@joeconway.com
Whole thread Raw
In response to Re: PG 7.4 BETA 3: Bug in NULL arrays updating  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom Lane wrote:
> Bertrand Petit <pgsql@phoe.frmug.org> writes:
>>    When updating a NULL cell which is an array of something,
>>setting an adressed member of a non existent array, the value of the
>>cell is not changed.
>
> Assigning to a member of a NULL array has always yielded another NULL
> array.  While I've never been particularly satisfied with that behavior
> either, it has some logical symmetry to it.  What do you think the
> behavior ought to be?  (In particular, if a non-null array should
> result, where do we get its dimensions and subscripts from?)

I think the behavior is correct. An analogy I is text concatenation. If
I concatenate 'a' to NULL::text, I get NULL. But if I concatenate 'a' to
an empty text value, '', I get 'a'.

Similarly if you assign to an element of an empty array, '{}', you get
an array with the one appended element. Not sure if this works pre-7.4
though -- I know I made some changes related to this, but I forget the
exact details.

Joe

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: PG 7.4 BETA 3: Bug in NULL arrays updating
Next
From: Bruce Momjian
Date:
Subject: Re: create temporary sequence and ecpg