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.

What lands in your log

ERROR: "widgets" is not an index

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

In 10 seconds

What triggers it
Run DROP INDEX against a name that is actually a table.
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.

Fix

What to do right now

Application-level steps for 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;

Verification

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

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops