From 29ddf7086ac5639646010f66137af7068a981bdc Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Fri, 6 Nov 2026 13:58:36 -0600 Subject: [PATCH v4 1/1] 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 mark the first column as row headers so that it is styled like the header row. Author: Vik Fearing Discussion: https://postgr.es/m/37c76707-e6fa-4ee3-b57f-aa0bf1b0bba8%40postgresfriends.org --- doc/src/sgml/func/func-logical.sgml | 70 ++++++++++++++++------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/doc/src/sgml/func/func-logical.sgml b/doc/src/sgml/func/func-logical.sgml index 65e50e65a81..28d49b61a89 100644 --- a/doc/src/sgml/func/func-logical.sgml +++ b/doc/src/sgml/func/func-logical.sgml @@ -47,16 +47,17 @@ SQL uses a three-valued logic system with true, false, and null, which represents unknown. - Observe the following truth tables: + 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 + NULL @@ -64,41 +65,56 @@ TRUE TRUE - TRUE - TRUE + FALSE + NULL - TRUE FALSE FALSE - TRUE + FALSE + FALSE - TRUE NULL NULL - TRUE + FALSE + NULL + + + + + + + OR + TRUE FALSE - FALSE - FALSE - FALSE + NULL + + + + + + TRUE + TRUE + TRUE + TRUE FALSE - NULL + TRUE FALSE NULL NULL - NULL + TRUE NULL NULL @@ -106,28 +122,22 @@ - - + + - a - NOT a - - - - - + NOT TRUE FALSE + NULL + + + FALSE TRUE - - - - NULL NULL -- 2.55.0