postgresql/src/test/modules
Michael Paquier 661643deda Avoid scribbling of VACUUM options
This fixes two issues with the handling of VacuumParams in vacuum_rel().
This code path has the idea to change the passed-in pointer of
VacuumParams for the "truncate" and "index_cleanup" options for the
relation worked on, impacting the two following scenarios where
incorrect options may be used because a VacuumParams pointer is shared
across multiple relations:
- Multiple relations in a single VACUUM command.
- TOAST relations vacuumed with their main relation.

The problem is avoided by providing to the two callers of vacuum_rel()
copies of VacuumParams, before the pointer is updated for the "truncate"
and "index_cleanup" options.

The refactoring of the VACUUM option and parameters done in 0d83138974
did not introduce an issue, but it has encouraged the problem we are
dealing with in this commit, with b84dbc8eb8 for "truncate" and
a96c41feec for "index_cleanup" that have been added a couple of years
after the initial refactoring.  HEAD will be improved with a different
patch that hardens the uses of VacuumParams across the tree.  This
cannot be backpatched as it introduces an ABI breakage.

The backend portion of the patch has been authored by Nathan, while I
have implemented the tests.  The tests rely on injection points to check
the option values, making them faster, more reliable than the tests
originally proposed by Shihao, and they also provide more coverage.
This part can only be backpatched down to v17.

Reported-by: Shihao Zhong <zhong950419@gmail.com>
Author: Nathan Bossart <nathandbossart@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAGRkXqTo+aK=GTy5pSc-9cy8H2F2TJvcrZ-zXEiNJj93np1UUw@mail.gmail.com
Backpatch-through: 13
2025-06-25 10:03:46 +09:00
..
brin Update copyright for 2025 2025-01-01 11:21:55 -05:00
commit_ts Apply more consistent style for command options in TAP tests 2025-03-17 12:42:23 +09:00
delay_execution Remove unstable test suite added by 525392d57 2025-02-22 15:19:23 +09:00
dummy_index_am Rename amcancrosscompare 2025-03-07 11:46:33 +01:00
dummy_seclabel Update copyright for 2025 2025-01-01 11:21:55 -05:00
gin Update copyright for 2025 2025-01-01 11:21:55 -05:00
injection_points Avoid scribbling of VACUUM options 2025-06-25 10:03:46 +09:00
ldap_password_func Replace deprecated log_connections values in docs and tests 2025-05-22 17:14:54 -04:00
libpq_pipeline Make cancel request keys longer 2025-04-02 16:41:48 +03:00
oauth_validator oauth: Limit JSON parsing depth in the client 2025-05-23 13:05:33 -07:00
plsample Update copyright for 2025 2025-01-01 11:21:55 -05:00
spgist_name_ops Update copyright for 2025 2025-01-01 11:21:55 -05:00
ssl_passphrase_callback Apply more consistent style for command options in TAP tests 2025-03-17 12:42:23 +09:00
test_aio Sync typedefs.list with the buildfarm. 2025-06-15 13:04:24 -04:00
test_bloomfilter Get rid of our dependency on type "long" for memory size calculations. 2025-01-31 13:52:40 -05:00
test_copy_callbacks Use PRI?64 instead of "ll?" in format strings (continued). 2025-03-29 10:43:57 +01:00
test_custom_rmgrs Remove unnecessary (char *) casts [xlog] 2025-02-13 10:57:07 +01:00
test_ddl_deparse Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_dsa Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_dsm_registry Fixed signed/unsigned mismatch in test_dsm_registry. 2025-06-06 11:40:52 -05:00
test_escape With GB18030, prevent SIGSEGV from reading past end of allocation. 2025-05-05 04:52:04 -07:00
test_extensions Make "directory" setting work with extension_control_path 2025-05-02 16:35:48 +02:00
test_ginpostinglist Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_integerset Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_json_parser Allocate JsonLexContexts on the heap to avoid warnings 2025-04-23 11:02:05 +02:00
test_lfind Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_misc Fix catcache invalidation of a list entry that's being built 2025-01-14 14:28:49 +02:00
test_oat_hooks Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_parser Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_pg_dump pg_dump: Add --sequence-data. 2025-03-25 16:02:35 -05:00
test_predtest Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_radixtree Always use the caller-provided context for radix tree leaves 2025-01-06 13:26:02 +07:00
test_rbtree Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_regex Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_resowner Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_rls_hooks Update copyright for 2025 2025-01-01 11:21:55 -05:00
test_shm_mq pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
test_slru Add support for runtime arguments in injection points 2025-05-10 06:56:26 +09:00
test_tidstore Update copyright for 2025 2025-01-01 11:21:55 -05:00
typcache Update copyright for 2025 2025-01-01 11:21:55 -05:00
unsafe_tests Remove direct handling of reloptions for toast tables 2025-03-14 09:28:51 +01:00
worker_spi pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
xid_wraparound Use PRI?64 instead of "ll?" in format strings (continued). 2025-03-29 10:43:57 +01:00
Makefile aio: Add test_aio module 2025-04-01 13:47:46 -04:00
meson.build aio: Add test_aio module 2025-04-01 13:47:46 -04:00
README Add an enforcement mechanism for global object names in regression tests. 2019-06-29 11:34:00 -04:00

Test extensions and libraries
=============================

src/test/modules contains PostgreSQL extensions that are primarily or entirely
intended for testing PostgreSQL and/or to serve as example code. The extensions
here aren't intended to be installed in a production server and aren't suitable
for "real work".

Furthermore, while you can do "make install" and "make installcheck" in
this directory or its children, it is NOT ADVISABLE to do so with a server
containing valuable data.  Some of these tests may have undesirable
side-effects on roles or other global objects within the tested server.
"make installcheck-world" at the top level does not recurse into this
directory.

Most extensions have their own pg_regress tests or isolationtester specs. Some
are also used by tests elsewhere in the tree.

If you're adding new hooks or other functionality exposed as C-level API this
is where to add the tests for it.