SQLSTATE 55000 ERROR Class 55: Object Not In Prerequisite State

object_not_in_prerequisite_state cannot attach table “…” as partition because it is referenced in pu… — 55000

PostgreSQL error “cannot attach table “…” as partition because it is referenced in publication … EXCEPT clause” (SQLSTATE 55000, object_not_in_prerequisite_state): what it means, common causes, and how to fix it.

Last reviewed May 2026 Grounded in source
Production impact High Competency Locking & Concurrency Career Survive on-call independently Frequency Common

Investigation

Symptoms

A statement failed with SQLSTATE 55000 (object_not_in_prerequisite_state), reported at severity ERROR. This is a Object Not In Prerequisite State condition: PostgreSQL emits the message cannot attach table "…" as partition because it is referenced in publication … EXCEPT clause.

  • The client receives SQLSTATE 55000 (object not in prerequisite state).
  • The operation is rejected at ERROR level; the statement does not complete.
  • The server adds a DETAIL line with specifics (see below).

What the server log shows

ERROR:  cannot attach table "…" as partition because it is referenced in publication … EXCEPT clause
DETAIL:  The publication EXCEPT clause cannot contain tables that are partitions.
HINT:  Change the publication's EXCEPT clause using ALTER PUBLICATION ... SET ALL TABLES.

Why PostgreSQL raises this

Class 55 (Object Not In Prerequisite State) is raised when an object exists but is not in a state that allows the requested operation right now.

As described in PostgreSQL’s Appendix A PostgreSQL Error Codes, SQLSTATE 55000 carries the condition name object_not_in_prerequisite_state in class Object Not In Prerequisite State. (Paraphrased — see the linked reference for the exact wording.)

Common causes

  • The object is locked, in use, or being modified by another session.
  • A required precondition (e.g. an index, a prepared state) is not met.
  • The operation cannot run while the object is in its current state.

How to fix it

  1. Wait for the conflicting session/operation to finish, then retry.
  2. Establish the missing precondition before retrying.
  3. Check for blocking locks with pg_locks.

Version applicability

This message text is present in PostgreSQL 19. It was introduced around PostgreSQL 19; earlier releases do not emit this exact text.

Related & next steps

Reference: PostgreSQL Appendix A PostgreSQL Error Codes.

Keep going

Related & next steps

Concepts on this page

Was this helpful?