pgsql: Fix const-simplification for index expressions and predicate

2025-12-08 Thread Richard Guo
Fix const-simplification for index expressions and predicate Similar to the issue with constraint and statistics expressions fixed in 317c117d6, index expressions and predicate can also suffer from incorrect reduction of NullTest clauses during const-simplification, due to unfixed varnos and the u

pgsql: Fix LOCK_TIMEOUT handling in slotsync worker.

2025-12-08 Thread Amit Kapila
Fix LOCK_TIMEOUT handling in slotsync worker. Previously, the slotsync worker relied on SIGINT for graceful shutdown during promotion. However, SIGINT is also used by the LOCK_TIMEOUT handler to cancel queries. Since the slotsync worker can lock catalog tables while parsing libpq tuples, this over

pgsql: Fix LOCK_TIMEOUT handling in slotsync worker.

2025-12-08 Thread Amit Kapila
Fix LOCK_TIMEOUT handling in slotsync worker. Previously, the slotsync worker relied on SIGINT for graceful shutdown during promotion. However, SIGINT is also used by the LOCK_TIMEOUT handler to cancel queries. Since the slotsync worker can lock catalog tables while parsing libpq tuples, this over

pgsql: Fix LOCK_TIMEOUT handling in slotsync worker.

2025-12-08 Thread Amit Kapila
Fix LOCK_TIMEOUT handling in slotsync worker. Previously, the slotsync worker relied on SIGINT for graceful shutdown during promotion. However, SIGINT is also used by the LOCK_TIMEOUT handler to cancel queries. Since the slotsync worker can lock catalog tables while parsing libpq tuples, this over

pgsql: Remove unnecessary casts in printf format arguments (%zu/%zd)

2025-12-08 Thread Peter Eisentraut
Remove unnecessary casts in printf format arguments (%zu/%zd) Many of these are probably left over from before use of %zu/%zd was portable. Reviewed-by: Bertrand Drouvot Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org Branch -- m

pgsql: Remove useless casts in format arguments

2025-12-08 Thread Peter Eisentraut
Remove useless casts in format arguments There were a number of useless casts in format arguments, either where the input to the cast was already in the right type, or seemingly uselessly casting between types instead of just using the right format placeholder to begin with. Reviewed-by: Bertrand

pgsql: Clean up int64-related format strings

2025-12-08 Thread Peter Eisentraut
Clean up int64-related format strings Remove some gratuitous uses of INT64_FORMAT. Make use of PRIu64/PRId64 were appropriate, remove unnecessary casts. Reviewed-by: Bertrand Drouvot Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org B

pgsql: Use palloc_object() and palloc_array() in more areas of the tree

2025-12-08 Thread Michael Paquier
Use palloc_object() and palloc_array() in more areas of the tree The idea is to encourage more the use of these new routines across the tree, as these offer stronger type safety guarantees than palloc(). The following paths are included in this batch, treating all the areas proposed by the author

pgsql: Improve documentation for pg_atomic_unlocked_write_u32()

2025-12-08 Thread Andres Freund
Improve documentation for pg_atomic_unlocked_write_u32() After my recent commit 7902a47c20b, Nathan noticed that pg_atomic_unlocked_write_u64() was not accurately described by the comments for the 32bit version. Turns out the 32bit version has suffered from copy-and-paste-itis since its introducti

pgsql: Doc: fix typo in hash index documentation

2025-12-08 Thread David Rowley
Doc: fix typo in hash index documentation Plus a similar fix to the README. Backpatch as far back as the sgml issue exists. The README issue does exist in v14, but that seems unlikely to harm anyone. Author: David Geier Discussion: https://postgr.es/m/ed3db7ea-55b4-4809-86af-81ad3bb2c...@gmail

pgsql: Doc: fix typo in hash index documentation

2025-12-08 Thread David Rowley
Doc: fix typo in hash index documentation Plus a similar fix to the README. Backpatch as far back as the sgml issue exists. The README issue does exist in v14, but that seems unlikely to harm anyone. Author: David Geier Discussion: https://postgr.es/m/ed3db7ea-55b4-4809-86af-81ad3bb2c...@gmail

pgsql: Doc: fix typo in hash index documentation

2025-12-08 Thread David Rowley
Doc: fix typo in hash index documentation Plus a similar fix to the README. Backpatch as far back as the sgml issue exists. The README issue does exist in v14, but that seems unlikely to harm anyone. Author: David Geier Discussion: https://postgr.es/m/ed3db7ea-55b4-4809-86af-81ad3bb2c...@gmail

pgsql: Doc: fix typo in hash index documentation

2025-12-08 Thread David Rowley
Doc: fix typo in hash index documentation Plus a similar fix to the README. Backpatch as far back as the sgml issue exists. The README issue does exist in v14, but that seems unlikely to harm anyone. Author: David Geier Discussion: https://postgr.es/m/ed3db7ea-55b4-4809-86af-81ad3bb2c...@gmail

