pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: benkoshy@hotmail.com
To: pgsql-docs@lists.postgresql.org
Subject: Re: Comparison Predicates - example - documentation seems contradictory?
Date: Fri, 7 Oct 2022 12:19:17 +0200
Message-ID: <20221007101917.3hturo5a7v25cjh7@alvherre.pgsql> (raw)
In-Reply-To: <166510022672.661.15495990607469895016@wrigleys.postgresql.org>

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/





view thread (3+ messages)  latest in thread

Message-ID: <20221007101917.3hturo5a7v25cjh7@alvherre.pgsql>
Permalink:  ../20221007101917.3hturo5a7v25cjh7@alvherre.pgsql/
Also on:    postgresql.org/message-id/20221007101917.3hturo5a7v25cjh7@alvherre.pgsql

 · 

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-docs@postgresql.org
  Cc: alvherre@alvh.no-ip.org, benkoshy@hotmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Comparison Predicates - example - documentation seems contradictory?
  In-Reply-To: <20221007101917.3hturo5a7v25cjh7@alvherre.pgsql>

* 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