I was working on a little thing where I needed to simulate BETWEEN SYMMETRIC so naturally I used least() and greatest(). I was a little surprised to see that my expressions were not folded into straight constants and the estimates were way off as a consequence.
I came up with the attached patch to fix it, but it's so ridiculously small that I fear I'm missing something. I don't think this needs any documentation and I didn't see where we have any existing tests for eval_const_expressions so I didn't create any either. Thoughts? -- Vik Fearing +33 6 46 75 15 36 http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index f4446169f5..117efbf7de 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -3378,6 +3378,7 @@ eval_const_expressions_mutator(Node *node, case T_ArrayRef: case T_ArrayExpr: case T_RowExpr: + case T_MinMaxExpr: { /* * Generic handling for node types whose own processing is