TypedSql Array Parameter for Postgres
I am attempting to use array parameters as inputs to my queries, but when I generate the client I get the following error:
Error: SQL documentation parsing: invalid type: 'Int[]' (accepted types are: 'Int', 'BigInt', 'Float', 'Boolean', 'String', 'DateTime', 'Json', 'Bytes', 'Decimal')
at '{Int[]} $1:groupIds Array of group IDs to process'.
If I don't include the [] - the input parameter is not of an array type. I am using this in two scenarios: one with an
ANY()
filter in my where clause, and the other as an unnest($1::text[])
for inserting an array2 Replies
Hey 👋
I assume your use case is similar to this example?
https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/typedsql#passing-array-arguments-to-typedsql
Writing Type-safe SQL with TypedSQL and Prisma Client | Prisma Docu...
Learn how to use TypedSQL to write fully type-safe SQL queries that are compatible with any SQL console and Prisma Client.
Hey Nurul - somewhat - here is the full query for the filtering scenario: https://pastebin.com/8bLK33rF
The insert scenario is just
Pastebin
-- @param {BigInt} $1:groupIds Array of group IDs to process-- @ret...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.