Bug description
Calling findFirst with an undefined in where filter still returns data. This is not intuitive.
How to reproduce
- Deploy this schema with
yarn prisma db push --preview-feature
datasource ds {
provider = "sqlite"
url = "file:./dev.db"
}
generator pc {
provider = "prisma-client-js"
}
model User {
id String @id
name String
}
- Ensure it has some rows
- Run the following script
const { PrismaClient } = require('@prisma/client')
const prisma = new PrismaClient()
async function main() {
const data = await prisma.user.findFirst({
where: {
id: null
},
})
console.log({ data })
}
main()
- It returns
{ data: { id: '1', name: 'Alice' } }
- The where ID doesn't match anything, it shouldn't return
Expected behaviour
IMO, this should be a runtime error.
Prisma information
(base) divyendusingh [p2-ff]$ yarn prisma --version 130 ↵
yarn run v1.22.4
$ /Users/divyendusingh/Documents/prisma/triage/p2-ff/node_modules/.bin/prisma --version
@prisma/cli : 2.15.0-dev.57
@prisma/client : 2.15.0-dev.57
Current platform : darwin
Query Engine : query-engine 6cece221de1da7dd83b9a158db5147e36f802cb1 (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine : migration-engine-cli 6cece221de1da7dd83b9a158db5147e36f802cb1 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 6cece221de1da7dd83b9a158db5147e36f802cb1 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 6cece221de1da7dd83b9a158db5147e36f802cb1 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Studio : 0.333.0
Bug description
Calling
findFirstwith anundefinedin where filter still returns data. This is not intuitive.How to reproduce
yarn prisma db push --preview-featureExpected behaviour
IMO, this should be a runtime error.
Prisma information