Kazaz
PPrisma
•Created by Kazaz on 2/12/2025 in #help-and-questions
queryRaw plsql function failed Code: `42601`. Message: `ERROR: syntax error at or near "$1"`
Hi everyone, I'm trying to call a function in my Postgres DB with this signature:
It gets the brand ID as a variable.
Using Prisma I'm not able to call it no matter what I do:
queryRaw
executeRaw
queryRawUnsafe
executeRawUnsafe
(this is in our tests so no fear of SQL injection)
Here is an example:
brand.id
is a UUID string.
I get this error all the time with all approaches:
Even when I use the unsafe approach the error seems to happen in the queryRaw
function (or executeRaw
if I try and use executeRawUnsafe
).
I also tried using Prisma.raw as was suggested in some Github repo and it didn't work: https://github.com/prisma/prisma/issues/13162#issuecomment-1675434494
How can I make it work?
I assumed that I could run everything I wanted with the unsafe
approaches but seems like it's not working.
It is worth mentioning that if I take the SQL string and run it directly on the DB it does work.
Prisma version: 5.22.0
5 replies