P
Prisma•2w ago
beeps

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 array
2 Replies
Nurul
Nurul•2w ago
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.
beeps
beepsOP•2w ago
Hey Nurul - somewhat - here is the full query for the filtering scenario: https://pastebin.com/8bLK33rF The insert scenario is just
-- @param {String[]} $1:scanData String of scan data strings to insert
INSERT INTO scan_staging (scan_data)
SELECT unnest($1::text[]);
-- @param {String[]} $1:scanData String of scan data strings to insert
INSERT INTO scan_staging (scan_data)
SELECT unnest($1::text[]);
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.

Did you find this page helpful?