mirror of
https://github.com/postgres/postgres.git
synced 2025-06-08 22:02:03 +03:00
Clarify that ORDER BY/FOR UPDATE can't malfunction at higher iso levels.
Kevin Grittner
This commit is contained in:
parent
e489c000d9
commit
af0cc0f42d
@ -1280,7 +1280,8 @@ ROLLBACK TO s;
|
|||||||
|
|
||||||
<caution>
|
<caution>
|
||||||
<para>
|
<para>
|
||||||
It is possible for a <command>SELECT</> command using <literal>ORDER
|
It is possible for a <command>SELECT</> command running at the <literal>READ
|
||||||
|
COMMITTED</literal> transaction isolation level and using <literal>ORDER
|
||||||
BY</literal> and <literal>FOR UPDATE/SHARE</literal> to return rows out of
|
BY</literal> and <literal>FOR UPDATE/SHARE</literal> to return rows out of
|
||||||
order. This is because <literal>ORDER BY</> is applied first.
|
order. This is because <literal>ORDER BY</> is applied first.
|
||||||
The command sorts the result, but might then block trying to obtain a lock
|
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;
|
|||||||
only if concurrent updates of the ordering columns are expected and a
|
only if concurrent updates of the ordering columns are expected and a
|
||||||
strictly sorted result is required.
|
strictly sorted result is required.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
At the <literal>REPEATABLE READ</literal> or <literal>SERIALIZABLE</literal>
|
||||||
|
transaction isolation level this would cause a serialization failure (with
|
||||||
|
a <literal>SQLSTATE</literal> of <literal>'40001'</literal>), so there is
|
||||||
|
no possibility of receiving rows out of order under these isolation levels.
|
||||||
|
</para>
|
||||||
</caution>
|
</caution>
|
||||||
</refsect2>
|
</refsect2>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user