pgsql: Add tab completion for ALTER USER/ROLE RESET

2025-02-17 Thread Tomas Vondra
Add tab completion for ALTER USER/ROLE RESET

Currently tab completion for ALTER USER RESET shows a list of all
configuration parameters that may be set on a role, irrespectively of
which parameters are actually set. This patch improves tab completion to
offer only parameters that are set.

Author: Robins Tharakan
Reviewed-By: Tomas Vondra
Discussion: 
https://postgr.es/m/CAEP4nAzqiT6VbVC5r3nq5byLTnPzjniVGzEMpYcnAHQyNzEuaw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c407d5426b877b41be87f9e679e321bb2c42e47d

Modified Files
--
src/bin/psql/tab-complete.in.c | 9 +
1 file changed, 9 insertions(+)



pgsql: Add tab completion for ALTER DATABASE RESET

2025-02-17 Thread Tomas Vondra
Add tab completion for ALTER DATABASE RESET

Currently tab completion for ALTER DATABASE RESET shows a list of all
configuration parameters that may be set on a database, irrespectively
of which parameters are actually set. This patch improves tab completion
to offer only parameters that are set.

Author: Robins Tharakan
Reviewed-By: Tomas Vondra
Discussion: 
https://postgr.es/m/CAEP4nAzqiT6VbVC5r3nq5byLTnPzjniVGzEMpYcnAHQyNzEuaw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9df8727c5067916580f82da8b249136391de8544

Modified Files
--
src/bin/psql/tab-complete.in.c | 20 +++-
1 file changed, 19 insertions(+), 1 deletion(-)



pgsql: Translation updates

2025-02-17 Thread Álvaro Herrera
Translation updates

Source-Git-URL: ssh://g...@git.postgresql.org/pgtranslation/messages.git
Source-Git-Hash: 8fbdbed3216a3cdbb9ca74f3d9d990b4e96100e3

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/50fabe48e39858eacf8a56e0da1ba7610ae537ae

Modified Files
--
src/backend/po/es.po | 1541 
src/backend/po/sv.po | 3211 +-
src/bin/initdb/po/es.po  |2 +-
src/bin/pg_archivecleanup/po/es.po   |2 +-
src/bin/pg_basebackup/po/es.po   |2 +-
src/bin/pg_checksums/po/es.po|2 +-
src/bin/pg_config/po/es.po   |2 +-
src/bin/pg_controldata/po/es.po  |  131 +-
src/bin/pg_ctl/po/es.po  |6 +-
src/bin/pg_dump/po/es.po |  406 ++---
src/bin/pg_resetwal/po/es.po |2 +-
src/bin/pg_rewind/po/es.po   |   88 +-
src/bin/pg_test_fsync/po/es.po   |2 +-
src/bin/pg_test_timing/po/es.po  |2 +-
src/bin/pg_upgrade/po/es.po  |2 +-
src/bin/pg_verifybackup/po/es.po |2 +-
src/bin/pg_waldump/po/es.po  |2 +-
src/bin/psql/po/es.po|  206 +--
src/bin/psql/po/sv.po| 1928 ++--
src/bin/scripts/po/es.po |  256 +--
src/interfaces/ecpg/ecpglib/po/es.po |2 +-
src/interfaces/ecpg/preproc/po/es.po |   16 +-
src/interfaces/libpq/po/es.po|   20 +-
src/interfaces/libpq/po/fr.po|   20 +-
src/interfaces/libpq/po/sv.po|  410 ++---
src/pl/plperl/po/es.po   |2 +-
src/pl/plpgsql/src/po/es.po  |2 +-
src/pl/plpython/po/es.po |   24 +-
src/pl/tcl/po/es.po  |   40 +-
29 files changed, 4189 insertions(+), 4142 deletions(-)



pgsql: Translation updates

2025-02-17 Thread Álvaro Herrera
Translation updates

Source-Git-URL: ssh://g...@git.postgresql.org/pgtranslation/messages.git
Source-Git-Hash: 1e8728e015ca86554fa7a4e4153c8fd414657a02

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/3b5b99f6f14567396555b6c24a14111f81161e60

Modified Files
--
src/backend/po/es.po  | 1195 
src/backend/po/sv.po  | 2992 +
src/bin/initdb/po/sv.po   |  375 +++---
src/bin/psql/po/sv.po | 2081 ++--
src/interfaces/libpq/po/es.po |6 +
src/interfaces/libpq/po/fr.po |   13 +-
src/interfaces/libpq/po/sv.po |  412 +++---
7 files changed, 3504 insertions(+), 3570 deletions(-)



