Re: Range Types - typo + NULL string constructor - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: Range Types - typo + NULL string constructor
Date
Msg-id 4C807098-5842-46C4-AE1D-21ABB5F8A65A@phlo.org
Whole thread Raw
In response to Re: Range Types - typo + NULL string constructor  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Range Types - typo + NULL string constructor
Re: Range Types - typo + NULL string constructor
List pgsql-hackers
On Sep19, 2011, at 15:33 , Robert Haas wrote:
> On Mon, Sep 19, 2011 at 1:51 AM, Jeff Davis <pgsql@j-davis.com> wrote:
>>> select '[ 2 , NULL )'::int4range;
>>> ERROR:  NULL range boundaries are not supported
>>> LINE 1: select '[ 2 , NULL )'::int4range;
>> 
>> I think this might require more opinions. There is a trade-off here
>> between convenience and confusion: accepting NULL is convenient in the
>> constructors, because it avoids the need to have extra constructors just
>> for unbounded ranges; but could lead to confusion between NULL and INF
>> (which are not the same).
> 
> I agree with this line of reasoning.  I think we will be making pain
> for ourselves if we need to invent a bunch more constructors just to
> have a way of indicating an unbounded range, but OTOH I don't see any
> compelling reason why the type input function needs to accept N-U-L-L.

The one reason I can see in favour of supporting N-U-L-L there is 
compatibility with arrays. I've recently had the questionable pleasure
of writing PHP functions to parse and emit our textual representations of
arrays, records, dates and timestamps. After that experience, I feel that
the number of similar-yet-slightly-different textual input output format
for non-primitive types is already excessive, and any further additions
should be modeled after some existing ones.

(And BTW, why in heavens sake, is date and time input and output
asymmetric for some DateStyle settings? Asymmetric like in you need to
send one format, but get back another...)

best regards,
Florian Pflug




pgsql-hackers by date:

Previous
From: Enrico Pirozzi
Date:
Subject: Re: A little pg_dump patch
Next
From: Andrew Dunstan
Date:
Subject: Re: A little pg_dump patch