trigger “…” for relation “…” does not exist

SQLSTATE 42704 condition undefined_object class 42 — Syntax Error or Access Rule Violation severity ERROR
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 30 May 2025 · Reproduced live with the SQL on this page.

Symptoms

A statement referenced a trigger that does not exist on the given relation. PostgreSQL raises SQLSTATE 42704 (undefined_object).

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

How to fix it

  1. List triggers: \d tablename or query pg_trigger.
  2. Use the exact trigger name and the correct table.
  3. Use DROP TRIGGER IF EXISTS … ON table for idempotency.

Related & next steps

Reference: PostgreSQL 18 — DROP TRIGGER.