pgsql: libpq: Fix some issues in TAP tests for service files

2025-04-06 Thread Michael Paquier
libpq: Fix some issues in TAP tests for service files The valid service file was not correctly shaped, as append_to_file() was called with an array as input. This is changed so as the parameter and value pairs from the valid connection string are appended to the valid service file one by one. Ev

pgsql: Clarify comment for worst-case allocation in quote_literal_cstr(

2025-04-06 Thread Michael Paquier
Clarify comment for worst-case allocation in quote_literal_cstr() palloc() is invoked with a specific formula for its allocation size in quote_literal_cstr(). This wastes some memory, but the size is large enough to cover even the worst-case scenarios. No explanations were given about the reason

pgsql: Fix use-after-free in pgstat_fetch_stat_backend_by_pid()

2025-04-06 Thread Michael Paquier
Fix use-after-free in pgstat_fetch_stat_backend_by_pid() stats_fetch_consistency set to "snapshot" causes the backend entry "beentry" retrieved by pgstat_get_beentry_by_proc_number() to be reset at the beginning of pgstat_fetch_stat_backend() when fetching the backend pgstats entry. As coded, "be

pgsql: Use XLOG_CONTROL_FILE macro consistently for control file name.

2025-04-06 Thread Fujii Masao
Use XLOG_CONTROL_FILE macro consistently for control file name. The XLOG_CONTROL_FILE macro (defined in access/xlog_internal.h) represents the control file name. While some parts of the codebase already use this macro, others previously hardcoded the file name as a string. This commit replaces th

pgsql: pg_upgrade: Fix memory leak in check_for_unicode_update().

2025-04-06 Thread Nathan Bossart
pg_upgrade: Fix memory leak in check_for_unicode_update(). This function was initializing the "task" variable before a couple of early returns. To fix, postpone the initialization until just before it's needed. Per Coverity. Discussion: https://postgr.es/m/Z_KMsUH2-FEbiNjC%40nathan Branch

pgsql: doc: Clarify project naming

2025-04-06 Thread Daniel Gustafsson
doc: Clarify project naming Clarify the project naming in the history section of the docs to match the recent license preamble changes. Backpatch to all supported versions. Author: Dave Page Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CA+OCxozLzK2+Jc14XZyWXSp6L9Ot+3efwXUE35

pgsql: doc: Clarify project naming

2025-04-06 Thread Daniel Gustafsson
doc: Clarify project naming Clarify the project naming in the history section of the docs to match the recent license preamble changes. Backpatch to all supported versions. Author: Dave Page Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CA+OCxozLzK2+Jc14XZyWXSp6L9Ot+3efwXUE35

pgsql: doc: Clarify project naming

2025-04-06 Thread Daniel Gustafsson
doc: Clarify project naming Clarify the project naming in the history section of the docs to match the recent license preamble changes. Backpatch to all supported versions. Author: Dave Page Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CA+OCxozLzK2+Jc14XZyWXSp6L9Ot+3efwXUE35

pgsql: doc: Clarify project naming

2025-04-06 Thread Daniel Gustafsson
doc: Clarify project naming Clarify the project naming in the history section of the docs to match the recent license preamble changes. Backpatch to all supported versions. Author: Dave Page Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CA+OCxozLzK2+Jc14XZyWXSp6L9Ot+3efwXUE35

pgsql: doc: Clarify project naming

2025-04-06 Thread Daniel Gustafsson
doc: Clarify project naming Clarify the project naming in the history section of the docs to match the recent license preamble changes. Backpatch to all supported versions. Author: Dave Page Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CA+OCxozLzK2+Jc14XZyWXSp6L9Ot+3efwXUE35

pgsql: doc: Clarify project naming

2025-04-06 Thread Daniel Gustafsson
doc: Clarify project naming Clarify the project naming in the history section of the docs to match the recent license preamble changes. Backpatch to all supported versions. Author: Dave Page Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CA+OCxozLzK2+Jc14XZyWXSp6L9Ot+3efwXUE35

Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing

2025-04-06 Thread Michael Paquier
On Sun, Apr 06, 2025 at 09:18:45AM -0700, Jeff Davis wrote: > My mistake, backported through 16 now. Thanks! -- Michael signature.asc Description: PGP signature

pgsql: Clean up checking for pg_dumpall output directory

2025-04-06 Thread Andrew Dunstan
Clean up checking for pg_dumpall output directory Coverity objected to the original code, and in any case this is much cleaner, using the existing routine pg_check_dir() instead of rolling its own test. Per suggestion from Tom Lane. Branch -- master Details --- https://git.postgresql.or

pgsql: Doc: fix PDF "contents ... exceed the available area" warnings.

2025-04-06 Thread Tom Lane
Doc: fix PDF "contents ... exceed the available area" warnings. Tweak column widths in a new table, similarly to some previous fixes such as b62381d9a. Per buildfarm. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/218ab682751dfe75667456019364187758d4871a Modified

Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing

2025-04-06 Thread Jeff Davis
On Sat, 2025-04-05 at 17:24 +0900, Michael Paquier wrote: > I am back to a laptop, and just noticed that you have applied > f4e51eab4eb0 into the tree to take care of this issue, affecting only > HEAD.  Why didn't you do a backpatch of this commit down to v16? > That's down to where 2a083ab807db ha

pgsql: Fix unintentional 'NULL' string literal in pg_upgrade.

2025-04-06 Thread Jeff Davis
Fix unintentional 'NULL' string literal in pg_upgrade. Introduced in 2a083ab807. Note: backport of commit 945126234b, which was missed at the time. Discussion: https://postgr.es/m/e852442da35b4f31acc600ed98bbee0f12e65e0c.ca...@j-davis.com Reviewed-by: Michael Paquier Backpatch-through: 16 Bra

pgsql: Fix unintentional 'NULL' string literal in pg_upgrade.

2025-04-06 Thread Jeff Davis
Fix unintentional 'NULL' string literal in pg_upgrade. Introduced in 2a083ab807. Note: backport of commit 945126234b, which was missed at the time. Discussion: https://postgr.es/m/e852442da35b4f31acc600ed98bbee0f12e65e0c.ca...@j-davis.com Reviewed-by: Michael Paquier Backpatch-through: 16 Bra

pgsql: aio: Avoid spurious coverity warning

2025-04-06 Thread Andres Freund
aio: Avoid spurious coverity warning PgAioResult.result is never accessed in the relevant path, but coverity complains about an uninitialized access anyway. So just zero-initialize the whole thing. While at it, reduce the scope of the variable. Reported-by: Ranier Vilela Reviewed-by: Noah Misch

pgsql: Fix memory leaks in px_crypt_shacrypt().

2025-04-06 Thread Tom Lane
Fix memory leaks in px_crypt_shacrypt(). Per Coverity. I don't think these are of any actual significance since the function ought to be invoked in a short-lived context. Still, if it's trying to be neat it should get it right. Also const-ify a constant and fix up typedef formatting. Branch ---

pgsql: Use "(void)" to mark pgstat_lock_entry(..., false) calls.

2025-04-06 Thread Tom Lane
Use "(void)" to mark pgstat_lock_entry(..., false) calls. This should silence Coverity's complaints about the result being sometimes ignored. I'm inclined to think that these routines are simply misdesigned, because sometimes it's okay to ignore the result and sometimes it isn't, and we have no w

pgsql: Avoid unnecessary copying of a string in pg_restore.c

2025-04-06 Thread Andrew Dunstan
Avoid unnecessary copying of a string in pg_restore.c Coverity complained about a possible overrun in the copy, but there is no actual need to copy the string at all. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5e1915439085014140314979c4dd5e23bd677cac Modified

pgsql: Fix a couple of memory leaks in pg_restore.c

2025-04-06 Thread Andrew Dunstan
Fix a couple of memory leaks in pg_restore.c per complaint from Coverity. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/6d5417e634b3841dcc44bdb43f5586bcde33ddb4 Modified Files -- src/bin/pg_dump/pg_restore.c | 4 1 file changed, 4 insertions(+)

pgsql: Relax ordering-related hardcoded btree requirements in planning

2025-04-06 Thread Peter Eisentraut
Relax ordering-related hardcoded btree requirements in planning There were several places in ordering-related planning where a requirement for btree was hardcoded but an amcanorder index could suffice. This fixes that. We just need to do the necessary mapping between strategy numbers and compare

Re: pgsql: Put enable_self_join_elimination into postgresql.conf.sample

2025-04-06 Thread Alexander Korotkov
On Sun, Apr 6, 2025 at 2:10 PM Daniel Gustafsson wrote: > > > On 6 Apr 2025, at 12:27, Alexander Korotkov > > wrote: > > > > Put enable_self_join_elimination into postgresql.conf.sample > > > > fc069a3a6319 implements Self-Join Elimination (SJE) and provides a new > > GUC variable: enable_self_j

pgsql: Revert "Put enable_self_join_elimination into postgresql.conf.sa

2025-04-06 Thread Alexander Korotkov
Revert "Put enable_self_join_elimination into postgresql.conf.sample" This reverts commit c2d329260cd8. Reported-by: Daniel Gustafsson Discussion: https://postgr.es/m/D292EB44-806E-439A-82A4-491A1BA59E7A%40yesql.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3

Re: pgsql: Put enable_self_join_elimination into postgresql.conf.sample

2025-04-06 Thread Daniel Gustafsson
> On 6 Apr 2025, at 12:27, Alexander Korotkov wrote: > > Put enable_self_join_elimination into postgresql.conf.sample > > fc069a3a6319 implements Self-Join Elimination (SJE) and provides a new > GUC variable: enable_self_join_elimination. This commit adds > enable_self_join_elimination to the p

pgsql: Put enable_self_join_elimination into postgresql.conf.sample

2025-04-06 Thread Alexander Korotkov
Put enable_self_join_elimination into postgresql.conf.sample fc069a3a6319 implements Self-Join Elimination (SJE) and provides a new GUC variable: enable_self_join_elimination. This commit adds enable_self_join_elimination to the postgresql.conf.sample, as it was forgotten in the original commit.

pgsql: Compute CRC32C using AVX-512 instructions where available

2025-04-06 Thread John Naylor
Compute CRC32C using AVX-512 instructions where available The previous implementation of CRC32C on x86 relied on the native CRC32 instruction from the SSE 4.2 extension, which operates on up to 8 bytes at a time. We can get a substantial speedup by using carryless multiplication on SIMD registers,