pgsql: Use C11 alignas in pg_atomic_uint64 definitions

2025-11-26 Thread Peter Eisentraut
Use C11 alignas in pg_atomic_uint64 definitions They were already using pg_attribute_aligned. This replaces that with alignas and moves that into the required syntactic position. This ends up making these three atomics implementations appear a bit more consistent, but shouldn't change anything o

pgsql: Fix error reporting for SQL/JSON path type mismatches

2025-11-26 Thread Amit Langote
Fix error reporting for SQL/JSON path type mismatches transformJsonFuncExpr() used exprType()/exprLocation() on the possibly coerced path expression, which could be NULL when coercion to jsonpath failed, leading to "cache lookup failed for type 0" errors. Preserve the original expression node so

pgsql: Fix error reporting for SQL/JSON path type mismatches

2025-11-26 Thread Amit Langote
Fix error reporting for SQL/JSON path type mismatches transformJsonFuncExpr() used exprType()/exprLocation() on the possibly coerced path expression, which could be NULL when coercion to jsonpath failed, leading to "cache lookup failed for type 0" errors. Preserve the original expression node so

pgsql: Fix error reporting for SQL/JSON path type mismatches

2025-11-26 Thread Amit Langote
Fix error reporting for SQL/JSON path type mismatches transformJsonFuncExpr() used exprType()/exprLocation() on the possibly coerced path expression, which could be NULL when coercion to jsonpath failed, leading to "cache lookup failed for type 0" errors. Preserve the original expression node so

pgsql: Add parallelism support for TID Range Scans

2025-11-26 Thread David Rowley
Add parallelism support for TID Range Scans In v14, bb437f995 added support for scanning for ranges of TIDs using a dedicated executor node for the purpose. Here, we allow these scans to be parallelized. The range of blocks to scan is divvied up similarly to how a Parallel Seq Scans does that, w

pgsql: Have the planner replace COUNT(ANY) with COUNT(*), when possible

2025-11-26 Thread David Rowley
Have the planner replace COUNT(ANY) with COUNT(*), when possible This adds SupportRequestSimplifyAggref to allow pg_proc.prosupport functions to receive an Aggref and allow them to determine if there is a way that the Aggref call can be optimized. Also added is a support function to allow transfo

pgsql: Teach DSM registry to retry entry initialization if needed.

2025-11-26 Thread Nathan Bossart
Teach DSM registry to retry entry initialization if needed. If DSM registry entry initialization fails, backends could try to use an uninitialized DSM segment, DSA, or dshash table (since the entry is still added to the registry). To fix, restructure the code so that the registry retries initiali

pgsql: Teach DSM registry to retry entry initialization if needed.

2025-11-26 Thread Nathan Bossart
Teach DSM registry to retry entry initialization if needed. If DSM registry entry initialization fails, backends could try to use an uninitialized DSM segment, DSA, or dshash table (since the entry is still added to the registry). To fix, restructure the code so that the registry retries initiali

pgsql: Teach DSM registry to retry entry initialization if needed.

2025-11-26 Thread Nathan Bossart
Teach DSM registry to retry entry initialization if needed. If DSM registry entry initialization fails, backends could try to use an uninitialized DSM segment, DSA, or dshash table (since the entry is still added to the registry). To fix, restructure the code so that the registry retries initiali

pgsql: Allow pg_locale_t APIs to work when ctype_is_c.

2025-11-26 Thread Jeff Davis
Allow pg_locale_t APIs to work when ctype_is_c. Previously, the caller needed to check ctype_is_c first for some routines and not others. Now, the APIs consistently work, and the caller can just check ctype_is_c for optimization purposes. Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d

pgsql: Check for correct version of perltidy

2025-11-26 Thread Daniel Gustafsson
Check for correct version of perltidy pgperltidy requires a particular version of perltidy, but the version wasn't checked like how pgindent checks the underlying indent binary. Fix by checking the version of perltidy and error out if an incorrect version is used. Author: Daniel Gustafsson Repor

pgsql: Add #define for UNICODE_CASEMAP_BUFSZ.

2025-11-26 Thread Jeff Davis
Add #define for UNICODE_CASEMAP_BUFSZ. Useful for mapping a single codepoint at a time into a statically-allocated buffer. Discussion: https://postgr.es/m/[email protected] Reviewed-by: Chao Li Branch -- master Details --- https://git.postgresq

pgsql: Inline pg_ascii_tolower() and pg_ascii_toupper().

2025-11-26 Thread Jeff Davis
Inline pg_ascii_tolower() and pg_ascii_toupper(). Discussion: https://postgr.es/m/[email protected] Reviewed-by: Chao Li Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ec4997a9d733e91b614d0c2f3e6445cc2905fd16 Modified Fil

