Re: Range Types, discrete and/or continuous

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Range Types, discrete and/or continuous
Дата
Msg-id AANLkTik2aTqHwiGa6WcY1mBGhZr68zEzMCCg5C9V+Z21@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Range Types, discrete and/or continuous  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sun, Oct 24, 2010 at 6:59 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Jeff Davis <pgsql@j-davis.com> writes:
>> Last development cycle, one of the questions that was unresolved was
>> whether to handle ranges like a discrete set (that is, [1,5) = [1,4] )
>> or continuous or both.
>
> Put me in the camp that says you need both.  I really seriously dislike
> the idea of representing [1, 2) as [1, 2-epsilon], mainly because there
> is often no portable value for epsilon.  Dump-and-restore would be quite
> hazardous.

+1.  I think the right way to do this is - in general, a range should
be stored as a start value, a stop value, and 2 extra bits indicating
whether each end is open or closed.  (And perhaps a few bits beyond
that if you want to support things like (4, inf) over a base type that
has no infinite value, which I'm not sure about.)  Then you can
optionally allow a "convert-to-closed" operation, which will convert a
[3, 5) over int to [3, 4], but be undefined for float/timestamp
ranges.

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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: why does plperl cache functions using just a bool for is_trigger
Следующее
От: Robert Haas
Дата:
Сообщение: Re: ask for review of MERGE