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-29T20:54:27Z
Lists: pgsql-hackers
Attachments
- 0001-Allow-pushing-CASE-expression-to-foreign-server-v8.patch (text/x-diff) patch v8-0001
Alexander Pyhalov <a.pyhalov@postgrespro.ru> writes: > [ 0001-Allow-pushing-CASE-expression-to-foreign-server-v7.patch ] I looked this over. It's better than before, but the collation handling is still not at all correct. We have to consider that a CASE's arg expression supplies the collation for a contained CaseTestExpr, otherwise we'll come to the wrong conclusions about whether "CASE foreignvar WHEN ..." is shippable, if the foreignvar is what's determining collation of the comparisons. This means that the CaseExpr level of recursion has to pass data down to the CaseTestExpr level. In the attached, I did that by adding an additional argument to foreign_expr_walker(). That's a bit invasive, but it's not awful. I thought about instead adding fields to the foreign_loc_cxt struct. But that seemed considerably messier in the end, because we'd then have some fields that are information sourced at one recursion level and some that are info sourced at another level. I also whacked the regression test cases around a lot. They seemed to spend a lot of time on irrelevant combinations, while failing to check the things that matter, namely whether collation-based pushdown decisions are made correctly. regards, tom lane
Commits
-
In postgres_fdw, allow CASE expressions to be pushed to the remote server.
- 5d44fff01eeb 15.0 landed