pgsql: Revert "Teach DSM registry to ERROR if attaching to an uninitial

2025-11-26 Thread Nathan Bossart
Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry." This reverts commit 1165a933aa (and the corresponding commits on the back-branches). In a follow-up commit, we'll teach the registry to retry entry initialization instead of leaving it in a permanently failed state. Rev

pgsql: Revert "Teach DSM registry to ERROR if attaching to an uninitial

2025-11-26 Thread Nathan Bossart
Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry." This reverts commit 1165a933aa (and the corresponding commits on the back-branches). In a follow-up commit, we'll teach the registry to retry entry initialization instead of leaving it in a permanently failed state. Rev

pgsql: Revert "Teach DSM registry to ERROR if attaching to an uninitial

2025-11-26 Thread Nathan Bossart
Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry." This reverts commit 1165a933aa (and the corresponding commits on the back-branches). In a follow-up commit, we'll teach the registry to retry entry initialization instead of leaving it in a permanently failed state. Rev

pgsql: Split heap_page_prune_and_freeze() into helpers

2025-11-26 Thread Melanie Plageman
Split heap_page_prune_and_freeze() into helpers Refactor the setup and planning phases of pruning and freezing into helpers. This streamlines heap_page_prune_and_freeze() and makes it more clear when the examination of tuples ends and page modifications begin. No code change beyond what was requi

pgsql: Remove a few unused struct members.

2025-11-26 Thread Nathan Bossart
Remove a few unused struct members. Oversights in commits ab9e0e718a, f3049a603a, and 247ce06b88. Author: Bertrand Drouvot Discussion: https://postgr.es/m/aScUuBSawPWogUxs%40ip-10-97-1-34.eu-west-3.compute.internal Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/

pgsql: doc: Clarify passphrase command reloading on Windows

2025-11-26 Thread Daniel Gustafsson
doc: Clarify passphrase command reloading on Windows When running on Windows (or EXEC_BACKEND) the SSL configuration will be reloaded on each backend start, so the passphrase command will be reloaded along with it. This implies that passphrase command reload must be enabled on Windows for connect

pgsql: doc: Clarify passphrase command reloading on Windows

2025-11-26 Thread Daniel Gustafsson
doc: Clarify passphrase command reloading on Windows When running on Windows (or EXEC_BACKEND) the SSL configuration will be reloaded on each backend start, so the passphrase command will be reloaded along with it. This implies that passphrase command reload must be enabled on Windows for connect

pgsql: doc: Clarify passphrase command reloading on Windows

2025-11-26 Thread Daniel Gustafsson
doc: Clarify passphrase command reloading on Windows When running on Windows (or EXEC_BACKEND) the SSL configuration will be reloaded on each backend start, so the passphrase command will be reloaded along with it. This implies that passphrase command reload must be enabled on Windows for connect

pgsql: doc: Clarify passphrase command reloading on Windows

2025-11-26 Thread Daniel Gustafsson
doc: Clarify passphrase command reloading on Windows When running on Windows (or EXEC_BACKEND) the SSL configuration will be reloaded on each backend start, so the passphrase command will be reloaded along with it. This implies that passphrase command reload must be enabled on Windows for connect

pgsql: doc: Clarify passphrase command reloading on Windows

2025-11-26 Thread Daniel Gustafsson
doc: Clarify passphrase command reloading on Windows When running on Windows (or EXEC_BACKEND) the SSL configuration will be reloaded on each backend start, so the passphrase command will be reloaded along with it. This implies that passphrase command reload must be enabled on Windows for connect

pgsql: ssl: Add connection and reload tests for key passphrases

2025-11-26 Thread Daniel Gustafsson
ssl: Add connection and reload tests for key passphrases ssl_passphrase_command_supports_reload was not covered by the SSL testsuite, and connection tests after unlocking secrets with the passphrase was also missing. This adds test coverage for reloads of passphrase commands as well as connectio

pgsql: Add GUC to show EXEC_BACKEND state

2025-11-26 Thread Daniel Gustafsson
Add GUC to show EXEC_BACKEND state There is no straightforward way to determine if a cluster is running in EXEC_BACKEND mode or not, which is useful for tests to know. This adds a GUC debug_exec_backend similar to debug_assertions which will be true when the server is running in EXEC_BACKEND mode.

pgsql: doc: Clarify passphrase command reloading on Windows

2025-11-26 Thread Daniel Gustafsson
doc: Clarify passphrase command reloading on Windows When running on Windows (or EXEC_BACKEND) the SSL configuration will be reloaded on each backend start, so the passphrase command will be reloaded along with it. This implies that passphrase command reload must be enabled on Windows for connect