Optimize BooleanTest with non-nullable input

Richard Guo <rguo@postgresql.org>

Commit: 0aaf0de7fed8555114aca766e9cdc836dad763a3
Author: Richard Guo <rguo@postgresql.org>
Date: 2026-02-10T01:18:47Z
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

Files

Discussion