Thread: pgsql: Add INET/CIDR operators: and, or, not, plus int8, minus int8, and

pgsql: Add INET/CIDR operators: and, or, not, plus int8, minus int8, and

From
momjian@postgresql.org (Bruce Momjian)
Date:
Log Message:
-----------
Add INET/CIDR operators: and, or, not, plus int8, minus int8, and inet
minus inet.

Stephen R. van den Berg

Modified Files:
--------------
    pgsql/doc/src/sgml:
        func.sgml (r1.303 -> r1.304)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml.diff?r1=1.303&r2=1.304)
    pgsql/src/backend/utils/adt:
        network.c (r1.63 -> r1.64)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/network.c.diff?r1=1.63&r2=1.64)
    pgsql/src/include/catalog:
        pg_operator.h (r1.138 -> r1.139)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_operator.h.diff?r1=1.138&r2=1.139)
        pg_proc.h (r1.394 -> r1.395)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h.diff?r1=1.394&r2=1.395)
    pgsql/src/include/utils:
        builtins.h (r1.272 -> r1.273)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/builtins.h.diff?r1=1.272&r2=1.273)
    pgsql/src/test/regress/expected:
        inet.out (r1.19 -> r1.20)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/inet.out.diff?r1=1.19&r2=1.20)
    pgsql/src/test/regress/sql:
        inet.sql (r1.11 -> r1.12)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/inet.sql.diff?r1=1.11&r2=1.12)

momjian@postgresql.org (Bruce Momjian) writes:
> Log Message:
> -----------
> Add INET/CIDR operators: and, or, not, plus int8, minus int8, and inet
> minus inet.

Shouldn't this commit have included a catversion.h bump?

            regards, tom lane

Re: pgsql: Add INET/CIDR operators: and, or, not, plus

From
Bruce Momjian
Date:
Tom Lane wrote:
> momjian@postgresql.org (Bruce Momjian) writes:
> > Log Message:
> > -----------
> > Add INET/CIDR operators: and, or, not, plus int8, minus int8, and inet
> > minus inet.
>
> Shouldn't this commit have included a catversion.h bump?

Yes, just done.  I mentioned it in the posting but forgot to do it on
commit.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pgsql: Add INET/CIDR operators: and, or, not, plus

From
Tom Lane
Date:
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