pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: BETWEEN bug?
Date: Wed, 10 Jul 2002 13:10:06 -0700 (PDT)
Message-ID: <20020710125904.O53979-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <200207101235.53848.josh@agliodbs.com>


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.









view thread (4+ messages)  latest in thread

Message-ID: <20020710125904.O53979-100000@megazone23.bigpanda.com>
Permalink:  ../20020710125904.O53979-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20020710125904.O53979-100000@megazone23.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, josh@agliodbs.com
  Subject: Re: BETWEEN bug?
  In-Reply-To: <20020710125904.O53979-100000@megazone23.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox