Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4323142

Browse files
committed
Feed ObjectAddress to event triggers for ALTER TABLE ATTACH/DETACH
These flavors of ALTER TABLE were already shaped to report the ObjectAddress of the partition attached or detached, but this data was not added to what is collected for event triggers. The tests of test_ddl_deparse are updated to show the modification in the data reported. Author: Hou Zhijie Reviewed-by: Álvaro Herrera, Amit Kapila, Hayato Kuroda, Michael Paquier Discussion: https://postgr.es/m/OS0PR01MB571626984BD099DADF53F38394899@OS0PR01MB5716.jpnprd01.prod.outlook.com
1 parent 07ff701 commit 4323142

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/backend/commands/tablecmds.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5202,24 +5202,24 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab,
52025202
cur_pass, context);
52035203
Assert(cmd != NULL);
52045204
if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
5205-
ATExecAttachPartition(wqueue, rel, (PartitionCmd *) cmd->def,
5206-
context);
5205+
address = ATExecAttachPartition(wqueue, rel, (PartitionCmd *) cmd->def,
5206+
context);
52075207
else
5208-
ATExecAttachPartitionIdx(wqueue, rel,
5209-
((PartitionCmd *) cmd->def)->name);
5208+
address = ATExecAttachPartitionIdx(wqueue, rel,
5209+
((PartitionCmd *) cmd->def)->name);
52105210
break;
52115211
case AT_DetachPartition:
52125212
cmd = ATParseTransformCmd(wqueue, tab, rel, cmd, false, lockmode,
52135213
cur_pass, context);
52145214
Assert(cmd != NULL);
52155215
/* ATPrepCmd ensures it must be a table */
52165216
Assert(rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
5217-
ATExecDetachPartition(wqueue, tab, rel,
5218-
((PartitionCmd *) cmd->def)->name,
5219-
((PartitionCmd *) cmd->def)->concurrent);
5217+
address = ATExecDetachPartition(wqueue, tab, rel,
5218+
((PartitionCmd *) cmd->def)->name,
5219+
((PartitionCmd *) cmd->def)->concurrent);
52205220
break;
52215221
case AT_DetachPartitionFinalize:
5222-
ATExecDetachPartitionFinalize(rel, ((PartitionCmd *) cmd->def)->name);
5222+
address = ATExecDetachPartitionFinalize(rel, ((PartitionCmd *) cmd->def)->name);
52235223
break;
52245224
default: /* oops */
52255225
elog(ERROR, "unrecognized alter table type: %d",

src/test/modules/test_ddl_deparse/expected/alter_table.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ CREATE TABLE part2 (a int);
5050
NOTICE: DDL test: type simple, tag CREATE TABLE
5151
ALTER TABLE part ATTACH PARTITION part2 FOR VALUES FROM (101) to (200);
5252
NOTICE: DDL test: type alter table, tag ALTER TABLE
53-
NOTICE: subcommand: type ATTACH PARTITION desc <NULL>
53+
NOTICE: subcommand: type ATTACH PARTITION desc table part2
5454
ALTER TABLE part DETACH PARTITION part2;
5555
NOTICE: DDL test: type alter table, tag ALTER TABLE
56-
NOTICE: subcommand: type DETACH PARTITION desc <NULL>
56+
NOTICE: subcommand: type DETACH PARTITION desc table part2
5757
DROP TABLE part2;
5858
ALTER TABLE part ADD PRIMARY KEY (a);
5959
NOTICE: DDL test: type alter table, tag ALTER TABLE

0 commit comments

Comments
 (0)