Re: PG 7.4 BETA 3: Bug in NULL arrays updating

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bertrand Petit <pgsql(at)phoe(dot)frmug(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: PG 7.4 BETA 3: Bug in NULL arrays updating
Date: 2003-09-24 04:57:34
Message-ID: 3F71243E.2040906@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> Bertrand Petit <pgsql(at)phoe(dot)frmug(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2003-09-24 19:06:02 Re: create temporary sequence and ecpg
Previous Message Tom Lane 2003-09-24 04:09:52 Re: PG 7.4 BETA 3: Bug in NULL arrays updating