Skip site navigation (1) Skip section navigation (2)

INET operators and NOT

From: Tomas Cerha <t(dot)cerha(at)sh(dot)cvut(dot)cz>
To: pgsql-bugs(at)postgresql(dot)org
Subject: INET operators and NOT
Date: 1999-12-17 11:21:15
Message-ID: 385A1CAB.2AE35CD@sh.cvut.cz (view raw or flat)
Thread:
Lists: pgsql-bugs

Your name               :       Tomas Cerha
Your email address      :       t(dot)cerha(at)sh(dot)cvut(dot)cz

System Configuration
---------------------
  Architecture (example: Intel Pentium)         : Intel Pentium MMX

  Operating System (example: Linux 2.0.26 ELF)  : Linux 2.2.5-15 ELF

  PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3 

  Compiler used (example:  gcc 2.8.0)           : installed from RPMs

	installed packages:
		postgresql-6.5.3-1.i386.rpm
		postgresql-perl-6.5.3-1.i386.rpm
		postgresql-server-6.5.3-1.i386.rpm
		postgresql-tcl-6.5.3-1.i386.rpm
		postgresql-test-6.5.3-1.rpm
----------------------------------------------------------------------

Please enter a FULL description of your problem:
------------------------------------------------

Aplying the NOT operator with << INET operator results always in false.
See the example below:

This is the contents of table a:

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

Now, let's select only those hosts from subnet '10.1/16': (works fine)

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

And now, I only apply NOT to prewious statement ....

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


But that is not true! I tryed this also with other versions of postgress
on other machines and the result was always the same. But this makes all
about INET operators quite unusable, when I am not able to exclude some
address space (I can only include them). Or is there another way to do
It?



Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible: 
----------------------------------------------------------------------

CREATE TABLE a (ip inet);

INSERT INTO a VALUES ('10.1.1.1');                                    
INSERT INTO a VALUES ('10.1.1.2');
INSERT INTO a VALUES ('10.2.1.2');
INSERT INTO a VALUES ('10.2.1.1');

SELECT * FROM a;
SELECT * FROM a WHERE ip<<'10.1/16';
SELECT * FROM a WHERE NOT ip<<'10.1/16';

DROP TABLE a;

----------------------------------------------------------------------
Thank you for any idea which could help me with this problem ...

Tom Cerha, student, FEE CTU Prague Czech Republic

pgsql-bugs by date

Next:From: Tom LaneDate: 1999-12-17 17:00:35
Subject: Re: [BUGS] Bug: Inserting
Previous:From: Laurent.LevierDate: 1999-12-17 10:19:47
Subject: PostregSQL 6.5.3 on Linux RedHat 6.1/Ultra1 Sparc (sun4u)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group