Optimize BooleanTest with non-nullable input
Richard Guo <rguo@postgresql.org>
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
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/util/clauses.c | modified | +31 −0 |
| src/test/regress/expected/predicate.out | modified | +119 −0 |
| src/test/regress/sql/predicate.sql | modified | +54 −0 |
Discussion
- Optimize IS DISTINCT FROM with non-nullable inputs 9 messages · 2026-01-23 → 2026-02-10