Skip site navigation (1) Skip section navigation (2)

Re: Repair plan for inet and cidr types

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Repair plan for inet and cidr types
Date: 2000-07-05 02:19:49
Message-ID: m139emz-000AXrC@druid.net (view raw or flat)
Thread:
Lists: 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(at){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.

In response to

pgsql-hackers by date

Next:From: Chris BitmeadDate: 2000-07-05 02:24:12
Subject: Re: Article on MySQL vs. Postgres
Previous:From: Tom LaneDate: 2000-07-05 02:13:08
Subject: Re: Dumping SQL type names

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group