On Tue, 2011-01-04 at 23:04 +0900, Hitoshi Harada wrote:
> 2011/1/4 Jeff Davis <pgsql@j-davis.com>:
> > I have been updating my work in progress here:
> >
> > http://git.postgresql.org/gitweb?p=users/jdavis/postgres.git;a=log;h=refs/heads/rangetypes
> >
> > Right now, it's not in a reviewable state, but those interested can
> > glance through the code.
> >
> > Quick synopsis (for illustration purposes only; don't expect much from
> > the current code):
> >
> > CREATE TYPE numrange
> > AS RANGE (SUBTYPE=numeric, SUBTYPE_CMP=numeric_cmp);
>
> I am interested in how you define increment/decrement operation of
> range value in discrete types. The window functions and PARTITION also
> want to represent RANGE but there's no clear solution.
>
> Sorry if it's already been discussed since I didn't track the threads.
The user would specify a "canonical" function like:
CREATE TYPE int4range AS RANGE (SUBTYPE=int4, SUBTYPE_CMP=btint4cmp, CANONICAL=my_int4range_canonical);
That function would be called when constructing ranges on input or after
a computation, and could change something like (1,4] into [2,4] if you
prefer the latter form.
So the range types would not have increments, decrements, granules, or
knowledge about the "difference" type (e.g. "interval" is the difference
type for timestamp).
What support do you need/want from range types to help with new window
function features?
Also, partitioning might have some use for range types to represent
range partitions. Comments are welcome.
Regards,Jeff Davis