Search Postgresql Archives

Re: Difference between inet and cidr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <CABRT9RAr2bFrxdx93H_aEQsKmuchMwurSfENP8itSpExsWsF7g@xxxxxxxxxxxxxx>,
Marti Raudsepp <marti@xxxxxxxxx> writes:

> Hi,
> On Tue, Jul 5, 2011 at 09:50, Yan Cheng CHEOK <yccheok@xxxxxxxxx> wrote:
>> The essential difference between inet and cidr data types is that inet accepts values with nonzero bits to the right of the 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.

Do the inet/cidr types have any advantage over the ip4r contrib module?


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux