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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Kristian Larsson <kristian(at)spritelink(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Adding integers ( > 8 bytes) to an inet
Date: 2009-09-08 15:37:02
Message-ID: 26970.1252424222@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> 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?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kristian Larsson 2009-09-08 15:49:02 Re: Adding integers ( > 8 bytes) to an inet
Previous Message Sam Mason 2009-09-08 15:31:40 Re: How to store data on an external drive

Browse pgsql-hackers by date

  From Date Subject
Next Message Kristian Larsson 2009-09-08 15:49:02 Re: Adding integers ( > 8 bytes) to an inet
Previous Message Tom Lane 2009-09-08 15:31:40 Re: More Snow Leopard fun: multiarch problems while building plperl