@@ -204,11 +204,14 @@ handle_attach_partition(Oid parent_relid, AlterTableCmd *cmd)
204204ParseState * pstate = make_parsestate (NULL );
205205const PartRelationInfo * prel ;
206206
207- PartitionCmd * pcmd = (PartitionCmd * )cmd -> def ;
207+ PartitionCmd * pcmd = (PartitionCmd * )cmd -> def ;
208+
209+ /* in 10beta1, PartitionCmd->bound is (Node *) */
210+ PartitionBoundSpec * bound = (PartitionBoundSpec * )pcmd -> bound ;
208211
209212Assert (cmd -> subtype == AT_AttachPartition );
210213
211- if (pcmd -> bound -> strategy != PARTITION_STRATEGY_RANGE )
214+ if (bound -> strategy != PARTITION_STRATEGY_RANGE )
212215ereport (ERROR , (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
213216errmsg ("pg_pathman only supports queries for range partitions" )));
214217
@@ -224,11 +227,15 @@ handle_attach_partition(Oid parent_relid, AlterTableCmd *cmd)
224227proc_name = list_make2 (makeString (pathman_schema ),
225228makeString (CppAsString (attach_range_partition )));
226229
227- ldatum = (PartitionRangeDatum * )linitial (pcmd -> bound -> lowerdatums );
230+ if ((!list_length (bound -> lowerdatums ))||
231+ (!list_length (bound -> upperdatums )))
232+ elog (ERROR ,"provide start and end value for range partition" );
233+
234+ ldatum = (PartitionRangeDatum * )linitial (bound -> lowerdatums );
228235con = castNode (A_Const ,ldatum -> value );
229236lval = transform_bound_value (pstate ,con ,prel -> ev_type ,prel -> ev_typmod );
230237
231- rdatum = (PartitionRangeDatum * )linitial (pcmd -> bound -> upperdatums );
238+ rdatum = (PartitionRangeDatum * )linitial (bound -> upperdatums );
232239con = castNode (A_Const ,rdatum -> value );
233240rval = transform_bound_value (pstate ,con ,prel -> ev_type ,prel -> ev_typmod );
234241
@@ -247,10 +254,6 @@ handle_attach_partition(Oid parent_relid, AlterTableCmd *cmd)
247254proc_fcinfo .flinfo -> fn_expr =
248255(Node * )make_fn_expr (proc_fcinfo .flinfo -> fn_oid ,fn_args );
249256
250- if ((!list_length (pcmd -> bound -> lowerdatums ))||
251- (!list_length (pcmd -> bound -> upperdatums )))
252- elog (ERROR ,"provide start and end value for range partition" );
253-
254257proc_fcinfo .arg [2 ]= lval -> constvalue ;
255258proc_fcinfo .argnull [2 ]= ldatum -> infinite || lval -> constisnull ;
256259proc_fcinfo .arg [3 ]= rval -> constvalue ;
@@ -308,11 +311,14 @@ handle_create_partition_of(Oid parent_relid, CreateStmt *stmt)
308311* rval ;
309312A_Const * con ;
310313
314+ /* in 10beta1, PartitionCmd->bound is (Node *) */
315+ PartitionBoundSpec * bound = (PartitionBoundSpec * )stmt -> partbound ;
316+
311317/* we show errors earlier for these asserts */
312318Assert (stmt -> inhRelations != NULL );
313319Assert (stmt -> tableElts == NIL );
314320
315- if (stmt -> partbound -> strategy != PARTITION_STRATEGY_RANGE )
321+ if (bound -> strategy != PARTITION_STRATEGY_RANGE )
316322ereport (ERROR , (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
317323errmsg ("pg_pathman only supports queries for range partitions" )));
318324
@@ -326,11 +332,11 @@ handle_create_partition_of(Oid parent_relid, CreateStmt *stmt)
326332errmsg ("table \"%s\" is not partitioned by RANGE" ,
327333get_rel_name_or_relid (parent_relid ))));
328334
329- ldatum = (PartitionRangeDatum * )linitial (stmt -> partbound -> lowerdatums );
335+ ldatum = (PartitionRangeDatum * )linitial (bound -> lowerdatums );
330336con = castNode (A_Const ,ldatum -> value );
331337lval = transform_bound_value (pstate ,con ,prel -> ev_type ,prel -> ev_typmod );
332338
333- rdatum = (PartitionRangeDatum * )linitial (stmt -> partbound -> upperdatums );
339+ rdatum = (PartitionRangeDatum * )linitial (bound -> upperdatums );
334340con = castNode (A_Const ,rdatum -> value );
335341rval = transform_bound_value (pstate ,con ,prel -> ev_type ,prel -> ev_typmod );
336342