pgsql: Avoid memory size overflow when allocating backend activity buff

2023-10-02 Thread Michael Paquier
Avoid memory size overflow when allocating backend activity buffer The code in charge of copying the contents of PgBackendStatus to local memory could fail on memory allocation because of an overflow on the amount of memory to use. The overflow can happen when combining a high value track_activit

pgsql: Avoid memory size overflow when allocating backend activity buff

2023-10-02 Thread Michael Paquier
Avoid memory size overflow when allocating backend activity buffer The code in charge of copying the contents of PgBackendStatus to local memory could fail on memory allocation because of an overflow on the amount of memory to use. The overflow can happen when combining a high value track_activit

pgsql: Avoid memory size overflow when allocating backend activity buff

2023-10-02 Thread Michael Paquier
Avoid memory size overflow when allocating backend activity buffer The code in charge of copying the contents of PgBackendStatus to local memory could fail on memory allocation because of an overflow on the amount of memory to use. The overflow can happen when combining a high value track_activit

pgsql: Avoid memory size overflow when allocating backend activity buff

2023-10-02 Thread Michael Paquier
Avoid memory size overflow when allocating backend activity buffer The code in charge of copying the contents of PgBackendStatus to local memory could fail on memory allocation because of an overflow on the amount of memory to use. The overflow can happen when combining a high value track_activit

pgsql: Avoid memory size overflow when allocating backend activity buff

2023-10-02 Thread Michael Paquier
Avoid memory size overflow when allocating backend activity buffer The code in charge of copying the contents of PgBackendStatus to local memory could fail on memory allocation because of an overflow on the amount of memory to use. The overflow can happen when combining a high value track_activit

pgsql: Avoid memory size overflow when allocating backend activity buff

2023-10-02 Thread Michael Paquier
Avoid memory size overflow when allocating backend activity buffer The code in charge of copying the contents of PgBackendStatus to local memory could fail on memory allocation because of an overflow on the amount of memory to use. The overflow can happen when combining a high value track_activit

pgsql: Fix incorrect format placeholder

2023-10-02 Thread Peter Eisentraut
Fix incorrect format placeholder Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/aea599cfc06b54426160a630e94ab7bdff7529c5 Modified Files -- src/test/modules/libpq_pipeline/libpq_pipeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Tidy-up some appendStringInfo*() usages

2023-10-02 Thread David Rowley
Tidy-up some appendStringInfo*() usages Make a few newish calls to appendStringInfo() which have no special formatting use appendStringInfoString() instead. Also, adjust usages of appendStringInfoString() which only append a string containing a single character to make use of appendStringInfoChar

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Fail hard on out-of-memory failures in xlogreader.c

2023-10-02 Thread Michael Paquier
Fail hard on out-of-memory failures in xlogreader.c This commit changes the WAL reader routines so as a FATAL for the backend or exit(FAILURE) for the frontend is triggered if an allocation for a WAL record decode fails in walreader.c, rather than treating this case as bogus data, which would be e

pgsql: Replace use of stat()[7] by -s switch in TAP tests to retrieve f

2023-10-02 Thread Michael Paquier
Replace use of stat()[7] by -s switch in TAP tests to retrieve file size The list form of stat() is an inelegant API as it relies on the position of the file size in the list returned in result. Like in any other places of the tree, replace that with a -s switch instead. Another suggestion from

pgsql: Fix omission of column-level privileges in selective pg_restore.

2023-10-02 Thread Tom Lane
Fix omission of column-level privileges in selective pg_restore. In a selective restore, ACLs for a table should be dumped if the table is selected to be dumped. However, if the table has both table-level and column-level ACLs, only the table-level ACL was restored. This happened because _tocEnt

pgsql: Fix omission of column-level privileges in selective pg_restore.

2023-10-02 Thread Tom Lane
Fix omission of column-level privileges in selective pg_restore. In a selective restore, ACLs for a table should be dumped if the table is selected to be dumped. However, if the table has both table-level and column-level ACLs, only the table-level ACL was restored. This happened because _tocEnt

pgsql: Fix omission of column-level privileges in selective pg_restore.

2023-10-02 Thread Tom Lane
Fix omission of column-level privileges in selective pg_restore. In a selective restore, ACLs for a table should be dumped if the table is selected to be dumped. However, if the table has both table-level and column-level ACLs, only the table-level ACL was restored. This happened because _tocEnt

