Skip to content

Commit 9cf12df

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

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
@@ -1281,7 +1281,8 @@ ROLLBACK TO s;
12811281

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy