HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

Event Trigger

Availability

This feature is available since MogDB 5.0.0.

Introduction

An event trigger is used to capture and process DDL operations.

Benefits

A typical application scenario is as follows: An event trigger is used to capture DDL operations and target objects to implement data synchronization.

Description

The event trigger can capture DDL operations in the current database and target objects of DDL operations. It cannot capture operations on shared objects, such as databases, roles, and tablespaces. The event trigger can capture four types of events: ddl_command_start, ddl_command_end, sql_drop, and table_rewrite.

  1. The ddl_command_start event occurs before the CREATE, ALTER, DROP, SECURITY LABEL, COMMENT, GRANT, or REVOKE statement is executed. The existence of the affected object is not checked before the event trigger is used.
  2. The ddl_command_end event captures DDL operations and occurs after DDL execution.
  3. The sql_drop event captures any operation of deleting database objects and is executed before ddl_command_end.
  4. The table_rewrite event occurs only before the table is overwritten by some actions of the ALTER TABLE and ALTER TYPE statements.

Constraints

  • This feature is available only in PG-compatible mode.
  • Only the system administrator can add, delete, and modify the event trigger.
  • Built-in functions related to the event trigger can be used only for event trigger functions (the return type is event_trigger).

Dependencies

None.

CREATE EVENT TRIGGER, ALTER EVENT TRIGGER, DROP EVENT TRIGGER

Copyright © 2011-2024 www.enmotech.com All rights reserved.