Re: BETWEEN bug? - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: BETWEEN bug?
Date
Msg-id 20020710125904.O53979-100000@megazone23.bigpanda.com
Whole thread Raw
In response to BETWEEN bug?  (Josh Berkus <josh@agliodbs.com>)
Responses Re: BETWEEN bug?  (Josh Berkus <josh@agliodbs.com>)
List pgsql-sql
On Wed, 10 Jul 2002, Josh Berkus wrote:

> Folks,
>
> Why does BETWEEN only work for ascending criteria?  For example:
>
> jwnet=> select '2002-06-07'::TIMESTAMP BETWEEN '2002-06-29'::TIMESTAMP and
> '2002-06-01'::TIMESTAMP;
>  ?column?
> ----------
>  f
> (1 row)
>
> jwnet=> select '2002-06-07'::TIMESTAMP BETWEEN '2002-06-01'::TIMESTAMP and
> '2002-06-29'::TIMESTAMP;
>  ?column?
> ----------
>  t
> (1 row)
>
> The above behaviour does not seem logical; is this a SQL spec thing, or a bug?

Spec thing.

In SQL92,
"X BETWEEN Y AND Z" is equivalent to "X>=Y AND X<=Z".

In SQL99, there's BETWEEN SYMMETRIC and ASYMMETRIC, but ASYMMETRIC is the
default which is the same as the SQL92 version afaics.  Symmetric is an
optional feature that I think Christopher's been working on.








pgsql-sql by date:

Previous
From: "David Durst"
Date:
Subject: Insert Function
Next
From: Ian Barwick
Date:
Subject: Re: Insert Function