postgresql/src
Tomas Vondra 4f8d3c5b5a Lock table in DROP STATISTICS
The DROP STATISTICS code failed to properly lock the table, leading to

  ERROR:  tuple concurrently deleted

when executed concurrently with ANALYZE.

Fixed by modifying RemoveStatisticsById() to acquire the same lock as
ANALYZE. This function is called only by DROP STATISTICS, as ANALYZE
calls RemoveStatisticsDataById() directly.

Reported by Justin Pryzby, fix by me. Backpatch through 12. The code was
like this since it was introduced in 10, but older releases are EOL.

Reported-by: Justin Pryzby
Reviewed-by: Tom Lane
Backpatch-through: 12

Discussion: https://postgr.es/m/ZUuk-8CfbYeq6g_u@pryzbyj2023
2023-11-19 21:04:47 +01:00
..
backend Lock table in DROP STATISTICS 2023-11-19 21:04:47 +01:00
bin Don't try to dump RLS policies or security labels for extension objects. 2023-11-13 17:04:10 -05:00
common Try to handle torn reads of pg_control in frontend. 2023-10-16 17:25:43 +13:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include llvmjit: Use explicit LLVMContextRef for inlining 2023-11-17 11:47:17 +01:00
interfaces Stamp 12.17. 2023-11-06 17:11:55 -05:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
pl Translation updates 2023-11-06 13:27:02 +01:00
port Stamp 12.17. 2023-11-06 17:11:55 -05:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:29:13 -04:00
test Guard against overflow in interval_mul() and interval_div(). 2023-11-18 14:50:00 +00:00
timezone Remove PHOT from our default timezone abbreviations list. 2023-10-28 11:55:22 -04:00
tools Fix exception safety bug in typcache.c. 2023-09-13 14:50:14 +12:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Suppress macOS warnings about duplicate libraries in link commands. 2023-09-29 14:07:30 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:05:50 +02:00