PostgreSQL ENABLE TRIGGER
In this section, we are going to understand the working of the Enable trigger using the ALTER TABLE command and see the example of it.
What is PostgreSQL ENABLE TRIGGER command?
If we want to enable a trigger, we will use the ENABLE TRIGGER command with the ALTER TABLE command.
The Syntax of PostgreSQL Enable Trigger using ALTER TRIGGER command
The syntax PostgreSQL Enable Trigger using ALTER TRIGGER command is as follows:
In the above syntax, we have used the following parameters, as shown in the below table:
Note: The PostgreSQL disabled trigger doesn't execute when the triggering event occurs, and to make it implemented, we need to enable it.
Example of PostgreSQL ENABLE TRIGGER using ALTER TABLE command
Let us see a simple example to understand the working of the PostgreSQL ENABLE Trigger command.
In the following example, we are taking a similar Clients table, which we used in the PostgreSQL Disable trigger section of the PostgreSQL tutorial.
If we want to enable the trigger connected with the Client table, as shown in the below command:
On implementing the above command, we will get the following window message, which displays that the First_name_changes trigger with the Clients table has been enabled successfully.
And, if we want to enable all triggers linked with the Clients table, we can use the below command:
After implementing the above command, we will get the following message window, which displays that all the associated trigger has been enabled successfully into the Clients table.
In the PostgreSQL Enable Trigger section, we have learned the following topics: