pgsql: Include schema/table publications even with exclude options in d

2025-02-19 Thread Amit Kapila
Include schema/table publications even with exclude options in dump. The current implementation inconsistently includes public schema but not information_schema when those are specified in FOR TABLES IN SCHMEA ... Apart from that, the current behavior for publications w.r.t exclude table and schem

pgsql: doc: Fix typo in section "WAL configuration"

2025-02-19 Thread Michael Paquier
doc: Fix typo in section "WAL configuration" pg_stat_io has an attribute named fsync_time, not sync_time. Oversight in 2f70871c2bc1. Discussion: https://postgr.es/m/Z7RkQ0EfYaqqjgz/@ip-10-97-1-34.eu-west-3.compute.internal Branch -- master Details --- https://git.postgresql.org/pg/com

pgsql: doc: Add details about object "wal" in pg_stat_io

2025-02-19 Thread Michael Paquier
doc: Add details about object "wal" in pg_stat_io This commit adds a short description of what kind of activity is tracked in pg_stat_io for the object "wal", with a link pointing to the section "WAL configuration" that has a lot of details on the matter. This should perhaps have been added in a0

pgsql: doc: Recommend pg_stat_io rather than pg_stat_wal in WAL configu

2025-02-19 Thread Michael Paquier
doc: Recommend pg_stat_io rather than pg_stat_wal in WAL configuration Since a051e71e28a1, pg_stat_io is able to track statistics for the WAL activity, providing an equivalent of pg_stat_wal with more granularity for the fsyncs/writes counts and timings, as the data is split across backend types.

Re: pgsql: doc: Fix some issues with JSON_TABLE() exampls

2025-02-19 Thread Amit Langote
On Wed, Feb 19, 2025 at 3:33 PM Amit Langote wrote: > doc: Fix some issues with JSON_TABLE() exampls > > 1. Remove an unused PASSING variable. > > 2. Adjust formatting of JSON data used in an example to be valid > under strict mode > > Reported-by: Miłosz Chmura > Author: Robert Treat > Di

pgsql: Fix FATAL message for invalid recovery timeline at beginning of

2025-02-19 Thread Michael Paquier
Fix FATAL message for invalid recovery timeline at beginning of recovery If the requested recovery timeline is not reachable, the logged checkpoint and timeline should to be the values read from the backup_label when it is defined. The message generated used the values from the control file in th

pgsql: Fix FATAL message for invalid recovery timeline at beginning of

2025-02-19 Thread Michael Paquier
Fix FATAL message for invalid recovery timeline at beginning of recovery If the requested recovery timeline is not reachable, the logged checkpoint and timeline should to be the values read from the backup_label when it is defined. The message generated used the values from the control file in th

pgsql: Fix FATAL message for invalid recovery timeline at beginning of

2025-02-19 Thread Michael Paquier
Fix FATAL message for invalid recovery timeline at beginning of recovery If the requested recovery timeline is not reachable, the logged checkpoint and timeline should to be the values read from the backup_label when it is defined. The message generated used the values from the control file in th

pgsql: Fix FATAL message for invalid recovery timeline at beginning of

2025-02-19 Thread Michael Paquier
Fix FATAL message for invalid recovery timeline at beginning of recovery If the requested recovery timeline is not reachable, the logged checkpoint and timeline should to be the values read from the backup_label when it is defined. The message generated used the values from the control file in th

pgsql: test_escape: Fix output of --help

2025-02-19 Thread Michael Paquier
test_escape: Fix output of --help The short option name -f was not listed, only its long option name --force-unsupported. Author: Japin Li Discussion: https://postgr.es/m/me0p300mb04452bd1fb1b277d4c1c20b9b6...@me0p300mb0445.ausp300.prod.outlook.com Backpatch-through: 13 Branch -- REL_13_STA

pgsql: test_escape: Fix output of --help

2025-02-19 Thread Michael Paquier
test_escape: Fix output of --help The short option name -f was not listed, only its long option name --force-unsupported. Author: Japin Li Discussion: https://postgr.es/m/me0p300mb04452bd1fb1b277d4c1c20b9b6...@me0p300mb0445.ausp300.prod.outlook.com Backpatch-through: 13 Branch -- REL_17_STA

pgsql: test_escape: Fix output of --help

2025-02-19 Thread Michael Paquier
test_escape: Fix output of --help The short option name -f was not listed, only its long option name --force-unsupported. Author: Japin Li Discussion: https://postgr.es/m/me0p300mb04452bd1fb1b277d4c1c20b9b6...@me0p300mb0445.ausp300.prod.outlook.com Backpatch-through: 13 Branch -- REL_15_STA

pgsql: test_escape: Fix output of --help

2025-02-19 Thread Michael Paquier
test_escape: Fix output of --help The short option name -f was not listed, only its long option name --force-unsupported. Author: Japin Li Discussion: https://postgr.es/m/me0p300mb04452bd1fb1b277d4c1c20b9b6...@me0p300mb0445.ausp300.prod.outlook.com Backpatch-through: 13 Branch -- REL_14_STA

