Alexander Pyhalov <a.pyha...@postgrespro.ru> writes: > The only thing I'm confused about is in T_CaseTestExpr case - how can it > be that CaseTestExpr collation doesn't match case_arg_cxt->collation ? > Do we we need to inspect only case_arg_cxt->state? Can we assert that > collation == case_arg_cxt->collation?
Perhaps, but: (1) I'm disinclined to make this code look different from the otherwise- identical coding elsewhere in foreign_expr_walker. (2) That would create a hard assumption that foreign_expr_walker's conclusions about the collation of a subexpression match those of assign_query_collations. I'm not quite sure I believe that (and if it's true, why aren't we just relying on exprCollation?). Anyway, if we're to have an assertion that it's true, it should be in some place that's a lot less out-of-the-way than CaseTestExpr, because if the assumption gets violated it might be a long time till we notice. So I think we're best off to just write it the way I did, at least so far as this patch is concerned. If we want to rethink the way collation gets calculated here, that would be material for a separate patch. regards, tom lane