Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xgcwt-0002aR-5E for pgsql-bugs@arkaria.postgresql.org; Tue, 21 Oct 2014 17:10:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xgcws-0004EO-JR for pgsql-bugs@arkaria.postgresql.org; Tue, 21 Oct 2014 17:10:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XgXoK-0001FU-NN for pgsql-bugs@postgresql.org; Tue, 21 Oct 2014 11:41:08 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XgXoG-00068c-0M for pgsql-bugs@postgresql.org; Tue, 21 Oct 2014 11:41:06 +0000 MIME-Version: 1.0 Subject: BUG #11734: The "<<=" operator on "inet" values does not return the expected result. To: pgsql-bugs@postgresql.org From: michel@albert.lu Date: Tue, 21 Oct 2014 11:40:40 +0000 Message-ID: <20141021114040.2674.45532@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 11734 Logged by: Michel Albert Email address: michel@albert.lu PostgreSQL version: 9.1.14 Operating system: Ubuntu 12.04.5 LTS Description: Just now I ran into a peculiarity with the '<<=' operator. I have a table which contains both "network" and "host" entries. Their addresses are stored as type "inet". Sidenote: I am aware that it is conceptually bad to have both hosts and networks in the same table, and it is planned to be changed in the future. But for now, that's how it is. The best way to explain this is with a quick example script: CREATE TABLE inettest ( value inet UNIQUE ); INSERT INTO inettest VALUES ('1.2.1.0/24'), ('1.2.1.1/24'), ('1.2.1.2/24'), ('1.2.2.0/24'), ('1.2.3.0/24'), ('1.2.3.1/24'), ('1.2.3.2/24'), ('1.2.3.3/24'), ('1.2.3.4/24') ; SELECT * FROM inettest WHERE value <<= '1.2.3.1/24'::inet; I would expect that the above select would only return *one* row. The one with the host '1.2.3.1/24'. Instead, it returns *all* rows of the '1.2.3.0/24' network. I am not sure if this result is correct (by design), or if it is indeed a bug. In any case, I have solved the issue on my end in the client code, but thought I would let you know nonetheless :) -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs