Skip to content

Rollback (downgrade 0.224.0 → 0.209.0) fails due to dependent view on sqlmesh._snapshots #5464

@nickmuoh

Description

@nickmuoh

Description

Running sqlmesh rollback after downgrading from sqlmesh 0.224.0 to 0.209.0 raises a PostgreSQL dependency error. The process attempts to drop table sqlmesh._snapshots while view sqlmesh.model_snapshots still depends on it, causing the rollback to abort and leaving state objects partially reverted.

Error Snippet

psycopg2.errors.DependentObjectsStillExist: cannot drop table sqlmesh._snapshots because other objects depend on it
DETAIL:  view sqlmesh.model_snapshots depends on table sqlmesh._snapshots

Steps to Reproduce

  1. Install and run with sqlmesh 0.224.0 (state initialized).
  2. Downgrade dependency to sqlmesh 0.209.0.
  3. Execute sqlmesh rollback.
  4. Observe failure.

Actual Result

Rollback halts with a dependency error; state not fully rolled back.

Expected Result

Rollback completes without dependency errors and state objects are reverted consistently.

Impact

Prevents rollback during version downgrade; leaves residual state.

Environment

Database: PostgreSQL
Previous version: 0.224.0
Downgraded to: 0.209.0
Python: 3.10.x
Platform: Windows (dev environment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions