On Mon, Jul 21, 2025 at 10:23 PM Richard Guo <[email protected]> wrote:
> Reduce "Var IS [NOT] NULL" quals during constant folding

I feel like this commit message might have missed a fairly important
point here, which is that this commit made it necessary, in some set
of circumstances, for eval_const_expressions() to happen with a valid
PlannerInfo *root and with varnos already fixed. In addition to the
cases covered by 317c117d6d2 and c925ad30b04, there seems to be issues
with partition keys and partition constraints: see
set_baserel_partition_key_exprs and set_baserel_partition_constraint.
Attached are a pair of Claude-written test case that demonstrate
partition pruning failing as a result.

I'm afraid this isn't going to be all the bugs. We have expression
trees in a lot of places, and we call eval_const_expressions()
directly or indirectly in a lot of places, and it doesn't seem easy to
know what we might still have missed.

-- 
Robert Haas
Databricks

Attachment: finding6.sql
Description: Binary data

Attachment: finding8.sql
Description: Binary data

Reply via email to