Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-22 Thread Tom Lane
Jeff Davis writes: > It's a little strange that we allow people to define functions with one > argument and the same name as a type if such functions are confusing. As long as your mental model is that such a function is a cast, everything is fine. The trouble with the range constructors is that

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-22 Thread Jeff Davis
On Tue, 2011-11-22 at 09:07 -0500, Robert Haas wrote: > I honestly don't know what function names people will pick, and I > don't care. Someone might like singleton(x), which would be > impractical as a built-in because there could be more than one range > type over the same base type, but if the

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-22 Thread Robert Haas
On Mon, Nov 21, 2011 at 9:55 AM, Tom Lane wrote: > Robert Haas writes: >> On Nov 20, 2011, at 10:24 PM, Jeff Davis wrote: >>> Well, if there were a good shorter notation, then probably so. But it >>> doesn't look like we have a good idea, so I'm fine with dropping it. > >> We should also keep in

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-21 Thread Dean Rasheed
On 21 November 2011 14:55, Tom Lane wrote: > Robert Haas writes: >> On Nov 20, 2011, at 10:24 PM, Jeff Davis wrote: >>> Well, if there were a good shorter notation, then probably so. But it >>> doesn't look like we have a good idea, so I'm fine with dropping it. > >> We should also keep in mind

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-21 Thread Tom Lane
Robert Haas writes: > On Nov 20, 2011, at 10:24 PM, Jeff Davis wrote: >> Well, if there were a good shorter notation, then probably so. But it >> doesn't look like we have a good idea, so I'm fine with dropping it. > We should also keep in mind that people who use range types can and likely > w

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-21 Thread Robert Haas
On Nov 20, 2011, at 10:24 PM, Jeff Davis wrote: > On Sat, 2011-11-19 at 15:57 -0500, Tom Lane wrote: >>> 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 enoug

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-20 Thread Jeff Davis
On Sat, 2011-11-19 at 15:57 -0500, Tom Lane wrote: > > 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. W

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-19 Thread Florian Pflug
On Nov19, 2011, at 21:57 , Tom Lane wrote: > 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 c

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-19 Thread Tom Lane
Jeff Davis 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

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-19 Thread Pavel Stehule
2011/11/19 Jeff Davis : > On Sat, 2011-11-19 at 12:27 -0500, Tom Lane wrote: >> The singleton range constructors don't work terribly well. > ... > >> I don't immediately see a solution that's better than dropping the >> single-argument range constructors. > > We could change the name, I suppose, bu

Re: [HACKERS] Singleton range constructors versus functional coercion notation

2011-11-19 Thread Jeff Davis
On Sat, 2011-11-19 at 12:27 -0500, Tom Lane wrote: > The singleton range constructors don't work terribly well. ... > 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. I'm hesitant

[HACKERS] Singleton range constructors versus functional coercion notation

2011-11-19 Thread Tom Lane
The singleton range constructors don't work terribly well. regression=# select int4range(42); -- ok int4range --- [42,43) (1 row) regression=# select int4range(null);-- not so ok int4range --- (1 row) regression=# select int4range('42');