Re: BETWEEN [SYMMETRIC | ASYMMETRIC]

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Robert B. Easter" <reaster@comptechnews.com>
Cc: pgsql-hackers@postgresql.org
Date: 2001-01-09T23:58:15Z
Lists: pgsql-hackers
"Robert B. Easter" <reaster@comptechnews.com> writes:
> subselects=# SELECT 2 BETWEEN 3 AND 1;
>  ?column?
> ----------
>  f
> (1 row) 

SQL92 quoth:

         6) "X BETWEEN Y AND Z" is equivalent to "X>=Y AND X<=Z".

so this is correct behavior, even if it might seem surprising.

> Any chance of BETWEEN [SYMMETRIC | ASYMMETRIC] being implemented?

> SELECT 2 BETWEEN SYMMETRIC 3 AND 1;
>  ?column?
> ----------
>  t
> (1 row) 

Build a function based on this idea:

regression-# select case
regression-#   when 3 < 1 then  2 between 3 and 1
regression-#   else             2 between 1 and 3
regression-# end;
 case
------
 t
(1 row)

I don't really see this as important enough to justify introducing a
nonstandard syntax for it...

			regards, tom lane