Re: [BUGS] INET operators and NOT - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] INET operators and NOT
Date
Msg-id 29304.946424144@sss.pgh.pa.us
Whole thread Raw
In response to INET operators and NOT  (Tomas Cerha <t.cerha@sh.cvut.cz>)
Responses Re: [HACKERS] Re: INET operators and NOT
List pgsql-bugs
Tomas Cerha <t.cerha@sh.cvut.cz> writes:
> Aplying the NOT operator with << INET operator results always in false.

> accounting=> SELECT * FROM a;
>       ip
> --------
> 10.1.1.1
> 10.1.1.2
> 10.2.1.2
> 10.2.1.1
> (4 rows)

> accounting=> SELECT * FROM a WHERE ip<<'10.1/16';
>       ip
> --------
> 10.1.1.1
> 10.1.1.2
> (2 rows)

> accounting=> SELECT * FROM a WHERE NOT ip<<'10.1/16';
> ip
> --
> (0 rows)

What's going on here is that the optimizer is simplifying "NOT x<<y"
(network_sub) into "x>>=y" (network_supeq), because the pg_operator
entry for << claims that >>= is its negator.  This example demonstrates
that that ain't so.

Can anyone comment on whether any of the inet operators are actually the
correct negator of << ?  For that matter, are inet's other commutator
and negator declarations just as broken?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Samuel A Horwitz
Date:
Subject: rs6000-aix4.2.1.0 - build failure
Next
From: Erix MOLINIE
Date:
Subject: unsubscribe