pgsql: Optimize Query jumble

2025-03-26 Thread David Rowley
Optimize Query jumble f31aad9b0 adjusted query jumbling so it no longer ignores NULL nodes during the jumble. This added some overhead. Here we tune a few things to make jumbling faster again. This makes jumbling perform similar or even slightly faster than prior to that change. Author: David

pgsql: Fix query jumbling to account for NULL nodes

2025-03-26 Thread David Rowley
Fix query jumbling to account for NULL nodes Previously NULL nodes were ignored. This could cause issues where the computed query ID could match for queries where fields that are next to each other in their Node struct where one field was NULL and the other non-NULL. For example, the Query struc

pgsql: Fix typo in comment

2025-03-26 Thread Peter Eisentraut
Fix typo in comment Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/47929324c522cecfa8e0f64c6833f1dc3a67a735 Modified Files -- src/backend/storage/file/buffile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: doc: Correct description of values used in FSM for indexes

2025-03-26 Thread Michael Paquier
doc: Correct description of values used in FSM for indexes The implementation of FSM for indexes is simpler than heap, where 0 is used to track if a page is in-use and (BLCKSZ - 1) if a page is free. One comment in indexfsm.c and one description in the documentation of pg_freespacemap were incorre

pgsql: doc: Correct description of values used in FSM for indexes

2025-03-26 Thread Michael Paquier
doc: Correct description of values used in FSM for indexes The implementation of FSM for indexes is simpler than heap, where 0 is used to track if a page is in-use and (BLCKSZ - 1) if a page is free. One comment in indexfsm.c and one description in the documentation of pg_freespacemap were incorre

pgsql: doc: Correct description of values used in FSM for indexes

2025-03-26 Thread Michael Paquier
doc: Correct description of values used in FSM for indexes The implementation of FSM for indexes is simpler than heap, where 0 is used to track if a page is in-use and (BLCKSZ - 1) if a page is free. One comment in indexfsm.c and one description in the documentation of pg_freespacemap were incorre

pgsql: doc: Correct description of values used in FSM for indexes

2025-03-26 Thread Michael Paquier
doc: Correct description of values used in FSM for indexes The implementation of FSM for indexes is simpler than heap, where 0 is used to track if a page is in-use and (BLCKSZ - 1) if a page is free. One comment in indexfsm.c and one description in the documentation of pg_freespacemap were incorre

pgsql: doc: Correct description of values used in FSM for indexes

2025-03-26 Thread Michael Paquier
doc: Correct description of values used in FSM for indexes The implementation of FSM for indexes is simpler than heap, where 0 is used to track if a page is in-use and (BLCKSZ - 1) if a page is free. One comment in indexfsm.c and one description in the documentation of pg_freespacemap were incorre

Re: pgsql: aio: Add io_method=io_uring

2025-03-26 Thread Andres Freund
Hi, On 2025-03-27 00:15:53 +, Andres Freund wrote: > aio: Add io_method=io_uring FWIW, the BF failure on culicidae looks to be independent to me https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=culicidae&dt=2025-03-27%2000%3A16%3A30 The relevant line from the log is: 2025-03-27 00:20:

pgsql: aio: Add io_method=io_uring

2025-03-26 Thread Andres Freund
aio: Add io_method=io_uring Performing AIO using io_uring can be considerably faster than io_method=worker, particularly when lots of small IOs are issued, as a) the context-switch overhead for worker based AIO becomes more significant b) the number of IO workers can become limiting io_uring, how

pgsql: aio: Add liburing dependency

2025-03-26 Thread Andres Freund
aio: Add liburing dependency Will be used in a subsequent commit, to implement io_method=io_uring. Kept separate for easier review. Reviewed-by: Noah Misch Discussion: https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dt Branch -- master Details --- ht

pgsql: doc: Mention possible ephemeral discrepancies in pg_stat_activit

2025-03-26 Thread Michael Paquier
doc: Mention possible ephemeral discrepancies in pg_stat_activity Ephemeral inconsistencies across multiple attributes of pg_stat_activity can exist as the system is designed to be efficient with a low overhead. This question is raised by users from time to time based on the data read in the view,

