[Postgres] prepared with inArray & placeholder

Hello there,

I can't see why It ends with an error :/

export const sumQuery = db
  .select({
    sum: sql<number>`cast(sum(${Table.amount}) as integer)`,
  })
  .from(Table)
  .where(
    inArray(Table.userId, placeholder("userIds"))
  .prepare("sum_query");

// later
const userIds = ['real', 'uuid', 's']
await sumQuery.execute({ userIds });


select cast(sum("amount") as integer) from "table" where "table"."user_id" in $1
[
  [
    '54a7291c-7ab5-4ff0-b4a6-612cc5397a57',
    '69312f6a-6eab-4b67-b4d2-be1800f40d73',
    'a80d62dd-b623-42eb-a853-b8caaddd0d1e'
  ]
]


PostgresError: syntax error at or near "$1"


Any idea?
It only fails with array kind placeholder 😢
Looks like () are missing?
Was this page helpful?