© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
Issue with 'insert on conflict do update where' - Drizzle Team
DT
Drizzle Team
•
3y ago
Yarulf
Issue with 'insert on conflict do update where'
I am using
db
.insert
(lastHeaterMetricsTable
)
.values
(heaterEntityWithMaxTime
)
.onConflictDoUpdate
(
{
target
: lastHeaterMetricsTable
.deviceId
,
set
: heaterEntityWithMaxTime
,
where
: lt
(
lastHeaterMetricsTable
.receivedAt
,
heaterEntityWithMaxTime
.receivedAt
,
)
,
}
)
.execute
(
)
But as the query result I get the following
:
where
where
statement is before
do update
do update
, that
's why query failes
. Drizzle ORM 0
.25
.4
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,959
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Custom Logic in Upsert/Insert on conflict
DT
Drizzle Team / help
3y ago
ON DUPLICATE KEY UPDATE with bulk insert?
DT
Drizzle Team / help
3y ago
parameterized insert and update
DT
Drizzle Team / help
3y ago
`with` with insert
DT
Drizzle Team / help
3y ago