-
Notifications
You must be signed in to change notification settings - Fork 2.1k
UniqueCompundInput for partial unique index is generated #29282
Copy link
Copy link
Open
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.
Description
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
7.4.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.