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@{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@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749