Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 52BF11337B5E for ; Tue, 25 Jan 2011 17:26:10 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 09930-04 for ; Tue, 25 Jan 2011 21:26:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id 6403D1337B39 for ; Tue, 25 Jan 2011 17:26:02 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id p0PLQ2t05227; Tue, 25 Jan 2011 16:26:02 -0500 (EST) From: Bruce Momjian Message-Id: <201101252126.p0PLQ2t05227@momjian.us> Subject: Re: BUG #5848: Between operator issue In-Reply-To: <201101252047.p0PKlr9G004217@wwwmaster.postgresql.org> To: curt@net2business.com Date: Tue, 25 Jan 2011 16:26:02 -0500 (EST) CC: pgsql-bugs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201101/198 X-Sequence-Number: 29220 curt@net2business.com wrote: > > The following bug has been logged online: > > Bug reference: 5848 > Logged by: > Email address: curt@net2business.com > PostgreSQL version: 8.1.22 > Operating system: Centos 5.5 > Description: Between operator issue > Details: > > Statement 'A between B and C' always false if B is greater than C, even if A > falls between them. I think you want BETWEEN SYMMETRIC: BETWEEN SYMMETRIC is the same as BETWEEN except there is no requirement that the argument to the left of AND be less than or equal to the argument on the right. If it is not, those two arguments are automatically swapped, so that a nonempty range is always implied. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +