Re: inet increment with int
Patrick Welche <prlw1@newn.cam.ac.uk>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Date: 2005-09-06T12:12:50Z
Lists: pgsql-hackers
Attachments
- inet.c (text/plain)
On Mon, Sep 05, 2005 at 08:10:16PM +0100, Patrick Welche wrote: > On Mon, Sep 05, 2005 at 03:02:55PM -0400, Tom Lane wrote: > > Patrick Welche <prlw1@newn.cam.ac.uk> writes: > > > * Allow INET + INT4 to increment the host part of the address, or > > > throw an error on overflow > > > > > I think that the naively coded function attached does what is needed, e.g., > > > > What happened to the IPv6 case? > > My take on the thread is that the IPv6 case doesn't make sense, and the > int8 part was dropped from the TODO. > > > Also, I think you need to reject CIDR inputs. > > OK Now with: test=# select '192.168.0.0/24'::inet + 1; ERROR: Trying to increment a network (192.168.0.0/24) rather than a host test=# select '192.168.0.1/24'::inet + -1; ERROR: Increment returns a network (192.168.0.0/24) rather than a host Cheers, Patrick