Related upstream issue prisma/orm#30163 was closed as completed for the direct PostgreSQL-native enum array_position(text[], enum) overload. This report is limited to the separately reproduced loss of value-set declaration order after a text-backed enum source becomes derived. The standalone package keeps both observations so a new published runtime can be checked completely.
Type: lowering/result semantics bug. Target: prisma/orm PostgreSQL renderer.
The standalone enum is declared low, high, medium. Its direct table query orders the two fixture rows low, high. Wrapping that table in a native DerivedTableSource, while selecting and ordering the same column, returns high, low. The derived query has fallen back to lexical order. The two native ASTs and both actual PostgreSQL results are in run.ts and results.json.
A separate rc.8 baseline case calls ordinary orderBy(e => e.state.asc()) and reproduces the incompatible array_position(text[], enum) overload. That defect is already covered and closed by #30163, so it is retained only as a versioned regression check and is not part of this proposed issue.
Expected behavior: a result-preserving derived SELECT should retain its output enum's declared ordering, including aliases. Relevant regression coverage includes root and nested ordering, ascending and descending order, null placement, output aliases, per-parent pagination, DISTINCT ON, and text-backed versus native enums.
Primary source: tagged PostgreSQL target, public AST types.
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 for database-backed cases
Related upstream issue prisma/orm#30163 was closed as completed for the direct PostgreSQL-native enum
array_position(text[], enum)overload. This report is limited to the separately reproduced loss of value-set declaration order after a text-backed enum source becomes derived. The standalone package keeps both observations so a new published runtime can be checked completely.Type: lowering/result semantics bug. Target: prisma/orm PostgreSQL renderer.
The standalone enum is declared
low,high,medium. Its direct table query orders the two fixture rowslow,high. Wrapping that table in a nativeDerivedTableSource, while selecting and ordering the same column, returnshigh,low. The derived query has fallen back to lexical order. The two native ASTs and both actual PostgreSQL results are inrun.tsandresults.json.A separate rc.8 baseline case calls ordinary
orderBy(e => e.state.asc())and reproduces the incompatiblearray_position(text[], enum)overload. That defect is already covered and closed by #30163, so it is retained only as a versioned regression check and is not part of this proposed issue.Expected behavior: a result-preserving derived SELECT should retain its output enum's declared ordering, including aliases. Relevant regression coverage includes root and nested ordering, ascending and descending order, null placement, output aliases, per-parent pagination,
DISTINCT ON, and text-backed versus native enums.Primary source: tagged PostgreSQL target, public AST types.
Environment
@prisma/orm-postgres:8.0.0-rc.8(the livelatesttag when reverified September 6, 2026)8.0.0-rc.135.9.326.5.011.17.014.23for database-backed cases