pgsql: Clear padding of PgStat_HashKey when handling pgstats entries

2024-11-04 Thread Michael Paquier
Clear padding of PgStat_HashKey when handling pgstats entries PgStat_HashKey is currently initialized in a way that could result in random data if the structure has any padding bytes. The structure has no padding bytes currently, fortunately, but it could become a problem should the structure cha

pgsql: Clear padding of PgStat_HashKey when handling pgstats entries

2024-11-04 Thread Michael Paquier
Clear padding of PgStat_HashKey when handling pgstats entries PgStat_HashKey is currently initialized in a way that could result in random data if the structure has any padding bytes. The structure has no padding bytes currently, fortunately, but it could become a problem should the structure cha

pgsql: Clear padding of PgStat_HashKey when handling pgstats entries

2024-11-04 Thread Michael Paquier
Clear padding of PgStat_HashKey when handling pgstats entries PgStat_HashKey is currently initialized in a way that could result in random data if the structure has any padding bytes. The structure has no padding bytes currently, fortunately, but it could become a problem should the structure cha

pgsql: Clear padding of PgStat_HashKey when handling pgstats entries

2024-11-04 Thread Michael Paquier
Clear padding of PgStat_HashKey when handling pgstats entries PgStat_HashKey is currently initialized in a way that could result in random data if the structure has any padding bytes. The structure has no padding bytes currently, fortunately, but it could become a problem should the structure cha

pgsql: Use portable diff options in pg_bsd_indent's regression test.

2024-11-04 Thread Tom Lane
Use portable diff options in pg_bsd_indent's regression test. We had been using "diff -upd", which evidently works for most people, but Solaris's diff doesn't like it. (We'd not noticed because the Solaris buildfarm animals weren't running this test until they were upgraded to the latest buildfar

pgsql: Use portable diff options in pg_bsd_indent's regression test.

2024-11-04 Thread Tom Lane
Use portable diff options in pg_bsd_indent's regression test. We had been using "diff -upd", which evidently works for most people, but Solaris's diff doesn't like it. (We'd not noticed because the Solaris buildfarm animals weren't running this test until they were upgraded to the latest buildfar

pgsql: Use portable diff options in pg_bsd_indent's regression test.

2024-11-04 Thread Tom Lane
Use portable diff options in pg_bsd_indent's regression test. We had been using "diff -upd", which evidently works for most people, but Solaris's diff doesn't like it. (We'd not noticed because the Solaris buildfarm animals weren't running this test until they were upgraded to the latest buildfar

pgsql: Revert pg_wal_replay_wait() stored procedure

2024-11-04 Thread Alexander Korotkov
Revert pg_wal_replay_wait() stored procedure This commit reverts 3c5db1d6b0, and subsequent improvements and fixes including 8036d73ae3, 867d396ccd, 3ac3ec580c, 0868d7ae70, 85b98b8d5a, 2520226c95, 014f9f34d2, e658038772, e1555645d7, 5035172e4a, 6cfebfe88b, 73da6b8d1b, and e546989a26. The reason f

pgsql: doc: use more accurate URL for bug reporting

2024-11-04 Thread Bruce Momjian
doc: use more accurate URL for bug reporting Reported-by: n...@makarevitch.org Discussion: https://postgr.es/m/172947609746.699.14488791149769110...@wrigleys.postgresql.org Backpatch-through: master Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3293b718a01310c

pgsql: pg_basebackup, pg_receivewal: fix failure to find password in ~/

2024-11-04 Thread Tom Lane
pg_basebackup, pg_receivewal: fix failure to find password in ~/.pgpass. Sloppy refactoring in commit cca97ce6a caused these programs to pass dbname = NULL to libpq if there was no "--dbname" switch on the command line, where before "replication" would be passed. This didn't break things completel

pgsql: pg_basebackup, pg_receivewal: fix failure to find password in ~/

2024-11-04 Thread Tom Lane
pg_basebackup, pg_receivewal: fix failure to find password in ~/.pgpass. Sloppy refactoring in commit cca97ce6a caused these programs to pass dbname = NULL to libpq if there was no "--dbname" switch on the command line, where before "replication" would be passed. This didn't break things completel

pgsql: doc: remove check of SVG files, since they are derived

2024-11-04 Thread Bruce Momjian
doc: remove check of SVG files, since they are derived revert of change from commit 641a5b7a144 Reported-by: Peter Eisentraut Discussion: https://postgr.es/m/2c5dd601-b245-4092-9c27-6d1ad5160...@eisentraut.org Backpatch-through: master Branch -- master Details --- https://git.postgr

pgsql: pg_dump: provide a stable sort order for rules.

2024-11-04 Thread Tom Lane
pg_dump: provide a stable sort order for rules. Previously, we sorted rules by schema name and then rule name; if that wasn't unique, we sorted by rule OID. This can be problematic for comparing dumps from databases with different histories, especially since certain rule names like "_RETURN" are

pgsql: Fix typo in comment of gistdoinsert().

2024-11-04 Thread Masahiko Sawada
Fix typo in comment of gistdoinsert(). Author: Tender Wang Reviewed-by: Masahiko Sawada Discussion: https://postgr.es/m/CAHewXN%3D3sH2sNw4nC3QGCEVw1Lftmw9m5y1Xje0bXK6ApDrsPQ%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/215f7af27d622162a1e33883f7

pgsql: Fix obsolete _bt_first comments.

2024-11-04 Thread Peter Geoghegan
Fix obsolete _bt_first comments. _bt_first doesn't necessarily hold onto a buffer pin on success exit. Fix header comments that claimed that we'll always hold onto a pin. Oversight in commit 2ed5b87f96. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/846cfe0dcc0281

