@@ -153,6 +153,16 @@ get_path_clauses(Path *path, PlannerInfo *root, List **selectivities)
153153return get_path_clauses (((SetOpPath * )path )-> subpath ,root ,
154154selectivities );
155155break ;
156+ case T_SubqueryScanPath :
157+ /*
158+ * According to the SubqueryScanPath description, we need to use
159+ * path.parent->subroot as the planning context for interpretation
160+ * of the subpath.
161+ */
162+ return get_path_clauses (((SubqueryScanPath * )path )-> subpath ,
163+ path -> parent -> subroot ,
164+ selectivities );
165+ break ;
156166case T_LockRowsPath :
157167return get_path_clauses (((LockRowsPath * )path )-> subpath ,root ,
158168selectivities );
@@ -161,10 +171,6 @@ get_path_clauses(Path *path, PlannerInfo *root, List **selectivities)
161171return get_path_clauses (((LimitPath * )path )-> subpath ,root ,
162172selectivities );
163173break ;
164- case T_SubqueryScanPath :
165- return get_path_clauses (((SubqueryScanPath * )path )-> subpath ,root ,
166- selectivities );
167- break ;
168174case T_AppendPath :
169175{
170176ListCell * lc ;