Search Postgresql Archives

Re: Adding integers ( > 8 bytes) to an inet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 08, 2009 at 11:37:02AM -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre@xxxxxxxxxxxxxxxxx> writes:
> > I'd say this is just a missing feature.
> 
> I think the whole thing is a bit of a crock; adding integers to inet
> addresses doesn't make a lot of sense logically.  Perhaps what is
> really wanted is functions on CIDR net identifiers, for instance
> 
> 	first_address('10/8') = 10.0.0.0
> 	last_address('10/8') = 10.255.255.255
> 	prior_address('10/8') = 9.255.255.255
> 	next_address('10/8') = 11.0.0.0
> 
> which would have obvious extensions to IPv6 without having to bring
> numerics into the picture.
> 
> What are the actual applications for adding integers to inet addresses?
> The one Kristian mentions seems to be covered by next_address(), but
> are there others?

My application is a IP address planning tool. The user can make a
request "give me an address from address-pool X" and a stored
procedure will go and find the next available address, it does so
by looping through a prefix, incrementing with the requested
prefix-length for each loop and returning a prefix if it does not
yet exist in the table.

first_address() is basically just host(network('10/8)) while
last_address() is host(broadcast('10/8')), so I see little use
for those. next_address() however, as shown above, seems to fill
my requirements.

For me, as a network engineer, adding an integer to a inet feels
quite natural. Inet is just another representation of a integer
anyway... so I'd really not have a problem with having either a
int16 or being able to add numerics to inets :) 

Btw, anyone have a workaround for my issue?

Kind regards,
   Kristian. 

-- 
Kristian Larsson                                        KLL-RIPE
+46 704 264511			              kll@xxxxxxxxxxxxxx

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux