Re: Why? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why?
Date
Msg-id 1056.1106181402@sss.pgh.pa.us
Whole thread Raw
In response to Why?  ("Vladimir S. Petukhov" <vladimir@sycore.org>)
List pgsql-general
"Vladimir S. Petukhov" <vladimir@sycore.org> writes:
> select * from nets;
>  name | note |      net
> ------+------+---------------
>       |      | 172.16.0.0/16
> (1 row)

> select * from nets where net >>= '172.16.4.0/8';
>  name | note | net
> ------+------+-----
> (0 rows)

Are you confusing >>= with <<= perhaps?  The >>= operator tests

    ip_bits(a1) <= ip_bits(a2)
    && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a1)) == 0

which looks reasonable enough to me.  By that logic a /16 net
can never be a supernet of a /8 net.

            regards, tom lane

pgsql-general by date:

Previous
From: "Vladimir S. Petukhov"
Date:
Subject: Re: Why?
Next
From: "Uwe C. Schroeder"
Date:
Subject: Re: need an advice on running Database