Re: pgsql: Add INET/CIDR operators: and, or, not, plus - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Add INET/CIDR operators: and, or, not, plus
Date
Msg-id 23282.1139687202@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Add INET/CIDR operators: and, or, not, plus  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-committers
Actually this patch has got some worse problems:

regression=# select '127.0.0.1'::inet + 256;
 ?column?
-----------
 127.0.2.1
(1 row)

which is wrong; if that's not obvious try

regression=# select ('127.0.0.1'::inet + 256) - 256;
 ?column?
-----------
 127.0.1.1
(1 row)

or

regression=# select '127::2'::inet  - ('127::2'::inet - 256);
 ?column?
----------
   -65280
(1 row)

I think the overflow checks are wrong, and the current buildfarm
results say there's a portability problem too.  Working on it now...

            regards, tom lane

pgsql-committers by date:

Previous
From: gsmet@pgfoundry.org (User Gsmet)
Date:
Subject: pgfouine - www: reorganized samples
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix incorrect addition, subtraction, and overflow checking in new