postgresql/src/backend
Heikki Linnakangas 1169fcf129 Fix predicate-locking of HOT updated rows.
In serializable mode, heap_hot_search_buffer() incorrectly acquired a
predicate lock on the root tuple, not the returned tuple that satisfied
the visibility checks. As explained in README-SSI, the predicate lock does
not need to be copied or extended to other tuple versions, but for that to
work, the correct, visible, tuple version must be locked in the first
place.

The original SSI commit had this bug in it, but it was fixed back in 2013,
in commit 81fbbfe335. But unfortunately, it was reintroduced a few months
later in commit b89e151054. Wising up from that, add a regression test
to cover this, so that it doesn't get reintroduced again. Also, move the
code that sets 't_self', so that it happens at the same time that the
other HeapTuple fields are set, to make it more clear that all the code in
the loop operate on the "current" tuple in the chain, not the root tuple.

Bug spotted by Andres Freund, analysis and original fix by Thomas Munro,
test case and some additional changes to the fix by Heikki Linnakangas.
Backpatch to all supported versions (9.4).

Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de
2019-08-07 12:40:49 +03:00
..
access Fix predicate-locking of HOT updated rows. 2019-08-07 12:40:49 +03:00
bootstrap Fix inconsistencies and typos in the tree 2019-07-16 13:23:53 +09:00
catalog Require the schema qualification in pg_temp.type_name(arg). 2019-08-05 07:48:41 -07:00
commands Fix inconsistencies and typos in the tree, take 9 2019-08-05 12:14:58 +09:00
executor Fix choice of comparison operators for cross-type hashed subplans. 2019-08-05 11:20:31 -04:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Avoid macro clash with LLVM 9. 2019-07-29 10:23:55 +12:00
lib Fix inconsistencies in the code 2019-07-08 13:15:09 +09:00
libpq Fix inconsistencies and typos in the tree, take 9 2019-08-05 12:14:58 +09:00
main Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
nodes Fix inconsistencies and typos in the tree, take 9 2019-08-05 12:14:58 +09:00
optimizer Fix typo in pathnode.c 2019-08-06 18:11:02 +09:00
parser Require the schema qualification in pg_temp.type_name(arg). 2019-08-05 07:48:41 -07:00
partitioning Improve pruning of a default partition 2019-08-04 11:18:45 -04:00
po Translation updates 2019-06-17 15:30:20 +02:00
port Fix inconsistencies and typos in the tree 2019-07-22 10:01:50 +09:00
postmaster Fix inconsistencies and typos in the tree, take 9 2019-08-05 12:14:58 +09:00
regex Fix inconsistencies and typos in the tree, take 9 2019-08-05 12:14:58 +09:00
replication Adjust tuple data lookup logic in multi-insert logical decoding 2019-08-07 10:28:16 +09:00
rewrite Make identity sequence management more robust 2019-07-22 12:07:10 +02:00
snowball Sync our Snowball stemmer dictionaries with current upstream 2019-07-04 13:26:48 +02:00
statistics Use column collation for extended statistics 2019-07-20 16:37:37 +02:00
storage Fix inconsistencies and typos in the tree, take 9 2019-08-05 12:14:58 +09:00
tcop Revert "Add log_statement_sample_rate parameter" 2019-08-04 23:38:27 +02:00
tsearch Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
utils Fix some incorrect parsing of time with time zone strings 2019-08-07 18:16:31 +09:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2019-05-20 16:00:53 +02:00