pgsql: Fix omission of column-level privileges in selective pg_restore.

2023-10-02 Thread Tom Lane
Fix omission of column-level privileges in selective pg_restore. In a selective restore, ACLs for a table should be dumped if the table is selected to be dumped. However, if the table has both table-level and column-level ACLs, only the table-level ACL was restored. This happened because _tocEnt

pgsql: Fix omission of column-level privileges in selective pg_restore.

2023-10-02 Thread Tom Lane
Fix omission of column-level privileges in selective pg_restore. In a selective restore, ACLs for a table should be dumped if the table is selected to be dumped. However, if the table has both table-level and column-level ACLs, only the table-level ACL was restored. This happened because _tocEnt

pgsql: Fix omission of column-level privileges in selective pg_restore.

2023-10-02 Thread Tom Lane
Fix omission of column-level privileges in selective pg_restore. In a selective restore, ACLs for a table should be dumped if the table is selected to be dumped. However, if the table has both table-level and column-level ACLs, only the table-level ACL was restored. This happened because _tocEnt

pgsql: Fix omission of column-level privileges in selective pg_restore.

2023-10-02 Thread Tom Lane
Fix omission of column-level privileges in selective pg_restore. In a selective restore, ACLs for a table should be dumped if the table is selected to be dumped. However, if the table has both table-level and column-level ACLs, only the table-level ACL was restored. This happened because _tocEnt

pgsql: Remove retry loop in heap_page_prune().

2023-10-02 Thread Robert Haas
Remove retry loop in heap_page_prune(). The retry loop is needed because heap_page_prune() calls HeapTupleSatisfiesVacuum() and then lazy_scan_prune() does the same thing again, and they might get different answers due to concurrent clog updates. But this patch makes heap_page_prune() return the

pgsql: Flush WAL stats in bgwriter

2023-10-02 Thread Heikki Linnakangas
Flush WAL stats in bgwriter bgwriter can write out WAL, but did not flush the WAL pgstat counters, so the writes were not seen in pg_stat_wal. Back-patch to v14, where pg_stat_wal was introduced. Author: Nazir Bilal Yavuz Reviewed-by: Matthias van de Meent, Kyotaro Horiguchi Discussion: https:/

pgsql: Flush WAL stats in bgwriter

2023-10-02 Thread Heikki Linnakangas
Flush WAL stats in bgwriter bgwriter can write out WAL, but did not flush the WAL pgstat counters, so the writes were not seen in pg_stat_wal. Back-patch to v14, where pg_stat_wal was introduced. Author: Nazir Bilal Yavuz Reviewed-by: Matthias van de Meent, Kyotaro Horiguchi Discussion: https:/

pgsql: Add rmgrdesc README

2023-10-02 Thread Heikki Linnakangas
Add rmgrdesc README In the README, briefly explain what rmgrdesc functions are, and why they are in a separate directory. Commit c03c2eae0a added some guidelines on the preferred output format; move that to the README too. Reviewed-by: Melanie Plageman, Peter Geoghegan Discussion: https://www.po

pgsql: Flush WAL stats in bgwriter

2023-10-02 Thread Heikki Linnakangas
Flush WAL stats in bgwriter bgwriter can write out WAL, but did not flush the WAL pgstat counters, so the writes were not seen in pg_stat_wal. Back-patch to v14, where pg_stat_wal was introduced. Author: Nazir Bilal Yavuz Reviewed-by: Matthias van de Meent, Kyotaro Horiguchi Discussion: https:/

pgsql: Flush WAL stats in bgwriter

2023-10-02 Thread Heikki Linnakangas
Flush WAL stats in bgwriter bgwriter can write out WAL, but did not flush the WAL pgstat counters, so the writes were not seen in pg_stat_wal. Back-patch to v14, where pg_stat_wal was introduced. Author: Nazir Bilal Yavuz Reviewed-by: Matthias van de Meent, Kyotaro Horiguchi Discussion: https:/

pgsql: Add regression tests for psql \g piped into a program

2023-10-02 Thread Heikki Linnakangas
Add regression tests for psql \g piped into a program Author: Daniel Vérité Reviewed-by: Peter Eisentraut Discussion: https://www.postgresql.org/message-id/33ce8350-8cd1-45ff-a5fe-f9be7bc70649%40manitou-mail.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/be8d4