pgsql: Translation updates

2025-02-17 Thread Álvaro Herrera
Translation updates

Source-Git-URL: ssh://g...@git.postgresql.org/pgtranslation/messages.git
Source-Git-Hash: 2bcd19355a18178dfe82bde9e98b9486fcd3143f

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/a282099583039633a8aa83953a0c4e72fca95423

Modified Files
--
src/backend/po/es.po | 1304 +++
src/backend/po/sv.po | 3059 +-
src/bin/initdb/po/es.po  |2 +-
src/bin/pg_archivecleanup/po/es.po   |2 +-
src/bin/pg_basebackup/po/es.po   |2 +-
src/bin/pg_checksums/po/es.po|2 +-
src/bin/pg_config/po/es.po   |2 +-
src/bin/pg_controldata/po/es.po  |  131 +-
src/bin/pg_ctl/po/es.po  |6 +-
src/bin/pg_dump/po/es.po |  386 ++---
src/bin/pg_resetwal/po/es.po |2 +-
src/bin/pg_rewind/po/es.po   |2 +-
src/bin/pg_test_fsync/po/es.po   |2 +-
src/bin/pg_test_timing/po/es.po  |2 +-
src/bin/pg_upgrade/po/es.po  |2 +-
src/bin/pg_verifybackup/po/es.po |2 +-
src/bin/pg_waldump/po/es.po  |2 +-
src/bin/psql/po/es.po|  204 +--
src/bin/psql/po/sv.po| 1883 ++---
src/bin/scripts/po/es.po |  254 +--
src/interfaces/ecpg/ecpglib/po/es.po |2 +-
src/interfaces/ecpg/preproc/po/es.po |   16 +-
src/interfaces/libpq/po/es.po|   21 +-
src/interfaces/libpq/po/fr.po|   20 +-
src/interfaces/libpq/po/sv.po|  305 ++--
src/pl/plperl/po/es.po   |2 +-
src/pl/plpgsql/src/po/es.po  |2 +-
src/pl/plpython/po/es.po |   24 +-
src/pl/tcl/po/es.po  |   40 +-
29 files changed, 3863 insertions(+), 3820 deletions(-)



pgsql: Translation updates

2025-02-17 Thread Álvaro Herrera
Translation updates

Source-Git-URL: ssh://g...@git.postgresql.org/pgtranslation/messages.git
Source-Git-Hash: af39eb1d27d7701ff7240457c2c9e49e9531eaa7

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/f815362abecde1aebcd9ddb334fe271edc759eaa

Modified Files
--
src/backend/po/es.po | 1366 +++
src/backend/po/sv.po | 3146 +-
src/bin/initdb/po/es.po  |2 +-
src/bin/pg_archivecleanup/po/es.po   |2 +-
src/bin/pg_basebackup/po/es.po   |2 +-
src/bin/pg_checksums/po/es.po|2 +-
src/bin/pg_config/po/es.po   |2 +-
src/bin/pg_controldata/po/es.po  |  131 +-
src/bin/pg_ctl/po/es.po  |6 +-
src/bin/pg_dump/po/es.po |  384 ++---
src/bin/pg_resetwal/po/es.po |2 +-
src/bin/pg_rewind/po/es.po   |   88 +-
src/bin/pg_test_fsync/po/es.po   |2 +-
src/bin/pg_test_timing/po/es.po  |2 +-
src/bin/pg_upgrade/po/es.po  |2 +-
src/bin/pg_verifybackup/po/es.po |2 +-
src/bin/pg_waldump/po/es.po  |2 +-
src/bin/psql/po/es.po|  206 +--
src/bin/psql/po/sv.po| 1960 +++--
src/bin/scripts/po/es.po |  262 +--
src/interfaces/ecpg/ecpglib/po/es.po |2 +-
src/interfaces/ecpg/preproc/po/es.po |   16 +-
src/interfaces/libpq/po/es.po|   20 +-
src/interfaces/libpq/po/fr.po|   20 +-
src/interfaces/libpq/po/sv.po|  428 ++---
src/pl/plperl/po/es.po   |2 +-
src/pl/plpgsql/src/po/es.po  |2 +-
src/pl/plpython/po/es.po |   24 +-
src/pl/tcl/po/es.po  |   42 +-
29 files changed, 4068 insertions(+), 4059 deletions(-)



pgsql: Translation updates

2025-02-17 Thread Álvaro Herrera
Translation updates

