Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af0cc0f

Browse files
committed
Clarify that ORDER BY/FOR UPDATE can't malfunction at higher iso levels.
Kevin Grittner
1 parent e489c00 commit af0cc0f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

doc/src/sgml/ref/select.sgml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,8 @@ ROLLBACK TO s;
12801280

12811281
<caution>
12821282
<para>
1283-
It is possible for a <command>SELECT</> command using <literal>ORDER
1283+
It is possible for a <command>SELECT</> command running at the <literal>READ
1284+
COMMITTED</literal> transaction isolation level and using <literal>ORDER
12841285
BY</literal> and <literal>FOR UPDATE/SHARE</literal> to return rows out of
12851286
order. This is because <literal>ORDER BY</> is applied first.
12861287
The command sorts the result, but might then block trying to obtain a lock
@@ -1301,6 +1302,13 @@ SELECT * FROM (SELECT * FROM mytable FOR UPDATE) ss ORDER BY column1;
13011302
only if concurrent updates of the ordering columns are expected and a
13021303
strictly sorted result is required.
13031304
</para>
1305+
1306+
<para>
1307+
At the <literal>REPEATABLE READ</literal> or <literal>SERIALIZABLE</literal>
1308+
transaction isolation level this would cause a serialization failure (with
1309+
a <literal>SQLSTATE</literal> of <literal>'40001'</literal>), so there is
1310+
no possibility of receiving rows out of order under these isolation levels.
1311+
</para>
13041312
</caution>
13051313
</refsect2>
13061314

0 commit comments

Comments
 (0)