RE: INET/CIDR types - Mailing list pgsql-hackers

From Larry Rosenman
Subject RE: INET/CIDR types
Date
Msg-id NCBBKBDOOHHEJCJHLLPAMELAHIAA.ler@lerctr.org
Whole thread Raw
In response to Re: INET/CIDR types  (darcy@druid.net (D'Arcy J.M. Cain))
Responses RE: INET/CIDR types  (Don Baccus <dhogaza@pacifier.com>)
List pgsql-hackers
The problem is NON-TECHNICAL people will be getting the output,
and they expect 4 octet output. 

I really think that we should have a way to coerce a CIDR to
an INET, and then allow host(). 

Remember that I am dealing with $10/hour clerks. 

I really don't get the hostility to changing the OUTPUT format...

Larry Rosenman

-----Original Message-----
From: D'Arcy J.M. Cain [mailto:darcy@druid.net]
Sent: Monday, July 24, 2000 2:15 PM
To: Larry Rosenman
Cc: pgsql-hackers@hub.org
Subject: Re: [HACKERS] INET/CIDR types


Thus spake Larry Rosenman
> The bad news is that I'm tracking CIDR blocks. 

Then there is no host part.  I would argue that if someone is getting
confused with the current output then perhaps they shouldn't be dealing
with client networks.

> If I could get a network() function to return essentially
> host()::inet for CIDR's that would work. 

There is a network function.  It returns the network.

darcy=> select network('1.2.0.0/23'::cidr);
network 
--------
1.2.0/23
(1 row)

A lot of work went into these types to make them correct.  I don't think
we should be undermining that to allow people to work with incorrect
assumptions.  If you want Micro$oft you know where to find it.

If you really must do this then store your blocks in the INET type.  It
pretty much does what you want but doesn't try to pretend to be a CIDR.


Hmmm.  I just noticed this.

darcy=> select '1.2.0.1/23'::cidr;
?column?
--------
1.2.0/23
(1 row)

Shouldn't that throw an error?

-- 
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: darcy@druid.net (D'Arcy J.M. Cain)
Date:
Subject: Re: INET/CIDR types
Next
From: Don Baccus
Date:
Subject: RE: INET/CIDR types