pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Comparison Predicates - example - documentation seems contradictory?
3+ messages / 3 participants
[nested] [flat]

* Comparison Predicates - example - documentation seems contradictory?
@ 2022-10-06 23:50 PG Doc comments form <noreply@postgresql.org>
  2022-10-07 10:19 ` Re: Comparison Predicates - example - documentation seems contradictory? Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2022-10-06 23:50 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: benkoshy@hotmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/functions.html
Description:

https://www.postgresql.org/docs/14/functions-comparison.html

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?

That doesn't seem right?


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

* Re: Comparison Predicates - example - documentation seems contradictory?
  2022-10-06 23:50 Comparison Predicates - example - documentation seems contradictory? PG Doc comments form <noreply@postgresql.org>
@ 2022-10-07 10:19 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  2022-10-07 21:52   ` Re: Comparison Predicates - example - documentation seems contradictory? Ben Koshy <benkoshy@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Alvaro Herrera @ 2022-10-07 10:19 UTC (permalink / raw)
  To: benkoshy@hotmail.com; pgsql-docs@lists.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/





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

* Re: Comparison Predicates - example - documentation seems contradictory?
  2022-10-06 23:50 Comparison Predicates - example - documentation seems contradictory? PG Doc comments form <noreply@postgresql.org>
  2022-10-07 10:19 ` Re: Comparison Predicates - example - documentation seems contradictory? Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2022-10-07 21:52   ` Ben Koshy <benkoshy@hotmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Ben Koshy @ 2022-10-07 21:52 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

you're 100% right. Got it now. The documentation is correct and does not need to be changed. chrs.
________________________________
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Sent: Friday, 7 October 2022 7:49 PM
To: benkoshy@hotmail.com <benkoshy@hotmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: Comparison Predicates - example - documentation seems contradictory?

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://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.enterprisedb.com%2F&amp;da...


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


end of thread, other threads:[~2022-10-07 21:52 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 23:50 Comparison Predicates - example - documentation seems contradictory? PG Doc comments form <noreply@postgresql.org>
2022-10-07 10:19 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-10-07 21:52   ` Ben Koshy <benkoshy@hotmail.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