Re: Why?

Started by Tom Laneabout 21 years ago1 messagesgeneral
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

"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