Re: Repair plan for inet and cidr types - Mailing list pgsql-hackers

From darcy@druid.net (D'Arcy J.M. Cain)
Subject Re: Repair plan for inet and cidr types
Date
Msg-id m139emz-000AXrC@druid.net
Whole thread Raw
In response to Repair plan for inet and cidr types  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Thus spake Peter Eisentraut
> network and a host are not the same thing. To construct a cidr value from
> an inet value, you'd have to use some sort of (to be created) network()
> function, e.g., network('127.0.0.5/16') => '127.0/16'. IMO, there is no

Oh, I forgot to mention:

darcy=> select network('127.1.2.3/24'::inet);
network   
----------
127.1.2/24
(1 row)

There is also a host and netmask function and note:

darcy=> select host('127.1.2.3/24'::cidr);
ERROR:  CIDR type has no host part

But I still see no reason why that can't be implicit if we assign the
"'127.1.2.3/24'::inet" value to a cidr.  In other words let "select
('127.1.2.3/24'::inet)::cidr" give the same output.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Dumping SQL type names
Next
From: Chris Bitmead
Date:
Subject: Re: Article on MySQL vs. Postgres