Re: Range Types, constructors, and the type system - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Range Types, constructors, and the type system
Date
Msg-id 1309281521.10707.68.camel@jdavis
Whole thread Raw
In response to Re: Range Types, constructors, and the type system  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
On Tue, 2011-06-28 at 09:30 -0700, David E. Wheeler wrote:
> On Jun 27, 2011, at 8:42 PM, Jeff Davis wrote:
> 
> > Do we think that this is a good way forward? The only thing I can think
> > of that's undesirable is that it's not normal to be required to cast the
> > result of a function, and might be slightly difficult to explain in the
> > documentation in a straightforward way
> 
> That's the part that bothers me.

Yeah, that bothered me, too. 

> I think that if it's not cast it should somehow be useful.

Let's see, what can one do with a range that has no ordering yet? ;)

Robert suggested that we don't need to throw an error, and I think I
agree. Just having a working output function solves most of the
documentation problem, because it makes it less abstract.

The only operators that we could really support are accessors, which
seems somewhat reasonable. However, I'd have some concerns even about
that, because if you do range(10,1), then what's the upper bound?

> Maybe default to a text range or something?

That sounds a little dangerous: select range('1','09')
would fail before it could be cast to int4range.

We could invent an UNKNOWNRANGE type or something. But I don't
particularly like that; it would start out working nicely when people
only had one textrange type, and then their old queries would start
failing when they added another range type based on text.

I think it's fine if the RANGEINPUT type isn't too useful by itself.
It's already a common requirement to cast unknown literals, and this
isn't too much different. It's only for constructors, so it still fits
pretty closely with that idea.

Regards,Jeff Davis



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Range Types, constructors, and the type system
Next
From: Alexander Korotkov
Date:
Subject: Re: Small patch for GiST: move childoffnum to child