* 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. */
| 1577 | * add it to the command list. |
| 1578 | */ |
| 1579 | void |
| 1580 | EventTriggerAlterTableStart(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. |
no test coverage detected