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