DELETEon a given table.
INSERTing a list of rows Postgres will respect the order in which they appear in the query, so the reordering can happen beforehand.
UPDATEs is trickier because there is no
ORDER BYclause. The solution to this is to
JOINon a subquery that
SELECTs with the option
DELETEhas the same quircks as
UPDATEand it is too solved in the same way.
DELETEon multiple tables the order to keep is between different operation. For example, supposing
EntryAwas established to be modified before
EntryB, this is not correct:
:update_ato be before
:update_b. When not possible, for instance if
:update_adepends on the result of
:update_b, this can be solved by acquiring the locks in a separate operation.