postgresql/src/backend
Thomas Munro f9b7fc651a Fix race in SSI interaction with empty btrees.
When predicate-locking btrees, we have a special case for completely
empty btrees, since there is no page to lock.  This was racy, because,
without buffer lock held, a matching key could be inserted between the
_bt_search() and the PredicateLockRelation() calls.

Fix, by rechecking _bt_search() after taking the relation-level SIREAD
lock, if using SERIALIZABLE isolation and an empty btree is discovered.

Back-patch to all supported releases.  Fixes one aspect of bug #17949.

Reported-by: Artem Anisimov <artem.anisimov.255@gmail.com>
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/17949-a0f17035294a55e2%40postgresql.org
2023-07-04 09:07:31 +12:00
..
access Fix race in SSI interaction with empty btrees. 2023-07-04 09:07:31 +12:00
archive Redesign archive modules 2023-02-17 14:26:42 +09:00
backup Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
bootstrap Fix CREATE INDEX progress reporting for multi-level partitioning. 2023-03-25 15:34:03 -04:00
catalog Use named captures in Catalog::ParseHeader() 2023-06-30 09:16:27 +09:00
commands Fix code indentation violations 2023-07-03 12:47:49 +02:00
executor Fix memory leak in Incremental Sort rescans 2023-07-02 20:03:30 +02:00
foreign Expand some more uses of "deleg" to "delegation" or "delegated". 2023-05-21 10:55:18 -04:00
jit Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
lib Fix ILIST_DEBUG build 2023-01-18 10:26:15 -08:00
libpq Remove support for OpenSSL 1.0.1 2023-07-03 13:20:27 +09:00
main Remove obsolete defense against strxfrm() bugs. 2023-04-20 13:20:14 +12:00
nodes Remove inappropriate raw_expression_tree_walker() code 2023-06-29 10:34:53 +02:00
optimizer Remove redundant PARTITION BY columns from WindowClauses 2023-07-03 12:49:43 +12:00
parser Remove dependency to query text in JumbleQuery() 2023-06-28 08:59:36 +09:00
partitioning Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
po Translation updates 2023-06-26 12:02:02 +02:00
port Update copyright for 2023 2023-01-02 15:00:37 -05:00
postmaster Don't truncate database and user names in startup packets. 2023-07-03 13:18:05 -07:00
regex Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
replication Remove redundant check for fast_forward. 2023-06-30 18:31:10 +03:00
rewrite A minor simplification for List manipulation 2023-07-03 11:39:03 +02:00
snowball Fix the install rule for snowball_create.sql. 2023-05-23 11:15:57 -04:00
statistics Take pg_attribute out of VacAttrStats 2023-07-03 07:18:57 +02:00
storage Refactor some code related to wait events "BufferPin" and "Extension" 2023-07-03 11:01:02 +09:00
tcop Handle logical slot conflicts on standby 2023-04-08 00:05:44 -07:00
tsearch Take pg_attribute out of VacAttrStats 2023-07-03 07:18:57 +02:00
utils Take pg_attribute out of VacAttrStats 2023-07-03 07:18:57 +02:00
.gitignore
Makefile Give postgres.exe the icon of other executables. 2023-06-12 07:40:38 -07:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
meson.build Add win32ver data to meson-built postgres.exe. 2023-06-12 07:40:38 -07:00
nls.mk Add missing gettext triggers 2023-05-10 13:51:51 +02:00