-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Prisma v7 breaks postgres Byte upserts #28824
Copy link
Copy link
Closed
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.trackedThis issue is internally tracked by the Prisma Team on Linear.This issue is internally tracked by the Prisma Team on Linear.
Description
Bug description
Prisma v7 breaks postgres Byte upserts.
Severity
🚨 Critical: Data loss, app crash, security issue
Reproduction
Schema:
datasource db {
provider = "postgresql"
relationMode = "foreignKeys"
extensions = [pgcrypto]
}
generator client {
provider = "prisma-client"
previewFeatures = ["relationJoins", "typedSql", "postgresqlExtensions"]
output = "../__generated__/prisma"
engineType = "library"
}
generator pothos {
provider = "prisma-pothos-types"
output = "../__generated__/pothos-types.ts"
}
model TestByteId {
id Bytes @id
value String
}
model TestStringId {
id String @id
value String
}script
await prisma.$executeRaw`DROP TABLE IF EXISTS "Test" CASCADE`;
await prisma.$executeRaw`DROP TABLE IF EXISTS "Test2" CASCADE`;
const stringId = 'hello world!';
const upsertStringRow = () =>
prisma.testStringId.upsert({
create: {
id: stringId,
value: 'hello world!',
},
where: {
id: stringId,
},
update: {},
});
await upsertStringRow();
console.log('created string row');
await upsertStringRow();
console.log('updated string row');
const byteId = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
const upsertByteRow = () =>
prisma.testByteId.upsert({
create: {
id: byteId,
value: 'hello world!',
},
where: {
id: byteId,
},
update: {},
});
await upsertByteRow();
console.log('created byte row');
await upsertByteRow();
console.log('updated byte row');
await prisma.$disconnect();Expected vs. Actual Behavior
Expected:
created string row
updated string row
created byte row
updated byte row
Actual:
created string row
updated string row
created byte row
[error]
An operation failed because it depends on one or more records that were required but not found. No record was found for an upsert.
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Worked in 6.12.0
Broken in 7.0.1
Workaround
Works in 6.12.0
Prisma Schema & Queries
See repro
Prisma Config
No response
Logs & Debug Info
No response
Environment & Setup
- OS: OSX 15.6.1
- Database: Postgres 17
- Node.js version: v22.14.0
Prisma Version
prisma : 7.0.1
@prisma/client : 7.0.1
Operating System : darwin
Architecture : arm64
Node.js : v22.14.0
TypeScript : 5.8.3
Query Compiler : enabled
PSL : @prisma/prisma-schema-wasm 7.1.0-2.f09f2815f091dbba658cdcd2264306d88bb5bda6
Schema Engine : schema-engine-cli f09f2815f091dbba658cdcd2264306d88bb5bda6 (at node_modules/@prisma/engines/schema-engine-darwin-arm64)
Default Engines Hash : f09f2815f091dbba658cdcd2264306d88bb5bda6
Studio : 0.8.2
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.trackedThis issue is internally tracked by the Prisma Team on Linear.This issue is internally tracked by the Prisma Team on Linear.