pgsql: aio: Rename pgaio_io_prep_* to pgaio_io_start_*

2025-03-26 Thread Andres Freund
aio: Rename pgaio_io_prep_* to pgaio_io_start_* The old naming pattern (mirroring liburing's naming) was inconsistent with the (not yet introduced) callers. It seems better to get rid of the inconsistency now than to grow more users of the odd naming. Reported-by: Noah Misch Discussion: https://

pgsql: aio: Be more paranoid about interrupts

2025-03-26 Thread Andres Freund
aio: Be more paranoid about interrupts As reported by Noah, it's possible, although practically very unlikely, that interrupts could be processed in between pgaio_io_reopen() and pgaio_io_perform_synchronously(). Prevent that by explicitly holding interrupts. It also seems good to add an assertio

pgsql: aio: Pass result of local callbacks to ->report_return

2025-03-26 Thread Andres Freund
aio: Pass result of local callbacks to ->report_return Otherwise the results of e.g. temp table buffer verification errors will not reach bufmgr.c. Obviously that's not right. Found while expanding the tests for invalid buffer contents. Reviewed-by: Noah Misch Discussion: https://postgr.es/m/202

pgsql: pg_overexplain: SET jit=off when running tests.

2025-03-26 Thread Robert Haas
pg_overexplain: SET jit=off when running tests. Per buildfarm. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/47a1f076a7c9789134a29dc738db0152e5f71b4c Modified Files -- contrib/pg_overexplain/expected/pg_overexplain.out | 3 +++ contrib/pg_overexplain/s

pgsql: Fix oversights in commit 8d5ceb113e3f7ddb627bd40b26438a9d2fa0551

2025-03-26 Thread Robert Haas
Fix oversights in commit 8d5ceb113e3f7ddb627bd40b26438a9d2fa05512 It added bogus whitespace at the end of a line in the documentation. It should not have done that. The pg_overexplain tests must SET debug_parallel_query = false, not just RESET debug_parallel_query, or we get failures on test mach

pgsql: Keep the decompressed filter in brin_bloom_union

2025-03-26 Thread Tomas Vondra
Keep the decompressed filter in brin_bloom_union The brin_bloom_union() function combines two BRIN summaries, by merging one filter into the other. With bloom, we have to decompress the filters first, but the function failed to update the summary to store the merged filter. As a consequence, the i

pgsql: Keep the decompressed filter in brin_bloom_union

2025-03-26 Thread Tomas Vondra
Keep the decompressed filter in brin_bloom_union The brin_bloom_union() function combines two BRIN summaries, by merging one filter into the other. With bloom, we have to decompress the filters first, but the function failed to update the summary to store the merged filter. As a consequence, the i

pgsql: Keep the decompressed filter in brin_bloom_union

2025-03-26 Thread Tomas Vondra
Keep the decompressed filter in brin_bloom_union The brin_bloom_union() function combines two BRIN summaries, by merging one filter into the other. With bloom, we have to decompress the filters first, but the function failed to update the summary to store the merged filter. As a consequence, the i

pgsql: Keep the decompressed filter in brin_bloom_union

2025-03-26 Thread Tomas Vondra
Keep the decompressed filter in brin_bloom_union The brin_bloom_union() function combines two BRIN summaries, by merging one filter into the other. With bloom, we have to decompress the filters first, but the function failed to update the summary to store the merged filter. As a consequence, the i

pgsql: Keep the decompressed filter in brin_bloom_union

2025-03-26 Thread Tomas Vondra
Keep the decompressed filter in brin_bloom_union The brin_bloom_union() function combines two BRIN summaries, by merging one filter into the other. With bloom, we have to decompress the filters first, but the function failed to update the summary to store the merged filter. As a consequence, the i

pgsql: Use PG_MODULE_MAGIC_EXT in our installable shared libraries.

2025-03-26 Thread Tom Lane
Use PG_MODULE_MAGIC_EXT in our installable shared libraries. It seems potentially useful to label our shared libraries with version information, now that a facility exists for retrieving that. This patch labels them with the PG_VERSION string. There was some discussion about using semantic versi

pgsql: Introduce PG_MODULE_MAGIC_EXT macro.

2025-03-26 Thread Tom Lane
Introduce PG_MODULE_MAGIC_EXT macro. This macro allows dynamically loaded shared libraries (modules) to provide a wired-in module name and version, and possibly other compile-time-constant fields in future. This information can be retrieved with the new pg_get_loaded_modules() function. This fea

pgsql: Move GSSAPI includes into its own header

2025-03-26 Thread Daniel Gustafsson
Move GSSAPI includes into its own header Due to a conflict in macro names on Windows between and these headers need to be included using a predictable pattern with an undef to handle that. The GSSAPI header does include which cause problems with compiling PostgreSQL using MSVC when OpenSSL and

pgsql: psql: Make test robust against locale variations

2025-03-26 Thread Daniel Gustafsson
psql: Make test robust against locale variations The test committed in 1a759c83278 was prone to failing when using locales with a different decimal separator. Since the test value isn't the important part, change to using an integer instead. Author: Daniel Gustafsson Reported-by: Pavel Stehule

Re: pgsql: postgres_fdw: improve security checks

2025-03-26 Thread Peter Eisentraut
On 26.03.25 01:59, Tom Lane wrote: Peter Eisentraut writes: postgres_fdw: improve security checks This patch is failing on "drongo" [1]. It looks like the problem is that the pg_hba.conf file being used doesn't allow for TCP loopback connections. To make that safe, the test would have to be

pgsql: dblink: SCRAM authentication pass-through

2025-03-26 Thread Peter Eisentraut
dblink: SCRAM authentication pass-through This enables SCRAM authentication for dblink (using dblink_fdw) when connecting to a foreign server without having to store a plain-text password on user mapping options This uses the same approach as it was implemented for postgres_fdw in commit 761c7950

pgsql: Add support for gamma() and lgamma() functions.

2025-03-26 Thread Dean Rasheed
Add support for gamma() and lgamma() functions. These are useful general-purpose math functions which are included in POSIX and C99, and are commonly included in other math libraries, so expose them as SQL-callable functions. Author: Dean Rasheed Reviewed-by: Stepan Neretin Reviewed-by: Peter E

pgsql: doc: Remove incorrect description about dropping replication slo

2025-03-26 Thread Fujii Masao
doc: Remove incorrect description about dropping replication slots. pg_drop_replication_slot() can drop replication slots created on a different database than the one where it is executed. This behavior has been in place since PostgreSQL 9.4, when pg_drop_replication_slot() was introduced. Howeve

pgsql: Fix integer-overflow problem in scram_SaltedPassword()

2025-03-26 Thread Richard Guo
Fix integer-overflow problem in scram_SaltedPassword() Setting the iteration count for SCRAM secret generation to INT_MAX will cause an infinite loop in scram_SaltedPassword() due to integer overflow, as the loop uses the "i <= iterations" comparison. To fix, use "i < iterations" instead. Back-p

pgsql: Fix integer-overflow problem in scram_SaltedPassword()

2025-03-26 Thread Richard Guo
Fix integer-overflow problem in scram_SaltedPassword() Setting the iteration count for SCRAM secret generation to INT_MAX will cause an infinite loop in scram_SaltedPassword() due to integer overflow, as the loop uses the "i <= iterations" comparison. To fix, use "i < iterations" instead. Back-p

pgsql: Fix integer-overflow problem in scram_SaltedPassword()

2025-03-26 Thread Richard Guo
Fix integer-overflow problem in scram_SaltedPassword() Setting the iteration count for SCRAM secret generation to INT_MAX will cause an infinite loop in scram_SaltedPassword() due to integer overflow, as the loop uses the "i <= iterations" comparison. To fix, use "i < iterations" instead. Back-p