pgsql: Fix comments of GUC hooks for timezone_abbreviations

2024-12-09 Thread Michael Paquier
Fix comments of GUC hooks for timezone_abbreviations The GUC assign and check hooks used "assign_timezone_abbreviations", which was incorrect. Issue noticed while browsing this area of the code, introduced in 0a20ff54f5e6. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/z1ev6y8yk77gz...@pa

pgsql: Fix comments of GUC hooks for timezone_abbreviations

2024-12-09 Thread Michael Paquier
Fix comments of GUC hooks for timezone_abbreviations The GUC assign and check hooks used "assign_timezone_abbreviations", which was incorrect. Issue noticed while browsing this area of the code, introduced in 0a20ff54f5e6. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/z1ev6y8yk77gz...@pa

pgsql: Fix comments of GUC hooks for timezone_abbreviations

2024-12-09 Thread Michael Paquier
Fix comments of GUC hooks for timezone_abbreviations The GUC assign and check hooks used "assign_timezone_abbreviations", which was incorrect. Issue noticed while browsing this area of the code, introduced in 0a20ff54f5e6. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/z1ev6y8yk77gz...@pa

pgsql: Fix outdated comment of scram_build_secret()

2024-12-09 Thread Michael Paquier
Fix outdated comment of scram_build_secret() This routine documented that "iterations" would use a default value if set to 0 by the caller. However, the iteration should always be set by the caller to a value strictly more than 0, as documented by an assertion. Oversight in b577743000cd, that ha

pgsql: Fix outdated comment of scram_build_secret()

2024-12-09 Thread Michael Paquier
Fix outdated comment of scram_build_secret() This routine documented that "iterations" would use a default value if set to 0 by the caller. However, the iteration should always be set by the caller to a value strictly more than 0, as documented by an assertion. Oversight in b577743000cd, that ha

pgsql: Fix outdated comment of scram_build_secret()

2024-12-09 Thread Michael Paquier
Fix outdated comment of scram_build_secret() This routine documented that "iterations" would use a default value if set to 0 by the caller. However, the iteration should always be set by the caller to a value strictly more than 0, as documented by an assertion. Oversight in b577743000cd, that ha

pgsql: Fix unused-but-set-variable compiler warning in reorderbuffer.c.

2024-12-09 Thread Nathan Bossart
Fix unused-but-set-variable compiler warning in reorderbuffer.c. On v13, this variable is only used for an assertion, so adding PG_USED_FOR_ASSERTS_ONLY is sufficient to suppress this warning on builds with assertions disabled. Older versions are unsupported, and newer versions use the variable f

pgsql: Include necessary header files in radixtree.h.

2024-12-09 Thread Masahiko Sawada
Include necessary header files in radixtree.h. When #include'ing radixtree.h with RT_SHMEM, it could happen to raise compiler errors due to missing some declarations of types and functions. This commit also removes the inclusion of postgres.h since it's against our usual convention. Backpatch to

pgsql: Include necessary header files in radixtree.h.

2024-12-09 Thread Masahiko Sawada
Include necessary header files in radixtree.h. When #include'ing radixtree.h with RT_SHMEM, it could happen to raise compiler errors due to missing some declarations of types and functions. This commit also removes the inclusion of postgres.h since it's against our usual convention. Backpatch to

pgsql: Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes

2024-12-09 Thread David Rowley
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom

pgsql: Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes

2024-12-09 Thread David Rowley
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom

pgsql: Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes

2024-12-09 Thread David Rowley
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom

pgsql: Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes

2024-12-09 Thread David Rowley
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom

pgsql: Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes

2024-12-09 Thread David Rowley
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom

pgsql: Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes

2024-12-09 Thread David Rowley
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom

pgsql: Fix small memory leaks in GUC checks

2024-12-09 Thread Daniel Gustafsson
Fix small memory leaks in GUC checks Follow-up commit to a9d58bfe8a3a. Backpatch down to v16 where this was added in order to keep the code consistent for future backpatches. Author: Tofig Aliev Reviewed-by: Daniel Gustafsson Reviewed-by: Masahiko Sawada Discussion: https://postgr.es/m/bba431

pgsql: Fix small memory leaks in GUC checks

2024-12-09 Thread Daniel Gustafsson
Fix small memory leaks in GUC checks Follow-up commit to a9d58bfe8a3a. Backpatch down to v16 where this was added in order to keep the code consistent for future backpatches. Author: Tofig Aliev Reviewed-by: Daniel Gustafsson Reviewed-by: Masahiko Sawada Discussion: https://postgr.es/m/bba431

