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 t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Nov 20, 2011, at 10:24 PM, Jeff Davis pg...@j-davis.com 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

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 Tom Lane
Jeff Davis pg...@j-davis.com 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

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 pg...@j-davis.com 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

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

2011-11-21 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Nov 20, 2011, at 10:24 PM, Jeff Davis pg...@j-davis.com 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

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

2011-11-21 Thread Dean Rasheed
On 21 November 2011 14:55, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Nov 20, 2011, at 10:24 PM, Jeff Davis pg...@j-davis.com 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

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. Well, if

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 to

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

2011-11-19 Thread Pavel Stehule
2011/11/19 Jeff Davis pg...@j-davis.com: 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

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

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

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