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
Is it possible to return the number of inserted records (or updated ones) as a result of executing the upsert statement?
For example, when the INSERT succeeds, it could set an instance variable: __inserted: 1. If there was a conflict and there was a ON CONFLICT DO UPDATE, the number of updated records are set: __updated: 1. If there was a WHERE clause in the update which caused the update not to go through the value would be __updated: 0.
I inspected the generated statement and I could see RETURNING *, xmax = 0, so probably the last boolean can indicate insertion count?
The text was updated successfully, but these errors were encountered:
Is it possible to return the number of inserted records (or updated ones) as a result of executing the upsert statement?
For example, when the
INSERT
succeeds, it could set an instance variable:__inserted: 1
. If there was a conflict and there was aON CONFLICT DO UPDATE
, the number of updated records are set:__updated: 1
. If there was aWHERE
clause in the update which caused the update not to go through the value would be__updated: 0
.I inspected the generated statement and I could see
RETURNING *, xmax = 0
, so probably the last boolean can indicate insertion count?The text was updated successfully, but these errors were encountered: