You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
INSERT SELECT .. ON CONFLICT .. UPDATE is currently implemented as insertSelectWithConflict, which provides basic upsert functionality in a fairly nice way.
Unfortunately it's fairly limited compared to Esqueleto's update in that it's not possible to constrain what gets updated with a where_ clause.
The current insertSelectWithConflict is nice in that the third argument has the signature:
...which provides a concrete list of updates, which can be used to choose between DO NOTHING or DO UPDATE when the SQL is being generated.
I'm mostly opening this issue up so that interested parties can discuss and/or propose a good API for this. From what I've poked around with so far, everything has small compromises in terms of ergonomics or type safety.
The text was updated successfully, but these errors were encountered:
jkachmar
changed the title
Apply WHERE clause to INSERT SELECT .. ON CONFLICT .. UPDATE
Apply WHERE clause to INSERT SELECT .. ON CONFLICT
Aug 26, 2020
INSERT SELECT .. ON CONFLICT .. UPDATE
is currently implemented asinsertSelectWithConflict
, which provides basicupsert
functionality in a fairly nice way.Unfortunately it's fairly limited compared to Esqueleto's
update
in that it's not possible to constrain what gets updated with awhere_
clause.The current
insertSelectWithConflict
is nice in that the third argument has the signature:...which provides a concrete list of updates, which can be used to choose between
DO NOTHING
orDO UPDATE
when the SQL is being generated.I'm mostly opening this issue up so that interested parties can discuss and/or propose a good API for this. From what I've poked around with so far, everything has small compromises in terms of ergonomics or type safety.
Related issues/PRs: #131 #155
The text was updated successfully, but these errors were encountered: