Re: Supporting NULL elements in arrays - Mailing list pgsql-hackers

From mark@mark.mielke.cc
Subject Re: Supporting NULL elements in arrays
Date
Msg-id 20051109162505.GA25452@mark.mielke.cc
Whole thread Raw
In response to Re: Supporting NULL elements in arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Nov 09, 2005 at 11:22:37AM -0500, Tom Lane wrote:
> Marc Munro <marc@bloodnok.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@mielke.cc / markm@ncf.ca / markm@nortel.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
bindthem...
 
                          http://mark.mielke.cc/



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Supporting NULL elements in arrays
Next
From: Robert Creager
Date:
Subject: Re: SIGSEGV taken on 8.1 during dump/reload