pgsql: Document some structures in attribute_stats.c

2025-11-05 Thread Michael Paquier
Document some structures in attribute_stats.c Like relation_stats.c, these structures are used to track the argument number, names and types of pg_restore_attribute_stats() and pg_clear_attribute_stats(). Extracted from a larger patch by the same author, reworded by me for consistency with relati

pgsql: Fix spurious output in configure

2025-11-05 Thread Peter Eisentraut
Fix spurious output in configure If sizeof off_t is 4, then configure will print a line saying just "0" after the test. This is the output of the following "expr" command. If we are using expr just for the exit code, the output should be sent to /dev/null, as is done elsewhere. Branch -- mas

pgsql: MSVC: Improve warning options set

2025-11-05 Thread Peter Eisentraut
MSVC: Improve warning options set The previous code had a set of warnings to disable on MSVC. But some of these weren't actually enabled by default anyway, only in higher MSVC warning levels (/W, maps to meson warning_level). I rearranged this so that it is clearer in what MSVC warning level a w

pgsql: Re-run autoconf

2025-11-05 Thread Peter Eisentraut
Re-run autoconf Some of the last-minute changes in commit f0f2c0c1aef were apparently not captured. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4b6fa00a3a91714ed19fed667abdcb569f77 Modified Files -- configure | 4 ++-- 1 file changed, 2 insertion

pgsql: Re-run autoheader

2025-11-05 Thread Peter Eisentraut
Re-run autoheader Some of the changes in pg_config.h.in from commit 3853a6956c3 didn't match the order that a fresh run would produce. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/01a985c3c4fb138ac2753e1210eed084e6bd181f Modified Files -- src/include

pgsql: Update code comment

2025-11-05 Thread Peter Eisentraut
Update code comment Should have been part of commit a13833c35f9. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/05b9edcb7140101e91f7cf17c0c7d463bb41c401 Modified Files -- src/backend/utils/misc/guc_tables.c | 8 1 file changed, 4 insertions(+),

pgsql: Fix UNION planner estimate_num_groups with varno==0

2025-11-05 Thread David Rowley
Fix UNION planner estimate_num_groups with varno==0 03d40e4b5 added code to provide better row estimates for when a UNION query ended up only with a single child due to other children being found to be dummy rels. In that case, ordinarily it would be ok to call estimate_num_groups() on the target

pgsql: Update obsolete comment in ExecScanReScan().

2025-11-05 Thread Etsuro Fujita
Update obsolete comment in ExecScanReScan(). Commit 27cc7cd2b removed the epqScanDone flag from the EState struct, and instead added an equivalent flag named relsubs_done to the EPQState struct; but it failed to update this comment. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK15

pgsql: Update obsolete comment in ExecScanReScan().

2025-11-05 Thread Etsuro Fujita
Update obsolete comment in ExecScanReScan(). Commit 27cc7cd2b removed the epqScanDone flag from the EState struct, and instead added an equivalent flag named relsubs_done to the EPQState struct; but it failed to update this comment. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK15

pgsql: Update obsolete comment in ExecScanReScan().

2025-11-05 Thread Etsuro Fujita
Update obsolete comment in ExecScanReScan(). Commit 27cc7cd2b removed the epqScanDone flag from the EState struct, and instead added an equivalent flag named relsubs_done to the EPQState struct; but it failed to update this comment. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK15

pgsql: Update obsolete comment in ExecScanReScan().

2025-11-05 Thread Etsuro Fujita
Update obsolete comment in ExecScanReScan(). Commit 27cc7cd2b removed the epqScanDone flag from the EState struct, and instead added an equivalent flag named relsubs_done to the EPQState struct; but it failed to update this comment. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK15

pgsql: Update obsolete comment in ExecScanReScan().

2025-11-05 Thread Etsuro Fujita
Update obsolete comment in ExecScanReScan(). Commit 27cc7cd2b removed the epqScanDone flag from the EState struct, and instead added an equivalent flag named relsubs_done to the EPQState struct; but it failed to update this comment. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK15

pgsql: Update obsolete comment in ExecScanReScan().

2025-11-05 Thread Etsuro Fujita
Update obsolete comment in ExecScanReScan(). Commit 27cc7cd2b removed the epqScanDone flag from the EState struct, and instead added an equivalent flag named relsubs_done to the EPQState struct; but it failed to update this comment. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK15

pgsql: Update obsolete comment in ExecScanReScan().

2025-11-05 Thread Etsuro Fujita
Update obsolete comment in ExecScanReScan(). Commit 27cc7cd2b removed the epqScanDone flag from the EState struct, and instead added an equivalent flag named relsubs_done to the EPQState struct; but it failed to update this comment. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK15

