This is a documented limitation:
> Trying to update the same row twice in a single statement is not supported. Only one of the modifications takes
place,but it is not easy (and sometimes not possible) to reliably predict which one. This also applies to deleting a
rowthat was already updated in the same statement: only the update is performed. Therefore you should generally avoid
tryingto modify a single row twice in a single statement. In particular avoid writing WITH sub-statements that could
affectthe same rows changed by the main statement or a sibling sub-statement. The effects of such a statement will not
bepredictable.
https://www.postgresql.org/docs/current/queries-with.html
.m