Re: Supporting NULL elements in arrays

From: mark(at)mark(dot)mielke(dot)cc
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Marc Munro <marc(at)bloodnok(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Supporting NULL elements in arrays
Date: 2005-11-09 16:25:05
Message-ID: 20051109162505.GA25452@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 09, 2005 at 11:22:37AM -0500, Tom Lane wrote:
> Marc Munro <marc(at)bloodnok(dot)com> writes:
> > How about representing null array elements with a special-case cast-like
> > null? Something like {::null}
>
> The problem with *any* proposal for let's-spell-NULL-like-this
> is that "this" is inevitably a string that is valid as a text
> data value. Making the string weirder may reduce the odds of
> a failure but the risk is still there, and meanwhile you're making
> the null marker less readable. (The above has the additional problem
> of being indistinguishable from a sub-array.)
>
> I think we really need something that is rejected as syntactically
> invalid by the existing array input parser.

Hehehe... Feeling silly here:

{1,2,}NULL{,4,5,}NULL

What are the feelings on representing it similar to how it would be
in memory?

{1,2,,4,5,}(,,NULL,,,NULL)

Then, there is always the possibility of including a new array text format
for arrays that contain nulls (Q for quote?):

Q{1,2,NULL,4,5,NULL}

This would activate a mode that would fully quote any non-numeric,
non-array arguments, allowing NULL to be unambiguous?

Q{'a','b',NULL,'c','d',NULL}

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Creager 2005-11-09 16:53:58 Re: SIGSEGV taken on 8.1 during dump/reload
Previous Message Tom Lane 2005-11-09 16:22:37 Re: Supporting NULL elements in arrays