Re: BETWEEN [SYMMETRIC | ASYMMETRIC] - Mailing list pgsql-hackers

From Tom Lane
Subject Re: BETWEEN [SYMMETRIC | ASYMMETRIC]
Date
Msg-id 7784.979084695@sss.pgh.pa.us
Whole thread Raw
In response to BETWEEN [SYMMETRIC | ASYMMETRIC]  ("Robert B. Easter" <reaster@comptechnews.com>)
Responses Re: BETWEEN [SYMMETRIC | ASYMMETRIC]
List 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


pgsql-hackers by date:

Previous
From: "Robert B. Easter"
Date:
Subject: SIMILAR TO for regular expressions
Next
From: "Robert B. Easter"
Date:
Subject: Re: BETWEEN [SYMMETRIC | ASYMMETRIC]