1 /*-------------------------------------------------------------------------
2  *
3  * insert_select_planner.h
4  *
5  * Declarations for public functions and types related to planning
6  * INSERT..SELECT commands.
7  *
8  * Copyright (c) Citus Data, Inc.
9  *
10  *-------------------------------------------------------------------------
11  */
12 
13 #ifndef INSERT_SELECT_PLANNER_H
14 #define INSERT_SELECT_PLANNER_H
15 
16 
17 #include "postgres.h"
18 
19 #include "distributed/multi_physical_planner.h"
20 #include "distributed/distributed_planner.h"
21 #include "nodes/execnodes.h"
22 #include "nodes/parsenodes.h"
23 #include "nodes/plannodes.h"
24 
25 
26 extern bool InsertSelectIntoCitusTable(Query *query);
27 extern bool CheckInsertSelectQuery(Query *query);
28 extern bool InsertSelectIntoLocalTable(Query *query);
29 extern Query * ReorderInsertSelectTargetLists(Query *originalQuery,
30 											  RangeTblEntry *insertRte,
31 											  RangeTblEntry *subqueryRte);
32 extern void NonPushableInsertSelectExplainScan(CustomScanState *node, List *ancestors,
33 											   struct ExplainState *es);
34 extern DistributedPlan * CreateInsertSelectPlan(uint64 planId, Query *originalQuery,
35 												PlannerRestrictionContext *
36 												plannerRestrictionContext,
37 												ParamListInfo boundParams);
38 extern DistributedPlan * CreateInsertSelectIntoLocalTablePlan(uint64 planId,
39 															  Query *originalQuery,
40 															  ParamListInfo
41 															  boundParams, bool
42 															  hasUnresolvedParams,
43 															  PlannerRestrictionContext *
44 															  plannerRestrictionContext);
45 extern char * InsertSelectResultIdPrefix(uint64 planId);
46 extern bool PlanningInsertSelect(void);
47 
48 
49 #endif /* INSERT_SELECT_PLANNER_H */
50