pgsql: Adjust new pg_read_file() test cases for more portability.

2022-07-30 Thread Tom Lane
Adjust new pg_read_file() test cases for more portability. It's allowed for an installation to remove postgresql.auto.conf, so don't rely on that being present. Instead probe whether we can read postmaster.pid. (If you've removed that, you broke the data directory's multiple-postmaster interlock

pgsql: Fix incorrect is-this-the-topmost-join tests in parallel plannin

2022-07-30 Thread Tom Lane
Fix incorrect is-this-the-topmost-join tests in parallel planning. Two callers of generate_useful_gather_paths were testing the wrong thing when deciding whether to call that function: they checked for being at the top of the current join subproblem, rather than being at the actual top join. This

pgsql: Fix incorrect is-this-the-topmost-join tests in parallel plannin

2022-07-30 Thread Tom Lane
Fix incorrect is-this-the-topmost-join tests in parallel planning. Two callers of generate_useful_gather_paths were testing the wrong thing when deciding whether to call that function: they checked for being at the top of the current join subproblem, rather than being at the actual top join. This

pgsql: Add regression test coverage for contrib/pg_buffercache.

2022-07-30 Thread Tom Lane
Add regression test coverage for contrib/pg_buffercache. We can't check the output of this view very closely without creating portability headaches, but we can make sure that the number of rows is as-expected. In any case, this is sufficient to exercise all the C code within, which is a lot bette

pgsql: Improve regression test coverage of GiST index building.

2022-07-30 Thread Tom Lane
Improve regression test coverage of GiST index building. Add a test case that exercises the "buffering build" code path. This covers almost all the non-error-case lines in gistbuild.c and gistbuildbuffers.c. Matheus Alcantara, based on earlier work by Pavel Borisov Discussion: https://postgr.es

pgsql: Expand tests of test_ddl_deparse/ for ALTER TABLE

2022-07-30 Thread Michael Paquier
Expand tests of test_ddl_deparse/ for ALTER TABLE This module is expanded to track the description of the objects changed in the subcommands of ALTER TABLE by reworking the function get_altertable_subcmdtypes() (now named get_altertable_subcmdinfo) used in the event trigger of the test. It now re

pgsql: Feed ObjectAddress to event triggers for ALTER TABLE ATTACH/DETA

2022-07-30 Thread Michael Paquier
Feed ObjectAddress to event triggers for ALTER TABLE ATTACH/DETACH These flavors of ALTER TABLE were already shaped to report the ObjectAddress of the partition attached or detached, but this data was not added to what is collected for event triggers. The tests of test_ddl_deparse are updated to