Source-Git-URL: ssh://g...@git.postgresql.org/pgtranslation/messages.git
Source-Git-Hash: 4b3f97f98ced3e9b03a6b24a16ac06eec2eab330

Branch
--
REL_17_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/d0ed7d2a5aeb858e814147b42f8681870340909b

Modified Files
--
src/backend/po/es.po | 1305 ++---
src/backend/po/sv.po | 3368 +-
src/bin/initdb/po/es.po  |6 +-
src/bin/initdb/po/sv.po  |  349 ++--
src/bin/pg_archivecleanup/po/es.po   |2 +-
src/bin/pg_basebackup/po/es.po   |  142 +-
src/bin/pg_checksums/po/es.po|2 +-
src/bin/pg_combinebackup/po/sv.po|  129 +-
src/bin/pg_config/po/es.po   |2 +-
src/bin/pg_controldata/po/es.po  |  135 +-
src/bin/pg_ctl/po/es.po  |6 +-
src/bin/pg_dump/po/es.po |  412 ++---
src/bin/pg_resetwal/po/es.po |2 +-
src/bin/pg_rewind/po/es.po   |6 +-
src/bin/pg_test_fsync/po/es.po   |2 +-
src/bin/pg_test_timing/po/es.po  |2 +-
src/bin/pg_upgrade/po/es.po  |6 +-
src/bin/pg_upgrade/po/sv.po  |   14 +-
src/bin/pg_verifybackup/po/es.po |   78 +-
src/bin/pg_waldump/po/es.po  |2 +-
src/bin/psql/po/es.po|  234 +--
src/bin/psql/po/sv.po| 2047 ++---
src/bin/scripts/po/es.po |  290 +--
src/interfaces/ecpg/ecpglib/po/es.po |2 +-
src/interfaces/ecpg/preproc/po/es.po |   16 +-
src/interfaces/libpq/po/es.po|   14 +-
src/interfaces/libpq/po/fr.po|   13 +-
src/interfaces/libpq/po/sv.po|  148 +-
src/pl/plperl/po/es.po   |2 +-
src/pl/plpgsql/src/po/es.po  |2 +-
src/pl/plpython/po/es.po |   24 +-
src/pl/tcl/po/es.po  |   42 +-
32 files changed, 4434 insertions(+), 4370 deletions(-)



pgsql: Specialize intarray sorting

2025-02-17 Thread John Naylor
Specialize intarray sorting

There is at least one report in the field of storing millions of
integers in arrays, so it seems like a good time to specialize
intarray's qsort function. In doing so, streamline the comparators:
Previously there were three, two for each direction for sorting
and one passed to qunique_arg. To preserve the early exit in the
case of descending input, pass the direction as an argument to
the comparator. This requires giving up duplicate detection, which
previously allowed skipping the qunique_arg() call. Testing showed
no regressions this way.

In passing, get rid of nearby checks that the input has at least
two elements, since preserving them would make some macros less
readable. These are not necessary for correctness, and seem like
premature optimizations.

Author: Andrey M. Borodin 
Discussion: 
https://postgr.es/m/098a3e67-e4a6-4086-9c66-b1eaeb1df...@yandex-team.ru

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/53d3daa491be458e543dd5bf24d40595e588e4e7

Modified Files
--
contrib/intarray/_int.h  | 20 ++
contrib/intarray/_int_tool.c | 62 +++-
2 files changed, 34 insertions(+), 48 deletions(-)



pgsql: Doc: Improve pg_replication_slots.inactive_since description.

2025-02-17 Thread Amit Kapila
Doc: Improve pg_replication_slots.inactive_since description.

Author: Peter Smith 
Reviewed-by: Amit Kapila 
Discussion: 
https://postgr.es/m/cahut+pssvvmtwvtupto6hbpo8pgvsvtzndt_fdboma_oq4z...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/164bac92f08ccddd6701d44a5338d72c22f7b5c2

Modified Files
--
doc/src/sgml/system-views.sgml | 8 +++-
1 file changed, 3 insertions(+), 5 deletions(-)



pgsql: Raise a WARNING for max_slot_wal_keep_size in pg_createsubscribe

2025-02-17 Thread Amit Kapila
Raise a WARNING for max_slot_wal_keep_size in pg_createsubscriber.

During the pg_createsubscriber execution, it is possible that the required
WAL is removed from the primary/publisher node due to
'max_slot_wal_keep_size'.

This patch raises a WARNING during the '--dry-run' mode if the
'max_slot_wal_keep_size' is set to a non-default value on the
primary/publisher node.

