postgresql/src
Tomas Vondra 9dd50e92ed 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:28 +01:00
..
backend Lock table in DROP STATISTICS 2023-11-19 21:04:28 +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 Improve pglz_decompress's defenses against corrupt compressed data. 2023-10-18 20:43:17 -04:00
fe_utils Don't spuriously report FD_SETSIZE exhaustion on Windows. 2023-10-14 15:54:49 -07:00
include llvmjit: Use explicit LLVMContextRef for inlining 2023-11-17 10:27:45 +01:00
interfaces Call pqPipelineFlush from PQsendFlushRequest 2023-11-08 16:44:08 +01:00
makefiles Add NO_INSTALL option to pgxs 2021-05-27 13:58:29 +02:00
pl Translation updates 2023-11-06 13:19:51 +01:00
port Fix detection of unseekable files for fseek() and ftello() with MSVC 2023-04-12 09:09:58 +09:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:29:03 -04:00
test Guard against overflow in interval_mul() and interval_div(). 2023-11-18 14:48:10 +00:00
timezone Remove PHOT from our default timezone abbreviations list. 2023-10-28 11:55:06 -04:00
tools Fix exception safety bug in typcache.c. 2023-09-13 14:46:16 +12:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -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 Add errhint_plural() function and make use of it 2021-03-31 09:16:25 +02:00