trigger “…” for relation “…” does not exist
Symptoms
A statement referenced a trigger that does not exist on the given relation. PostgreSQL raises SQLSTATE 42704 (undefined_object).
- The named trigger is not defined on that table.
- Common in
DROP TRIGGER/ALTER TRIGGER. - Trigger names are scoped to their table.
What the server log shows
ERROR: trigger "audit_orders" for relation "orders" does not exist
Why PostgreSQL raises this — what the manual says
As the DROP TRIGGER reference (Description) explains:
No trigger of that name exists on the specified table; in PostgreSQL trigger names are local to a table, so DROP TRIGGER must name both the trigger and the correct table (use IF EXISTS to ignore a missing trigger).
Triggers are named objects attached to a specific relation. Referencing a name not present on that table (typo, already dropped, or wrong table) cannot be resolved, so PostgreSQL reports 42704.
Common causes
- A typo or wrong case in the trigger name.
- The trigger was already dropped or never created.
- Referencing the wrong relation.
How to fix it
- List triggers:
\d tablenameor querypg_trigger. - Use the exact trigger name and the correct table.
- Use
DROP TRIGGER IF EXISTS … ON tablefor idempotency.
Related & next steps
Reference: PostgreSQL 18 — DROP TRIGGER.