RE: INET/CIDR types

From: "Larry Rosenman" <ler(at)lerctr(dot)org>
To: <pgsql-hackers(at)hub(dot)org>, "Larry Rosenman" <ler(at)lerctr(dot)org>
Subject: RE: INET/CIDR types
Date: 2000-07-24 19:26:37
Message-ID: NCBBKBDOOHHEJCJHLLPAMELAHIAA.ler@lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)druid(dot)net]
Sent: Monday, July 24, 2000 2:15 PM
To: Larry Rosenman
Cc: pgsql-hackers(at)hub(dot)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(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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Don Baccus 2000-07-24 19:30:08 RE: INET/CIDR types
Previous Message D'Arcy J.M. Cain 2000-07-24 19:15:01 Re: INET/CIDR types