SQLSTATE 55006Severity mediumLab verified

Incident brief

Object in use

A DROP DATABASE was attempted while another session was still connected to that database. PostgreSQL refused to drop it out from under an active connection.

Reproduced on PostgreSQL 16.14Verified 2026-07-16 (Docker lab, PostgreSQL 16.14)Reviewed by Verified against PostgreSQL 16.14 in an isolated lab environment

In 10 seconds

What
Object in use
What triggers it
Session A connects to the target database and stays connected.
The fix
Disconnect (or wait for) every other session connected to the target database, then DROP DATABASE.
Proof
Reproduced on PostgreSQL 16.14 → DROP DATABASE on a database with one other active connection was rejected with SQLSTATE 55006, naming exactly one other session.

The fix

What to do right now

The immediate, application-level response to this error.

  • Disconnect (or wait for) every other session connected to the target database, then DROP DATABASE.
  • Or use DROP DATABASE ... WITH (FORCE) (PostgreSQL 13+) to have PostgreSQL terminate those connections itself.
  • Setting CONNECTION LIMIT 0 does not disconnect anyone already connected — see the counterexample.
Fix — SQL
DROP DATABASE reporting_snapshot WITH (FORCE);

Related & next steps

Follow the thread

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

Verification

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