Re: Case expression pushdown
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
Cc: Gilles Darold <gilles@migops.com>, pgsql-hackers@lists.postgresql.org
Date: 2021-07-30T14:17:39Z
Lists: pgsql-hackers
Alexander Pyhalov <a.pyhalov@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
Commits
-
In postgres_fdw, allow CASE expressions to be pushed to the remote server.
- 5d44fff01eeb 15.0 landed