Re: inet increment w/ int8 - Mailing list pgsql-hackers

From Greg Stark
Subject Re: inet increment w/ int8
Date
Msg-id 87d5sqk9c1.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: inet increment w/ int8  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: inet increment w/ int8
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:

> am thinking we should support only inet + inet, like this:
> 
>     SELECT '1.2.3.4'::inet + '0.0.1.2'::inet;

I don't think inet+inet makes any sense.

I think inet+int4 should work by adding to the host address and overflowing if
it exceeds the network mask.

Ie, 

10.0.0.0/24   + 1 = 10.0.0.1/24
10.0.0.255/24 + 1 => overflow

Or

10.1/16 + 1      = 10.1.0.1/16
10.1/16 + 16384  = 10.1.64.0/16
10.1/16 + 65536  => overflow



-- 
greg



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problem with PITR recovery
Next
From: Bruce Momjian
Date:
Subject: Re: inet increment w/ int8