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

Re: BUG #5848: Between operator issue

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: curt(at)net2business(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5848: Between operator issue
Date: 2011-01-25 21:26:02
Message-ID: 201101252126.p0PLQ2t05227@momjian.us (view raw or flat)
Thread:
Lists: pgsql-bugs
curt(at)net2business(dot)com wrote:
> 
> The following bug has been logged online:
> 
> Bug reference:      5848
> Logged by:          
> Email address:      curt(at)net2business(dot)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(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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

In response to

pgsql-bugs by date

Next:From: Kevin GrittnerDate: 2011-01-25 21:27:00
Subject: Re: BUG #5848: Between operator issue
Previous:From: Tom LaneDate: 2011-01-25 21:21:55
Subject: Re: Multicolun index creation never completes on 9.0.1/solaris

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