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 14:33:14
Message-ID: m13GjIB-000AXgC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2000-07-24 14:41:05 Re: INET/CIDR types
Previous Message Zeugswetter Andreas SB 2000-07-24 14:22:39 AW: libpgtcl on aix