Re: INET/CIDR types

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: pgsql-hackers(at)hub(dot)org
Subject: Re: INET/CIDR types
Date: 2000-07-24 19:15:01
Message-ID: m13Gngs-000AXeC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 Larry Rosenman 2000-07-24 19:26:37 RE: INET/CIDR types
Previous Message Philip Warner 2000-07-24 17:04:13 Re: pg_dump, libdump, dump API, & backend again