Skip to content

deleteAll with include can return rows that the final DELETE did not affect #30212

Description

@JoeRoddy

Type: mutation result-correlation bug. Target: Prisma 8 SQL ORM client.

The standalone run.ts executes deleteAll() with an include through a public RuntimeQueryable wrapper. The wrapper forwards the snapshot SELECT unchanged and refines the final public DeleteAst to false:

return orm({ context, runtime: noDelete }).public.Post
  .where({ id: "base" })
  .include("comments", (c) => c.select("id"))
  .deleteAll()
  .toArray();

The terminal returns one pre-delete snapshot as if it were deleted. Direct PostgreSQL verification confirms the row still exists and the final DELETE affected zero rows.

Expected behavior: records returned by a delete terminal should correspond to rows affected by its final DML. A later restriction of the public DML AST should not leave an earlier candidate snapshot presented as a successful deletion.

Suggested regression: zero, partial, and complete deletion; composite identities; selected-away identity fields; includes; and final DML refinement through the public runtime boundary.

Primary source: mutation executor, collection mutation dispatch.

Environment

  • @prisma/orm-postgres: 8.0.0-rc.8 (the live latest tag when reverified September 6, 2026)
  • Prisma CLI: 8.0.0-rc.13
  • TypeScript: 5.9.3
  • Node: 26.5.0
  • npm: 11.17.0
  • OS: macOS 26.6.2 arm64
  • PostgreSQL: 14.23

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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