index 335de0a4c1d62029929d6c133dbc29366090cab5..4d39fa128d76e79849e097f4b212c722ba3fc425 100644 (file)
@@ -329,9 +329,14 @@ BuildParameterizedTidPaths(PlannerInfo *root, RelOptInfo *rel, List *clauses)
*
* We currently consider only TidEqual join clauses. In principle we
* might find a suitable ScalarArrayOpExpr in the rel's joininfo list,
- * but it seems unlikely to be worth checking for.
+ * but it seems unlikely to be worth expending the cycles to check.
+ * And we definitely won't find a CurrentOfExpr here. Hence, we don't
+ * use TidQualFromRestrictInfo; but this must match that function
+ * otherwise.
*/
- if (!IsTidEqualClause(rinfo, rel))
+ if (rinfo->pseudoconstant ||
+ !restriction_is_securely_promotable(rinfo, rel) ||
+ !IsTidEqualClause(rinfo, rel))
continue;
/*