SQLSTATE 55000 ERROR Class 55: Object Not In Prerequisite State

object_not_in_prerequisite_state materialized view “…” has not been populated — 55000

PostgreSQL error "materialized view "…" has not been populated" (SQLSTATE 55000): what it means, common causes, and how to fix it.

PG 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed May 2025 Grounded in source

Diagnostic Queries

Symptoms

A query tried to read a materialized view that was created WITH NO DATA and never refreshed. PostgreSQL raises SQLSTATE 55000 (object_not_in_prerequisite_state).

  • The materialized view holds no data yet.
  • It was created WITH NO DATA and not refreshed.
  • Reads are blocked until it is populated.

What the server log shows

ERROR:  materialized view "sales_summary" has not been populated
HINT:  Use the REFRESH MATERIALIZED VIEW command.

Why PostgreSQL raises this — what the manual says

the REFRESH MATERIALIZED VIEW reference (Parameters):

“If WITH NO DATA is specified no new data is generated and the materialized view is left in an unscannable state.”

A materialized view created WITH NO DATA is marked unscannable. Until a REFRESH populates it, querying it has no valid contents, so PostgreSQL reports 55000.

Common causes

  • The matview was created WITH NO DATA.
  • A scheduled refresh hasn’t run yet.
  • A failed/aborted refresh left it unpopulated.

How to fix it

  1. Populate it: REFRESH MATERIALIZED VIEW sales_summary;.
  2. Schedule refreshes appropriately for your data freshness needs.
  3. Use REFRESH … CONCURRENTLY (needs a unique index) to avoid blocking readers on later refreshes.

Related & next steps

Reference: PostgreSQL 18 — REFRESH MATERIALIZED VIEW.

Was this helpful?