postgresql/src
Michael Paquier c426f7c2b3 Fix assertion failure with REINDEX and event triggers
A REINDEX CONCURRENTLY run on a table with no indexes would always pop
the topmost snapshot from the active snapshot stack, making the snapshot
handling inconsistent between the multiple-relation and single-relation
cases.  This commit slightly changes the snapshot stack handling so as a
snapshot is popped only ReindexMultipleInternal() in this case after a
relation has been reindexed, fixing a problem where an event trigger
function may need a snapshot but does not have one.  This also keeps the
places where PopActiveSnapshot() is called closer to each other.

While on it, this expands the existing tests to cover all the cases that
could be faced with REINDEX commands and such event triggers, for one or
more relations, with or without indexes.

This behavior is inconsistent since 5dc92b844e, but we've never had a
need for an active snapshot at the end of a REINDEX until now.

Thanks also to Jian He for the input.

Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/cb538743-484c-eb6a-a8c5-359980cd3a17@gmail.com
2023-12-07 08:31:02 +09:00
..
backend Fix assertion failure with REINDEX and event triggers 2023-12-07 08:31:02 +09:00
bin Suppress -Wunused-result warning about write(). 2023-12-06 17:16:57 -06:00
common Add CHECK_FOR_INTERRUPTS() in scram_SaltedPassword() for the backend 2023-11-28 08:35:50 +09:00
fe_utils Remove unneeded assignments in for loop header 2023-11-21 16:10:27 +01:00
include Remove now-unnecessary Autovacuum[Launcher|Worker]IAm functions 2023-12-04 15:34:37 +02:00
interfaces Fix handling of errors in libpq pipelines 2023-12-05 12:43:24 +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 Optimize pg_readv/pg_pwritev single vector case. 2023-11-29 17:19:25 +13:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Fix assertion failure with REINDEX and event triggers 2023-12-07 08:31:02 +09:00
timezone Remove distprep 2023-11-06 15:18:04 +01:00
tools Rename JsonManifestParseContext callbacks. 2023-12-05 12:17:49 -05: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