Re: WIP: RangeTypes

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thom Brown <thom(at)linux(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: RangeTypes
Date: 2011-01-29 19:53:14
Message-ID: 1296330794.11513.527.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 2011-01-29 at 14:42 -0500, Tom Lane wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> > On Fri, 2011-01-28 at 21:52 +0000, Thom Brown wrote:
> > Also, if I try the same, but with a different name for the type, I get
> > the same error. Why does that restriction exist? Can't you have
> > types which happen to use the exact same subtype?
>
> > At first, that's how I designed it. Then, I realized that the type
> > system needs to know the range type from the element type in order for
> > something like ANYRANGE to work.
>
> That seems like a fairly bad restriction. In a datatype with multiple
> useful sort orderings, it'd be desirable to be able to create a range
> type for each such ordering, no? I'd be inclined to think of a range
> type as being defined by element type plus a btree opfamily. Maybe it'd
> be okay to insist on that combination as being unique.

I couldn't find another way to make a function with a definition like:

range(ANYELEMENT, ANYELEMENT) returns ANYRANGE

work. And it seemed worse to live without a constructor like that.
Ideas?

Also, it's not based on the btree opfamily right now. It's just based on
a user-supplied compare function. I think I could change it to store the
opfamily instead, if you think that's a better idea.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2011-01-29 19:56:40 Re: SPI_exec doesn't return proc context (on 9.1)
Previous Message Tom Lane 2011-01-29 19:42:13 Re: WIP: RangeTypes