From: Bruce Momjian Date: Thu, 22 Jan 2009 22:56:54 +0000 (+0000) Subject: Document that SELECT FOR UPDATE/SHARE with ORDER BY might return results X-Git-Tag: REL8_3_6~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=879d780f65292c0973d68c4dda721ad28f9a118c;p=postgresql Document that SELECT FOR UPDATE/SHARE with ORDER BY might return results in the incorrect order, per bug 4593. Backpatch to 8.3.X. --- diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 2624630699..b000dbb1f5 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -1,5 +1,5 @@ @@ -941,6 +941,22 @@ ROLLBACK TO s; anymore, in which case it will not be returned. + + + + Similarly, it is possible for a SELECT command + using ORDER BY and FOR + UPDATE/SHARE to return rows out of order. This is + because ORDER BY is applied first. The command + orders the result, but might then block trying to obtain a lock + on one or more of the rows. Once the SELECT + unblocks, one of the ordered columns might have been modified + and be returned out of order. A workaround is to perform + SELECT ... FOR UPDATE/SHARE and then SELECT + ... ORDER BY. + + +