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

From Tom Lane
Subject Re: Supporting NULL elements in arrays
Date
Msg-id 4592.1131899498@sss.pgh.pa.us
Whole thread Raw
In response to Re: Supporting NULL elements in arrays  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> Jim C. Nasby wrote:
>> 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.

After further thought I'm starting to agree with this point of view as
well.  I propose the following details:

1. A null element is represented as the unquoted string NULL  (case-insensitive on input).  Any use of quotes or
backslashes turns it into a simple string value "NULL" instead.  array_out  will need to be careful to quote any string
thatmatches NULL.
 

2. For backwards compatibility, we'll invent a GUC parameter  enable_array_nulls that defeats recognition of NULL in
array_in. (Any better ideas about the name of the parameter?)
 

This isn't ideal because of the compatibility risk, but once we get past
the transition period it's a reasonable definition.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Multi-table-unique-constraint
Next
From: Jaime Casanova
Date:
Subject: REPLACE implementation (was: Re: MERGE vs REPLACE)