Summary
Emitting a contract whose model has a field mapped (via @map) to a physical column name containing a space produces an invalid contract.d.ts: the space-containing column is emitted as an unquoted TypeScript property key, e.g. readonly has space: { ... }, which is a syntax error. Emission then fails with PN-CLI-4999 ("Property or signature expected.").
Reproduction
PSL:
model DataRow {
id Int @id
spacedValue String? @map("has space")
@@map("data_rows")
}
Run prisma-next contract emit against this schema.
Observed generated type (excerpt) — note the unquoted key has space:
readonly has space: { readonly nativeType: 'text'; readonly codecId: 'pg/text@1'; readonly nullable: true }
Emit fails:
PN-CLI-4999 Unexpected error
why: Property or signature expected. (38:1203)
Expected
Column names that are not valid bare TS identifiers (spaces, punctuation, etc.) must be emitted as quoted/bracketed property keys, e.g. readonly "has space": { ... }, so the generated contract.d.ts is valid TypeScript. Postgres permits such identifiers as quoted names, and @map accepts them at the authoring layer without validation.
Impact
Blocks authoring any contract that maps a column to a name containing a space (or other non-identifier characters). Discovered while building a PSL data-types fixture for test porting; ledger entry #118 (column name with a space) is parked on this issue.
Provenance
Found during test-porting work (tests-ports.md, entry #118). Related upstream coverage: Prisma client issues/22098-column_does_not_exist and column-name handling tests.
Summary
Emitting a contract whose model has a field mapped (via
@map) to a physical column name containing a space produces an invalidcontract.d.ts: the space-containing column is emitted as an unquoted TypeScript property key, e.g.readonly has space: { ... }, which is a syntax error. Emission then fails withPN-CLI-4999("Property or signature expected.").Reproduction
PSL:
Run
prisma-next contract emitagainst this schema.Observed generated type (excerpt) — note the unquoted key
has space:Emit fails:
Expected
Column names that are not valid bare TS identifiers (spaces, punctuation, etc.) must be emitted as quoted/bracketed property keys, e.g.
readonly "has space": { ... }, so the generatedcontract.d.tsis valid TypeScript. Postgres permits such identifiers as quoted names, and@mapaccepts them at the authoring layer without validation.Impact
Blocks authoring any contract that maps a column to a name containing a space (or other non-identifier characters). Discovered while building a PSL data-types fixture for test porting; ledger entry #118 (column name with a space) is parked on this issue.
Provenance
Found during test-porting work (
tests-ports.md, entry #118). Related upstream coverage: Prisma clientissues/22098-column_does_not_existand column-name handling tests.