plpgsql -- any '+' ,'-' operators for INET?

From: Randall Perry <rgp(at)systame(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql -- any '+' ,'-' operators for INET?
Date: 2005-04-03 18:52:53
Message-ID: BE75B3C5.62B72%rgp@systame.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Anyone know an easy way to increment IP type inet?

For example, I'd like to create a list of all Ips contained in a subnet. For
that, I can grab the network address and broadcast address from a given CIDR
subnet type, and then fill in all the Ips between the two.

I know I can:
* convert an INET addr to text using host()
* grep the digits after the last period (for class C addresses, anyway)
* convert that to an integer
* increment the integer
* concatenate it after the 1st 3 sets of digits in the address to produce
the next ip

Just wondering if there's an easier way, or anyone has written a function to
handle this?

--
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/

Browse pgsql-general by date

  From Date Subject
Next Message Stephane Bortzmeyer 2005-04-03 20:12:45 Re: Inheritance and such
Previous Message Karsten Hilbert 2005-04-03 18:32:33 Re: Empty date