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_5wtr4xrqy8...@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 via email to