pgsql: postgres_fdw: Add more test coverage for EvalPlanQual testing.

2025-11-05 Thread Etsuro Fujita
postgres_fdw: Add more test coverage for EvalPlanQual testing. postgres_fdw supports EvalPlanQual testing by using the infrastructure provided by the core with the RecheckForeignScan callback routine (cf. commits 5fc4c26db and 385f337c9), but there has been no test coverage for that, except that r

pgsql: postgres_fdw: Add more test coverage for EvalPlanQual testing.

2025-11-05 Thread Etsuro Fujita
postgres_fdw: Add more test coverage for EvalPlanQual testing. postgres_fdw supports EvalPlanQual testing by using the infrastructure provided by the core with the RecheckForeignScan callback routine (cf. commits 5fc4c26db and 385f337c9), but there has been no test coverage for that, except that r

pgsql: postgres_fdw: Add more test coverage for EvalPlanQual testing.

2025-11-05 Thread Etsuro Fujita
postgres_fdw: Add more test coverage for EvalPlanQual testing. postgres_fdw supports EvalPlanQual testing by using the infrastructure provided by the core with the RecheckForeignScan callback routine (cf. commits 5fc4c26db and 385f337c9), but there has been no test coverage for that, except that r

pgsql: postgres_fdw: Add more test coverage for EvalPlanQual testing.

2025-11-05 Thread Etsuro Fujita
postgres_fdw: Add more test coverage for EvalPlanQual testing. postgres_fdw supports EvalPlanQual testing by using the infrastructure provided by the core with the RecheckForeignScan callback routine (cf. commits 5fc4c26db and 385f337c9), but there has been no test coverage for that, except that r

pgsql: postgres_fdw: Add more test coverage for EvalPlanQual testing.

2025-11-05 Thread Etsuro Fujita
postgres_fdw: Add more test coverage for EvalPlanQual testing. postgres_fdw supports EvalPlanQual testing by using the infrastructure provided by the core with the RecheckForeignScan callback routine (cf. commits 5fc4c26db and 385f337c9), but there has been no test coverage for that, except that r

pgsql: postgres_fdw: Add more test coverage for EvalPlanQual testing.

2025-11-05 Thread Etsuro Fujita
postgres_fdw: Add more test coverage for EvalPlanQual testing. postgres_fdw supports EvalPlanQual testing by using the infrastructure provided by the core with the RecheckForeignScan callback routine (cf. commits 5fc4c26db and 385f337c9), but there has been no test coverage for that, except that r

pgsql: postgres_fdw: Add more test coverage for EvalPlanQual testing.

2025-11-05 Thread Etsuro Fujita
postgres_fdw: Add more test coverage for EvalPlanQual testing. postgres_fdw supports EvalPlanQual testing by using the infrastructure provided by the core with the RecheckForeignScan callback routine (cf. commits 5fc4c26db and 385f337c9), but there has been no test coverage for that, except that r

pgsql: Doc: use uppercase keywords in SQLs

2025-11-05 Thread David Rowley
Doc: use uppercase keywords in SQLs Use uppercase SQL keywords consistently throughout the documentation to ease reading. Also add whitespace in a couple of places where it improves readability. Author: Erik Wienhold Reviewed-by: David Rowley Discussion: https://postgr.es/m/82eb512b-8ed2-46be-

pgsql: Use stack allocated StringInfoDatas, where possible

2025-11-05 Thread David Rowley
Use stack allocated StringInfoDatas, where possible Various places that were using StringInfo but didn't need that StringInfo to exist beyond the scope of the function were using makeStringInfo(), which allocates both a StringInfoData and the buffer it uses as two separate allocations. It's more

pgsql: ci: Add missing "set -e" to scripts run by su.

2025-11-05 Thread Thomas Munro
ci: Add missing "set -e" to scripts run by su. If any shell command fails, the whole script should fail. To avoid future omissions, add this even for single-command scripts that use su with heredoc syntax, as they might be extended or copied-and-pasted. Extracted from a larger patch that wanted

pgsql: ci: Add missing "set -e" to scripts run by su.

2025-11-05 Thread Thomas Munro
ci: Add missing "set -e" to scripts run by su. If any shell command fails, the whole script should fail. To avoid future omissions, add this even for single-command scripts that use su with heredoc syntax, as they might be extended or copied-and-pasted. Extracted from a larger patch that wanted

pgsql: ci: Add missing "set -e" to scripts run by su.

2025-11-05 Thread Thomas Munro
ci: Add missing "set -e" to scripts run by su. If any shell command fails, the whole script should fail. To avoid future omissions, add this even for single-command scripts that use su with heredoc syntax, as they might be extended or copied-and-pasted. Extracted from a larger patch that wanted

