pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BETWEEN bug?
4+ messages / 2 participants
[nested] [flat]

* BETWEEN bug?
@ 2002-07-10 19:35  Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Josh Berkus @ 2002-07-10 19:35 UTC (permalink / raw)
  To: pgsql-sql

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?

-- 
-Josh Berkus




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BETWEEN bug?
@ 2002-07-10 20:10  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Stephan Szabo @ 2002-07-10 20:10 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: 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.









^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BETWEEN bug?
@ 2002-07-10 21:57  Josh Berkus <josh@agliodbs.com>
  parent: Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Josh Berkus @ 2002-07-10 21:57 UTC (permalink / raw)
  To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; +Cc: pgsql-sql

Stephan,

> 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.

Thanks.  Thought it was something like that.

Thank you guys, though, OVERLAPS is asymmetric.

-- 
-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                        Josh Berkus
   Complete information technology 	josh@agliodbs.com
    and data management solutions 	(415) 565-7293
   for law firms, small businesses 	 fax 621-2533
    and non-profit organizations. 	San Francisco




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BETWEEN bug?
@ 2002-07-11 03:22  Josh Berkus <josh@agliodbs.com>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Josh Berkus @ 2002-07-11 03:22 UTC (permalink / raw)
  To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; +Cc: pgsql-sql


Stephan,

> Thanks.  Thought it was something like that.
> 
> Thank you guys, though, OVERLAPS is asymmetric.

Err ... I meant "symmetric".

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-07-11 03:22 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-10 19:35 BETWEEN bug? Josh Berkus <josh@agliodbs.com>
2002-07-10 20:10 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-07-10 21:57   ` Josh Berkus <josh@agliodbs.com>
2002-07-11 03:22     ` Josh Berkus <josh@agliodbs.com>

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