From c792c7db41466ff02107e3233ec9d92d8e3df866 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 20 Apr 2018 15:19:16 -0400 Subject: Change more places to be less trusting of RestrictInfo.is_pushed_down. On further reflection, commit e5d83995e didn't go far enough: pretty much everywhere in the planner that examines a clause's is_pushed_down flag ought to be changed to use the more complicated behavior where we also check the clause's required_relids. Otherwise we could make incorrect decisions about whether, say, a clause is safe to use as a hash clause. Some (many?) of these places are safe as-is, either because they are never reached while considering a parameterized path, or because there are additional checks that would reject a pushed-down clause anyway. However, it seems smarter to just code them all the same way rather than rely on easily-broken reasoning of that sort. In support of that, invent a new macro RINFO_IS_PUSHED_DOWN that should be used in place of direct tests on the is_pushed_down flag. Like the previous patch, back-patch to all supported branches. Discussion: https://postgr.es/m/f8128b11-c5bf-3539-48cd-234178b2314d@proxel.se --- src/include/optimizer/paths.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/include/optimizer') diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index 50e180c5543..f181586a532 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -115,7 +115,8 @@ extern bool have_join_order_restriction(PlannerInfo *root, extern bool have_dangerous_phv(PlannerInfo *root, Relids outer_relids, Relids inner_params); extern void mark_dummy_rel(RelOptInfo *rel); -extern bool have_partkey_equi_join(RelOptInfo *rel1, RelOptInfo *rel2, +extern bool have_partkey_equi_join(RelOptInfo *joinrel, + RelOptInfo *rel1, RelOptInfo *rel2, JoinType jointype, List *restrictlist); /* -- cgit v1.2.3