pgsql: ci: Add missing "set -e" to scripts run by su.

2025-11-05 Thread Thomas Munro
ci: Add missing "set -e" to scripts run by su. If any shell command fails, the whole script should fail. To avoid future omissions, add this even for single-command scripts that use su with heredoc syntax, as they might be extended or copied-and-pasted. Extracted from a larger patch that wanted

pgsql: ci: Add missing "set -e" to scripts run by su.

2025-11-05 Thread Thomas Munro
ci: Add missing "set -e" to scripts run by su. If any shell command fails, the whole script should fail. To avoid future omissions, add this even for single-command scripts that use su with heredoc syntax, as they might be extended or copied-and-pasted. Extracted from a larger patch that wanted

pgsql: Avoid possible crash within libsanitizer.

2025-11-05 Thread Tom Lane
Avoid possible crash within libsanitizer. We've successfully used libsanitizer for awhile with the undefined and alignment sanitizers, but with some other sanitizers (at least thread and hwaddress) it crashes due to internal recursion before it's fully initialized itself. It turns out that that's

pgsql: Avoid possible crash within libsanitizer.

2025-11-05 Thread Tom Lane
Avoid possible crash within libsanitizer. We've successfully used libsanitizer for awhile with the undefined and alignment sanitizers, but with some other sanitizers (at least thread and hwaddress) it crashes due to internal recursion before it's fully initialized itself. It turns out that that's

pgsql: Avoid possible crash within libsanitizer.

2025-11-05 Thread Tom Lane
Avoid possible crash within libsanitizer. We've successfully used libsanitizer for awhile with the undefined and alignment sanitizers, but with some other sanitizers (at least thread and hwaddress) it crashes due to internal recursion before it's fully initialized itself. It turns out that that's

pgsql: Avoid possible crash within libsanitizer.

2025-11-05 Thread Tom Lane
Avoid possible crash within libsanitizer. We've successfully used libsanitizer for awhile with the undefined and alignment sanitizers, but with some other sanitizers (at least thread and hwaddress) it crashes due to internal recursion before it's fully initialized itself. It turns out that that's

pgsql: doc: Add section for temporal tables

2025-11-05 Thread Peter Eisentraut
doc: Add section for temporal tables This section introduces temporal tables, with a focus on Application Time (which we support) and only a brief mention of System Time (which we don't). It covers temporal primary keys, unique constraints, and temporal foreign keys. We will document temporal up

pgsql: Implement WAIT FOR command

2025-11-05 Thread Alexander Korotkov
Implement WAIT FOR command WAIT FOR is to be used on standby and specifies waiting for the specific WAL location to be replayed. This option is useful when the user makes some data changes on primary and needs a guarantee to see these changes are on standby. WAIT FOR needs to wait without any sn

pgsql: Add pairingheap_initialize() for shared memory usage

2025-11-05 Thread Alexander Korotkov
Add pairingheap_initialize() for shared memory usage The existing pairingheap_allocate() uses palloc(), which allocates from process-local memory. For shared memory use cases, the pairingheap structure must be allocated via ShmemAlloc() or embedded in a shared memory struct. Add pairingheap_initia

pgsql: Add infrastructure for efficient LSN waiting

2025-11-05 Thread Alexander Korotkov
Add infrastructure for efficient LSN waiting Implement a new facility that allows processes to wait for WAL to reach specific LSNs, both on primary (waiting for flush) and standby (waiting for replay) servers. The implementation uses shared memory with per-backend information organized into pairi

pgsql: Fix assertion failure in generate_orderedappend_paths()

2025-11-05 Thread Richard Guo
Fix assertion failure in generate_orderedappend_paths() In generate_orderedappend_paths(), there is an assumption that a child relation's row estimate is always greater than zero. There is an Assert verifying this assumption, and the estimate is also used to convert an absolute tuple count into a

pgsql: Avoid creating duplicate ordered append paths

2025-11-05 Thread Richard Guo
Avoid creating duplicate ordered append paths In generate_orderedappend_paths(), the function does not handle the case where the paths in total_subpaths and fractional_subpaths are identical. This situation is not uncommon, and as a result, it may generate two exactly identical ordered append pat

pgsql: Fix assertion failure in generate_orderedappend_paths()

2025-11-05 Thread Richard Guo
Fix assertion failure in generate_orderedappend_paths() In generate_orderedappend_paths(), there is an assumption that a child relation's row estimate is always greater than zero. There is an Assert verifying this assumption, and the estimate is also used to convert an absolute tuple count into a