Re: BUG #7575: "between" does not work properly with inet/cidr addresses

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #7575: "between" does not work properly with inet/cidr addresses
Дата
Msg-id 15990.1348982762@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #7575: "between" does not work properly with inet/cidr addresses  (mr.dash.four@googlemail.com)
Ответы Re: BUG #7575: "between" does not work properly with inet/cidr addresses  (Mr Dash Four <mr.dash.four@googlemail.com>)
Список pgsql-bugs
mr.dash.four@googlemail.com writes:
> 1. select '10.1.1.0/24'::inet between '10.1.1.0'::inet and
> '10.1.1.255'::inet gives me FALSE.

> Am I missing something obvious?

10.1.1.0/24 is different from, and sorts before, 10.1.1.0/32
(which is what '10.1.1.0'::inet is an abbreviation for).

You might find that the net address inclusion operators (<< and friends)
provide the semantics you're looking for.  BETWEEN only knows about
btree sort ordering, which is fundamentally a brick or two shy of a
load when considering two-dimensional quantities such as netmasks.

            regards, tom lane

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

Предыдущее
От: mr.dash.four@googlemail.com
Дата:
Сообщение: BUG #7575: "between" does not work properly with inet/cidr addresses
Следующее
От: Mr Dash Four
Дата:
Сообщение: Re: BUG #7575: "between" does not work properly with inet/cidr addresses