pgsql: Doc: fix typo in hash index documentation

2025-12-08 Thread David Rowley
Doc: fix typo in hash index documentation Plus a similar fix to the README. Backpatch as far back as the sgml issue exists. The README issue does exist in v14, but that seems unlikely to harm anyone. Author: David Geier Discussion: https://postgr.es/m/ed3db7ea-55b4-4809-86af-81ad3bb2c...@gmail

pgsql: libpq: Refactor logic checking for exit() in shared library buil

2025-12-08 Thread Michael Paquier
libpq: Refactor logic checking for exit() in shared library builds This commit refactors the sanity check done by libpq to ensure that there is no exit() reference in the build, moving the check from a standalone Makefile rule to a perl script. Platform-specific checks are now part of the script,

pgsql: Fix minor portability issue in pg_resetwal.c.

2025-12-08 Thread Tom Lane
Fix minor portability issue in pg_resetwal.c. The argument of isspace() (like other functions) must be cast to unsigned char to ensure portable results. Per NetBSD buildfarm members. Oversight in 636c1914b. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c004d68c

pgsql: Avoid pointer chasing in _bt_readpage inner loop.

2025-12-08 Thread Peter Geoghegan
Avoid pointer chasing in _bt_readpage inner loop. Make _bt_readpage pass down the current scan direction to various utility functions within its pstate variable. Also have _bt_readpage work off of a local copy of scan->ignore_killed_tuples within its per-tuple loop (rather than using scan->ignore

pgsql: Unify some more messages

2025-12-08 Thread Álvaro Herrera
Unify some more messages No backpatch here because of message wording changes. Author: Álvaro Herrera Reviewed-by: Nathan Bossart Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d0d0ba6cf66c

pgsql: Relocate _bt_readpage and related functions.

2025-12-08 Thread Peter Geoghegan
Relocate _bt_readpage and related functions. Quite a bit of code within nbtutils.c is only called by _bt_readpage. Move _bt_readpage and all of the nbtutils.c functions it depends on into a new .c file, nbtreadpage.c. Also reorder some of the functions within the new file for clarity. This commi

pgsql: Unify error messages

2025-12-08 Thread Álvaro Herrera
Unify error messages No visible changes, just refactor how messages are constructed. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/502e256f2262351e92994878eea3332da64834b0 Modified Files -- src/backend/catalog/aclchk.c| 6 +++-- src/ba

pgsql: Unify error messages

2025-12-08 Thread Álvaro Herrera
Unify error messages No visible changes, just refactor how messages are constructed. Branch -- REL_18_STABLE Details --- https://git.postgresql.org/pg/commitdiff/5278222853cab4d9779b707eaea5878856e2471e Modified Files -- src/backend/catalog/aclchk.c| 6 +++--

pgsql: pg_resetwal: Reject negative and out of range arguments

2025-12-08 Thread Heikki Linnakangas
pg_resetwal: Reject negative and out of range arguments The strtoul() function that we used to parse many of the options accepts negative values, and silently wraps them to the equivalent unsigned values. For example, -1 becomes 0x, on platforms where unsigned long is 32 bits wide. Also, o

pgsql: pg_resetwal: Use separate flags for whether an option is given

2025-12-08 Thread Heikki Linnakangas
pg_resetwal: Use separate flags for whether an option is given Currently, we use special values that are otherwise invalid for each option to indicate "option was not given". Replace that with separate boolean variables for each option. It seems more clear to be explicit. We were already doing th

pgsql: Make ecpg parse.pl more robust with braces

2025-12-08 Thread Peter Eisentraut
Make ecpg parse.pl more robust with braces When parse.pl processes braces, it does not take into account that braces could also be their own token if single quoted ('{', '}'). This is not currently used but a future patch wants to make use of it. This fixes that by using lookaround assertions to

pgsql: Use PGAlignedXLogBlock for some code simplification

2025-12-08 Thread Peter Eisentraut
Use PGAlignedXLogBlock for some code simplification The code in BootStrapXLOG() and in pg_test_fsync.c tried to align WAL buffers in complicated ways. Also, they still used XLOG_BLCKSZ for the alignment, even though that should now be PG_IO_ALIGN_SIZE. This can now be simplified and made more co

Re: pgsql: injection_points: Remove portions related to custom pgstats

2025-12-08 Thread Michael Paquier
On Sun, Dec 07, 2025 at 11:57:34PM -0500, Tom Lane wrote: > Nah, hold off till we have a discussion about whether the test is > correct to expect compatibility. We can afford to have a couple > of BF animals unhappy for a day or two while we come to a decision. By the way, while looking at the bu