Re: Why is NULL = unbounded for rangetypes?

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: Why is NULL = unbounded for rangetypes?
Дата
Msg-id 1373303775.30779.3.camel@jdavis
обсуждение исходный текст
Ответ на Why is NULL = unbounded for rangetypes?  (Andreas Joseph Krogh <andreak@officenet.no>)
Ответы Re: Why is NULL = unbounded for rangetypes?  (Andreas Joseph Krogh <andreak@officenet.no>)
Список pgsql-general
On Mon, 2013-07-08 at 10:19 +0200, Andreas Joseph Krogh wrote:
> Hi.
>
> Both of these queries return TRUE because NULL means "unmounded":
> select daterange('2013-07-01' :: DATE, null, '[]') && daterange('2013-07-04' :: DATE, '2013-07-30' :: DATE, '[]');
> select daterange(null, '2013-08-11' :: DATE, '[]') && daterange('2013-07-04' :: DATE, '2013-07-30' :: DATE, '[]');
> What is the rational behind this behavior of NULL?

It's just a convenience that passing NULL to a constructor creates an
unbounded range. The alternatives of having extra constructors for
unbounded ranges were discussed, but seemed more awkward.

Note that ranges do not allow either bound to be NULL. That would create
a lot of semantic problems.

Does that answer your question?

Regards,
    Jeff Davis




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

Предыдущее
От: pg noob
Дата:
Сообщение: Re: odd locking behaviour
Следующее
От: Joe Van Dyk
Дата:
Сообщение: domains, case statements, functions: bug?