Re: WIP: Range Types

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: Range Types
Date: 2011-01-06 17:35:08
Message-ID: AANLkTikg0zZxZKqnum=V=tZZJ9SEEgV_KRKjX77NqfdN@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 6, 2011 at 12:32 PM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> On Wed, 2011-01-05 at 12:07 -0800, Jeff Davis wrote:
>> The current design for range types doesn't ask for add or subtract.
>> Although it might be interesting to try to use such an interface for
>> range types, it introduces a lot of complexity and makes it easier to
>> cause subtle problems (consider that addition of timestamps and
>> intervals is not commutative).
>
> A consequence of this design is that some generic range functions, like
> "length" or "distance" would need to rely on the polymorphism of "+" and
> "-" to work.
>
> I'm also not sure if a constructor like "range(start, offset) returns
> anyrange" could be made to work generically at all, because the start
> and offset may be two different types (and a function that takes
> ANYELEMENT requires that all ANYELEMENT arguments are the same type).
>
> Does anyone see a problem with that?

Seems like you could make people who want that write range(start,
start+offset) instead without too much pain.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-01-06 18:53:48 Re: Something fishy about the current Makefiles
Previous Message Jeff Davis 2011-01-06 17:32:29 Re: WIP: Range Types