@@ -1200,7 +1200,7 @@ FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] {
12001200 </refsect2>
12011201
12021202 <refsect2 id="SQL-FOR-UPDATE-SHARE">
1203- <title id="sql-for-update-share-title"><literal>FOR UPDATE</>, <literal>FOR NO KEY UPDATE</>/<literal>FOR SHARE</>/<literal>FOR KEY SHARE</> Clauses </title>
1203+ <title id="sql-for-update-share-title">The Locking Clause </title>
12041204
12051205 <para>
12061206 <literal>FOR UPDATE</>, <literal>FOR NO KEY UPDATE</>, <literal>FOR SHARE</>
@@ -1210,30 +1210,19 @@ FETCH { FIRST | NEXT } [ <replaceable class="parameter">count</replaceable> ] {
12101210 </para>
12111211
12121212 <para>
1213- The <literal>FOR UPDATE</literal> clause has this form:
1214- <synopsis>
1215- FOR UPDATE [ OF <replaceable class="parameter">table_name</replaceable> [, ...] ] [ NOWAIT ]
1216- </synopsis>
1217- </para>
1213+ The locking clause has the general form
12181214
1219- <para>
1220- The <literal>FOR NO KEY UPDATE</literal> clause has this form:
12211215<synopsis>
1222- FOR NO KEY UPDATE [ OF <replaceable class="parameter">table_name</replaceable> [, ...] ] [ NOWAIT ]
1216+ FOR <replaceable>lock_strength</> [ OF <replaceable class="parameter">table_name</replaceable> [, ...] ] [ NOWAIT ]
12231217</synopsis>
1224- </para>
12251218
1226- <para>
1227- The closely related <literal>FOR SHARE</literal> clause has this form:
1228- <synopsis>
1229- FOR SHARE [ OF <replaceable class="parameter">table_name</replaceable> [, ...] ] [ NOWAIT ]
1230- </synopsis>
1231- </para>
1219+ where <replaceable>lock_strength</> can be one of
12321220
1233- <para>
1234- Similarly, the <literal>FOR KEY SHARE</> clause has this form:
12351221<synopsis>
1236- FOR KEY SHARE [ OF <replaceable class="parameter">table_name</replaceable> [, ...] ] [ NOWAIT ]
1222+ UPDATE
1223+ NO KEY UPDATE
1224+ SHARE
1225+ KEY SHARE
12371226</synopsis>
12381227 </para>
12391228
@@ -1245,6 +1234,7 @@ FOR KEY SHARE [ OF <replaceable class="parameter">table_name</replaceable> [, ..
12451234 other transactions that attempt <command>UPDATE</command>,
12461235 <command>DELETE</command>,
12471236 <command>SELECT FOR UPDATE</command>,
1237+ <command>SELECT FOR NO KEY UPDATE</command>,
12481238 <command>SELECT FOR SHARE</command> or
12491239 <command>SELECT FOR KEY SHARE</command>
12501240 of these rows will be blocked until the current transaction ends.
@@ -1270,15 +1260,17 @@ FOR KEY SHARE [ OF <replaceable class="parameter">table_name</replaceable> [, ..
12701260 <literal>FOR NO KEY UPDATE</> behaves similarly, except that the lock
12711261 acquired is weaker: this lock will not block
12721262 <literal>SELECT FOR KEY SHARE</> commands that attempt to acquire
1273- a lock on the same rows.
1263+ a lock on the same rows. This lock mode is also acquired by any
1264+ <command>UPDATE</> that does not acquire a <literal>FOR UPDATE</> lock.
12741265 </para>
12751266
12761267 <para>
12771268 <literal>FOR SHARE</literal> behaves similarly, except that it
12781269 acquires a shared rather than exclusive lock on each retrieved
12791270 row. A shared lock blocks other transactions from performing
1280- <command>UPDATE</command>, <command>DELETE</command>, or <command>SELECT
1281- FOR UPDATE</command> on these rows, but it does not prevent them
1271+ <command>UPDATE</command>, <command>DELETE</command>, <command>SELECT
1272+ FOR UPDATE</command> or <command>SELECT FOR NO KEY UPDATE</>
1273+ on these rows, but it does not prevent them
12821274 from performing <command>SELECT FOR SHARE</command> or
12831275 <command>SELECT FOR KEY SHARE</command>.
12841276 </para>
@@ -1290,8 +1282,8 @@ FOR KEY SHARE [ OF <replaceable class="parameter">table_name</replaceable> [, ..
12901282 not <literal>SELECT FOR NO KEY UPDATE</>. A key-shared
12911283 lock blocks other transactions from performing <command>DELETE</command>
12921284 or any <command>UPDATE</command> that changes the key values, but not
1293- other <command>UPDATE</>, and neither it does prevent
1294- <command>SELECT FOR UPDATE</>, <command>SELECT FOR SHARE</>, or
1285+ other <command>UPDATE</>, and neither does it prevent
1286+ <command>SELECT FOR NO KEY UPDATE</>, <command>SELECT FOR SHARE</>, or
12951287 <command>SELECT FOR KEY SHARE</>.
12961288 </para>
12971289
@@ -1382,7 +1374,7 @@ UPDATE mytable SET ... WHERE key = 1;
13821374ROLLBACK TO s;
13831375</programlisting>
13841376 would fail to preserve the <literal>FOR UPDATE</> lock after the
1385- <command>ROLLBACK</>. This has been fixed in release 9.2 .
1377+ <command>ROLLBACK TO </>. This has been fixed in release 9.3 .
13861378 </para>
13871379
13881380 <caution>
0 commit comments