© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
1 reply
.deini

Using a placeholder with an inArray

I'm porting a query to a prepared statement, in the query I used to do something like:

.where(inArray(users.id), ['abc', 'def']))
.where(inArray(users.id), ['abc', 'def']))


After trying to move it to a prepared statement:
.where(inArray(users.id), placeholder("userIds"))
.where(inArray(users.id), placeholder("userIds"))


However, when I execute the pepared statement and pass
{ userIds: ['abc', 'def'] }
{ userIds: ['abc', 'def'] }
I get a syntax error:
PostgresError: syntax error at or near "$1"
PostgresError: syntax error at or near "$1"
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

[Postgres] prepared with inArray & placeholder
Drizzle TeamDTDrizzle Team / help
3y ago
inArray
Drizzle TeamDTDrizzle Team / help
3y ago
sql placeholder with an array throws an error
Drizzle TeamDTDrizzle Team / help
2y ago
Using sql.placeholder with limit in creating a prepared query
Drizzle TeamDTDrizzle Team / help
2y ago