Re: Singleton range constructors versus functional coercion notation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Singleton range constructors versus functional coercion notation
Date: 2011-11-19 20:57:15
Message-ID: 23450.1321736235@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis <pgsql(at)j-davis(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-11-19 21:03:01 Re: range_adjacent and discrete ranges
Previous Message Pavel Stehule 2011-11-19 19:06:39 Re: Singleton range constructors versus functional coercion notation