From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | "David E(dot) Wheeler" <david(at)kineticode(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Range Types, constructors, and the type system |
Date: | 2011-06-28 17:18:41 |
Message-ID: | 1309281521.10707.68.camel@jdavis |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2011-06-28 17:21:47 | Re: Small patch for GiST: move childoffnum to child |
Previous Message | Jeff Davis | 2011-06-28 16:58:11 | Re: Range Types, constructors, and the type system |