Bug description
Prisma generates UniqueCompoundInput for a unique partial index. A query can be executed, but acts like findFirst, which may not be expected.
Also, when an actual database contains partial indexes, prisma migration reset && prisma db pull produces previewFeatures = ["partialIndexes"] for each generator, but i expect it to be only for client generator
Severity
🔹 Minor: Unexpected behavior, but does not block development
Reproduction
- Enable new 'partialIndexes' preview feature
- Create a unique partial index, e.g.
@@unique([field1, field2], where: raw("(\"field3\" IS NULL)"))
Expected vs. Actual Behavior
Expected: CompoundUniqueInput is not generated for a unique partial index.
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
No
Workaround
No workaround found
Prisma Schema & Queries
model Entity {
id String @id
field1 String
field2 String
field3 String
@@unique([field1, field2], where: raw("(\"field3\" IS NULL)"))
@@schema("public")
}
await prisma.entity.findUnique({ where: { field1_field2: { field1: "", field2: "" } } })
Prisma Config
No response
Logs & Debug Info
No response
Environment & Setup
- OS: Manjaro
- Database: PostgreSQL
- Node.js version: 24.13.1
Prisma Version
Bug description
Prisma generates UniqueCompoundInput for a unique partial index. A query can be executed, but acts like findFirst, which may not be expected.
Also, when an actual database contains partial indexes,
prisma migration reset && prisma db pullproducespreviewFeatures = ["partialIndexes"]for each generator, but i expect it to be only forclientgeneratorSeverity
🔹 Minor: Unexpected behavior, but does not block development
Reproduction
@@unique([field1, field2], where: raw("(\"field3\" IS NULL)"))Expected vs. Actual Behavior
Expected:
CompoundUniqueInputis not generated for a unique partial index.Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
No
Workaround
No workaround found
Prisma Schema & Queries
Prisma Config
No response
Logs & Debug Info
No response
Environment & Setup
Prisma Version