@@ -258,14 +258,29 @@ get_path_clauses(Path *path, PlannerInfo *root, List **selectivities)
258
258
return get_path_clauses (((MaterialPath * ) path )-> subpath , root ,
259
259
selectivities );
260
260
break ;
261
+ case T_MemoizePath :
262
+ return get_path_clauses (((MemoizePath * ) path )-> subpath , root ,
263
+ selectivities );
264
+ break ;
261
265
case T_ProjectionPath :
262
266
return get_path_clauses (((ProjectionPath * ) path )-> subpath , root ,
263
267
selectivities );
264
268
break ;
269
+ case T_ProjectSetPath :
270
+ return get_path_clauses (((ProjectSetPath * ) path )-> subpath , root ,
271
+ selectivities );
272
+ break ;
265
273
case T_SortPath :
266
274
return get_path_clauses (((SortPath * ) path )-> subpath , root ,
267
275
selectivities );
268
276
break ;
277
+ case T_IncrementalSortPath :
278
+ {
279
+ IncrementalSortPath * p = (IncrementalSortPath * ) path ;
280
+ return get_path_clauses (p -> spath .subpath , root ,
281
+ selectivities );
282
+ }
283
+ break ;
269
284
case T_GroupPath :
270
285
return get_path_clauses (((GroupPath * ) path )-> subpath , root ,
271
286
selectivities );
@@ -302,10 +317,20 @@ get_path_clauses(Path *path, PlannerInfo *root, List **selectivities)
302
317
return get_path_clauses (((SubqueryScanPath * ) path )-> subpath , root ,
303
318
selectivities );
304
319
break ;
320
+ case T_ModifyTablePath :
321
+ return get_path_clauses (((ModifyTablePath * ) path )-> subpath , root ,
322
+ selectivities );
323
+ break ;
324
+ /* TODO: RecursiveUnionPath */
305
325
case T_AppendPath :
326
+ case T_MergeAppendPath :
306
327
{
307
328
ListCell * lc ;
308
329
330
+ /*
331
+ * It isn't a safe style, but we use the only subpaths field that is
332
+ * the first at both Append and MergeAppend nodes.
333
+ */
309
334
foreach (lc , ((AppendPath * ) path )-> subpaths )
310
335
{
311
336
Path * subpath = lfirst (lc );
@@ -343,6 +368,33 @@ get_path_clauses(Path *path, PlannerInfo *root, List **selectivities)
343
368
}
344
369
}
345
370
371
+ /*
372
+ * Some of paths are kind of utility path. I mean, It isn't corresponding to
373
+ * specific RelOptInfo node. So, it should be omitted in process of clauses
374
+ * gathering to avoid duplication of the same clauses.
375
+ * XXX: only a dump plug implemented for now.
376
+ */
377
+ static bool
378
+ is_appropriate_path (Path * path )
379
+ {
380
+ bool appropriate = true;
381
+
382
+ switch (path -> type )
383
+ {
384
+ case T_SortPath :
385
+ case T_IncrementalSortPath :
386
+ case T_MemoizePath :
387
+ case T_GatherPath :
388
+ case T_GatherMergePath :
389
+ appropriate = false;
390
+ break ;
391
+ default :
392
+ break ;
393
+ }
394
+
395
+ return appropriate ;
396
+ }
397
+
346
398
/*
347
399
* Converts path info into plan node for collecting it after query execution.
348
400
*/
@@ -392,7 +444,7 @@ aqo_create_plan_hook(PlannerInfo *root, Path *src, Plan **dest)
392
444
node -> relids = get_list_of_relids (root , ap -> subpath -> parent -> relids );
393
445
node -> jointype = JOIN_INNER ;
394
446
}
395
- else
447
+ else if ( is_appropriate_path ( src ))
396
448
{
397
449
node -> clauses = list_concat (
398
450
aqo_get_clauses (root , src -> parent -> baserestrictinfo ),
0 commit comments