Re: Singleton range constructors versus functional coercion notation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Singleton range constructors versus functional coercion notation
Date
Msg-id 23450.1321736235@sss.pgh.pa.us
Whole thread Raw
In response to Re: Singleton range constructors versus functional coercion notation  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Singleton range constructors versus functional coercion notation
Re: Singleton range constructors versus functional coercion notation
List pgsql-hackers
Jeff Davis <pgsql@j-davis.com> writes:
> On Sat, 2011-11-19 at 12:27 -0500, Tom Lane wrote:
>> I don't immediately see a solution that's better than dropping the
>> single-argument range constructors.

> We could change the name, I suppose, but that seems awkward.

Yeah, something like int4range_1(42) would work, but it seems rather
ugly.

> I'm hesitant to remove them because the alternative is significantly
> more verbose:
>   numrange(1.0, 1.0, '[]');

Right.  The question is, does the case occur in practice often enough
to justify a shorter notation?  I'm not sure.

One thing I've been thinking for a bit is that for discrete ranges,
I find the '[)' canonical form to be surprising/confusing.  If we
were to fix range_adjacent along the lines suggested by Florian,
would it be practical to go over to '[]' as the canonical form?
One good thing about that approach is that canonicalization wouldn't
have to involve generating values that might overflow.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Singleton range constructors versus functional coercion notation
Next
From: Tom Lane
Date:
Subject: Re: range_adjacent and discrete ranges