Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
bug/2-confirmedBug has been reproduced and confirmed.kind/bugA reported bug.topic: native database typestopic: postgresqltopic: uuid
Milestone
Description
Bug description
When the following query where id is @postgres.Uuid type is executed prisma is throwing the following panic:
const data = await prisma.user.findMany({
where: {
id: {
mode: "insensitive",
contains: "something",
},
},
});(node:9993) UnhandledPromiseRejectionWarning: Error:
Invalid `prisma.user.findMany()` invocation:
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState("42883"), message: "function lower(uuid) does not exist", detail: None, hint: Some("No function matches the given name and argument types. You might need to add explicit type casts."), position: Some(Original(105)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("parse_func.c"), line: Some(627), routine: Some("ParseFuncOrColumn") }) }) })
at PrismaClientFetcher.request (/home/harshit/code/reproductions/issue-3447-studio/node_modules/@prisma/client/runtime/index.js:78461:15)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at main (/home/harshit/code/reproductions/issue-3447-studio/main.ts:6:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9993) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9993) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
How to reproduce
Expected behavior
Prisma should not ever generate this invalid sql.
Prisma information
See the reproduction posted above
Environment & setup
- OS: Ubuntu 20.04 via WSL
- Database: Postgres 12 (docker)
- Node.js version: 14.15.2
- Prisma version:
@prisma/cli : 2.16.0-dev.23
@prisma/client : 2.16.0-dev.25
Current platform : debian-openssl-1.1.x
Query Engine : query-engine 874f616fce40a665d24867f42e602ce8b5ed2cd7 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine : migration-engine-cli 874f616fce40a665d24867f42e602ce8b5ed2cd7 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 874f616fce40a665d24867f42e602ce8b5ed2cd7 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt 874f616fce40a665d24867f42e602ce8b5ed2cd7 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Studio : 0.343.0
Preview Features : nativeTypes
Metadata
Metadata
Assignees
Labels
bug/2-confirmedBug has been reproduced and confirmed.kind/bugA reported bug.topic: native database typestopic: postgresqltopic: uuid
Activity
skworden commentedon Jan 28, 2021
I also get the same error when filtering a uuid column using "equals" in Prisma Studio. It works using "in" and adding the uuid value in the array. I haven't tried other types.
flaviaan commentedon Feb 8, 2021
After investigating the issue, the conclusion is that we're not yet in a position to fix that issue. We'll get back to it once the Query Engine can deal with native types more granularly.
matthewmueller commentedon Feb 8, 2021
To elaborate on @Weakky's comment: we use the underlying database as much as possible. For Postgres, the query would look like this:
Unfortunately
lowerdoes not accept auuidas an input. In the future, we may disable this API so you can't run into this runtime error, but we're not there yet.pantharshit00 commentedon May 4, 2021
This is still reproducible in 2.22.
Jolg42 commentedon Sep 7, 2022
Can reproduce in our internal dev version
4.4.0-dev.30Note: The message is now different
Jolg42 commentedon Oct 21, 2022
This cannot be reproduced since
4.4.0, it now errors with a TypeScript error (also on 4.5.0)Jolg42 commentedon Oct 21, 2022
This issue was a duplicate of #9007