MCPcopy Create free account
hub / github.com/apache/cloudberry / EventTriggerAlterTableStart

Function EventTriggerAlterTableStart

src/backend/commands/event_trigger.c:1579–1606  ·  view source on GitHub ↗

* EventTriggerAlterTableStart * Prepare to receive data on an ALTER TABLE command about to be executed * * Note we don't collect the command immediately; instead we keep it in * currentCommand, and only when we're done processing the subcommands we will * add it to the command list. */

Source from the content-addressed store, hash-verified

1577 * add it to the command list.
1578 */
1579void
1580EventTriggerAlterTableStart(Node *parsetree)
1581{
1582 MemoryContext oldcxt;
1583 CollectedCommand *command;
1584
1585 /* ignore if event trigger context not set, or collection disabled */
1586 if (!currentEventTriggerState ||
1587 currentEventTriggerState->commandCollectionInhibited)
1588 return;
1589
1590 oldcxt = MemoryContextSwitchTo(currentEventTriggerState->cxt);
1591
1592 command = palloc(sizeof(CollectedCommand));
1593
1594 command->type = SCT_AlterTable;
1595 command->in_extension = creating_extension;
1596
1597 command->d.alterTable.classId = RelationRelationId;
1598 command->d.alterTable.objectId = InvalidOid;
1599 command->d.alterTable.subcmds = NIL;
1600 command->parsetree = copyObject(parsetree);
1601
1602 command->parent = currentEventTriggerState->currentCommand;
1603 currentEventTriggerState->currentCommand = command;
1604
1605 MemoryContextSwitchTo(oldcxt);
1606}
1607
1608/*
1609 * Remember the OID of the object being affected by an ALTER TABLE.

Callers 3

ProcessUtilitySlowFunction · 0.85
AlterTableMoveAllFunction · 0.85

Calls 2

MemoryContextSwitchToFunction · 0.85
pallocFunction · 0.50

Tested by

no test coverage detected