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

Commit722ddb0

Browse files
committed
Add support of ALTER TABLE .. DETACH PARTITION
1 parent84682ff commit722ddb0

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

‎src/declarative.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,32 @@ void handle_attach_partition(AlterTableStmt *stmt, AlterTableCmd *cmd)
233233
/* handle ALTER TABLE .. DETACH PARTITION command */
234234
voidhandle_detach_partition(AlterTableStmt*stmt,AlterTableCmd*cmd)
235235
{
236+
List*proc_name;
237+
FmgrInfoproc_flinfo;
238+
FunctionCallInfoDataproc_fcinfo;
239+
char*pathman_schema;
240+
Oidpartition_relid,
241+
args=REGCLASSOID;
242+
PartitionCmd*pcmd= (PartitionCmd*)cmd->def;
243+
236244
Assert(cmd->subtype==AT_DetachPartition);
245+
partition_relid=RangeVarGetRelid(pcmd->name,NoLock, false);
246+
247+
/* Fetch pg_pathman's schema */
248+
pathman_schema=get_namespace_name(get_pathman_schema());
249+
250+
/* Build function's name */
251+
proc_name=list_make2(makeString(pathman_schema),
252+
makeString(CppAsString(detach_range_partition)));
253+
254+
/* Lookup function's Oid and get FmgrInfo */
255+
fmgr_info(LookupFuncName(proc_name,1,&args, false),&proc_flinfo);
256+
257+
InitFunctionCallInfoData(proc_fcinfo,&proc_flinfo,
258+
4,InvalidOid,NULL,NULL);
259+
proc_fcinfo.arg[0]=ObjectIdGetDatum(partition_relid);
260+
proc_fcinfo.argnull[0]= false;
261+
262+
/* Invoke the callback */
263+
FunctionCallInvoke(&proc_fcinfo);
237264
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp