]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Optimize BooleanTest with non-nullable input
authorRichard Guo <rguo@postgresql.org>
Tue, 10 Feb 2026 01:18:47 +0000 (10:18 +0900)
committerRichard Guo <rguo@postgresql.org>
Tue, 10 Feb 2026 01:18:47 +0000 (10:18 +0900)
commit0aaf0de7fed8555114aca766e9cdc836dad763a3
treef7c13083ce73ff8f498e223173e2d718e09fc3d9
parent0a379612540cc51e54dc1c0cc4b9ef8797d2533c
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 <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49BMAOWvkdSHxpUDnniqJcEcGq3_8dd_5wTR4xrQY8urA@mail.gmail.com
src/backend/optimizer/util/clauses.c
src/test/regress/expected/predicate.out
src/test/regress/sql/predicate.sql