Re: inet subtraction fails with IPv6? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: inet subtraction fails with IPv6?
Date
Msg-id 11082.1328045831@sss.pgh.pa.us
Whole thread Raw
In response to Re: inet subtraction fails with IPv6?  (Jon Nelson <jnelson+pgsql@jamponi.net>)
List pgsql-bugs
Jon Nelson <jnelson+pgsql@jamponi.net> writes:
> On Tue, Jan 31, 2012 at 2:03 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> What were you expecting to get? There's no such thing as a negative IP address.

> True, but it works for IPv4:

> jnelson=# select inet '255.255.255.255' - inet '0/0';
>   ?column?
> ------------
>  4294967295
> (1 row)

The inet minus inet operator is defined to yield bigint, so it only
copes for addresses within 2^63 of each other.  Short of inventing an
integer type at least 129 bits wide, the only way we could fix this is
to make the operator return numeric instead, which doesn't really seem
like an improvement for typical use-cases.  I'm fairly sure this was
debated when the operator was added, and we thought it was an acceptable
limitation; though maybe with IPv6 finally starting to see real usage
it's going to seem less so.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #6200: standby bad memory allocations on SELECT
Next
From: Tom Lane
Date:
Subject: Re: Fw: Re: [SQL] pg_dump not correctly saving schema with partitioned tables?