Re: embedded sql interface to ip address type

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: Michael Meskes <meskes(at)postgresql(dot)org>, Rob Fowler <postgres(at)mianos(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: embedded sql interface to ip address type
Date: 2003-03-22 10:33:30
Message-ID: 200303220533.30512.darcy@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

> What exactly do you mean? A C type for IP addresses? That doesn't
> exist. Right now this type has to be stored in character strings.

You mean base types written in C? We certainly do.

darcy=# select '123.4.5.6'::inet << '123.4.5.0/24'::cidr;
?column?
----------
t
(1 row)

darcy=# select '123.4.5.6'::inet << '123.4.6.0/24'::cidr;
?column?
----------
f
(1 row)

The above says that the IP address 123.4.5.6 is in the CIDR block 123.4.5.0/24
but not in 123.4.6.0/24.

We also have a MAC address type. See the documentation pages at
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=datatype-net-types.html
and
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=functions-net.html
for details.

--
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-interfaces by date

  From Date Subject
Next Message Michael Meskes 2003-03-22 12:14:39 Re: esql problem
Previous Message Tom Lane 2003-03-22 05:20:21 Re: persistent variables between cross-calls in C functions