"Viorel Dragomir" <bigchief@vio.ro> writes:
> Indeed it was a mistake not to put the table_name. in where clause.
> But this doesn't resolve the problem.
> Do you know in which order the update will modify the rows?
No, and *it does not matter*. You are forgetting that this all runs
under MVCC rules. The sub-SELECTs will see the pre-existing versions
of the rows, whether or not the UPDATE has yet produced new versions.
regards, tom lane