Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1THija-0007xu-5v for pgsql-bugs@postgresql.org; Fri, 28 Sep 2012 22:08:34 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1THijX-0001Fv-Sy for pgsql-bugs@postgresql.org; Fri, 28 Sep 2012 22:08:33 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1THijX-0002lr-00 for pgsql-bugs@postgresql.org; Fri, 28 Sep 2012 22:08:31 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1THijW-00022e-9T for pgsql-bugs@postgresql.org; Fri, 28 Sep 2012 22:08:30 +0000 Date: Fri, 28 Sep 2012 22:08:30 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7575: "between" does not work properly with inet/cidr addresses To: pgsql-bugs@postgresql.org From: mr.dash.four@googlemail.com X-Pg-Spam-Score: 2.0 (++) X-Archive-Number: 201209/304 X-Sequence-Number: 34298 The following bug has been logged on the website: Bug reference: 7575 Logged by: Mr-4 Email address: mr.dash.four@googlemail.com PostgreSQL version: 9.1.4 Operating system: Linux (kernel 3.5) Description: = 1. select '10.1.1.0/24'::inet between '10.1.1.0'::inet and '10.1.1.255'::inet gives me FALSE. 2. select '10.1.0.0/24'::inet between '10.1.0.0'::inet and '10.1.255.255'::inet also produces FALSE. To my understanding, 10.1.1.0/24 covers the range 10.1.1.0-10.1.1.255, so the first statement above should produce TRUE, not FALSE. It is similar to "select 1 between 1 and 1" which, quite rightly, produces TRUE. Same goes for the second statement above: 10.1.0.0/24 covers the range 10.1.0.0-10.1.0.255, which falls fully within the 10.1.0.0-10.1.255.255 (10.1.0.0/16) range. Am I missing something obvious?