SHOW TRIGGERS

On this page Carat arrow pointing down

The SHOW TRIGGERS statement lists the triggers defined on a table.

Required privileges

The user must have any privilege on the target table.

Synopsis

SHOW TRIGGERS FROM table_name

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:

icon/buttons/copy
CREATE TABLE users (id INT PRIMARY KEY, name STRING);
icon/buttons/copy
CREATE FUNCTION update_timestamp()
RETURNS TRIGGER AS $$
BEGIN
  RAISE NOTICE 'Current timestamp: %', now();
  RETURN NEW;
END;
$$ LANGUAGE PLpgSQL;
icon/buttons/copy
CREATE TRIGGER log_update_timestamp
AFTER UPDATE ON users
FOR EACH ROW
EXECUTE FUNCTION update_timestamp();

List the triggers on the table:

icon/buttons/copy
SHOW TRIGGERS FROM users;
      trigger_name     | enabled
-----------------------+----------
  log_update_timestamp |    t
(1 row)

See also

×