pgsql: pgbench: Increase RLIMIT_NOFILE if necessary

2025-02-19 Thread Andres Freund
pgbench: Increase RLIMIT_NOFILE if necessary pgbench already had code to check if the soft rlimit is too low for the specified number of connections. If too low, it errored out, telling the user to increase the limit. However, we can do better: If the hard limit allows, increase the soft limit to

pgsql: test_escape: Fix output of --help

2025-02-19 Thread Michael Paquier
test_escape: Fix output of --help The short option name -f was not listed, only its long option name --force-unsupported. Author: Japin Li Discussion: https://postgr.es/m/me0p300mb04452bd1fb1b277d4c1c20b9b6...@me0p300mb0445.ausp300.prod.outlook.com Backpatch-through: 13 Branch -- REL_16_STA

pgsql: test_escape: Fix output of --help

2025-02-19 Thread Michael Paquier
test_escape: Fix output of --help The short option name -f was not listed, only its long option name --force-unsupported. Author: Japin Li Discussion: https://postgr.es/m/me0p300mb04452bd1fb1b277d4c1c20b9b6...@me0p300mb0445.ausp300.prod.outlook.com Backpatch-through: 13 Branch -- master De

pgsql: Correct relation size estimate with low fillfactor

2025-02-19 Thread Tomas Vondra
Correct relation size estimate with low fillfactor Since commit 29cf61ade3, table_block_relation_estimate_size() considers fillfactor when estimating number of rows in a relation before the first ANALYZE. The formula however did not consider tuples may be larger than available space determined by

pgsql: Correct relation size estimate with low fillfactor

2025-02-19 Thread Tomas Vondra
Correct relation size estimate with low fillfactor Since commit 29cf61ade3, table_block_relation_estimate_size() considers fillfactor when estimating number of rows in a relation before the first ANALYZE. The formula however did not consider tuples may be larger than available space determined by

pgsql: Fix crash in brininsertcleanup during logical replication.

2025-02-19 Thread Tom Lane
Fix crash in brininsertcleanup during logical replication. Logical replication crashes if the subscriber's partitioned table has a BRIN index. There are two independently blamable causes, and this patch fixes both: 1. brininsertcleanup fails if called twice for the same IndexInfo, because it hal

pgsql: Assert that ExecOpenIndices and ExecCloseIndices are not repeate

2025-02-19 Thread Tom Lane
Assert that ExecOpenIndices and ExecCloseIndices are not repeated. These functions should be called at most once per ResultRelInfo; it's wasteful to do otherwise, and certainly the pattern of opening twice and then closing twice is a bad idea. Moreover, aminsertcleanup functions might not be prep

pgsql: Fix crash in brininsertcleanup during logical replication.

2025-02-19 Thread Tom Lane
Fix crash in brininsertcleanup during logical replication. Logical replication crashes if the subscriber's partitioned table has a BRIN index. There are two independently blamable causes, and this patch fixes both: 1. brininsertcleanup fails if called twice for the same IndexInfo, because it hal

pgsql: Consider BufFiles when adjusting hashjoin parameters

2025-02-19 Thread Tomas Vondra
Consider BufFiles when adjusting hashjoin parameters Until now ExecChooseHashTableSize() considered only the size of the in-memory hash table, and ignored the memory needed for the batch files. Which can be a significant amount, because each batch needs two BufFiles (each with a BLCKSZ buffer). Th

pgsql: backport: Extend background_psql() to be able to start asynchron

2025-02-19 Thread Andres Freund
backport: Extend background_psql() to be able to start asynchronously This is a backport of ba08edb0654. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql, which would be somewhat harder with the behavioural differences across branches. It's a

pgsql: tests: BackgroundPsql: Fix potential for lost errors on windows

2025-02-19 Thread Andres Freund
tests: BackgroundPsql: Fix potential for lost errors on windows This addresses various corner cases in BackgroundPsql: - On windows stdout and stderr may arrive out of order, leading to errors not being reported, or attributed to the wrong statement. To fix, emit the "query-separation banner

pgsql: tests: BackgroundPsql: Fix potential for lost errors on windows

2025-02-19 Thread Andres Freund
tests: BackgroundPsql: Fix potential for lost errors on windows This addresses various corner cases in BackgroundPsql: - On windows stdout and stderr may arrive out of order, leading to errors not being reported, or attributed to the wrong statement. To fix, emit the "query-separation banner

pgsql: tests: BackgroundPsql: Fix potential for lost errors on windows

2025-02-19 Thread Andres Freund
tests: BackgroundPsql: Fix potential for lost errors on windows This addresses various corner cases in BackgroundPsql: - On windows stdout and stderr may arrive out of order, leading to errors not being reported, or attributed to the wrong statement. To fix, emit the "query-separation banner

pgsql: tests: BackgroundPsql: Fix potential for lost errors on windows

2025-02-19 Thread Andres Freund
tests: BackgroundPsql: Fix potential for lost errors on windows This addresses various corner cases in BackgroundPsql: - On windows stdout and stderr may arrive out of order, leading to errors not being reported, or attributed to the wrong statement. To fix, emit the "query-separation banner

pgsql: tests: BackgroundPsql: Fix potential for lost errors on windows

2025-02-19 Thread Andres Freund
tests: BackgroundPsql: Fix potential for lost errors on windows This addresses various corner cases in BackgroundPsql: - On windows stdout and stderr may arrive out of order, leading to errors not being reported, or attributed to the wrong statement. To fix, emit the "query-separation banner

pgsql: tests: BackgroundPsql: Fix potential for lost errors on windows

2025-02-19 Thread Andres Freund
tests: BackgroundPsql: Fix potential for lost errors on windows This addresses various corner cases in BackgroundPsql: - On windows stdout and stderr may arrive out of order, leading to errors not being reported, or attributed to the wrong statement. To fix, emit the "query-separation banner

pgsql: backport: Extend background_psql() to be able to start asynchron

2025-02-19 Thread Andres Freund
backport: Extend background_psql() to be able to start asynchronously This is a backport of ba08edb0654. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql, which would be somewhat harder with the behavioural differences across branches. It's a

pgsql: backport: Improve handling of empty query results in BackgroundP

2025-02-19 Thread Andres Freund
backport: Improve handling of empty query results in BackgroundPsql This is a backport of 70291a3c66e. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql that are harder to fix in the backbranches with the old behavior. It's also generally good

pgsql: backport: Improve handling of empty query results in BackgroundP

2025-02-19 Thread Andres Freund
backport: Improve handling of empty query results in BackgroundPsql This is a backport of 70291a3c66e. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql that are harder to fix in the backbranches with the old behavior. It's also generally good

pgsql: backport: Improve handling of empty query results in BackgroundP

2025-02-19 Thread Andres Freund
backport: Improve handling of empty query results in BackgroundPsql This is a backport of 70291a3c66e. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql that are harder to fix in the backbranches with the old behavior. It's also generally good

pgsql: backport: Improve handling of empty query results in BackgroundP

2025-02-19 Thread Andres Freund
backport: Improve handling of empty query results in BackgroundPsql This is a backport of 70291a3c66e. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql that are harder to fix in the backbranches with the old behavior. It's also generally good

pgsql: backport: Extend background_psql() to be able to start asynchron

2025-02-19 Thread Andres Freund
backport: Extend background_psql() to be able to start asynchronously This is a backport of ba08edb0654. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql, which would be somewhat harder with the behavioural differences across branches. It's a

pgsql: backport: Extend background_psql() to be able to start asynchron

2025-02-19 Thread Andres Freund
backport: Extend background_psql() to be able to start asynchronously This is a backport of ba08edb0654. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql, which would be somewhat harder with the behavioural differences across branches. It's a

pgsql: backport: Improve handling of empty query results in BackgroundP

2025-02-19 Thread Andres Freund
backport: Improve handling of empty query results in BackgroundPsql This is a backport of 70291a3c66e. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql that are harder to fix in the backbranches with the old behavior. It's also generally good

pgsql: backport: Extend background_psql() to be able to start asynchron

2025-02-19 Thread Andres Freund
backport: Extend background_psql() to be able to start asynchronously This is a backport of ba08edb0654. Originally it was only applied to master, but I (Andres) am planning to fix a few bugs in BackgroundPsql, which would be somewhat harder with the behavioural differences across branches. It's a

pgsql: Add ATAlterConstraint struct for ALTER .. CONSTRAINT

2025-02-19 Thread Álvaro Herrera
Add ATAlterConstraint struct for ALTER .. CONSTRAINT Replace the use of Constraint with a new ATAlterConstraint struct, which allows us to pass additional information. No functionality is added by this commit. This is necessary for future work that allows altering constraints in other ways. I (

pgsql: Improve statistics estimation for single-column GROUP BY in sub-

2025-02-19 Thread Alexander Korotkov
Improve statistics estimation for single-column GROUP BY in sub-queries This commit follows the idea of the 4767bc8ff2. If sub-query has only one GROUP BY column, we can consider its output variable as being unique. We can employ this fact in the statistics to make more precise estimations in the

pgsql: Add a test for commit ac0e33136a using the injection point.

2025-02-19 Thread Amit Kapila
Add a test for commit ac0e33136a using the injection point. This test uses an injection point to bypass the time overhead caused by the idle_replication_slot_timeout GUC, which has a minimum value of one minute. Author: Hayato Kuroda Author: Nisha Moond Reviewed-by: Peter Smith Reviewed-by: Vi