postgresql/src
Tomas Vondra 28f84f72fb 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:03:38 +01:00
..
backend Lock table in DROP STATISTICS 2023-11-19 21:03:38 +01:00
bin psql: Add some completion support for CREATE TABLE .. AS 2023-11-16 09:44:29 +09:00
common Make ResourceOwners more easily extensible. 2023-11-08 13:30:50 +02:00
fe_utils Remove distprep 2023-11-06 15:18:04 +01:00
include simplehash: preserve consistency in case of OOM. 2023-11-17 13:58:16 -08:00
interfaces Call pqPipelineFlush from PQsendFlushRequest 2023-11-08 16:44:08 +01:00
makefiles Remove distprep 2023-11-06 15:18:04 +01:00
pl Don't specify number of dimensions in cases where we don't know it. 2023-11-17 11:29:46 -05:00
port Remove distprep 2023-11-06 15:18:04 +01:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Guard against overflow in interval_mul() and interval_div(). 2023-11-18 14:41:20 +00:00
timezone Remove distprep 2023-11-06 15:18:04 +01:00
tools Explicitly skip TAP tests under Meson if disabled 2023-11-16 08:14:33 +01:00
tutorial Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
meson.build Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00