Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit61f5c80

Browse files
committed
Add compability with REL_10_beta1 branch
1 parente8521d3 commit61f5c80

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

‎src/declarative.c‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,14 @@ handle_attach_partition(Oid parent_relid, AlterTableCmd *cmd)
204204
ParseState*pstate=make_parsestate(NULL);
205205
constPartRelationInfo*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

209212
Assert(cmd->subtype==AT_AttachPartition);
210213

211-
if (pcmd->bound->strategy!=PARTITION_STRATEGY_RANGE)
214+
if (bound->strategy!=PARTITION_STRATEGY_RANGE)
212215
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
213216
errmsg("pg_pathman only supports queries for range partitions")));
214217

@@ -224,11 +227,15 @@ handle_attach_partition(Oid parent_relid, AlterTableCmd *cmd)
224227
proc_name=list_make2(makeString(pathman_schema),
225228
makeString(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);
228235
con=castNode(A_Const,ldatum->value);
229236
lval=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);
232239
con=castNode(A_Const,rdatum->value);
233240
rval=transform_bound_value(pstate,con,prel->ev_type,prel->ev_typmod);
234241

@@ -247,10 +254,6 @@ handle_attach_partition(Oid parent_relid, AlterTableCmd *cmd)
247254
proc_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-
254257
proc_fcinfo.arg[2]=lval->constvalue;
255258
proc_fcinfo.argnull[2]=ldatum->infinite||lval->constisnull;
256259
proc_fcinfo.arg[3]=rval->constvalue;
@@ -308,11 +311,14 @@ handle_create_partition_of(Oid parent_relid, CreateStmt *stmt)
308311
*rval;
309312
A_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 */
312318
Assert(stmt->inhRelations!=NULL);
313319
Assert(stmt->tableElts==NIL);
314320

315-
if (stmt->partbound->strategy!=PARTITION_STRATEGY_RANGE)
321+
if (bound->strategy!=PARTITION_STRATEGY_RANGE)
316322
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
317323
errmsg("pg_pathman only supports queries for range partitions")));
318324

@@ -326,11 +332,11 @@ handle_create_partition_of(Oid parent_relid, CreateStmt *stmt)
326332
errmsg("table \"%s\" is not partitioned by RANGE",
327333
get_rel_name_or_relid(parent_relid))));
328334

329-
ldatum= (PartitionRangeDatum*)linitial(stmt->partbound->lowerdatums);
335+
ldatum= (PartitionRangeDatum*)linitial(bound->lowerdatums);
330336
con=castNode(A_Const,ldatum->value);
331337
lval=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);
334340
con=castNode(A_Const,rdatum->value);
335341
rval=transform_bound_value(pstate,con,prel->ev_type,prel->ev_typmod);
336342

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp