@@ -36,22 +36,25 @@ do LockTuple as well, if there is any conflict, to ensure that they don't
3636starve out waiting exclusive-lockers. However, if there is not any active
3737conflict for a tuple, we don't incur any extra overhead.
3838
39- We provide four levels of tuple locking strength: SELECT FOR KEY UPDATE is
40- super-exclusive locking (used to delete tuples and more generally to update
41- tuples modifying the values of the columns that make up the key of the tuple);
42- SELECT FOR UPDATE is a standards-compliant exclusive lock; SELECT FOR SHARE
43- implements shared locks; and finally SELECT FOR KEY SHARE is a super-weak mode
44- that does not conflict with exclusive mode, but conflicts with SELECT FOR KEY
45- UPDATE. This last mode implements a mode just strong enough to implement RI
46- checks, i.e. it ensures that tuples do not go away from under a check, without
47- blocking when some other transaction that want to update the tuple without
48- changing its key.
39+ We provide four levels of tuple locking strength: SELECT FOR UPDATE obtains an
40+ exclusive lock which prevents any kind of modification of the tuple. This is
41+ the lock level that is implicitly taken by DELETE operations, and also by
42+ UPDATE operations if they modify any of the tuple's key fields. SELECT FOR NO
43+ KEY UPDATE likewise obtains an exclusive lock, but only prevents tuple removal
44+ and modifications which might alter the tuple's key. This is the lock that is
45+ implicitly taken by UPDATE operations which leave all key fields unchanged.
46+ SELECT FOR SHARE obtains a shared lock which prevents any kind of tuple
47+ modification. Finally, SELECT FOR KEY SHARE obtains a shared lock which only
48+ prevents tuple removal and modifications of key fields. This last mode
49+ implements a mode just strong enough to implement RI checks, i.e. it ensures
50+ that tuples do not go away from under a check, without blocking when some
51+ other transaction that want to update the tuple without changing its key.
4952
5053The conflict table is:
5154
52- KEY UPDATE UPDATE SHARE KEY SHARE
53- KEY UPDATE conflict conflict conflict conflict
54- UPDATE conflict conflict conflict
55+ UPDATE NO KEY UPDATE SHARE KEY SHARE
56+ UPDATE conflict conflict conflict conflict
57+ NO KEY UPDATE conflict conflict conflict
5558SHARE conflict conflict
5659KEY SHARE conflict
5760
@@ -127,7 +130,7 @@ The following infomask bits are applicable:
127130 the member flags. If HEAP_XMAX_IS_MULTI is not set and HEAP_XMAX_LOCK_ONLY
128131 is set, then one of these *must* be set as well.
129132 Note there is no infomask bit for a SELECT FOR SHARE lock. Also there is no
130- separate bit for a SELECT FOR KEY UPDATE lock; this is implemented by the
133+ separate bit for a SELECT FOR NO KEY UPDATE lock; this is implemented by the
131134 HEAP_KEYS_UPDATED bit.
132135
133136- HEAP_KEYS_UPDATED
0 commit comments