Re: Supporting NULL elements in arrays

From: Joe Conway <mail(at)joeconway(dot)com>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Supporting NULL elements in arrays
Date: 2005-11-09 02:04:39
Message-ID: 43715937.7080001@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim C. Nasby wrote:
> On Tue, Nov 08, 2005 at 07:21:34PM -0500, Tom Lane wrote:
>>>... the most straightforward thing to do is define an empty element
>>>as meaning a NULL. But this might be objected to on a couple of grounds:
>>
>>I just thought of another, potentially fatal objection: it's ambiguous
>>whether '{}'::text[] should be taken to mean an empty (zero-length)
>>array or an array containing a single NULL element.
>>
>>For backwards compatibility it should mean an empty array, but then
>>there's no way to represent ARRAY(NULL) in data dumps, which won't
>>do either.
>>
>>The only workaround that comes to mind is to allow explicit
>>specification of what's meant: '[1:1]{}' would be needed to represent
>>the one-null case. Ugly.
>
> Instead of bending over backwards to try and support older cases, would
> a compatability mode be possible? Seems that would solve a lot of
> problems.

Last time I thought about this problem, that's what I concluded. I don't
think there is a reasonable and backward compatible solution.

I also think the best non-compatible solution is to require non-numeric
elements to be delimited (double quotes, configurable?), and use NULL
unadorned to represent NULL.

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-11-09 02:16:04 Re: Supporting NULL elements in arrays
Previous Message Christopher Kings-Lynne 2005-11-09 01:31:26 Re: Enums again