Thread: Why?

Why?

From
"Vladimir S. Petukhov"
Date:
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)

??????

Re: Why?

From
"Vladimir S. Petukhov"
Date:
Sorry, of course... :)
On Thursday 20 January 2005 03:15, Vladimir S. Petukhov wrote:
> 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)
>
> ??????
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
Как сексапильно молвишь ты "Дурак"...
          -- Владимир Вишневский

Now playing: 13 - Wayne Johnson - Goodnight Moon.mp3
   AutoGenerated by fortune & xmms...

Re: Why?

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