Re: Incrementing INET fields - Mailing list pgsql-hackers

From Peter Nixonn
Subject Re: Incrementing INET fields
Date
Msg-id ekfo5g$ih7$1@sea.gmane.org
Whole thread Raw
In response to Incrementing INET fields  (Peter Nixonn <listuser@peternixon.net>)
Responses Re: Incrementing INET fields
Re: Incrementing INET fields
List pgsql-hackers
Andrew Sullivan wrote:

> On Mon, Nov 27, 2006 at 03:04:01PM +0200, Peter Nixonn wrote:
>> Is there some technical reason (other than finite developer time) that
>> this isn't possible at present?
> 
> I don't think it makes much sense, without a fair amount of policy
> around it.  For instance, you'd need to know what to increment to
> when you get to 10.1.1.254/32.  Moreover, the mask range work you
> mentioned as "icing on the cake" is not icing at all: it's part of
> the cake, becase CIDR has been here for a long time.  So you _have_
> to be able to know what range you're in in order to do autoincrement.

Yes. You are correct of course, however I am dealing with static IP
assignment in FreeRADIUS for PPP clients and I just need to make sure that
each user's IP is unique when added via a web interface. Being able to
select the max ip and increment by one in a query would simplify my web
code somewhat.

On a related note we also wrote an ippool module for radius which needs to
have a prepopulated sqltable of ip addresses which it then hands out. Being
able to prepopulate the table with a 10.0.0.0/8 or 192.168.0.0/24 range
with a simple loop would be very usefull.

> You could write a function that would do all this for you, though.

Yep. Sure. I have solutions for the situations I need, but every time I come
across a new problem like this I need to reimpliment (sometimes poorly..)
the a specific solution in my client code (perl and php for the most part).
It would nice if Postgres took away this problem from me in the same way
that it handles date and time arithmetic so wonderfully.

-- 

Peter Nixon
http://www.peternixon.net/
PGP Key: http://www.peternixon.net/public.asc



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Storing a dynahash for an entire connection or
Next
From: Devrim GUNDUZ
Date:
Subject: Re: Shared pg_xlog directory/partition and warm standby