SQLSTATE 42809Severity lowLab verified

Incident brief

Wrong object type (DROP INDEX on a table)

Object-specific DDL like DROP INDEX only accepts that object type; running DROP INDEX against a table raises this wrong-object-type error with a hint to use DROP TABLE.

Reproduced on PostgreSQL 18.4Verified 2026-07-24 (isolated lab, PostgreSQL 18.4)Reviewed by Verified against PostgreSQL 18.4 in an isolated lab environment

In 10 seconds

What
Wrong object type (DROP INDEX on a table)
What triggers it
Run DROP INDEX against a name that is actually a table.
The fix
Use the DDL that matches the object type — DROP TABLE for a table, DROP INDEX for an index.
Proof
Reproduced on PostgreSQL 18.4 → A single statement reproduces SQLSTATE 42809; DROP INDEX on a table is rejected with a hint naming the right command.

The fix

What to do right now

The immediate, application-level response to this error.

  • Use the DDL that matches the object type — DROP TABLE for a table, DROP INDEX for an index.
  • Check the object type (\d in psql, or pg_class.relkind) before scripting the drop.
Fix — SQL
-- Use DROP TABLE to remove a table.
DROP TABLE widgets;

Related & next steps

Follow the thread

Everything this error touches — jump straight to the sibling error, term, runbook, or parameter.

Verification

PG 18.4
Last verified
2026-07-24 (isolated lab, PostgreSQL 18.4)
Reviewed by
Verified against PostgreSQL 18.4 in an isolated lab environment
Audit status
reviewed