Thread: BUG #7832: incorrect summation of ipv6 addresses

BUG #7832: incorrect summation of ipv6 addresses

From
shuklin@selectel.ru
Date:
The following bug has been logged on the website:

Bug reference:      7832
Logged by:          George Shuklin
Email address:      shuklin@selectel.ru
PostgreSQL version: 9.1.0
Operating system:   GNU/Debian Linux Wheezy
Description:        =


Normal summation:

 SELECT cidr'0::1/128'+1;
 ?column? =

----------
 ::2



SELECT cidr'0::1/128'+65535;
 ?column?  =

-----------
 ::0.1.0.0

(strange dots in the middle of the ipv6 address).

Re: BUG #7832: incorrect summation of ipv6 addresses

From
Tom Lane
Date:
shuklin@selectel.ru writes:
> SELECT cidr'0::1/128'+65535;
>  ?column?
> -----------
>  ::0.1.0.0

> (strange dots in the middle of the ipv6 address).

The code in inet_net_ntop_ipv6 (which we got from the BIND project, we
didn't invent it ourselves) appears to believe that values in this
range should be printed in encapsulated-IPv4 format.  Unless you can
cite chapter and verse why that's wrong, I'm disinclined to change it.

            regards, tom lane