Closed olfal closed 3 years ago
ALTER USER prisma WITH PASSWORD '${password}'
)ALTER USER prisma WITH PASSWORD '${password}'
ALTER USER prisma WITH PASSWORD $1
, newPassword)
The following does not work as when using prisma.$executeRaw`` it is converted to a PREPARE statement i.e ${password}
is converted to $1
so you should use prisma.$executeRaw(``)
await prisma.$executeRaw`ALTER USER prisma WITH PASSWORD '${password}'`
This produces the following query which is not valid SQL as PREPARE does not support ALTER (see)
PREPARE somthing (text) AS
ALTER USER prisma WITH PASSWORD $1
EXECUTE somthing('prisma');
If you use the following it will work
const password = "prisma"
await prisma.$executeRaw(`ALTER USER prisma WITH PASSWORD '${password}'`)
as the following is generated
ALTER USER prisma WITH PASSWORD 'prisma'
Hey @williamluke4, thanks for your explanation. This is what we are using at the moment, but we were hoping for a safer version :) We will stick with that.
Happy new year!
Hey 👋
I'm trying to run this simple statement, but I get a panic crash.
Just in case, I've also tried without quoting the newPassword variable, but I get
Finally, I can work around this by using the unsafe/deprecated version below, but I thought I'd let you know anyway, since this panic crash does not sound right.
I'm using Prisma with PostgreSQL 12, if that helps.
Here is the full crash report from the error prompt:
Hi Prisma Team! My Prisma Client just crashed. This is the report:
Versions
Logs