Re: INET/CIDR types

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: pgsql-hackers(at)hub(dot)org
Cc: Larry Rosenman <ler(at)lerctr(dot)org>
Subject: Re: INET/CIDR types
Date: 2000-07-24 14:41:05
Message-ID: 200007241441.e6OEf5D12433@lerami.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The bad news is that I'm tracking CIDR blocks.

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

Larry
> Thus spake Larry Rosenman
> > I noticed a discussion on this list about a re-do of the INET/CIDR
> > types. I was wondering if there was ANY way at all to add
> > an output function that ALWAYS returns all 4 octets of an INET or CIDR
> > type with and without the /netmask?
> >
> > I'm writing a IP Allocation/Tracking app for the ISP I work for, and
> > find the current output format causes confusion for the less
> > technical types.
>
> The host() function does this for the INET type. It doesn't work for
> the CIDR type (it throws an error) because CIDR doesn't have a host
> part per se.
>
> darcy=> select '1.2.0.0/23'::inet;
> ?column?
> --------
> 1.2.0/23
> (1 row)
>
> darcy=> select host('1.2.0.0/23'::inet);
> host
> -------
> 1.2.0.0
> (1 row)
>
> --
> 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.

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2000-07-24 15:05:57 Re: State of RPMs
Previous Message D'Arcy J.M. Cain 2000-07-24 14:33:14 Re: INET/CIDR types