Author: Shubham Khanna 
Reviewed-by: Peter Smith 
Reviewed-by: Hayato Kuroda 
Reviewed-by: Vignesh C 
Discussion: 
https://postgr.es/m/CAHv8Rj+deqsQXOMa7Tck8CBQUbsua=+4AuMVQ2=mpm0f-zh...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/217919dd0954f54402e8d0a38cd203a740754077

Modified Files
--
doc/src/sgml/ref/pg_createsubscriber.sgml   |  7 +++
src/bin/pg_basebackup/pg_createsubscriber.c | 20 +++-
2 files changed, 26 insertions(+), 1 deletion(-)



pgsql: Fix translator notes in comments

2025-02-17 Thread Daniel Gustafsson
Fix translator notes in comments

The translator comments detailing what a %s inclusion refers to were
accidentally including too many address types.  In practice this is
not a problem since it's not a translated string, but to minimize any
risk of confusion let's fix them anwyays.  Even though this exists in
backbranches there is little use for backpatch as the translation work
has already happened there, so let's avoid the churn.

Author: Japin Li 
Reviewed-by: Daniel Gustafsson 
Discussion: 
https://postgr.es/m/me0p300mb04458de627480614abe639d2b6...@me0p300mb0445.ausp300.prod.outlook.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9cdc21b533d43829eb1337c8b16e147f6de7c53e

Modified Files
--
src/backend/libpq/pqcomm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



pgsql: Stamp 13.20.

2025-02-17 Thread Tom Lane
Stamp 13.20.

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/c8f198c3acb59ed858b5b9b88b4fbc55cece544e

Modified Files
--
configure| 18 +-
configure.in |  2 +-
2 files changed, 10 insertions(+), 10 deletions(-)



pgsql: Stamp 17.4.

2025-02-17 Thread Tom Lane
Stamp 17.4.

Branch
--
REL_17_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/f8554dee417ffc4540c94cf357f7bf7d4b6e5d80

Modified Files
--
configure| 18 +-
configure.ac |  2 +-
meson.build  |  2 +-
3 files changed, 11 insertions(+), 11 deletions(-)



pgsql: Stamp 14.17.

2025-02-17 Thread Tom Lane
Stamp 14.17.

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/e5cabe28006995d90cc9ebc613dad072c44c7f4a

Modified Files
--
configure| 18 +-
configure.ac |  2 +-
2 files changed, 10 insertions(+), 10 deletions(-)



pgsql: Stamp 16.8.

2025-02-17 Thread Tom Lane
Stamp 16.8.

Branch
--
REL_16_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/71eb35c0b18de96537bd3876ec9bf8075bfd484f

Modified Files
--
configure| 18 +-
configure.ac |  2 +-
meson.build  |  2 +-
3 files changed, 11 insertions(+), 11 deletions(-)



pgsql: Stamp 15.12.

2025-02-17 Thread Tom Lane
Stamp 15.12.

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/50d3d22baba63613d1f1406b2ed460dc9b03c3fc

Modified Files
--
configure| 18 +-
configure.ac |  2 +-
2 files changed, 10 insertions(+), 10 deletions(-)



pgsql: Fix typo in 2a8a0067.

2025-02-17 Thread Thomas Munro
Fix typo in 2a8a0067.

Builds configured with Valgrind but without assertions would fail due to
a typo in the recent change.  This should be included when back-patching
2a8a0067 into v17.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/2509b857cc1067be628291864289f27325760477

Modified Files
--
src/backend/storage/aio/read_stream.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



pgsql: Revert: Get rid of WALBufMappingLock

2025-02-17 Thread Alexander Korotkov
Revert: Get rid of WALBufMappingLock

This commit reverts 6a2275b895.  Buildfarm failure on batta spots some
concurrency issue, which requires further investigation.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/3fb58625d18fd226cb929c9700d0db72ac92c075

Modified Files
--
src/backend/access/transam/xlog.c   | 176 +++-
src/backend/utils/activity/wait_event_names.txt |   2 +-
src/include/storage/lwlocklist.h|   2 +-
3 files changed, 48 insertions(+), 132 deletions(-)



pgsql: Implement Self-Join Elimination

2025-02-17 Thread Alexander Korotkov
Implement Self-Join Elimination

