`SqliteError: near "(": syntax error` when using `notExists`

It seems like queries with notExists clauses add a pair of parentheses too many:

db
    .select({ foobar: sql<number>`1` })
    .from(content)
    .where(notExists(db.select({ foobar: sql<number>`1` }).from(content)))
    .toSQL()
// Output:
{
  sql: 'select 1 from "Content" where not exists ((select 1 from "Content"))',
  params: []
}


Am I doing something wrong or does someone know a workaround?
Was this page helpful?