Re: BUG #5848: Between operator issue - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #5848: Between operator issue
Date
Msg-id 201101252126.p0PLQ2t05227@momjian.us
Whole thread Raw
In response to BUG #5848: Between operator issue  ("" <curt@net2business.com>)
List pgsql-bugs
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:

    <literal>BETWEEN SYMMETRIC</> is the same as <literal>BETWEEN</>
    except there is no requirement that the argument to the left of
    <literal>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  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Multicolun index creation never completes on 9.0.1/solaris
Next
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5848: Between operator issue