Skip site navigation (1) Skip section navigation (2)

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$ (view raw, whole thread or download thread mbox)
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  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 or 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
PGP Key:

In response to


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group