public inbox for [email protected]  
help / color / mirror / Atom feed
From: Richard Guo <[email protected]>
To: [email protected]
Subject: pgsql: Optimize BooleanTest with non-nullable input
Date: Tue, 10 Feb 2026 01:20:34 +0000
Message-ID: <[email protected]> (raw)

Optimize BooleanTest with non-nullable input

The BooleanTest construct (IS [NOT] TRUE/FALSE/UNKNOWN) treats a NULL
input as the logical value "unknown".  However, when the input is
proven to be non-nullable, this special handling becomes redundant.
In such cases, the construct can be simplified directly to a boolean
expression or a constant.

Author: Richard Guo <[email protected]>
Reviewed-by: Tender Wang <[email protected]>
Discussion: https://postgr.es/m/CAMbWs49BMAOWvkdSHxpUDnniqJcEcGq3_8dd_5wTR4xrQY8urA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0aaf0de7fed8555114aca766e9cdc836dad763a3

Modified Files
--------------
src/backend/optimizer/util/clauses.c    |  31 +++++++++
src/test/regress/expected/predicate.out | 119 ++++++++++++++++++++++++++++++++
src/test/regress/sql/predicate.sql      |  54 +++++++++++++++
3 files changed, 204 insertions(+)



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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Optimize BooleanTest with non-nullable input
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox