pgsql: Use relation name instead of OID in query jumbling for RangeTblE

2025-03-25 Thread Michael Paquier
Use relation name instead of OID in query jumbling for RangeTblEntry custom_query_jumble (introduced in 5ac462e2b7ac as a node field attribute) is now assigned to the expanded reference name "eref" of RangeTblEntry, adding in the query jumble computation the non-qualified aliased relation name, wi

pgsql: postgres_fdw: Fix tests on some Windows variants

2025-03-25 Thread Peter Eisentraut
postgres_fdw: Fix tests on some Windows variants The tests introduced by commit 76563f88cfb only work when Unix-domain sockets are available. This is optional on Windows, and buildfarm member drongo runs without them. To fix, skip the test if Unix-domain sockets are not enabled. Branch -- m

pgsql: pg_upgrade: Add --swap for faster file transfer.

2025-03-25 Thread Nathan Bossart
pg_upgrade: Add --swap for faster file transfer. This new option instructs pg_upgrade to move the data directories from the old cluster to the new cluster and then to replace the catalog files with those generated for the new cluster. This mode can outperform --link, --clone, --copy, and --copy-f

pgsql: Fix two issues with custom_query_jumble in gen_node_support.pl

2025-03-25 Thread Michael Paquier
Fix two issues with custom_query_jumble in gen_node_support.pl A node field marked with custom_query_jumble and query_jumble_ignore would generate some code of a custom routine. The script is changed so as custom_query_jumble behaves like the other options in this case, query_jumble_ignore taking

Re: pgsql: postgres_fdw: improve security checks

2025-03-25 Thread Tom Lane
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 changed to not run by default. We c

pgsql: Add pg_dump --with-{schema|data|statistics} options.

2025-03-25 Thread Jeff Davis
Add pg_dump --with-{schema|data|statistics} options. By adding the positive variants of options, in addition to the negative variants that already exist, users can be explicit about what pg_dump should produce. Discussion: https://postgr.es/m/bd0513e4b1ea2b2f2d06f02720c6579711cb62a6.ca...@j-davi

pgsql: Support buffer forwarding in StartReadBuffers().

2025-03-25 Thread Thomas Munro
Support buffer forwarding in StartReadBuffers(). StartReadBuffers() reports a short read when it finds a cached block that ends a range needing I/O by updating the caller's *nblocks. It doesn't want to have to unpin the trailing hit that it knows the caller wants, so the v17 version used sleight

pgsql: Fix order of -I switches for building pg_regress.o.

2025-03-25 Thread Tom Lane
Fix order of -I switches for building pg_regress.o. We need the -I switch for libpq_srcdir to come before any -I switches injected by configure. Otherwise there is a risk of pulling in a mismatched version of libpq_fe.h from someplace like /usr/local/include, if the platform has another Postgres

pgsql: Fix order of -I switches for building pg_regress.o.

2025-03-25 Thread Tom Lane
Fix order of -I switches for building pg_regress.o. We need the -I switch for libpq_srcdir to come before any -I switches injected by configure. Otherwise there is a risk of pulling in a mismatched version of libpq_fe.h from someplace like /usr/local/include, if the platform has another Postgres

pgsql: pg_stat_statements: Add more tests with temp tables and namespac

2025-03-25 Thread Michael Paquier
pg_stat_statements: Add more tests with temp tables and namespaces These tests provide coverage for RangeTblEntry and how query jumbling works with search_path, as well as the case where relations are re-created, generating a different query ID as the relation OID is used in the computation. A pa

pgsql: initdb: Add --no-sync-data-files.

2025-03-25 Thread Nathan Bossart
initdb: Add --no-sync-data-files. This new option instructs initdb to skip synchronizing any files in database directories, the database directories themselves, and the tablespace directories, i.e., everything in the base/ subdirectory and any other tablespace directories. Other files, such as th

pgsql: pg_dump: Add --sequence-data.

2025-03-25 Thread Nathan Bossart
pg_dump: Add --sequence-data. This new option instructs pg_dump to dump sequence data when the --no-data, --schema-only, or --statistics-only option is specified. This was originally considered for commit a7e5457db8, but it was left out at that time because there was no known use-case. A follow-u

pgsql: Stats: use schemaname/relname instead of regclass.

2025-03-25 Thread Jeff Davis
Stats: use schemaname/relname instead of regclass. For import and export, use schemaname/relname rather than regclass. This is more natural during export, fits with the other arguments better, and it gives better control over error handling in case we need to downgrade more errors to warnings. A

pgsql: Minor doc update for commit 99f8f3fbbc.

2025-03-25 Thread Jeff Davis
Minor doc update for commit 99f8f3fbbc. Author: Corey Huinker Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2a420f7995e415f4813fccf1c42ab29a3a32182f Modified Files -- doc/src/sgml/func.sgml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)

pgsql: psql: Make default \watch interval configurable

2025-03-25 Thread Daniel Gustafsson
psql: Make default \watch interval configurable The default interval for \watch to wait between executing queries, when executed without a specified interval, was hardcoded to two seconds. This adds the new variable WATCH_INTERVAL which is used to set the default interval, making it configurable

pgsql: refactor: Split ATExecAlterConstraintInternal()

2025-03-25 Thread Peter Eisentraut
refactor: Split ATExecAlterConstraintInternal() Split ATExecAlterConstraintInternal() into two functions: ATExecAlterConstrDeferrability() and ATExecAlterConstrInheritability(). This simplifies the code and avoids unnecessary confusion caused by recursive code, which isn't needed for ATExecAlterC

pgsql: refactor: Move some code that updates pg_constraint to a separat

2025-03-25 Thread Peter Eisentraut
refactor: Move some code that updates pg_constraint to a separate function This extracts common/duplicate code for different ALTER CONSTRAINT variants into a common function. We plan to add more variants that would use the same code. Author: Amul Sul Discussion: https://www.postgresql.org/mess

pgsql: Small fixes for Add ALTER TABLE ... ALTER CONSTRAINT ... SET [NO

2025-03-25 Thread Peter Eisentraut
Small fixes for Add ALTER TABLE ... ALTER CONSTRAINT ... SET [NO] INHERIT Small fixes for commit f4e53e10b6c: Add missing calls to InvokeObjectPostAlterHook() and also CacheInvalidateRelcache(). The former change could have a user-visible effect. The latter omission might have caused other bugs,

pgsql: postgres_fdw: Remove redundant check in semijoin_target_ok()

2025-03-25 Thread Alexander Korotkov
postgres_fdw: Remove redundant check in semijoin_target_ok() If a var belongs to the innerrel of the joinrel, it's not possible that it belongs to the outerrel. This commit removes the redundant check from the if-clause but keeps it as an assertion. Discussion: https://postgr.es/m/flat/CAHewXN=

pgsql: libpq: Deprecate pg_int64.

2025-03-25 Thread Thomas Munro
libpq: Deprecate pg_int64. Previously we used pg_int64 in three function prototypes in libpq. It was added by commit 461ef73f to expose the platform-dependent type used for int64 in the C89 era. As of commit 962da900 it is defined as standard int64_t, and the dust seems to have settled. Let's j

pgsql: Label the contents of pg_*_d.h files a little better.

2025-03-25 Thread Tom Lane
Label the contents of pg_*_d.h files a little better. Make genbki.pl emit some boilerplate comments identifying the sections of the pg_*_d.h files that it generates. This is in hopes of making them slightly more readable, in case people look at those files and not the pg_*.h/pg_*.dat originals.