Skip to content

PostgreSQL UPDATE lowering drops the public AST target alias #30211

Description

@JoeRoddy

Type: SQL lowering bug. Target: Prisma 8 PostgreSQL renderer.

The standalone run.ts builds an aliased UPDATE through public Prisma exports:

const plan = native.sql.public.post.as("p")
  .update({ title: "alias" })
  .returning("id")
  .build();
const ast = plan.ast.withWhere(
  BinaryExpr.eq(ColumnRef.of("p", "id"), LiteralExpr.of("base")),
);
await runtime.query({ ...plan, ast });

The predicate renders a reference to p, but the UPDATE target loses AS p. PostgreSQL rejects the resulting statement with a missing-FROM-clause or invalid-reference error.

Expected behavior: a public aliased DML AST should lower to internally consistent, executable SQL. Target references should remain valid across WHERE, SET expressions, correlated scopes, and RETURNING.

Suggested regression: aliased UPDATE and DELETE with qualified predicates, expressions, RETURNING, and correlated subqueries.

Primary source: public AST types, PostgreSQL target.

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