Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPQBk-00000000eeG-2U4Q for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Nov 2026 20:05:30 +0000 Received: from localhost ([127.0.0.1]:49540 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xPQBk-00000001O1L-48Za for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Nov 2026 20:05:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:57692) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPQBk-00000001O1A-2R4N for pgsql-hackers@lists.postgresql.org; Fri, 06 Nov 2026 20:05:28 +0000 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xPQBh-00000000bhn-2ZG7 for pgsql-hackers@lists.postgresql.org; Fri, 06 Nov 2026 20:05:27 +0000 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-48e9476e26aso324475fac.3 for ; Fri, 06 Nov 2026 12:05:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793995526; x=1794600326; darn=lists.postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=0f1tXlMhxPgNiINPgrqvrJ4uPxm+QT5LwtZpBA0x/9A=; b=hCXUCBypFubxiMP9KBpMTrcOkMvO1J8Mn3UWTCTUi0ZJKd8kM/MchUfsBvH6D6UN8G CBOMPyXMvvh0gNYc+W4oDBuySmtToWdyYt5mX2Ukg9Xht6A9uf7ujP0dyyG1P0o2VCJS UXMGVMBM18LK9wf8mE/Gd12SV9JAfFV3jh6tabA1ZJodMKpRjllRbwfyCQiVMjUS/fwO QDxz3Ij21EGz4j4VE73SaHp0nTonewYyb9xUrJaGwCeGEDsNBRcHDQitRr1RAkjDzvJA I8rBQnWLUHZ294aJd6pBeXX3QB88Ve4UBFUoySQhbthvlSq8nYPNnV14DrdJxWio0BSy C9LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793995526; x=1794600326; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0f1tXlMhxPgNiINPgrqvrJ4uPxm+QT5LwtZpBA0x/9A=; b=PhJdOGEuJHbudsZnBTzn8A+sfnJqAySJCglFO5LdVyQnnUw7wVZ52YKccgqJ4WywF3 VmrBt44wiJL8t14hLGxuFlkAe8ct3xajyXq2JrKbFpjMQhROLSLdY1SeMQ1f9+Fmb3Dr lfDpub+gYB42gy0CrWsIQCzvTDRkwzm1sTaEb7SXJ/hwFyXjloI04efImdqND9Vt6ReG q4NLnBlPrPeBQvnO3ZfJT3iRMFG/AAOU8d7MAMjsOCpHjXis66ewBNcJ4NUGwrc8V57j lXt72thBBKkxfx22zVF8x8NtJTkJa06uiKy6NqlnEPA6oxIJdsZgpleYdSXa9YR/mhoG zTww== X-Forwarded-Encrypted: i=1; AKwUvBxYdXIMnWtLkHWl/xdtaNNVK/tfmMq0t7u6GNXD1akZXLHR60jvjE58FaxKMlmlNWTIjAmG0M8nEg31KcBF@lists.postgresql.org X-Gm-Message-State: APuU4Z8Fctgzj5RynP0aG+EQJJPrHMLgGI1HyTa2yArn8I34iuT8qfjT PUXMWq9YBjJuD3i2D74tTKwHpz6EKuUnLoqfT4YI2rpGHBKdngLADBqB X-Gm-Gg: AYBFou04w5VjjfZ8BtZTurzReHE4J8Dra3Ht0xSptxTg8gK6p6yEZceaRIq31H5CVab xHeayvpalw9ORzeyaJNhpIPdsKQxbE0z+JFdZlecJqQzfGHymhxRyCfX36NVeHUNkMjr22rgNKM 5RuXRZnY2qDk7Kx5vv+3qJAgIHDtqLWxjPHUrRS2mfz5kuMkb67F/oS0kK88LbAuuZlwrbiCQA/ S3ODLBkUwezi+z1VHH/Sg+DEpiUyFfmWx/bJYWE67OxsfeGLimLbxjD8YhDJx5B/w9OSMZG3cPV fyKUsEaj0kDb+M4XD/hmfOd1+hV2US1mMbdD9Tr+XcVSMxRdSbB8xDaPvWTMRA1xlpbhG5Z/F/d nhftnnAh2L03wnOml+/+U/I+zZR0uGVKN83ZQNr6X/qvR+fRyCUcsijHJWMZGJc9bc1UGKAYlDr 790eaW8K8YeMBJUSa4zhsUib+PFXNAPX1CyVwUQQGqWCrjZYqRJzRsAdAoRui44zfsSi13trjTc KljrDc7p5ZpvbuyYbi4+t1YoBZwbo3fwZ1V/SAy3tpviku56dT8d7jKEZ10inrxDznYBwfnLwpb IrBfTQ2/QoD6tP7e5cGX0DIcbuJ0VDyVFvgseHCy/3JN2XDUkYtW8NjHgGwtM8vAzPvCT+ESFoA KHH0eaAr4hnsS460wfwng8/fzDGBJ3E7cZecsAanWGeTxbHvIqLasO+uw X-Received: by 2002:a05:6808:1715:b0:4c4:9f7e:92ce with SMTP id 5614622812f47-567e1129550mr2755201b6e.38.1793995526149; Fri, 06 Nov 2026 12:05:26 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4ad97a9b45fsm2718598fac.15.2026.11.06.12.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 12:05:25 -0800 (PST) Date: Fri, 6 Nov 2026 14:05:23 -0600 From: Nathan Bossart To: Vik Fearing Cc: Zsolt Parragi , pgsql-hackers@lists.postgresql.org, Jacob Champion , Isaac Morland Subject: Re: Logical Implication Message-ID: References: <37c76707-e6fa-4ee3-b57f-aa0bf1b0bba8@postgresfriends.org> <9ab35dbb-d9a4-4c1e-bae2-7763ddeb720c@postgresfriends.org> <3d779ee0-6596-4dae-b79c-e35b237f83bf@postgresfriends.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4HINQKUtf45qI6TC" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --4HINQKUtf45qI6TC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 06, 2026 at 01:19:31PM -0500, Nathan Bossart wrote: > On Sat, Oct 03, 2026 at 06:18:43PM +0200, Vik Fearing wrote: >> 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: > > I find the reorganization to be an improvement, and I intend to commit this > one sooner than later. The only thing I'd change is the switch from NULL > to "unknown" in the tables. Users deal with NULL at the command level, and > the rest of the docs use NULL, so I think the existing text has the right > idea by noting once that NULL represents "unknown" and then using NULL > throughout. Concretely, like the attached. -- nathan --4HINQKUtf45qI6TC Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v4-0001-doc-Rearrange-the-logical-operator-truth-tables.patch 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 --4HINQKUtf45qI6TC--