Re: Incrementing INET fields

From: Peter Nixonn <listuser(at)peternixon(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Incrementing INET fields
Date: 2006-11-27 22:17:20
Message-ID: ekfo5g$ih7$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Devrim GUNDUZ 2006-11-27 22:31:22 Re: Shared pg_xlog directory/partition and warm standby
Previous Message Joseph Shraibman 2006-11-27 22:08:45 doc patch for savepoints