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

From Jon Nelson
Subject Re: inet subtraction fails with IPv6?
Date
Msg-id CAKuK5J3xq5OWR9ToKYZdD4hc=81-jkxzQoW91aom=FaTPEymRA@mail.gmail.com
Whole thread Raw
In response to Re: inet subtraction fails with IPv6?  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: inet subtraction fails with IPv6?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Tue, Jan 31, 2012 at 2:03 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Tue, Jan 31, 2012 at 10:38 AM, Jon Nelson <jnelson+pgsql@jamponi.net> =
wrote:
>> Example (using one of google's IPv6 addrs):
>>
>> jnelson=3D# select inet '0::0' - inet '2001:4860:4006:800::1011';
>> ERROR: =C2=A0result is out of range
>> jnelson=3D#
>
> What were you expecting to get? =C2=A0There's no such thing as a negative=
 IP address.

True, but it works for IPv4:

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

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

Time: 0.166 ms
jnelson=3D#


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

--=20
Jon

pgsql-bugs by date:

Previous
From: Robert Haas
Date:
Subject: Re: inet subtraction fails with IPv6?
Next
From: Tom Lane
Date:
Subject: Re: BUG #6200: standby bad memory allocations on SELECT