pgsql: Fix calculation of how much shared memory is required to store a

2021-01-14 Thread Fujii Masao
Fix calculation of how much shared memory is required to store a TOC. Commit ac883ac453 refactored shm_toc_estimate() but changed its calculation of shared memory size for TOC incorrectly. Previously this could cause too large memory to be allocated. Back-patch to v11 where the bug was introduced

pgsql: Fix calculation of how much shared memory is required to store a

2021-01-14 Thread Fujii Masao
Fix calculation of how much shared memory is required to store a TOC. Commit ac883ac453 refactored shm_toc_estimate() but changed its calculation of shared memory size for TOC incorrectly. Previously this could cause too large memory to be allocated. Back-patch to v11 where the bug was introduced

pgsql: Fix calculation of how much shared memory is required to store a

2021-01-14 Thread Fujii Masao
Fix calculation of how much shared memory is required to store a TOC. Commit ac883ac453 refactored shm_toc_estimate() but changed its calculation of shared memory size for TOC incorrectly. Previously this could cause too large memory to be allocated. Back-patch to v11 where the bug was introduced

pgsql: Fix calculation of how much shared memory is required to store a

2021-01-14 Thread Fujii Masao
Fix calculation of how much shared memory is required to store a TOC. Commit ac883ac453 refactored shm_toc_estimate() but changed its calculation of shared memory size for TOC incorrectly. Previously this could cause too large memory to be allocated. Back-patch to v11 where the bug was introduced

pgsql: Remove PG_SHA*_DIGEST_STRING_LENGTH from sha2.h

2021-01-14 Thread Michael Paquier
Remove PG_SHA*_DIGEST_STRING_LENGTH from sha2.h The last reference to those variables has been removed in aef8948, so this cleans up a bit the code. Discussion: https://postgr.es/m/X//[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ccf4e27

Re: pgsql: Ensure that a standby is able to follow a primary on a newer tim

2021-01-14 Thread Michael Paquier
On Thu, Jan 14, 2021 at 03:19:02PM +0900, Fujii Masao wrote: > BTW, I included the URL to Michael's report [1] in the commit log. But this > URL doesn't seem to work fine maybe because part includes > a slash character. Sorry about that. This is related to mutt that has changed its logic to gene

pgsql: Fix O(N^2) stat() calls when recycling WAL segments

2021-01-14 Thread Michael Paquier
Fix O(N^2) stat() calls when recycling WAL segments The counter tracking the last segment number recycled was getting initialized when recycling one single segment, while it should be used across a full cycle of segments recycled to prevent useless checks related to entries already recycled. This

pgsql: postgres_fdw: Save foreign server OID in connection cache entry.

2021-01-14 Thread Fujii Masao
postgres_fdw: Save foreign server OID in connection cache entry. The foreign server OID stored in the connection cache entry is used as a lookup key to directly get the server name. Previously since the connection cache entry did not have the server OID, postgres_fdw had to get the server OID at

pgsql: pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner.

2021-01-14 Thread Tom Lane
pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner. This is the same fix as commit 9eabfe300 applied to INDEX ATTACH entries, but for table-to-publication attachments. As in that case, even though the backend doesn't record "ownership" of the attachment, we still ought to label it in t

pgsql: pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner.

2021-01-14 Thread Tom Lane
pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner. This is the same fix as commit 9eabfe300 applied to INDEX ATTACH entries, but for table-to-publication attachments. As in that case, even though the backend doesn't record "ownership" of the attachment, we still ought to label it in t

pgsql: pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner.

2021-01-14 Thread Tom Lane
pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner. This is the same fix as commit 9eabfe300 applied to INDEX ATTACH entries, but for table-to-publication attachments. As in that case, even though the backend doesn't record "ownership" of the attachment, we still ought to label it in t

pgsql: pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner.

2021-01-14 Thread Tom Lane
pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner. This is the same fix as commit 9eabfe300 applied to INDEX ATTACH entries, but for table-to-publication attachments. As in that case, even though the backend doesn't record "ownership" of the attachment, we still ought to label it in t

pgsql: pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner.

2021-01-14 Thread Tom Lane
pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner. This is the same fix as commit 9eabfe300 applied to INDEX ATTACH entries, but for table-to-publication attachments. As in that case, even though the backend doesn't record "ownership" of the attachment, we still ought to label it in t

pgsql: Prevent drop of tablespaces used by partitioned relations

2021-01-14 Thread Alvaro Herrera
Prevent drop of tablespaces used by partitioned relations When a tablespace is used in a partitioned relation (per commits ca4103025dfe in pg12 for tables and 33e6c34c3267 in pg11 for indexes), it is possible to drop the tablespace, potentially causing various problems. One such was reported in b

pgsql: Prevent drop of tablespaces used by partitioned relations

2021-01-14 Thread Alvaro Herrera
Prevent drop of tablespaces used by partitioned relations When a tablespace is used in a partitioned relation (per commits ca4103025dfe in pg12 for tables and 33e6c34c3267 in pg11 for indexes), it is possible to drop the tablespace, potentially causing various problems. One such was reported in b

pgsql: Prevent drop of tablespaces used by partitioned relations

2021-01-14 Thread Alvaro Herrera
Prevent drop of tablespaces used by partitioned relations When a tablespace is used in a partitioned relation (per commits ca4103025dfe in pg12 for tables and 33e6c34c3267 in pg11 for indexes), it is possible to drop the tablespace, potentially causing various problems. One such was reported in b

pgsql: Prevent drop of tablespaces used by partitioned relations

2021-01-14 Thread Alvaro Herrera
Prevent drop of tablespaces used by partitioned relations When a tablespace is used in a partitioned relation (per commits ca4103025dfe in pg12 for tables and 33e6c34c3267 in pg11 for indexes), it is possible to drop the tablespace, potentially causing various problems. One such was reported in b

pgsql: Stabilize timeline switch regression test.

2021-01-14 Thread Fujii Masao
Stabilize timeline switch regression test. Commit fef5b47f6b added the regression test to check whether a standby is able to follow a primary on a newer timeline when WAL archiving is enabled. But the buildfarm member florican reported that this test failed because the requested WAL segment was re

pgsql: Stabilize timeline switch regression test.

2021-01-14 Thread Fujii Masao
Stabilize timeline switch regression test. Commit fef5b47f6b added the regression test to check whether a standby is able to follow a primary on a newer timeline when WAL archiving is enabled. But the buildfarm member florican reported that this test failed because the requested WAL segment was re