From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | "Ilya A(dot) Kovalenko" <shadow(at)oganer(dot)net> |
Cc: | Bruce Momjian <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: inet increment w/ int8 |
Date: | 2005-04-19 16:03:27 |
Message-ID: | 200504191603.j3JG3Rk19696@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Ilya A. Kovalenko wrote:
> BM> Would you modify this so it can go in /contrib or pgfoundry? Is there
> BM> general interest for this?
>
> Actually, I suggested to do such or similar function as internal.
> PostgreSQL has inet/cidr - excellent data type and good facilities to
> examine and compare inet values, but has no facilities to modify
> them (i.e. get-change-return operations).
>
> There is place for many useful operators and functions to do but
> they not invented enough yet (to supplement with existing facilites
> and each other).
>
> Only facility that has no doubt is increment/decrement inet
> address value with numeric value. It nicely supplements existing
> inet compare operators (that compares two addresses as numeric
> values). Also, it can be used to override "+" and "-" operators
> between inet and numeric values.
>
> I understand, that you have more important things to do, so I write
> this function, to save your time.
Agreed. Let's implement '+/-' for 'inet + int4' and put it in the
backend as standard (I can help do the system table stuff if you give me
the C functions). However, how do we handle cases where int4 > 255. I
am thinking we should support only inet + inet, like this:
SELECT '1.2.3.4'::inet + '0.0.1.2'::inet;
But how do we do:
SELECT '1.2.3.255'::inet + '0.0.0.1'::inet;
I assume this becomes '1.2.4.0'. Inet +/- inet seems the most flexible
because it allows you to add to any part of the mask, rather than just
the lower-order bytes, or trying to make sense that 256 adds like
'0.0.1.0'.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-04-19 16:20:51 | Re: Problem with PITR recovery |
Previous Message | Bruce Momjian | 2005-04-19 15:05:32 | Re: Problem with PITR recovery |