PostgreSQL 16.0 commit log

Doc: fix release date in release-16.sgml.

commit   : c372fbbd8e911f2412b80a8c39d7079366565d67    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Sep 2023 16:25:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Sep 2023 16:25:06 -0400    

Click here for diff

M doc/src/sgml/release-16.sgml

Stamp 16.0.

commit   : 2439153f4477892b5af0f05e1c95eb0a048608bd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Sep 2023 16:10:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Sep 2023 16:10:09 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

Translation updates

commit   : e472a8c51c935ee074ab83197a1358325cc91b1b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 11 Sep 2023 14:22:52 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 11 Sep 2023 14:22:52 +0200    

Click here for diff

This file was missed in the previous update.  
  
Source-Git-URL: ssh://git@git.postgresql.org/pgtranslation/messages.git  
Source-Git-Hash: de944161c6153124a7bf720cb99823ff31b64bab  

A src/interfaces/ecpg/ecpglib/po/zh_TW.po

Translation updates

commit   : 6bdeed9844d77d051905771c5673364d4e385052    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 11 Sep 2023 14:08:53 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 11 Sep 2023 14:08:53 +0200    

Click here for diff

Source-Git-URL: ssh://git@git.postgresql.org/pgtranslation/messages.git  
Source-Git-Hash: 06696f05da005029a2326e1cbb234917a9286914  

M src/backend/po/es.po
M src/backend/po/ko.po
M src/bin/initdb/po/el.po
M src/bin/initdb/po/ko.po
A src/bin/initdb/po/zh_TW.po
M src/bin/pg_archivecleanup/po/ko.po
M src/bin/pg_basebackup/po/el.po
M src/bin/pg_basebackup/po/ko.po
M src/bin/pg_checksums/po/ko.po
M src/bin/pg_config/po/el.po
M src/bin/pg_config/po/ko.po
M src/bin/pg_controldata/po/ko.po
M src/bin/pg_ctl/po/el.po
M src/bin/pg_ctl/po/ko.po
A src/bin/pg_ctl/po/zh_TW.po
M src/bin/pg_dump/po/el.po
M src/bin/pg_dump/po/ko.po
A src/bin/pg_dump/po/zh_TW.po
M src/bin/pg_resetwal/po/ko.po
M src/bin/pg_rewind/po/el.po
M src/bin/pg_rewind/po/ko.po
M src/bin/pg_test_fsync/po/ko.po
M src/bin/pg_test_timing/po/ko.po
M src/bin/pg_upgrade/po/ko.po
M src/bin/pg_verifybackup/po/el.po
M src/bin/pg_verifybackup/po/ko.po
M src/bin/pg_waldump/po/el.po
M src/bin/pg_waldump/po/ko.po
M src/bin/psql/po/el.po
M src/bin/psql/po/ko.po
M src/bin/scripts/po/el.po
M src/bin/scripts/po/ko.po
M src/interfaces/ecpg/preproc/po/ko.po
M src/interfaces/ecpg/preproc/po/zh_TW.po
M src/interfaces/libpq/po/el.po
M src/interfaces/libpq/po/ja.po
M src/interfaces/libpq/po/ko.po
M src/pl/plperl/po/ko.po
M src/pl/plpgsql/src/po/ko.po
M src/pl/plpython/po/el.po
M src/pl/plpython/po/ko.po
M src/pl/tcl/po/ko.po

doc: remove mention of backslash doubling in strings

commit   : efaa50c783d73d99b4e999012f9f0a9ffdad3e50    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 8 Sep 2023 17:25:15 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 8 Sep 2023 17:25:15 -0400    

Click here for diff

Reported-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/0b03f91a875fb44182f5bed9e1d404ed6d138066.camel@cybertec.at  
  
Author: Laurenz Albe  
  
Backpatch-through: 11  

M doc/src/sgml/syntax.sgml

Stabilize subscription stats test.

commit   : 1b95c8d85fa66c0ef63591b8064b023872a8f43c    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 8 Sep 2023 22:50:56 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 8 Sep 2023 22:50:56 +0900    

Click here for diff

The new test added by commit 68a59f9e9 disables the subscription and  
manually drops the associated replication slot. However, since  
disabling the subsubscription doesn't wait for a walsender to release  
the replication slot and exit, pg_drop_replication_slot() could  
fail. Avoid failure by adding a wait for the replication slot to  
become inactive.  
  
Reported-by: Hou Zhijie, as per buildfarm  
Reviewed-by: Hou Zhijie  
Discussion: https://postgr.es/m/OS0PR01MB571682316378379AA34854F694E9A%40OS0PR01MB5716.jpnprd01.prod.outlook.com  
Backpatch-through: 15  

M src/test/subscription/t/026_stats.pl

doc: Extend documentation of PG_TEST_EXTRA

commit   : bae47d78673e42bc203bc5a8172e058f1c5bb548    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 8 Sep 2023 11:34:43 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 8 Sep 2023 11:34:43 +0200    

Click here for diff

Extend the PG_TEST_EXTRA documentation to mention resource intensive  
tests as well. The previous wording only mentioned special software  
and security in the main paragraph, with resource usage listed on one  
of the tests in the list.  
  
Backpatch to v15 where f47ed79cc8 added wal_consistenct_checking as  
a PG_TEST_EXTRA target.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CAN55FZ0OthTuBdiNkaX2BvxuHdK4Y1MVEb8_uEuD1yHMPmT9Og@mail.gmail.com  
Backpatch-through: 15  

M doc/src/sgml/regress.sgml

pg_basebackup: Generate valid temporary slot names under PQbackendPID()

commit   : 1057958436c5b9f0468fc3bf08dd49b1e0f43acb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 Sep 2023 14:12:25 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 Sep 2023 14:12:25 +0900    

Click here for diff

pgbouncer can cause PQbackendPID() to return negative values due to it  
filling be_pid with random bytes (even these days pid_max can only be  
set up to 2^22 on 64b machines on Linux, for example, so this cannot  
happen with normal PID numbers).  When this happens, pg_basebackup may  
generate a temporary slot name that may not be accepted by the parser,  
leading to spurious failures, like:  
pg_basebackup: error: could not send replication command  
ERROR:  replication slot name "pg_basebackup_-1201966863" contains  
invalid character  
  
This commit fixes that problem by formatting the result from  
PQbackendPID() as an unsigned integer when creating the temporary  
replication slot name, so as the invalid character is gone and the  
command can be parsed.  
  
Author: Jelte Fennema  
Reviewed-by: Daniel Gustafsson, Nishant Sharma  
Discussion: https://postgr.es/m/CAGECzQQOGvYfp8ziF4fWQ_o8s2K7ppaoWBQnTmdakn3s-4Z=5g@mail.gmail.com  
Backpatch-through: 11  

M src/bin/pg_basebackup/pg_basebackup.c

Disable 031_recovery_conflict.pl in 15 and 16.

commit   : 8d1cf9674a253f88d52c365804b9b4d3a7eeab9d    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 7 Sep 2023 11:47:42 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 7 Sep 2023 11:47:42 +1200    

Click here for diff

This test fails due to known bugs in the test and the server.  Those  
will be fixed in master shortly and possibly back-patched a bit later,  
but in the meantime it is unhelpful for package maintainers if the tests  
randomly fail, and it's not a good time to make complex changes in 16.  
  
This had already been done for older branches prior to 15's release.  
Now we're about to release 16, and Debian's test builds are regularly  
failing on one architecture, so let's do the same for 15 and 16.  
  
Reported-by: Christoph Berg <myon@debian.org>  
Reported-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Discussion: https://postgr.es/m/CALj2ACVr8au2J_9D88UfRCi0JdWhyQDDxAcSVav0B0irx9nXEg%40mail.gmail.com  

M src/test/recovery/t/031_recovery_conflict.pl

doc: mention that to_char() values are rounded

commit   : 253bc4eb284b3d3e5fe554f74fcc50ca10e8fd61    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 6 Sep 2023 16:52:24 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 6 Sep 2023 16:52:24 -0400    

Click here for diff

Reported-by: barsikdacat@gmail.com  
  
Diagnosed-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/168991536429.626.9957835774751337210@wrigleys.postgresql.org  
  
Author: Laurenz Albe  
  
Backpatch-through: 11  

M doc/src/sgml/func.sgml

doc: PG 16 relnotes: fix subscriber role permission description

commit   : 3ddc889e334f21c6dc98753dcd8b485b275b5e33    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 6 Sep 2023 15:36:07 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 6 Sep 2023 15:36:07 -0400    

Click here for diff

Reported-by: Magnus Hagander  
  
Discussion: https://postgr.es/m/CABUevEwBXi5oqqMj429Lxjro1uu-fdKgSkJtgJS5aTOmujEGQQ@mail.gmail.com  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Translation updates

commit   : b323fcc58cb15200572a8515bc9b5bb1882c4d42    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Sep 2023 09:04:30 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Sep 2023 09:04:30 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: c5b5ab1da828e1d7a012431e417f0b75b2450c8f  

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
M src/backend/po/ja.po
M src/backend/po/ka.po
M src/backend/po/ru.po
M src/backend/po/sv.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/it.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ka.po
M src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/sv.po
M src/bin/pg_amcheck/po/it.po
M src/bin/pg_amcheck/po/ru.po
M src/bin/pg_amcheck/po/sv.po
M src/bin/pg_archivecleanup/po/it.po
M src/bin/pg_archivecleanup/po/ru.po
M src/bin/pg_basebackup/po/it.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_checksums/po/es.po
M src/bin/pg_checksums/po/it.po
M src/bin/pg_checksums/po/ru.po
M src/bin/pg_checksums/po/uk.po
M src/bin/pg_config/po/ru.po
M src/bin/pg_config/po/sv.po
M src/bin/pg_controldata/po/cs.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_controldata/po/it.po
M src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/sv.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/it.po
M src/bin/pg_ctl/po/pl.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_ctl/po/sv.po
M src/bin/pg_ctl/po/tr.po
M src/bin/pg_dump/po/cs.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/ja.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_resetwal/po/cs.po
M src/bin/pg_resetwal/po/de.po
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/fr.po
M src/bin/pg_resetwal/po/it.po
M src/bin/pg_resetwal/po/ja.po
M src/bin/pg_resetwal/po/ka.po
M src/bin/pg_resetwal/po/ru.po
M src/bin/pg_resetwal/po/sv.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_rewind/po/it.po
M src/bin/pg_rewind/po/ru.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_test_fsync/po/ru.po
M src/bin/pg_test_timing/po/ru.po
M src/bin/pg_upgrade/po/fr.po
M src/bin/pg_upgrade/po/ja.po
M src/bin/pg_upgrade/po/ru.po
M src/bin/pg_verifybackup/po/fr.po
M src/bin/pg_verifybackup/po/it.po
M src/bin/pg_verifybackup/po/ru.po
M src/bin/pg_waldump/po/es.po
M src/bin/pg_waldump/po/fr.po
M src/bin/pg_waldump/po/it.po
M src/bin/pg_waldump/po/ru.po
M src/bin/pg_waldump/po/sv.po
M src/bin/pg_waldump/po/uk.po
M src/bin/psql/po/cs.po
M src/bin/psql/po/el.po
M src/bin/psql/po/es.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/it.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/cs.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/it.po
M src/bin/scripts/po/ru.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/preproc/po/pl.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/libpq/po/ru.po
M src/pl/plperl/po/ru.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpython/po/ru.po
M src/pl/tcl/po/fr.po
M src/pl/tcl/po/ru.po

Update list of acknowledgments in release notes

commit   : ae7e3ae8c6ee1a877ef5940cafdb4a051d80feca    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Sep 2023 08:11:22 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Sep 2023 08:11:22 +0200    

Click here for diff

current through 57a011b666  

M doc/src/sgml/release-16.sgml

doc: mention libpq regression tests

commit   : 57a011b6664f284bedd172595dbeb910a53e9121    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 5 Sep 2023 13:05:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 5 Sep 2023 13:05:28 -0400    

Click here for diff

Reported-by: Ryo Matsumura  
  
Discussion: https://postgr.es/m/TYCPR01MB11316B3FB56EE54D70BF0CEF6E8E4A@TYCPR01MB11316.jpnprd01.prod.outlook.com  
  
Backpatch-through: 11  

M doc/src/sgml/regress.sgml

Unify gratuitously different error messages

commit   : 9ddecd40664f7523b18f760aea0e04936e8a2302    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 Sep 2023 11:36:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 Sep 2023 11:36:55 +0200    

Click here for diff

Fixup for commit 37188cea0c.  

M src/bin/pg_dump/pg_dump.c

Fix out-of-bound read in gtsvector_picksplit()

commit   : fac3fa0d5b21ce59258a691b88e4176a06722bfc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 4 Sep 2023 14:55:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 4 Sep 2023 14:55:49 +0900    

Click here for diff

This could lead to an imprecise choice when splitting an index page of a  
GiST index on a tsvector, deciding which entries should remain on the  
old page and which entries should move to a new page.  
  
This is wrong since tsearch2 has been moved into core with commit  
140d4ebcb46e, so backpatch all the way down.  This error has been  
spotted by valgrind.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/17950-6c80a8d2b94ec695@postgresql.org  
Backpatch-through: 11  

M src/backend/utils/adt/tsgistidx.c

Fix handling of shared statistics with dropped databases

commit   : c397c98ae63d57c35766dbefe4ea34a5162abf53    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 4 Sep 2023 08:04:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 4 Sep 2023 08:04:40 +0900    

Click here for diff

Dropping a database while a connection is attempted on it was able to  
lead to the presence of valid database entries in shared statistics.  
The issue is that MyDatabaseId was getting set too early than it should,  
as, if the connection attempted on the dropped database fails when  
renamed or dropped, the shutdown callback of the shared statistics would  
finish by re-inserting a correct entry related to the database already  
dropped.  
  
As analyzed by the bug reporters, this issue could lead to phantom  
entries in the database list maintained by the autovacuum launcher  
(in rebuild_database_list()) if the database dropped was part of the  
database list when it was still valid.  After the database was dropped,  
it would remain the highest on the list of databases to considered by  
the autovacuum worker as things to process.  This would prevent  
autovacuum jobs to happen on all the other databases still present.  
  
The commit fixes this issue by delaying setting MyDatabaseId until the  
database existence has been re-checked with the second scan on  
pg_database after getting a shared lock on it, and by switching  
pgstat_update_dbstats() so as nothing happens if MyDatabaseId is not  
valid.  
  
Issue introduced by 5891c7a8ed8f, so backpatch down to 15.  
  
Reported-by: Will Mortensen, Jacob Speidel  
Analyzed-by: Will Mortensen, Jacob Speidel  
Author: Andres Freund  
Discussion: https://postgr.es/m/17973-bca1f7d5c14f601e@postgresql.org  
Backpatch-through: 15  

M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/init/postinit.c

doc: PG 16 relnotes: clarify LOCK TABLE description

commit   : 22297cd65fa5efeffebcfaebfdda174dcdbd821a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 31 Aug 2023 15:14:18 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 31 Aug 2023 15:14:18 -0400    

Click here for diff

Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Report syncscan position at end of scan.

commit   : d5feb6011e629cc1096bbaa10af5ffcc6c17f908    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 31 Aug 2023 13:02:15 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 31 Aug 2023 13:02:15 +0300    

Click here for diff

The comment in heapgettup_advance_block() says that it reports the  
scan position before checking for end of scan, but that didn't match  
the code. The code was refactored in commit 7ae0ab0ad9, which  
inadvertently changed the order of the check and reporting. Change it  
back.  
  
This caused a few regression test failures with a small shared_buffers  
setting like 10 MB. The 'portals' and 'cluster' tests perform seqscans  
that are large enough that sync seqscans kick in. When the sync scan  
position is not updated at end of scan, the next seq scan doesn't  
start at the beginning of the table, and the test queries are  
sensitive to that.  
  
Reviewed-by: Melanie Plageman, David Rowley  
Discussion: https://www.postgresql.org/message-id/6f991389-ae22-d844-a9d8-9aceb7c01a9a@iki.fi  
Backpatch-through: 16  

M src/backend/access/heap/heapam.c

Use actual backend IDs in pg_stat_get_backend_subxact().

commit   : 133654a05b4367e3e70f7cfe496a4b9386674fcf    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 30 Aug 2023 14:47:20 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 30 Aug 2023 14:47:20 -0700    

Click here for diff

Unlike the other pg_stat_get_backend* functions,  
pg_stat_get_backend_subxact() looks up the backend entry by using  
its integer argument as a 1-based index in an internal array.  The  
other functions look for the entry with the matching session  
backend ID.  These numbers often match, but that isn't reliably  
true.  
  
This commit resolves this discrepancy by introducing  
pgstat_get_local_beentry_by_backend_id() and using it in  
pg_stat_get_backend_subxact().  We cannot use  
pgstat_get_beentry_by_backend_id() because it returns a  
PgBackendStatus, which lacks the locally computed additions  
available in LocalPgBackendStatus that are required by  
pg_stat_get_backend_subxact().  
  
Author: Ian Barwick  
Reviewed-by: Sami Imseih, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/CAB8KJ%3Dj-ACb3H4L9a_b3ZG3iCYDW5aEu3WsPAzkm2S7JzS1Few%40mail.gmail.com  
Backpatch-through: 16  

M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/utils/backend_status.h

Rename some support functions for pgstat* views.

commit   : 8dfa37b797843a83a5756ea3309055e8953e1a86    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 30 Aug 2023 14:47:14 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 30 Aug 2023 14:47:14 -0700    

Click here for diff

Presently, pgstat_fetch_stat_beentry() accepts a session's backend  
ID as its argument, and pgstat_fetch_stat_local_beentry() accepts a  
1-based index in an internal array as its argument.  The former is  
typically used wherever a user must provide a backend ID, and the  
latter is usually used internally when looping over all entries in  
the array.  This difference was first introduced by d7e39d72ca.  
Before that commit, both functions accepted a 1-based index to the  
internal array.  
  
This commit renames these two functions to make it clear whether  
they use the backend ID or the 1-based index to look up the entry.  
This is preparatory work for a follow-up change that will introduce  
a function for looking up a LocalPgBackendStatus using a backend  
ID.  
  
Reviewed-by: Ian Barwick, Sami Imseih, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/CAB8KJ%3Dj-ACb3H4L9a_b3ZG3iCYDW5aEu3WsPAzkm2S7JzS1Few%40mail.gmail.com  
Backpatch-through: 16  

M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/utils/backend_status.h

postgres_fdw: Fix test for parameterized foreign scan.

commit   : 5220b568c5ad8d9ac97c0401453267491a378ef3    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 30 Aug 2023 17:15:01 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 30 Aug 2023 17:15:01 +0900    

Click here for diff

Commit e4106b252 should have updated this test, but did not; back-patch  
to all supported branches.  
  
Reviewed by Richard Guo.  
  
Discussion: http://postgr.es/m/CAPmGK15nR0NXLSCKQAcqbZbTzrzd5MozowWnTnGfPkayndF43Q%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Avoid possible overflow with ltsGetFreeBlock() in logtape.c

commit   : 1d2939b6dc638f9b9f9e747bec478cb1a7a459b6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 30 Aug 2023 08:03:48 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 30 Aug 2023 08:03:48 +0900    

Click here for diff

nFreeBlocks, defined as a long, stores the number of free blocks in a  
logical tape.  ltsGetFreeBlock() has been using an int to store the  
value of nFreeBlocks, which could lead to overflows on platforms where  
long and int are not the same size (in short everything except Windows  
where long is 4 bytes).  
  
The problematic intermediate variable is switched to be a long instead  
of an int.  
  
Issue introduced by c02fdc9223015, so backpatch down to 13.  
  
Author: Ranier vilela  
Reviewed-by: Peter Geoghegan, David Rowley  
Discussion: https://postgr.es/m/CAEudQApLDWCBR_xmwNjGBrDo+f+S4E87x3s7-+hoaKqYdtC4JQ@mail.gmail.com  
Backpatch-through: 13  

M src/backend/utils/sort/logtape.c

Rename logical_replication_mode to debug_logical_replication_streaming

commit   : 39d4207e876fa55971cd20a7677b78f067971fd3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 29 Aug 2023 15:15:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 29 Aug 2023 15:15:54 +0200    

Click here for diff

The logical_replication_mode GUC is intended for testing and debugging  
purposes, but its current name may be misleading and encourage users to make  
unnecessary changes.  
  
To avoid confusion, renaming the GUC to a less misleading name  
debug_logical_replication_streaming that casual users are less likely to mistakenly  
assume needs to be modified in a regular logical replication setup.  
  
Author: Hou Zhijie <houzj.fnst@cn.fujitsu.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/d672d774-c44b-6fec-f993-793e744f169a%40eisentraut.org  

M doc/src/sgml/config.sgml
M doc/src/sgml/release-16.sgml
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/misc/guc_tables.c
M src/include/replication/reorderbuffer.h
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/023_twophase_stream.pl

Reword user-facing message for "power of two"

commit   : cd59fcff256d68e028bf8a181d4e166e81b6474b    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 29 Aug 2023 14:27:40 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 29 Aug 2023 14:27:40 +0200    

Click here for diff

While there are numerous instances of using "power of 2" in the code,  
translated user-facing messages use "power of two". Fix two instances  
which used "power of 2" instead.  
  
This is a backpatch of 95fff2abee in master.  
  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20230829.175615.682972421946735863.horikyota.ntt@gmail.com  
Backpatch-through: v16  

M src/bin/initdb/initdb.c
M src/bin/pg_resetwal/pg_resetwal.c

Initialize ListenSocket array earlier.

commit   : 5f38ff3d0f65b7d092362aaf7375cce050a13bba    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 29 Aug 2023 09:09:40 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 29 Aug 2023 09:09:40 +0300    

Click here for diff

After commit b0bea38705, syslogger prints 63 warnings about failing to  
close a listen socket at postmaster startup. That's because the  
syslogger process forks before the ListenSockets array is initialized,  
so ClosePostmasterPorts() calls "close(0)" 64 times. The first call  
succeeds, because fd 0 is stdin.  
  
This has been like this since commit 9a86f03b4e in version 13, which  
moved the SysLogger_Start() call to before initializing ListenSockets.  
We just didn't notice until commit b0bea38705 added the LOG message.  
  
Reported by Michael Paquier and Jeff Janes.  
  
Author: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/ZOvvuQe0rdj2slA9%40paquier.xyz  
Discussion: https://www.postgresql.org/message-id/ZO0fgDwVw2SUJiZx@paquier.xyz#482670177eb4eaf4c9f03c1eed963e5f  
Backpatch-through: 13  

M src/backend/postmaster/postmaster.c

Stamp 16rc1.

commit   : d94dadcc5020f6746203896dba5a9627872ba2ee    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Aug 2023 16:26:56 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Aug 2023 16:26:56 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

Translation updates

commit   : 66ed5a2e92d206ae95fa460d9e5648b636b8270a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 28 Aug 2023 09:23:57 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 28 Aug 2023 09:23:57 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: a58360c10bd5a0f0153fcf75d0b5291ac1acecb0  

M src/backend/po/LINGUAS
M src/backend/po/de.po
A src/backend/po/ka.po
M src/backend/po/sv.po
M src/backend/po/uk.po
M src/bin/initdb/po/pt_BR.po
M src/bin/pg_archivecleanup/po/pt_BR.po
M src/bin/pg_checksums/po/pt_BR.po
M src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_dump/po/ka.po
M src/bin/pg_dump/po/sv.po
M src/bin/pg_resetwal/po/pt_BR.po
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/ka.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/psql/po/ka.po
M src/bin/scripts/po/pt_BR.po

Update list of acknowledgments in release notes

commit   : ef0e7dbcbed403ba53a1d77faf96600785e57d7a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 27 Aug 2023 20:30:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 27 Aug 2023 20:30:53 +0200    

Click here for diff

current through a842ba407c  

M doc/src/sgml/release-16.sgml

Remove incorrect name from release notes

commit   : 60d7d50f426b17b544fd8c24024d87ab8331984f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 27 Aug 2023 20:29:05 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 27 Aug 2023 20:29:05 +0200    

Click here for diff

This name was incorrect in the underlying commit message.  (The  
correct name is already listed.)  
  
Reported-by: Denis Laxalde <denis.laxalde@dalibo.com>  

M doc/src/sgml/release-16.sgml

Remove incorrect/duplicate name from list of acknowledgments

commit   : 8d70eb731c43c4ccb5fa5642518a277ef3f6b860    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 27 Aug 2023 20:27:32 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 27 Aug 2023 20:27:32 +0200    

Click here for diff

Reported-by: Vik Fearing <vik@postgresfriends.org>  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes: fix initdb encoding/locale item

commit   : a842ba407c375b4088ee0fa569780b5328cdebe8    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 24 Aug 2023 21:44:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 24 Aug 2023 21:44:31 -0400    

Click here for diff

Reported-by: Jeff Davis  
  
Discussion:  https://postgr.es/m/c5369641862637c71a6c1c440ac7f122068ca4e7.camel@j-davis.com  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

pg_upgrade: Bump MESSAGE_WIDTH.

commit   : 2e7d15ab69d91abc874f6b5d89df4d7c5a4f2c17    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 24 Aug 2023 10:13:31 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 24 Aug 2023 10:13:31 -0700    

Click here for diff

Commit 7b378237aa added a status message to pg_upgrade that is 60  
characters wide.  Since the MESSAGE_WIDTH macro is currently set to  
60, there is no space between this new status message and the "ok"  
or "failed" indicator appended when the step completes.  To fix  
this problem, this commit increases the value of MESSAGE_WIDTH to  
62.  
  
Suggested-by: Bharath Rupireddy  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/CALj2ACVVvk1cYLtWVxHv%3DZ1Ubq%3DUES9fhKbUU4c9k4W%2BfEDnbw%40mail.gmail.com  
Backpatch-through: 16  

M src/bin/pg_upgrade/pg_upgrade.h

Avoid unnecessary plancache revalidation of utility statements.

commit   : ba0d737caa44d322c709c4d64e95de86b126f3e4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 24 Aug 2023 12:02:40 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 24 Aug 2023 12:02:40 -0400    

Click here for diff

Revalidation of a plancache entry (after a cache invalidation event)  
requires acquiring a snapshot.  Normally that is harmless, but not  
if the cached statement is one that needs to run without acquiring a  
snapshot.  We were already aware of that for TransactionStmts,  
but for some reason hadn't extrapolated to the other statements that  
PlannedStmtRequiresSnapshot() knows mustn't set a snapshot.  This can  
lead to unexpected failures of commands such as SET TRANSACTION  
ISOLATION LEVEL.  We can fix it in the same way, by excluding those  
command types from revalidation.  
  
However, we can do even better than that: there is no need to  
revalidate for any statement type for which parse analysis, rewrite,  
and plan steps do nothing interesting, which is nearly all utility  
commands.  To mechanize this, invent a parser function  
stmt_requires_parse_analysis() that tells whether parse analysis does  
anything beyond wrapping a CMD_UTILITY Query around the raw parse  
tree.  If that's what it does, then rewrite and plan will just  
skip the Query, so that it is not possible for the same raw parse  
tree to produce a different plan tree after cache invalidation.  
  
stmt_requires_parse_analysis() is basically equivalent to the  
existing function analyze_requires_snapshot(), except that for  
obscure reasons that function omits ReturnStmt and CallStmt.  
It is unclear whether those were oversights or intentional.  
I have not been able to demonstrate a bug from not acquiring a  
snapshot while analyzing these commands, but at best it seems mighty  
fragile.  It seems safer to acquire a snapshot for parse analysis of  
these commands too, which allows making stmt_requires_parse_analysis  
and analyze_requires_snapshot equivalent.  
  
In passing this fixes a second bug, which is that ResetPlanCache  
would exclude ReturnStmts and CallStmts from revalidation.  
That's surely *not* safe, since they contain parsable expressions.  
  
Per bug #18059 from Pavel Kulakov.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/18059-79c692f036b25346@postgresql.org  

M src/backend/parser/analyze.c
M src/backend/utils/cache/plancache.c
M src/include/parser/analyze.h
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/sql/plpgsql_call.sql

Fix lack of message pluralization

commit   : ce18252d0b48d206d42cfbe1028e48d776e01831    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 24 Aug 2023 14:22:02 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 24 Aug 2023 14:22:02 +0200    

Click here for diff

M src/backend/replication/slot.c

Update DECLARE_INDEX documentation

commit   : 4cdcff4d93b202fd30e6b3927874af9002247779    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 24 Aug 2023 13:59:40 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 24 Aug 2023 13:59:40 +0200    

Click here for diff

Update source code comment changes belonging to the changes in  
6a6389a08b.  
  
Discussion: https://www.postgresql.org/message-id/flat/75ae5875-3abc-dafc-8aec-73247ed41cde@eisentraut.org  

M src/include/catalog/genbki.h

Rename hook functions for debug_io_direct to match variable name.

commit   : 155c81463c26d908a1579b6d90e7b39b6f61df8b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 22 Aug 2023 14:12:45 +0200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 22 Aug 2023 14:12:45 +0200    

Click here for diff

Commit 319bae9a renamed the GUC.  Rename the check and assign functions  
to match, and alphabetize.  
  
Back-patch to 16.  
  
Author: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/2769341e-fa28-c2ee-3e4b-53fdcaaf2271%40eisentraut.org  

M src/backend/storage/file/fd.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc_hooks.h

Fix the error message when failing to restore the snapshot.

commit   : 13e2665df3d01de5b0e039eb41b5e358e2b29ae5    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 24 Aug 2023 14:51:57 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 24 Aug 2023 14:51:57 +0530    

Click here for diff

The SnapBuildRestoreContents() used a const value in the error message to  
indicate the size in bytes it was expecting to read from the serialized  
snapshot file. Fix it by reporting the size that was actually passed.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Backpatch-through: 16  
Discussion: http://postgr.es/m/OS0PR01MB5716D408364F7DF32221C08D941FA@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/snapbuild.c

Fix translation markers

commit   : 8179d1bdf7763bab8a55022268bcfada011e8a4f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 24 Aug 2023 10:24:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 24 Aug 2023 10:24:38 +0200    

Click here for diff

Conditionals cannot be inside gettext trigger functions, they must be  
applied outside.  

M src/backend/parser/parse_expr.c

pg_upgrade: Improve one log message

commit   : 8fa09a11c994b85a4f4e6c09c5465f561b17c22b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 24 Aug 2023 08:23:43 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 24 Aug 2023 08:23:43 +0200    

Click here for diff

The parenthesized plural is unnecessary here and inconsistent with  
nearby similar messages.  

M src/bin/pg_upgrade/check.c

do: PG 16 relnotes: clarify last seq/index view names

commit   : 7d8e7036177a9fce94a6b99a5a12d65568556fde    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 23 Aug 2023 21:33:03 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 23 Aug 2023 21:33:03 -0400    

Click here for diff

Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Meson: check for pg_config_paths.h left over from make

commit   : 5a16984ff1f3556f4bd29723e11d3594f41db90b    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 24 Aug 2023 10:33:48 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 24 Aug 2023 10:33:48 +1200    

Click here for diff

The meson build scripts attempt to find files left over from configure  
and fail, mentioning that "make maintainer-clean" should be run to remove  
these.  This seems to have been done for files generated from configure.  
pg_config_paths.h is generated during the actual make build, so seems to  
have been missed.  This would result in compilation using the wrong  
pg_config_paths.h file.  
  
Here we just add this file to generated_sources_ac so that meson errors  
out if pg_config_paths.h exists.  
  
Likely this wasn't noticed before because make maintainer-clean will  
remove pg_config_paths.h, however, people using the MSVC build scripts  
are more likely to run into issues and they have to manually remove  
these files and pg_config_paths.h wasn't listed as a conflicting file to  
remove in the meson log.  
  
Backpatch-through: 16, where meson support was added  
Discussion: https://postgr.es/m/CAApHDvqjYOxZfmLKAOWKFEE7LOr9_E6UA6YNmx9r8nxStcS3gg@mail.gmail.com  

M src/port/meson.build

ci: Make compute resources for CI configurable

commit   : e8a8cd05d4b9533cf5bff0f4a4ee83a40df62875    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    

Click here for diff

See prior commit for an explanation for the goal of the change and why it had  
to be split into two commits.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de  
Backpatch: 15-, where CI support was added  

M .cirrus.tasks.yml
A .cirrus.yml
M src/tools/ci/README

ci: Prepare to make compute resources for CI configurable

commit   : 9ed46c78a3625001a863bbcbfd5f1c696c1def46    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    

Click here for diff

cirrus-ci will soon restrict the amount of free resources every user gets (as  
have many other CI providers). For most users of CI that should not be an  
issue. But e.g. for cfbot it will be an issue.  
  
To allow configuring different resources on a per-repository basis, introduce  
infrastructure for overriding the task execution environment. Unfortunately  
this is not entirely trivial, as yaml anchors have to be defined before their  
use, and cirrus-ci only allows injecting additional contents at the end of  
.cirrus.yml.  
  
To deal with that, move the definition of the CI tasks to  
.cirrus.tasks.yml. The main .cirrus.yml is loaded first, then, if defined, the  
file referenced by the REPO_CI_CONFIG_GIT_URL variable, will be added,  
followed by the contents of .cirrus.tasks.yml. That allows  
REPO_CI_CONFIG_GIT_URL to override the yaml anchors defined in .cirrus.yml.  
  
Unfortunately git's default merge / rebase strategy does not handle copied  
files, just renamed ones. To avoid painful rebasing over this change, this  
commit just renames .cirrus.yml to .cirrus.tasks.yml, without adding a new  
.cirrus.yml. That's done in the followup commit, which moves the relevant  
portion of .cirrus.tasks.yml to .cirrus.yml.  Until that is done,  
REPO_CI_CONFIG_GIT_URL does not fully work.  
  
The subsequent commit adds documentation for how to configure custom compute  
resources to src/tools/ci/README  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de  
Backpatch: 15-, where CI support was added  

A .cirrus.star
R100 .cirrus.yml .cirrus.tasks.yml

ci: Use VMs for SanityCheck and CompilerWarnings

commit   : f518c909ead1be7c88ee1f53db13bdef7c50d1ca    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 12:29:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 12:29:50 -0700    

Click here for diff

The main reason for this change is to reduce different ways of executing  
tasks, making it easier to use custom compute resources for cfbot. A secondary  
benefit is that the tasks seem slightly faster this way, apparently the  
increased startup overhead is outweighed by reduced runtime overhead.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

ci: Move execution method of tasks into yaml templates

commit   : cad461b044b521c5f80d180194d6e27dce82c424    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 12:27:40 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 12:27:40 -0700    

Click here for diff

This is done in preparation for making the compute resources for CI  
configurable. It also looks cleaner.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

ci: Don't specify amount of memory

commit   : 5581a9a3953020dd9df18ffd00b788f296bd60e0    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 12:27:29 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 23 Aug 2023 12:27:29 -0700    

Click here for diff

The number of CPUs is the cost-determining factor. Most instance types that  
run tests have more memory/core than what we specified, there's no real  
benefit in wasting that.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

Fix _bt_allequalimage() call within critical section.

commit   : c3b874c431bc5d1399c011e9e5ce1e30b756f930    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 23 Aug 2023 18:08:40 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 23 Aug 2023 18:08:40 +0300    

Click here for diff

_bt_allequalimage() does complicated things, so it's not OK to call it  
in a critical section. Per buildfarm failure on 'prion', which uses  
-DRELCACHE_FORCE_RELEASE -DCATCACHE_FORCE_RELEASE options.  
  
Discussion: https://www.postgresql.org/message-id/6e5bbc08-cdfc-b2b3-9e23-1a914b9850a9@iki.fi  
Backpatch-through: 16, like commit ccadf73163 that introduced this  

M src/backend/access/nbtree/nbtree.c

Use the buffer cache when initializing an unlogged index.

commit   : 6bc1fd4e60e9556ba5e04710049fdf42e3134f47    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 23 Aug 2023 17:21:31 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 23 Aug 2023 17:21:31 +0300    

Click here for diff

Some of the ambuildempty functions used smgrwrite() directly, followed  
by smgrimmedsync(). A few small problems with that:  
  
Firstly, one is supposed to use smgrextend() when extending a  
relation, not smgrwrite(). It doesn't make much difference in  
production builds. smgrextend() updates the relation size cache, so  
you miss that, but that's harmless because we never use the cached  
relation size of an init fork. But if you compile with  
CHECK_WRITE_VS_EXTEND, you get an assertion failure.  
  
Secondly, the smgrwrite() calls were performed before WAL-logging, so  
the page image written to disk had 0/0 as the LSN, not the LSN of the  
WAL record. That's also harmless in practice, but seems sloppy.  
  
Thirdly, it's better to use the buffer cache, because then you don't  
need to smgrimmedsync() the relation to disk, which adds latency.  
Bypassing the cache makes sense for bulk operations like index  
creation, but not when you're just initializing an empty index.  
Creation of unlogged tables is hardly performance bottleneck in any  
real world applications, but nevertheless.  
  
Backpatch to v16, but no further. These issues should be harmless in  
practice, so better to not rock the boat in older branches.  
  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/6e5bbc08-cdfc-b2b3-9e23-1a914b9850a9@iki.fi  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spginsert.c

doc: Replace list of drivers and PLs with wiki link

commit   : 5fd424c87a86dd19d6cb15a18d1662ffc7368de1    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 23 Aug 2023 14:13:07 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 23 Aug 2023 14:13:07 +0200    

Click here for diff

The list of external language drivers and procedural languages was  
never complete or exhaustive, and rather than attempting to manage  
it the content has migrated to the wiki.  This replaces the tables  
altogether with links to the wiki as we regularly get requests for  
adding various projects,  which we reject without any clear policy  
for why or how the content should be managed.  
  
The threads linked to below are the most recent discussions about  
this, the archives contain many more.  
  
Backpatch to all supported branches since the list on the wiki  
applies to all branches.  
  
Author: Jonathan Katz <jkatz@postgresql.org>  
Discussion: https://postgr.es/m/169165415312.635.10247434927885764880@wrigleys.postgresql.org  
Discussion: https://postgr.es/m/169177958824.635.11087800083040275266@wrigleys.postgresql.org  
Backpatch-through: v11  

M doc/src/sgml/external-projects.sgml

doc: Add more ICU rules examples

commit   : 103df207a71e74d64173edcb7bacec872933755b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 23 Aug 2023 11:23:42 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 23 Aug 2023 11:23:42 +0200    

Click here for diff

In particular, add an example EBCDIC collation.  
  
Author: Daniel Verite <daniel@manitou-mail.org>  
Discussion: https://www.postgresql.org/message-id/flat/35cc1684-e516-4a01-a256-351632d47066@manitou-mail.org  

M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_database.sgml

doc: Improve ICU external link

commit   : 0b9127de12daf4b6eb33766a592c38fda3853bff    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 23 Aug 2023 08:25:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 23 Aug 2023 08:25:56 +0200    

Click here for diff

It previously pointed to the collation API documentation, which our  
users don't need, but the containing chapter seems useful.  

M doc/src/sgml/charset.sgml

Improve vertical spacing of documentation markup

commit   : 6f168e077e4671ecc0796e9aeb7ad61fc3e5b6dd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 23 Aug 2023 08:12:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 23 Aug 2023 08:12:50 +0200    

Click here for diff

M doc/src/sgml/charset.sgml

ExtendBufferedWhat -> BufferManagerRelation.

commit   : f58af9f416f95b1b396aab55c5978f277fe13ac7    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 23 Aug 2023 12:10:18 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 23 Aug 2023 12:10:18 +1200    

Click here for diff

Commit 31966b15 invented a way for functions dealing with relation  
extension to accept a Relation in online code and an SMgrRelation in  
recovery code.  It seems highly likely that future bufmgr.c interfaces  
will face the same problem, and need to do something similar.  
Generalize the names so that each interface doesn't have to re-invent  
the wheel.  
  
Back-patch to 16.  Since extension AM authors might start using the  
constructor macros once 16 ships, we agreed to do the rename in 16  
rather than waiting for 17.  
  
Reviewed-by: Peter Geoghegan <pg@bowt.ie>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CA%2BhUKG%2B6tLD2BhpRWycEoti6LVLyQq457UL4ticP5xd8LqHySA%40mail.gmail.com  

M contrib/bloom/blutils.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/sequence.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/freespace/freespace.c
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list

doc: PG 16 relnotes: properly indent and word-wrap text

commit   : d8cd49e992eb0d0f3d447d6b41866ce1b573b01d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 22 Aug 2023 19:37:26 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 22 Aug 2023 19:37:26 -0400    

Click here for diff

Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Fix pg_dump assertion failure when dumping pg_catalog.

commit   : 501704e826fc75d7d1c8976a8d177f8ce3ea0b4c    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 22 Aug 2023 11:21:36 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 22 Aug 2023 11:21:36 -0700    

Click here for diff

Commit 396d348b04 did not account for the default collation.  
  
Also, use pg_log_warning() instead of Assert().  
  
Discussion: https://postgr.es/m/ce071503fee88334aa70f360e6e4ea14d48305ee.camel%40j-davis.com  
Reviewed-by: Michael Paquier  
Backpatch-through: 15  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl

Cache by-reference missing values in a long lived context

commit   : f938acd68b08704a086b5f41eaf1989026d6f013    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 22 Aug 2023 11:57:08 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 22 Aug 2023 11:57:08 -0400    

Click here for diff

Attribute missing values might be needed past the lifetime of the tuple  
descriptors from which they are extracted. To avoid possibly using  
pointers for by-reference values which might thus be left dangling, we  
cache a datumCopy'd version of the datum in the TopMemoryContext. Since  
we first search for the value this only needs to be done once per  
session for any such value.  
  
Original complaint from Tom Lane, idea for mitigation by Andrew Dunstan,  
tweaked by Tom Lane.  
  
Backpatch to version 11 where missing values were introduced.  
  
Discussion: https://postgr.es/m/1306569.1687978174@sss.pgh.pa.us  

M src/backend/access/common/heaptuple.c
M src/tools/pgindent/typedefs.list

doc: PG 16 relnotes: separate out psql \drg item

commit   : e9f535463a12af2d4e7973dbf1db53c7097df31b    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 22 Aug 2023 15:15:24 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 22 Aug 2023 15:15:24 -0400    

Click here for diff

Reported-by: Pavel Luzanov  
  
Discussion: https://postgr.es/m/29b97504-80a3-fdcc-538e-cadde3d8ecd5@postgrespro.ru  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Add list of acknowledgments to release notes

commit   : 8c76a556658ddb56e33be5507131874776c00907    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 22 Aug 2023 10:54:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 22 Aug 2023 10:54:16 +0200    

Click here for diff

This contains all individuals mentioned in the commit messages during  
PostgreSQL 16 development.  
  
current through REL_16_BETA3  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes: adjust RANGE/ROWS window item

commit   : 7fb906d80aa07cd83ada2a60588679e68f635939    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 21 Aug 2023 18:55:41 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 21 Aug 2023 18:55:41 -0400    

Click here for diff

Reported-by: Erwin Brandstetter  
  
Discussion: https://postgr.es/m/CAGHENJ5Cj3wBH07YM5Lw2h5q8s65cNg_NEdkkWvmRo+vOormWw@mail.gmail.com  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes: move role INHERIT item and clarify it

commit   : 00be0bc3d57f1b01249429bc0a154ecb41e02e7f    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 21 Aug 2023 17:54:29 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 21 Aug 2023 17:54:29 -0400    

Click here for diff

Also split out new role ADMIN syntax entry.  
  
Reported-by: Pavel Luzanov  
  
Discussion: https://postgr.es/m/0ebcc8ea-7f5a-d014-d53f-e078622be35d@aklaver.com  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Fix pg_stat_reset_single_table_counters() for shared relations

commit   : d6af45052dc8a9d97a18e1a3b9febabd891ba270    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 21 Aug 2023 13:33:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 21 Aug 2023 13:33:04 +0900    

Click here for diff

This commit fixes the function of $subject for shared relations.  This  
feature has been added by e042678.  Unfortunately, this new behavior got  
removed by 5891c7a when moving statistics to shared memory.  
  
Reported-by: Mitsuru Hinata  
Author: Masahiro Ikeda  
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada  
Discussion: https://postgr.es/m/7cc69f863d9b1bc677544e3accd0e4b4@oss.nttdata.com  
Backpatch-through: 15  

M src/backend/utils/adt/pgstatfuncs.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

ci: macos: use cached macports install

commit   : dd2a731d9caffa8c9f6d82f2b72dd460b67decd7    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 19 Aug 2023 12:40:45 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 19 Aug 2023 12:40:45 -0700    

Click here for diff

A significant chunk of the time on the macos CI task is spent installing  
packages using homebrew. The downloads of the packages are cached, but the  
installation needs to happen every time. We can't cache the whole homebrew  
installation, because it is too large due to pre-installed packages.  
  
Speed this up by installing packages using macports and caching the  
installation as .dmg. That's a lot faster than unpacking a tarball.  
  
In addition, don't install llvm - it wasn't enabled when building, so it's  
just a waste of time/space.  
  
This substantially speeds up the mac CI time, both in the cold cache and in  
the warm cache case (the latter from ~1m20s to ~5s).  
  
It doesn't seem great to have diverging sources of packages for CI between  
branches, so backpatch to 15 (where CI was added).  
  
Discussion: https://postgr.es/m/20230805202539.r3umyamsnctysdc7@awork3.anarazel.de  
Backpatch: 15-, where CI was added  

M .cirrus.yml
A src/tools/ci/ci_macports_packages.sh

Remove dubious warning message from SQL/JSON functions

commit   : dcfc49c1b652dfe41273579aeaf6b454c51f037b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 18 Aug 2023 07:41:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 18 Aug 2023 07:41:14 +0200    

Click here for diff

There was a warning that FORMAT JSON has no effect on json/jsonb  
types, which is true, but it's not clear why we should issue a warning  
about it.  The SQL standard does not say anything about this, which  
should generally govern the behavior here.  So remove it.  
  
Discussion: https://www.postgresql.org/message-id/flat/dfec2cae-d17e-c508-6d16-c2dba82db486%40eisentraut.org  

M src/backend/parser/parse_expr.c
M src/test/regress/expected/sqljson.out

Invalidate smgr_targblock in smgrrelease().

commit   : 6337e994e89797d60b68ac6786c6a322ac00a382    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 17 Aug 2023 15:45:13 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 17 Aug 2023 15:45:13 +1200    

Click here for diff

In rare circumstances involving relfilenode reuse, it might have been  
possible for smgr_targblock to finish up pointing past the end.  
  
Oversight in b74e94dc.  Back-patch to 15.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/CA%2BhUKGJ8NTvqLHz6dqbQnt2c8XCki4r2QvXjBQcXpVwxTY_pvA%40mail.gmail.com  

M src/backend/storage/smgr/smgr.c

commit   : 11f4935490eb8597fcc0e3e71c2caf90e6154943    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 16 Aug 2023 22:22:12 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 16 Aug 2023 22:22:12 -0400    

Click here for diff

Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, initial markup

commit   : 6b86a3e0b421a0e0c9cfa02ddc0525e431379ee4    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 16 Aug 2023 14:34:49 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 16 Aug 2023 14:34:49 -0400    

Click here for diff

Still need to add links to doc sections.  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Unify some error messages

commit   : c672262779833a6b58cf5a4e85a9b76efd660cb7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 16 Aug 2023 16:17:00 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 16 Aug 2023 16:17:00 +0200    

Click here for diff

We had essentially the same error in several different wordings.  
Unify that.  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb_util.c
M src/interfaces/ecpg/test/expected/sql-sqljson.stderr
M src/test/regress/expected/sqljson.out

Improved CREATE SUBSCRIPTION message for clarity

commit   : 842b65905046be8a979a67484c9fd4110e4e2dfe    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 16 Aug 2023 15:09:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 16 Aug 2023 15:09:50 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/CAHut+PtfzQ7JRkb0-Y_UejAxaLQ17-bGMvV4MJJHcPoP3ML2bg@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

doc: PG 16 relnotes, update "current as of" date

commit   : c5c8bd29b9a22a05f81857c6921c0bc615140cc5    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 15 Aug 2023 09:15:21 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 15 Aug 2023 09:15:21 -0400    

Click here for diff

Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

De-pessimize ConditionVariableCancelSleep().

commit   : acc5c4fd8f83e5991cab11d7299d112e89cb3fe7    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 15 Aug 2023 10:20:11 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 15 Aug 2023 10:20:11 +1200    

Click here for diff

Commit b91dd9de was concerned with a theoretical problem with our  
non-atomic condition variable operations.  If you stop sleeping, and  
then cancel the sleep in a separate step, you might be signaled in  
between, and that could be lost.  That doesn't matter for callers of  
ConditionVariableBroadcast(), but callers of ConditionVariableSignal()  
might be upset if a signal went missing like this.  
  
Commit bc971f4025c interacted badly with that logic, because it doesn't  
use ConditionVariableSleep(), which would normally put us back in the  
wait list.  ConditionVariableCancelSleep() would be confused and think  
we'd received an extra signal, and try to forward it to another backend,  
resulting in wakeup storms.  
  
New idea: ConditionVariableCancelSleep() can just return true if we've  
been signaled.  Hypothetical users of ConditionVariableSignal() would  
then still have a way to deal with rare lost signals if they are  
concerned about that problem.  
  
Back-patch to 16, where bc971f4025c arrived.  
  
Reported-by: Tomas Vondra <tomas.vondra@enterprisedb.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/2840876b-4cfe-240f-0a7e-29ffd66711e7%40enterprisedb.com  

M src/backend/storage/lmgr/condition_variable.c
M src/include/storage/condition_variable.h

doc: PG 16 relnotes: udpate for commits since branching

commit   : 03fb43f6ed63fd2d52bf8ec305893a31ef0a38e5    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 14 Aug 2023 17:28:39 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 14 Aug 2023 17:28:39 -0400    

Click here for diff

Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

hio: Take number of prior relation extensions into account

commit   : d37ab378b6e773c278c14b9554a1ea23b355aab9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 14 Aug 2023 09:54:03 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 14 Aug 2023 09:54:03 -0700    

Click here for diff

The new relation extension logic, introduced in 00d1e02be24, could lead to  
slowdowns in some scenarios. E.g., when loading narrow rows into a table using  
COPY, the caller of RelationGetBufferForTuple() will only request a small  
number of pages. Without concurrency, we just extended using pwritev() in that  
case. However, if there is *some* concurrency, we switched between extending  
by a small number of pages and a larger number of pages, depending on the  
number of waiters for the relation extension logic.  However, some  
filesystems, XFS in particular, do not perform well when switching between  
extending files using fallocate() and pwritev().  
  
To avoid that issue, remember the number of prior relation extensions in  
BulkInsertState and extend more aggressively if there were prior relation  
extensions. That not just avoids the aforementioned slowdown, but also leads  
to noticeable performance gains in other situations, primarily due to  
extending more aggressively when there is no concurrency. I should have done  
it this way from the get go.  
  
Reported-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940=Kp6mszNGK3bq9yRN6g@mail.gmail.com  
Backpatch: 16-, where the new relation extension code was added  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/include/access/hio.h

ci: macos: Remove use of -Dsegsize_blocks=6

commit   : 2243ef8dd6fbe1f4ae3ffc7db1ee9af9427ecadb    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 12 Aug 2023 13:09:45 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 12 Aug 2023 13:09:45 -0700    

Click here for diff

The option causes a measurable slowdown. Macos is, by far, the most expensive  
platform for CI, therefore it doesn't make sense to run such a test there.  
  
d3b111e3205 used a small segment size for two tasks, one with autoconf, one  
with meson. In hindsight that is a bit overkill, it's unlikely that the option  
would silently break. Thus don't move the -Dsegsize_blocks=6, just remove  
it. I did however change the autoconf test to use 6 instead of 8 blocks, as  
long as we allow it, a non-power-of-two test seems like a good idea.  
  
While at it, add a comment explaining why we use a small segment size for CI.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de  
Backpatch: 16-, where d3b111e3205 introduced the use of -Dsegsize_blocks=6  

M .cirrus.yml

ci: macos: Remove use of -DRANDOMIZE_ALLOCATED_MEMORY

commit   : 4bec616f26f5f39a6819804f2b7992495a1a7a6f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 12 Aug 2023 13:06:04 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 12 Aug 2023 13:06:04 -0700    

Click here for diff

RANDOMIZE_ALLOCATED_MEMORY causes a measurable slowdown. Macos is, by far, the  
most expensive platform for CI, therefore it doesn't make sense to run such a  
test there.  
  
Ubsan and asan on linux should detect most of the the cases of uninitialized  
memory, so it doesn't really seem worth using -DRANDOMIZE_ALLOCATED_MEMORY in  
another instance type.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de  
Backpatch: 16-, where 89d16b635 added the use of -DRANDOMIZE_ALLOCATED_MEMORY  

M .cirrus.yml

Fix off-by-one in XLogRecordMaxSize check.

commit   : 7823a298ba5c54a67f98c928f73500bc4089449f    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 12 Aug 2023 14:37:05 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 12 Aug 2023 14:37:05 -0700    

Click here for diff

pg_logical_emit_message(false, '_', repeat('x', 1069547465)) failed with  
self-contradictory message "WAL record would be 1069547520 bytes (of  
maximum 1069547520 bytes)".  There's no particular benefit from allowing  
or denying one byte in either direction; XLogRecordMaxSize could rise a  
few megabytes without trouble.  Hence, this is just for cleanliness.  
Back-patch to v16, where this check first appeared.  

M src/backend/access/transam/xloginsert.c

Remove test from commit fa2e874946.

commit   : 7bed93a469bfa6954ce937b72ef1dc76fda7159e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 10 Aug 2023 10:16:59 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 10 Aug 2023 10:16:59 -0700    

Click here for diff

The fix itself is fine, but the test revealed other problems related  
to parallel query that are not easily fixable. Remove the test for  
now to fix the buildfarm.  
  
Discussion: https://postgr.es/m/88825.1691665432@sss.pgh.pa.us  
Backpatch-through: 11  

D src/test/isolation/expected/search-path-inval.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/search-path-inval.spec

Document RelationGetIndexAttrBitmap better

commit   : 1b594a326a88bf1604360daa5a274096c0762fec    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 10 Aug 2023 12:04:07 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 10 Aug 2023 12:04:07 +0200    

Click here for diff

Commit 19d8e2308bc5 changed the list of set-of-columns that can be  
returned by RelationGetIndexAttrBitmap, but didn't update its  
"documentation".  That was pretty hard to read already, so rewrite to  
make it more comprehensible, adding the missing values while at it.  
  
Backpatch to 16, like that commit.  
  
Discussion: https://postgr.es/m/20230809091155.7c7f3gttjk3dj4ze@alvherre.pgsql  
Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>  

M src/backend/utils/cache/relcache.c
M src/include/utils/relcache.h

doc: PG 16 relnotes, mark current as of 2023-08-09

commit   : c8c033f721de1e25c90acf146fabee77c9dbf92e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 22:09:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 22:09:17 -0400    

Click here for diff

Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, move createuser and SCM items

commit   : fc3e21282fae2b5b44c59e56e1fc4958915bd817    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 20:48:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 20:48:31 -0400    

Click here for diff

Reported-by: Noah Misch  
  
Discussion: https://postgr.es/m/20230805230847.GA1370050@rfd.leadboat.com  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, small wording improvement

commit   : 0752461d3a1114d560225fae7522dde0ab544b63    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 20:37:41 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 20:37:41 -0400    

Click here for diff

Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, merge and adjust CREATEROLE items

commit   : 6e1d1c58488e685370de0becc5a81d6502a8e099    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 18:01:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 18:01:50 -0400    

Click here for diff

Reported-by: Noah Misch  
  
Discussion: https://postgr.es/m/20230805230847.GA1370050@rfd.leadboat.com  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, add Windows 10 huge pages fix

commit   : 89cadf30c605d509f12b0b7f80119cbba38efc6e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 17:47:03 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 17:47:03 -0400    

Click here for diff

Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/ZL0M28/L+grYR8o7@paquier.xyz  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Recalculate search_path after ALTER ROLE.

commit   : 0d56c32c8e724f96f4aa5b15645d427f6e2ddf21    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 7 Aug 2023 15:13:06 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 7 Aug 2023 15:13:06 -0700    

Click here for diff

Renaming a role can affect the meaning of the special string $user, so  
must cause search_path to be recalculated.  
  
Discussion: https://postgr.es/m/186761d32c0255debbdf50b6310b581b9c973e6c.camel@j-davis.com  
Reviewed-by: Nathan Bossart, Michael Paquier  
Backpatch-through: 11  

M src/backend/catalog/namespace.c
A src/test/isolation/expected/search-path-inval.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/search-path-inval.spec

doc: PG 16 relnotes, fix various typos

commit   : e90308ae6b4a468d089733cc6f650bda144c01cc    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 13:56:26 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 13:56:26 -0400    

Click here for diff

Reported-by: Erik Rijkers  
  
Discussion: https://postgr.es/m/9c83328b-c0ff-070f-f2be-c3dce484e182@xs4all.nl  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, adjust \ef+ body comment to mention \sf

commit   : 98cb73f5c98de86e85a90c06babdd7b1a37540db    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 13:23:39 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 13:23:39 -0400    

Click here for diff

Reported-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/99d731a543501eb31bf7b8db43d231a037d7cc80.camel@cybertec.at  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, remove MAINTAIN item

commit   : 86415153f47a4ad8e332262592e0a32f14f226c6    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 11:16:26 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 9 Aug 2023 11:16:26 -0400    

Click here for diff

Feature was removed by commit 957445996f.  
  
Discussion: 957445996f  
  
Backpatch-through: 16  

M doc/src/sgml/release-16.sgml

Stamp 16beta3.

commit   : 0dd5545378d79bc0080dd34824f428458cf7448d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 7 Aug 2023 16:05:20 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 7 Aug 2023 16:05:20 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

Reject substituting extension schemas or owners matching ["$'\].

commit   : f53511010b72d7d314e22be7c63ef94792fee345    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 7 Aug 2023 06:05:56 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 7 Aug 2023 06:05:56 -0700    

Click here for diff

Substituting such values in extension scripts facilitated SQL injection  
when @extowner@, @extschema@, or @extschema:...@ appeared inside a  
quoting construct (dollar quoting, '', or "").  No bundled extension was  
vulnerable.  Vulnerable uses do appear in a documentation example and in  
non-bundled extensions.  Hence, the attack prerequisite was an  
administrator having installed files of a vulnerable, trusted,  
non-bundled extension.  Subject to that prerequisite, this enabled an  
attacker having database-level CREATE privilege to execute arbitrary  
code as the bootstrap superuser.  By blocking this attack in the core  
server, there's no need to modify individual extensions.  Back-patch to  
v11 (all supported versions).  
  
Reported by Micah Gate, Valerie Woolard, Tim Carey-Smith, and Christoph  
Berg.  
  
Security: CVE-2023-39417  

M src/backend/commands/extension.c
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext_extschema–1.0.sql
A src/test/modules/test_extensions/test_ext_extschema.control

Translation updates

commit   : e8386b2cef7741aa4e49870691d67f792d5f6789    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 7 Aug 2023 12:06:49 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 7 Aug 2023 12:06:49 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 97398d714ace69f0c919984e160f429b6fd2300e  

M src/backend/po/de.po
M src/backend/po/fr.po
M src/backend/po/ja.po
M src/backend/po/sv.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ka.po
M src/bin/initdb/po/sv.po
M src/bin/pg_archivecleanup/po/ja.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/ka.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_config/po/fr.po
M src/bin/pg_config/po/sv.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/sv.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/ka.po
M src/bin/pg_dump/po/sv.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_rewind/po/ka.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_upgrade/po/fr.po
M src/bin/pg_upgrade/po/ka.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/pg_verifybackup/po/fr.po
M src/bin/pg_verifybackup/po/sv.po
M src/bin/pg_waldump/po/fr.po
M src/bin/pg_waldump/po/sv.po
M src/bin/psql/po/de.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/ka.po
M src/bin/psql/po/sv.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/ka.po
M src/bin/scripts/po/sv.po
M src/interfaces/libpq/po/fr.po
M src/interfaces/libpq/po/ka.po
M src/interfaces/libpq/po/sv.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/ka.po
M src/pl/plpython/po/sv.po

Don't Memoize lateral joins with volatile join conditions

commit   : ae89129aa3555c263b8c3ccc4c0f1ef7e46201aa    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 7 Aug 2023 22:14:54 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 7 Aug 2023 22:14:54 +1200    

Click here for diff

The use of Memoize was already disabled in normal joins when the join  
conditions had volatile functions per the code in  
match_opclause_to_indexcol().  Ordinarily, the parameterization for the  
inner side of a nested loop will be an Index Scan or at least eventually  
lead to an index scan (perhaps nested several joins deep). However, for  
lateral joins, that's not the case and seq scans can be parameterized  
too, so we can't rely on match_opclause_to_indexcol().  
  
Here we explicitly check the parameterization for volatile functions and  
don't consider the generation of a Memoize path when such functions  
are present.  
  
Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs49nHFnHbpepLsv_yF3qkpCS4BdB-v8HoJVv8_=Oat0u_w@mail.gmail.com  
Backpatch-through: 14, where Memoize was introduced  

M src/backend/optimizer/path/joinpath.c

Fix RLS policy usage in MERGE.

commit   : 67a007dc0cdb8578726c2000a7abc513109cb4a2    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Mon, 7 Aug 2023 09:27:09 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Mon, 7 Aug 2023 09:27:09 +0100    

Click here for diff

If MERGE executes an UPDATE action on a table with row-level security,  
the code incorrectly applied the WITH CHECK clauses from the target  
table's INSERT policies to new rows, instead of the clauses from the  
table's UPDATE policies. In addition, it failed to check new rows  
against the target table's SELECT policies, if SELECT permissions were  
required (likely to always be the case).  
  
In addition, if MERGE executes a DO NOTHING action for matched rows,  
the code incorrectly applied the USING clauses from the target table's  
DELETE policies to existing target tuples. These policies were applied  
as checks that would throw an error, if they did not pass.  
  
Fix this, so that a MERGE UPDATE action applies the same RLS policies  
as a plain UPDATE query with a WHERE clause, and a DO NOTHING action  
does not apply any RLS checks (other than adding clauses from SELECT  
policies to the join).  
  
Back-patch to v15, where MERGE was introduced.  
  
Dean Rasheed, reviewed by Stephen Frost.  
  
Security: CVE-2023-39418  

M src/backend/executor/nodeModifyTable.c
M src/backend/rewrite/rowsecurity.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Doc: update documentation for creating custom scan paths.

commit   : f0a3805d7c44ed1c01668061bc2f6458e7b1369a    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 3 Aug 2023 17:45:01 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 3 Aug 2023 17:45:01 +0900    

Click here for diff

Commit f49842d1e added a new callback for custom scan paths, but missed  
updating the documentation.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAPmGK15ODkN%2B%3DhkBCufj1HBW0x5OTb65Xuy7ryXchMdiCMpx_g%40mail.gmail.com  

M doc/src/sgml/custom-scan.sgml

Update comments on CustomPath struct.

commit   : c575e00230ed1262edb7845e2e9a22ec164bf9f0    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 3 Aug 2023 17:15:01 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 3 Aug 2023 17:15:01 +0900    

Click here for diff

Commit e7cb7ee14 allowed custom scan providers to create CustomPath  
paths for join relations as well, but missed updating the comments.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAPmGK15ODkN%2B%3DhkBCufj1HBW0x5OTb65Xuy7ryXchMdiCMpx_g%40mail.gmail.com  

M src/include/nodes/pathnodes.h

Fix ReorderBufferCheckMemoryLimit() comment.

commit   : 5c0fcef76a44bb834d4d13685b877e62409e6984    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 2 Aug 2023 15:01:10 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 2 Aug 2023 15:01:10 +0900    

Click here for diff

Commit 7259736a6 updated the comment but it was not correct since  
ReorderBufferLargestStreamableTopTXN() returns only top-level  
transactions.  
  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoA9XB7OR86BqvrCe2dMYX%2BZv3-BvVmjF%3DGY2z6jN-kqjg%40mail.gmail.com  
Backpatch-through: 14  

M src/backend/replication/logical/reorderbuffer.c

Fix pg_stat_io buffer reuse test instability

commit   : 803660ea4c5d9d2b3c7e1b0a9fc4b99359ba0a85    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 1 Aug 2023 11:22:03 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 1 Aug 2023 11:22:03 -0700    

Click here for diff

The stats regression test attempts to ensure that Buffer Access Strategy  
"reuses" are being counted in pg_stat_io by vacuuming a table which is larger  
than the size of the strategy ring. However, when shared buffers are in  
sufficiently high demand, another backend could evict one of the blocks in the  
strategy ring before the first backend has a chance to reuse the buffer. The  
backend using the strategy would then evict another shared buffer and add that  
buffer to the strategy ring. This counts as an eviction and not a reuse in  
pg_stat_io. Count both evictions and reuses in the test to ensure it does not  
fail incorrectly.  
  
Reported-by: Jeff Davis <pgsql@j-davis.com>,  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/CAAKRu_bNG27AxG9TdPtwsL6wg8AWbVckjmTL2t1HF=miDQuNtw@mail.gmail.com  

M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Fix performance regression in pg_strtointNN_safe functions

commit   : 4e2e75cd29eb7bc591afe30fd7425629fe2c5a5d    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 2 Aug 2023 12:06:08 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 2 Aug 2023 12:06:08 +1200    

Click here for diff

Between 6fcda9aba and 1b6f632a3, the pg_strtoint functions became quite  
a bit slower in v16, despite efforts in 6b423ec67 to speed these up.  
  
Since the majority of cases for these functions will only contain  
base-10 digits, perhaps prefixed by a '-', it makes sense to have a  
special case for this and just fall back on the more complex version  
which processes hex, octal, binary and underscores if the fast path  
version fails to parse the string.  
  
While we're here, update the header comments for these functions to  
mention that hex, octal and binary formats along with underscore  
separators are now supported.  
  
Author: Andres Freund, David Rowley  
Reported-by: Masahiko Sawada  
Reviewed-by: Dean Rasheed, John Naylor  
Discussion: https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940%3DKp6mszNGK3bq9yRN6g%40mail.gmail.com  
Backpatch-through: 16, where 6fcda9aba and 1b6f632a3 were added  

M src/backend/utils/adt/numutils.c

Fix overly strict Assert in jsonpath code

commit   : b25acc302524cf61bee46e1aad5bebb276449270    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 2 Aug 2023 01:40:27 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 2 Aug 2023 01:40:27 +1200    

Click here for diff

This was failing for queries which try to get the .type() of a  
jpiLikeRegex.  For example:  
  
select jsonb_path_query('["string", "string"]',  
                        '($[0] like_regex ".{7}").type()');  
  
Reported-by: Alexander Kozhemyakin  
Bug: #18035  
Discussion: https://postgr.es/m/18035-64af5cdcb5adf2a9@postgresql.org  
Backpatch-through: 12, where SQL/JSON path was added.  

M src/backend/utils/adt/jsonpath.c

Disallow replacing joins with scans in problematic cases.

commit   : 695f5deb7902865901eb2d50a70523af655c3a00    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 28 Jul 2023 15:45:01 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 28 Jul 2023 15:45:01 +0900    

Click here for diff

Commit e7cb7ee14, which introduced the infrastructure for FDWs and  
custom scan providers to replace joins with scans, failed to add support  
handling of pseudoconstant quals assigned to replaced joins in  
createplan.c, leading to an incorrect plan without a gating Result node  
when postgres_fdw replaced a join with such a qual.  
  
To fix, we could add the support by 1) modifying the ForeignPath and  
CustomPath structs to store the list of RestrictInfo nodes to apply to  
the join, as in JoinPaths, if they represent foreign and custom scans  
replacing a join with a scan, and by 2) modifying create_scan_plan() in  
createplan.c to use that list in that case, instead of the  
baserestrictinfo list, to get pseudoconstant quals assigned to the join;  
but #1 would cause an ABI break.  So fix by modifying the infrastructure  
to just disallow replacing joins with such quals.  
  
Back-patch to all supported branches.  
  
Reported by Nishant Sharma.  Patch by me, reviewed by Nishant Sharma and  
Richard Guo.  
  
Discussion: https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/optimizer/restrictinfo.h

Eliminate fixed token-length limit in hba.c.

commit   : de3f0e3fe0e7d44620111c5723504a3a6e8c046e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 27 Jul 2023 11:56:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 27 Jul 2023 11:56:35 -0400    

Click here for diff

Historically, hba.c limited tokens in the authentication configuration  
files (pg_hba.conf and pg_ident.conf) to less than 256 bytes.  We have  
seen a few reports of this limit causing problems; notably, for  
moderately-complex LDAP configurations.  Let's get rid of the fixed  
limit by using a StringInfo instead of a fixed-size buffer.  
This actually takes less code than before, since we can get rid of  
a nontrivial error recovery stanza.  It's doubtless a hair slower,  
but parsing the content of the HBA files should in no way be  
performance-critical.  
  
Although this is a pretty straightforward patch, it doesn't seem  
worth the risk to back-patch given the small number of complaints  
to date.  In released branches, we'll just raise MAX_TOKEN to  
ameliorate the problem.  
  
Discussion: https://postgr.es/m/1588937.1690221208@sss.pgh.pa.us  

M src/backend/libpq/hba.c

Fix performance problem with new COPY DEFAULT code

commit   : c1308ce2d9224f0ec08128ab35e161837f9a5105    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 27 Jul 2023 14:48:44 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 27 Jul 2023 14:48:44 +1200    

Click here for diff

9f8377f7a added code to allow COPY FROM insert a column's default value  
when the input matches the DEFAULT string specified in the COPY command.  
  
Here we fix some inefficient code which needlessly palloc0'd an array to  
store if we should use the default value or input value for the given  
column.  This array was being palloc0'd and pfree'd once per row.  It's  
much more efficient to allocate this once and just reset the values once  
per row.  
  
Reported-by: Masahiko Sawada  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940%3DKp6mszNGK3bq9yRN6g%40mail.gmail.com  
Backpatch-through: 16, where 9f8377f7a was introduced.  

M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c

Fix crash with RemoveFromWaitQueue() when detecting a deadlock.

commit   : b4f14d2e433bf9f2499f07bcaca07b9ff13d641b    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 26 Jul 2023 14:41:23 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 26 Jul 2023 14:41:23 +0900    

Click here for diff

Commit 5764f611e used dclist_delete_from() to remove the proc from the  
wait queue. However, since it doesn't clear dist_node's next/prev to  
NULL, it could call RemoveFromWaitQueue() twice: when the process  
detects a deadlock and then when cleaning up locks on aborting the  
transaction. The waiting lock information is cleared in the first  
call, so it led to a crash in the second call.  
  
Backpatch to v16, where the change was introduced.  
  
Bug: #18031  
Reported-by: Justin Pryzby, Alexander Lakhin  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/ZKy4AdrLEfbqrxGJ%40telsasoft.com  
Discussion: https://postgr.es/m/18031-ebe2d08cb405f6cc@postgresql.org  
Backpatch-through: 16  

M src/backend/storage/lmgr/lock.c

Remove unnecessary checks for indexes for REPLICA IDENTITY FULL tables.

commit   : 35c85c3c9b90eb70937c8f409d2e7615b2bdb538    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 25 Jul 2023 15:09:31 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 25 Jul 2023 15:09:31 +0900    

Click here for diff

Previously, when selecting an usable index for update/delete for the  
REPLICA IDENTITY FULL table, in IsIndexOnlyExpression(), we used to  
check if all index fields are not expressions. However, it was not  
necessary, because it is enough to check if only the leftmost index  
field is not an expression (and references the remote table column)  
and this check has already been done by  
RemoteRelContainsLeftMostColumnOnIdx().  
  
This commit removes IsIndexOnlyExpression() and  
RemoteRelContainsLeftMostColumnOnIdx() and all checks for usable  
indexes for REPLICA IDENTITY FULL tables are now performed by  
IsIndexUsableForReplicaIdentityFull().  
  
Backpatch this to remain the code consistent.  
  
Reported-by: Peter Smith  
Reviewed-by: Amit Kapila, Önder Kalacı  
Discussion: https://postgr.es/m/CAHut%2BPsGRE5WSsY0jcLHJEoA17MrbP9yy8FxdjC_ZOAACxbt%2BQ%40mail.gmail.com  
Backpatch-through: 16  

M src/backend/executor/execReplication.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalrelation.h

Fix the display of UNKNOWN message type in apply worker.

commit   : ad486b0eaef4b2fcb7c672fcbf5c2f31eb99ac83    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 25 Jul 2023 09:01:29 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 25 Jul 2023 09:01:29 +0530    

Click here for diff

We include the message type while displaying an error context in the  
apply worker. Now, while retrieving the message type string if the  
message type is unknown we throw an error that will hide the original  
error. So, instead, we need to simply return the string indicating an  
unknown message type.  
  
Reported-by: Ashutosh Bapat  
Author: Euler Taveira, Amit Kapila  
Reviewed-by: Ashutosh Bapat  
Backpatch-through: 15  
Discussion: https://postgr.es/m/CAExHW5suAEDW-mBZt_qu4RVxWZ1vL54-L+ci2zreYWebpzxYsA@mail.gmail.com  

M src/backend/replication/logical/proto.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalproto.h

Fix off-by-one in LimitAdditionalPins()

commit   : bd2f46c6559ddcafe7bae5015ac45b69bc014067    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 24 Jul 2023 19:07:52 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 24 Jul 2023 19:07:52 -0700    

Click here for diff

Due to the bug LimitAdditionalPins() could return 0, violating  
LimitAdditionalPins()'s API ("One additional pin is always allowed"). This  
could be hit when setting shared_buffers very low and using a fair amount of  
concurrency.  
  
This bug was introduced in 31966b151e6a.  
  
Author: "Anton A. Melnikov" <aamelnikov@inbox.ru>  
Reported-by: "Anton A. Melnikov" <aamelnikov@inbox.ru>  
Reported-by: Victoria Shepard  
Discussion: https://postgr.es/m/ae46f2fb-5586-3de0-b54b-1bb0f6410ebd@inbox.ru  
Backpatch: 16-  

M src/backend/storage/buffer/bufmgr.c

Make test_decoding ddl.out shorter

commit   : b1dc946eee3d8d4fd9776ccbc21bcb4ab747b998    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 24 Jul 2023 17:48:06 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 24 Jul 2023 17:48:06 +0200    

Click here for diff

Some of the test_decoding test output was extremely wide, because it  
deals with massive toasted values, and the aligned mode causes psql to  
produce 200kB of whitespace and dashes. Change to unaligned mode  
temporarily to avoid that behavior.  
  
Backpatch to 14, where it applies cleanly.  
  
Discussion: https://postgr.es/m/20230405103953.sxleixp3uz5lazst@alvherre.pgsql  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql

Compare only major versions in AdjustUpgrade.pm

commit   : 28ce9d51f9082318e84f2a84385871394dcf2130    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 24 Jul 2023 17:14:22 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 24 Jul 2023 17:14:22 +0200    

Click here for diff

Because PostgreSQL::Version is very nuanced about development version  
numbers, the comparison to 16beta2 makes it think that that release is  
older than 16, therefore applying a database tweak that doesn't work  
there (the comparison is only supposed to match when run on version 15).  
As suggested by Andrew Dunstan, fix by having AdjustUpgrade.pm public  
methods create a separate PostgreSQL::Version object to use for these  
comparisons, that only carries the major version number.  
  
While at it, have the same methods ensure that the objects given are of  
the expected type.  
  
Backpatch to 16.  This module goes all the way back to 9.2, but there's  
probably no need for this fix except where betas still live.  
  
Co-authored-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/20230719110504.zbu74o54bqqlsufb@alvherre.pgsql  

M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm

Avoid compiler warning in non-assert builds.

commit   : 11237e5a46ca2221aca5c74bf43bb58eff8dcc3b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 22 Jul 2023 10:32:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 22 Jul 2023 10:32:52 -0400    

Click here for diff

After 3c90dcd03, try_partitionwise_join's child_joinrelids  
variable is read only in an Assert, provoking a compiler  
warning in non-assert builds.  Rearrange code to avoid the  
warning and eliminate unnecessary work in the non-assert case.  
  
Per CI testing (via Jeff Davis and Bharath Rupireddy)  
  
Discussion: https://postgr.es/m/ef0de9713e605451f1b60b30648c5ee900b2394c.camel@j-davis.com  

M src/backend/optimizer/path/joinrels.c

Fix calculation of relid sets for partitionwise child joins.

commit   : f75595cd80d134d5a63929a90a0347ff9729b79a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 21 Jul 2023 12:00:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 21 Jul 2023 12:00:14 -0400    

Click here for diff

Applying add_outer_joins_to_relids() to a child join doesn't actually  
work, even if we've built a SpecialJoinInfo specialized to the child,  
because that function will also compare the join's relids to elements  
of the main join_info_list, which only deal in regular relids not  
child relids.  This mistake escaped detection by the existing  
partitionwise join tests because they didn't test any cases where  
add_outer_joins_to_relids() needs to add additional OJ relids (that  
is, any cases where join reordering per identity 3 is possible).  
  
Instead, let's apply adjust_child_relids() to the relids of the parent  
join.  This requires minor code reordering to collect the relevant  
AppendRelInfo structures first, but that's work we'd do shortly anyway.  
  
Report and fix by Richard Guo; cosmetic changes by me  
  
Discussion: https://postgr.es/m/CAMbWs49NCNbyubZWgci3o=_OTY=snCfAPtMnM-32f3mm-K-Ckw@mail.gmail.com  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/relnode.c
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Don't include CaseTestExpr in JsonValueExpr.formatted_expr

commit   : 66a9003e2e3ec05e9b62d6bfb6797fa35fb01d15    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 21 Jul 2023 19:28:31 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 21 Jul 2023 19:28:31 +0900    

Click here for diff

A CaseTestExpr is currently being put into  
JsonValueExpr.formatted_expr as placeholder for the result of  
evaluating JsonValueExpr.raw_expr, which in turn is evaluated  
separately.  Though, there's no need for this indirection if  
raw_expr itself can be embedded into formatted_expr and evaluated  
as part of evaluating the latter, especially as there is no  
special reason to evaluate it separately.  So this commit makes it  
so.  As a result, JsonValueExpr.raw_expr no longer needs to be  
evaluated in ExecInterpExpr(), eval_const_exprs_mutator() etc. and  
is now only used for displaying the original "unformatted"  
expression in ruleutils.c.  Comments about and the code manipulating  
formatted_expr is updated to mention that it is now always set and  
is the expression that gives a JsonValueExpr its runtime value.  
  
While at it, this also removes the function makeCaseTestExpr(),  
because the code in makeJsonConstructorExpr() looks more readable  
without it IMO and isn't used by anyone else either.  
  
Finally, a note is added in the comment above CaseTestExpr's  
definition that JsonConstructorExpr is also using it.  
  
Backpatched to 16 from the development branch to keep the code in  
sync across branches.  
  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/include/nodes/makefuncs.h
M src/include/nodes/primnodes.h

Guard against null plan pointer in CachedPlanIsSimplyValid().

commit   : c0f53139611cf6b24175bea27bfbddb0ea5b7378    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 20 Jul 2023 14:23:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 20 Jul 2023 14:23:46 -0400    

Click here for diff

If both the passed-in plan pointer and plansource->gplan are  
NULL, CachedPlanIsSimplyValid would think that the plan pointer  
is possibly-valid and try to dereference it.  For the one extant  
call site in plpgsql, this situation doesn't normally happen  
which is why we've not noticed. However, it appears to be possible  
if the previous use of the cached plan failed, as per report from  
Justin Pryzby.  Add an extra check to prevent crashing.  
Back-patch to v13 where this code was added.  
  
Discussion: https://postgr.es/m/ZLlV+STFz1l/WhAQ@telsasoft.com  

M src/backend/utils/cache/plancache.c

Pass constructName to transformJsonValueExpr()

commit   : 7825a1b01e400434835253b4ff38dd96d823d454    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Thu, 20 Jul 2023 16:23:49 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Thu, 20 Jul 2023 16:23:49 +0900    

Click here for diff

This allows it to pass to coerce_to_specific_type() the actual name  
corresponding to the specific JSON_* function expression being  
transformed, instead of the currently hardcoded string.  
  
Backpatched to 16 from the development branch to keep the code in  
sync across branches.  
  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/CA+HiwqHu58pO3cJ7rB6ZLwUztVdG1J66xSjDdjfan5uT5NhESw@mail.gmail.com  

M src/backend/parser/parse_expr.c

Add psql \drg command to display role grants.

commit   : 0a1d2a7df852f16c452eef8a83003943125162c7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 19 Jul 2023 12:46:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 19 Jul 2023 12:46:30 -0400    

Click here for diff

With the addition of INHERIT and SET options for role grants,  
the historical display of role memberships in \du/\dg is woefully  
inadequate.  Besides those options, there are pre-existing  
shortcomings that you can't see the ADMIN option nor the grantor.  
  
To fix this, remove the "Member of" column from \du/\dg altogether  
(making that output usefully narrower), and invent a new meta-command  
"\drg" that is specifically for displaying role memberships.  It  
shows one row for each role granted to the selected role(s), with  
the grant options and grantor.  
  
We would not normally back-patch such a feature addition post  
feature freeze, but in this case the change is mainly driven by  
v16 changes in the server, so it seems appropriate to include it  
in v16.  
  
Pavel Luzanov, with bikeshedding and review from a lot of people,  
but particularly David Johnston  
  
Discussion: https://postgr.es/m/b9be2d0e-a9bc-0a30-492f-a4f68e4f7740@postgrespro.ru  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/tab-complete.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Doc: improve description of IN and row-constructor comparisons.

commit   : 245d0e6d0d1cc563c986fa34736b111bdf260af0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 19 Jul 2023 11:00:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 19 Jul 2023 11:00:34 -0400    

Click here for diff

IN and NOT IN work fine on records and arrays, so just say that  
they accept "expressions" not "scalar expressions".  I think that  
that phrasing was meant to say that they don't work on set-returning  
expressions, but that's not the common meaning of "scalar".  
  
Revise the description of row-constructor comparisons to make it  
perhaps a bit less confusing.  (This partially reverts some  
dubious wording changes made by commit f56651519.)  
  
Per gripe from Ilya Nenashev.  Back-patch to supported branches.  
In HEAD and v16, also drop a NOTE about pre-8.2 behavior, which  
is hopefully no longer of interest to anybody.  
  
Discussion: https://postgr.es/m/168968062460.632.14303906825812821399@wrigleys.postgresql.org  

M doc/src/sgml/func.sgml

Doc: fix out-of-date example of SPI usage.

commit   : e6e451c1d7e5bc70f0f3a63cbf06eb298f56a76e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 18 Jul 2023 11:59:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 18 Jul 2023 11:59:39 -0400    

Click here for diff

The "count" argument of SPI_exec() only limits execution when  
the query is actually returning rows.  This was not the case  
before PG 9.0, so this example was correct when written; but  
we missed updating it in commit 2ddc600f8.  Extend the example  
to show the behavior both with and without RETURNING.  
  
While here, improve the commentary and markup for the rest  
of the example.  
  
David G. Johnston and Tom Lane, per report from Curt Kolovson.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CANhYJV6HWtgz_qjx_APfK0PAgLUzY-2vjLuj7i_o=TZF1LAQew@mail.gmail.com  

M doc/src/sgml/spi.sgml

Fix indentation in twophase.c

commit   : 926aa6d11bde9f0b6b0e45ca5a26646aacac8be3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 18 Jul 2023 14:04:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 18 Jul 2023 14:04:46 +0900    

Click here for diff

This has been missed in cb0cca1, noticed before buildfarm member koel  
has been able to complain while poking at a different patch.  Like the  
other commit, backpatch all the way down to limit the odds of merge  
conflicts.  
  
Backpatch-through: 11  

M src/backend/access/transam/twophase.c

Fix recovery of 2PC transaction during crash recovery

commit   : f88bc9f3883970327598271d26afdb525112874b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 18 Jul 2023 13:44:27 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 18 Jul 2023 13:44:27 +0900    

Click here for diff

A crash in the middle of a checkpoint with some two-phase state data  
already flushed to disk by this checkpoint could cause a follow-up crash  
recovery to recover twice the same transaction, once from what has been  
found in pg_twophase/ at the beginning of recovery and a second time  
when replaying its corresponding record.  
  
This would lead to FATAL failures in the startup process during  
recovery, where the same transaction would have a state recovered twice  
instead of once:  
LOG:  recovering prepared transaction 731 from shared memory  
LOG:  recovering prepared transaction 731 from shared memory  
FATAL:  lock ExclusiveLock on object 731/0/0 is already held  
  
This issue is fixed by skipping the addition of any 2PC state coming  
from a record whose equivalent 2PC state file has already been loaded in  
TwoPhaseState at the beginning of recovery by restoreTwoPhaseData(),  
which is OK as long as the system has not reached a consistent state.  
  
The timing to get a messed up recovery processing is very racy, and  
would very unlikely happen.  The thread that has reported the issue has  
demonstrated the bug using injection points to force a PANIC in the  
middle of a checkpoint.  
  
Issue introduced in 728bd99, so backpatch all the way down.  
  
Reported-by: "suyu.cmj" <mengjuan.cmj@alibaba-inc.com>  
Author: "suyu.cmj" <mengjuan.cmj@alibaba-inc.com>  
Author: Michael Paquier  
Discussion: https://postgr.es/m/109e6994-b971-48cb-84f6-829646f18b4c.mengjuan.cmj@alibaba-inc.com  
Backpatch-through: 11  

M src/backend/access/transam/twophase.c

Include <limits.h> in fe-auth.c, to get CHAR_BIT reliably.

commit   : efe8d8226929137f8c96f45e0904868b53ba56bc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Jul 2023 16:54:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Jul 2023 16:54:54 -0400    

Click here for diff

fe-auth.c references CHAR_BIT since commit 3a465cc67, but it  
did not #include <limits.h>, which per POSIX is where that  
symbol is defined.  This escaped notice so far because  
(a) on most platforms, <sys/param.h> pulls in <limits.h>,  
(b) even if yours doesn't, OpenSSL pulls it in, so compiling  
with --with-openssl masks the omission.  
  
Per bug #18026 from Marcel Hofstetter.  Back-patch to v16.  
  
Discussion: https://postgr.es/m/18026-d5bb69f79cd16203@postgresql.org  

M src/interfaces/libpq/fe-auth.c

Add missing initializations of p_perminfo

commit   : 4a7301c7ad1c504c5a3f485a1d28cfd62b3ecbb0    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 14 Jul 2023 14:28:38 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 14 Jul 2023 14:28:38 +0900    

Click here for diff

In a61b1f74823, we failed to update transformFromClauseItem() and  
buildNSItemFromLists() to set ParseNamespaceItem.p_perminfo causing  
it to point to garbage.  
  
Pointed out by Tom Lane.  
  
Reported-by: Farias de Oliveira <matheusfarias519@gmail.com>  
Discussion: https://postgr.es/m/3173476.1689286373%40sss.pgh.pa.us  
Backpatch-through: 16  

M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c

Add indisreplident to fields refreshed by RelationReloadIndexInfo()

commit   : 27da47122075971aeacd4e2284d7907dde8a7204    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Jul 2023 11:16:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Jul 2023 11:16:03 +0900    

Click here for diff

RelationReloadIndexInfo() is a fast-path used for index reloads in the  
relation cache, and it has always forgotten about updating  
indisreplident, which is something that would happen after an index is  
selected for a replica identity.  This can lead to incorrect cache  
information provided when executing a command in a transaction context  
that updates indisreplident.  
  
None of the code paths currently on HEAD that need to check upon  
pg_index.indisreplident fetch its value from the relation cache, always  
relying on a fresh copy on the syscache.  Unfortunately, this may not be  
the case of out-of-core code, that could see out-of-date value.  
  
Author: Shruthi Gowda  
Reviewed-by: Robert Haas, Dilip Kumar, Michael Paquier  
Discussion: https://postgr.es/m/CAASxf_PBcxax0wW-3gErUyftZ0XrCs3Lrpuhq4-Z3Fak1DoW7Q@mail.gmail.com  
Backpatch-through: 11  

M src/backend/utils/cache/relcache.c

Fix updates of indisvalid for partitioned indexes

commit   : 31f9d41d625dc6ca8c1469edd6919316b18174fe    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Jul 2023 10:13:14 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Jul 2023 10:13:14 +0900    

Click here for diff

indisvalid is switched to true for partitioned indexes when all its  
partitions have valid indexes when attaching a new partition, up to the  
top-most parent if all its leaves are themselves valid when dealing with  
multiple layers of partitions.  
  
The copy of the tuple from pg_index used to switch indisvalid to true  
came from the relation cache, which is incorrect.  Particularly, in the  
case reported by Shruthi Gowda, executing a series of commands in a  
single transaction would cause the validation of partitioned indexes to  
use an incorrect version of a pg_index tuple, as indexes are reloaded  
after an invalidation request with RelationReloadIndexInfo(), a much  
faster version than a full index cache rebuild.  In this case, the  
limited information updated in the cache leads to an incorrect version  
of the tuple used.  One of the symptoms reported was the following  
error, with a replica identity update, for instance:  
"ERROR: attempted to update invisible tuple"  
  
This is incorrect since 8b08f7d, so backpatch all the way down.  
  
Reported-by: Shruthi Gowda  
Author: Michael Paquier  
Reviewed-by: Shruthi Gowda, Dilip Kumar  
Discussion: https://postgr.es/m/CAASxf_PBcxax0wW-3gErUyftZ0XrCs3Lrpuhq4-Z3Fak1DoW7Q@mail.gmail.com  
Backpatch-through: 11  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Handle DROP DATABASE getting interrupted

commit   : a4b4cc1d60f7e8ccfcc8ff8cb80c28ee411ad9a9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 13 Jul 2023 13:03:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 13 Jul 2023 13:03:30 -0700    

Click here for diff

Until now, when DROP DATABASE got interrupted in the wrong moment, the removal  
of the pg_database row would also roll back, even though some irreversible  
steps have already been taken. E.g. DropDatabaseBuffers() might have thrown  
out dirty buffers, or files could have been unlinked. But we continued to  
allow connections to such a corrupted database.  
  
To fix this, mark databases invalid with an in-place update, just before  
starting to perform irreversible steps. As we can't add a new column in the  
back branches, we use pg_database.datconnlimit = -2 for this purpose.  
  
An invalid database cannot be connected to anymore, but can still be  
dropped.  
  
Unfortunately we can't easily add output to psql's \l to indicate that some  
database is invalid, it doesn't fit in any of the existing columns.  
  
Add tests verifying that a interrupted DROP DATABASE is handled correctly in  
the backend and in various tools.  
  
Reported-by: Evgeny Morozov <postgresql3@realityexists.net>  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/20230509004637.cgvmfwrbht7xm7p6@awork3.anarazel.de  
Discussion: https://postgr.es/m/20230314174521.74jl6ffqsee5mtug@awork3.anarazel.de  
Backpatch: 11-, bug present in all supported versions  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/dbcommands.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/init/postinit.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/scripts/clusterdb.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/vacuumdb.c
M src/include/catalog/pg_database.h
M src/test/recovery/meson.build
A src/test/recovery/t/037_invalid_database.pl

Release lock after encountering bogs row in vac_truncate_clog()

commit   : 03ccc9569cd87fcbe01e4ba052c22ad0d9a3b71d    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 13 Jul 2023 13:03:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 13 Jul 2023 13:03:30 -0700    

Click here for diff

When vac_truncate_clog() encounters bogus datfrozenxid / datminmxid values, it  
returns early. Unfortunately, until now, it did not release  
WrapLimitsVacuumLock. If the backend later tries to acquire  
WrapLimitsVacuumLock, the session / autovacuum worker hangs in an  
uncancellable way. Similarly, other sessions will hang waiting for the  
lock. However, if the backend holding the lock exited or errored out for some  
reason, the lock was released.  
  
The bug was introduced as a side effect of 566372b3d643.  
  
It is interesting that there are no production reports of this problem. That  
is likely due to a mix of bugs leading to bogus values having gotten less  
common, process exit releasing locks and instances of hangs being hard to  
debug for "normal" users.  
  
Discussion: https://postgr.es/m/20230621221208.vhsqgduwfpzwxnpg@awork3.anarazel.de  

M src/backend/commands/vacuum.c

Remove unnecessary pfree() in g_intbig_compress().

commit   : e27f3f52c289a2f6e67f9319602df190a92446c0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 13 Jul 2023 13:07:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 13 Jul 2023 13:07:51 -0400    

Click here for diff

GiST compress functions (like all GiST opclass functions) are  
supposed to be called in short-lived memory contexts, so that  
minor memory leaks in them are not of concern, and indeed  
explicit pfree's are likely slightly counterproductive.  
But this one in g_intbig_compress() is more than  
slightly counterproductive, because it's guarded by  
"if (in != DatumGetArrayTypeP(entry->key))" which means  
that if this test succeeds, we've detoasted the datum twice.  
(And to add insult to injury, the extra detoast result is  
leaked.)  Let's just drop the whole stanza, relying on the  
GiST temporary context mechanism to clean up in good time.  
  
The analogous bit in g_int_compress() is  
       if (r != (ArrayType *) DatumGetPointer(entry->key))  
           pfree(r);  
which doesn't have the gratuitous-detoast problem so  
I left it alone.  Perhaps there is a case for removing  
unnecessary pfree's more widely, but I'm not sure if it's  
worth the code churn.  
  
The potential extra decompress seems expensive enough to  
justify calling this a (minor) performance bug and  
back-patching.  
  
Konstantin Knizhnik, Matthias van de Meent, Tom Lane  
  
Discussion: https://postgr.es/m/CAEze2Wi86=DxErfvf+SCB2UKmU2amKOF60BKuJOX=w-RojRn0A@mail.gmail.com  

M contrib/intarray/_intbig_gist.c

Fix untranslatable log message assembly

commit   : b4018ecb88a49612730398d15d3d96d68abe1137    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 13 Jul 2023 12:56:35 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 13 Jul 2023 12:56:35 +0200    

Click here for diff

We can't inject the name of the logical replication worker into a log  
message like that.  But for these messages we don't really need the  
precision of knowing what kind of worker it was, so just write  
"logical replication worker" and keep the message in one piece.  
  
Discussion: https://www.postgresql.org/message-id/flat/CAHut%2BPt1xwATviPGjjtJy5L631SGf3qjV9XUCmxLu16cHamfgg%40mail.gmail.com  

M src/backend/replication/logical/worker.c

Doc: clarify the conditions of usable indexes for REPLICA IDENTITY FULL tables.

commit   : 4946910a875ce84823236f2a06e576b16080465f    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 13 Jul 2023 15:03:24 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 13 Jul 2023 15:03:24 +0900    

Click here for diff

Commit 89e46da5e allowed REPLICA IDENTITY FULL tables to use an index  
on the subscriber during apply of update/delete. This commit clarifies  
in the documentation that the leftmost field of candidate indexes must  
be a column (not an expression) that references the published relation  
column.  
  
The source code comments are also updated accordingly.  
  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDJjffEvUFKXT27Q5U8-UU9JHv4rrJ9Ke8Zkc5UPWHLvA@mail.gmail.com  
Backpatch-through: 16  

M doc/src/sgml/logical-replication.sgml
M src/backend/executor/execReplication.c
M src/backend/replication/logical/relation.c

meson: Tie adding C++ support to the llvm Meson option

commit   : 7fc064d9b70f58998d3e8de78ece52b4e1376428    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    

Click here for diff

In the event the llvm option is defined to be 'auto', it is possible  
that the host machine might not have a C++ compiler. If that is the  
case, then we shouldn't continue reaching for the llvm dependency.  
  
To make it easier to understand the case where LLVM support is disabled due to  
lacking a C++ compiler, add a message noting that fact.  
  
Author: Tristan Partin <tristan@neon.tech>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CSPIJVUDZFKX.3KHMOAVGF94RV@c3po  
Backpatch: 16-, where meson support was added  

M meson.build

meson: Pass more feature option through to required kwargs

commit   : 5a7280d9880f94c632425703ac68a17a218474fb    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    

Click here for diff

That was already done in a lot of places, but not all.  
  
Backpatch this to keep the the meson files aligned as long as reasonably  
possible.  
  
Author: Tristan Partin <tristan@neon.tech>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CSPIJVUDZFKX.3KHMOAVGF94RV@c3po  
Backpatch: 16-, where meson support was added  

M meson.build

pg_bsd_indent: Collect test diffs in test.diffs instead of tests.diff

commit   : eeb28a2d94220a8540a57ca8204eaff8cadaf1fa    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    

Click here for diff

That way CI knows to pick up the file if the test fails.  
  
Discussion: https://postgr.es/m/20230711233307.hu4wetabjm5f7ver@awork3.anarazel.de  
Backpatch: 16-, where the test was added  

M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl

Be more rigorous about local variables in PostgresMain().

commit   : 93dcdfa88f5f9befb781558920e02d3ee86dc629    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 10 Jul 2023 12:14:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 10 Jul 2023 12:14:34 -0400    

Click here for diff

Since PostgresMain calls sigsetjmp, any local variables that are not  
marked "volatile" have a risk of unspecified behavior.  In practice  
this means that when control returns via longjmp, such variables might  
get reset to their values as of the time of sigsetjmp, depending on  
whether the compiler chose to put them in registers or on the stack.  
We were careful about this for "send_ready_for_query", but not the  
other local variables.  
  
In the case of the timeout_enabled flags, resetting them to  
their initial "false" states is actually good, since we do  
"disable_all_timeouts()" in the longjmp cleanup code path.  If that  
does not happen, we risk uselessly calling "disable_timeout()" later,  
which is harmless but a little bit expensive.  Let's explicitly reset  
these flags so that the behavior is correct and platform-independent.  
(This change means that we really don't need the new "volatile"  
markings after all, but let's install them anyway since any change  
in this logic could re-introduce a problem.)  
  
There is no issue for "firstchar" and "input_message" because those  
are explicitly reinitialized each time through the query processing  
loop.  To make that clearer, move them to be declared inside the loop.  
That leaves us with all the function-lifespan locals except the  
sigjmp_buf itself marked as volatile, which seems like a good policy  
to have going forward.  
  
Because of the possibility of extra disable_timeout() calls, this  
seems worth back-patching.  
  
Sergey Shinderuk and Tom Lane  
  
Discussion: https://postgr.es/m/2eda015b-7dff-47fd-d5e2-f1a9899b90a6@postgrespro.ru  

M src/backend/tcop/postgres.c

Fix pgindent

commit   : e004cb0394402a26b7142721e59a4f8e179bd1e4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 10 Jul 2023 12:05:32 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 10 Jul 2023 12:05:32 +0200    

Click here for diff

for commit e53a611523  

M src/backend/tcop/utility.c

Message wording improvements

commit   : 2631ebab7b18bdc079fd86107c47d6104a6b3c6e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 10 Jul 2023 10:46:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 10 Jul 2023 10:46:54 +0200    

Click here for diff

M src/backend/access/common/reloptions.c
M src/backend/backup/basebackup_zstd.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/tablecmds.c
M src/backend/libpq/auth.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/misc/guc_tables.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/jsonpath_encoding.out
M src/test/regress/expected/jsonpath_encoding_1.out

Fix ALTER EXTENSION SET SCHEMA with objects outside an extension's schema

commit   : 55c95f24cd7c91fc80d7c0d2c842c0b633f9bdc9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 10 Jul 2023 09:40:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 10 Jul 2023 09:40:12 +0900    

Click here for diff

As coded, the code would use as a base comparison the namespace OID from  
the first object scanned in pg_depend when switching its namespace  
dependency entry to the new one, and use it as a base of comparison for  
any follow-up checks.  It would also be used as the old namespace OID to  
switch *from* for the extension's pg_depend entry.  Hence, if the first  
object scanned has a namespace different than the one stored in the  
extension, we would finish by:  
- Not checking that the extension objects map with the extension's  
schema.  
- Not switching the extension -> namespace dependency entry to the new  
namespace provided by the user, making ALTER EXTENSION ineffective.  
  
This issue exists since this command has been introduced in d9572c4 for  
relocatable extension, so backpatch all the way down to 11.  The test  
case has been provided by Heikki, that I have tweaked a bit to show the  
effects on pg_depend for the extension.  
  
Reported-by: Heikki Linnakangas  
Author: Michael Paquier, Heikki Linnakangas  
Discussion: https://postgr.es/m/20eea594-a05b-4c31-491b-007b6fceef28@iki.fi  
Backpatch-through: 11  

M src/backend/commands/extension.c
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql

doc: Use proper markup for emphasis

commit   : 25da5cd32f73eec9a7ea9b49fbf04d97059ad402    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 9 Jul 2023 10:02:15 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 9 Jul 2023 10:02:15 +0200    

Click here for diff

M doc/src/sgml/config.sgml

doc: Move DEFAULT parameter on COPY reference page

commit   : 1da1cd2944701d5f6d8e4e9514a4a19b0fdf852a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 9 Jul 2023 09:46:24 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 9 Jul 2023 09:46:24 +0200    

Click here for diff

The DEFAULT parameter seems most similar to the NULL parameter, so  
move it next to it, instead of having it at the end of the parameter  
list because it was the last one added.  

M doc/src/sgml/ref/copy.sgml

Doc: update old reference to "result cache"

commit   : 6d8b5f49f0e18a0e8a926a4315c6a70efa34036e    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sun, 9 Jul 2023 16:14:47 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sun, 9 Jul 2023 16:14:47 +1200    

Click here for diff

During the PostgreSQL 14 cycle, the Memoize executor node was briefly  
called "Result Cache" until it was renamed in 83f4fcc65.  That commit  
missed one reference.  
  
Reported-by: Paul A Jungwirth  
Packpatch-through: 14, where Memoize was added  
Discussion: https://postgr.es/m/CA+renyX=40YXhsfPTzn13oNOPO3TJ12CK9GX-2P2pvnQiScefA@mail.gmail.com  

M doc/src/sgml/config.sgml

Fix tmpdir issues with commit e213de8e78

commit   : 6d8a8bb0104ccd9ba5199dc54647d58ce006324e    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 8 Jul 2023 12:34:25 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 8 Jul 2023 12:34:25 -0400    

Click here for diff

Commit e213de8e78 fixed a problem with path lengths to a tempdir on  
Windows, but caused problems on at least some Unix systems where the  
system tempdir is on a different file system. To work around this, only  
used the system temdir for the destination of pg_replslot on Windows,  
and otherwise restore the old behaviour.  
  
Backpatch to relase 14 like the previous patch.  
  
Problem exposed by a myriad of buildfarm animals.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Use shorter location for pg_replslot in pg_basebackup test

commit   : 67ece2e709c44880bd634daa18c0f9d6862857f5    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 8 Jul 2023 11:21:58 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 8 Jul 2023 11:21:58 -0400    

Click here for diff

The symlink to a longer location tripped up some Windows limit on  
buildfarm animal fairywren when running with meson, which uses slightly  
longer paths.  
  
Backpatch to all live branches to keep the script in sync.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Fix Perl warning

commit   : 1421e8f3b6fc489f66d665d2a657f1af8bcd6595    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 8 Jul 2023 17:24:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 8 Jul 2023 17:24:41 +0200    

Click here for diff

Use of uninitialized value $content in concatenation (.) or string  

M src/test/perl/PostgreSQL/Test/Utils.pm

Make some indentation in gram.y consistent

commit   : 01f1f789df5631b831dbd38b5a2b70d066f79fe2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 8 Jul 2023 15:50:35 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 8 Jul 2023 15:50:35 +0200    

Click here for diff

Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/parser/gram.y

Revert MAINTAIN privilege and pg_maintain predefined role.

commit   : 957445996fda2d6939a8748f2a19c10b15941c5e    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 7 Jul 2023 11:25:23 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 7 Jul 2023 11:25:23 -0700    

Click here for diff

This reverts the following commits: 4dbdb82513, c2122aae63,  
5b1a879943, 9e1e9d6560, ff9618e82a, 60684dd834, 4441fc704d,  
and b5d6382496.  A role with the MAINTAIN privilege may be able to  
use search_path tricks to escalate privileges to the table owner.  
Unfortunately, it is too late in the v16 development cycle to apply  
the proposed fix, i.e., restricting search_path when running  
maintenance commands.  
  
Bumps catversion.  
  
Reviewed-by: Jeff Davis  
Discussion: https://postgr.es/m/E1q7j7Y-000z1H-Hr%40gemulon.postgresql.org  
Backpatch-through: 16  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/catalog/aclchk.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/utils/adt/acl.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat
M src/include/commands/tablecmds.h
M src/include/commands/vacuum.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h
M src/test/isolation/expected/cluster-conflict-partition.out
M src/test/isolation/specs/cluster-conflict-partition.spec
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/regress/expected/cluster.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/dependency.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/cluster.sql
M src/test/regress/sql/dependency.sql
M src/test/regress/sql/privileges.sql

Document relaxed HOT for summarizing indexes

commit   : 1124cb2cf2ebc1b0adb9c5289e53ffe094ce3206    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 7 Jul 2023 19:04:32 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 7 Jul 2023 19:04:32 +0200    

Click here for diff

Commit 19d8e2308b allowed a weaker check for HOT with summarizing  
indexes, but it did not update README.HOT. So do that now.  
  
Patch by Matthias van de Meent, minor changes by me. Backpatch to 16,  
where the optimization was introduced.  
  
Author: Matthias van de Meent  
Reviewed-by: Tomas Vondra  
Backpatch-through: 16  
Discussion: https://postgr.es/m/CAEze2WiEOm8V+c9kUeYp2BPhbEc5s473fUf51xNeqvSFGv44Ew@mail.gmail.com  

M src/backend/access/heap/README.HOT

Fix type of iterator variable in SH_START_ITERATE

commit   : 727d96511ef58521bd4be0d3acb7ba88df44e762    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Jul 2023 08:34:17 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Jul 2023 08:34:17 -0700    

Click here for diff

Also add comment to make the reasoning behind the Assert() more explicit (per  
Tom).  
  
Reported-by: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAocXNJ6s1VLz+hMamLAQAiewRoW17OJ6-+9GACKfj6iPQ@mail.gmail.com  
Backpatch: 11-  

M src/include/lib/simplehash.h

Skip pg_baseback long filename test if path too long on Windows

commit   : b94d70a632aabb02079f094b9c9a32f4f6b8c984    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 6 Jul 2023 12:27:40 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 6 Jul 2023 12:27:40 -0400    

Click here for diff

On Windows, it's sometimes difficult to create a file with a path longer  
than 255 chars, and if it can be created it might not be seen by the  
archiver. This can be triggered by the test for tar backups with  
filenames greater than 100 bytes. So we skip that test if the path would  
exceed 255.  
  
Backpatch to all live branches.  
  
Reviewed by Daniel Gustafsson  
  
Discussion: https://postgr.es/m/666ac55b-3400-fb2c-2cea-0281bf36a53c@dunslane.net  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

WAL-log the creation of the init fork of unlogged indexes.

commit   : bf7b70e6bf4ad07f4a46c51a7f866ef89f82404c    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 6 Jul 2023 17:25:29 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 6 Jul 2023 17:25:29 +0300    

Click here for diff

We create a file, so we better WAL-log it. In practice, all the  
built-in index AMs and all extensions that I'm aware of write a  
metapage to the init fork, which is WAL-logged, and replay of the  
metapage implicitly creates the fork too. But if ambuildempty() didn't  
write any page, we would miss it.  
  
This can be seen with dummy_index_am. Set up replication, create a  
'dummy_index_am' index on an unlogged table, and look at the files  
created in the replica: the init fork is not created on the  
replica. Dummy_index_am doesn't do anything with the relation files,  
however, so it doesn't lead to any user-visible errors.  
  
Backpatch to all supported versions.  
  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/6e5bbc08-cdfc-b2b3-9e23-1a914b9850a9%40iki.fi  

M src/backend/catalog/index.c

commit   : 3c1adbbf86c2cfa44ebed64bd01ed589ad0b832b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 6 Jul 2023 08:41:30 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 6 Jul 2023 08:41:30 +0530    

Click here for diff

This commit reverts the work done by commits 3ba59ccc89 and 72e78d831a.  
Those commits were incorrect in asserting that we never acquire any other  
heavy-weight lock after acquring page lock other than relation extension  
lock. We can acquire a lock on catalogs while doing catalog look up after  
acquring page lock.  
  
This won't impact any existing feature but we need to think some other way  
to achieve this before parallelizing other write operations or even  
improving the parallelism in vacuum (like allowing multiple workers  
for an index).  
  
Reported-by: Jaime Casanova  
Author: Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/CAJKUy5jffnRKNvRHKQ0LynRb0RJC-o4P8Ku3x9vGAVLwDBWumQ@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/backend/storage/lmgr/README
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c

Fix leak of LLVM "fatal-on-oom" section counter.

commit   : dc0b5841746c025f6e51b0a6ba0e423b2ac518f0    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 5 Jul 2023 13:13:13 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 5 Jul 2023 13:13:13 +0300    

Click here for diff

llvm_release_context() called llvm_enter_fatal_on_oom(), but was missing  
the corresponding llvm_leave_fatal_on_oom() call. As a result, if JIT was  
used at all, we were almost always in the "fatal-on-oom" state.  
  
It only makes a difference if you use an extension written in C++, and  
run out of memory in a C++ 'new' call. In that case, you would get a  
PostgreSQL FATAL error, instead of the default behavior of throwing a  
C++ exception.  
  
Back-patch to all supported versions.  
  
Reviewed-by: Daniel Gustafsson  
Discussion: https://www.postgresql.org/message-id/54b78cca-bc84-dad8-4a7e-5b56f764fab5@iki.fi  

M src/backend/jit/llvm/llvmjit.c

pgstat: fix subscription stats entry leak.

commit   : be8cae7e2f03f35a049e2b1f1113860fea6d0212    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 5 Jul 2023 14:49:58 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 5 Jul 2023 14:49:58 +0900    

Click here for diff

Commit 7b64e4b3 taught DropSubscription() to drop stats entry of  
subscription that is not associated with a replication slot for apply  
worker at DROP SUBSCRIPTION but missed covering the case where the  
subscription is not associated with replication slots for both apply  
worker and tablesync worker.  
  
Also add a test to verify that the stats for slot-less subscription is  
removed at DROP SUBSCRIPTION time.  
  
Backpatch down to 15.  
  
Author: Masahiko Sawada  
Reviewed-by: Nathan Bossart, Hayato Kuroda, Melih Mutlu, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoB71zkP7uPT7JDPsZcvp0749ExEQnOJxeNKPDFisHar+w@mail.gmail.com  
Backpatch-through: 15  

M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/026_stats.pl

Fix assertion failure in snapshot building

commit   : eb27d3dc88879cb148ae0365394aae0ab84fa1a7    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 4 Jul 2023 17:36:13 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 4 Jul 2023 17:36:13 +0200    

Click here for diff

Clear any potential stale next_phase_at value from the snapshot  
builder which otherwise may trip an assertion check ensuring  
that there is no next_phase_at value.  
  
This can be reproduced by running 80 concurrent sessions like  
the below where $c is a loop counter (assumes there has been  
1..$c databases created) :  
  
  echo "  
    CREATE TABLE replication_example(id SERIAL PRIMARY KEY,  
                                     somedata int,  
                                     text varchar(120));  
    SELECT 'init' FROM  
      pg_create_logical_replication_slot('regression_slot_$c',  
                                         'test_decoding');  
    SELECT data FROM  
      pg_logical_slot_get_changes('regression_slot_$c', NULL,  
                                  NULL, 'include-xids', '0',  
                                  'skip-empty-xacts', '1');  
  " | psql -d regress_$c >>psql.log &  
  
Backpatch down to v16.  
  
Bug: #17695  
Author: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>  
Reported-by: bowenshi <zxwsbg@qq.com>  
Discussion: https://postgr.es/m/17695-6be9277c9295985f@postgresql.org  
Backpatch-through: v16  

M src/backend/replication/logical/snapbuild.c

Ensure that creation of an empty relfile is fsync'd at checkpoint.

commit   : d431644b43fcce9b7c2f677db18452b0ee216b42    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 4 Jul 2023 17:57:03 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 4 Jul 2023 17:57:03 +0300    

Click here for diff

If you create a table and don't insert any data into it, the relation file  
is never fsync'd. You don't lose data, because an empty table doesn't have  
any data to begin with, but if you crash and lose the file, subsequent  
operations on the table will fail with "could not open file" error.  
  
To fix, register an fsync request in mdcreate(), like we do for mdwrite().  
  
Per discussion, we probably should also fsync the containing directory  
after creating a new file. But that's a separate and much wider issue.  
  
Backpatch to all supported versions.  
  
Reviewed-by: Andres Freund, Thomas Munro  
Discussion: https://www.postgresql.org/message-id/d47d8122-415e-425c-d0a2-e0160829702d%40iki.fi  

M src/backend/storage/smgr/md.c

Re-bin segment when memory pages are freed.

commit   : af8f9ec66bd19a920d02b4c0eb65b3dd6057d324    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 4 Jul 2023 15:16:34 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 4 Jul 2023 15:16:34 +1200    

Click here for diff

It's OK to be lazy about re-binning memory segments when allocating,  
because that can only leave segments in a bin that's too high.  We'll  
search higher bins if necessary while allocating next time, and  
also eventually re-bin, so no memory can become unreachable that way.  
  
However, when freeing memory, the largest contiguous range of free pages  
might go up, so we should re-bin eagerly to make sure we don't leave the  
segment in a bin that is too low for get_best_segment() to find.  
  
The re-binning code is moved into a function of its own, so it can be  
called whenever free pages are returned to the segment's free page map.  
  
Back-patch to all supported releases.  
  
Author: Dongming Liu <ldming101@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com> (earlier version)  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/CAL1p7e8LzB2LSeAXo2pXCW4%2BRya9s0sJ3G_ReKOU%3DAjSUWjHWQ%40mail.gmail.com  

M src/backend/utils/mmgr/dsa.c

Fix race in SSI interaction with gin fast path.

commit   : 12529028a4e55eb0500477d2589eec625466facf    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 3 Jul 2023 16:20:01 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 3 Jul 2023 16:20:01 +1200    

Click here for diff

The ginfast.c code previously checked for conflicts in before locking  
the relevant buffer, leaving a window where a RW conflict could be  
missed.  Re-order.  
  
There was also a place where buffer ID and block number were confused  
while trying to predicate-lock a page, noted by visual inspection.  
  
Back-patch to all supported releases.  Fixes one more problem discovered  
with the reproducer from bug #17949, in this case when Dmitry tried  
other index types.  
  
Reported-by: Artem Anisimov <artem.anisimov.255@gmail.com>  
Reported-by: Dmitry Dolgov <9erthalion6@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/17949-a0f17035294a55e2%40postgresql.org  

M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c

Fix race in SSI interaction with bitmap heap scan.

commit   : d03d9a2614fd58d4a9e90107f1700952333ce2a2    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 3 Jul 2023 16:18:20 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 3 Jul 2023 16:18:20 +1200    

Click here for diff

When performing a bitmap heap scan, we don't want to miss concurrent  
writes that occurred after we observed the heap's rs_nblocks, but before  
we took predicate locks on index pages.  Therefore, we can't skip  
fetching any heap tuples that are referenced by the index, because we  
need to test them all with CheckForSerializableConflictOut().  The  
old optimization that would ignore any references to blocks >=  
rs_nblocks gets in the way of that requirement, because it means that  
concurrent writes in that window are ignored.  
  
Removing that optimization shouldn't affect correctness at any isolation  
level, because any new tuples shouldn't be visible to an MVCC snapshot.  
There also shouldn't be any error-causing references to heap blocks past  
the end, because we should have held at least an AccessShareLock on the  
table before the index scan.  It can't get smaller while our transaction  
is running.  For now, though, we'll keep the optimization at lower  
levels to avoid making unnecessary changes in a bug fix.  
  
Back-patch to all supported releases.  In release 11, the code is in a  
different place but not fundamentally different.  Fixes one aspect of  
bug #17949.  
  
Reported-by: Artem Anisimov <artem.anisimov.255@gmail.com>  
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/17949-a0f17035294a55e2%40postgresql.org  

M src/backend/access/heap/heapam_handler.c

Fix race in SSI interaction with empty btrees.

commit   : 0cb1fb2c9bf8fdc27044082757cde79de1a8e482    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 3 Jul 2023 16:16:27 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 3 Jul 2023 16:16:27 +1200    

Click here for diff

When predicate-locking btrees, we have a special case for completely  
empty btrees, since there is no page to lock.  This was racy, because,  
without buffer lock held, a matching key could be inserted between the  
_bt_search() and the PredicateLockRelation() calls.  
  
Fix, by rechecking _bt_search() after taking the relation-level SIREAD  
lock, if using SERIALIZABLE isolation and an empty btree is discovered.  
  
Back-patch to all supported releases.  Fixes one aspect of bug #17949.  
  
Reported-by: Artem Anisimov <artem.anisimov.255@gmail.com>  
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/17949-a0f17035294a55e2%40postgresql.org  

M src/backend/access/nbtree/nbtsearch.c

Remove expensive test of postgres_fdw batch inserts

commit   : 6b488d5dc2fe4dc12e1ef15c0ea4c1a4e7170ae0    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 3 Jul 2023 18:16:58 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 3 Jul 2023 18:16:58 +0200    

Click here for diff

The test inserted 70k rows into a foreign table, in order to verify  
correct behavior with more than 65535 parameters, and was added in  
response to a bug report.  
  
However, this is rather expensive, especially when running the tests  
under valgrind, CLOBBER_CACHE_ALWAYS etc. It doesn't seem worth it to  
keep running the test, so remove it from all branches (14+).  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/2131017.1623451468@sss.pgh.pa.us  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Improve pg_basebackup long file name test Windows robustness

commit   : 16152705b31d12c339e3a9ee44ed43972a6ee96c    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 3 Jul 2023 10:06:26 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 3 Jul 2023 10:06:26 -0400    

Click here for diff

Creation of a file with a very long name can create problems on Windows  
due to its file path limits. Work around that by creating the file via a  
symlink with a shorter name.  
  
Error displayed by buildfarm animal fairywren.o  
  
Backpatch to all live branches  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Make PG_TEST_NOCLEAN work for temporary directories in TAP tests

commit   : c24e9ef330ac7da1d1628d21b2d5defb0ec03c54    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 3 Jul 2023 10:06:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 3 Jul 2023 10:06:13 +0900    

Click here for diff

When set, this environment variable was only effective for data  
directories but not for all the other temporary files created by  
PostgreSQL::Test::Utils.  Keeping the temporary files after a successful  
run can be useful for debugging purposes.  
  
The documentation is updated to reflect the new behavior, with contents  
available in doc/ since v16 and in src/test/perl/README since v15.  
  
Author: Jacob Champion  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAAWbhmgHtDH1SGZ+Fw05CsXtE0mzTmjbuUxLB9mY9iPKgM6cUw@mail.gmail.com  
Discussion: https://postgr.es/m/YyPd9unV14SX2bLF@paquier.xyz  
Backpatch-through: 11  

M doc/src/sgml/regress.sgml
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/README

Silence "missing contrecord" error.

commit   : 76d5966b3b798cc58025c77164fa944f2b6dd667    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 3 Jul 2023 10:53:44 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 3 Jul 2023 10:53:44 +1200    

Click here for diff

Commit dd38ff28ad added a new error message "missing contrecord" when  
we fail to reassemble a record.  Unfortunately that caused noisy  
messages to be logged by pg_waldump at end of segment, and by walsender  
when asked to shut down on a segment boundary.  
  
Remove the new error message, so that this condition signals end-of-  
WAL without a message.  It's arguably a reportable condition that should  
not be silenced while performing crash recovery, but fixing that without  
introducing noise in the other cases will require more research.  
  
Back-patch to 15.  
  
Reported-by: Tomas Vondra <tomas.vondra@enterprisedb.com>  
Discussion: https://postgr.es/m/6a1df56e-4656-b3ce-4b7a-a9cb41df8189%40enterprisedb.com  

M src/backend/access/transam/xlogreader.c

Fix oversight in handling of modifiedCols since f24523672d

commit   : 9cf85093b55979e7d8ccfd9d0da21ce277a2f321    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sun, 2 Jul 2023 20:29:01 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sun, 2 Jul 2023 20:29:01 +0200    

Click here for diff

Commit f24523672d fixed a memory leak by moving the modifiedCols bitmap  
into the per-row memory context. In the case of AFTER UPDATE triggers,  
the bitmap is however referenced from an event kept until the end of the  
query, resulting in a use-after-free bug.  
  
Fixed by copying the bitmap into the AfterTriggerEvents memory context,  
which is the one where we keep the trigger events. There's only one  
place that needs to do the copy, but the memory context may not exist  
yet. Doing that in a separate function seems more readable.  
  
Report by Alexander Pyhalov, fix by me. Backpatch to 13, where the  
bitmap was added to the event by commit 71d60e2aa0.  
  
Reported-by: Alexander Pyhalov  
Backpatch-through: 13  
Discussion: https://postgr.es/m/acddb17c89b0d6cb940eaeda18c08bbe@postgrespro.ru  

M src/backend/commands/trigger.c

Fix memory leak in Incremental Sort rescans

commit   : 9ae7b5d1f3ad2dc31ba7552a19d2efb24e7dbc0e    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sun, 2 Jul 2023 18:54:09 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sun, 2 Jul 2023 18:54:09 +0200    

Click here for diff

The Incremental Sort had a couple issues, resulting in leaking memory  
during rescans, possibly triggering OOM. The code had a couple of  
related flaws:  
  
1. During rescans, the sort states were reset but then also set to NULL  
   (despite the comment saying otherwise). ExecIncrementalSort then  
   sees NULL and initializes a new sort state, leaking the memory used  
   by the old one.  
  
2. Initializing the sort state also automatically rebuilt the info about  
   presorted keys, leaking the already initialized info. presorted_keys  
   was also unnecessarily reset to NULL.  
  
Patch by James Coleman, based on patches by Laurenz Albe and Tom Lane.  
Backpatch to 13, where Incremental Sort was introduced.  
  
Author: James Coleman, Laurenz Albe, Tom Lane  
Reported-by: Laurenz Albe, Zu-Ming Jiang  
Backpatch-through: 13  
Discussion: https://postgr.es/m/b2bd02dff61af15e3526293e2771f874cf2a3be7.camel%40cybertec.at  
Discussion: https://postgr.es/m/db03c582-086d-e7cd-d4a1-3bc722f81765%40inf.ethz.ch  

M src/backend/executor/nodeIncrementalSort.c

Fix test of pg_stat_io for wal_level=minimal.

commit   : cb5fd121d539b5c1ed91c5609c04e603c1bc8b50    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 1 Jul 2023 10:00:39 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 1 Jul 2023 10:00:39 -0700    

Click here for diff

Back-patch to v16, which introduced the test.  

M contrib/amcheck/expected/check_heap.out
M contrib/amcheck/sql/check_heap.sql

doc: PG 16 relnotes, remove "Have initdb use ICU by default"

commit   : c729642bd760c9d450592e3904d8d093b438b592    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 30 Jun 2023 17:35:47 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 30 Jun 2023 17:35:47 -0400    

Click here for diff

Item reverted.  
  
Backpatch-through: 16 only  

M doc/src/sgml/release-16.sgml

Add a test case for a316a3bc

commit   : 0a14bca662a44310305ad3fcc1079ef75d4a6316    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 30 Jun 2023 15:48:54 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 30 Jun 2023 15:48:54 +0900    

Click here for diff

a316a3bc fixed the code in build_simpl_rel() that propagates  
RelOptInfo.userid from parent to child rels so that it works  
correctly for the child rels of a UNION ALL subquery rel, though  
no tests were added in that commit.  So do so here.  
  
As noted in the discussion, coming up with a test case in the core  
regression suite for this fix has turned out to be tricky, so the  
test case is added to the postgres_fdw's suite instead.  
postgresGetForeignRelSize()'s use of user mapping for the user  
specified in RelOptInfo.userid makes it relatively easier to craft  
a test case around.  
  
Discussion: https://postgr.es/m/CA%2BHiwqH91GaFNXcXbLAM9L%3DzBwUmSyv699Mtv3i1_xtk9Xec_A%40mail.gmail.com  
Backpatch-through: 16  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Fix marking of indisvalid for partitioned indexes at creation

commit   : f4691e2e76a4ba6a340668160d8008124c2140a0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 30 Jun 2023 13:54:53 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 30 Jun 2023 13:54:53 +0900    

Click here for diff

The logic that introduced partitioned indexes missed a few things when  
invalidating a partitioned index when these are created, still the code  
is written to handle recursions:  
1) If created from scratch because a mapping index could not be found,  
the new index created could be itself invalid, if for example it was a  
partitioned index with one of its leaves invalid.  
2) A CCI was missing when indisvalid is set for a parent index, leading  
to inconsistent trees when recursing across more than one level for a  
partitioned index creation if an invalidation of the parent was  
required.  
  
This could lead to the creation of a partition index tree where some of  
the partitioned indexes are marked as invalid, but some of the parents  
are marked valid, which is not something that should happen (as  
validatePartitionedIndex() defines, indisvalid is switched to true for a  
partitioned index iff all its partitions are themselves valid).  
  
This patch makes sure that indisvalid is set to false on a partitioned  
index if at least one of its partition is invalid.  The flag is set to  
true if *all* its partitions are valid.  
  
The regression test added in this commit abuses of a failed concurrent  
index creation, marked as invalid, that maps with an index created on  
its partitioned table afterwards.  
  
Reported-by: Alexander Lakhin  
Reviewed-by: Alexander Lakhin  
Discussion: https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.com  
Backpatch-through: 11  

M src/backend/commands/indexcmds.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Arm gen_node_support.pl's nodetag ABI stability check in v16.

commit   : 871d342bf3d51a7502ce7dfcbd7fe1682e1cb8fb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Jun 2023 19:14:22 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Jun 2023 19:14:22 -0400    

Click here for diff

Per RELEASE_CHANGES checklist.  

M src/backend/nodes/gen_node_support.pl

Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHOD

commit   : 97d89101045fac8cb36f4ef6c08526ea0841a596    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 30 Jun 2023 07:49:01 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 30 Jun 2023 07:49:01 +0900    

Click here for diff

ALTER TABLE .. SET ACCESS METHOD was not registering a dependency to the  
new access method with the relation altered in its rewrite phase, making  
possible the drop of an access method even if there are relations that  
depend on it.  During the rewrite, a temporary relation is created to  
build the new relation files before swapping the new and old files, and,  
while the temporary relation was registering a correct dependency to the  
new AM, the old relation did not do that.  A dependency on the access  
method is added when the relation files are swapped, which is the point  
where pg_class is updated.  
  
Materialized views and tables use the same code path, hence both were  
impacted.  
  
Backpatch down to 15, where this command has been introduced.  
  
Reported-by: Alexander Lakhin  
Reviewed-by: Nathan Bossart, Andres Freund  
Discussion: https://postgr.es/m/18000-9145c25b1af475ca@postgresql.org  
Backpatch-through: 15  

M src/backend/commands/cluster.c
M src/test/regress/expected/create_am.out
M src/test/regress/sql/create_am.sql

meson: Remove redundant return code check

commit   : 5f87a021257f1ea1cacdced0cf49ff1c58ecf5e9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 29 Jun 2023 09:12:52 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 29 Jun 2023 09:12:52 -0700    

Click here for diff

run_command(check: true) already would have errorred out before the check is  
reached.  
  
Author: Tristan Partin <tristan@neon.tech>  
Discussion: CSPIJVUDZFKX.3KHMOAVGF94RV@c3po  

M meson.build

Defend against bogus parameterization of join input paths.

commit   : a798660ebe3ff1feb310db13b957c5cda4c8c50d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Jun 2023 12:12:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Jun 2023 12:12:52 -0400    

Click here for diff

An outer join cannot be formed using an input path that is parameterized  
by a value that is supposed to be nulled by the outer join.  This is  
obviously nonsensical, and it could lead to a bad plan being selected;  
although currently it seems that we'll hit various sanity-check  
assertions first.  
  
I think that such cases were formerly prevented by the delay_upper_joins  
mechanism, but now that that's gone we need an explicit check.  
  
(Perhaps we should avoid generating baserel paths that could  
lead to this situation in the first place; but it seems like  
having a defense at the join level would be a good idea anyway.)  
  
Richard Guo and Tom Lane, per report from Jaime Casanova  
  
Discussion: https://postgr.es/m/CAJKUy5g2uZRrUDZJ8p-=giwcSHVUn0c9nmdxPSY0jF0Ov8VoEA@mail.gmail.com  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix order of operations in ExecEvalFieldStoreDeForm().

commit   : 43af714defa00145981eb542cb71647836b3efa4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Jun 2023 10:19:10 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Jun 2023 10:19:10 -0400    

Click here for diff

If the given composite datum is toasted out-of-line,  
DatumGetHeapTupleHeader will perform database accesses to detoast it.  
That can invalidate the result of get_cached_rowtype, as documented  
(perhaps not plainly enough) in that function's API spec; which leads  
to strange errors or crashes when we try to use the TupleDesc to read  
the tuple.  In short then, trying to update a field of a composite  
column could fail intermittently if the overall column value is wide  
enough to require toasting.  
  
We can fix the bug at no cost by just changing the order of  
operations, since we don't need the TupleDesc until after detoasting.  
(Other callers of get_cached_rowtype appear to get this right already,  
so there's only one bug.)  
  
Note that the added regression test case reveals this bug reliably  
only with debug_discard_caches/CLOBBER_CACHE_ALWAYS.  
  
Per bug #17994 from Alexander Lakhin.  Sadly, this patch does not fix  
the missing-values issue revealed in the bug discussion; we'll need  
some more work to cover that.  
  
Discussion: https://postgr.es/m/17994-5c7100b51b4790e9@postgresql.org  

M src/backend/executor/execExprInterp.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

meson: Fix intl misspelling

commit   : b750e74e6ec324f4c9de82587cb6a07490f86cfe    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:16:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:16:52 +0200    

Click here for diff

Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson.build

meson: Use a better error message in an impossible case

commit   : 99e57663518b0eaf8fa69d20d0e796321bc8e558    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:06:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:06:41 +0200    

Click here for diff

Meson validates 'choice' options for us, so technically this case is  
impossible. A better error message helps people reading the code  
understand what is going on in that branch.  
  
Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson.build

meson: Make some Meson style more consistent with surrounding code

commit   : af492eb6d6c90cf470c544083d3b6b3648f1bea2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:06:02 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:06:02 +0200    

Click here for diff

Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson.build
M src/include/meson.build

meson: Fix some grammar usage in Meson comments

commit   : 74668cbf0fcc356faef271aa2fb42896e323f8b1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:05:05 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:05:05 +0200    

Click here for diff

Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson.build

meson: Mention the correct way to disable readline support

commit   : f5159c734fe41526805c49d62c61fb2f320531e0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:04:04 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:04:04 +0200    

Click here for diff

Using false to disable a feature option is incorrect.  
  
Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson.build

meson: Remove old comment

commit   : 45c88eecb4a6cf286b2bd8fc977ccf932525933a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:03:19 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 13:03:19 +0200    

Click here for diff

That portion of code is not run in the Windows case already given the  
structure of the surrounding if statement.  
  
Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson.build

meson: Use the not_found_dep constant

commit   : 38977dd2bdacdfa5ca36377d3197029993929d7f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:56:30 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:56:30 +0200    

Click here for diff

Previously in the build description, a not_found_dep was defined. Make  
use of it.  
  
Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson.build

meson: Attach colon to keyword argument

commit   : c55d31e59c8980147b2103cbcf5ef0c3e6434f70    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:53:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:53:41 +0200    

Click here for diff

This matches the style found in the rest of the Meson build description.  
  
Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson_options.txt

meson: Use consistent Meson option description formats

commit   : b2ec7f543f9e3b9ab1ad21e5512cfe5c6c2b4a6f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:52:12 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:52:12 +0200    

Click here for diff

Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson_options.txt

meson: Use consistent casing in Meson option descriptions

commit   : 529449c379b9248ad1b2b8af308799a149a6d0c1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:47:33 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:47:33 +0200    

Click here for diff

Meson itself uses capital letters for option descriptions, so follow  
that.  
  
Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson_options.txt

meson: Remove triple-quoted strings

commit   : 559bdd58eb712d413aff662cf797a7a4598baf00    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:44:27 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 12:44:27 +0200    

Click here for diff

Triple-quoted strings are for multiline strings in Meson. None of the  
descriptions that got changed were multiline and the entire file uses  
single-line descriptions.  
  
Author: Tristan Partin <tristan@neon.tech>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson_options.txt

Remove inappropriate raw_expression_tree_walker() code

commit   : efcf55f8fe00b46198cd34557431c87ce5da8040    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 10:30:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 10:30:55 +0200    

Click here for diff

It was walking into the ColumnDef->compression field, which is not a  
node but a string.  This code is currently not reachable (because the  
compression field is only set in situations that don't go through  
raw_expression_tree_walker()), but if it had been, this could have  
behaved erratically.  

M src/backend/nodes/nodeFuncs.c

Error message wording improvements

commit   : 39a584dc90324b7323424d7450df8586ab2a0ca1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 09:14:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 29 Jun 2023 09:14:55 +0200    

Click here for diff

M src/backend/commands/user.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/utils/init/postinit.c
M src/test/regress/expected/create_role.out

Fix psql \?'s entries for \dp and \z.

commit   : dda9f8e7bc2e1e5cc6c77b86ce54786e9df8e0c6    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 28 Jun 2023 21:32:53 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 28 Jun 2023 21:32:53 -0700    

Click here for diff

d913928c9c added support for the "S" modifier to psql's \dp and \z  
meta-commands, but it missed updating the corresponding entries in  
\?'s output.  
  
Author: Noriyoshi Shinoda  
Discussion: https://postgr.es/m/DM4PR84MB17342A51B3A1556CFBC7A4B2EE25A%40DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M src/bin/psql/help.c

pg_stat_statements: Fix second comment related to entry resets

commit   : bc8e9a6a25e1674d49b977c1d3fc80e7c22f5b30    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jun 2023 09:17:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jun 2023 09:17:26 +0900    

Click here for diff

This should have been part of dc73db6, but it got lost in the mix.  
Oversight in 6b4d23f.  
  
Author: Japin Li  
Discussion: https://postgr.es/m/MEYP282MB1669FC91C764E277821936D3B624A@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  
Backpatch-through: 14  

M contrib/pg_stat_statements/pg_stat_statements.c

pg_stat_statements: Fix incorrect comment with entry resets

commit   : dc73db67433c5a9ee0d7a7dc788178553ef8afce    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jun 2023 08:04:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jun 2023 08:04:47 +0900    

Click here for diff

Oversight in 6b4d23f.  
  
Author: Japin Li, Richard Guo  
Discussion: https://postgr.es/m/MEYP282MB1669FC91C764E277821936D3B624A@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  
Backpatch-through: 14  

M contrib/pg_stat_statements/pg_stat_statements.c

Reword error messages for consistency

commit   : 046c8c5c8fe26fbce3ba773d49c81e6bbdf73db1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 28 Jun 2023 19:30:26 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 28 Jun 2023 19:30:26 +0200    

Click here for diff

M src/backend/replication/logical/applyparallelworker.c

Doc: minor wording adjustments in transaction isolation discussion.

commit   : ac1e974221cb11465c126097243d5b5050b8d041    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 28 Jun 2023 12:48:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 28 Jun 2023 12:48:14 -0400    

Click here for diff

Re-word for more clarity, per gripe from Anton Sidyakin.  
  
Discussion: https://postgr.es/m/168745911769.2239590.6062411529242609290@wrigleys.postgresql.org  

M doc/src/sgml/mvcc.sgml

Add timeline ID to file names generated with pg_waldump --save-fullpage

commit   : b381d9637030c163c3b1f8a9d3de51dfc1b4ee58    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jun 2023 16:26:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jun 2023 16:26:55 +0900    

Click here for diff

Not including the timeline IDs to the file names generated by pg_waldump  
for the individual blocks saved could cause some of these files to be  
overwritten when scanning segments across multiple timelines.  Having  
this information is also as much useful as the LSNs, to be able to know  
from exactly which WAL segment a block is comes from.  
  
While on it, this fixes a few comments in the tests, where the format of  
the file was not described as matching with the reality.  
  
Reported-by: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, David Christensen  
Discussion: https://postgr.es/m/ZJp921+nITFnvBVS@paquier.xyz  

M doc/src/sgml/ref/pg_waldump.sgml
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/t/002_save_fullpage.pl

Ignore invalid indexes when enforcing index rules in ALTER TABLE ATTACH PARTITION

commit   : fc55c7ff8d122feb48aae5889e26499ffe53c0b7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jun 2023 15:57:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jun 2023 15:57:31 +0900    

Click here for diff

A portion of ALTER TABLE .. ATTACH PARTITION is to ensure that the  
partition being attached to the partitioned table has a correct set of  
indexes, so as there is a consistent index mapping between the  
partitioned table and its new-to-be partition.  However, as introduced  
in 8b08f7d, the current logic could choose an invalid index as a match,  
which is something that can exist when dealing with more than two levels  
of partitioning, like attaching a partitioned table (that has  
partitions, with an index created by CREATE INDEX ON ONLY) to another  
partitioned table.  
  
A partitioned index with indisvalid set to false is equivalent to an  
incomplete partition tree, meaning that an invalid partitioned index  
does not have indexes defined in all its partitions.  Hence, choosing an  
invalid partitioned index can create inconsistent partition index trees,  
where the parent attaching to is valid, but its partition may be  
invalid.  
  
In the report from Alexander Lakhin, this showed up as an assertion  
failure when validating an index.  Without assertions enabled, the  
partition index tree would be actually broken, as indisvalid should  
be switched to true for a partitioned index once all its partitions are  
themselves valid.  With two levels of partitioning, the top partitioned  
table used a valid index and was able to link to an invalid index stored  
on its partition, itself a partitioned table.  
  
I have studied a few options here (like the possibility to switch  
indisvalid to false for the parent), but came down to the conclusion  
that we'd better rely on a simple rule: invalid indexes had better never  
be chosen, so as the partition attached uses and creates indexes that  
the parent expects.  Some regression tests are added to provide some  
coverage.  Note that the existing coverage is not impacted.  
  
This is a problem since partitioned indexes exist, so backpatch all the  
way down to v11.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/14987634-43c0-0cb3-e075-94d423607e08@gmail.com  
Backpatch-through: 11  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Remove dependency to query text in JumbleQuery()

commit   : 2ecbb0a49359759b46dd82df4ac3a083c36b1db4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jun 2023 08:59:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jun 2023 08:59:36 +0900    

Click here for diff

Since 3db72eb, the query ID of utilities is generated using the Query  
structure, making the use of the query string in JumbleQuery()  
unnecessary.  This commit removes the argument "querytext" from  
JumbleQuery().  
  
Reported-by: Joe Conway  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/ZJlQAWE4COFqHuAV@paquier.xyz  

M src/backend/commands/explain.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/parser/analyze.c
M src/include/nodes/queryjumble.h

Fix comment on clearing padding.

commit   : 876d17d62fe84d706058f2458f067f0e9049a230    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 27 Jun 2023 10:11:31 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 27 Jun 2023 10:11:31 +0300    

Click here for diff

Author: Japin Li  
Discussion: https://www.postgresql.org/message-id/MEYP282MB16696317B5DA7D0D92306149B627A@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M contrib/pg_stat_statements/pg_stat_statements.c

Stamp 16beta2.

commit   : 19508f4763b6e55baae788af000ee47e74d24370    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 26 Jun 2023 16:07:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 26 Jun 2023 16:07:19 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

doc: PG 16 relnotes, update for beta 2

commit   : 228a2fab9cdee8bad434a0037e8f5e85c6f30002    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 26 Jun 2023 13:44:40 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 26 Jun 2023 13:44:40 -0400    

Click here for diff

M doc/src/sgml/release-16.sgml

Translation updates

commit   : 3f0199da5a61fd7deff52889679a1a896b41e8ee    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Jun 2023 12:02:02 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Jun 2023 12:02:02 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: ab77975e9d2cde44da796c18af3ec1a66f0df7ae  

M src/backend/po/de.po
M src/backend/po/ja.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ka.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/ja.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/ja.po
M src/pl/plpython/po/ka.po

Change "..." to cstring in old input/output function comments.

commit   : b491a15f8c1468097ca181cbe3a4ce1271781ffb    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 26 Jun 2023 11:52:02 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 26 Jun 2023 11:52:02 +0300    

Click here for diff

It was not clear what the "..." meant.  
  
Author: Steve Chavez  
Discussion: https://www.postgresql.org/message-id/CAGRrpzZzeh7zC3yaVG9di%3DydJ%2BiHwdXnFPB3evGFKvC1zf6ajA@mail.gmail.com  

M src/backend/utils/adt/name.c
M src/backend/utils/adt/varlena.c

Check for interrupts and stack overflow in TParserGet().

commit   : 691594acd67e68d903ea1b7575a7a9097772bbcb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 24 Jun 2023 17:18:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 24 Jun 2023 17:18:08 -0400    

Click here for diff

TParserGet() recurses for some token types, meaning it's possible  
to drive it to stack overflow.  Since this is a minority behavior,  
I chose to add the check_stack_depth() call to the two places that  
recurse rather than doing it during every single call.  
  
While at it, add CHECK_FOR_INTERRUPTS(), because this can run  
unpleasantly long for long inputs.  
  
Per bug #17995 from Zuming Jiang.  This is old, so back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/17995-9f20ff3e6389db4c@postgresql.org  

M src/backend/tsearch/wparser_def.c

doc: rename "decades" to be more generic

commit   : 239fd118b0923c7b3e28354e13fb7cea42f729e1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 23 Jun 2023 22:50:55 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 23 Jun 2023 22:50:55 -0400    

Click here for diff

Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/ZJTzwD2rTbHWWQ9g@paquier.xyz  
  
Backpatch-through: 11  

M doc/src/sgml/history.sgml

Error message refactoring

commit   : 3ad5f07c0fe9a734fb4e2484c7165f9280dbefa7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 23 Jun 2023 16:36:17 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 23 Jun 2023 16:36:17 +0200    

Click here for diff

Take some untranslatable things out of the message and replace by  
format placeholders, to reduce translatable strings and reduce  
translation mistakes.  

M src/backend/replication/logical/launcher.c
M src/backend/replication/slot.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c

doc: Improve punctuation

commit   : b63cda34e2bbdd17be53cf1452f7238fc9385d6c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 23 Jun 2023 14:48:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 23 Jun 2023 14:48:38 +0200    

Click here for diff

M doc/src/sgml/logical-replication.sgml

doc: Clean up title case use

commit   : 37a6d81c457fd507bac0a08758a5dcff5c6225f7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 23 Jun 2023 14:14:57 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 23 Jun 2023 14:14:57 +0200    

Click here for diff

M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/regress.sgml

Fix incorrect error message in libpq_pipeline

commit   : f69a7f08fd01aa7d6dcd2c34dbdc4eb154a5ec12    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 23 Jun 2023 17:49:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 23 Jun 2023 17:49:07 +0900    

Click here for diff

One of the tests for the pipeline mode with portal description expects a  
non-NULL PQgetResult, but used an incorrect error message on failure,  
telling that PQgetResult being NULL was the expected result.  
  
Author: Jelte Fennema  
Discussion: https://postgr.es/m/CAGECzQTkShHecFF+EZrm94Lbsu2ej569T=bz+PjMbw9Aiioxuw@mail.gmail.com  
Backpatch-through: 14  

M src/test/modules/libpq_pipeline/libpq_pipeline.c

Improve privilege documentation for maintenance commands.

commit   : c2122aae636d7121d5cdb64ad1444e1df7f69257    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 22 Jun 2023 15:48:38 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 22 Jun 2023 15:48:38 -0700    

Click here for diff

The documentation of the required privileges for maintenance  
commands (i.e., VACUUM, ANALYZE, CLUSTER, LOCK TABLE, REFRESH  
MATERIALIZED VIEW, and REINDEX) is redundant, inaccurate, and  
difficult to read.  This commit fixes and simplifies this  
documentation by removing references to ownership, superuser, and  
the pg_maintain role.  In addition, this removes notes about  
database-wide VACUUM and ANALYZE, clarifies matters for REINDEX on  
partitioned indexes and tables, and strengthens the description of  
the pg_maintain role.  
  
Reviewed-by: Michael Paquier, Jeff Davis  
Discussion: https://postgr.es/m/20230615041044.GA736001%40nathanxps13  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/user-manag.sgml

Fix cache lookup hazards introduced by ff9618e82a.

commit   : 4dbdb82513b65ab3a29e431f0233009c8a0fa890    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 22 Jun 2023 15:48:20 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 22 Jun 2023 15:48:20 -0700    

Click here for diff

ff9618e82a introduced has_partition_ancestor_privs(), which is used  
to check whether a user has MAINTAIN on any partition ancestors.  
This involves syscache lookups, and presently this function does  
not take any relation locks, so it is likely subject to the same  
kind of cache lookup failures that were fixed by 19de0ab23c.  
  
To fix this problem, this commit partially reverts ff9618e82a.  
Specifically, it removes the partition-related changes, including  
the has_partition_ancestor_privs() function mentioned above.  This  
means that MAINTAIN on a partitioned table is no longer sufficient  
to perform maintenance commands on its partitions.  This is more  
like how privileges for maintenance commands work on supported  
versions.  Privileges are checked for each partition, so a command  
that flows down to all partitions might refuse to process them  
(e.g., if the current user doesn't have MAINTAIN on the partition).  
  
In passing, adjust a few related comments and error messages, and  
add a test for the privilege checks for CLUSTER on a partitioned  
table.  
  
Reviewed-by: Michael Paquier, Jeff Davis  
Discussion: https://postgr.es/m/20230613211246.GA219055%40nathanxps13  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/include/commands/tablecmds.h
M src/test/isolation/expected/cluster-conflict-partition.out
M src/test/isolation/specs/cluster-conflict-partition.spec
M src/test/regress/expected/cluster.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/cluster.sql

Doc: Clarify the behavior of triggers/rules in a logical subscriber.

commit   : f5c446e3367527f9db1506d7c38d2f56e20950b6    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 22 Jun 2023 12:37:19 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 22 Jun 2023 12:37:19 +0530    

Click here for diff

By default, triggers and rules do not fire on a logical replication  
subscriber based on the "session_replication_role" GUC being set to  
"replica". However, the docs in the logical replication section assumed  
that the reader understood how this GUC worked. This modifies the docs to  
be more explicit and links back to the GUC itself.  
  
Author: Jonathan Katz, Peter Smith  
Reviewed-by: Vignesh C, Euler Taveira  
Backpatch-through: 11  
Discussion: https://postgr.es/m/5bb2c9a2-499f-e1a2-6e33-5ce96b35cc4a@postgresql.org  

M doc/src/sgml/logical-replication.sgml

Doc: mention that extended stats aren't used for joins

commit   : c2d35bb88eab99fd81198fa4caee004fb8997c73    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 22 Jun 2023 12:45:30 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 22 Jun 2023 12:45:30 +1200    

Click here for diff

Statistics defined by the CREATE STATISTICS command are only used to  
assist with the selectivity estimations of base relations, never for  
joins.  Here we mention this fact in the notes section of the CREATE  
STATISTICS command.  
  
Discussion: https://postgr.es/m/CAApHDvrMuVgDOrmg_EtFDZ=AOovq6EsJNnHH1ddyZ8EqL4yzMw@mail.gmail.com  
Backpatch-through: 11  

M doc/src/sgml/ref/create_statistics.sgml

nbtree VACUUM: cope with topparent inconsistencies.

commit   : 5f0762f14754597724c24cf6517fe4fe6412a6f9    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 21 Jun 2023 17:41:58 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 21 Jun 2023 17:41:58 -0700    

Click here for diff

Avoid "right sibling %u of block %u is not next child" errors when  
vacuuming a corrupt nbtree index.  Just LOG the issue and press on.  
That way VACUUM will have a decent chance of finishing off all required  
processing for the index (and for the table as a whole).  
  
This is similar to recent work from commit 5abff197, as well as work  
from commit 5b861baa (later backpatched as commit 43e409ce), which  
taught nbtree VACUUM to keep going when its "re-find" check fails.  The  
hardening added by this commit takes place directly after the "re-find"  
check, right before the critical section for the first stage of page  
deletion.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-Wz=dayg0vjs4+er84TS9ami=csdzjpuiCGbEw=idhwqhzQ@mail.gmail.com  
Backpatch: 11- (all supported versions).  

M src/backend/access/nbtree/nbtpage.c

doc: update PG history as over "three decades"

commit   : 05ffc1fadbe0ce7762b209061634b5857b36e1b8    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 21 Jun 2023 19:20:07 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 21 Jun 2023 19:20:07 -0400    

Click here for diff

Reported-by: Pierre <pbaumard@gmail.com>  
  
Discussion: https://postgr.es/m/168724660637.399156.7642965215720120947@wrigleys.postgresql.org  
  
Backpatch-through: 11  

M doc/src/sgml/history.sgml

ICU: do not convert locale 'C' to 'en-US-u-va-posix'.

commit   : f3a01af29b1941ca7937a45504ab10ef5f99cdff    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 21 Jun 2023 13:18:25 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 21 Jun 2023 13:18:25 -0700    

Click here for diff

Older versions of ICU canonicalize "C" to "en-US-u-va-posix"; but  
starting in ICU version 64, the "C" locale is considered  
obsolete. Postgres commit ea1db8ae70 introduced code to always  
canonicalize "C" to "en-US-u-va-posix" for consistency and  
convenience, but it was deemed too confusing.  
  
This commit removes that code, so that "C" is treated like other ICU  
locale names: canonicalization is attempted, and if it fails, the  
behavior is controlled by icu_validation_level.  
  
A similar change was previously committed as f7faa9976c, then reverted  
due to an ICU-version-dependent test failure. This commit un-reverts  
it, omitting the test because we now expect the behavior to depend on  
the version of ICU being used.  
  
Discussion: https://postgr.es/m/3a200aca-4672-4b37-fc91-5d198a323503%40eisentraut.org  
Discussion: https://postgr.es/m/f83f089ee1e9acd5dbbbf3353294d24e1f196e95.camel@j-davis.com  
Discussion: https://postgr.es/m/37520ec1ae9591f83132f82dbd625f3fc2d69c16.camel@j-davis.com  

M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

initdb: change default --locale-provider back to libc.

commit   : 2535c74b1a6190cc42e13f6b6b55d94bff4b7dd6    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 21 Jun 2023 11:10:03 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 21 Jun 2023 11:10:03 -0700    

Click here for diff

Reverts 27b62377b4.  
  
Discussion: https://postgr.es/m/eff031036baa07f325de29215371a4c9e69d61f3.camel@j-davis.com  
Discussion: https://postgr.es/m/3353947.1682092131@sss.pgh.pa.us  

M doc/src/sgml/ref/initdb.sgml
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/scripts/t/020_createdb.pl
M src/test/icu/t/010_database.pl
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Avoid Assert failure when processing empty statement in aborted xact.

commit   : 555b929bbe7bd2f228e804d2c5bf4a246a319358    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 21 Jun 2023 11:07:11 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 21 Jun 2023 11:07:11 -0400    

Click here for diff

exec_parse_message() wants to create a cached plan in all cases,  
including for empty input.  The empty-input path does not have  
a test for being in an aborted transaction, making it possible  
that plancache.c will fail due to trying to do database lookups  
even though there's no real work to do.  
  
One solution would be to throw an aborted-transaction error in  
this path too, but it's not entirely clear whether the lack of  
such an error was intentional or whether some clients might be  
relying on non-error behavior.  Instead, let's hack plancache.c  
so that it treats empty statements with the same logic it  
already had for transaction control commands, ensuring that it  
can soldier through even in an already-aborted transaction.  
  
Per bug #17983 from Alexander Lakhin.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/17983-da4569fcb878672e@postgresql.org  

M src/backend/utils/cache/plancache.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Allow and require passing files on command line of pgperltidy

commit   : 3d9fd1a8743abfe460137f45e8523e710c7cc589    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Jun 2023 16:14:47 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Jun 2023 16:14:47 +0200    

Click here for diff

pgperltidy as well as pgperlcritic and pgperlsyncheck now allow  
passing files and directories on the command line, like pgindent does.  
(Previously, they would always operate on the whole tree.)  
  
Also, for consistency with pgindent's new behavior (as of b16259b3c1),  
passing an argument is now required.  To get the previous default  
behavior, use "pgperltidy ." for example.  
  
Discussion: https://www.postgresql.org/message-id/flat/45aacd8a-5265-d9da-8df2-b8e2c0cf6a07%40eisentraut.org  

M src/tools/perlcheck/find_perl_files
M src/tools/perlcheck/pgperlcritic
M src/tools/perlcheck/pgperlsyncheck
M src/tools/pgindent/README
M src/tools/pgindent/pgperltidy

Disable use of archiving in 009_twophase.pl

commit   : 8cca660b0bfb495306f9abd94fb4bcde783ee8ad    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Jun 2023 16:16:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Jun 2023 16:16:15 +0900    

Click here for diff

This partially reverts 68cb5af, as using archiving to enforce the  
rename of the last partial segment of the old timeline at promotion to  
use .partial as suffix is impacting the tests when it does switchovers.  
As showed by the logs gathered by the CI in the tests that failed, a new  
standby may fail to find the WAL segment it needs to follow a promoted  
instance with its timeline jump, as it got renamed to .partial.  
  
This problem would manifest as a run timeout with 009_twophase.pl, as  
the new standby repeatedly requests a segment from the promoted primary  
that it would not find.  
  
Reported-by: Nathan Bossart  
Discussion: https://postgr.es/m/20230621043345.GA787473@nathanxps13  
Backpatch-through: 13  

M src/test/recovery/t/009_twophase.pl

Fix the errhint message and docs for drop subscription failure.

commit   : a734caa25f79b7bfa423dd97162e5ecf14d1feb5    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 21 Jun 2023 10:36:09 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 21 Jun 2023 10:36:09 +0530    

Click here for diff

The existing errhint message and docs were missing the fact that we can't  
disassociate from the slot unless the subscription is disabled.  
  
Author: Robert Sjöblom, Peter Smith  
Reviewed-by: Peter Eisentraut, Amit Kapila  
Backpatch-through: 11  
Discussion: https://postgr.es/m/807bdf85-61ea-88e2-5712-6d9fcd4eabff@fortnox.se  

M doc/src/sgml/ref/drop_subscription.sgml
M src/backend/commands/subscriptioncmds.c

Move bool parameter for vacuum_rel() to option bits.

commit   : 5b1a8799431279b5f9d56c81b0d0879415e7b45c    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 20 Jun 2023 15:14:58 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 20 Jun 2023 15:14:58 -0700    

Click here for diff

ff9618e82a introduced the skip_privs parameter, which is used to  
skip privilege checks when recursing to a relation's TOAST table.  
This parameter should have been added as a flag bit in  
VacuumParams->options instead.  
  
Suggested-by: Michael Paquier  
Reviewed-by: Michael Paquier, Jeff Davis  
Discussion: https://postgr.es/m/ZIj4v1CwqlDVJZfB%40paquier.xyz  

M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Fix hash join when inner hashkey expressions contain Params.

commit   : 45392626c95c6345d48c1b1b7541add0102ba59f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 17:47:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 17:47:36 -0400    

Click here for diff

If the inner-side expressions contain PARAM_EXEC Params, we must  
re-hash whenever the values of those Params change.  The executor  
mechanism for that exists already, but we failed to invoke it because  
finalize_plan() neglected to search the Hash.hashkeys field for  
Params.  This allowed a previous scan's hash table to be re-used  
when it should not be, leading to rows missing from the join's output.  
(I believe incorrectly-included join rows are impossible however,  
since checking the real hashclauses would reject false matches.)  
  
This bug is very ancient, dating probably to d24d75ff1 of 7.4.  
Sadly, this simple fix depends on the plan representational changes  
made by 2abd7ae9b, so it will only work back to v12.  I thought  
about trying to make some kind of hack for v11, but I'm leery  
of putting code significantly different from what is used in the  
newer branches into a nearly-EOL branch.  Seeing that the bug  
escaped detection for a full twenty years, problematic cases  
must be rare; so I don't feel too awful about leaving v11 as-is.  
  
Per bug #17985 from Zuming Jiang.  Back-patch to v12.  
  
Discussion: https://postgr.es/m/17985-748b66607acd432e@postgresql.org  

M src/backend/optimizer/plan/subselect.c
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

docs: adjust tag indenting and add MERGE mention

commit   : 8a300fc3afce4a0fe8a4c55bc22b2aeec092cf23    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 20 Jun 2023 13:15:18 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 20 Jun 2023 13:15:18 -0400    

Click here for diff

Discussion: https://postgr.es/m/CAMpnoC4_WsY3gsY+ud-Z0GDbafR=K7t7cXn2gatEqFnsRNY3yQ@mail.gmail.com  
  
Author: Will Mortensen  

M doc/src/sgml/mvcc.sgml

Fix another cause of "wrong varnullingrels" planner failures.

commit   : 3af87736bf5d5c7bea086d962afc2bbf4f29279a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 11:09:56 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 11:09:56 -0400    

Click here for diff

I removed the delay_upper_joins mechanism in commit b448f1c8d,  
reasoning that it was only needed when we have a single-table  
(SELECT ... WHERE) as the immediate RHS child of a left join,  
and we could get rid of that by hoisting the WHERE condition into  
the parent join's quals.  However that new code missed a case:  
we could have "foo LEFT JOIN ((SELECT ... WHERE) LEFT JOIN bar)",  
and if the two left joins can be commuted then we now have the  
problematic query shape.  We can fix this too easily enough,  
by allowing the syntactically-lower left join to pass through  
its parent qual location pointer recursively.  That lets  
prepjointree.c discard the SELECT by temporarily hoisting the  
WHERE condition into the ancestor join's qual.  
  
Per bug #17978 from Zuming Jiang.  
  
Discussion: https://postgr.es/m/17978-12f3d93a55297266@postgresql.org  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Don't include outer join relids in lateral_relids bitmapsets.

commit   : efeb12ef0bfef0b5aa966a56bb4dbb1f936bda0c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 10:29:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 10:29:57 -0400    

Click here for diff

This avoids an assertion failure when outer joins are rearranged  
per identity 3.  Listing only the baserels from a PlaceHolderVar's  
ph_lateral set should be enough to ensure that the required values  
are available when we need to compute the PHV --- it's what we  
did before inventing nullingrel sets, after all.  It's a bit  
unsatisfying; but with beta2 hard upon us, there's not time to  
look for an aesthetically cleaner fix.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/CAMbWs48Jcw-NvnxT23WiHP324wG44DvzcH1j4hc0Zn+3sR9cfg@mail.gmail.com  

M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Centralize fixups for mismatched nullingrels in nestloop params.

commit   : 0655c03ef9cc6154b0b209059e758863dcf4e6b0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 10:22:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 10:22:52 -0400    

Click here for diff

It turns out that the fixes we applied in commits bfd332b3f  
and 63e4f13d2 were not nearly enough to solve the problem.  
We'd focused narrowly on subquery RTEs with lateral references,  
but lateral references can occur in several other RTE kinds  
such as function RTEs.  Putting the same hack into half a dozen  
code paths seems quite unattractive.  Hence, revert the code changes  
(but not the test cases) from those commits and instead solve it  
centrally in identify_current_nestloop_params(), as Richard proposed  
originally.  This is a bit annoying because it could mask erroneous  
nullingrels in nestloop params that are generated from non-LATERAL  
parameterized paths; but on balance I don't see a better way.  
Maybe at some future time we'll be motivated to find a more rigorous  
approach to nestloop params, but that's not happening for beta2.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/CAMbWs48Jcw-NvnxT23WiHP324wG44DvzcH1j4hc0Zn+3sR9cfg@mail.gmail.com  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/paramassign.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Add b334612b8 to .git-blame-ignore-revs.

commit   : 596114164699bbe184969df374fd6a1d8a93a57c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 09:52:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 09:52:52 -0400    

Click here for diff

M .git-blame-ignore-revs

Pre-beta2 mechanical code beautification.

commit   : b334612b8aee9f9a34378982d8938b201dfad323    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 09:50:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Jun 2023 09:50:43 -0400    

Click here for diff

Run pgindent and pgperltidy.  It seems we're still some ways  
away from all committers doing this automatically.  Now that  
we have a buildfarm animal that will whine about poorly-indented  
code, we'll try to keep the tree more tidy.  
  
Discussion: https://postgr.es/m/3156045.1687208823@sss.pgh.pa.us  

M src/backend/executor/execUtils.c
M src/backend/libpq/hba.c
M src/backend/replication/logical/tablesync.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/smgr/md.c
M src/backend/utils/adt/pgstatfuncs.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/scripts/t/020_createdb.pl
M src/include/utils/backend_status.h
M src/test/subscription/t/033_run_as_table_owner.pl

test_extensions: make meson.build consistent with Makefile.

commit   : 877bf52cffe587d33556e6259f610eb932699706    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 19 Jun 2023 18:08:59 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 19 Jun 2023 18:08:59 -0700    

Click here for diff

Specify --no-locale and --encoding=UTF8 to be consistent with the  
Makefile, which specifies NO_LOCALE=1. Fixes test for some locales  
when meson is used and ICU is disabled. May have been an oversight in  
e6927270cd.  
  
Also switch argument order in unaccent/meson.build to make it  
consistent in style.  
  
Discussion: https://postgr.es/m/CABwTF4Wz41pNMJ9q3tpH=6mnvg6aopDU5Lzvers5=6=WJVekww@mail.gmail.com  
Author: Gurjeet Singh  
Author: Jeff Davis  

M contrib/unaccent/meson.build
M src/test/modules/test_extensions/meson.build

Enable archiving in recovery TAP test 009_twophase.pl

commit   : 68cb5af46cd8bb2f6fd25886da5d6045a6a42208    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Jun 2023 10:25:27 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Jun 2023 10:25:27 +0900    

Click here for diff

This is a follow-up of f663b00, that has been committed to v13 and v14,  
tweaking the TAP test for two-phase transactions so as it provides  
coverage for the bug that has been fixed.  This change is done in its  
own commit for clarity, as v15 and HEAD did not show the problematic  
behavior, still missed coverage for it.  
  
While on it, this adds a comment about the dependency of the last  
partial segment rename and RecoverPreparedTransactions() at the end of  
recovery, as that can be easy to miss.  
  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/743b9b45a2d4013bd90b6a5cba8d6faeb717ee34.camel@cybertec.at  
Backpatch-through: 13  

M src/backend/access/transam/xlog.c
M src/test/recovery/t/009_twophase.pl

fd.c: Retry after EINTR in more places

commit   : 0d369ac650041862ed5006885160f36d24b224a4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 19 Jun 2023 14:11:32 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 19 Jun 2023 14:11:32 -0700    

Click here for diff

Starting with 4d330a61bb1 we can use posix_fallocate() to extend  
files. Unfortunately in some situation, e.g. on tmpfs filesystems, EINTR may  
be returned. See also 4518c798b2b.  
  
To fix, add a retry path to FileFallocate(). In contrast to 4518c798b2b the  
amount we extend by is limited and the extending may happen at a high  
frequency, so disabling signals does not appear to be the correct path here.  
  
Also add retry paths to other file operations currently lacking them (around  
fdatasync(), fsync(), ftruncate(), posix_fadvise(), sync_file_range(),  
truncate()) - they are all documented or have been observed to return EINTR.  
  
Even though most of these functions used in the back branches, it does not  
seem worth the risk to backpatch - outside of the new-to-16 case of  
posix_fallocate() I am not aware of problem reports due to the lack of  
retries.  
  
Reported-by: Christoph Berg <myon@debian.org>  
Discussion: https://postgr.es/m/ZEZDj1H61ryrmY9o@msg.df7cb.de  
Backpatch: -  

M src/backend/storage/file/fd.c

pg_regress: for --no-locale, use LOCALE='C'.

commit   : 797f98036400bc70d4b331c5b1760a05aab59cfa    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 19 Jun 2023 11:51:22 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 19 Jun 2023 11:51:22 -0700    

Click here for diff

Instead of specifying LC_COLLATE='C' and LC_CTYPE='C', specify  
LOCALE='C' which will also affect ICU. This makes pg_regress  
consistent with recent changes to initdb in commit a14e75eb0b6.  
  
Fixes buildfarm failure.  
  
Discussion: https://postgr.es/m/2458565.1686953169@sss.pgh.pa.us  

M src/test/regress/pg_regress.c

Don't use partial unique indexes for unique proofs in the planner

commit   : 7fcd7ef2a9c372b789f95b40043edffdc611c566    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 19 Jun 2023 13:00:42 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 19 Jun 2023 13:00:42 +1200    

Click here for diff

Here we adjust relation_has_unique_index_for() so that it no longer makes  
use of partial unique indexes as uniqueness proofs.  It is incorrect to  
use these as the predicates used by check_index_predicates() to set  
predOK makes use of not only baserestrictinfo quals as proofs, but also  
qual from join conditions.  For relation_has_unique_index_for()'s case, we  
need to know the relation is unique for a given set of columns before any  
joins are evaluated, so if predOK was only set to true due to some join  
qual, then it's unsafe to use such indexes in  
relation_has_unique_index_for().  The final plan may not even make use  
of that index, which could result in reading tuples that are not as  
unique as the planner previously expected them to be.  
  
Bug: #17975  
Reported-by: Tor Erik Linnerud  
Backpatch-through: 11, all supported versions  
Discussion: https://postgr.es/m/17975-98a90c156f25c952%40postgresql.org  

M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

CREATE DATABASE: make LOCALE apply to all collation providers.

commit   : a14e75eb0b6a73821e0d66c0d407372ec8376105    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 16 Jun 2023 10:27:32 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 16 Jun 2023 10:27:32 -0700    

Click here for diff

For CREATE DATABASE, make LOCALE parameter apply regardless of the  
provider used. Also affects initdb and createdb --locale arguments.  
  
Previously, LOCALE (and --locale) only affected the database default  
collation when using the libc provider.  
  
Discussion: https://postgr.es/m/1a63084d-221e-4075-619e-6b3e590f673e@enterprisedb.com  
Reviewed-by: Peter Eisentraut  

M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/initdb.sgml
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/scripts/createdb.c
M src/bin/scripts/t/020_createdb.pl
M src/test/icu/t/010_database.pl
M src/test/regress/expected/collate.icu.utf8.out

libpq: Add missing gettext trigger

commit   : c0d951262c80f42b3bfe037f940e103a24da84f4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Jun 2023 10:53:22 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Jun 2023 10:53:22 +0200    

Click here for diff

libpq_ngettext() was missing.  This was an ancient mistake (commit  
acd08d764a).  

M src/interfaces/libpq/nls.mk

Add missing pg_basebackup TAP test for meson.

commit   : 0225eec80bddbf69d0509851b2df2bafd62fcc30    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 16 Jun 2023 10:32:49 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 16 Jun 2023 10:32:49 +0900    

Click here for diff

011_in_place_tablespace was missing from the list of pg_basebackup  
tests to run under meson, so add it.  
  
Oversight in 363e8f9115.  
  
Discussion: https://postgr.es/m/CAD21AoDTh1A8bvNBF3LQNQg=27xTpSgvpT+4_yyEj6p4Zv8unA@mail.gmail.com  

M src/bin/pg_basebackup/meson.build

Fix typo in comment.

commit   : 160c23b5fa0243d2f743cc70c96dac44d9932645    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 16 Jun 2023 10:04:22 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 16 Jun 2023 10:04:22 +0900    

Click here for diff

Back-patch down to 11.  
  
Author: Sho Kato (<kato-sho@fujitsu.com>)  
Discussion: https://postgr.es/m/TYCPR01MB68499042A33BC32241193AAF9F5BA%40TYCPR01MB6849.jpnprd01.prod.outlook.com  

M src/backend/rewrite/rewriteHandler.c

When removing a left join, clean out references in EquivalenceClasses.

commit   : f4c00d138f6dea4c9d8af8ec280b7edc9b0a29e1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 15 Jun 2023 15:24:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 15 Jun 2023 15:24:50 -0400    

Click here for diff

Since commit b448f1c8d, we've been able to remove left joins  
(that are otherwise removable) even when they are underneath  
other left joins, a case that was previously prevented by a  
delay_upper_joins check.  This is a clear improvement, but  
it has a surprising side-effect: it's now possible that there  
are EquivalenceClasses whose relid sets mention the removed  
baserel and/or outer join.  If we fail to clean those up,  
we may drop essential join quals due to not having any join  
level that appears to satisfy their relid sets.  
  
(It's not quite 100% clear that this was impossible before.  
But the lack of complaints since we added join removal a dozen  
years ago strongly suggests that it was impossible.)  
  
Richard Guo and Tom Lane, per bug #17976 from Zuming Jiang  
  
Discussion: https://postgr.es/m/17976-4b638b525e9a983b@postgresql.org  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Remove outdated reference to a removed file

commit   : 5c8c8079b0f93bb714b14e4ce9b463411cad7db4    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Thu, 15 Jun 2023 18:39:45 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Thu, 15 Jun 2023 18:39:45 +0900    

Click here for diff

parse_jsontable.c was removed as part of 2f2b18bd3f55, though its  
mention in src/backend/parser/README was not.  Fix that.  
  
Discussion: https://postgr.es/m/CA%2BHiwqHDzw8AP8p_dEkFr0xg458ZTf58zbivAHhK4UeNrx9Tdg%40mail.gmail.com  

M src/backend/parser/README

libpq: Fix up some error message coding

commit   : d6326ba8fe69ced797412ea9bb97b2f35588f791    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jun 2023 13:54:37 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jun 2023 13:54:37 +0200    

Click here for diff

This applies the new error message API from commit 0873b2d354 to the  
changes introduced by bbf9c282ce.  The latter was committed shortly  
after the former, so it probably didn't get the news in time.  

M src/interfaces/libpq/fe-protocol3.c

Add missing subscription TAP test for meson

commit   : ac68323a8788a881aa37671126346c08b1b08091    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 15 Jun 2023 17:27:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 15 Jun 2023 17:27:21 +0900    

Click here for diff

033_run_as_table_owner was missing from the list of subscription tests  
to run under meson, so add it.  
  
Oversight in 4826759.  
  
Author: Hayato Kuroda  
Discussion: https://postgr.es/m/TYAPR01MB58668F4D85A9A122A158F442F55BA@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/test/subscription/meson.build

Replace GUC_UNIT_MEMORY|GUC_UNIT_TIME with GUC_UNIT.

commit   : a54fc892ad0a5673d75b199128b1f5fcf5e1a41d    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 15 Jun 2023 17:04:19 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 15 Jun 2023 17:04:19 +0900    

Click here for diff

We used (GUC_UNIT_MEMORY | GUC_UNIT_TIME) instead of GUC_UNIT some  
places but we already define it in guc.h. This commit replaces them  
with GUC_UNIT for better consistency with their surrounding code.  
  
Author: Japin Li  
Reviewed-by: Richard Guo, Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/MEYP282MB1669EC0FED922F7A151673ACB65AA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/utils/misc/guc.c

intarray: Prevent out-of-bound memory reads with gist__int_ops

commit   : c00fbe89dc51c13eae1ca71460bcddfc3dde5081    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 15 Jun 2023 13:45:34 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 15 Jun 2023 13:45:34 +0900    

Click here for diff

As gist__int_ops stands in intarray, it is possible to store GiST  
entries for leaf pages that can cause corruptions when decompressed.  
Leaf nodes are stored as decompressed all the time by the compression  
method, and the decompression method should map with that, retrieving  
the contents of the page without doing any decompression.  However, the  
code authorized the insertion of leaf page data with a higher number of  
array items than what can be supported, generating a NOTICE message to  
inform about this matter (199 for a 8k page, for reference).  When  
calling the decompression method, a decompression would be attempted on  
this leaf node item but the contents should be retrieved as they are.  
  
The NOTICE message generated when dealing with the compression of a leaf  
page and too many elements in the input array for gist__int_ops has been  
introduced by 08ee64e, removing the marker stored in the array to track  
if this is actually a leaf node.  However, it also missed the fact that  
the decompression path should do nothing for a leaf page.  Hence, as the  
code stand, a too-large array would be stored as uncompressed but the  
decompression path would attempt a decompression rather that retrieving  
the contents as they are.  
  
This leads to various problems.  First, even if 08ee64e tried to address  
that, it is possible to do out-of-bound chunk writes with a large input  
array, with the backend informing about that with WARNINGs.  On  
decompression, retrieving the stored leaf data would lead to incorrect  
memory reads, leading to crashes or even worse.  
  
Perhaps somebody would be interested in expanding the number of array  
items that can be handled in a leaf page for this operator in the  
future, which would require revisiting the choice done in 08ee64e, but  
based on the lack of reports about this problem since 2005 it does not  
look so.  For now, this commit prevents the insertion of data for leaf  
pages when using more array items that the code can handle on  
decompression, switching the NOTICE message to an ERROR.  If one wishes  
to use more array items, gist__intbig_ops is an optional choice.  
  
While on it, use ERRCODE_PROGRAM_LIMIT_EXCEEDED as error code when a  
limit is reached, because that's what the module is facing in such  
cases.  
  
Author: Ankit Kumar Pandey, Alexander Lakhin  
Reviewed-by: Richard Guo, Michael Paquier  
Discussion: https://postgr.es/m/796b65c3-57b7-bddf-b0d5-a8afafb8b627@gmail.com  
Discussion: https://postgr.es/m/17888-f72930e6b5ce8c14@postgresql.org  
Backpatch-through: 11  

M contrib/intarray/_int_gist.c
M contrib/intarray/expected/_int.out
M contrib/intarray/sql/_int.sql

Fix possible crash in tablesync worker.

commit   : b5c517379a40fa1af84c0852aa3730a5875a6482    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 15 Jun 2023 08:37:48 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 15 Jun 2023 08:37:48 +0530    

Click here for diff

Commit c3afe8cf5a added a new password_required option but forgot that you  
need database access to check whether an arbitrary role ID is a superuser.  
  
Commit e7e7da2f8d fixed a similar bug in apply worker, and this patch  
fixes a similar bug in tablesync worker.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB571607F5A9D723755268D36294759@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/tablesync.c

Make parseNodeString() C idiom compatible with Visual Studio 2015.

commit   : f9f31aa91f82df863a35354893978e1937863d7c    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Wed, 14 Jun 2023 05:31:54 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Wed, 14 Jun 2023 05:31:54 -0700    

Click here for diff

Between v15 and now, this function's "else if" chain grew from 252 lines  
to 592 lines, exceeding a compiler limit that manifests as "fatal error  
C1026: parser stack overflow, program too complex (compiling source file  
src/backend/nodes/readfuncs.c)".  Use "if (...)  return ...;" instead.  
  
Reviewed by Tom Lane, Peter Eisentraut and Michael Paquier.  Not all  
reviewers endorse this.  
  
Discussion: https://postgr.es/m/20230607185458.GA1334487@rfd.leadboat.com  

M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/readfuncs.c

Fix typo in comment.

commit   : 4327f6c7480fea9348ea6825a9d38a71b2ef8785    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 14 Jun 2023 13:28:41 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 14 Jun 2023 13:28:41 +0900    

Click here for diff

Introduced in 4d330a61bb1.  
  
Author: Masahiko Sawada  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAD21AoDg8rTWJkrNJg9UTP89vS8smfib2c55DVqKrCn8zR-GYA@mail.gmail.com  

M src/backend/storage/smgr/md.c

Retain relkind too in RTE_SUBQUERY entries for views.

commit   : 0f8cfaf8921fed35f0b92d918ce95eec7b46ff05    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Tue, 13 Jun 2023 12:52:47 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Tue, 13 Jun 2023 12:52:47 +0900    

Click here for diff

47bb9db75 modified the ApplyRetrieveRule()'s conversion of a view's  
original RTE_RELATION entry into an RTE_SUBQUERY one to retain relid,  
rellockmode, and perminfoindex so that the executor can lock the view  
and check its permissions.  It seems better to also retain  
relkind for cross-checking that the exception of an  
RTE_SUBQUERY entry being allowed to carry relation details only  
applies to views, so do so.  
  
Bump catversion because this changes the output format of  
RTE_SUBQUERY RTEs.  
  
Suggested-by: David Steele <david@pgmasters.net>  
Reviewed-by: David Steele <david@pgmasters.net>  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/3953179e-9540-e5d1-a743-4bef368785b0%40pgmasters.net  

M src/backend/executor/execMain.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/rewrite/rewriteHandler.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h

Fix make_etags breakage on certain platforms.

commit   : ae66716bf3ef6fa9b33904eaf15441813a150320    
  
author   : Tatsuo Ishii <ishii@postgresql.org>    
date     : Wed, 14 Jun 2023 11:02:50 +0900    
  
committer: Tatsuo Ishii <ishii@postgresql.org>    
date     : Wed, 14 Jun 2023 11:02:50 +0900    

Click here for diff

make_etags produced wrong format TAGS files on platforms such as Mac,  
which uses non-Exuberant ctags.  
  
Author: Masahiko Sawada  
Reviewed-by: Tatsuo Ishii  
Backpatch-through: 15  
Discussion: https://postgr.es/m/CAD21AoDmCqpS%2BU6b9Bc-b4OFx3tz%3DNv6O2KVkoVg7sHk60spjA%40mail.gmail.com  

M src/tools/make_ctags

Fix "wrong varnullingrels" for Memoize's lateral references, too.

commit   : 63e4f13d2a78124c798165814a679b0534db87a5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 13 Jun 2023 18:01:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 13 Jun 2023 18:01:33 -0400    

Click here for diff

The issue fixed in commit bfd332b3f can also bite Memoize plans,  
because of the separate copies of lateral reference Vars made  
by paraminfo_get_equal_hashops.  Apply the same hacky fix there.  
  
(In passing, clean up shaky grammar in the existing comments  
for this function.)  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4-krwk0Wbd6WdufMAupuou_Ua73ijQ4XQCr1Mb5BaVtKQ@mail.gmail.com  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/setrefs.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

commit   : 792213f2e9f6d321d5a463f4a0fc263c2b770ac3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 13 Jun 2023 15:58:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 13 Jun 2023 15:58:37 -0400    

Click here for diff

rewriteRuleAction neglected to check for SubLink nodes in the  
securityQuals of range table entries.  This could lead to failing  
to convert such a SubLink to a SubPlan, resulting in assertion  
crashes or weird errors later in planning.  
  
In passing, fix some poor coding in rewriteTargetView:  
we should not pass the source parsetree's hasSubLinks  
field to ReplaceVarsFromTargetList's outer_hasSubLinks.  
ReplaceVarsFromTargetList knows enough to ignore that  
when a Query node is passed, but it's still confusing  
and bad precedent: if we did try to update that flag  
we'd be updating a stale copy of the parsetree.  
  
Per bug #17972 from Alexander Lakhin.  This has been broken since  
we added RangeTblEntry.securityQuals (although the presented test  
case only fails back to 215b43cdc), so back-patch all the way.  
  
Discussion: https://postgr.es/m/17972-f422c094237847d0@postgresql.org  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

doc: Move list entry to proper position

commit   : b93c63d1972a28ffa3e16c2bc71fd60d82a57f73    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 13 Jun 2023 15:00:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 13 Jun 2023 15:00:52 +0200    

Click here for diff

M doc/src/sgml/ref/psql-ref.sgml

Report stats when replaying XLOG_RUNNING_XACTS

commit   : e3cb1a586cef746326eeabf36d103ea1136607f9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 12 Jun 2023 15:06:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 12 Jun 2023 15:06:12 -0700    

Click here for diff

Previously stats in the startup process would only get reported during  
shutdown of the startup process. It has been that way for a long time, but  
became a lot more noticeable with the new pg_stat_io view, which separates out  
IO done by different backend types...  
  
While replaying after every XLOG_RUNNING_XACTS isn't the prettiest approach,  
it has the advantage of being quite easy. Given that we're well past feature  
freeze...  
  
It's not a problem that we don't report stats more frequently with  
wal_level=minimal, in that case stats can't be read before the stats process  
has shut down.  
  
Besides the above, this commit also changes pgstat_report_stat() to acquire  
the timestamp with GetCurrentTimestamp() instead of  
GetCurrentTransactionStopTimestamp().  
  
Thanks to Melih Mutlu, Kyotaro Horiguchi for prototypes of other approaches to  
solving this issue.  
  
Reported-by: Fujii Masao <masao.fujii@oss.nttdata.com>  
Discussion: https://postgr.es/m/5315aedc-fbca-1556-c5de-dc2e00b23a14@oss.nttdata.com  

M src/backend/storage/ipc/standby.c
M src/backend/utils/activity/pgstat.c

Accept fractional seconds in jsonpath's datetime() method.

commit   : 7398e27224f173306e5b62977672b29f5553ee76    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 12 Jun 2023 10:54:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 12 Jun 2023 10:54:28 -0400    

Click here for diff

Commit 927d9abb6 purported to make datetime() accept any string  
that could be output for a datetime value by to_jsonb().  But it  
overlooked the possibility of fractional seconds being present,  
so that cases as simple as to_jsonb(now()) would defeat it.  
  
Fix by adding formats that include ".US" to the list in  
executeDateTimeMethod().  (Note that while this is nominally  
microseconds, it'll do the right thing for fractions with  
fewer than six digits.)  
  
In passing, re-order the list to restore the datatype ordering  
specified in its comment.  The violation accidentally did not  
break anything; but the next edit might be less lucky, so add  
more comments.  
  
Per report from Tim Field.  Back-patch to v13 where datetime()  
was added, like the previous patch.  
  
Discussion: https://postgr.es/m/014A028B-5CE6-4FDF-AC24-426CA6FC9CEE@mohiohio.com  

M src/backend/utils/adt/jsonpath_exec.c
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql

src/tools/msvc/clean.bat: Reconcile with PostgreSQL 16 work.

commit   : 0c524370203b85b49ca3b52c7a705b867d7c7167    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 12 Jun 2023 07:40:39 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 12 Jun 2023 07:40:39 -0700    

Click here for diff

M src/tools/msvc/clean.bat

src/tools/msvc: Move all.sym temporary file back to Debug/postgres.

commit   : 6e723f6d7b3642ef9457b8eddd27ebb616d7a7e9    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 12 Jun 2023 07:40:39 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 12 Jun 2023 07:40:39 -0700    

Click here for diff

Commit 70df2df1cc89e69e31b31b6aa0d65fd72935af38 moved it to the  
top_srcdir, where it caused "git status" noise.  

M src/tools/msvc/MSBuildProject.pm

Add win32ver data to meson-built postgres.exe.

commit   : 8c7ad6f1562ba7e8a65b21c40782091a4dd3301d    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 12 Jun 2023 07:40:38 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 12 Jun 2023 07:40:38 -0700    

Click here for diff

As in the older build systems, the resources object is not an input to  
postgres.def.  
  
Reviewed by Andres Freund.  
  
Discussion: https://postgr.es/m/20230607231407.GC1334487@rfd.leadboat.com  

M src/backend/meson.build

Give postgres.exe the icon of other executables.

commit   : 04411cbfdb76194c483c77bdbc636e83099ae5c3    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 12 Jun 2023 07:40:38 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 12 Jun 2023 07:40:38 -0700    

Click here for diff

We had left it icon-free since users won't achieve much by opening it  
from Windows Explorer.  Subsequent to that decision, Task Manager  
started to show the icon.  That shifts the balance in favor of attaching  
the icon, so do so.  No back-patch, but make this late addition to v16.  
  
Reviewed by Andres Freund and Magnus Hagander.  
  
Discussion: https://postgr.es/m/20230608014507.GD1334487@rfd.leadboat.com  

M src/backend/Makefile

Fix "wrong varnullingrels" for subquery nestloop parameters.

commit   : bfd332b3fda5c73e28c05b7ba0aac6cf053cdf00    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 12 Jun 2023 10:01:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 12 Jun 2023 10:01:26 -0400    

Click here for diff

If we apply outer join identity 3 when relation C is a subquery  
having lateral references to relation B, then the lateral references  
within C continue to bear the original syntactically-correct  
varnullingrels marks, but that won't match what is available from  
the outer side of the nestloop.  Compensate for that in  
process_subquery_nestloop_params().  This is a slightly hacky fix,  
but we certainly don't want to re-plan C in toto for each possible  
outer join order, so there's not a lot of better alternatives.  
  
Richard Guo and Tom Lane, per report from Markus Winand  
  
Discussion: https://postgr.es/m/DFBB2D25-DE97-49CA-A60E-07C881EA59A7@winand.at  

M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/paramassign.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Remove a few unused global variables and declarations.

commit   : 548d7260309008b146bd9eaa66f3c5be0a8d725a    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 12 Jun 2023 16:25:37 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 12 Jun 2023 16:25:37 +0300    

Click here for diff

- Commit 3eb77eba5a, which moved the pending ops queue from md.c to  
  sync.c, introduced a duplicate, unused 'pendingOpsCxt'  
  variable. (I'm surprised none of the compilers or static analysis  
  tools have complained about that.)  
  
- Commit c2fe139c20 moved the 'synchronize_seqscans' variable and  
  introduced an extern declaration in tableam.h, making the one in  
  guc_tables.c unnecessary.  
  
- Commit 6f0cf87872 removed the 'pgstat_temp_directory' GUC, but  
  forgot to remove the corresponding global variable.  
  
- Commit 1b4e729eaa removed the 'pg_krb_realm' GUC, and its global  
  variable, but forgot the declaration in auth.h.  
  
Spotted all these by reading the code.  

M src/backend/storage/sync/sync.c
M src/backend/utils/misc/guc_tables.c
M src/include/libpq/auth.h

Fix instability in regression test for Parallel Hash Full Join

commit   : 3e8da50244a8de69317babcfdb048172cf30f14c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 12 Jun 2023 12:19:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 12 Jun 2023 12:19:46 +0900    

Click here for diff

As reported by buildfarm member conchuela, one of the regression tests  
added by 558c9d7 is having some ordering issues.  This commit adds an  
ORDER BY clause to make the output more stable for the problematic  
query.  
  
Fix suggested by Tom Lane.  The plan of the query updated still uses a  
parallel hash full join.  
  
Author: Melanie Plageman  
Discussion: https://postgr.es/m/623596.1684541098@sss.pgh.pa.us  

M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

hstore: Tighten key/value parsing check for whitespaces

commit   : d522b05c8c1c2c430b2c8be795c609f6f4f2ce44    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 12 Jun 2023 09:14:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 12 Jun 2023 09:14:03 +0900    

Click here for diff

isspace() can be locale-sensitive depending on the platform, causing  
hstore to consider as whitespaces characters it should not see as such.  
For example, U+0105, being decoded as 0xC4 0x85 in UTF-8, would be  
discarded from the input given.  
  
This problem is similar to 9ae2661, though it was missed that hstore  
can also manipulate non-ASCII inputs, so replace the existing isspace()  
calls with scanner_isspace().  
  
This problem exists for a long time, so backpatch all the way down.  
  
Author: Evan Jones  
Discussion: https://postgr.es/m/CA+HWA9awUW0+RV_gO9r1ABZwGoZxPztcJxPy8vMFSTbTfi4jig@mail.gmail.com  
Backpatch-through: 11  

M contrib/hstore/Makefile
A contrib/hstore/expected/hstore_utf8.out
A contrib/hstore/expected/hstore_utf8_1.out
M contrib/hstore/hstore_io.c
M contrib/hstore/meson.build
A contrib/hstore/sql/hstore_utf8.sql

nbtree: Allocate new pages in separate function.

commit   : d088ba5a5aa410d39b64f013e8433ad9eb3d17f1    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 10 Jun 2023 14:08:25 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 10 Jun 2023 14:08:25 -0700    

Click here for diff

Split nbtree's _bt_getbuf function is two: code that read locks or write  
locks existing pages remains in _bt_getbuf, while code that deals with  
allocating new pages is moved to a new, dedicated function called  
_bt_allocbuf.  This simplifies most _bt_getbuf callers, since it is no  
longer necessary for them to pass a heaprel argument.  Many of the  
changes to nbtree from commit 61b313e4 can be reverted.  This minimizes  
the divergence between HEAD/PostgreSQL 16 and earlier release branches.  
  
_bt_allocbuf replaces the previous nbtree idiom of passing P_NEW to  
_bt_getbuf.  There are only 3 affected call sites, all of which continue  
to pass a heaprel for recovery conflict purposes.  Note that nbtree's  
use of P_NEW was superficial; nbtree never actually relied on the P_NEW  
code paths in bufmgr.c, so this change is strictly mechanical.  
  
GiST already took the same approach; it has a dedicated function for  
allocating new pages called gistNewBuffer().  That factor allowed commit  
61b313e4 to make much more targeted changes to GiST.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/CAH2-Wz=8Z9qY58bjm_7TAHgtW6RzZ5Ke62q5emdCEy9BAzwhmg@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/access/nbtree.h
M src/include/utils/tuplesort.h

Add another old commit to git-blame-ignore-revs.

commit   : fe879ae3a8e0735ccb12a425e1cdbcedb2f4af81    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 10 Jun 2023 13:55:15 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 10 Jun 2023 13:55:15 -0700    

Click here for diff

M .git-blame-ignore-revs

Revert "Fix search_path to a safe value during maintenance operations."

commit   : 2fcc7ee7affe2fb708d7b2727e93981216b5d2f8    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Sat, 10 Jun 2023 08:11:02 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Sat, 10 Jun 2023 08:11:02 -0700    

Click here for diff

This reverts commit 05e17373517114167d002494e004fa0aa32d1fd1.  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/brin/brin.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/vacuum.c
M src/bin/scripts/t/100_vacuumdb.pl
M src/include/utils/guc.h
M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/vacuum.sql

meson: Add dependencies to perl modules to various script invocations

commit   : a1cd982098c8f6a714870ae512b4a9cdeacb9440    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 9 Jun 2023 20:12:16 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 9 Jun 2023 20:12:16 -0700    

Click here for diff

Eventually it is likely worth trying to deal with this in a more expansive  
way, by generating dependency files generated within the scripts. But it's not  
entirely obvious how to do that in perl and is work more suitable for 17  
anyway.  
  
Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Reviewed-by: Tristan Partin <tristan@neon.tech>  
Discussion: https://postgr.es/m/87v8g7s6bf.fsf@wibble.ilmari.org  

M meson.build
M src/common/meson.build
M src/common/unicode/meson.build
M src/include/catalog/meson.build
M src/include/nodes/meson.build
M src/include/utils/meson.build
M src/interfaces/ecpg/preproc/meson.build
M src/pl/plpgsql/src/meson.build

doc: PG 16 relnotes, add author

commit   : b9e3f8005c99dece44d60cdfad5b904554f4d435    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 9 Jun 2023 21:04:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 9 Jun 2023 21:04:28 -0400    

Click here for diff

Reported-by: Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoDP46y+1yUMikYWhCfkhSEuoXmHq2SV8_PyQoM1uWBRbg@mail.gmail.com  

M doc/src/sgml/release-16.sgml

Fix search_path to a safe value during maintenance operations.

commit   : 05e17373517114167d002494e004fa0aa32d1fd1    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 9 Jun 2023 11:20:47 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 9 Jun 2023 11:20:47 -0700    

Click here for diff

While executing maintenance operations (ANALYZE, CLUSTER, REFRESH  
MATERIALIZED VIEW, REINDEX, or VACUUM), set search_path to  
'pg_catalog, pg_temp' to prevent inconsistent behavior.  
  
Functions that are used for functional indexes, in index expressions,  
or in materialized views and depend on a different search path must be  
declared with CREATE FUNCTION ... SET search_path='...'.  
  
This change addresses a security risk introduced in commit 60684dd834,  
where a role with MAINTAIN privileges on a table may be able to  
escalate privileges to the table owner. That commit is not yet part of  
any release, so no need to backpatch.  
  
Discussion: https://postgr.es/m/e44327179e5c9015c8dda67351c04da552066017.camel%40j-davis.com  
Reviewed-by: Greg Stark  
Reviewed-by: Nathan Bossart  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/brin/brin.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/vacuum.c
M src/bin/scripts/t/100_vacuumdb.pl
M src/include/utils/guc.h
M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/vacuum.sql

Fix missing word in nbtree/README.

commit   : 9aee26a491ba9b7ceff40e6192183ab7200b6bfb    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 8 Jun 2023 21:20:24 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 8 Jun 2023 21:20:24 -0700    

Click here for diff

Reported-by: Daniel Westermann  
Author: Gurjeet Singh  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/ZR0P278MB0427F0E0CE4ED140F52D1923D250A%40ZR0P278MB0427.CHEP278.PROD.OUTLOOK.COM  

M src/backend/access/nbtree/README

Refactor routine to find single log content pattern in TAP tests

commit   : 392ea0c78fdb6cb92f1af0793f6c2d48526e6fed    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 9 Jun 2023 11:56:27 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 9 Jun 2023 11:56:27 +0900    

Click here for diff

The same routine to check if a specific pattern can be found in the  
server logs was copied over four different test scripts.  This refactors  
the whole to use a single routine located in PostgreSQL::Test::Cluster,  
named log_contains, to grab the contents of the server logs and check  
for a specific pattern.  
  
On HEAD, the code previously used assumed that slurp_file() could not  
handle an undefined offset, setting it to zero, but slurp_file() does  
do an extra fseek() before retrieving the log contents only if an offset  
is defined.  In two places, the test was retrieving the full log  
contents with slurp_file() after calling substr() to apply an offset,  
ignoring that slurp_file() would be able to handle that.  
  
Backpatch all the way down to ease the introduction of new tests that  
could rely on the new routine.  
  
Author: Vignesh C  
Reviewed-by: Andrew Dunstan, Dagfinn Ilmari Mannsåker, Michael Paquier  
Discussion: https://postgr.es/m/CALDaNm0YSiLpjCmajwLfidQrFOrLNKPQir7s__PeVvh9U3uoTQ@mail.gmail.com  
Backpatch-through: 11  

M src/test/authentication/t/003_peer.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/033_replay_tsp_drops.pl
M src/test/recovery/t/035_standby_logical_decoding.pl

Honor run_as_owner option in tablesync worker.

commit   : a83edeaf684a70da02fa2bce8b7e3aefa3f906f5    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 9 Jun 2023 10:43:03 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 9 Jun 2023 10:43:03 +0900    

Click here for diff

Commit 482675987 introduced "run_as_owner" subscription option so that  
subscription runs with either the permissions of the subscription  
owner or the permission of the table owner. However, tablesync workers  
did not use this option for the initial data copy.  
  
With this change, tablesync workers run with appropriate permissions  
based on "run_as_owner" option.  
  
Ajin Cherian, with changes and regression tests added by me.  
  
Reported-By: Amit Kapila  
Author: Ajin Cherian, Masahiko Sawada  
Reviewed-by: Ajin Cherian, Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1L=qzRHPEn+qeMoKQGFBzqGoLBzt_ov0A89iFFiut+ppA@mail.gmail.com  

M src/backend/replication/logical/tablesync.c
M src/test/subscription/t/033_run_as_table_owner.pl

Refactor log check logic for connect_ok/fails in PostgreSQL::Test::Cluster

commit   : 26eaf82e7138890022d5d06b77eb745524542fb7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 9 Jun 2023 09:37:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 9 Jun 2023 09:37:21 +0900    

Click here for diff

This commit refactors a bit the code in charge of checking for log  
patterns when connections fail or succeed, by moving the log pattern  
checks into their own routine, for clarity.  This has come up as  
something to improve while discussing the refactoring of find_in_log().  
  
Backpatch down to 14 where these routines are used, to ease the  
introduction of new tests that could rely on them.  
  
Author: Vignesh C, Michael Paquier  
Discussion: https://postgr.es/m/CALDaNm0YSiLpjCmajwLfidQrFOrLNKPQir7s__PeVvh9U3uoTQ@mail.gmail.com  
Backpatch-through: 14  

M src/test/perl/PostgreSQL/Test/Cluster.pm

Fix oversight in outer join removal.

commit   : 9a2dbc614e6e47da3c49daacec106da32eba9467    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jun 2023 17:10:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jun 2023 17:10:04 -0400    

Click here for diff

A placeholder that references the outer join's relid in ph_eval_at  
is logically "above" the join, and therefore we can't remove its  
PlaceHolderInfo: it might still be used somewhere in the query.  
  
This was not an issue pre-v16 because we failed to remove the join  
at all in such cases.  The new outer-join-aware-Var infrastructure  
permits deducing that it's okay to remove the join, but then we  
have to clean up correctly afterwards.  
  
Report and fix by Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4_tuVn9EwwMcggGiZJWWstdXX_ci8FeEU17vs+4nLgw3w@mail.gmail.com  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Re-allow INDEX_VAR as rt_index in ChangeVarNodes().

commit   : fbf80421ead55deaafbefa808960a2695de492c9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jun 2023 13:11:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jun 2023 13:11:49 -0400    

Click here for diff

Apparently some extensions are in the habit of calling  
ChangeVarNodes() with INDEX_VAR as the rt_index to replace.  
That worked before 2489d76c4, at least as long as there were  
not PlaceHolderVars in the expression; but now it fails  
because bms_is_member spits up.  Add a test to avoid that.  
  
Per report from Anton Melnikov, though this is not his  
proposed patch.  
  
Discussion: https://postgr.es/m/5b370a46-f6d2-373d-9dbc-0d55250e82c1@inbox.ru  

M src/backend/rewrite/rewriteManip.c

Fix small overestimation of base64 encoding output length.

commit   : d98ed080bb31fd3d46281127871b7886288686d9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jun 2023 11:24:31 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jun 2023 11:24:31 -0400    

Click here for diff

pg_base64_enc_len() and its clones overestimated the output  
length by up to 2 bytes, as a result of sloppy thinking about  
where to divide.  No callers require a precise estimate, so  
this has no consequences worse than palloc'ing a byte or two  
more than necessary.  We might as well get it right though.  
  
This bug is very ancient, dating to commit 79d78bb26 which  
added encode.c.  (The other instances were presumably copied  
from there.)  Still, it doesn't quite seem worth back-patching.  
  
Oleg Tselebrovskiy  
  
Discussion: https://postgr.es/m/f94da55286a63022150bc266afdab754@postgrespro.ru  

M contrib/pgcrypto/pgp-armor.c
M src/backend/utils/adt/encode.c
M src/common/base64.c

doc: Fix example command for ALTER FOREIGN TABLE ... OPTIONS.

commit   : 378d73ef204d0dcbeab834d52478e8cb90578ab7    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 8 Jun 2023 20:11:52 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 8 Jun 2023 20:11:52 +0900    

Click here for diff

In the documentation, previously the example command for  
ALTER FOREIGN TABLE ... OPTIONS incorrectly included both  
the option name and value with the DROP operation.  
The correct syntax for the DROP operation requires only  
the name of the option to be specified. This commit fixes  
the example by removing the option value from the DROP operation.  
  
Back-patch to all supported versions.  
  
Author: Mehmet Emin KARAKAS <emin100@gmail.com>  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CANQrdXAHzbcEYhjGoe5A42OmfvdQhHFJzyKj9gJvHuDKyOF5Ng@mail.gmail.com  

M doc/src/sgml/ref/alter_foreign_table.sgml

Don't use _BitScanForward64/_BitScanReverse64 on 32-bit MSVC builds

commit   : 53ea2b7ad050ce4ad95c89bb55197209b65886a1    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 8 Jun 2023 10:10:34 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 8 Jun 2023 10:10:34 +1200    

Click here for diff

677319746 added support for making use of MSVC's bit scanning functions.  
However, that commit failed to consider 32-bit MSVC builds where the  
64-bit versions of these functions are unavailable.  This resulted in  
compilation failures on 32-bit MSVC.  
  
Here we adjust the code so we fall back on the manual way of finding the  
bit positions for 64-bit integers when building on 32-bit MSVC.  
  
Bug: #17967  
Reported-by: Youmiu Mo  
Discussion: https://postgr.es/m/17967-cd21e34a314141b2@postgresql.org  

M src/include/port/pg_bitutils.h

Use per-tuple context in ExecGetAllUpdatedCols

commit   : f24523672de9c37423800a74cffa7aec27146047    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 7 Jun 2023 16:48:50 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 7 Jun 2023 16:48:50 +0200    

Click here for diff

Commit fc22b6623b (generated columns) replaced ExecGetUpdatedCols() with  
ExecGetAllUpdatedCols() in a couple places handling UPDATE (triggers and  
lock mode). However, ExecGetUpdatedCols() did exec_rt_fetch() while  
ExecGetAllUpdatedCols() also allocates memory through bms_union()  
without paying attention to the memory context and happened to use the  
long-lived ExecutorState, leaking the memory until the end of the query.  
  
The amount of leaked memory is proportional to the number of (updated)  
attributes, types of UPDATE triggers, and the number of processed rows  
(which for UPDATE ... FROM ... may be much higher than updated rows).  
  
Fixed by switching to the per-tuple context in GetAllUpdatedColumns().  
This is fine for all in-core callers, but external callers may need to  
copy the result. But we're not aware of any such callers.  
  
Note the issue was introduced by fc22b6623b, but the macros were later  
renamed by f50e888990.  
  
Backpatch to 12, where the issue was introduced.  
  
Reported-by: Tomas Vondra  
Reviewed-by: Andres Freund, Tom Lane, Jakub Wartak  
Backpatch-through: 12  
Discussion: https://postgr.es/m/222a3442-7f7d-246c-ed9b-a76209d19239@enterprisedb.com  

M src/backend/executor/execUtils.c

doc: Fix confusing positioning of notes in connection settings

commit   : fb5a7d84d23fa2e1f26334453948a01e8e59eee3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 7 Jun 2023 17:54:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 7 Jun 2023 17:54:53 +0200    

Click here for diff

Reported-by: Jonathan S. Katz <jkatz@postgresql.org>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/flat/6f825d42-a1ce-492a-2ea7-c83e6e65fa8b%40postgresql.org  

M doc/src/sgml/config.sgml

Remove read-only server settings lc_collate and lc_ctype

commit   : b0f6c437160db640d4ea3e49398ebc3ba39d1982    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 7 Jun 2023 16:57:06 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 7 Jun 2023 16:57:06 +0200    

Click here for diff

The GUC settings lc_collate and lc_ctype are from a time when those  
locale settings were cluster-global.  When those locale settings were  
made per-database (PG 8.4), the settings were kept as read-only.  As  
of PG 15, you can use ICU as the per-database locale provider, so  
examining these settings is already less meaningful and possibly  
confusing, since you need to look into pg_database to find out what is  
really happening, and they would likely become fully obsolete in the  
future anyway.  
  
Reviewed-by: Jeff Davis <pgsql@j-davis.com>  
Discussion: https://www.postgresql.org/message-id/696054d1-bc88-b6ab-129a-18b8bce6a6f0@enterprisedb.com  

M contrib/citext/expected/citext_utf8.out
M contrib/citext/expected/citext_utf8_1.out
M contrib/citext/sql/citext_utf8.sql
M doc/src/sgml/config.sgml
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.windows.win1252.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/collate.linux.utf8.sql
M src/test/regress/sql/collate.windows.win1252.sql

Reload configuration more frequently in apply worker.

commit   : d64e6468f489effec356ce3501c0f226ac1cfcc0    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 7 Jun 2023 09:19:17 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 7 Jun 2023 09:19:17 +0530    

Click here for diff

The apply worker was not reloading the configuration while processing  
messages if there is a continuous flow of messages from upstream. It was  
also not reloading the configuration if there is a change in the  
configuration after it has waited for the message and before receiving the  
new replication message. This can lead to failure in tests because we  
expect that after reload, the behavior of apply worker to respect the  
changed GUCs.  
  
We found this while analyzing a rare buildfarm failure.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB5716AF9079CC0755CD015322947E9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/worker.c

Initialize 'recordXtime' to silence compiler warning.

commit   : 95f0340c3bc745aee3aa90847efd2007e40236e9    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 6 Jun 2023 20:30:53 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 6 Jun 2023 20:30:53 +0300    

Click here for diff

In reality, recordXtime will always be set by the getRecordTimestamp  
call, but the compiler doesn't necessarily see that.  
  
Back-patch to all supported versions.  
  
Author: Tristan Partin  
Discussion: https://www.postgresql.org/message-id/CT5MN8E11U0M.1NYNCHXYUHY41@gonk  

M src/backend/access/transam/xlogrecovery.c

doc: PG 16 relnotes, fix PREPARE/EXECUTE wording

commit   : 3f1aaaa180689f2015e7f7bd01c9be6d7a993b42    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 5 Jun 2023 14:00:37 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 5 Jun 2023 14:00:37 -0400    

Click here for diff

Reported-by: Erik Rijkers  
  
Discussion: https://postgr.es/m/73f361d0-237e-3413-224b-86ab6b71a3dd@xs4all.nl  

M doc/src/sgml/release-16.sgml

Remove obsolete comment

commit   : 08235203ddefde1d0bfb6a1e8bb6ff546a2c7e8c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 5 Jun 2023 15:33:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 5 Jun 2023 15:33:08 +0200    

Click here for diff

OIDs are no longer system columns, since 578b229718.  

M src/include/executor/tuptable.h

Doc: unify use of timestamp with time zone vs timestamptz

commit   : 8cddea9a539cbbdd1b316255c9f404323243fd37    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 5 Jun 2023 17:34:27 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 5 Jun 2023 17:34:27 +1200    

Click here for diff

For pg_stat_all_tables, last_vacuum, last_autovacuum and co all used the  
full "timestamp with time zone" type name.  For consistency, make the  
newly added "last_seq_scan" also use the full type name instead of  
"timestamptz".  
  
Author: Noriyoshi Shinoda  
Discussion: https://postgr.es/m/DM4PR84MB17348EA11FA90A9BE896AF89EE489%40DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/monitoring.sgml

Doc: explain about dependency tracking for new-style SQL functions.

commit   : 0211544969b589e49c40d113822162ee3ed78bd6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jun 2023 13:27:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jun 2023 13:27:34 -0400    

Click here for diff

5.14 Dependency Tracking was not updated when we added new-style  
SQL functions.  Improve that.  
  
Noted by Sami Imseih.  Back-patch to v14 where  
new-style SQL functions came in.  
  
Discussion: https://postgr.es/m/2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com  

M doc/src/sgml/ddl.sgml

Fix pg_dump's failure to honor dependencies of SQL functions.

commit   : 01610747867ff26ca62d099e83e62d97730c40c1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jun 2023 13:05:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jun 2023 13:05:54 -0400    

Click here for diff

A new-style SQL function can contain a parse-time dependency  
on a unique index, much as views and matviews can (such cases  
arise from GROUP BY and ON CONFLICT clauses, for example).  
To dump and restore such a function successfully, pg_dump must  
postpone the function until after the unique index is created,  
which will happen in the post-data part of the dump.  Therefore  
we have to remove the normal constraint that functions are  
dumped in pre-data.  Add code similar to the existing logic  
that handles this for matviews.  I added test cases for both  
as well, since code coverage tests showed that we weren't  
testing the matview logic.  
  
Per report from Sami Imseih.  Back-patch to v14 where  
new-style SQL functions came in.  
  
Discussion: https://postgr.es/m/2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/t/002_pg_dump.pl

Fix misuse of pg_log_info() for details/hints.

commit   : b3f32a6c312c476beecb7864450f4f6c448cd1bc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jun 2023 11:22:05 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jun 2023 11:22:05 -0400    

Click here for diff

Two places in pg_dump_sort.c were using pg_log_info() to add  
more details to a message printed with pg_log_warning().  
This is bad, because at default verbosity level we would  
print the warning line but not the details.  One should use  
pg_log_warning_detail() or pg_log_warning_hint() instead.  
Commit 9a374b77f got rid of most such abuses, but unaccountably  
missed these.  
  
Noted while studying a bug report from Sami Imseih.  
Back-patch to v15 where 9a374b77f came in.  (Prior versions  
don't have the missing-details misbehavior, for reasons  
I didn't bother to track down.)  
  
Discussion: https://postgr.es/m/2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com  

M src/bin/pg_dump/pg_dump_sort.c

doc: Add note to prevent server spoofing with SCRAM

commit   : d0f4824a54104bb831ebcd46982e6e3b337ef5fa    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 3 Jun 2023 17:44:09 -0400    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 3 Jun 2023 17:44:09 -0400    

Click here for diff

The set of recommendations added in the documentation with this commit  
helps in avoiding SCRAM exchanges with untrusted servers.  
  
Author: Jacob Champion, Jonathan Katz  
Reviewed-by: Stephen Frost, Daniel Gustafsson, Michael Paquier  
Discussion: https://postgr.es/m/CAAWbhmg5Gh0JetNbQi7z0yOsdsN9YECv8GoY-QBGBBiip9+JOw@mail.gmail.com  

M doc/src/sgml/runtime.sgml

doc: PG 16 relnotes, add psql \df+ source code change

commit   : 47b7051bc82f11f19df43544045c93549783e962    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 1 Jun 2023 19:59:46 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 1 Jun 2023 19:59:46 -0400    

Click here for diff

Reported-by: bzm@2bz.de  
  
Discussion: https://postgr.es/m/17957-e1db8b1c15af444a@postgresql.org  

M doc/src/sgml/release-16.sgml

doc: add missing "the" in LATERAL sentence.

commit   : 9eb1817d5cb8e85a753ea658059495d0b75a623a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 1 Jun 2023 10:22:16 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 1 Jun 2023 10:22:16 -0400    

Click here for diff

Backpatch-through: 11  

M doc/src/sgml/queries.sgml

doc: PG 16 relnotes, move memory item and reword OUTER item

commit   : e6a254c0d4af1f693f23b2f5fd550914c4c7e90c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 May 2023 07:01:21 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 May 2023 07:01:21 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvqmqxcX2n9NwvsfnsN0be6DjmyLSjz3Jk2DaZO5OLW+pw@mail.gmail.com  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, add memory overhead reduction item

commit   : 409d24485cbee46cbfbc101ac6bde7d890f470b8    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 May 2023 19:32:15 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 May 2023 19:32:15 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvqnUoyrJxS4uqnKo87b3_cUjaDDte4NQag49YHu1oEOgA@mail.gmail.com  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, adjust subscription origin mention

commit   : f7c16a120cfa550214a14e3f42ce949fdd37ec40    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 May 2023 19:08:14 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 May 2023 19:08:14 -0400    

Click here for diff

Reported-by: Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoC+VihMWs3-xVB3Z=8LzLbsQc52TO29o25rzfqcnJDCUQ@mail.gmail.com  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, adjust auto_explain logging item

commit   : 0bcb3ca3b95b2b94de0b337a73aef333e0346c44    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 May 2023 06:04:09 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 30 May 2023 06:04:09 -0400    

Click here for diff

Reported-by: Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/878rdctb7o.fsf@wibble.ilmari.org  

M doc/src/sgml/release-16.sgml

doc: Add missing backend_type to pg_stat_activity

commit   : e77c6c55e8dd834667006d2b3ba5f2868c21671f    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 30 May 2023 10:31:11 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 30 May 2023 10:31:11 +0200    

Click here for diff

Commit 0c679464a8 added the missing backendDesc for B_STANDALONE_BACKEND  
but missed updating the list of backend types in the documentation.  Fix  
by adding it to the list.  
  
Author: Noriyoshi Shinoda <noriyoshi.shinoda@hpe.com>  
Discussion: https://postgr.es/m/DM4PR84MB1734ECEA02BCB59564E8FC03EE4A9@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/monitoring.sgml

doc: PG 16 relnotes: adjust outer/full hash join parallelization

commit   : 5a64640966227eac582f2961b8f4a59cd1cca446    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 29 May 2023 14:36:27 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 29 May 2023 14:36:27 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvph4djrP+zjOK67VcgbB_p9Zn8QoO7Qctt4oQgUC_ejEw@mail.gmail.com  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, fix duplicate author and commit

commit   : 9e28b83ae6fabd8ae03eec7fa9533de018e9306e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 29 May 2023 13:49:05 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 29 May 2023 13:49:05 -0400    

Click here for diff

Reported-by: Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoALE_joh=H-j5sdaAfDs=BXtCy6BQKYZBTi=neU8k0VFw@mail.gmail.com  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, fix "locale" typo and windows locale text

commit   : 503b0556d96f2c8df6ed91c5a8cf11b23f37ce6d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 27 May 2023 23:04:48 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 27 May 2023 23:04:48 -0400    

Click here for diff

Reported-by: Laurenz Albe, Álvaro Herrera  
  
Discussion: https://postgr.es/m/70a09a9fa557b632f4b1505395aaa6c4cb77b55a.camel@cybertec.at  

M doc/src/sgml/release-16.sgml

ICU: use uloc_getDefault() for initdb.

commit   : ec1264f01e374c48707cc7dc18928b4ace0530fb    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 26 May 2023 11:26:11 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 26 May 2023 11:26:11 -0700    

Click here for diff

Simpler, and better preserves the locale name as read from the  
environment.  
  
Author: Daniel Verite  
Discussion: https://postgr.es/m/a6204a46-c077-451b-8f9d-8965d95bb57c@manitou-mail.org  

M src/bin/initdb/initdb.c

Fix joinclause removal logic to cope with cloned clauses.

commit   : 7a844c77ece1bda3b076034bc20142d4bd66db7a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 May 2023 12:13:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 26 May 2023 12:13:19 -0400    

Click here for diff

When we're deleting a no-op LEFT JOIN from the query, we must remove  
the join's joinclauses from surviving relations' joininfo lists.  
The invention of "cloned" clauses in 2489d76c4 broke the logic for  
that; it'd fail to remove clones that include OJ relids outside the  
doomed join's min relid sets, which could happen if that join was  
previously discovered to commute with some other join.  
  
This accidentally failed to cause problems in the majority of cases,  
because we'd never decide that such a cloned clause was evaluatable at  
any surviving join.  However, Richard Guo discovered a case where that  
did happen, leading to "no relation entry for relid" errors later.  
Also, adding assertions that a non-removed clause contains no Vars from  
the doomed join exposes that there are quite a few existing regression  
test cases where the problem happens but is accidentally not exposed.  
  
The fix for this is just to include the target join's commute_above_r  
and commute_below_l sets in the relid set we test against when  
deciding whether a join clause is "pushed down" and thus not  
removable.  
  
While at it, do a little refactoring: the join's relid set can be  
computed inside remove_rel_from_query rather than in the caller.  
  
Patch by me; thanks to Richard Guo for review.  
  
Discussion: https://postgr.es/m/CAMbWs4_PHrRqTKDNnTRsxxQy6BtYCVKsgXm1_gdN2yQ=kmcO5g@mail.gmail.com  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Doc fixes for commit 1e16af8ab5.

commit   : f4a9422c0c37ba638adbab853b8badb98a53ce04    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 25 May 2023 17:05:50 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 25 May 2023 17:05:50 -0700    

Click here for diff

Discussion: https://postgr.es/m/275c47ea-e7f3-e654-c99a-63bc116997d7@enterprisedb.com  

M doc/src/sgml/charset.sgml

commit   : 5abff197cc3ec2b0a1f5a64fd34953d0318bca79    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 25 May 2023 15:33:00 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 25 May 2023 15:33:00 -0700    

Click here for diff

Avoid "right sibling's left-link doesn't match" errors when vacuuming a  
corrupt nbtree index.  Just LOG the issue and press on.  That way VACUUM  
will have a decent chance of finishing off all required processing for  
the index (and for the table as a whole).  
  
This error was seen in the field from time to time (it's more than a  
theoretical risk), so giving VACUUM the ability to press on like this  
has real value.  Nothing short of a REINDEX is expected to fix the  
underlying index corruption, so giving up (by throwing an error) risks  
making a bad situation far worse.  Anything that blocks forward progress  
by VACUUM like this might go unnoticed for a long time.  This could  
eventually lead to a wraparound/xidStopLimit outage.  
  
Note that _bt_unlink_halfdead_page() has always been able to bail on  
page deletion when the target page's left sibling page was in an  
inconsistent state.  It now does the same thing (returns false to back  
out of the second phase of deletion) when it notices sibling link  
corruption in the target page's right sibling page.  
  
This is similar to the work from commit 5b861baa (later backpatched as  
commit 43e409ce), which taught nbtree to press on with vacuuming an  
index when page deletion fails to "re-find" a downlink in the target  
page's parent page.  The "re-find" check seems to make VACUUM bail on  
page deletion more often in practice, but there is no reason to take any  
chances here.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/CAH2-Wzko2q2kP1+UvgJyP9g0mF4hopK0NtQZcxwvMv9_ytGhkQ@mail.gmail.com  
Backpatch: 11- (all supported versions).  

M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c

Fix filtering of "cloned" outer-join quals some more.

commit   : 991a3df227e9e8b16d7399df3961dfaae4ae677c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 25 May 2023 10:28:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 25 May 2023 10:28:33 -0400    

Click here for diff

We've had multiple issues with the clause_is_computable_at logic that  
I introduced in 2489d76c4: it's been known to accept more than one  
clone of the same qual at the same plan node, and also to accept no  
clones at all.  It's looking impractical to get it 100% right on the  
basis of the currently-stored information, so fix it by introducing a  
new RestrictInfo field "incompatible_relids" that explicitly shows  
which outer joins a given clone mustn't be pushed above.  
  
In principle we could populate this field in every RestrictInfo, but  
that would cost space and there doesn't presently seem to be a need  
for it in general.  Also, while deconstruct_distribute_oj_quals can  
easily fill the field with the remaining members of the commutative  
join set that it's considering, computing it in the general case  
seems again pretty complicated.  So for now, just fill it for  
clone quals.  
  
Along the way, fix a bug that may or may not be only latent:  
equivclass.c was generating replacement clauses with is_pushed_down  
and has_clone/is_clone markings that didn't match their  
required_relids.  This led me to conclude that leaving the clone flags  
out of make_restrictinfo's purview wasn't such a great idea after all,  
so add them.  
  
Per report from Richard Guo.  
  
Discussion: https://postgr.es/m/CAMbWs48EYi_9-pSd0ORes1kTmTeAjT4Q3gu49hJtYCbSn2JyeA@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/README
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/restrictinfo.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

doc: fix typo in language tag documentation

commit   : 913b3da6aeda3f887b8796d8098d7227d32580b9    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 25 May 2023 12:49:26 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 25 May 2023 12:49:26 +0200    

Click here for diff

Commit 1e16af8ab5 accidentally mistyped 'language' in one place.  

M doc/src/sgml/charset.sgml

doc: Fix example query for pg_walinspect

commit   : 661bf96cd208238efb45c75e3af5ad400e5b0026    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 25 May 2023 12:43:16 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 25 May 2023 12:43:16 +0200    

Click here for diff

The LIMIT clause had ended up in the wrong place in the query.  
Backpatch to v15 where pg_walinspect was introduced.  
  
Reported-by: Jian He <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/CACJufxHqXDr4NnmwmR6pEiVPAg54J0dgwMuYQzrH5BX6+NtF1g@mail.gmail.com  
Backpatch-through: 15  

M doc/src/sgml/pgwalinspect.sgml

Fix pgbench in prepared mode with an empty pipeline

commit   : 8f5e42d3346924b5d6330208d62ec1b19fdbc110    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 25 May 2023 12:36:18 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 25 May 2023 12:36:18 +0200    

Click here for diff

It crashes because it references memory that's not allocated in that  
particular case.  Fix by allocating it.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/bcf802a6-afc1-95b9-7bf4-c5dd868ec144@gmail.com  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix typo in TAP tests of vacuumdb

commit   : ecb968e7e3da69a39d3efab69fa63fe6c8d04b5f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 25 May 2023 16:26:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 25 May 2023 16:26:08 +0900    

Click here for diff

Noticed while scanning the area, introduced in 582edc3.  

M src/bin/scripts/t/100_vacuumdb.pl

doc: PG 16 relnotes, add author from previous merge

commit   : 46ba86cd32dc499a5cf8fbab7d3f596f4e7852a2    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 May 2023 22:03:40 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 May 2023 22:03:40 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CAFBsxsEMoNdg6CCMuQ-6YJ8G=AgGNMVuiTb5Di5bsoPfBb=9CA@mail.gmail.com  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, wording adjustments

commit   : 5c2c59ba0b5f723b067a6fa8bf8452d41fbb2125    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 May 2023 12:18:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 May 2023 12:18:43 -0400    

Click here for diff

Reported-by: Erik Rijkers  
  
Discussion: https://postgr.es/m/c4a88acf-ab1a-a912-d4a9-5e19b323c5ed@xs4all.nl  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, merge and move vector items

commit   : ad5406246bff5490fbd428c148717c5b87e52ab1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 May 2023 09:54:34 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 May 2023 09:54:34 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CAFBsxsEPg8L2MmGqavc8JByC=WF_Mnkhn-KKnFPkcqh0hydung@mail.gmail.com  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, update xid/subxid searches item

commit   : a817edbf6f302c376f5c0012d19a0474b6bdea88    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 May 2023 00:09:13 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 May 2023 00:09:13 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CAFBsxsEPg8L2MmGqavc8JByC=WF_Mnkhn-KKnFPkcqh0hydung@mail.gmail.com  

M doc/src/sgml/release-16.sgml

Document deprecated createuser option.

commit   : 381d19b3ea0e7593d30a3af8df20d92bbccb775f    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 23 May 2023 19:34:09 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 23 May 2023 19:34:09 -0700    

Click here for diff

2dcd1578c4 left the --role option undocumented, which is  
inconsistent with other deprecated options such as pg_dump's  
--blobs and --no-blobs.  This change adds --role back to  
createuser's documentation and usage output and marks it as  
deprecated.  
  
Suggested-by: Peter Eisentraut  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/0e85c9e7-4804-1cdb-5a4a-c72c328f9ad8%40enterprisedb.com  

M doc/src/sgml/ref/createuser.sgml
M src/bin/scripts/createuser.c
M src/bin/scripts/t/040_createuser.pl

Doc: update src/tools/pginclude/README.

commit   : be3f62ae6e9839b10db0052a973e5fdc5b789abc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 May 2023 18:51:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 May 2023 18:51:43 -0400    

Click here for diff

Commit f62975b2a made headerscheck and cpluspluscheck a little  
smarter than this documentation gave them credit for.  Make  
their docs match current reality.  Also add a warning about the  
layer of dust that has settled on the rest of these scripts.  
  
Discussion: https://postgr.es/m/769950.1684797558@sss.pgh.pa.us  

M src/tools/pginclude/README

Fix the install rule for snowball_create.sql.

commit   : 5df5bea29070b420452bdb257c3dec1cf0419fca    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 May 2023 11:15:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 May 2023 11:15:57 -0400    

Click here for diff

This file could be in the current (build) directory if we just  
built it.  However, when installing from a VPATH build from a  
tarball, it will exist in the source directory and gmake will  
therefore not rebuild it.  Use the $< macro to find out where  
gmake found it.  
  
Oversight in b3a0d8324, which also exposes a buildfarm testing gap:  
we test install from VPATH builds from bare source trees, but not  
from tarballs.  
  
Per report from Christoph Berg.  
  
Discussion: https://postgr.es/m/ZGzEAqjxkkoY3ooH@msg.df7cb.de  

M src/backend/snowball/Makefile

Use lower case for icu_validation_level values

commit   : 0ffbe6e59197e5e2b3bf026f594fabb8ada9bec3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:19:33 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:19:33 +0200    

Click here for diff

Similar to client_min_messages etc.  

M src/backend/utils/misc/postgresql.conf.sample

Punctuation improvement in postgresql.conf.sample

commit   : dfe0169988f32e7cb9c48fad9ab3de71c6c39a55    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:19:12 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:19:12 +0200    

Click here for diff

M src/backend/utils/misc/postgresql.conf.sample

Add newline at end of file

commit   : f40177c904f17721c3d33a6c202b74f3f2d4874d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:18:06 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:18:06 +0200    

Click here for diff

M src/test/ssl/conf/server-rsapss.config

doc: PG 16 relnotes, SIMD improvements

commit   : 5cb54fc310fb84287cbdc74533f3420490a2f63a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 23 May 2023 00:27:01 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 23 May 2023 00:27:01 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CAFBsxsEuAx4_nq=200u=70S5r83C2hzO-a9+c6YXTCbOFeDAfw@mail.gmail.com  

M doc/src/sgml/release-16.sgml

Stamp 16beta1.

commit   : e0b82fc8e8317881ecdd1e28bece55ea0db952da    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 May 2023 17:08:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 May 2023 17:08:08 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

doc: PG 16 relnotes, add major features list

commit   : 60751aa50313b3498de199a3cd62e5f30e6b6091    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 May 2023 13:58:24 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 May 2023 13:58:24 -0400    

Click here for diff

Reported-by: Jonathan Katz  
  
Discussion: https://postgr.es/m/2fd2cc0e-df39-3e77-8fcf-35aad5796b0a@postgresql.org  

M doc/src/sgml/release-16.sgml

Spell the values of libpq's gssdelegation parameter as "0" and "1".

commit   : 1f9f6aa491986ed4e65851e827d021e9c784fd42    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 May 2023 11:50:20 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 May 2023 11:50:20 -0400    

Click here for diff

That's how other boolean options are handled, so do likewise.  
The previous coding with "enable" and "disable" was seemingly  
modeled on gssencmode, but that's a three-way flag.  
  
While at it, add PGGSSDELEGATION to the set of environment  
variables cleared by pg_regress and Utils.pm.  
  
Abhijit Menon-Sen, per gripe from Alvaro Herrera  
  
Discussion: https://postgr.es/m/20230522091609.nlyuu4nolhycqs2p@alvherre.pgsql  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/release-16.sgml
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/t/001_auth.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/regress/pg_regress.c

doc: PG 16 relnotes, improve desc. of pg_log_standby_snapshot()

commit   : 4123455a9e5463495a6e9be8423e671c874ec19f    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 May 2023 10:20:53 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 May 2023 10:20:53 -0400    

Click here for diff

M doc/src/sgml/release-16.sgml

Translation updates

commit   : 473e02f6f9ba1863c59a9e40736a633ed52c139f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 22 May 2023 12:44:31 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 22 May 2023 12:44:31 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 642d41265b1ea68ae71a66ade5c5440ba366a890  

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
M src/backend/po/it.po
M src/backend/po/ja.po
M src/backend/po/ru.po
M src/backend/po/sv.po
M src/backend/po/uk.po
M src/bin/initdb/po/LINGUAS
M src/bin/initdb/po/de.po
M src/bin/initdb/po/el.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/it.po
M src/bin/initdb/po/ja.po
A src/bin/initdb/po/ka.po
M src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/sv.po
M src/bin/initdb/po/uk.po
M src/bin/pg_amcheck/po/LINGUAS
M src/bin/pg_amcheck/po/el.po
M src/bin/pg_amcheck/po/es.po
A src/bin/pg_amcheck/po/it.po
M src/bin/pg_amcheck/po/ja.po
A src/bin/pg_amcheck/po/ka.po
M src/bin/pg_amcheck/po/ru.po
M src/bin/pg_amcheck/po/uk.po
M src/bin/pg_archivecleanup/po/LINGUAS
M src/bin/pg_archivecleanup/po/el.po
M src/bin/pg_archivecleanup/po/es.po
A src/bin/pg_archivecleanup/po/it.po
M src/bin/pg_archivecleanup/po/ja.po
A src/bin/pg_archivecleanup/po/ka.po
A src/bin/pg_archivecleanup/po/pt_BR.po
M src/bin/pg_archivecleanup/po/ru.po
M src/bin/pg_archivecleanup/po/uk.po
M src/bin/pg_basebackup/po/LINGUAS
M src/bin/pg_basebackup/po/de.po
A src/bin/pg_basebackup/po/el.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/it.po
M src/bin/pg_basebackup/po/ja.po
A src/bin/pg_basebackup/po/ka.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_basebackup/po/uk.po
M src/bin/pg_checksums/po/LINGUAS
M src/bin/pg_checksums/po/el.po
M src/bin/pg_checksums/po/es.po
A src/bin/pg_checksums/po/it.po
M src/bin/pg_checksums/po/ja.po
A src/bin/pg_checksums/po/ka.po
A src/bin/pg_checksums/po/pt_BR.po
M src/bin/pg_checksums/po/ru.po
M src/bin/pg_checksums/po/uk.po
M src/bin/pg_config/po/LINGUAS
M src/bin/pg_config/po/de.po
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/it.po
M src/bin/pg_config/po/ja.po
A src/bin/pg_config/po/ka.po
M src/bin/pg_config/po/pt_BR.po
M src/bin/pg_config/po/ru.po
M src/bin/pg_config/po/uk.po
M src/bin/pg_controldata/po/LINGUAS
M src/bin/pg_controldata/po/el.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/it.po
M src/bin/pg_controldata/po/ja.po
A src/bin/pg_controldata/po/ka.po
M src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/uk.po
M src/bin/pg_ctl/po/LINGUAS
M src/bin/pg_ctl/po/cs.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_ctl/po/el.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/it.po
M src/bin/pg_ctl/po/ja.po
A src/bin/pg_ctl/po/ka.po
M src/bin/pg_ctl/po/ko.po
M src/bin/pg_ctl/po/pl.po
M src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_ctl/po/tr.po
M src/bin/pg_ctl/po/uk.po
M src/bin/pg_ctl/po/zh_CN.po
M src/bin/pg_dump/po/LINGUAS
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/el.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/ja.po
A src/bin/pg_dump/po/ka.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_dump/po/sv.po
M src/bin/pg_dump/po/uk.po
M src/bin/pg_resetwal/po/LINGUAS
M src/bin/pg_resetwal/po/el.po
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/it.po
M src/bin/pg_resetwal/po/ja.po
A src/bin/pg_resetwal/po/ka.po
M src/bin/pg_resetwal/po/pt_BR.po
M src/bin/pg_resetwal/po/ru.po
M src/bin/pg_resetwal/po/uk.po
M src/bin/pg_rewind/po/LINGUAS
M src/bin/pg_rewind/po/de.po
M src/bin/pg_rewind/po/el.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_rewind/po/it.po
M src/bin/pg_rewind/po/ja.po
A src/bin/pg_rewind/po/ka.po
M src/bin/pg_rewind/po/ru.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_rewind/po/uk.po
M src/bin/pg_test_fsync/po/LINGUAS
M src/bin/pg_test_fsync/po/el.po
M src/bin/pg_test_fsync/po/es.po
A src/bin/pg_test_fsync/po/it.po
M src/bin/pg_test_fsync/po/ja.po
A src/bin/pg_test_fsync/po/ka.po
A src/bin/pg_test_fsync/po/pt_BR.po
M src/bin/pg_test_fsync/po/ru.po
M src/bin/pg_test_fsync/po/uk.po
M src/bin/pg_test_timing/po/LINGUAS
M src/bin/pg_test_timing/po/es.po
A src/bin/pg_test_timing/po/it.po
M src/bin/pg_test_timing/po/ja.po
A src/bin/pg_test_timing/po/ka.po
A src/bin/pg_test_timing/po/pt_BR.po
M src/bin/pg_test_timing/po/uk.po
M src/bin/pg_upgrade/po/LINGUAS
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_upgrade/po/ja.po
A src/bin/pg_upgrade/po/ka.po
M src/bin/pg_verifybackup/po/LINGUAS
M src/bin/pg_verifybackup/po/de.po
M src/bin/pg_verifybackup/po/el.po
M src/bin/pg_verifybackup/po/es.po
A src/bin/pg_verifybackup/po/it.po
M src/bin/pg_verifybackup/po/ja.po
A src/bin/pg_verifybackup/po/ka.po
M src/bin/pg_verifybackup/po/ru.po
M src/bin/pg_verifybackup/po/uk.po
M src/bin/pg_waldump/po/LINGUAS
M src/bin/pg_waldump/po/de.po
M src/bin/pg_waldump/po/el.po
M src/bin/pg_waldump/po/es.po
M src/bin/pg_waldump/po/fr.po
A src/bin/pg_waldump/po/it.po
M src/bin/pg_waldump/po/ja.po
A src/bin/pg_waldump/po/ka.po
M src/bin/pg_waldump/po/ru.po
M src/bin/pg_waldump/po/sv.po
M src/bin/psql/po/LINGUAS
M src/bin/psql/po/de.po
M src/bin/psql/po/el.po
M src/bin/psql/po/es.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/it.po
M src/bin/psql/po/ja.po
A src/bin/psql/po/ka.po
M src/bin/psql/po/ru.po
M src/bin/psql/po/sv.po
M src/bin/psql/po/uk.po
M src/bin/scripts/po/LINGUAS
M src/bin/scripts/po/de.po
M src/bin/scripts/po/el.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/it.po
M src/bin/scripts/po/ja.po
A src/bin/scripts/po/ka.po
M src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/uk.po
M src/interfaces/ecpg/ecpglib/po/LINGUAS
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/ja.po
A src/interfaces/ecpg/ecpglib/po/ka.po
M src/interfaces/ecpg/ecpglib/po/pt_BR.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/ecpglib/po/uk.po
M src/interfaces/ecpg/preproc/po/LINGUAS
M src/interfaces/ecpg/preproc/po/el.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/it.po
M src/interfaces/ecpg/preproc/po/ja.po
A src/interfaces/ecpg/preproc/po/ka.po
M src/interfaces/ecpg/preproc/po/pt_BR.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/ecpg/preproc/po/uk.po
M src/interfaces/libpq/po/LINGUAS
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/ja.po
A src/interfaces/libpq/po/ka.po
M src/pl/plperl/po/LINGUAS
M src/pl/plperl/po/el.po
M src/pl/plperl/po/es.po
M src/pl/plperl/po/it.po
M src/pl/plperl/po/ja.po
A src/pl/plperl/po/ka.po
M src/pl/plperl/po/pt_BR.po
M src/pl/plperl/po/ru.po
M src/pl/plperl/po/sv.po
M src/pl/plperl/po/uk.po
M src/pl/plpgsql/src/po/LINGUAS
M src/pl/plpgsql/src/po/el.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/it.po
M src/pl/plpgsql/src/po/ja.po
A src/pl/plpgsql/src/po/ka.po
M src/pl/plpgsql/src/po/pt_BR.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpgsql/src/po/sv.po
M src/pl/plpgsql/src/po/uk.po
M src/pl/plpython/po/LINGUAS
M src/pl/plpython/po/de.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/it.po
A src/pl/plpython/po/ka.po
M src/pl/plpython/po/pt_BR.po
M src/pl/plpython/po/ru.po
M src/pl/plpython/po/sv.po
M src/pl/plpython/po/uk.po
M src/pl/tcl/po/LINGUAS
M src/pl/tcl/po/el.po
M src/pl/tcl/po/es.po
M src/pl/tcl/po/it.po
M src/pl/tcl/po/ja.po
A src/pl/tcl/po/ka.po
M src/pl/tcl/po/pt_BR.po
M src/pl/tcl/po/ru.po
M src/pl/tcl/po/sv.po
M src/pl/tcl/po/uk.po

pg_dump doc: mention 'long' is valid for --compress

commit   : 4042b2e18781532d5dd6ee3cef38c4fbb0249202    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 22 May 2023 12:26:40 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 22 May 2023 12:26:40 +0200    

Click here for diff

Apparently an oversight in 2820adf7755d.  

M doc/src/sgml/ref/pg_dump.sgml

doc: PG 16 relnotes, improve description of standby log. decode

commit   : ac298d3cb56b015acd40d2e015e07a87d8aff124    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 23:39:27 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 23:39:27 -0400    

Click here for diff

Improve description of "Allow logical decoding on standbys".  

M doc/src/sgml/release-16.sgml

Rename some createuser options.

commit   : 2dcd1578c40153250836df62f625863056c28a81    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Sun, 21 May 2023 20:03:56 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Sun, 21 May 2023 20:03:56 -0700    

Click here for diff

This change renames --admin to --with-admin, --role to --member-of,  
and --member to --with-member.  Many people found the previous  
names to be confusing.  The --admin and --member options are new in  
v16, but --role has been there for a while, so that one has been  
kept (but left undocumented) for backward compatibility.  
  
Suggested-by: Peter Eisentraut  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/ZFvVZvQDliIWmOwg%40momjian.us  

M doc/src/sgml/ref/createuser.sgml
M src/bin/scripts/createuser.c
M src/bin/scripts/t/040_createuser.pl

doc: PG 16 relnotes, misc merged items and bootstrap detail

commit   : de7c3fd34e0fc0a3f77537e1d12efcd01d255534    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 22:52:42 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 22:52:42 -0400    

Click here for diff

Reported-by: Andres Freund, jian he  
  
Discussion: https://postgr.es/m/20230521171341.jjxykfsefsek4kzj@awork3.anarazel.de, 20230521171341.jjxykfsefsek4kzj@awork3.anarazel.de  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, misc. updates

commit   : c822358a256ca1f3b8b08557b9c9f0efa8d41675    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 15:57:37 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 15:57:37 -0400    

Click here for diff

Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/277016.1684689065@sss.pgh.pa.us  

M doc/src/sgml/release-16.sgml

In clause_is_computable_at(), test required_relids for clone clauses.

commit   : b9c755a2f625b7dca6323804b140b016d95a0b1d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 15:25:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 15:25:43 -0400    

Click here for diff

Use the clause's required_relids not clause_relids for testing  
whether it is computable at the current join level, if it is a  
clone clause generated by deconstruct_distribute_oj_quals().  
  
Arguably, this is more correct and we should do it for all clauses;  
that would at least remove the handwavy claim that we are doing  
it to save cycles compared to inspecting Vars individually.  
However, attempting to do that exposes that we are not being careful  
to compute an accurate value for required_relids in all cases.  
I'm unsure whether it's a good idea to attempt to do that for v16,  
or leave it as future clean-up.  In the meantime, this quick hack  
demonstrably fixes some cases, so let's squeeze it in for beta1.  
  
Patch by me, but great thanks to Richard Guo for investigation  
and testing.  The new test cases are all modeled on his examples.  
  
Discussion: https://postgr.es/m/CAMbWs4-_vwkBij4XOQ5ukxUvLgwTm0kS5_DO9CicUeKbEfKjUw@mail.gmail.com  

M src/backend/optimizer/util/restrictinfo.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Remove over-eager assertion in ExtendBufferedRelTo()

commit   : eabb22525efc40ce0d83580584094a0248ac0682    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 21 May 2023 09:48:37 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 21 May 2023 09:48:37 -0700    

Click here for diff

The assertion checked that the size of the relation is not "too large" - but  
the code is explicitly dealing with the possibility of another backend  
extending the relation concurrently. In that case the new relation size could  
be bigger than what the current backend needs, wrongly triggering an assertion  
failure.  
  
Unfortunately it is hard to write a reliable and affordable regression tests  
for this, as a lot of concurrency is needed to encounter the bug.  
  
Introduced in 31966b151e6a.  
  
Reported-by: Melanie Plageman <melanieplageman@gmail.com>  

M src/backend/storage/buffer/bufmgr.c

Optimize walsender wake up logic using condition variables

commit   : bc971f4025c378ce500d86597c34b0ef996d4d8c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 21 May 2023 09:44:55 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 21 May 2023 09:44:55 -0700    

Click here for diff

WalSndWakeup() currently loops through all the walsenders slots, with a  
spinlock acquisition and release for every iteration, to wake up waiting  
walsenders.  
  
This commonly was not a problem before e101dfac3a53c. But, to allow logical  
decoding on standbys, we need to wake up logical walsenders after every WAL  
record is applied on the standby, rather just when flushing WAL or switching  
timelines.  This causes a performance regression for workloads replaying a lot  
of WAL records.  
  
To solve this, we use condition variable (CV) to efficiently wake up  
walsenders in WalSndWakeup().  
  
Every walsender prepares to sleep on a shared memory CV. Note that it just  
prepares to sleep on the CV (i.e., adds itself to the CV's waitlist), but does  
not actually wait on the CV (IOW, it never calls ConditionVariableSleep()). It  
still uses WaitEventSetWait() for waiting, because CV infrastructure doesn't  
handle FeBe socket events currently. The processes (startup process,  
walreceiver etc.)  wanting to wake up walsenders use  
ConditionVariableBroadcast(), which in turn calls SetLatch(), helping  
walsenders come out of WaitEventSetWait().  
  
We use separate shared memory CVs for physical and logical walsenders for  
selective wake ups, see WalSndWakeup() for more details.  
  
This approach is simple and reasonably efficient. But not very elegant. But  
for 16 it seems to be a better path than a larger redesign of the CV  
mechanism.  A desirable future improvement would be to add support for CVs  
into WaitEventSetWait().  
  
This still leaves us with a small regression in very extreme workloads (due to  
the spinlock acquisition in ConditionVariableBroadcast() when there are no  
waiters) - but that seems acceptable.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Discussion: https://www.postgresql.org/message-id/20230509190247.3rrplhdgem6su6cg%40awork3.anarazel.de  

M src/backend/replication/walsender.c
M src/include/replication/walsender_private.h

doc: PG 16 relnotes, add commits

commit   : 30579d23b22655e340e9806fb3425e73eed60876    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 11:55:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 11:55:50 -0400    

Click here for diff

Reported-by: Ian Lawrence Barwick  
  
Discussion: https://postgr.es/m/CAB8KJ=hLvQDb53WdigV7OBEBh5tzQ7eA=pG0ZpccoRVBUNCXYA@mail.gmail.com  

M doc/src/sgml/release-16.sgml

Doc: fix some rendering problems in the PDF docs build.

commit   : b62381d9a23b4b96259cf560e411137656201704    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 11:21:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 11:21:19 -0400    

Click here for diff

Tweak column widths in a couple of tables to avoid "contents  
... exceed the available area" warnings.  Remove usage of  
some non-Latin-1 characters.  
  
Discussion: https://postgr.es/m/614600.1684537037@sss.pgh.pa.us  

M doc/src/sgml/charset.sgml
M doc/src/sgml/release-16.sgml

Expand some more uses of "deleg" to "delegation" or "delegated".

commit   : a2eb99a01e015a76682911ae3980762f6ee6ac8c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 10:55:18 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 10:55:18 -0400    

Click here for diff

Complete the task begun in 9c0a0e2ed: we don't want to use the  
abbreviation "deleg" for GSS delegation in any user-visible places.  
(For consistency, this also changes most internal uses too.)  
  
Abhijit Menon-Sen and Tom Lane  
  
Discussion: https://postgr.es/m/949048.1684639317@sss.pgh.pa.us  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/libpq.sgml
M src/backend/catalog/system_views.sql
M src/backend/foreign/foreign.c
M src/backend/utils/init/postinit.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/README
M src/test/kerberos/t/001_auth.pl
M src/test/regress/expected/rules.out

Fix remaining references to gss_accept_deleg.

commit   : f4001a553770b3114dd11846c6789ad6c34ef111    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Sat, 20 May 2023 20:18:51 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Sat, 20 May 2023 20:18:51 -0700    

Click here for diff

These were missed in 9c0a0e2ed9.  
  
Discussion: https://postgr.es/m/20230521031757.GA3835667%40nathanxps13  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/postgresql.conf.sample
M src/test/kerberos/t/001_auth.pl

rename "gss_accept_deleg" to "gss_accept_delegation".

commit   : 9c0a0e2ed92a1a94ec30d36f8ea1ab12c928292b    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 May 2023 21:32:54 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 May 2023 21:32:54 -0400    

Click here for diff

This is more consistent with existing GUC spelling.  
  
Discussion: https://postgr.es/m/ZGdnEsGtNj7+fZoa@momjian.us  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M doc/src/sgml/config.sgml
M doc/src/sgml/release-16.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/include/libpq/auth.h
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h

doc: PG 16 relnotes, misc updates

commit   : cf109ffc205063f82258e0643588491a153c3a45    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 May 2023 21:03:13 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 May 2023 21:03:13 -0400    

Click here for diff

*  document to_reg* accepting OIDs  
*  document pg_log_standby_snapshot()  
*  document pg_input_is_valid() and pg_input_error_info()  
*  handle rename of function to pg_split_walfile_name()  
*  fix character encoding problem for Przemyslaw Sztoch  
*  remove partition section  
  
Reported-by: jian he, Tom Lane, Bertrand Drouvot  

M doc/src/sgml/release-16.sgml

Add 0245f8db3 to .git-blame-ignore-revs.

commit   : 1c006c067124403d63b6ad3eac687b4217f05691    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 17:28:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 17:28:04 -0400    

Click here for diff

M .git-blame-ignore-revs

Pre-beta mechanical code beautification.

commit   : 0245f8db36f375326c2bae0c3420d3c77714e72d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 17:24:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 17:24:48 -0400    

Click here for diff

Run pgindent, pgperltidy, and reformat-dat-files.  
  
This set of diffs is a bit larger than typical.  We've updated to  
pg_bsd_indent 2.1.2, which properly indents variable declarations that  
have multi-line initialization expressions (the continuation lines are  
now indented one tab stop).  We've also updated to perltidy version  
20230309 and changed some of its settings, which reduces its desire to  
add whitespace to lines to make assignments etc. line up.  Going  
forward, that should make for fewer random-seeming changes to existing  
code.  
  
Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql  

M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/amcheck/verify_heapam.c
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/basic_archive/basic_archive.c
M contrib/dblink/dblink.c
M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltree_io.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_prewarm/t/001_basic.pl
M contrib/pg_walinspect/pg_walinspect.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/shippable.c
M contrib/seg/seg-validate.pl
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/mk_feature_tables.pl
M src/backend/access/brin/brin.c
M src/backend/access/common/reloptions.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/aclchk.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/indexing.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/alter.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/commands/dropcmds.c
M src/backend/commands/explain.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/view.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execSRF.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/hba.c
M src/backend/nodes/gen_node_support.pl
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/postmaster/fork_process.c
M src/backend/regex/regc_lex.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/syncrep.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/snowball_create.pl
M src/backend/statistics/extended_stats.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/buffile.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/smgr/md.c
M src/backend/tsearch/spell.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/init/postinit.c
M src/backend/utils/init/usercontext.c
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/compress_zstd.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/004_pg_dump_parallel.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/t/002_save_fullpage.pl
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/settings.h
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/200_connstr.pl
M src/bin/scripts/vacuumdb.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/fe_utils/print.c
M src/include/access/amapi.h
M src/include/access/brin_tuple.h
M src/include/access/gist_private.h
M src/include/access/tableam.h
M src/include/access/xlogreader.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_subscription.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/executor/hashjoin.h
M src/include/executor/tuptable.h
M src/include/fe_utils/print.h
M src/include/funcapi.h
M src/include/nodes/primnodes.h
M src/include/port/win32ntdll.h
M src/include/replication/reorderbuffer.h
M src/include/storage/bufmgr.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/utils/backend_status.h
M src/include/utils/pg_locale.h
M src/include/utils/rel.h
M src/include/utils/varlena.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/text2macro.pl
M src/port/dirmod.c
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/authentication/t/003_peer.pl
M src/test/authentication/t/004_file_inclusion.pl
M src/test/icu/t/010_database.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm
M src/test/ldap/t/001_auth.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_custom_rmgrs/t/001_basic.pl
M src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_misc/t/003_check_guc.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
M src/test/perl/PostgreSQL/Test/SimpleTee.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/PostgreSQL/Version.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/028_pitr_timelines.pl
M src/test/recovery/t/029_stats_restart.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/032_relfilenode_reuse.pl
M src/test/recovery/t/033_replay_tsp_drops.pl
M src/test/recovery/t/034_create_database.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/regress/pg_regress.c
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm
M src/test/ssl/t/SSL/Server.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_stats.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/032_subscribe_use_index.pl
M src/test/subscription/t/033_run_as_table_owner.pl
M src/test/subscription/t/100_bugs.pl
M src/timezone/zic.c
M src/tools/PerfectHash.pm
M src/tools/check_bison_recursion.pl
M src/tools/ci/windows_build_config.pl
M src/tools/copyright.pl
M src/tools/gen_export.pl
M src/tools/gen_keywordlist.pl
M src/tools/git_changelog
M src/tools/mark_pgdllimport.pl
M src/tools/msvc/Install.pm
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/build.pl
M src/tools/msvc/config_default.pl
M src/tools/msvc/dummylib/Win32/Registry.pm
M src/tools/msvc/dummylib/Win32API/File.pm
M src/tools/msvc/gendef.pl
M src/tools/msvc/pgbison.pl
M src/tools/msvc/vcregress.pl
M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent
M src/tools/pgindent/typedefs.list
M src/tools/win32tzlist.pl
M src/tutorial/funcs.c

Make agreed-on updates in perltidy options.

commit   : df6b19fbbc20d830de91d9bea68715a39635b568    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 16:43:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 16:43:57 -0400    

Click here for diff

Our standard version of perltidy is now 20230309.  
Add a --valign-exclusion-list setting to reduce crosstalk  
between nearby lines of Perl code.  
  
Also, update instructions for running pgindent  
(missed in b16259b3c).  
  
Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql  

M src/tools/pgindent/README
M src/tools/pgindent/perltidyrc

Do pre-release housekeeping on catalog data.

commit   : 722541ead194635d77163bda057cc0064ff81149    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 16:36:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 16:36:38 -0400    

Click here for diff

Run renumber_oids.pl to move high-numbered OIDs down, as per pre-beta  
tasks specified by RELEASE_CHANGES.  For reference, the command was  
  
./renumber_oids.pl --first-mapped-oid 8000 --target-oid 6200  

M src/include/catalog/catversion.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_proc.dat

Fix thinko in join removal.

commit   : d0f952691ff532aa0c54e9d146fac8d590596646    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 15:24:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 15:24:07 -0400    

Click here for diff

In commit 9df8f903e I (tgl) switched join_is_removable() from  
using the min relid sets of the join under consideration to  
using its full syntactic relid sets.  This was a mistake,  
as it allowed join removal in cases where a reference to the  
join output would survive in some syntactically-lower join  
condition.  Revert to the former coding.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4-EU9uBGSP7G-iTwLBhRQ=rnZKvFDhD+n+xhajokyPCKg@mail.gmail.com  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix misbehavior of EvalPlanQual checks with multiple result relations.

commit   : 70b42f2790292cc30aa07563f343f7ba6749af01    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 14:26:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 14:26:34 -0400    

Click here for diff

The idea of EvalPlanQual is that we replace the query's scan of the  
result relation with a single injected tuple, and see if we get a  
tuple out, thereby implying that the injected tuple still passes the  
query quals.  (In join cases, other relations in the query are still  
scanned normally.)  This logic was not updated when commit 86dc90056  
made it possible for a single DML query plan to have multiple result  
relations, when the query target relation has inheritance or partition  
children.  We replaced the output for the current result relation  
successfully, but other result relations were still scanned normally;  
thus, if any other result relation contained a tuple satisfying the  
quals, we'd think the EPQ check passed, even if it did not pass for  
the injected tuple itself.  This would lead to update or delete  
actions getting performed when they should have been skipped due to  
a conflicting concurrent update in READ COMMITTED isolation mode.  
  
Fix by blocking all sibling result relations from emitting tuples  
during an EvalPlanQual recheck.  In the back branches, the fix is  
complicated a bit by the need to not change the size of struct  
EPQState (else we'd have ABI-breaking changes in offsets in  
struct ModifyTableState).  Like the back-patches of 3f7836ff6  
and 4b3e37993, add a separately palloc'd struct to avoid that.  
The logic is the same as in HEAD otherwise.  
  
This is only a live bug back to v14 where 86dc90056 came in.  
However, I chose to back-patch the test cases further, on the  
grounds that this whole area is none too well tested.  I skipped  
doing so in v11 though because none of the test applied cleanly,  
and it didn't quite seem worth extra work for a branch with only  
six months to live.  
  
Per report from Ante Krešić (via Aleksander Alekseev)  
  
Discussion: https://postgr.es/m/CAJ7c6TMBTN3rcz4=AjYhLPD_w3FFT0Wq_C15jxCDn8U4tZnH1g@mail.gmail.com  

M src/backend/executor/execMain.c
M src/backend/executor/execScan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/replication/logical/worker.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

psql: Tweak xheader_width and pager_min_lines input parsing

commit   : ed7e686a031e5b9469e0813af2f513dfdd77560b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 19 May 2023 20:19:28 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 19 May 2023 20:19:28 +0200    

Click here for diff

Don't throw away the previous value when an invalid value is proposed.  
  
Discussion: https://postgr.es/m/20230519110205.updpbjiuqgbox6gp@alvherre.pgsql  

M src/bin/psql/command.c

Message style improvements

commit   : 8e7912e73da008862180112cc6ba4d0aa5fa955d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 18:45:29 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 18:45:29 +0200    

Click here for diff

M src/backend/access/transam/xlogfuncs.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/check.c
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/scripts/createuser.c
M src/common/compression.c
M src/common/rmtree.c
M src/interfaces/libpq/fe-connect.c

doc: PG 16 relnotes, delete reverted grant, adjust version num

commit   : e5f85744eaa5ca83ff4d27509ed094ca33ed485e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 12:29:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 12:29:50 -0400    

Click here for diff

Reported-by: Nathan Bossart, Sehrope Sarkuni  

M doc/src/sgml/release-16.sgml

Allocate hash join files in a separate memory context

commit   : 8c4040edf456d9241816176eacb79e4d9a0034fc    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 16:31:11 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 16:31:11 +0200    

Click here for diff

Should a hash join exceed memory limit, the hashtable is split up into  
multiple batches. The number of batches is doubled each time a given  
batch is determined not to fit in memory. Each batch file is allocated  
with a block-sized buffer for buffering tuples and parallel hash join  
has additional sharedtuplestore accessor buffers.  
  
In some pathological cases requiring a lot of batches, often with skewed  
data, bad stats, or very large datasets, users can run out-of-memory  
solely from the memory overhead of all the batch files' buffers.  
  
Batch files were allocated in the ExecutorState memory context, making  
it very hard to identify when this batch explosion was the source of an  
OOM. This commit allocates the batch files in a dedicated memory  
context, making it easier to identify the cause of an OOM and work to  
avoid it.  
  
Based on initial draft by Tomas Vondra, with significant reworks and  
improvements by Jehan-Guillaume de Rorthais.  
  
Author: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>  
Author: Tomas Vondra <tomas.vondra@enterprisedb.com>  
Reviewed-by:  Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20190421114618.z3mpgmimc3rmubi4@development  
Discussion: https://postgr.es/m/20230504193006.1b5b9622%40karst#273020ff4061fc7a2fbb1ba96b281f17  

M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/utils/sort/sharedtuplestore.c
M src/include/executor/hashjoin.h
M src/include/executor/nodeHashjoin.h

Describe hash join implementation

commit   : 507615fc533b1b65bcecc6218e36436687fe8420    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 16:19:54 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 16:19:54 +0200    

Click here for diff

Add a high level description of our implementation of the hybrid hash  
join algorithm to the block comment in nodeHashjoin.c.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>  
Reviewed-by: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>  
Discussion: https://postgr.es/m/20230516160051.4267a800%40karst  

M src/backend/executor/nodeHashjoin.c

Avoid naming conflict between transactions.sql and namespace.sql.

commit   : b973f93b6c540f65c960bfb19af55f3d4afe4b72    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 10:57:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 10:57:46 -0400    

Click here for diff

Commits 681d9e462 et al added a test case in namespace.sql that  
implicitly relied on there not being a table "public.abc".  
However, the concurrently-run transactions.sql test creates precisely  
such a table, so with the right timing you'd get a failure.  
Creating a table named as generically as "abc" in a common schema  
seems like bad practice, so fix this by changing the name of  
transactions.sql's table.  (Compare 2cf8c7aa4.)  
  
Marina Polyakova  
  
Discussion: https://postgr.es/m/80d0201636665d82185942e7112257b4@postgrespro.ru  

M src/test/regress/expected/transactions.out
M src/test/regress/sql/transactions.sql

Remove stray mid-sentence tabs in comments

commit   : 803b4a26ca3fdddbb6e3ce87a23bfbcc8a8669f3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 15:57:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 15:57:38 +0200    

Click here for diff

M src/backend/executor/nodeIncrementalSort.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/storage/smgr/smgr.c
M src/backend/tsearch/ts_parse.c
M src/include/common/jsonapi.h
M src/include/port/win32_port.h
M src/interfaces/ecpg/pgtypeslib/timestamp.c

doc: PG 16 relnotes, merge REINDEX and reindexdb items

commit   : 6ff33cdbabdf770ca9d6b417c0687c04b2cd4d36    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 09:30:00 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 09:30:00 -0400    

Click here for diff

Reported-by: Vibhor Kumar  

M doc/src/sgml/release-16.sgml

doc: PG 16 relnotes, add missing parentheses

commit   : 1a620cbae5c48dc89f7cb08602c331f5751df71a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 08:31:11 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 08:31:11 -0400    

Click here for diff

Reported-by: Hans Buschmann  

M doc/src/sgml/release-16.sgml

Move mdwriteback() to better place

commit   : 4c9deebd37ecbeb1bbf6baaf43bafc2f84b9011b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 13:42:06 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 13:42:06 +0200    

Click here for diff

The previous order in the file didn't make sense and matched neither  
the header file nor the smgr API.  
  
Discussion: https://www.postgresql.org/message-id/flat/22fed8ba-01c3-2008-a256-4ea912d68fab%40enterprisedb.com  

M src/backend/storage/smgr/md.c

Reindent some comments

commit   : 0b8ace8d773257fffeaceda196ed94877c2b74df    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 10:52:04 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 10:52:04 +0200    

Click here for diff

Most (older) comments in md.c and smgr.c are indented with a leading  
tab on all lines, which isn't the current style and makes updating the  
comments a bit annoying.  This reindents all these lines with a single  
space, as is the normal style.  This issue exists in various shapes  
throughout the code but it's pretty consistent here, and since there  
is a patch pending to refresh some of the comments in these files, it  
seems sensible to clean this up here separately.  
  
Discussion: https://www.postgresql.org/message-id/flat/22fed8ba-01c3-2008-a256-4ea912d68fab%40enterprisedb.com  

M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c

pageinspect: Fix gist_page_items() with included columns

commit   : e7bff46e50b85c6b37723426188498dab973806c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 May 2023 12:37:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 May 2023 12:37:58 +0900    

Click here for diff

Non-leaf pages of GiST indexes contain key attributes, leaf pages  
contain both key and non-key attributes, and gist_page_items() ignored  
the handling of non-key attributes.  This caused a few problems when  
using gist_page_items() on a GiST index with INCLUDE:  
- On a non-leaf page, the function would crash.  
- On a leaf page, the function would work, but miss to display all the  
values for included attributes.  
  
This commit fixes gist_page_items() to handle such cases in a more  
appropriate way, and now displays the values of key and non-key  
attributes for each item separately in a style consistent with what  
ruleutils.c would generate for the attribute list, depending on the page  
type dealt with.  In a way similar to how a record is displayed, values  
would be double-quoted for key or non-key attributes if required.  
  
ruleutils.c did not provide a routine able to control if non-key  
attributes should be displayed, so an extended() routine for index  
definitions is added to work around the leaf and non-leaf page  
differences.  
  
While on it, this commit fixes a third problem related to the amount of  
data reported for key attributes.  The code originally relied on  
BuildIndexValueDescription() (used for error reports on constraints)  
that would not print all the data stored in the index but the index  
opclass's input type, so this limited the amount of information  
available.  This switch makes gist_page_items() much cheaper as there is  
no need to run ACL checks for each item printed, which is not an issue  
anyway as superuser rights are required to execute the functions of  
pageinspect.  Opclasses whose data cannot be displayed can rely on  
gist_page_items_bytea().  
  
The documentation of this function was slightly incorrect for the  
output results generated on HEAD and v15, so adjust it on these  
branches.  
  
Author: Alexander Lakhin, Michael Paquier  
Discussion: https://postgr.es/m/17884-cb8c326522977acb@postgresql.org  
Backpatch-through: 14  

M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/sql/gist.sql
M doc/src/sgml/pageinspect.sgml
M src/backend/utils/adt/ruleutils.c
M src/include/utils/ruleutils.h

doc: improve pg_walinspect and role membership items

commit   : 613a7eca9ca9f13d1f9fd8a7806bbded1836e58f    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 23:17:03 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 23:17:03 -0400    

Click here for diff

Reported-by: Peter Geoghegan  

M doc/src/sgml/release-16.sgml

doc: improve description of adding roles as members

commit   : ce3673daded3fe3a101b0c008235dcf8bfe9ffec    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 22:22:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 22:22:17 -0400    

Click here for diff

Discussion: https://postgr.es/m/ZFvVZvQDliIWmOwg@momjian.us  

M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/createuser.sgml

doc: update PG 16 relnotes for pg_walinspect changes

commit   : f79ee34702d485fb30427816b95e6c944660fc23    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 21:44:22 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 21:44:22 -0400    

Click here for diff

Reported-by: Peter Geoghegan  

M doc/src/sgml/release-16.sgml

Show empty BRIN ranges in brin_page_items

commit   : 428c0cae929b7d2b26a830fbba55619c57ceba55    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 01:53:30 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 01:53:30 +0200    

Click here for diff

Commit 3581cbdcd6 added a flag to identify empty BRIN ranges. This adds  
the new flag to brin_page_items() output.  
  
This is kept as a separate commit as it should not be backpatched.  
  
Reviewed-by: Justin Pryzby, Matthias van de Meent, Alvaro Herrera  
Discussion: https://postgr.es/m/402430e4-7d9d-6cf1-09ef-464d80afff3b@enterprisedb.com  

M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/pageinspect–1.11–1.12.sql
M doc/src/sgml/pageinspect.sgml
M src/test/modules/brin/expected/summarization-and-inprogress-insertion.out

Fix handling of empty ranges and NULLs in BRIN

commit   : 3581cbdcd64f5aceb445f60df23141d08ed50617    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 00:00:22 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 00:00:22 +0200    

Click here for diff

BRIN indexes did not properly distinguish between summaries for empty  
(no rows) and all-NULL ranges, treating them as essentially the same  
thing. Summaries were initialized with allnulls=true, and opclasses  
simply reset allnulls to false when processing the first non-NULL value.  
This however produces incorrect results if the range starts with a NULL  
value (or a sequence of NULL values), in which case we forget the range  
contains NULL values when adding the first non-NULL value.  
  
This happens because the allnulls flag is used for two separate  
purposes - to mark empty ranges (not representing any rows yet) and  
ranges containing only NULL values.  
  
Opclasses don't know which of these cases it is, and so don't know  
whether to set hasnulls=true. Setting the flag in both cases would make  
it correct, but it would also make BRIN indexes useless for queries with  
IS NULL clauses. All ranges start empty (and thus allnulls=true), so all  
ranges would end up with either allnulls=true or hasnulls=true.  
  
The severity of the issue is somewhat reduced by the fact that it only  
happens when adding values to an existing summary with allnulls=true.  
This can happen e.g. for small tables (because a summary for the first  
range exists for all BRIN indexes), or for tables with large fraction of  
NULL values in the indexed columns.  
  
Bulk summarization (e.g. during CREATE INDEX or automatic summarization)  
that processes all values at once is not affected by this issue. In this  
case the flags were updated in a slightly different way, not forgetting  
the NULL values.  
  
To identify empty ranges we use a new flag, stored in an unused bit in  
the BRIN tuple header so the on-disk format remains the same. A matching  
flag is added to BrinMemTuple, into a 3B gap after bt_placeholder.  
That means there's no risk of ABI breakage, although we don't actually  
pass the BrinMemTuple to any public API.  
  
We could also skip storing index tuples for empty summaries, but then  
we'd have to always process such ranges - even if there are no rows in  
large parts of the table (e.g. after a bulk DELETE), it would still  
require reading the pages etc. So we store them, but ignore them when  
building the bitmap.  
  
Backpatch to 11. The issue exists since BRIN indexes were introduced in  
9.5, but older releases are already EOL.  
  
Backpatch-through: 11  
Reviewed-by: Justin Pryzby, Matthias van de Meent, Alvaro Herrera  
Discussion: https://postgr.es/m/402430e4-7d9d-6cf1-09ef-464d80afff3b@enterprisedb.com  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_tuple.c
M src/include/access/brin_tuple.h
M src/test/modules/brin/expected/summarization-and-inprogress-insertion.out
M src/test/modules/brin/specs/summarization-and-inprogress-insertion.spec

doc: PG 16 relnotes, add freeze and update walinspect items

commit   : 1158c8c4e350b92ad6fecae894c8c1c777495954    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 18:53:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 18:53:28 -0400    

Click here for diff

Reported-by: Peter Geoghegan  

M doc/src/sgml/release-16.sgml

docs: re-order some PG 16 relnotes items

commit   : 07ef30a0282064f688a1923ba5e7c850f2ff5776    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 18:25:21 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 18:25:21 -0400    

Click here for diff

Reported-by: Jonathan Katz  

M doc/src/sgml/release-16.sgml

doc: more PG 16 relnote wording improvements

commit   : d8a81108a87bd5e8e9ca136d3195e146a58b9e4d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 17:42:47 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 17:42:47 -0400    

Click here for diff

M doc/src/sgml/release-16.sgml

Fix handling of NULLs when merging BRIN summaries

commit   : 3ec8a3bfb5472ecf93aba416e9f384ea16d340d1    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 18 May 2023 13:00:31 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 18 May 2023 13:00:31 +0200    

Click here for diff

When merging BRIN summaries, union_tuples() did not correctly update the  
target hasnulls/allnulls flags. When merging all-NULL summary into a  
summary without any NULL values, the result had both flags set to false  
(instead of having hasnulls=true).  
  
This happened because the code only considered the hasnulls flags,  
ignoring the possibility the source summary has allnulls=true.  
  
Discovered while investigating issues with handling empty BRIN ranges  
and handling of NULL values, but it's a separate problem (has nothing to  
do with empty ranges).  
  
Fixed by considering both flags on the source summary, and updating the  
hasnulls flag on the target summary.  
  
Backpatch to 11. The bug exists since 9.5 (where BRIN indexes were  
introduced), but those releases are EOL already.  
  
Discussion: https://postgr.es/m/9d993d0d-e431-2196-9ccc-0554d0e60154%40enterprisedb.com  

M src/backend/access/brin/brin.c

doc: add more sections to PG 16 release notes

commit   : 0791930aaaed2678daf694fa8b06cf81cd72cd69    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 16:33:05 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 16:33:05 -0400    

Click here for diff

M doc/src/sgml/release-16.sgml

doc: first draft of the PG 16 release notes

commit   : 206a67e27fa15d75bd7b9ddf41d7e18d19bbb9db    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 16:00:04 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 16:00:04 -0400    

Click here for diff

M doc/src/sgml/release-16.sgml

Fix documentation build broken by 1e16af8ab5.

commit   : c9dc480a21f2746f5a96a8f68a22e633ba69c405    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 May 2023 11:04:30 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 May 2023 11:04:30 -0700    

Click here for diff

M doc/src/sgml/charset.sgml

Doc improvements for language tags and custom ICU collations.

commit   : 1e16af8ab5d7f307b66e496eff6ec573d9fd8eb0    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 May 2023 10:37:55 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 May 2023 10:37:55 -0700    

Click here for diff

Separate the documentation for language tags themselves from the  
available collation settings which can be included in a language tag.  
  
Include tables of the available options, more details about the  
effects of each option, and additional examples.  
  
Also include an explanation of the "levels" of textual features and  
how they relate to collation.  
  
Discussion: https://postgr.es/m/25787ec7-4c04-9a8a-d241-4dc9be0b1ba3@postgresql.org  
Reviewed-by: Jonathan S. Katz  

M doc/src/sgml/charset.sgml

Tweak API of new function clause_is_computable_at().

commit   : 8a2523ff354077180084b43a04be01f10aafdb8c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 May 2023 10:39:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 May 2023 10:39:16 -0400    

Click here for diff

Pass it the RestrictInfo under consideration, not just the  
clause_relids.  This should save some trivial amount of  
code at the call sites, and it gives us more flexibility  
about what clause_is_computable_at() does.  There's no  
actual functional change here, though.  
  
Discussion: https://postgr.es/m/3564467.1684352557@sss.pgh.pa.us  

M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/optimizer/restrictinfo.h

ICU: check for U_STRING_NOT_TERMINATED_WARNING.

commit   : 1c634f6647c28354258d114041252475325aea32    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 17 May 2023 13:43:41 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 17 May 2023 13:43:41 -0700    

Click here for diff

Fixes memory error in cases where the length of the language name  
returned by uloc_getLanguage() is exactly ULOC_LANG_CAPACITY, in which  
case the status is set to U_STRING_NOT_TERMINATED_WARNING.  
  
Also check in call sites for other ICU functions that are expected to  
return a C string to be safe (no bug is known at these other call  
sites).  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/2098874d-c111-41e4-9063-30bcf135226b@gmail.com  

M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c

Reduce icu_validation_level default to WARNING.

commit   : 6de31ce446e59a1f947c7ebe4e4bbe7ca2b842bc    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 17 May 2023 13:18:40 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 17 May 2023 13:18:40 -0700    

Click here for diff

Discussion: https://postgr.es/m/daa9f060aa2349ebc84444515efece49e7b32c5d.camel@j-davis.com  

M doc/src/sgml/config.sgml
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Fix error message wordings

commit   : 009bd237bf6db64ea1131df71f19a529b119fbef    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 17 May 2023 21:33:13 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 17 May 2023 21:33:13 +0200    

Click here for diff

The original patch for percentrepl.c c96de2ce17 adopted the error  
messages from basebackup_to_shell, but that uses terminology that  
doesn't really fit with the new API naming.  

M src/common/percentrepl.c

Add writeback to pg_stat_io

commit   : 093e5c57d506783a95dd8feddd9a3f2651e1aeba    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:18:35 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:18:35 -0700    

Click here for diff

28e626bde00 added the concept of IOOps but neglected to include writeback  
operations. ac8d53dae5 added time spent doing these I/O operations. Without  
counting writeback, checkpointer write time in the log often differed  
substantially from that in pg_stat_io. To fix this, add IOOp IOOP_WRITEBACK  
and track writeback in pg_stat_io.  
  
Bumps catversion.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20230419172326.dhgyo4wrrhulovt6%40awork3.anarazel.de  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/storage/buf_internals.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Update parameter name context to wb_context

commit   : 52676dc2e016df5cd842a4f6073b25ee8e681b9f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:17:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:17:12 -0700    

Click here for diff

For clarity of review, renaming the function parameter "context" in  
ScheduleBufferTagForWriteback() and IssuePendingWritebacks() to  
"wb_context" is a separate commit. The next commit adds an "io_context"  
parameter and "wb_context" makes it more clear which is which.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAAKRu_acc6iL4M3hvOTeztf_ZPpsB3Pqio5aVHgZ5q=Pi3BZKg@mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/include/storage/buf_internals.h

Use BUFFER_USAGE_LIMIT to reduce needed test table size

commit   : 322875597c0c15cd85d03c8621038f4945c8caa3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:17:02 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:17:02 -0700    

Click here for diff

Using the minimum BUFFER_USAGE_LIMIT value, we can make one of the pg_stat_io  
test tables smaller while still causing reuses.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAAKRu_acc6iL4M3hvOTeztf_ZPpsB3Pqio5aVHgZ5q=Pi3BZKg@mail.gmail.com  

M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Revert "Add USER SET parameter values for pg_db_role_setting"

commit   : b9a7a822723aebb16cbe7e5fb874e5124745b07e    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 17 May 2023 20:06:50 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 17 May 2023 20:06:50 +0300    

Click here for diff

This reverts commit 096dd80f3ccc and its fixups beecbe8e5001, afdd9f7f0e00,  
529da086ba, db93e739ac61.  
  
Catversion is bumped.  
  
Discussion: https://postgr.es/m/d46f9265-ff3c-6743-2278-6772598233c2%40pgmasters.net  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/functioncmds.c
M src/backend/parser/gram.y
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_db_role_setting.h
M src/include/nodes/parsenodes.h
M src/include/utils/guc.h
M src/test/modules/Makefile
M src/test/modules/meson.build
D src/test/modules/test_pg_db_role_setting/.gitignore
D src/test/modules/test_pg_db_role_setting/Makefile
D src/test/modules/test_pg_db_role_setting/expected/test_pg_db_role_setting.out
D src/test/modules/test_pg_db_role_setting/meson.build
D src/test/modules/test_pg_db_role_setting/sql/test_pg_db_role_setting.sql
D src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting–1.0.sql
D src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting.c
D src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting.control
M src/test/regress/expected/psql.out

pg_dump: Error message improvements

commit   : 58dc80acc5ebf12223be90db1a97dc0b31ca4e1f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 May 2023 19:13:08 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 May 2023 19:13:08 +0200    

Click here for diff

Remove spurious semicolon from one error message, and print the  
offending value of a parameter reported as invalid in another.  

M src/bin/pg_dump/compress_zstd.c

pg_dump: Have _EndLO report errno after CFH->write_func() failure

commit   : 98bd4c72fd6c4f9d6a2b3b449cb89f335116ab5a    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 May 2023 18:55:51 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 May 2023 18:55:51 +0200    

Click here for diff

Other callers of that function do things this way, but this one didn't  
get the memo.  

M src/bin/pg_dump/pg_backup_directory.c

Track tlist_vinfo.varnullingrels even in non-Assert builds.

commit   : 69c430626b5eb44825a12e8bc90a59a90c4f5a03    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 11:46:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 11:46:15 -0400    

Click here for diff

Oversight in commit 867be9c07 (which should get reverted  
along with that, if we ever do revert it).  Per buildfarm.  

M src/backend/optimizer/plan/setrefs.c

Fix some issues with improper placement of outer join clauses.

commit   : 9df8f903eb6758be5a19e66cdf77e922e9329c31    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 11:13:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 11:13:52 -0400    

Click here for diff

After applying outer-join identity 3 in the forward direction,  
it was possible for the planner to mistakenly apply a qual clause  
from above the two outer joins at the now-lower join level.  
This can give the wrong answer, since a value that would get nulled  
by the now-upper join might not yet be null.  
  
To fix, when we perform such a transformation, consider that the  
now-lower join hasn't really completed the outer join it's nominally  
responsible for and thus its relid set should not include that OJ's  
relid (nor should its output Vars have that nullingrel bit set).  
Instead we add those bits when the now-upper join is performed.  
The existing rules for qual placement then suffice to prevent  
higher qual clauses from dropping below the now-upper join.  
There are a few complications from needing to consider transitive  
closures in case multiple pushdowns have happened, but all in all  
it's not a very complex patch.  
  
This is all new logic (from 2489d76c4) so no need to back-patch.  
The added test cases all have the same results as in v15.  
  
Tom Lane and Richard Guo  
  
Discussion: https://postgr.es/m/0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru  

M src/backend/optimizer/README
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Convert nullingrels match checks from Asserts to test-and-elog.

commit   : 867be9c0738bef591544d39985f886b7d8e99bf0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 10:50:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 10:50:35 -0400    

Click here for diff

It seems like the code that these checks are backstopping may have  
a few bugs left in it.  Use a test-and-elog so that the tests are  
performed even in non-assert builds, and so that we get something  
more informative than "server closed the connection" on failure.  
  
Committed separately with the idea that eventually we'll revert  
this.  It might be awhile though.  
  
Discussion: https://postgr.es/m/3014965.1684293045@sss.pgh.pa.us  

M src/backend/optimizer/plan/setrefs.c

Advance input pointer when LZ4 compressing data

commit   : 1a05c1d252993b0a59c58a6daf91a2df9333044f    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 17 May 2023 16:49:31 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 17 May 2023 16:49:31 +0200    

Click here for diff

LZ4File_write() did not advance the input pointer on subsequent invocations of  
LZ4F_compressUpdate(). As a result the generated compressed output would be a  
compressed version of the same input chunk.  
  
Tests failed to catch this error because the data would comfortably fit  
within the default buffer size, as a single chunk. Tests have been added  
to provide adequate coverage of multi-chunk compression.  
  
WriteDataToArchiveLZ4() which is also using LZ4F_compressUpdate() did  
not suffer from this omission.  
  
Author: Georgios Kokolatos <gkokolatos@pm.me>  
Reported-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/ZFhCyn4Gm2eu60rB%40paquier.xyz  

M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/t/002_pg_dump.pl

Null-terminate the output buffer of LZ4Stream_gets

commit   : 3c18d90f8907e53c3021fca13ad046133c480e4d    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 17 May 2023 16:35:17 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 17 May 2023 16:35:17 +0200    

Click here for diff

LZ4Stream_gets did not null-terminate its output buffer. The callers expected  
the buffer to be null-terminated and passed it around to functions such as  
sscanf with unintended consequences.  
  
Author: Georgios Kokolatos <gkokolatos@pm.me>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/94ae9bca-5ebb-1e68-bb7b-4f32e89fefbe@gmail.com  

M src/bin/pg_dump/compress_lz4.c

Add back SQLValueFunction for SQL keywords

commit   : d8c3106bb60e4f87be595f241e173ba3c2b7aa2c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 May 2023 10:19:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 May 2023 10:19:17 +0900    

Click here for diff

This is equivalent to a revert of f193883 and fb32748, with the addition  
that the declaration of the SQLValueFunction node needs to gain a couple  
of node_attr for query jumbling.  The performance impact of removing the  
function call inlining is proving to be too huge for some workloads  
where these are used.  A worst-case test case of involving only simple  
SELECT queries with a SQL keyword is proving to lead to a reduction of  
10% in TPS via pgbench and prepared queries on a high-end machine.  
  
None of the tests I ran back for this set of changes saw such a huge  
gap, but Alexander Lakhin and Andres Freund have found that this can be  
noticeable.  Keeping the older performance would mean to do more  
inlining in the executor when using COERCE_SQL_SYNTAX for a function  
expression, similarly to what SQLValueFunction does.  This requires more  
redesign work and there is little time until 16beta1 is released, so for  
now reverting the change is the best way forward, bringing back the  
previous performance.  
  
Bump catalog version.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/b32bed1b-0746-9b20-1472-4bdc9ca66d52@gmail.com  

M src/backend/catalog/system_functions.sql
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/executor/execExpr.h
M src/include/nodes/primnodes.h
M src/include/utils/date.h
M src/include/utils/timestamp.h
M src/test/regress/expected/expressions.out
M src/test/regress/sql/expressions.sql
M src/tools/pgindent/typedefs.list

Ensure Soundex difference() function handles empty input sanely.

commit   : 1d369c9e90f311ec98b07a259cac48c404c773d5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 May 2023 10:53:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 May 2023 10:53:42 -0400    

Click here for diff

fuzzystrmatch's difference() function assumes that _soundex()  
always initializes its output buffer fully.  This was not so for  
the case of a string containing no alphabetic characters, resulting  
in unstable output and Valgrind complaints.  
  
Fix by using memset() to fill the whole buffer in the early-exit  
case.  Also make some cosmetic improvements (I didn't care for the  
random switches between "instr[0]" and "*instr" notation).  
  
Report and diagnosis by Alexander Lakhin (bug #17935).  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/17935-b99316aa79c18513@postgresql.org  

M contrib/fuzzystrmatch/expected/fuzzystrmatch.out
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/fuzzystrmatch/sql/fuzzystrmatch.sql

libpq: Error message improvement

commit   : 27debd05dcbdfe3db487ba82568f7f9ae25ddde2    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 16 May 2023 11:50:08 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 16 May 2023 11:50:08 +0200    

Click here for diff

Move a variable name out of the translatable message, to make it  
identical to others.  

M src/interfaces/libpq/fe-connect.c

Mark internal messages as no longer translatable

commit   : c44b59fad453fd4be9656d58dd5f51a11149c961    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 16 May 2023 11:47:25 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 16 May 2023 11:47:25 +0200    

Click here for diff

The problem that these messages protect against can only occur because  
a corrupted hash spill file was written, i.e., a Postgres bug.  There's  
no reason to have them as translatable.  
  
Backpatch to 15, where these messages were changed by commit c4649cce39a4.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/20230510175407.dwa5v477pw62ikyx@alvherre.pgsql  

M src/backend/executor/nodeAgg.c

Fix reported runtime for single tests in pg_regress

commit   : 8cb94344c3c7130a0cd5e21e83705739f552187e    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 16 May 2023 10:49:48 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 16 May 2023 10:49:48 +0200    

Click here for diff

Commit 558fff0adf got the order of the parameters to test_status_failed  
mixed up which resulted in the runtime being reported as 0 ms.  Fix by  
changing the order to the correct one.  No backpatching is needed since  
this has not been shipped in a release yet.  
  
Discussion: https://postgr.es/m/0134C9EC-5F6B-4EAC-B2D5-BB4249BEBD4D@yesql.se  

M src/test/regress/pg_regress.c

doc: Fix ordering of entries in wait event table for I/O type

commit   : 44e977d7ecb915d1181007e700f2da31acb6ea4c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 May 2023 16:51:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 May 2023 16:51:44 +0900    

Click here for diff

Issue spotted while reviewing a different patch touching this area.  
  
Discussion: https://postgr.es/m/ZGM1U5D5EuBUbasi@paquier.xyz  

M doc/src/sgml/monitoring.sgml

libpq: Error message improvement

commit   : c91f3560835f76bd8c9f614bebaa8c634b98b451    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 May 2023 08:59:34 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 May 2023 08:59:34 +0200    

Click here for diff

M src/interfaces/libpq/fe-auth.c
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/005_sspi.pl
M src/test/kerberos/t/001_auth.pl

psql: Adjust capitalization of table heading

commit   : 489b5409e4a0fa36c951561bae8ae4394e7d623f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 May 2023 06:13:59 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 May 2023 06:13:59 +0200    

Click here for diff

for consistency with surrounding headings  

M src/bin/psql/describe.c
M src/test/regress/expected/subscription.out

doc: Fix incorrect version list for Windows SDK

commit   : 08c45ae235660844167de8730da908d351f4352d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 May 2023 16:02:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 May 2023 16:02:07 +0900    

Click here for diff

References to SDK 8.1a should have been cleaned up in 495ed0e, as only  
version 10 and above are supported with Windows 10 and newer versions.  
  
Reported-by: Thomas Munro  
Discussion: https://postgr.es/m/CA+hUKG++qE9uVjQaTTD7oaC8a2T3h8K50=Eqyx9uUZvOHa__ww@mail.gmail.com  

M doc/src/sgml/install-windows.sgml

Fix incorrect TAP test ordering

commit   : 92155e15d3cfe97758552484acb1583aaf71cda6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 May 2023 07:07:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 May 2023 07:07:09 +0200    

Click here for diff

Using a test function before a possible skip_all is incorrect.  If the  
skip_all is called, the test output will become incorrect and the test  
file will fail.  
  
a4f23f9b3c introduced a new test before skip_all.  After discussion,  
this doesn't really need to be a test.  Instead, we just bail out if  
the condition is not satisfied.  
  
Discussion: https://www.postgresql.org/message-id/af5567a1-aea6-fbdb-7e4b-d1e23a43c43b@enterprisedb.com  

M src/bin/pg_amcheck/t/004_verify_heapam.pl

Fix whitespace inconsistencies

commit   : 1d70fb400c2c8312dac3ff19a1bb1cb5351047ce    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 May 2023 06:27:40 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 May 2023 06:27:40 +0200    

Click here for diff

M src/bin/pg_amcheck/t/004_verify_heapam.pl

Fix wal_writer_flush_after initializer value.

commit   : 63932a6d38e5dfa6df2a51a04b7314ec1e4d3de7    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 May 2023 10:45:19 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 May 2023 10:45:19 +1200    

Click here for diff

Commit a73952b7956 (new in 16) required default values in guc_table.c  
and C variable initializers to match.  This one only matched when  
XLOG_BLCKSZ == 8kB.  Fix by using the same expression in both places  
with a new DEFAULT_XXX macro, as done for other GUCs.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CA+hUKGLNmLV=VrT==5MqnbARgx2ifRSFtdd8ofdfrdSLL3yv5A@mail.gmail.com  

M src/backend/postmaster/walwriter.c
M src/backend/utils/misc/guc_tables.c
M src/include/postmaster/walwriter.h

Rename io_direct to debug_io_direct.

commit   : 319bae9a8da66678d80d862440e54cebc7b1cc24    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 May 2023 10:31:14 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 May 2023 10:31:14 +1200    

Click here for diff

Give the new GUC introduced by d4e71df6 a name that is clearly not  
intended for mainstream use quite yet.  
  
Future proposals would drop the prefix only after adding infrastructure  
to make it efficient.  Having the switch in the tree sooner is good  
because it might lead to new discoveries about the hazards awaiting us  
on a wide range of systems, but that name was too enticing and could  
lead to cross-version confusion in future, per complaints from Noah and  
Justin.  
  
Suggested-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> (the idea, not the patch)  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (ditto)  
Discussion: https://postgr.es/m/20230430041106.GA2268796%40rfd.leadboat.com  

M doc/src/sgml/config.sgml
M src/backend/storage/file/fd.c
M src/backend/utils/misc/guc_tables.c
M src/test/modules/test_misc/t/004_io_direct.pl

Improve error message for pg_create_subscription.

commit   : 4d5105a684ba20bf6a98e6ae48224fe93382c040    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 12 May 2023 13:50:46 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 12 May 2023 13:50:46 -0700    

Click here for diff

c3afe8cf5a updated this error message, but it didn't use the new  
style established in de4d456b40.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20230512203721.GA2644063%40nathanxps13.home  

M src/backend/commands/subscriptioncmds.c
M src/test/regress/expected/subscription.out

Tighten usage of PSQL_WATCH_PAGER.

commit   : 51b2c08798867cb9788090704b37c4698b456240    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 12 May 2023 16:11:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 12 May 2023 16:11:14 -0400    

Click here for diff

Don't use PSQL_WATCH_PAGER when stdin/stdout are not a terminal.  
This corresponds to the restrictions on when other commands will  
use [PSQL_]PAGER.  There isn't a lot of sense in trying to use a  
pager in non-interactive cases, and doing so allows an environment  
setting to break our tests.  
  
Also, ignore PSQL_WATCH_PAGER if it is set but empty or all-blank,  
for the same reasons we ignore such settings of [PSQL_]PAGER (see  
commit 18f8f784c).  
  
No documentation change is really needed, since there is nothing  
suggesting that these constraints on [PSQL_]PAGER didn't already  
apply to PSQL_WATCH_PAGER too.  But I rearranged the text  
a little to make it read more naturally (IMHO anyway).  
  
Per report from Pavel Stehule.  Back-patch to v15 where  
PSQL_WATCH_PAGER was introduced.  
  
Discussion: https://postgr.es/m/CAFj8pRDTwFzmEWdA-gdAcUh0ZnxUioSfTMre71WyB_wNJy-8gw@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c

initdb: Set collversion for standard collation UNICODE

commit   : e32701b8d285cd402f75fc9059d083e89ee8166b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 12 May 2023 09:45:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 12 May 2023 09:45:50 +0200    

Click here for diff

Since the behavior of the UNICODE collation can change with new  
ICU/Unicode versions, we need to apply the versioning mechanism to it.  
We do this with an UPDATE command in initdb; this is similar to how we  
put the collation version into pg_database already.  
  
Reported-by: Daniel Verite <daniel@manitou-mail.org>  
Discussion: https://www.postgresql.org/message-id/49417853-7bdd-4b23-a4e9-04c7aff33821@manitou-mail.org  

M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h

Undo faulty attempt at not relying on RINFO_IS_PUSHED_DOWN.

commit   : c8b881d21fd8e0214bc43280d6231cc2c6ef55ef    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 May 2023 13:44:25 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 May 2023 13:44:25 -0400    

Click here for diff

I've had a bee in my bonnet for some time about getting rid of  
RestrictInfo.is_pushed_down, because it's squishily defined and  
requires not-inexpensive extra tests to use (cf RINFO_IS_PUSHED_DOWN).  
In commit 2489d76c4, I tried to make remove_rel_from_query() not  
depend on that macro; but the replacement test is buggy,  
as exposed by a report from Rushabh Lathia and Robert Haas.  
That change was pretty incidental to the main goal of 2489d76c4,  
so let's just revert it for now.  (Getting rid of is_pushed_down  
is still far away, anyway.)  
  
Discussion: https://postgr.es/m/CA+TgmoYco=hmg+iX1CW9Y1_CzNoSL81J03wUG-d2_3=rue+L2A@mail.gmail.com  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

commit   : 375407f4940ba0922513666f00852c54943eb1a0    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 May 2023 10:49:50 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 May 2023 10:49:50 -0700    

Click here for diff

Fix a link from the "Heap-Only Tuples" documentation section.  
Previously, its "fillfactor" link pointed to the "CREATE TABLE"  
command's documentation.  Now the link directly points to the fillfactor  
storage parameter documentation (which is about half way into the  
"CREATE TABLE" sect1).  
  
Oversight in commit 115464bb.  
  
Backpatch: 12-, the first version with a usable reloption link.  

M doc/src/sgml/storage.sgml

Fix publication syntax error message

commit   : c39f2f68e95a54e430c6a7b7d1e9f98cedff5aff    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 10 May 2023 18:26:10 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 10 May 2023 18:26:10 +0200    

Click here for diff

There was some odd wording in corner-case gram.y error messages "some  
error ... at or near", which appears to have been modeled after "syntax  
error" messages.  However, they don't work that way, and they're just  
wrong.  They're also uncovered by tests.  Remove the trailing words,  
and also add tests.  
  
They were introduced with 5a2832465fd8; backpatch to 15.  
  
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>  

M src/backend/parser/gram.y
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Add missing gettext triggers

commit   : d8bcce1b5e99d8f6f12cb7a94190fdc5622355af    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 10 May 2023 13:51:51 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 10 May 2023 13:51:51 +0200    

Click here for diff

due to the changes in commit dac048f71e  

M src/backend/nls.mk

Fix assertion failure when updating stats_fetch_consistency in a transaction

commit   : 605994651b6a4209b418cb09d3c223ca269f7cfc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 May 2023 11:24:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 May 2023 11:24:30 +0900    

Click here for diff

An update of the GUC stats_fetch_consistency in a transaction would be  
able to trigger an assertion when doing cache->snapshot.  In this case,  
when retrieving a pgstat entry after the switch, a new snapshot would be  
rebuilt, confusing pgstat_build_snapshot() because a snapshot is already  
cached with an unexpected mode ("cache").  
  
In order to fix this problem, this commit adds a flag to force a  
snapshot clear each time this GUC is changed.  Some tests are added to  
check, while on it.  
  
Some optimizations in avoiding the snapshot clear should be possible  
depending on what is cached and the current GUC value, I guess, but this  
solution is simple, and ensures that the state of the cache is updated  
each time a new pgstat entry is fetched, hence being consistent with the  
level wanted by the client that has set the GUC.  
  
Note that cache->none and snapshot->none would not cause issues, as  
fetching a pgstat entry would be retrieved from shared memory on the  
second attempt, however a snapshot would still be cached.  Similarly,  
none->snapshot and none->cache would build a new snapshot on the second  
fetch attempt.  Finally, snapshot->cache would cache a new snapshot on  
the second attempt.  
  
Reported-by: Alexander Lakhin  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/17804-2a118cd046f2d0e5@postgresql.org  
backpatch-through: 15  

M doc/src/sgml/config.sgml
M src/backend/utils/activity/pgstat.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc_hooks.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Document values of stats_fetch_consistency in postgresql.conf.sample

commit   : 4d47eff99cc08255f0ae3cc27dc24cc9b30a32e7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 May 2023 10:19:57 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 May 2023 10:19:57 +0900    

Click here for diff

Issue noted while looking at a patch related to that.  
  
Discussion: https://postgr.es/m/ZE9LiFc7JdNHokz/@paquier.xyz  

M src/backend/utils/misc/postgresql.conf.sample

Fix the race condition in the test case added by commit a6e04b1d20.

commit   : c5b7f67fcc8c4a01c82660eb0996a3c697fac283    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 May 2023 14:25:33 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 May 2023 14:25:33 +0530    

Click here for diff

The commit a6e04b1d20 added a test to ensure that the invalidated logical  
slots don't retain WAL. The test was ensuring that the checkpoint removes  
the WAL files corresponding to invalidated logical slots on the standby  
node but missed the point that the standby node also had a physical slot  
which led to the prevention of WAL file removal. Move the creation of  
physical slot on the standby and initialization of cascading standby closer  
to the test case that actually required it so that other tests don't get  
affected by the presence of the physical slot on standby.  
  
Author: Bertrand Drouvot  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com  

M src/test/recovery/t/035_standby_logical_decoding.pl

Fix invalid memory access during the shutdown of the parallel apply worker.

commit   : 3d144c6c86025272e1711539f5fafb6fb85c4feb    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 May 2023 09:28:06 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 May 2023 09:28:06 +0530    

Click here for diff

The callback function pa_shutdown() accesses MyLogicalRepWorker which may  
not be initialized if there is an error during the initialization of the  
parallel apply worker. The other problem is that by the time it is invoked  
even after the initialization of the worker, the MyLogicalRepWorker will  
be reset by another callback logicalrep_worker_onexit. So, it won't have  
the required information.  
  
To fix this, register the shutdown callback after we are attached to the  
worker slot.  
  
After this fix, we observed another issue which is that sometimes the  
leader apply worker tries to receive the message from the error queue that  
might already be detached by the parallel apply worker leading to an  
error. To prevent such an error, we ensure that the leader apply worker  
detaches from the parallel apply worker's error queue before stopping it.  
  
Reported-by: Sawada Masahiko  
Author: Hou Zhijie  
Reviewed-by: Sawada Masahiko, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDo+yUwNq6nTrvE2h9bB2vZfcag=jxWc7QxuWCmkDAqcA@mail.gmail.com  

M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/include/replication/worker_internal.h

Revert "ICU: do not convert locale 'C' to 'en-US-u-va-posix'."

commit   : 455f948b0d03a556533a7e4a1a8abf45f0eb202e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 May 2023 20:50:51 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 May 2023 20:50:51 -0700    

Click here for diff

This reverts commit f7faa9976cc0504c027a20ed66ceca9018041dd4.  
  
Discussion: https://postgr.es/m/483826.1683582475@sss.pgh.pa.us  

M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Doc: update VACUUM FREEZE query conflict guidance.

commit   : 5698f07947396e1a7cd6564390306aafa26fc189    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 8 May 2023 13:17:31 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 8 May 2023 13:17:31 -0700    

Click here for diff

Commit 1de58df4, which added page-level freezing, taught VACUUM to reuse  
each page's "set-visibility-map" snapshotConflictHorizon for freezing  
(at least in the vast majority of cases where freezing went ahead).  
This made VACUUM FREEZE much less prone to generating recovery conflicts  
on standbys; VACUUM FREEZE became only slightly more likely to cause  
recovery conflicts than an equivalent VACUUM.  
  
Update old documentation that specifically warned of the likelihood of  
recovery conflicts from VACUUM FREEZE.  Explain the same general issue  
(the issue of VACUUM generating recovery conflicts even in the absence  
of dead row cleanup) using the example of conflicts caused by VISIBLE  
WAL records.  

M doc/src/sgml/high-availability.sgml

ICU: do not convert locale 'C' to 'en-US-u-va-posix'.

commit   : f7faa9976cc0504c027a20ed66ceca9018041dd4    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 May 2023 10:34:51 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 May 2023 10:34:51 -0700    

Click here for diff

The conversion was intended to be for convenience, but it's more  
likely to be confusing than useful.  
  
The user can still directly specify 'en-US-u-va-posix' if desired.  
  
Discussion: https://postgr.es/m/f83f089ee1e9acd5dbbbf3353294d24e1f196e95.camel@j-davis.com  
Discussion: https://postgr.es/m/37520ec1ae9591f83132f82dbd625f3fc2d69c16.camel@j-davis.com  

M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Adjust sepgsql expected output for 681d9e462 et al.

commit   : 8d525d7b9545884a3e0d79adcd61543f9ae2ae28    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 May 2023 11:24:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 May 2023 11:24:47 -0400    

Click here for diff

Security: CVE-2023-2454  

M contrib/sepgsql/expected/ddl.out

Handle RLS dependencies in inlined set-returning functions properly.

commit   : ca73753b090c33bc69ce299b4d7fff891a77b8ad    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 May 2023 10:12:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 May 2023 10:12:44 -0400    

Click here for diff

If an SRF in the FROM clause references a table having row-level  
security policies, and we inline that SRF into the calling query,  
we neglected to mark the plan as potentially dependent on which  
role is executing it.  This could lead to later executions in the  
same session returning or hiding rows that should have been hidden  
or returned instead.  
  
Our thanks to Wolfgang Walther for reporting this problem.  
  
Stephen Frost and Tom Lane  
  
Security: CVE-2023-2455  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Replace last PushOverrideSearchPath() call with set_config_option().

commit   : 681d9e4621aac0a9c71364b6f54f00f6d8c4337f    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 8 May 2023 06:14:07 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 8 May 2023 06:14:07 -0700    

Click here for diff

The two methods don't cooperate, so set_config_option("search_path",  
...) has been ineffective under non-empty overrideStack.  This defect  
enabled an attacker having database-level CREATE privilege to execute  
arbitrary code as the bootstrap superuser.  While that particular attack  
requires v13+ for the trusted extension attribute, other attacks are  
feasible in all supported versions.  
  
Standardize on the combination of NewGUCNestLevel() and  
set_config_option("search_path", ...).  It is newer than  
PushOverrideSearchPath(), more-prevalent, and has no known  
disadvantages.  The "override" mechanism remains for now, for  
compatibility with out-of-tree code.  Users should update such code,  
which likely suffers from the same sort of vulnerability closed here.  
Back-patch to v11 (all supported versions).  
  
Alexander Lakhin.  Reported by Alexander Lakhin.  
  
Security: CVE-2023-2454  

M contrib/seg/Makefile
A contrib/seg/expected/security.out
A contrib/seg/sql/security.sql
M src/backend/catalog/namespace.c
M src/backend/commands/schemacmds.c
M src/test/regress/expected/namespace.out
M src/test/regress/sql/namespace.sql

Add missing source file to nls.mk

commit   : b8c3f6df85e78e09c9709fc895aced719aebd7f9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 08:24:42 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 08:24:42 +0200    

Click here for diff

M src/bin/pg_dump/nls.mk

pg_dump: Restore lost translation marker

commit   : 9f9abfeb10026bc2c2ac7076c6adff201608eab5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 07:43:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 07:43:54 +0200    

Click here for diff

The refactoring in 03d02f54a6 lost a translation marker.  

M src/bin/pg_dump/compress_io.c

doc: Fix some markups in logical replication section

commit   : 0890f7d528c45bcfef7d3edd5618e121f0357250    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 May 2023 13:47:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 May 2023 13:47:36 +0900    

Click here for diff

Author: Peter Smith  
Reviewed-by: David Zhang  
Discussion: https://postgr.es/m/CAHut+Pst11ac2hcmePt1=oTmBwTT=DAssRR1nsdoy4BT+68=Mg@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml

pg_basebackup: Restore lost translation markers

commit   : 90f0d2881445a266038d349073e571f06def656b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 06:15:26 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 06:15:26 +0200    

Click here for diff

The refactoring in ebfb814f7c lost some translation markers.  

M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/walmethods.c

Add ruleutils support for decompiling MERGE commands.

commit   : 41e2c52fd6ebed6eff4184f68048813cc8886ec1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 May 2023 11:01:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 May 2023 11:01:15 -0400    

Click here for diff

This was overlooked when MERGE was added, but it's essential  
support for MERGE in new-style SQL functions.  
  
Alvaro Herrera  
  
Discussion: https://postgr.es/m/3579737.1683293801@sss.pgh.pa.us  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Fix typo with wait event for SLRU buffer of commit timestamps

commit   : 58f5edf849900bc248b7c909ca17da7287306c41    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 May 2023 21:25:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 May 2023 21:25:44 +0900    

Click here for diff

This wait event was documented as "CommitTsBuffer" since its  
introduction, but the code named it "CommitTSBuffer".  This commit fixes  
the code to follow the term documented, which is also more consistent  
with the naming of the other wait events used for commit timestamps.  
  
Introduced by 5da1493.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/e8c38840-596a-83d6-bd8d-cebc51111572@gmail.com  
Backpatch-through: 13  

M src/backend/storage/lmgr/lwlock.c

Fix sepgsql expected test output

commit   : 95f5a7a42c048ec01ba2650496296fe88aacd50f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 5 May 2023 11:10:25 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 5 May 2023 11:10:25 +0200    

Click here for diff

Commit f75cec4fff87 changed the order in which the relations are  
permission-checked in RI_Initial_Check, which the sepgsql test is  
sensitive to.  Adapt.  
  
Discussion: https://postgr.es/m/3468125.1683238309@sss.pgh.pa.us  

M contrib/sepgsql/expected/alter.out

Fix copy-and-pasto in error message

commit   : b1c4ed2f02b0c4cf1942e6eb2995bdbf8db5cccf    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 May 2023 07:50:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 May 2023 07:50:08 +0200    

Click here for diff

from 2fe3bdbd69  

M src/bin/pg_upgrade/option.c

Fix prove_installcheck when used with PGXS

commit   : 5d42a97519581a31bdc1d3d4cf10c07ae18b8296    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 May 2023 06:29:49 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 May 2023 06:29:49 +0200    

Click here for diff

Commit 153e215677 added the portlock directory.  This is created in  
$ENV{top_builddir} if it is set.  Under PGXS, top_builddir points into  
the installation directory, which is not necessarily writable and in  
any case inappropriate to use by a test suite.  The cause of the  
problem is that the prove_installcheck target in Makefile.global  
exports top_builddir, which isn't useful (since no other Perl code  
actually reads it) and breaks this use case.  The reason this code is  
there is probably that is has been dragged around with various other  
changes, in particular a0fc813266, but without a real purpose of its  
own.  By just removing the exporting of top_builddir in  
prove_installcheck, the portlock directory then ends up under  
tmp_check in the build directory, which is more suitable.  
  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://www.postgresql.org/message-id/78d1cfa6-0065-865d-584b-cde6d8c18aff@enterprisedb.com  

M src/Makefile.global.in

Move return statements out of PG_TRY blocks.

commit   : 57d0051706b897048063acc14c2c3454200c488f    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 3 May 2023 11:32:43 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 3 May 2023 11:32:43 -0700    

Click here for diff

If we exit a PG_TRY block early via "continue", "break", "goto", or  
"return", we'll skip unwinding its exception stack.  This change  
moves a couple of such "return" statements in PL/Python out of  
PG_TRY blocks.  This was introduced in d0aa965c0a and affects all  
supported versions.  
  
We might also be able to add compile-time checks to prevent  
recurrence, but that is left as a future exercise.  
  
Reported-by: Mikhail Gribkov, Xing Guo  
Author: Xing Guo  
Reviewed-by: Michael Paquier, Andres Freund, Tom Lane  
Discussion: https://postgr.es/m/CAMEv5_v5Y%2B-D%3DCO1%2Bqoe16sAmgC4sbbQjz%2BUtcHmB6zcgS%2B5Ew%40mail.gmail.com  
Discussion: https://postgr.es/m/CACpMh%2BCMsGMRKFzFMm3bYTzQmMU5nfEEoEDU2apJcc4hid36AQ%40mail.gmail.com  
Backpatch-through: 11 (all supported versions)  

M src/pl/plpython/plpy_exec.c

Fix ExecCheckPermissions call in RI_Initial_Check

commit   : f75cec4fff877ef24e4932a628fc974f3116ed16    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 4 May 2023 19:55:56 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 4 May 2023 19:55:56 +0200    

Click here for diff

RI_Initial_Check was setting up a list of RTEPermissionInfo for  
ExecCheckPermissions() wrong, and the problem is subtle enough that it  
doesn't have any immediate effect in core code.  However, if an  
extension is using the ExecutorCheckPerms_hook, then it would get the  
wrong parameters and perhaps arrive at a wrong conclusion, or outright  
malfunction.  Fix by constructing that list and the RTE list more  
honestly.  
  
We also add an assertion check to verify that these lists match.  This  
new assertion would have caught this bug.  
  
Co-authored-by: Олег Целебровский (Oleg Tselebrovskii) <o.tselebrovskiy@postgrespro.ru>  
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://postgr.es/m/3722b7a2cbe27a1796ee40824bd86dd1@postgrespro.ru  

M src/backend/executor/execMain.c
M src/backend/utils/adt/ri_triggers.c

In array_position()/array_positions(), beware of empty input array.

commit   : 4c40995f61227c579bd7269a829c00013ac66492    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 May 2023 11:48:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 May 2023 11:48:23 -0400    

Click here for diff

These functions incautiously fetched the array's first lower bound  
even when the array is zero-dimensional, thus fetching the word  
after the allocated array space.  While almost always harmless,  
with very bad luck this could result in SIGSEGV.  Fix by adding  
an early exit for empty input.  
  
Per bug #17920 from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/17920-f7c228c627b6d02e%40postgresql.org  

M src/backend/utils/adt/array_userfuncs.c

Tighten array dimensionality checks in Python -> SQL array conversion.

commit   : 0553528e7c2bb9eb4148ff9e3c51b9094ab67f70    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 May 2023 11:00:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 May 2023 11:00:33 -0400    

Click here for diff

Like plperl before f47004add, plpython wasn't being sufficiently  
careful about checking that list-of-list structures represent  
rectangular arrays, so that it would accept some cases in which  
different parts of the "array" are nested to different depths.  
This was exacerbated by Python's weak distinction between  
sequences and lists, so that in some cases strings could get  
treated as though they are lists (and burst into individual  
characters) even though a different ordering of the upper-level  
list would give a different result.  
  
Some of this behavior was unreachable (without risking a crash)  
before 81eaaf65e.  It seems like a good idea to clean it all up  
in the same releases, rather than shipping a non-crashing but  
nonetheless visibly buggy behavior in the name of minimal change.  
Hence, back-patch.  
  
Per bug #17912 and further testing by Alexander Lakhin.  
  
Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org  

M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_types.sql

Revert "Move PartitionPruneInfo out of plan nodes into PlannedStmt"

commit   : 5472743d9e8583638a897b47558066167cc14583    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 4 May 2023 12:09:59 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 4 May 2023 12:09:59 +0200    

Click here for diff

This reverts commit ec386948948c and its fixup 589bb816499e.  
  
This change was intended to support query planning avoiding acquisition  
of locks on partitions that were going to be pruned; however, the  
overall project took a different direction at [1] and this bit is no  
longer needed.  Put things back the way they were as agreed in [2], to  
avoid unnecessary complexity.  
  
Discussion: [1] https://postgr.es/m/4191508.1674157166@sss.pgh.pa.us  
Discussion: [2] https://postgr.es/m/20230502175409.kcoirxczpdha26wt@alvherre.pgsql  

M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/partitioning/partprune.c
M src/include/catalog/catversion.h
M src/include/executor/execPartition.h
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/partitioning/partprune.h

doc: New glossary entries

commit   : 919c486a275bcdd83d2add77da87b6edbd91418c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 May 2023 06:44:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 May 2023 06:44:38 +0200    

Click here for diff

Add:  
  
- "Restartpoint"  
- "Log sequence number"  
  
"LSN" was already listed in the Acronyms appendix, but it is more  
suitable as a glossary entry, so move it there and have the acronyms  
entry link into the glossary.  
  
Also turn on DocBook parameter glossentry.show.acronym to show  
acronyms for glossary entries, which is being used here.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://www.postgresql.org/message-id/flat/60915312-62cd-9c94-0d94-556023ece45f%40enterprisedb.com  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/stylesheet-common.xsl

Test that invalidated logical slots doesn't retain WAL.

commit   : a6e04b1d20c2e9cece9b64bb5b36ebfdc3a9031b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 4 May 2023 08:33:56 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 4 May 2023 08:33:56 +0530    

Click here for diff

Author: Bertrand Drouvot  
Reviewed-by: Shi yu, Amit Kapila, Vignesh C  
Discussion: https://postgr.es/m/2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com  

M src/test/recovery/t/035_standby_logical_decoding.pl

Add missing TAP test name

commit   : 1ab763fc22adc88e5d779817e7b42b25a9dd7c9e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 May 2023 11:08:24 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 May 2023 11:08:24 +0200    

Click here for diff

M src/bin/pg_waldump/t/002_save_fullpage.pl

Fix assertion failure in apply worker.

commit   : de63f8dadee4afa152ce177fd3c562d47373a728    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 3 May 2023 10:13:13 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 3 May 2023 10:13:13 +0530    

Click here for diff

During exit, the logical replication apply worker tries to release session  
level locks, if any. However, if the apply worker exits due to an error  
before its connection is initialized, trying to release locks can lead to  
assertion failure. The locks will be acquired once the worker is  
initialized, so we don't need to release them till the worker  
initialization is complete.  
  
Reported-by: Alexander Lakhin  
Author: Hou Zhijie based on inputs from Sawada Masahiko and Amit Kapila  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/2185d65f-5aae-3efa-c48f-fb42b173ef5c@gmail.com  

M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/include/replication/worker_internal.h

Doc: clarify behavior of row-limit arguments in the PLs' SPI wrappers.

commit   : 6489875ce6b16662142bc70e003437b9753c199f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 May 2023 17:55:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 May 2023 17:55:01 -0400    

Click here for diff

plperl, plpython, and pltcl all provide query-execution functions  
that are thin wrappers around SPI_execute() or its variants.  
The SPI functions document their row-count limit arguments clearly,  
as "maximum number of rows to return, or 0 for no limit".  However  
the PLs' documentation failed to explain this special behavior of  
zero, so that a reader might well assume it means "fetch zero  
rows".  Improve that.  
  
Daniel Gustafsson and Tom Lane, per report from Kieran McCusker  
  
Discussion: https://postgr.es/m/CAGgUQ6H6qYScctOhktQ9HLFDDoafBKHyUgJbZ6q_dOApnzNTXg@mail.gmail.com  

M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml

Fix overridden callbacks in pg_rewind.

commit   : 08237056f84e3a9ed75e8a698428c669f4d35db4    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 2 May 2023 13:15:29 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 2 May 2023 13:15:29 +0200    

Click here for diff

The <source>_traverse_files functions take a callback for processing  
files, but both the local and libpq source implementations called the  
function directly without using the callback argument. While there is  
no bug right now as the function called is the same as the callback,  
fix by calling the callback to reduce the risk of subtle bugs in the  
future.  
  
Author: Junwang Zhao <zhjwpku@gmail.com>  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CAEG8a3Jdwgh+PZr2zh1=t8apA4Yz8tKq+uubPqoCt14nvWKHEw@mail.gmail.com  

M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c

Update SQL features

commit   : e0bb5d0c5bcada63dc9b8a1a72a344a07bf930ce    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 May 2023 10:59:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 May 2023 10:59:21 +0200    

Click here for diff

Some updates for SQL:2023 and some new features in PostgreSQL 16.  

M src/backend/catalog/sql_feature_packages.txt
M src/backend/catalog/sql_features.txt

Add missing uninstallation rule for BackgroundPsql.pm

commit   : 7039c7cff6736780c3bbb41a90a6dfea0f581ad2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 May 2023 09:41:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 May 2023 09:41:03 +0200    

Click here for diff

Commit a4c17c8617 added in the install rule but not the uninstall  
rule.  

M src/test/perl/Makefile

Fix typos in comments

commit   : 8961cb9a0315fa23458587b3df547ca8d8e00f85    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 May 2023 12:23:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 May 2023 12:23:08 +0900    

Click here for diff

The changes done in this commit impact comments with no direct  
user-visible changes, with fixes for incorrect function, variable or  
structure names.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/e8c38840-596a-83d6-bd8d-cebc51111572@gmail.com  

M config/config.sub
M contrib/amcheck/verify_nbtree.c
M contrib/intarray/_int.h
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeAgg.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/optimizer/plan/planagg.c
M src/backend/parser/gram.y
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/syncrep.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/spin.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/mb/mbutils.c
M src/bin/pg_rewind/rewind_source.h
M src/include/access/tableam.h
M src/include/access/toast_helper.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/queryjumble.h
M src/include/pg_config_manual.h
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h
M src/pl/plperl/plperl.c
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/subscription/t/004_sync.pl

doc: Fix typo in pg_amcheck for term "schema"

commit   : 6fd8ae6888847da842ee4810fcd83b013cbed27f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 May 2023 11:40:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 May 2023 11:40:46 +0900    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/e8c38840-596a-83d6-bd8d-cebc51111572@gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/pg_amcheck.sgml

Tighten array dimensionality checks in Perl -> SQL array conversion.

commit   : f47004add16041a9cbd19aef29775ca4d9d6001e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Apr 2023 13:06:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Apr 2023 13:06:44 -0400    

Click here for diff

plperl_array_to_datum() wasn't sufficiently careful about checking  
that nested lists represent a rectangular array structure; it would  
accept inputs such as "[1, []]".  This is a bit related to the  
PL/Python bug fixed in commit 81eaaf65e, but it doesn't seem to  
provide any direct route to a memory stomp.  Instead the likely  
failure mode is for makeMdArrayResult to be passed fewer Datums than  
the claimed array dimensionality requires, possibly leading to a wild  
pointer dereference and SIGSEGV.  
  
Per report from Alexander Lakhin.  It's been broken for a long  
time, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com  

M src/pl/plperl/expected/plperl_array.out
M src/pl/plperl/plperl.c
M src/pl/plperl/sql/plperl_array.sql

Handle zero-length sublist correctly in Python -> SQL array conversion.

commit   : 81eaaf65e393d03f49a781009fba876f81fe9d0b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 28 Apr 2023 12:24:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 28 Apr 2023 12:24:29 -0400    

Click here for diff

If PLySequence_ToArray came across a zero-length sublist, it'd compute  
the overall array size as zero, possibly leading to a memory clobber.  
(This would likely qualify as a security bug, were it not that plpython  
is an untrusted language already.)  
  
I think there are other corner-case issues in this code as well, notably  
that the error messages don't match the core code and for some ranges  
of array sizes you'd get "invalid memory alloc request size" rather than  
the intended message about array size.  
  
Really this code has no business doing its own array size calculation  
at all, so remove the faulty code in favor of using ArrayGetNItems().  
  
Per bug #17912 from Alexander Lakhin.  Bug seems to have come in with  
commit 94aceed31, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org  

M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_types.sql

Fix crashes with CREATE SCHEMA AUTHORIZATION and schema elements

commit   : 4dadd660f0719206ce3914d4ad9b6aad69d6db6e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 28 Apr 2023 19:29:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 28 Apr 2023 19:29:12 +0900    

Click here for diff

CREATE SCHEMA AUTHORIZATION with appended schema elements can lead to  
crashes when comparing the schema name of the query with the schemas  
used in the qualification of some clauses in the elements' queries.  
  
The origin of the problem is that the transformation routine for the  
elements listed in a CREATE SCHEMA query uses as new, expected, schema  
name the one listed in CreateSchemaStmt itself.  However, depending on  
the query, CreateSchemaStmt.schemaname may be NULL, being computed  
instead from the role specification of the query given by the  
AUTHORIZATION clause, that could be either:  
- A user name string, with the new schema name being set to the same  
value as the role given.  
- Guessed from CURRENT_ROLE, SESSION_ROLE or CURRENT_ROLE, with a new  
schema name computed from the security context where CREATE SCHEMA is  
running.  
  
Regression tests are added for CREATE SCHEMA with some appended elements  
(some of them with schema qualifications), covering also some role  
specification patterns.  
  
While on it, this simplifies the context structure used during the  
transformation of the elements listed in a CREATE SCHEMA query by  
removing the fields for the role specification and the role type.  They  
were not used, and for the role specification this could be confusing as  
the schema name may by extracted from that at the beginning of  
CreateSchemaCommand().  
  
This issue exists for a long time, so backpatch down to all the versions  
supported.  
  
Reported-by: Song Hongyu  
Author: Michael Paquier  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/17909-f65c12dfc5f0451d@postgresql.org  
Backpatch-through: 11  

M src/backend/commands/schemacmds.c
M src/backend/parser/parse_utilcmd.c
M src/include/parser/parse_utilcmd.h
A src/test/regress/expected/create_schema.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/create_schema.sql

Fix assertion failure in heap_vacuum_rel

commit   : 4a6603cd4650a335ee38d894d7bbb452b1bf822f    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 28 Apr 2023 10:30:05 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 28 Apr 2023 10:30:05 +0200    

Click here for diff

Commit 7d71d3dd08 changed resetting the VacuumFailsafeActive flag to an  
assertion since the flag is reset before starting vacuuming a relation.  
This however failed to take recursive calls of vacuum_rel() and vacuum  
of TOAST tables into consideration. Fix by reverting back to resettting  
the flag.  
  
Author: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reported-by: John Naylor <john.naylor@enterprisedb.com>  
Discussion: https://postgr.es/m/CAFBsxsFz=GqaG5Ens5aNgVYoV2Y+pfMUijX0ku+CCkWfALwiqg@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c

Add unit to vacuum_buffer_usage_limit value in postgresql.conf.sample.

commit   : b72f564d87d10b5e5a91aedec605e48f80cb74ee    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 28 Apr 2023 15:40:12 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 28 Apr 2023 15:40:12 +0900    

Click here for diff

Also adjust the indentation of the comment to the surrounding parameters.  
  
Author: Masahiko Sawada  
Reviewed-by: David Rowley, Daniel Gustafsson, Melanie Plageman  
Discussion: https://postgr.es/m/CAD21AoCBSqmqOKVH4Q256DeCC_UE50gu1sgixcjLFZGLEbABVA@mail.gmail.com  

M src/backend/utils/misc/postgresql.conf.sample

Improve one of the test cases in 035_standby_logical_decoding.pl.

commit   : 4d26d93ff7fbf7bde5710595255ca9c8033a1402    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 28 Apr 2023 08:45:19 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 28 Apr 2023 08:45:19 +0530    

Click here for diff

The test to ensure that decoding changes via logical slot from another  
database will fail was incorrectly done on the primary node instead of on  
the standby node.  
  
In the passing, make the test to wait for replay catchup by using  
wait_for_replay_catchup(). This will make it consistent with the way we  
wait at other places in the test.  
  
Author: Shi yu  
Reviewed-by: Bertrand Drouvot, Amit Kapila  
Discussion: https://postgr.es/m/OSZPR01MB6310B0A507A0F2A2D379F38CFD6A9@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/test/recovery/t/035_standby_logical_decoding.pl

Prevent underflow in KeepLogSeg().

commit   : b72623671d9c0ead4ac219c69762246073fe2185    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 27 Apr 2023 13:43:48 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 27 Apr 2023 13:43:48 -0700    

Click here for diff

The call to XLogGetReplicationSlotMinimumLSN() might return a  
greater LSN than the one given to the function.  Subsequent segment  
number calculations might then underflow, which could result in  
unexpected behavior when removing or recyling WAL files.  This was  
introduced with max_slot_wal_keep_size in c655077639.  To fix, skip  
the block of code for replication slots if the LSN is greater.  
  
Reported-by: Xu Xingwang  
Author: Kyotaro Horiguchi  
Reviewed-by: Junwang Zhao  
Discussion: https://postgr.es/m/17903-4288d439dee856c6%40postgresql.org  
Backpatch-through: 13  

M src/backend/access/transam/xlog.c

Fix wrong construct_array_builtin() call in GUCArrayDelete()

commit   : db93e739ac61332126207b16f14da93f8ecac594    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 27 Apr 2023 22:06:14 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 27 Apr 2023 22:06:14 +0300    

Click here for diff

The current code unintentionally uses the wrong datum to construct an array.  
The bug was introduced by 096dd80f3c, so no backpatching is needed.  
  
Reported-by: David Steele  
Discussion: https://postgr.es/m/d46f9265-ff3c-6743-2278-6772598233c2%40pgmasters.net  
Author: Nathan Bossart  
Reviewed-by: David Steele, Tom Lane  

M src/backend/utils/misc/guc.c

In hstore_plpython, avoid crashing when return value isn't a mapping.

commit   : df38157d94662a64e2f83aa8a0110fd1ee7c4776    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 27 Apr 2023 11:55:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 27 Apr 2023 11:55:06 -0400    

Click here for diff

Python 3 changed the behavior of PyMapping_Check(), breaking the  
test in plpython_to_hstore() that verifies whether a function result  
to be transformed is acceptable.  A backwards-compatible fix is to  
first verify that the object doesn't pass PySequence_Check().  
  
Perhaps accidentally, our other uses of PyMapping_Check() already  
follow uses of PySequence_Check(), so that no other bugs were  
created by this change.  
  
Per bug #17908 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Dmitry Dolgov and Tom Lane  
  
Discussion: https://postgr.es/m/17908-3f19a125d56a11d6@postgresql.org  

M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/hstore_plpython/hstore_plpython.c
M contrib/hstore_plpython/sql/hstore_plpython.sql

Add a test to verify that subscription to the standby works.

commit   : 376dc820531bafcbf105fff74c5b14c23d9950af    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 27 Apr 2023 14:22:53 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 27 Apr 2023 14:22:53 +0530    

Click here for diff

Author: Bertrand Drouvot  
Reviewed-by: Vignesh C, Alvaro Herrera, Amit Kapila  
Discussion: https://postgr.es/m/2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/035_standby_logical_decoding.pl

Rework code defining default compression for dir/custom formats in pg_dump

commit   : bedc1f0564d12c4a89fc9de3044201166542dc3d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 27 Apr 2023 13:34:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 27 Apr 2023 13:34:05 +0900    

Click here for diff

As written, pg_dump would call twice parse_compress_specification() for  
the custom and directory formats to build a compression specification if  
no compression option is defined, as these formats should be compressed  
by default when compiled with zlib, or use no compression without zlib.  
This made the code logic quite confusing, and the first compression  
specification built would be incorrect before being overwritten by the  
second one.  
  
Rather than creating two compression specifications, this commit changes  
a bit the order of the checks for the compression options so as  
compression_algorithm_str is now set to a correct value for the custom  
and format directory when no compression option is defined.  This makes  
the code easier to understand, as parse_compress_specification() is now  
called once for all the format, with or without user-specified  
compression methods.  One comment was also confusing for the non-zlib  
case, so remove it while on it.  
  
This code has been introduced in 5e73a60 when adding support for  
compression specifications in pg_dump.  
  
Per discussion with Justin Pryzby and Georgios Kokolatos.  
  
Discussion: https://postgr.es/m/20230225050214.GH1653@telsasoft.com  

M src/bin/pg_dump/pg_dump.c

Fix stop condition for dumping GRANT commands

commit   : 7b7fa85130330128b404eddebd4f33c6739454b0    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 26 Apr 2023 14:24:13 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 26 Apr 2023 14:24:13 +0200    

Click here for diff

Commit ce6b672e44 changed dumping GRANT commands to ensure that  
grantors already have an ADMIN OPTION on the role for which it  
is granting permissions. Looping over the grants per role has a  
stop condition on dumping the grant statements, but accidentally  
missed updating the variable for the conditional check.  
  
Author: Andreas Scherbaum <ads@pgug.de>  
Co-authored-by: Artur Zakirov <zaartur@gmail.com>  
Discussion: https://postgr.es/m/de44299d-cd31-b41f-2c2a-161fa5e586a5@pgug.de  

M src/bin/pg_dump/pg_dumpall.c

doc: Fix grammar.

commit   : 4def50eba99e0a7e9b4c09fa3e33209d6d6fb834    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 26 Apr 2023 20:15:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 26 Apr 2023 20:15:00 +0900    

Click here for diff

M doc/src/sgml/postgres-fdw.sgml

Fix missing installation rules for BackgroundPsql.pm

commit   : a4c17c86176cfa712f541b81b2a026ae054b275e    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 26 Apr 2023 11:40:01 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 26 Apr 2023 11:40:01 +0200    

Click here for diff

Commit 664d75753 added the BackgroundPsql module with helper functions  
for tests running interactive or background psql tasks. The new module  
was however not added to the install rules of the build systems.  
  
Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/c0ba3008-dbc8-e53f-29f2-2e9abe72b2a2@enterprisedb.com  

M src/test/perl/Makefile
M src/test/perl/meson.build

Remove bogus #include added by d4e71df6d75.

commit   : 828e93a6f2dbf4bc7a24bc3ce166c34879eeb8b1    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 26 Apr 2023 10:39:46 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 26 Apr 2023 10:39:46 +1200    

Click here for diff

The recently added inclusion of guc.h in smgr.h is not necessary and  
introduces more server-related stuff. Removing the directive helps  
avoid potential issues with including sgmr.h in frontends.  
  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20230425.115748.2130383825066921512.horikyota.ntt%40gmail.com  

M src/include/storage/smgr.h

Re-add tracking of wait event SLRUFlushSync

commit   : 84cc1426745b4bc91242caec9173a2ca19a4af79    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 26 Apr 2023 07:10:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 26 Apr 2023 07:10:06 +0900    

Click here for diff

SLRUFlushSync has been accidently removed during dee663f, that has moved  
the flush of the SLRU files to the checkpointer, so add it back.  The  
issue has been noticed by Thomas when checking for orphaned wait  
events.  
  
Author: Thomas Munro  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/CA+hUKGK6tqm59KuF1z+h5Y8fsWcu5v8+84kduSHwRzwjB2aa_A@mail.gmail.com  

M src/backend/access/transam/slru.c

Fix vacuum_cost_delay check for balance calculation.

commit   : bfac8f8bc4a44c67c9f35b5266676278e4ba1217    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 25 Apr 2023 13:54:10 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 25 Apr 2023 13:54:10 +0200    

Click here for diff

Commit 1021bd6a89 excluded autovacuum workers from cost-limit balance  
calculations when per-relation options were set.  The code checks for  
limit and cost_delay being greater than zero, but since cost_delay can  
be set to -1 the test needs to check for greater than or zero.  
  
Backpatch to all supported branches since 1021bd6a89 was backpatched  
all the way at the time.  
  
Author: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAD21AoBS7o6Ljt_vfqPQPf67AhzKu3fR0iqk8B=vVYczMugKMQ@mail.gmail.com  
Backpatch-through: v11 (all supported branches)  

M src/backend/postmaster/autovacuum.c

Reduce the log level in 035_standby_logical_decoding.pl.

commit   : 3034dc56ef4b9bc1490e2b1e09fcdf3eeae53e8f    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 25 Apr 2023 08:33:09 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 25 Apr 2023 08:33:09 +0530    

Click here for diff

Reduce the log level in 035_standby_logical_decoding.pl as the test  
doesn't require the higher log level. This helps to shrink the output size  
and speed up the test a bit.  
  
Author: Bertrand Drouvot  
Discus