Re: Range Types and length function

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Range Types and length function
Date: 2011-06-27 10:25:24
Message-ID: 9909F6B8-D2CE-4A79-86E7-0F081B950146@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jun27, 2011, at 03:12 , Jeff Davis wrote:
> But I think you're right, it shouldn't be the responsibility of range
> types. Perhaps I should leave length() as some inlinable SQL functions
> like I mentioned, or perhaps I should remove them completely.

Does the current definition of length(range), i.e.
upper(range) - lower(range)
deal correctly with open vs. closed ranges and unbounded ranges? I'm thinking
that it probably doesn't - what would be the results of
length('[0,1]'::intrange) -- Should be 2
length('[0,1)'::intrange) -- Should be 1
length('[0,inf]'::intrange) -- Should be infinity, but ints can't
represent that, can't they?

If it cannot be easily made to support these cases, than I vote for
removing it all together.

best regards,
Florian Pflug

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2011-06-27 10:45:34 Re: WIP: Fast GiST index build
Previous Message Florian Pflug 2011-06-27 10:16:01 Re: Range Types, constructors, and the type system