On this page
The DROP TRIGGER
statement drops a trigger.
Required privileges
To drop a trigger, a user must have the DROP
privilege on the trigger.
Synopsis
Parameters
Parameter | Description |
---|---|
trigger_name |
The name of the trigger to drop. |
table_name |
The name of the table associated with the trigger. |
Examples
Setup
To follow along, run cockroach demo
to start a temporary, in-memory cluster with the movr
sample dataset preloaded:
$ cockroach demo
Drop a trigger
Create a sample trigger function:
CREATE FUNCTION update_timestamp()
RETURNS TRIGGER AS $$
BEGIN
RAISE NOTICE 'Current timestamp: %', now();
RETURN NEW;
END;
$$ LANGUAGE PLpgSQL;
Create a sample trigger:
CREATE TRIGGER log_update_timestamp
AFTER UPDATE ON users
FOR EACH ROW
EXECUTE FUNCTION update_timestamp();
Drop the trigger:
DROP TRIGGER log_update_timestamp ON users;
Known limitations
DROP TRIGGER
with CASCADE
is not supported. #128151