Paul Jungwirth wrote: >> Out of curiosity: any reason the ORDER BY should be in the subquery? It seems like it ought to be in > the UPDATE (if that's allowed). > > Hmm, it's not allowed. :-) It's still surprising that you can guarantee the order of a multi-row > UPDATE by ordering a subquery. To be honest, I don't think that there is any guarantee for this to work reliably in all comparable cases, as PostgreSQL does not guarantee in which order it performs the UPDATEs. It just happens to work with certain plans (use EXPLAIN to see wat will happen). Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general