pgsql: Fix small memory leaks in GUC checks

2024-12-09 Thread Daniel Gustafsson
Fix small memory leaks in GUC checks Follow-up commit to a9d58bfe8a3a. Backpatch down to v16 where this was added in order to keep the code consistent for future backpatches. Author: Tofig Aliev Reviewed-by: Daniel Gustafsson Reviewed-by: Masahiko Sawada Discussion: https://postgr.es/m/bba431

pgsql: Fix various overflow hazards in date and timestamp functions.

2024-12-09 Thread Nathan Bossart
Fix various overflow hazards in date and timestamp functions. This commit makes use of the overflow-aware routines in int.h to fix a variety of reported overflow bugs in the date and timestamp code. It seems unlikely that this fixes all such bugs in this area, but since the problems seem limited

pgsql: Simplify executor's determination of whether to use parallelism.

2024-12-09 Thread Tom Lane
Simplify executor's determination of whether to use parallelism. Our parallel-mode code only works when we are executing a query in full, so ExecutePlan must disable parallel mode when it is asked to do partial execution. The previous logic for this involved passing down a flag (variously named e

pgsql: Simplify executor's determination of whether to use parallelism.

2024-12-09 Thread Tom Lane
Simplify executor's determination of whether to use parallelism. Our parallel-mode code only works when we are executing a query in full, so ExecutePlan must disable parallel mode when it is asked to do partial execution. The previous logic for this involved passing down a flag (variously named e

pgsql: Simplify executor's determination of whether to use parallelism.

2024-12-09 Thread Tom Lane
Simplify executor's determination of whether to use parallelism. Our parallel-mode code only works when we are executing a query in full, so ExecutePlan must disable parallel mode when it is asked to do partial execution. The previous logic for this involved passing down a flag (variously named e

pgsql: Simplify executor's determination of whether to use parallelism.

2024-12-09 Thread Tom Lane
Simplify executor's determination of whether to use parallelism. Our parallel-mode code only works when we are executing a query in full, so ExecutePlan must disable parallel mode when it is asked to do partial execution. The previous logic for this involved passing down a flag (variously named e

pgsql: Simplify executor's determination of whether to use parallelism.

2024-12-09 Thread Tom Lane
Simplify executor's determination of whether to use parallelism. Our parallel-mode code only works when we are executing a query in full, so ExecutePlan must disable parallel mode when it is asked to do partial execution. The previous logic for this involved passing down a flag (variously named e

pgsql: Simplify executor's determination of whether to use parallelism.

2024-12-09 Thread Tom Lane
Simplify executor's determination of whether to use parallelism. Our parallel-mode code only works when we are executing a query in full, so ExecutePlan must disable parallel mode when it is asked to do partial execution. The previous logic for this involved passing down a flag (variously named e

pgsql: Remove remants of "snapshot too old"

2024-12-09 Thread Heikki Linnakangas
Remove remants of "snapshot too old" Remove the 'whenTaken' and 'lsn' fields from SnapshotData. After the removal of the "snapshot too old" feature, they were never set to a non-zero value. This largely reverts commit 3e2f3c2e423, which added the OldestActiveSnapshot tracking, and the init_toast_

pgsql: Avoid unnecessary wrapping for Vars and PHVs

2024-12-09 Thread Richard Guo
Avoid unnecessary wrapping for Vars and PHVs When pulling up a lateral subquery that is under an outer join, the current code always wraps a Var or PHV in the subquery's targetlist into a new PlaceHolderVar if it is a lateral reference to something outside the subquery. This is necessary when the

pgsql: Fix right-semi-joins in HashJoin rescans

2024-12-09 Thread Richard Guo
Fix right-semi-joins in HashJoin rescans When resetting a HashJoin node for rescans, if it is a single-batch join and there are no parameter changes for the inner subnode, we can just reuse the existing hash table without rebuilding it. However, for join types that depend on the inner-tuple match

pgsql: Fix possible crash during WindowAgg evaluation

2024-12-09 Thread David Rowley
Fix possible crash during WindowAgg evaluation When short-circuiting WindowAgg node evaluation on the top-level WindowAgg node using quals on monotonic window functions, because the WindowAgg run condition can mean there's no need to evaluate subsequent window function results in the same partitio

