>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>> Below is an example .sql file that replicates the problem. Put
>> simply, when we array concat with enum_range in the result of a CASE
>> statement the concatenation takes the expression from the CASE
>> statement, not the enum range.
Tom> Wow, that's ... bizarre. I'm thinking that we probably did
Tom> something silly in the big expression-execution rewrite, but it's
Tom> not clear exactly where. Anyway, will look into it if Andres
Tom> doesn't beat me to it.
I took a look, and what I'm seeing suggests that commit 3decd150a2d
might possibly be relevant here (at least to explain why it breaks in 11
but not 10).
What's going on in eval_const_expressions_mutator is that
context->case_val is set when recursing into the elemexpr in the
ArrayCoerceExpr case, so when that sees a CaseTestExpr inside that, it
replaces it (incorrectly).
--
Andrew (irc:RhodiumToad)