PrismaP
Prisma6mo ago
4 replies
Kale Leafy

TypedSQL Cannot Determine Data Parameter for Array

I'm attempting to create a filter system that uses $queryRawTyped() .

My frontend will have 5+ multi-select string filters. Each of these filters is to check if an element has any of the selected values. If the array is empty, it should not filter by that item.

SELECT *
FROM "Student" stu
WHERE 
($1 IS NULL OR ARRAY_LENGTH($1, 1) = 0) OR stu."name" = ANY($1);

This causes the following error when generating the TypedSQL types
ERROR: could not determine data type of parameter $1

Any suggestions on how I can use TypedSQL to achieve this functionality?
Was this page helpful?