pgsql: Add TAP test for pg_receivewal with timeline switch

2021-10-31 Thread Michael Paquier
Add TAP test for pg_receivewal with timeline switch pg_receivewal is able to follow a timeline switch, but this was not tested. This test uses an empty archive location with a restart done from a slot, making its implementation a tad simpler than if we would reuse an existing archive directory.

pgsql: Preserve opclass parameters across REINDEX CONCURRENTLY

2021-10-31 Thread Michael Paquier
Preserve opclass parameters across REINDEX CONCURRENTLY The opclass parameter Datums from the old index are fetched in the same way as for predicates and expressions, by grabbing them directly from the system catalogs. They are then copied into the new IndexInfo that will be used for the creation

pgsql: Preserve opclass parameters across REINDEX CONCURRENTLY

2021-10-31 Thread Michael Paquier
Preserve opclass parameters across REINDEX CONCURRENTLY The opclass parameter Datums from the old index are fetched in the same way as for predicates and expressions, by grabbing them directly from the system catalogs. They are then copied into the new IndexInfo that will be used for the creation

pgsql: Preserve opclass parameters across REINDEX CONCURRENTLY

2021-10-31 Thread Michael Paquier
Preserve opclass parameters across REINDEX CONCURRENTLY The opclass parameter Datums from the old index are fetched in the same way as for predicates and expressions, by grabbing them directly from the system catalogs. They are then copied into the new IndexInfo that will be used for the creation

pgsql: Don't try to read a multi-GB pg_stat_statements file in one call

2021-10-31 Thread Tom Lane
Don't try to read a multi-GB pg_stat_statements file in one call. Windows fails on a request to read() more than INT_MAX bytes, and perhaps other platforms could have similar issues. Let's adjust this code to read at most 1GB per call. (One would not have thought the file could get that big, but

pgsql: Don't try to read a multi-GB pg_stat_statements file in one call

2021-10-31 Thread Tom Lane
Don't try to read a multi-GB pg_stat_statements file in one call. Windows fails on a request to read() more than INT_MAX bytes, and perhaps other platforms could have similar issues. Let's adjust this code to read at most 1GB per call. (One would not have thought the file could get that big, but

pgsql: Don't try to read a multi-GB pg_stat_statements file in one call

2021-10-31 Thread Tom Lane
Don't try to read a multi-GB pg_stat_statements file in one call. Windows fails on a request to read() more than INT_MAX bytes, and perhaps other platforms could have similar issues. Let's adjust this code to read at most 1GB per call. (One would not have thought the file could get that big, but

pgsql: Don't try to read a multi-GB pg_stat_statements file in one call

2021-10-31 Thread Tom Lane
Don't try to read a multi-GB pg_stat_statements file in one call. Windows fails on a request to read() more than INT_MAX bytes, and perhaps other platforms could have similar issues. Let's adjust this code to read at most 1GB per call. (One would not have thought the file could get that big, but

pgsql: Don't try to read a multi-GB pg_stat_statements file in one call

2021-10-31 Thread Tom Lane
Don't try to read a multi-GB pg_stat_statements file in one call. Windows fails on a request to read() more than INT_MAX bytes, and perhaps other platforms could have similar issues. Let's adjust this code to read at most 1GB per call. (One would not have thought the file could get that big, but

pgsql: Don't try to read a multi-GB pg_stat_statements file in one call

2021-10-31 Thread Tom Lane
Don't try to read a multi-GB pg_stat_statements file in one call. Windows fails on a request to read() more than INT_MAX bytes, and perhaps other platforms could have similar issues. Let's adjust this code to read at most 1GB per call. (One would not have thought the file could get that big, but

pgsql: Don't try to read a multi-GB pg_stat_statements file in one call

2021-10-31 Thread Tom Lane
Don't try to read a multi-GB pg_stat_statements file in one call. Windows fails on a request to read() more than INT_MAX bytes, and perhaps other platforms could have similar issues. Let's adjust this code to read at most 1GB per call. (One would not have thought the file could get that big, but

pgsql: Doc: improve README files associated with TAP tests.

2021-10-31 Thread Tom Lane
Doc: improve README files associated with TAP tests. Rearrange src/test/perl/README so that the first section is more clearly "how to run these tests", and the rest "how to write new tests". Add some basic info there about debugging test failures. Then, add cross-refs to that READNE from other RE

pgsql: Avoid O(N^2) behavior when the standby process releases many loc

2021-10-31 Thread Tom Lane
Avoid O(N^2) behavior when the standby process releases many locks. When replaying a transaction that held many exclusive locks on the primary, a standby server's startup process would expend O(N^2) effort on manipulating the list of locks. This code was fine when written, but commit 1cff1b95a ma

pgsql: Avoid O(N^2) behavior when the standby process releases many loc

2021-10-31 Thread Tom Lane
Avoid O(N^2) behavior when the standby process releases many locks. When replaying a transaction that held many exclusive locks on the primary, a standby server's startup process would expend O(N^2) effort on manipulating the list of locks. This code was fine when written, but commit 1cff1b95a ma

pgsql: Avoid O(N^2) behavior when the standby process releases many loc

2021-10-31 Thread Tom Lane
Avoid O(N^2) behavior when the standby process releases many locks. When replaying a transaction that held many exclusive locks on the primary, a standby server's startup process would expend O(N^2) effort on manipulating the list of locks. This code was fine when written, but commit 1cff1b95a ma

pgsql: plpgsql: report proper line number for errors in variable initia

2021-10-31 Thread Tom Lane
plpgsql: report proper line number for errors in variable initialization. Previously, we pointed at the surrounding block's BEGIN keyword. If there are multiple variables being initialized in a DECLARE section, this isn't good enough: it can be quite confusing and unhelpful. We do know where the v