Does UPDATE FROM VALUES lock rows in the order they are listed?
0
votes
1
answer
523
views
I'm bulk updating some rows using
UPDATE ... FROM (values ...
as described in this answer .
Will the rows will be locked in the order that they appear in the values? Or do I need to do an explicit SELECT FOR UPDATE
first?
Here's an example statement
UPDATE stats as t set "individualCount" = new_values."individualCount"
FROM (values (6::int,7::int),(3::int,15::int))
as new_values("individualCount","id")
WHERE new_values."id" = t."id"
(id is the primary key of the table)
Asked by ChrisJ
(621 rep)
Jan 31, 2023, 02:39 AM
Last activity: Jun 13, 2025, 07:10 AM
Last activity: Jun 13, 2025, 07:10 AM