@@ -66,6 +66,7 @@ static void pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, In
6666static PlannedStmt * pathman_planner_hook (Query * parse ,int cursorOptions ,ParamListInfo boundParams );
6767
6868/* Utility functions */
69+ static void handle_modification_query (Query * parse );
6970static void append_child_relation (PlannerInfo * root ,RelOptInfo * rel ,Index rti ,
7071RangeTblEntry * rte ,int index ,Oid childOID ,List * wrappers );
7172static Node * wrapper_make_expression (WrapperNode * wrap ,int index ,bool * alwaysTrue );
@@ -89,7 +90,6 @@ static void set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, Index rt
8990static List * accumulate_append_subpath (List * subpaths ,Path * path );
9091static void set_pathkeys (PlannerInfo * root ,RelOptInfo * childrel ,Path * path );
9192
92- static void handle_delete_query (Query * parse );
9393
9494/*
9595 * Compare two Datums with the given comarison function
@@ -204,8 +204,9 @@ pathman_planner_hook(Query *parse, int cursorOptions, ParamListInfo boundParams)
204204case CMD_SELECT :
205205disable_inheritance (parse );
206206break ;
207+ case CMD_UPDATE :
207208case CMD_DELETE :
208- handle_delete_query (parse );
209+ handle_modification_query (parse );
209210break ;
210211default :
211212break ;
@@ -269,7 +270,7 @@ disable_inheritance(Query *parse)
269270 * Checks if query is affects only one partition. If true then substitute
270271 */
271272static void
272- handle_delete_query (Query * parse )
273+ handle_modification_query (Query * parse )
273274{
274275PartRelationInfo * prel ;
275276List * ranges ,
@@ -298,7 +299,7 @@ handle_delete_query(Query *parse)
298299// }
299300
300301/* If only one partition is affected then substitute parent table with partition */
301- if (irange_list_length (ranges ))
302+ if (irange_list_length (ranges )== 1 )
302303{
303304IndexRange irange = (IndexRange )linitial_oid (ranges );
304305elog (WARNING ,"lower: %d, upper: %d, lossy: %d" ,irange_lower (irange ),irange_upper (irange ),irange_is_lossy (irange ));