postgresql/src
Andres Freund d811ce6ea3 pgstat: Fix transactional stats dropping for indexes
Because index creation does not go through heap_create_with_catalog() we
didn't call pgstat_create_relation(), leading to index stats of a newly
created realtion not getting dropped during rollback. To fix, move the
pgstat_create_relation() to heap_create(), which indexes do use.

Similarly, because dropping an index does not go through
heap_drop_with_catalog(), we didn't drop index stats when the transaction
dropping an index committed. Here there's no convenient common path for
indexes and relations, so index_drop() now calls pgstat_drop_relation().

Add tests for transactional index stats handling.

Author: "Drouvot, Bertrand" <bdrouvot@amazon.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/51bbf286-2b4a-8998-bd12-eaae4b765d99@amazon.com
Backpatch: 15-, like 8b1dccd37c, which introduced the bug
2022-09-23 13:00:55 -07:00
..
backend pgstat: Fix transactional stats dropping for indexes 2022-09-23 13:00:55 -07:00
bin Allow publications with schema and table of the same schema. 2022-09-23 08:21:26 +05:30
common Use min/max bounds defined by Zstd for compression level 2022-09-22 20:02:40 +09:00
fe_utils meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
include Harmonize more lexer function parameter names. 2022-09-22 13:27:16 -07:00
interfaces Remove PQsendQuery support in pipeline mode 2022-09-23 18:21:22 +02:00
makefiles aix: No need to use mkldexport when we want to export all symbols 2022-09-09 19:11:49 -07:00
pl meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
port meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
template Move darwin sysroot determination into separate file 2022-09-01 16:54:19 -07:00
test pgstat: Fix transactional stats dropping for indexes 2022-09-23 13:00:55 -07:00
timezone meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
tools meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -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 Split TESTDIR into TESTLOGDIR and TESTDATADIR 2022-09-19 18:03:17 -07:00
Makefile.shlib aix: No need to use mkldexport when we want to export all symbols 2022-09-09 19:11:49 -07:00
meson.build meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00