pgsql: Improve the error message introduced in commit 87ce27de696.

2024-12-09 Thread Amit Kapila
Improve the error message introduced in commit 87ce27de696. The error detail message "Replica identity consists of an unpublished generated column." implies that the entire replica identity is made up of an unpublished generated column which may not be the case. Reported-by: Peter Smith Author: S

pgsql: Fix possible crash during WindowAgg evaluation

2024-12-09 Thread David Rowley
Fix possible crash during WindowAgg evaluation When short-circuiting WindowAgg node evaluation on the top-level WindowAgg node using quals on monotonic window functions, because the WindowAgg run condition can mean there's no need to evaluate subsequent window function results in the same partitio

pgsql: Fix possible crash during WindowAgg evaluation

2024-12-09 Thread David Rowley
Fix possible crash during WindowAgg evaluation When short-circuiting WindowAgg node evaluation on the top-level WindowAgg node using quals on monotonic window functions, because the WindowAgg run condition can mean there's no need to evaluate subsequent window function results in the same partitio

pgsql: Fix possible crash during WindowAgg evaluation

2024-12-09 Thread David Rowley
Fix possible crash during WindowAgg evaluation When short-circuiting WindowAgg node evaluation on the top-level WindowAgg node using quals on monotonic window functions, because the WindowAgg run condition can mean there's no need to evaluate subsequent window function results in the same partitio

pgsql: Fix invalidation of local pgstats references for entry reinitial

2024-12-09 Thread Michael Paquier
Fix invalidation of local pgstats references for entry reinitialization 818119afccd3 has introduced the "generation" concept in pgstats entries, incremented a counter when a pgstats entry is reinitialized, but it did not count on the fact that backends still holding local references to such entrie

pgsql: Improve comment about dropped entries in pgstat.c

2024-12-09 Thread Michael Paquier
Improve comment about dropped entries in pgstat.c pgstat_write_statsfile() discards any entries marked as dropped from being written to the stats file at shutdown, and also included an assertion based on the same condition. The intention of the assertion is to track that no pgstats entries should

pgsql: Improve comment about dropped entries in pgstat.c

2024-12-09 Thread Michael Paquier
Improve comment about dropped entries in pgstat.c pgstat_write_statsfile() discards any entries marked as dropped from being written to the stats file at shutdown, and also included an assertion based on the same condition. The intention of the assertion is to track that no pgstats entries should

pgsql: Fix invalidation of local pgstats references for entry reinitial

2024-12-09 Thread Michael Paquier
Fix invalidation of local pgstats references for entry reinitialization 818119afccd3 has introduced the "generation" concept in pgstats entries, incremented a counter when a pgstats entry is reinitialized, but it did not count on the fact that backends still holding local references to such entrie

pgsql: Fix invalidation of local pgstats references for entry reinitial

2024-12-09 Thread Michael Paquier
Fix invalidation of local pgstats references for entry reinitialization 818119afccd3 has introduced the "generation" concept in pgstats entries, incremented a counter when a pgstats entry is reinitialized, but it did not count on the fact that backends still holding local references to such entrie

pgsql: Improve comment about dropped entries in pgstat.c

2024-12-09 Thread Michael Paquier
Improve comment about dropped entries in pgstat.c pgstat_write_statsfile() discards any entries marked as dropped from being written to the stats file at shutdown, and also included an assertion based on the same condition. The intention of the assertion is to track that no pgstats entries should

pgsql: Fix invalidation of local pgstats references for entry reinitial

2024-12-09 Thread Michael Paquier
Fix invalidation of local pgstats references for entry reinitialization 818119afccd3 has introduced the "generation" concept in pgstats entries, incremented a counter when a pgstats entry is reinitialized, but it did not count on the fact that backends still holding local references to such entrie

pgsql: Improve comment about dropped entries in pgstat.c

2024-12-09 Thread Michael Paquier
Improve comment about dropped entries in pgstat.c pgstat_write_statsfile() discards any entries marked as dropped from being written to the stats file at shutdown, and also included an assertion based on the same condition. The intention of the assertion is to track that no pgstats entries should

pgsql: Fix memory leak in pgoutput with publication list cache

2024-12-09 Thread Michael Paquier
Fix memory leak in pgoutput with publication list cache The pgoutput module caches publication names in a list and frees it upon invalidation. However, the code forgot to free the actual publication names within the list elements, as publication names are pstrdup()'d in GetPublication(). This wo