pgsql: docs: Consistently use to indicate optional parameter

2024-11-04 Thread Heikki Linnakangas
docs: Consistently use to indicate optional parameters Some functions were using square brackets instead, replace them all with . Author: Dagfinn Ilmari Mannsåker Reviewed-by: jian he Discussion: https://www.postgresql.org/message-id/flat/cacjufxffubsph5uusszbl4sitbupuw%3deccpkgeazrjtrppu...@

pgsql: nbtree: Remove useless 'strat' local variable.

2024-11-04 Thread Peter Geoghegan
nbtree: Remove useless 'strat' local variable. Remove a local variable that was used to avoid overwriting strat_total with the = operator strategy when a >= operator strategy key was already included in the initial positioning/insertion scan keys by _bt_first (for backwards scans it would have to

pgsql: Split ProcSleep function into JoinWaitQueue and ProcSleep

2024-11-04 Thread Heikki Linnakangas
Split ProcSleep function into JoinWaitQueue and ProcSleep Split ProcSleep into two functions: JoinWaitQueue and ProcSleep. JoinWaitQueue is called while holding the partition lock, and inserts the current process to the wait queue, while ProcSleep() does the actual sleeping. ProcSleep() is now cal

pgsql: pg_combinebackup: Error if incremental file exists in full backu

2024-11-04 Thread Robert Haas
pg_combinebackup: Error if incremental file exists in full backup. Suppose that you run a command like "pg_combinebackup b1 b2 -o output", but both b1 and b2 contain an INCREMENTAL.$something file in a directory that is expected to contain relation files. This is an error, but the previous code wo

pgsql: pg_combinebackup: Error if incremental file exists in full backu

2024-11-04 Thread Robert Haas
pg_combinebackup: Error if incremental file exists in full backup. Suppose that you run a command like "pg_combinebackup b1 b2 -o output", but both b1 and b2 contain an INCREMENTAL.$something file in a directory that is expected to contain relation files. This is an error, but the previous code wo

pgsql: pg_combinebackup: When reconstructing, avoid double slash in fil

2024-11-04 Thread Robert Haas
pg_combinebackup: When reconstructing, avoid double slash in filename. This function is always called with a relative_path that ends in a slash, so there's no need to insert a second one. So, don't. Instead, add an assertion to verify that nothing gets broken in the future, and adjust the comments

pgsql: pg_combinebackup: When reconstructing, avoid double slash in fil

2024-11-04 Thread Robert Haas
pg_combinebackup: When reconstructing, avoid double slash in filename. This function is always called with a relative_path that ends in a slash, so there's no need to insert a second one. So, don't. Instead, add an assertion to verify that nothing gets broken in the future, and adjust the comments

pgsql: doc: fix typo in mvcc clarification in commit 2fa255ce9b9

2024-11-04 Thread Bruce Momjian
doc: fix typo in mvcc clarification in commit 2fa255ce9b9 Reported-by: Erik Rijkers (private email) Backpatch-through: master Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7ac744e72c842f528bfbb303e615560f0689619b Modified Files -- doc/src/sgml/mvcc.

pgsql: Move TRACE calls into WaitOnLock()

2024-11-04 Thread Heikki Linnakangas
Move TRACE calls into WaitOnLock() LockAcquire is a long and complex function. Pushing more stuff to its subroutines makes it a little more manageable. Reviewed-by: Maxim Orlov Discussion: https://www.postgresql.org/message-id/7c2090cd-a72a-4e34-afaa-6dd2ef314...@iki.fi Branch -- master De

pgsql: Set MyProc->heldLocks in ProcSleep

2024-11-04 Thread Heikki Linnakangas
Set MyProc->heldLocks in ProcSleep Previously, ProcSleep()'s caller was responsible for setting MyProc->heldLocks, and we had comments to remind about that. But it seems simpler to make ProcSleep() itself responsible for it. ProcSleep() already set the other info about the lock its waiting for (w

pgsql: Clarify nbtree parallel scan _bt_endpoint contract.

2024-11-04 Thread Peter Geoghegan
Clarify nbtree parallel scan _bt_endpoint contract. _bt_endpoint is a helper function for _bt_first that's called whenever no useful insertion scan key can be used, and we need to lock and read either the leftmost or rightmost leaf page in the index. Simplify and document its preconditions, relie

pgsql: Fix comment in LockReleaseAll() on when locallock->nLock can be

2024-11-04 Thread Heikki Linnakangas
Fix comment in LockReleaseAll() on when locallock->nLock can be zero We reach this case also e.g. when a deadlock is detected, not only when we run out of memory. Reviewed-by: Maxim Orlov Discussion: https://www.postgresql.org/message-id/7c2090cd-a72a-4e34-afaa-6dd2ef314...@iki.fi Branch --

pgsql: Make PG_TEST_EXTRA env var override the "meson setup" option

2024-11-04 Thread Heikki Linnakangas
Make PG_TEST_EXTRA env var override the "meson setup" option "meson test" used to ignore the PG_TEST_EXTRA environment variable, which meant that in order to run additional tests, you had to run "meson setup -DPG_TEST_EXTRA=...". That's somewhat expensive, and not consistent with autoconf builds.

pgsql: Add PG_TEST_EXTRA configure option to the Make builds

2024-11-04 Thread Heikki Linnakangas
Add PG_TEST_EXTRA configure option to the Make builds The Meson builds have PG_TEST_EXTRA as a configure-time variable, which was not available in the Make builds. To ensure both build systems are in sync, PG_TEST_EXTRA is now added as a configure-time variable. It can be set like this: ./con