Re: Comparison Predicates - example - documentation seems contradictory? - Mailing list pgsql-docs

From Alvaro Herrera
Subject Re: Comparison Predicates - example - documentation seems contradictory?
Date
Msg-id 20221007101917.3hturo5a7v25cjh7@alvherre.pgsql
Whole thread Raw
In response to Comparison Predicates - example - documentation seems contradictory?  (PG Doc comments form <noreply@postgresql.org>)
Responses Re: Comparison Predicates - example - documentation seems contradictory?  (Ben Koshy <benkoshy@hotmail.com>)
List pgsql-docs
On 2022-Oct-06, PG Doc comments form wrote:

> See the heading: "Table 9.2. Comparison Predicates"
> 
> "2 BETWEEN 3 AND 1 → f" # ok this is false.
> 
> But let's read the example immediately below (the 'not between' example)
> 
> 2 NOT BETWEEN 1 AND 3 → f   # what? This is also false. how can the negation
> also be the same value? I would expect it to be true?

Actually, 2 *is* between 1 and 3.  So if you ask if it's NOT between,
that's false.

The other one is false because the boundaries are reversed, and BETWEEN
does not put them in the proper order before comparing.  BETWEEN
SYMMETRIC does that, as explained in the line below.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/



pgsql-docs by date:

Previous
From: Erki Eessaar
Date:
Subject: Re: SQL-standard function bodies and creating SECURITY DEFINER routines securely
Next
From: Bruce Momjian
Date:
Subject: Re: SQL-standard function bodies and creating SECURITY DEFINER routines securely