Skip to content

Native Types Postgres: Introspecting timestamp[] and time[] break client generation #4051

@matthewmueller

Description

@matthewmueller

Bug description

When introspecting the timestamp[] or time[] type in Postgres, they become:

DateTime[] @db.Timestamp
DateTime[] @db.Time

which breaks client generation.

How to reproduce

create table types (
  timeStampList timestamp[],
  timeList time[]
);
npx @prisma/cli@dev introspect
model types {
  timeStampList DateTime[] @db.Timestamp
  timeList DateTime[] @db.Time
}
npx @prisma/cli@dev generate
Environment variables loaded from ./prisma/.env
Prisma Schema loaded from prisma/schema.prisma
Error: Schema parsing
error: Function "Timestamp" takes 1 arguments, but received 0.
  -->  schema.prisma:71
   | 
70 |   nl    Bytes[]    @db.ByteA
71 |   ol    DateTime[] @db.Timestamp
   | 
error: Function "Time" takes 1 arguments, but received 0.
  -->  schema.prisma:73
   | 
72 |   pl    DateTime[] @db.Date
73 |   ql    DateTime[] @db.Time
   | 

Validation Error Count: 2

Expected behavior

model types {
  timeStampList DateTime[] @db.Timestamp
  timeList DateTime[] @db.Time
}

Environment & setup

Environment variables loaded from ./prisma/.env
@prisma/cli          : 2.10.0-dev.74
@prisma/client       : 2.10.0-dev.58
Current platform     : darwin
Query Engine         : query-engine 77abecc4840127ebdcc02b83ee1e2c9cc27009f2 (at ../../../../../.npm/_npx/6106/lib/node_modules/@prisma/cli/query-engine-darwin)
Migration Engine     : migration-engine-cli 77abecc4840127ebdcc02b83ee1e2c9cc27009f2 (at ../../../../../.npm/_npx/6106/lib/node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 77abecc4840127ebdcc02b83ee1e2c9cc27009f2 (at ../../../../../.npm/_npx/6106/lib/node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary        : prisma-fmt 77abecc4840127ebdcc02b83ee1e2c9cc27009f2 (at ../../../../../.npm/_npx/6106/lib/node_modules/@prisma/cli/prisma-fmt-darwin)
Studio               : 0.304.0
Preview Features     : nativeTypes

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions