diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index fcb1873..4c9d8d9 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -3944,13 +3944,13 @@ quals_match_foreign_key(PlannerInfo *root, ForeignKeyOptInfo *fkinfo,
 			if (i > 0 && bms_is_member(quallstidx, qualmatches))
 				continue;
 
-			/*
-			 * Here since 'usefulquals' only contains bitmap indexes for quals
-			 * of type "var op var" we can safely skip checking this.
-			 */
 			rinfo = (RestrictInfo *) lfirst(lc);
 			clause = (OpExpr *) rinfo->clause;
 
+			/* only OpExprs are useful for consideration */
+			if (!IsA(clause, OpExpr))
+				continue;
+
 			/*
 			 * If the operator does not match then there's little point in
 			 * checking the operands.
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h
index e0ac451..f3b25e2 100644
--- a/src/include/optimizer/paths.h
+++ b/src/include/optimizer/paths.h
@@ -76,8 +76,6 @@ extern Expr *adjust_rowcompare_for_index(RowCompareExpr *clause,
 							int indexcol,
 							List **indexcolnos,
 							bool *var_on_left_p);
-extern bool has_matching_fkey(RelOptInfo *rel, RelOptInfo *frel, List *clauses,
-							  bool reverse);
 
 /*
  * tidpath.h
