On this page
The SHOW TRIGGERS statement lists the triggers defined on a table.
Required privileges
The user must have any privilege on the target table.
Synopsis
Parameters
| Parameter | Description |
|---|---|
table_name |
The name of the table for which to list triggers. |
Response
| Field | Description |
|---|---|
trigger_name |
The name of the trigger. |
enabled |
Whether the trigger is enabled. |
Example
Create a sample table and trigger:
CREATE TABLE users (id INT PRIMARY KEY, name STRING);
CREATE FUNCTION update_timestamp()
RETURNS TRIGGER AS $$
BEGIN
RAISE NOTICE 'Current timestamp: %', now();
RETURN NEW;
END;
$$ LANGUAGE PLpgSQL;
CREATE TRIGGER log_update_timestamp
AFTER UPDATE ON users
FOR EACH ROW
EXECUTE FUNCTION update_timestamp();
List the triggers on the table:
SHOW TRIGGERS FROM users;
trigger_name | enabled
-----------------------+----------
log_update_timestamp | t
(1 row)