pgsql: Improve timeout handling of pg_promote()

2026-03-25 Thread Michael Paquier
Improve timeout handling of pg_promote() Previously, pg_promote() looped a fixed number of times, calculated from the specified timeout, and waited 100ms on a latch, once per iteration, for the promotion of a standby to complete. However, unrelated signals to the backend could set the latch and w

pgsql: Refactor replorigin_session_setup() for better readability.

2026-03-25 Thread Amit Kapila
Refactor replorigin_session_setup() for better readability. Reorder the validation checks in replorigin_session_setup() to provide a more logical flow. This makes the function easier to follow and ensures that basic state checks are performed consistently. Additionally, update an error message to

pgsql: Fix UUID sortability tests in base32hex encoding.

2026-03-25 Thread Masahiko Sawada
Fix UUID sortability tests in base32hex encoding. Commit 497c1170cb1 added base32hex encoding support, but its regression test for UUIDs failed on buildfarm members hippopotamus and jay using natural language locales (such as cs_CZ). This happened because those collations may sort characters diffe

pgsql: Remove compiler warning option -Wendif-labels

2026-03-25 Thread Peter Eisentraut
Remove compiler warning option -Wendif-labels This warning has always been on by default in GCC (and in Clang at least going back to 3.1), so we don't need the option explicitly. Reviewed-by: Tom Lane Reviewed-by: Bertrand Drouvot Discussion: https://www.postgresql.org/message-id/flat/aa73q1aT

pgsql: psql: Fix tab completion for FOREIGN DATA WRAPPER and SUBSCRIPTI

2026-03-25 Thread Masahiko Sawada
psql: Fix tab completion for FOREIGN DATA WRAPPER and SUBSCRIPTION. Commit 8185bb5347 extended the CREATE/ALTER SUBSCRIPTION and CREATE/ALTER FOREIGN DATA WRAPPER commands, but missed the corresponding tab-completion logic. This commit fixes that oversight by adding completion support for: - The

pgsql: Fix some typos and make small stylistic improvements

2026-03-25 Thread Peter Eisentraut
Fix some typos and make small stylistic improvements for commit 2f094e7ac69 Author: zengman Reviewed-by: Ashutosh Bapat Discussion: https://www.postgresql.org/message-id/flat/[email protected] Branch -- master Details --- https://git.postgresql.org/p

pgsql: Add base32hex support to encode() and decode() functions.

2026-03-25 Thread Masahiko Sawada
Add base32hex support to encode() and decode() functions. This adds support for base32hex encoding and decoding, as defined in RFC 4648 Section 7. Unlike standard base32, base32hex uses the extended hex alphabet (0-9, A-V) which preserves the lexicographical order of the encoded data. This is par

pgsql: Disable warnings in system headers in MSVC

2026-03-25 Thread Peter Eisentraut
Disable warnings in system headers in MSVC This is similar to the standard behavior in GCC. For MSVC, we set all headers in angle brackets to be considered system headers. (GCC goes by path, not include style.) The required option is available since VS 2017. (Before VS 2019 version 16.10, the

pgsql: Fix file descriptor leakages in pg_waldump.

2026-03-25 Thread Tom Lane
Fix file descriptor leakages in pg_waldump. TarWALDumpCloseSegment was of the opinion that it didn't need to do anything. It was mistaken: it has to close the open file if any, because nothing else will, leading to a descriptor leak. In addition, we failed to ensure that any file being read by t

pgsql: Fix misuse of simplehash.h hash operations in pg_waldump.

2026-03-25 Thread Tom Lane
Fix misuse of simplehash.h hash operations in pg_waldump. Both ArchivedWAL_insert() and ArchivedWAL_delete_item() can cause existing hashtable entries to move. The code didn't account for this and could leave privateInfo->cur_file pointing at a dead or incorrect entry, with hilarity ensuing. Lik

pgsql: Remove a low-value, high-risk optimization in pg_waldump.

2026-03-25 Thread Tom Lane
Remove a low-value, high-risk optimization in pg_waldump. The code removed here deleted already-used data from a partially-read WAL segment's hashtable entry. The intent was evidently to try to keep the entry's memory consumption below the WAL segment's total size, but we don't use WAL segments t

pgsql: Remove unused autovac_table.at_sharedrel

2026-03-25 Thread Álvaro Herrera
Remove unused autovac_table.at_sharedrel The last use was removed by commit 38f7831d703b. After that, we compute MyWorkerInfo->wi_sharedrel directly from the pg_class tuple of the table being vacuumed rather than passing it around. Author: Yugo Nagata Discussion: https://postgr.es/m/2026032516