Re: Difference between inet and cidr

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: Difference between inet and cidr
Дата
Msg-id CABRT9RAr2bFrxdx93H_aEQsKmuchMwurSfENP8itSpExsWsF7g@mail.gmail.com
обсуждение исходный текст
Ответ на Difference between inet and cidr  (Yan Cheng CHEOK <yccheok@yahoo.com>)
Список pgsql-general
Hi,

On Tue, Jul 5, 2011 at 09:50, Yan Cheng CHEOK <yccheok@yahoo.com> wrote:
> The essential difference between inet and cidr data types is that inet accepts values with nonzero bits to the right
ofthe netmask, whereas cidr does not. 

Say, if you have a /8 netmask, the 'cidr' type requires that all the
24 rightmost bits are zero. inet does not have this requirement.

E.g:
db=# select '255.0.0.0/8'::cidr;
255.0.0.0/8

db=# select '255.1.0.0/8'::cidr;
ERROR:  invalid cidr value: "255.1.0.0/8"
DETAIL:  Value has bits set to right of mask.

And inet allows this:
db=# select '255.1.0.0/8'::inet;
255.1.0.0/8

Hope that helps.

Regards,
Marti

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

Предыдущее
От: Geoffrey Myers
Дата:
Сообщение: Re: out of memory error
Следующее
От: Harald Fuchs
Дата:
Сообщение: Re: Difference between inet and cidr