Re: WIP: Range Types

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: Range Types
Date: 2011-01-04 18:24:52
Message-ID: 1294165492.18031.3454.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2011-01-04 at 23:04 +0900, Hitoshi Harada wrote:
> 2011/1/4 Jeff Davis <pgsql(at)j-davis(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2011-01-04 18:28:22 Re: WIP: Range Types
Previous Message Jeff Davis 2011-01-04 18:18:02 Re: WIP: Range Types