Re: Supporting NULL elements in arrays

From: Marc Munro <marc(at)bloodnok(dot)com>
To: 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 16:15:38
Message-ID: 1131552939.12281.3.camel@bloodnok.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

How about representing null array elements with a special-case cast-like
null? Something like {::null}

__
Marc

On Tue, 2005-11-08 at 23:30 -0400, pgsql-hackers-owner(at)postgresql(dot)org
wrote:
> Date: Tue, 08 Nov 2005 19:21:34 -0500
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> To: pgsql-hackers(at)postgreSQL(dot)org
> Subject: Re: Supporting NULL elements in arrays
> Message-ID: <10097(dot)1131495694(at)sss(dot)pgh(dot)pa(dot)us>
>
> I 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.
>
> Ideas anyone?
>
> regards, tom lane
>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-11-09 16:19:28 Re: SIGSEGV taken on 8.1 during dump/reload
Previous Message Tom Lane 2005-11-09 16:02:30 Re: BUG #2033: Assertion Failure: File: "procarray.c", Line: 492