PrismaP
Prisma17mo ago
10 replies
switz

nested raw query errors

  WHERE
    "postId" = ${postId} AND
    ${rootCommentId ? `"id" = ${rootCommentId}` : '"parentCommentId" IS NULL'}


I get
Message: `ERROR: argument of AND must be type boolean, not type text


Do I need to escape this further?
Solution
What version of Prisma ORM are you using? Have you tried TypedSQL? https://www.prisma.io/blog/announcing-typedsql-make-your-raw-sql-queries-type-safe-with-prisma-orm
Prisma
Prisma ORM now supports the ability to write raw sql queries and have the inputs and outputs be fully type-safe! Get the benefit of a high-level API with the power of raw SQL.
Announcing TypedSQL: Make your raw SQL queries type-safe with Prism...
Was this page helpful?