The Self-Join Elimination (SJE) feature removes an inner join of a plain
table to itself in the query tree if it is proven that the join can be
replaced with a scan without impacting the query result.  Self-join and
inner relation get replaced with the outer in query, equivalence classes,
and planner info structures.  Also, the inner restrictlist moves to the
outer one with the removal of duplicated clauses.  Thus, this optimization
reduces the length of the range table list (this especially makes sense for
partitioned relations), reduces the number of restriction clauses and,
in turn, selectivity estimations, and potentially improves total planner
prediction for the query.

This feature is dedicated to avoiding redundancy, which can appear after
pull-up transformations or the creation of an EquivalenceClass-derived clause
like the below.

  SELECT * FROM t1 WHERE x IN (SELECT t3.x FROM t1 t3);
  SELECT * FROM t1 WHERE EXISTS (SELECT t3.x FROM t1 t3 WHERE t3.x = t1.x);
  SELECT * FROM t1,t2, t1 t3 WHERE t1.x = t2.x AND t2.x = t3.x;

In the future, we could also reduce redundancy caused by subquery pull-up
after unnecessary outer join removal in cases like the one below.

  SELECT * FROM t1 WHERE x IN
(SELECT t3.x FROM t1 t3 LEFT JOIN t2 ON t2.x = t1.x);

Also, it can drastically help to join partitioned tables, removing entries
even before their expansion.

The SJE proof is based on innerrel_is_unique() machinery.

We can remove a self-join when for each outer row:

 1. At most, one inner row matches the join clause;
 2. Each matched inner row must be (physically) the same as the outer one;
 3. Inner and outer rows have the same row mark.

In this patch, we use the next approach to identify a self-join:

 1. Collect all merge-joinable join quals which look like a.x = b.x;
 2. Add to the list above the baseretrictinfo of the inner table;
 3. Check innerrel_is_unique() for the qual list.  If it returns false, skip
this pair of joining tables;
 4. Check uniqueness, proved by the baserestrictinfo clauses. To prove the
possibility of self-join elimination, the inner and outer clauses must
match exactly.

The relation replacement procedure is not trivial and is partly combined
with the one used to remove useless left joins.  Tests covering this feature
were added to join.sql.  Some of the existing regression tests changed due
to self-join removal logic.

Discussion: 
https://postgr.es/m/flat/64486b0b-0404-e39e-322d-0801154901f3%40postgrespro.ru
Author: Andrey Lepikhov 
Author: Alexander Kuzmenkov 
Co-authored-by: Alexander Korotkov 
Co-authored-by: Alena Rybakina 
Reviewed-by: Tom Lane 
Reviewed-by: Robert Haas 
Reviewed-by: Andres Freund 
Reviewed-by: Simon Riggs 
Reviewed-by: Jonathan S. Katz 
Reviewed-by: David Rowley 
Reviewed-by: Thomas Munro 
Reviewed-by: Konstantin Knizhnik 
Reviewed-by: Heikki Linnakangas 
Reviewed-by: Hywel Carver 
Reviewed-by: Laurenz Albe 
Reviewed-by: Ronan Dunklau 
Reviewed-by: vignesh C 
Reviewed-by: Zhihong Yu 
Reviewed-by: Greg Stark 
Reviewed-by: Jaime Casanova 
Reviewed-by: Michał Kłeczek 
Reviewed-by: Alena Rybakina 
Reviewed-by: Alexander Korotkov 

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/fc069a3a6319b5bf40d2f0f1efceae1c9b7a68a8

Modified Files
--
doc/src/sgml/config.sgml  |   16 +
src/backend/optimizer/path/equivclass.c   |3 +-
src/backend/optimizer/path/indxpath.c |   39 +
src/backend/optimizer/plan/analyzejoins.c | 1240 ++---
src/backend/optimizer/plan/planmain.c |5 +
src/backend/optimizer/prep/prepunion.c|9 +-
src/backend/rewrite/rewriteManip.c|  126 ++-
src/backend/utils/misc/guc_tables.c   |   10 +
src/include/nodes/pathnodes.h |   40 +-
src/include/optimizer/optimizer.h |2 +
src/include/optimizer/paths.h |3 +
src/include/optimizer/planmain.h  |6 +
src/include/rewrite/rewriteManip.h|4 +
src/test/regress/expected/equivclass.out  |   30 +
src/test/regress/expected/join.out| 1083 +
src/test/regress/expected/sysviews.out|3 +-
src/test/regress/sql/equivclass.sql   |   16 +
src/test/regress/sql/join.sql |  494 
src/tools/pgindent/typedefs.list  |2 +
19 files changed, 2983 insertions(+), 148 deletions(-)