From 90f7767a2b26ebf527b19cd44cb0a472246cf508 Mon Sep 17 00:00:00 2001 From: Vik Fearing Date: Thu, 10 Sep 2026 14:30:51 +0200 Subject: [PATCH v1 1/2] doc: Rearrange the logical operator truth tables Present AND, OR, and NOT as matrix tables indexed by operand, instead of one combined row-per-case table, and name the third truth value unknown. Mark the first column as row headers so that it is styled like the header row. --- doc/src/sgml/func/func-logical.sgml | 105 +++++++++++++++------------- 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/doc/src/sgml/func/func-logical.sgml b/doc/src/sgml/func/func-logical.sgml index 65e50e65a81..5ba6389db56 100644 --- a/doc/src/sgml/func/func-logical.sgml +++ b/doc/src/sgml/func/func-logical.sgml @@ -39,103 +39,114 @@ negation boolean AND boolean boolean boolean OR boolean boolean NOT boolean boolean SQL uses a three-valued logic system with true, - false, and null, which represents unknown. - Observe the following truth tables: + false, and unknown; the null value of a boolean and the truth + value unknown are one and the same. In the truth tables below the left + operand of a binary operator selects the row, and the right operand the + column: - + - a - b - a AND b - a OR b + AND + True + False + Unknown - TRUE - TRUE - TRUE - TRUE + True + True + False + Unknown - TRUE - FALSE - FALSE - TRUE + False + False + False + False - TRUE - NULL - NULL - TRUE + Unknown + Unknown + False + Unknown + + + + + + - FALSE - FALSE - FALSE - FALSE + OR + True + False + Unknown + + - FALSE - NULL - FALSE - NULL + True + True + True + True - NULL - NULL - NULL - NULL + False + True + False + Unknown + + + + Unknown + True + Unknown + Unknown - - + + - a - NOT a + NOT + True + False + Unknown - TRUE - FALSE - - - - FALSE - TRUE - - - - NULL - NULL + + False + True + Unknown The operators AND and OR are commutative, that is, you can switch the left and right operands without affecting the result. (However, it is not guaranteed that -- 2.55.0