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-30T15:48:49Z
Lists: pgsql-hackers
I wrote: > Alexander Pyhalov <a.pyhalov@postgrespro.ru> writes: >> Do we we need to inspect only case_arg_cxt->state? Can we assert that >> collation == case_arg_cxt->collation? > Perhaps, but: > ... Oh, actually there's a third point: the shakiest part of this logic is the assumption that we've correctly matched a CaseTestExpr to its source CaseExpr. Seeing that inlining and constant-folding can mash things to the point where a WHEN expression doesn't look like "CaseTestExpr = RHS", it's a little nervous-making to assume there couldn't be another CASE in between. While there's not known problems of this sort, if it did happen I'd prefer this code to react as "don't push down", not as "assertion failure". (There's been speculation in the past about whether we could find a more bulletproof representation of this kind of CaseExpr. We've not succeeded at that yet though.) regards, tom lane
Commits
-
In postgres_fdw, allow CASE expressions to be pushed to the remote server.
- 5d44fff01eeb 15.0 landed