Re: inet subtraction fails with IPv6?

From: Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>
To:
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: inet subtraction fails with IPv6?
Date: 2012-01-31 20:07:59
Message-ID: CAKuK5J3xq5OWR9ToKYZdD4hc=81-jkxzQoW91aom=FaTPEymRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Jan 31, 2012 at 2:03 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Jan 31, 2012 at 10:38 AM, Jon Nelson <jnelson+pgsql(at)jamponi(dot)net> wrote:
>> Example (using one of google's IPv6 addrs):
>>
>> jnelson=# select inet '0::0' - inet '2001:4860:4006:800::1011';
>> ERROR:  result is out of range
>> jnelson=#
>
> 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)

Time: 0.417 ms
jnelson=# select inet '0/0' - inet '255.255.255.255';
?column?
-------------
-4294967295
(1 row)

Time: 0.166 ms
jnelson=#

If it makes you happy, reverse the arguments and try it again.

--
Jon

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-01-31 21:25:29 Re: BUG #6200: standby bad memory allocations on SELECT
Previous Message Robert Haas 2012-01-31 20:03:28 Re: inet subtraction fails with IPv6?