PostgreSQL 16.0 commit log

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

commit   : c372fbbd8e911f2412b80a8c39d7079366565d67    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Sep 2023 16:25:06 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Mon, 11 Sep 2023 16:10:09 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Mon, 11 Sep 2023 14:22:52 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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://[email protected]/pgtranslation/messages.git  
Source-Git-Hash: de944161c6153124a7bf720cb99823ff31b64bab  

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

Translation updates

commit   : 6bdeed9844d77d051905771c5673364d4e385052    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 Sep 2023 14:08:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 Sep 2023 14:08:53 +0200    

Click here for diff

Source-Git-URL: ssh://[email protected]/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 <[email protected]>    
date     : Fri, 8 Sep 2023 17:25:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 8 Sep 2023 17:25:15 -0400    

Click here for diff

Reported-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Laurenz Albe  
  
Backpatch-through: 11  

M doc/src/sgml/syntax.sgml

Stabilize subscription stats test.

commit   : 1b95c8d85fa66c0ef63591b8064b023872a8f43c    
  
author   : Masahiko Sawada <[email protected]>    
date     : Fri, 8 Sep 2023 22:50:56 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Fri, 8 Sep 2023 11:34:43 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 7 Sep 2023 14:12:25 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Thu, 7 Sep 2023 11:47:42 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Reported-by: Bharath Rupireddy <[email protected]>  
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 <[email protected]>    
date     : Wed, 6 Sep 2023 16:52:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 6 Sep 2023 16:52:24 -0400    

Click here for diff

Reported-by: [email protected]  
  
Diagnosed-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  
  
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 <[email protected]>    
date     : Wed, 6 Sep 2023 15:36:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Wed, 6 Sep 2023 09:04:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 6 Sep 2023 08:11:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Tue, 5 Sep 2023 13:05:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Tue, 5 Sep 2023 11:36:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 4 Sep 2023 14:55:49 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
Backpatch-through: 11  

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

Fix handling of shared statistics with dropped databases

commit   : c397c98ae63d57c35766dbefe4ea34a5162abf53    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Sep 2023 08:04:40 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Thu, 31 Aug 2023 15:14:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Thu, 31 Aug 2023 13:02:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Wed, 30 Aug 2023 14:47:20 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Wed, 30 Aug 2023 14:47:14 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Wed, 30 Aug 2023 17:15:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
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 <[email protected]>    
date     : Wed, 30 Aug 2023 08:03:48 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Tue, 29 Aug 2023 15:15:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
Reviewed-by: Peter Smith <[email protected]>  
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 <[email protected]>    
date     : Tue, 29 Aug 2023 14:27:40 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Tue, 29 Aug 2023 09:09:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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/[email protected]#482670177eb4eaf4c9f03c1eed963e5f  
Backpatch-through: 13  

M src/backend/postmaster/postmaster.c

Stamp 16rc1.

commit   : d94dadcc5020f6746203896dba5a9627872ba2ee    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Aug 2023 16:26:56 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Mon, 28 Aug 2023 09:23:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Sun, 27 Aug 2023 20:30:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Sun, 27 Aug 2023 20:29:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  

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

Remove incorrect/duplicate name from list of acknowledgments

commit   : 8d70eb731c43c4ccb5fa5642518a277ef3f6b860    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 27 Aug 2023 20:27:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 27 Aug 2023 20:27:32 +0200    

Click here for diff

Reported-by: Vik Fearing <[email protected]>  

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

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

commit   : a842ba407c375b4088ee0fa569780b5328cdebe8    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 24 Aug 2023 21:44:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 24 Aug 2023 21:44:31 -0400    

Click here for diff

Reported-by: Jeff Davis  
  
Discussion:  https://postgr.es/m/[email protected]  
  
Backpatch-through: 16 only  

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

pg_upgrade: Bump MESSAGE_WIDTH.

commit   : 2e7d15ab69d91abc874f6b5d89df4d7c5a4f2c17    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 24 Aug 2023 10:13:31 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Thu, 24 Aug 2023 12:02:40 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 24 Aug 2023 14:22:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Thu, 24 Aug 2023 13:59:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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/[email protected]  

M src/include/catalog/genbki.h

Rename hook functions for debug_io_direct to match variable name.

commit   : 155c81463c26d908a1579b6d90e7b39b6f61df8b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2023 14:12:45 +0200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 24 Aug 2023 14:51:57 +0530    
  
committer: Amit Kapila <[email protected]>    
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 <[email protected]>    
date     : Thu, 24 Aug 2023 10:24:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Thu, 24 Aug 2023 08:23:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 23 Aug 2023 21:33:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Thu, 24 Aug 2023 10:33:48 +1200    
  
committer: David Rowley <[email protected]>    
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 <[email protected]>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Reviewed-by: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Wed, 23 Aug 2023 15:15:28 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Reviewed-by: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Wed, 23 Aug 2023 12:29:50 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

ci: Move execution method of tasks into yaml templates

commit   : cad461b044b521c5f80d180194d6e27dce82c424    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 12:27:40 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

ci: Don't specify amount of memory

commit   : 5581a9a3953020dd9df18ffd00b788f296bd60e0    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Aug 2023 12:27:29 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI support was added  

M .cirrus.yml

Fix _bt_allequalimage() call within critical section.

commit   : c3b874c431bc5d1399c011e9e5ce1e30b756f930    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 23 Aug 2023 18:08:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Wed, 23 Aug 2023 17:21:31 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Wed, 23 Aug 2023 14:13:07 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v11  

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

doc: Add more ICU rules examples

commit   : 103df207a71e74d64173edcb7bacec872933755b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 11:23:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Aug 2023 11:23:42 +0200    

Click here for diff

In particular, add an example EBCDIC collation.  
  
Author: Daniel Verite <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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 <[email protected]>    
date     : Wed, 23 Aug 2023 08:25:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 23 Aug 2023 08:12:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 23 Aug 2023 12:10:18 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
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 <[email protected]>    
date     : Tue, 22 Aug 2023 19:37:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Tue, 22 Aug 2023 11:21:36 -0700    
  
committer: Jeff Davis <[email protected]>    
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 <[email protected]>    
date     : Tue, 22 Aug 2023 11:57:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 22 Aug 2023 15:15:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 22 Aug 2023 15:15:24 -0400    

Click here for diff

Reported-by: Pavel Luzanov  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 16 only  

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

Add list of acknowledgments to release notes

commit   : 8c76a556658ddb56e33be5507131874776c00907    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Aug 2023 10:54:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 21 Aug 2023 18:55:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Mon, 21 Aug 2023 17:54:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
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/[email protected]  
  
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 <[email protected]>    
date     : Mon, 21 Aug 2023 13:33:04 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Sat, 19 Aug 2023 12:40:45 -0700    
  
committer: Andres Freund <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Fri, 18 Aug 2023 07:41:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Thu, 17 Aug 2023 15:45:13 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ8NTvqLHz6dqbQnt2c8XCki4r2QvXjBQcXpVwxTY_pvA%40mail.gmail.com  

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

commit   : 11f4935490eb8597fcc0e3e71c2caf90e6154943    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 16 Aug 2023 22:22:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Wed, 16 Aug 2023 14:34:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Wed, 16 Aug 2023 16:17:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 16 Aug 2023 15:09:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Tue, 15 Aug 2023 09:15:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Tue, 15 Aug 2023 10:20:11 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
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 <[email protected]>    
date     : Mon, 14 Aug 2023 17:28:39 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Mon, 14 Aug 2023 09:54:03 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Author: Andres Freund <[email protected]>  
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 <[email protected]>    
date     : Sat, 12 Aug 2023 13:09:45 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Sat, 12 Aug 2023 13:06:04 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Sat, 12 Aug 2023 14:37:05 -0700    
  
committer: Noah Misch <[email protected]>    
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 <[email protected]>    
date     : Thu, 10 Aug 2023 10:16:59 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Thu, 10 Aug 2023 12:04:07 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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/[email protected]  
Reviewed-by: Tomas Vondra <[email protected]>  

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 <[email protected]>    
date     : Wed, 9 Aug 2023 22:09:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Wed, 9 Aug 2023 20:48:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 9 Aug 2023 20:48:31 -0400    

Click here for diff

Reported-by: Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 16 only  

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

doc: PG 16 relnotes, small wording improvement

commit   : 0752461d3a1114d560225fae7522dde0ab544b63    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 9 Aug 2023 20:37:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Wed, 9 Aug 2023 18:01:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 9 Aug 2023 18:01:50 -0400    

Click here for diff

Reported-by: Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  
  
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 <[email protected]>    
date     : Wed, 9 Aug 2023 17:47:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 9 Aug 2023 17:47:03 -0400    

Click here for diff

Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/ZL0M28/[email protected]  
  
Backpatch-through: 16 only  

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

Recalculate search_path after ALTER ROLE.

commit   : 0d56c32c8e724f96f4aa5b15645d427f6e2ddf21    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 7 Aug 2023 15:13:06 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Wed, 9 Aug 2023 13:56:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 9 Aug 2023 13:56:26 -0400    

Click here for diff

Reported-by: Erik Rijkers  
  
Discussion: https://postgr.es/m/[email protected]  
  
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 <[email protected]>    
date     : Wed, 9 Aug 2023 13:23:39 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 9 Aug 2023 13:23:39 -0400    

Click here for diff

Reported-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 16 only  

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

doc: PG 16 relnotes, remove MAINTAIN item

commit   : 86415153f47a4ad8e332262592e0a32f14f226c6    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 9 Aug 2023 11:16:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Mon, 7 Aug 2023 16:05:20 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Mon, 7 Aug 2023 06:05:56 -0700    
  
committer: Noah Misch <[email protected]>    
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 <[email protected]>    
date     : Mon, 7 Aug 2023 12:06:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 7 Aug 2023 22:14:54 +1200    
  
committer: David Rowley <[email protected]>    
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 <[email protected]>    
date     : Mon, 7 Aug 2023 09:27:09 +0100    
  
committer: Dean Rasheed <[email protected]>    
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 <[email protected]>    
date     : Thu, 3 Aug 2023 17:45:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
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 <[email protected]>    
date     : Thu, 3 Aug 2023 17:15:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
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 <[email protected]>    
date     : Wed, 2 Aug 2023 15:01:10 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Tue, 1 Aug 2023 11:22:03 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>,  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
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 <[email protected]>    
date     : Wed, 2 Aug 2023 12:06:08 +1200    
  
committer: David Rowley <[email protected]>    
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 <[email protected]>    
date     : Wed, 2 Aug 2023 01:40:27 +1200    
  
committer: David Rowley <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Fri, 28 Jul 2023 15:45:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
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 <[email protected]>    
date     : Thu, 27 Jul 2023 11:56:35 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/backend/libpq/hba.c

Fix performance problem with new COPY DEFAULT code

commit   : c1308ce2d9224f0ec08128ab35e161837f9a5105    
  
author   : David Rowley <[email protected]>    
date     : Thu, 27 Jul 2023 14:48:44 +1200    
  
committer: David Rowley <[email protected]>    
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 <[email protected]>    
date     : Wed, 26 Jul 2023 14:41:23 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Tue, 25 Jul 2023 15:09:31 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Tue, 25 Jul 2023 09:01:29 +0530    
  
committer: Amit Kapila <[email protected]>    
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 <[email protected]>    
date     : Mon, 24 Jul 2023 19:07:52 -0700    
  
committer: Andres Freund <[email protected]>    
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" <[email protected]>  
Reported-by: "Anton A. Melnikov" <[email protected]>  
Reported-by: Victoria Shepard  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 16-  

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

Make test_decoding ddl.out shorter

commit   : b1dc946eee3d8d4fd9776ccbc21bcb4ab747b998    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jul 2023 17:48:06 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Mon, 24 Jul 2023 17:14:22 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid compiler warning in non-assert builds.

commit   : 11237e5a46ca2221aca5c74bf43bb58eff8dcc3b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jul 2023 10:32:52 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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

Fix calculation of relid sets for partitionwise child joins.

commit   : f75595cd80d134d5a63929a90a0347ff9729b79a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Jul 2023 12:00:14 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Fri, 21 Jul 2023 19:28:31 +0900    
  
committer: Amit Langote <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 20 Jul 2023 14:23:46 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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

Pass constructName to transformJsonValueExpr()

commit   : 7825a1b01e400434835253b4ff38dd96d823d454    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 20 Jul 2023 16:23:49 +0900    
  
committer: Amit Langote <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Wed, 19 Jul 2023 12:46:30 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Wed, 19 Jul 2023 11:00:34 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M doc/src/sgml/func.sgml

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

commit   : e6e451c1d7e5bc70f0f3a63cbf06eb298f56a76e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Jul 2023 11:59:39 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Tue, 18 Jul 2023 14:04:46 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Tue, 18 Jul 2023 13:44:27 +0900    
  
committer: Michael Paquier <[email protected]>    
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" <[email protected]>  
Author: "suyu.cmj" <[email protected]>  
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 <[email protected]>    
date     : Mon, 17 Jul 2023 16:54:54 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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

Add missing initializations of p_perminfo

commit   : 4a7301c7ad1c504c5a3f485a1d28cfd62b3ecbb0    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 14 Jul 2023 14:28:38 +0900    
  
committer: Amit Langote <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Fri, 14 Jul 2023 11:16:03 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Fri, 14 Jul 2023 10:13:14 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Thu, 13 Jul 2023 13:03:30 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Author: Andres Freund <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Thu, 13 Jul 2023 13:03:30 -0700    
  
committer: Andres Freund <[email protected]>    
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/[email protected]  

M src/backend/commands/vacuum.c

Remove unnecessary pfree() in g_intbig_compress().

commit   : e27f3f52c289a2f6e67f9319602df190a92446c0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jul 2023 13:07:51 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Thu, 13 Jul 2023 12:56:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Thu, 13 Jul 2023 15:03:24 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
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 <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
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 <[email protected]>    
date     : Wed, 12 Jul 2023 16:26:03 -0700    
  
committer: Andres Freund <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Mon, 10 Jul 2023 12:14:34 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/backend/tcop/postgres.c

Fix pgindent

commit   : e004cb0394402a26b7142721e59a4f8e179bd1e4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Jul 2023 12:05:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 10 Jul 2023 10:46:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 10 Jul 2023 09:40:12 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Sun, 9 Jul 2023 10:02:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Sun, 9 Jul 2023 09:46:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Sun, 9 Jul 2023 16:14:47 +1200    
  
committer: David Rowley <[email protected]>    
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 <[email protected]>    
date     : Sat, 8 Jul 2023 12:34:25 -0400    
  
committer: Andrew Dunstan <[email protected]>    
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 <[email protected]>    
date     : Sat, 8 Jul 2023 11:21:58 -0400    
  
committer: Andrew Dunstan <[email protected]>    
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 <[email protected]>    
date     : Sat, 8 Jul 2023 17:24:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Sat, 8 Jul 2023 15:50:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 8 Jul 2023 15:50:35 +0200    

Click here for diff

Reviewed-by: Amit Langote <[email protected]>  
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 <[email protected]>    
date     : Fri, 7 Jul 2023 11:25:23 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Fri, 7 Jul 2023 19:04:32 +0200    
  
committer: Tomas Vondra <[email protected]>    
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 <[email protected]>    
date     : Thu, 6 Jul 2023 08:34:17 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>    
date     : Thu, 6 Jul 2023 12:27:40 -0400    
  
committer: Andrew Dunstan <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 6 Jul 2023 17:25:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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 <[email protected]>    
date     : Thu, 6 Jul 2023 08:41:30 +0530    
  
committer: Amit Kapila <[email protected]>    
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 <[email protected]>    
date     : Wed, 5 Jul 2023 13:13:13 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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/[email protected]  

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

pgstat: fix subscription stats entry leak.

commit   : be8cae7e2f03f35a049e2b1f1113860fea6d0212    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 5 Jul 2023 14:49:58 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Tue, 4 Jul 2023 17:36:13 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Reported-by: bowenshi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Tue, 4 Jul 2023 17:57:03 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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 <[email protected]>    
date     : Tue, 4 Jul 2023 15:16:34 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Reviewed-by: Robert Haas <[email protected]> (earlier version)  
Reviewed-by: Thomas Munro <[email protected]>  
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 <[email protected]>    
date     : Mon, 3 Jul 2023 16:20:01 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Reported-by: Dmitry Dolgov <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
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 <[email protected]>    
date     : Mon, 3 Jul 2023 16:18:20 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Reviewed-by: Dmitry Dolgov <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
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 <[email protected]>    
date     : Mon, 3 Jul 2023 16:16:27 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Reviewed-by: Dmitry Dolgov <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
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 <[email protected]>    
date     : Mon, 3 Jul 2023 18:16:58 +0200    
  
committer: Tomas Vondra <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Mon, 3 Jul 2023 10:06:26 -0400    
  
committer: Andrew Dunstan <[email protected]>    
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 <[email protected]>    
date     : Mon, 3 Jul 2023 10:06:13 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Mon, 3 Jul 2023 10:53:44 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Sun, 2 Jul 2023 20:29:01 +0200    
  
committer: Tomas Vondra <[email protected]>    
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/[email protected]  

M src/backend/commands/trigger.c

Fix memory leak in Incremental Sort rescans

commit   : 9ae7b5d1f3ad2dc31ba7552a19d2efb24e7dbc0e    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 2 Jul 2023 18:54:09 +0200    
  
committer: Tomas Vondra <[email protected]>    
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 <[email protected]>    
date     : Sat, 1 Jul 2023 10:00:39 -0700    
  
committer: Noah Misch <[email protected]>    
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 <[email protected]>    
date     : Fri, 30 Jun 2023 17:35:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Fri, 30 Jun 2023 15:48:54 +0900    
  
committer: Amit Langote <[email protected]>    
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 <[email protected]>    
date     : Fri, 30 Jun 2023 13:54:53 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 19:14:22 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Fri, 30 Jun 2023 07:49:01 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 09:12:52 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Discussion: CSPIJVUDZFKX.3KHMOAVGF94RV@c3po  

M meson.build

Defend against bogus parameterization of join input paths.

commit   : a798660ebe3ff1feb310db13b957c5cda4c8c50d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Jun 2023 12:12:52 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Thu, 29 Jun 2023 10:19:10 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 29 Jun 2023 13:16:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Jun 2023 13:16:52 +0200    

Click here for diff

Author: Tristan Partin <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 13:06:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 13:06:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Jun 2023 13:06:02 +0200    

Click here for diff

Author: Tristan Partin <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 13:05:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Jun 2023 13:05:05 +0200    

Click here for diff

Author: Tristan Partin <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 13:04:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CSPIJVUDZFKX.3KHMOAVGF94RV%40c3po  

M meson.build

meson: Remove old comment

commit   : 45c88eecb4a6cf286b2bd8fc977ccf932525933a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Jun 2023 13:03:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 12:56:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 12:53:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 12:52:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Jun 2023 12:52:12 +0200    

Click here for diff

Author: Tristan Partin <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 12:47:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 12:44:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 29 Jun 2023 10:30:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Thu, 29 Jun 2023 09:14:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 28 Jun 2023 21:32:53 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Thu, 29 Jun 2023 09:17:26 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Thu, 29 Jun 2023 08:04:47 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Wed, 28 Jun 2023 19:30:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 28 Jun 2023 12:48:14 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M doc/src/sgml/mvcc.sgml

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

commit   : b381d9637030c163c3b1f8a9d3de51dfc1b4ee58    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Jun 2023 16:26:55 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Wed, 28 Jun 2023 15:57:31 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Wed, 28 Jun 2023 08:59:36 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 27 Jun 2023 10:11:31 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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 <[email protected]>    
date     : Mon, 26 Jun 2023 16:07:19 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Mon, 26 Jun 2023 13:44:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Mon, 26 Jun 2023 12:02:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 26 Jun 2023 11:52:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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%[email protected]  

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 <[email protected]>    
date     : Sat, 24 Jun 2023 17:18:08 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/backend/tsearch/wparser_def.c

doc: rename "decades" to be more generic

commit   : 239fd118b0923c7b3e28354e13fb7cea42f729e1    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 23 Jun 2023 22:50:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 23 Jun 2023 22:50:55 -0400    

Click here for diff

Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/history.sgml

Error message refactoring

commit   : 3ad5f07c0fe9a734fb4e2484c7165f9280dbefa7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Jun 2023 16:36:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 23 Jun 2023 14:48:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 23 Jun 2023 14:14:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 23 Jun 2023 17:49:07 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Thu, 22 Jun 2023 15:48:38 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Thu, 22 Jun 2023 15:48:20 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Thu, 22 Jun 2023 12:37:19 +0530    
  
committer: Amit Kapila <[email protected]>    
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/[email protected]  

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

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

commit   : c2d35bb88eab99fd81198fa4caee004fb8997c73    
  
author   : David Rowley <[email protected]>    
date     : Thu, 22 Jun 2023 12:45:30 +1200    
  
committer: David Rowley <[email protected]>    
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 <[email protected]>    
date     : Wed, 21 Jun 2023 17:41:58 -0700    
  
committer: Peter Geoghegan <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Wed, 21 Jun 2023 19:20:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 21 Jun 2023 19:20:07 -0400    

Click here for diff

Reported-by: Pierre <[email protected]>  
  
Discussion: https://postgr.es/m/[email protected]  
  
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 <[email protected]>    
date     : Wed, 21 Jun 2023 13:18:25 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Wed, 21 Jun 2023 11:10:03 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 21 Jun 2023 11:10:03 -0700    

Click here for diff

Reverts 27b62377b4.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Wed, 21 Jun 2023 11:07:11 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Wed, 21 Jun 2023 16:14:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 21 Jun 2023 16:16:15 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Wed, 21 Jun 2023 10:36:09 +0530    
  
committer: Amit Kapila <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 20 Jun 2023 15:14:58 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Tue, 20 Jun 2023 17:47:36 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 20 Jun 2023 13:15:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Tue, 20 Jun 2023 11:09:56 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 20 Jun 2023 10:29:57 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Tue, 20 Jun 2023 10:22:52 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Tue, 20 Jun 2023 09:52:52 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Tue, 20 Jun 2023 09:50:43 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Mon, 19 Jun 2023 18:08:59 -0700    
  
committer: Jeff Davis <[email protected]>    
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 <[email protected]>    
date     : Tue, 20 Jun 2023 10:25:27 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Mon, 19 Jun 2023 14:11:32 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: -  

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

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

commit   : 797f98036400bc70d4b331c5b1760a05aab59cfa    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 19 Jun 2023 11:51:22 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  

M src/test/regress/pg_regress.c

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

commit   : 7fcd7ef2a9c372b789f95b40043edffdc611c566    
  
author   : David Rowley <[email protected]>    
date     : Mon, 19 Jun 2023 13:00:42 +1200    
  
committer: David Rowley <[email protected]>    
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 <[email protected]>    
date     : Fri, 16 Jun 2023 10:27:32 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Fri, 16 Jun 2023 10:53:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 16 Jun 2023 10:32:49 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Fri, 16 Jun 2023 10:04:22 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 16 Jun 2023 10:04:22 +0900    

Click here for diff

Back-patch down to 11.  
  
Author: Sho Kato (<[email protected]>)  
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 <[email protected]>    
date     : Thu, 15 Jun 2023 15:24:50 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 15 Jun 2023 18:39:45 +0900    
  
committer: Amit Langote <[email protected]>    
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 <[email protected]>    
date     : Thu, 15 Jun 2023 13:54:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Thu, 15 Jun 2023 17:27:21 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Thu, 15 Jun 2023 17:04:19 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Thu, 15 Jun 2023 13:45:34 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Thu, 15 Jun 2023 08:37:48 +0530    
  
committer: Amit Kapila <[email protected]>    
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 <[email protected]>    
date     : Wed, 14 Jun 2023 05:31:54 -0700    
  
committer: Noah Misch <[email protected]>    
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/[email protected]  

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

Fix typo in comment.

commit   : 4327f6c7480fea9348ea6825a9d38a71b2ef8785    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 14 Jun 2023 13:28:41 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Tue, 13 Jun 2023 12:52:47 +0900    
  
committer: Amit Langote <[email protected]>    
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 <[email protected]>  
Reviewed-by: David Steele <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
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 <[email protected]>    
date     : Wed, 14 Jun 2023 11:02:50 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
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 <[email protected]>    
date     : Tue, 13 Jun 2023 18:01:33 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Tue, 13 Jun 2023 15:58:37 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 13 Jun 2023 15:00:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 12 Jun 2023 15:06:12 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Mon, 12 Jun 2023 10:54:28 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Mon, 12 Jun 2023 07:40:39 -0700    
  
committer: Noah Misch <[email protected]>    
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 <[email protected]>    
date     : Mon, 12 Jun 2023 07:40:39 -0700    
  
committer: Noah Misch <[email protected]>    
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 <[email protected]>    
date     : Mon, 12 Jun 2023 07:40:38 -0700    
  
committer: Noah Misch <[email protected]>    
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/[email protected]  

M src/backend/meson.build

Give postgres.exe the icon of other executables.

commit   : 04411cbfdb76194c483c77bdbc636e83099ae5c3    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 12 Jun 2023 07:40:38 -0700    
  
committer: Noah Misch <[email protected]>    
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/[email protected]  

M src/backend/Makefile

Fix "wrong varnullingrels" for subquery nestloop parameters.

commit   : bfd332b3fda5c73e28c05b7ba0aac6cf053cdf00    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jun 2023 10:01:26 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Mon, 12 Jun 2023 16:25:37 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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 <[email protected]>    
date     : Mon, 12 Jun 2023 12:19:46 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Mon, 12 Jun 2023 09:14:03 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Sat, 10 Jun 2023 14:08:25 -0700    
  
committer: Peter Geoghegan <[email protected]>    
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 <[email protected]>  
Reviewed-By: Heikki Linnakangas <[email protected]>  
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 <[email protected]>    
date     : Sat, 10 Jun 2023 13:55:15 -0700    
  
committer: Peter Geoghegan <[email protected]>    
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 <[email protected]>    
date     : Sat, 10 Jun 2023 08:11:02 -0700    
  
committer: Jeff Davis <[email protected]>    
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 <[email protected]>    
date     : Fri, 9 Jun 2023 20:12:16 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Reviewed-by: Tristan Partin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Fri, 9 Jun 2023 21:04:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Fri, 9 Jun 2023 11:20:47 -0700    
  
committer: Jeff Davis <[email protected]>    
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 <[email protected]>    
date     : Thu, 8 Jun 2023 21:20:24 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Fri, 9 Jun 2023 11:56:27 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Fri, 9 Jun 2023 10:43:03 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Fri, 9 Jun 2023 09:37:21 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Thu, 8 Jun 2023 17:10:04 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Thu, 8 Jun 2023 13:11:49 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/backend/rewrite/rewriteManip.c

Fix small overestimation of base64 encoding output length.

commit   : d98ed080bb31fd3d46281127871b7886288686d9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Jun 2023 11:24:31 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 8 Jun 2023 20:11:52 +0900    
  
committer: Fujii Masao <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 8 Jun 2023 10:10:34 +1200    
  
committer: David Rowley <[email protected]>    
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/[email protected]  

M src/include/port/pg_bitutils.h

Use per-tuple context in ExecGetAllUpdatedCols

commit   : f24523672de9c37423800a74cffa7aec27146047    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 7 Jun 2023 16:48:50 +0200    
  
committer: Tomas Vondra <[email protected]>    
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/[email protected]  

M src/backend/executor/execUtils.c

doc: Fix confusing positioning of notes in connection settings

commit   : fb5a7d84d23fa2e1f26334453948a01e8e59eee3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Jun 2023 17:54:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Jun 2023 17:54:53 +0200    

Click here for diff

Reported-by: Jonathan S. Katz <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
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 <[email protected]>    
date     : Wed, 7 Jun 2023 16:57:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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 <[email protected]>    
date     : Wed, 7 Jun 2023 09:19:17 +0530    
  
committer: Amit Kapila <[email protected]>    
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 <[email protected]>    
date     : Tue, 6 Jun 2023 20:30:53 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
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 <[email protected]>    
date     : Mon, 5 Jun 2023 14:00:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 5 Jun 2023 14:00:37 -0400    

Click here for diff

Reported-by: Erik Rijkers  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove obsolete comment

commit   : 08235203ddefde1d0bfb6a1e8bb6ff546a2c7e8c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jun 2023 15:33:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 5 Jun 2023 17:34:27 +1200    
  
committer: David Rowley <[email protected]>    
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 <[email protected]>    
date     : Sun, 4 Jun 2023 13:27:34 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M doc/src/sgml/ddl.sgml

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

commit   : 01610747867ff26ca62d099e83e62d97730c40c1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Jun 2023 13:05:54 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Sun, 4 Jun 2023 11:22:05 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/bin/pg_dump/pg_dump_sort.c

doc: Add note to prevent server spoofing with SCRAM

commit   : d0f4824a54104bb831ebcd46982e6e3b337ef5fa    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 3 Jun 2023 17:44:09 -0400    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Thu, 1 Jun 2023 19:59:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 1 Jun 2023 19:59:46 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: add missing "the" in LATERAL sentence.

commit   : 9eb1817d5cb8e85a753ea658059495d0b75a623a    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 1 Jun 2023 10:22:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Wed, 31 May 2023 07:01:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Tue, 30 May 2023 19:32:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Tue, 30 May 2023 19:08:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Tue, 30 May 2023 06:04:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 30 May 2023 06:04:09 -0400    

Click here for diff

Reported-by: Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Add missing backend_type to pg_stat_activity

commit   : e77c6c55e8dd834667006d2b3ba5f2868c21671f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 May 2023 10:31:11 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Mon, 29 May 2023 14:36:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Mon, 29 May 2023 13:49:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Sat, 27 May 2023 23:04:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 27 May 2023 23:04:48 -0400    

Click here for diff

Reported-by: Laurenz Albe, Álvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  

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

ICU: use uloc_getDefault() for initdb.

commit   : ec1264f01e374c48707cc7dc18928b4ace0530fb    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 26 May 2023 11:26:11 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  

M src/bin/initdb/initdb.c

Fix joinclause removal logic to cope with cloned clauses.

commit   : 7a844c77ece1bda3b076034bc20142d4bd66db7a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 May 2023 12:13:19 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Thu, 25 May 2023 17:05:50 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 25 May 2023 17:05:50 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml

commit   : 5abff197cc3ec2b0a1f5a64fd34953d0318bca79    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 25 May 2023 15:33:00 -0700    
  
committer: Peter Geoghegan <[email protected]>    
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 <[email protected]>  
Reviewed-By: Heikki Linnakangas <[email protected]>  
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 <[email protected]>    
date     : Thu, 25 May 2023 10:28:33 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Thu, 25 May 2023 12:49:26 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>    
date     : Thu, 25 May 2023 12:43:16 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Thu, 25 May 2023 12:36:18 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Thu, 25 May 2023 16:26:08 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Wed, 24 May 2023 22:03:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Wed, 24 May 2023 12:18:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 24 May 2023 12:18:43 -0400    

Click here for diff

Reported-by: Erik Rijkers  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: PG 16 relnotes, merge and move vector items

commit   : ad5406246bff5490fbd428c148717c5b87e52ab1    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 24 May 2023 09:54:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Wed, 24 May 2023 00:09:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Tue, 23 May 2023 19:34:09 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Tue, 23 May 2023 18:51:43 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/tools/pginclude/README

Fix the install rule for snowball_create.sql.

commit   : 5df5bea29070b420452bdb257c3dec1cf0419fca    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 May 2023 11:15:57 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/backend/snowball/Makefile

Use lower case for icu_validation_level values

commit   : 0ffbe6e59197e5e2b3bf026f594fabb8ada9bec3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 May 2023 15:19:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Tue, 23 May 2023 15:19:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Tue, 23 May 2023 15:18:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Tue, 23 May 2023 00:27:01 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Mon, 22 May 2023 17:08:08 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Mon, 22 May 2023 13:58:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 22 May 2023 13:58:24 -0400    

Click here for diff

Reported-by: Jonathan Katz  
  
Discussion: https://postgr.es/m/[email protected]  

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

Spell the values of libpq's gssdelegation parameter as "0" and "1".

commit   : 1f9f6aa491986ed4e65851e827d021e9c784fd42    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 May 2023 11:50:20 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Mon, 22 May 2023 10:20:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Mon, 22 May 2023 12:44:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 22 May 2023 12:26:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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 <[email protected]>    
date     : Sun, 21 May 2023 23:39:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Sun, 21 May 2023 20:03:56 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Sun, 21 May 2023 22:52:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 21 May 2023 22:52:42 -0400    

Click here for diff

Reported-by: Andres Freund, jian he  
  
Discussion: https://postgr.es/m/[email protected], [email protected]  

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

doc: PG 16 relnotes, misc. updates

commit   : c822358a256ca1f3b8b08557b9c9f0efa8d41675    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 21 May 2023 15:57:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 21 May 2023 15:57:37 -0400    

Click here for diff

Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

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

In clause_is_computable_at(), test required_relids for clone clauses.

commit   : b9c755a2f625b7dca6323804b140b016d95a0b1d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 May 2023 15:25:43 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Sun, 21 May 2023 09:48:37 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  

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

Optimize walsender wake up logic using condition variables

commit   : bc971f4025c378ce500d86597c34b0ef996d4d8c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 21 May 2023 09:44:55 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Suggested-by: Andres Freund <[email protected]>  
Author: Bharath Rupireddy <[email protected]>  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Zhijie Hou <[email protected]>  
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 <[email protected]>    
date     : Sun, 21 May 2023 11:55:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Sun, 21 May 2023 11:21:19 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Sun, 21 May 2023 10:55:18 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Sat, 20 May 2023 20:18:51 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Sat, 20 May 2023 21:32:54 -0400    
  
committer: Bruce Momjian <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Sat, 20 May 2023 21:03:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 17:28:04 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 17:24:48 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Fri, 19 May 2023 16:43:57 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/tools/pgindent/README
M src/tools/pgindent/perltidyrc

Do pre-release housekeeping on catalog data.

commit   : 722541ead194635d77163bda057cc0064ff81149    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 May 2023 16:36:38 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 15:24:07 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 14:26:34 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 20:19:28 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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/[email protected]  

M src/bin/psql/command.c

Message style improvements

commit   : 8e7912e73da008862180112cc6ba4d0aa5fa955d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 May 2023 18:45:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 12:29:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 16:31:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
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 <[email protected]>  
Author: Tomas Vondra <[email protected]>  
Reviewed-by:  Melanie Plageman <[email protected]>  
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 <[email protected]>    
date     : Fri, 19 May 2023 16:19:54 +0200    
  
committer: Tomas Vondra <[email protected]>    
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 <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Reviewed-by: Jehan-Guillaume de Rorthais <[email protected]>  
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 <[email protected]>    
date     : Fri, 19 May 2023 10:57:46 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Fri, 19 May 2023 15:57:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 09:30:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 08:31:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 13:42:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 10:52:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 12:37:58 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Thu, 18 May 2023 23:17:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Thu, 18 May 2023 22:22:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 18 May 2023 22:22:17 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Thu, 18 May 2023 21:44:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Fri, 19 May 2023 01:53:30 +0200    
  
committer: Tomas Vondra <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Fri, 19 May 2023 00:00:22 +0200    
  
committer: Tomas Vondra <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 18 May 2023 18:53:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Thu, 18 May 2023 18:25:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Thu, 18 May 2023 17:42:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Thu, 18 May 2023 13:00:31 +0200    
  
committer: Tomas Vondra <[email protected]>    
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 <[email protected]>    
date     : Thu, 18 May 2023 16:33:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Thu, 18 May 2023 16:00:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
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 <[email protected]>    
date     : Thu, 18 May 2023 11:04:30 -0700    
  
committer: Jeff Davis <[email protected]>    
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 <[email protected]>    
date     : Thu, 18 May 2023 10:37:55 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Thu, 18 May 2023 10:39:16 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Wed, 17 May 2023 13:43:41 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Wed, 17 May 2023 13:18:40 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 17 May 2023 13:18:40 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Wed, 17 May 2023 21:33:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 17 May 2023 11:18:35 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reported-by: Andres Freund <[email protected]>  
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 <[email protected]>    
date     : Wed, 17 May 2023 11:17:12 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Wed, 17 May 2023 11:17:02 -0700    
  
committer: Andres Freund <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Wed, 17 May 2023 20:06:50 +0300    
  
committer: Alexander Korotkov <[email protected]>    
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 <[email protected]>    
date     : Wed, 17 May 2023 19:13:08 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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 <[email protected]>    
date     : Wed, 17 May 2023 18:55:51 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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 <[email protected]>    
date     : Wed, 17 May 2023 11:46:15 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Wed, 17 May 2023 11:13:52 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Wed, 17 May 2023 10:50:35 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

M src/backend/optimizer/plan/setrefs.c

Advance input pointer when LZ4 compressing data

commit   : 1a05c1d252993b0a59c58a6daf91a2df9333044f    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 17 May 2023 16:49:31 +0200    
  
committer: Tomas Vondra <[email protected]>    
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 <[email protected]>  
Reported-by: Michael Paquier <[email protected]>  
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 <[email protected]>    
date     : Wed, 17 May 2023 16:35:17 +0200    
  
committer: Tomas Vondra <[email protected]>    
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 <[email protected]>  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/compress_lz4.c

Add back SQLValueFunction for SQL keywords

commit   : d8c3106bb60e4f87be595f241e173ba3c2b7aa2c    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 May 2023 10:19:17 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 16 May 2023 10:53:42 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 16 May 2023 11:50:08 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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 <[email protected]>    
date     : Tue, 16 May 2023 11:47:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAgg.c

Fix reported runtime for single tests in pg_regress

commit   : 8cb94344c3c7130a0cd5e21e83705739f552187e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 16 May 2023 10:49:48 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 16 May 2023 16:51:44 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  

M doc/src/sgml/monitoring.sgml

libpq: Error message improvement

commit   : c91f3560835f76bd8c9f614bebaa8c634b98b451    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 May 2023 08:59:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Tue, 16 May 2023 06:13:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 15 May 2023 16:02:07 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Mon, 15 May 2023 07:07:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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/[email protected]  

M src/bin/pg_amcheck/t/004_verify_heapam.pl

Fix whitespace inconsistencies

commit   : 1d70fb400c2c8312dac3ff19a1bb1cb5351047ce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 May 2023 06:27:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 15 May 2023 10:45:19 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Mon, 15 May 2023 10:31:14 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
Reviewed-by: Noah Misch <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]> (the idea, not the patch)  
Reviewed-by: Tom Lane <[email protected]> (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 <[email protected]>    
date     : Fri, 12 May 2023 13:50:46 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Fri, 12 May 2023 16:11:14 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Fri, 12 May 2023 09:45:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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 <[email protected]>    
date     : Thu, 11 May 2023 13:44:25 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Wed, 10 May 2023 10:49:50 -0700    
  
committer: Peter Geoghegan <[email protected]>    
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 <[email protected]>    
date     : Wed, 10 May 2023 18:26:10 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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 <[email protected]>  

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 <[email protected]>    
date     : Wed, 10 May 2023 13:51:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 10 May 2023 11:24:30 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Wed, 10 May 2023 10:19:57 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Tue, 9 May 2023 14:25:33 +0530    
  
committer: Amit Kapila <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 9 May 2023 09:28:06 +0530    
  
committer: Amit Kapila <[email protected]>    
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 <[email protected]>    
date     : Mon, 8 May 2023 20:50:51 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 8 May 2023 20:50:51 -0700    

Click here for diff

This reverts commit f7faa9976cc0504c027a20ed66ceca9018041dd4.  
  
Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Mon, 8 May 2023 13:17:31 -0700    
  
committer: Peter Geoghegan <[email protected]>    
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 <[email protected]>    
date     : Mon, 8 May 2023 10:34:51 -0700    
  
committer: Jeff Davis <[email protected]>    
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/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Mon, 8 May 2023 11:24:47 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Mon, 8 May 2023 10:12:44 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Mon, 8 May 2023 06:14:07 -0700    
  
committer: Noah Misch <[email protected]>    
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 <[email protected]>    
date     : Mon, 8 May 2023 08:24:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 8 May 2023 07:43:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Mon, 8 May 2023 13:47:36 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Mon, 8 May 2023 06:15:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Sun, 7 May 2023 11:01:15 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Fri, 5 May 2023 21:25:44 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
Backpatch-through: 13  

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

Fix sepgsql expected test output

commit   : 95f5a7a42c048ec01ba2650496296fe88aacd50f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 May 2023 11:10:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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/[email protected]  

M contrib/sepgsql/expected/alter.out

Fix copy-and-pasto in error message

commit   : b1c4ed2f02b0c4cf1942e6eb2995bdbf8db5cccf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 May 2023 07:50:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Fri, 5 May 2023 06:29:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/Makefile.global.in

Move return statements out of PG_TRY blocks.

commit   : 57d0051706b897048063acc14c2c3454200c488f    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 3 May 2023 11:32:43 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Thu, 4 May 2023 19:55:56 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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) <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Thu, 4 May 2023 11:48:23 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Thu, 4 May 2023 11:00:33 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 4 May 2023 12:09:59 +0200    
  
committer: Alvaro Herrera <[email protected]>    
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/[email protected]  
Discussion: [2] https://postgr.es/m/[email protected]  

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 <[email protected]>    
date     : Thu, 4 May 2023 06:44:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
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 <[email protected]>    
date     : Thu, 4 May 2023 08:33:56 +0530    
  
committer: Amit Kapila <[email protected]>    
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/[email protected]  

M src/test/recovery/t/035_standby_logical_decoding.pl

Add missing TAP test name

commit   : 1ab763fc22adc88e5d779817e7b42b25a9dd7c9e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 May 2023 11:08:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Wed, 3 May 2023 10:13:13 +0530    
  
committer: Amit Kapila <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 2 May 2023 17:55:01 -0400    
  
committer: Tom Lane <[email protected]>    
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 <[email protected]>    
date     : Tue, 2 May 2023 13:15:29 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
Reviewed-by: Richard Guo <[email protected]>  
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 <[email protected]>    
date     : Tue, 2 May 2023 10:59:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Tue, 2 May 2023 09:41:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
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 <[email protected]>    
date     : Tue, 2 May 2023 12:23:08 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Tue, 2 May 2023 11:40:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 May 2023 11:40:46 +0900    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
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 <[email protected]>    
date     : Sat, 29 Apr 2023 13:06:44 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Fri, 28 Apr 2023 12:24:29 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Fri, 28 Apr 2023 19:29:12 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  
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 <[email protected]>    
date     : Fri, 28 Apr 2023 10:30:05 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Reported-by: John Naylor <[email protected]>  
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 <[email protected]>    
date     : Fri, 28 Apr 2023 15:40:12 +0900    
  
committer: Masahiko Sawada <[email protected]>    
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 <[email protected]>    
date     : Fri, 28 Apr 2023 08:45:19 +0530    
  
committer: Amit Kapila <[email protected]>    
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 <[email protected]>    
date     : Thu, 27 Apr 2023 13:43:48 -0700    
  
committer: Nathan Bossart <[email protected]>    
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 <[email protected]>    
date     : Thu, 27 Apr 2023 22:06:14 +0300    
  
committer: Alexander Korotkov <[email protected]>    
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 <[email protected]>    
date     : Thu, 27 Apr 2023 11:55:06 -0400    
  
committer: Tom Lane <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 27 Apr 2023 14:22:53 +0530    
  
committer: Amit Kapila <[email protected]>    
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/[email protected]  

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 <[email protected]>    
date     : Thu, 27 Apr 2023 13:34:05 +0900    
  
committer: Michael Paquier <[email protected]>    
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/[email protected]  

M src/bin/pg_dump/pg_dump.c

Fix stop condition for dumping GRANT commands

commit   : 7b7fa85130330128b404eddebd4f33c6739454b0    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 26 Apr 2023 14:24:13 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
Co-authored-by: Artur Zakirov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dumpall.c

doc: Fix grammar.

commit   : 4def50eba99e0a7e9b4c09fa3e33209d6d6fb834    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 26 Apr 2023 20:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
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 <[email protected]>    
date     : Wed, 26 Apr 2023 11:40:01 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/Makefile
M src/test/perl/meson.build

Remove bogus #include added by d4e71df6d75.

commit   : 828e93a6f2dbf4bc7a24bc3ce166c34879eeb8b1    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 26 Apr 2023 10:39:46 +1200    
  
committer: Thomas Munro <[email protected]>    
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 <[email protected]>  
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 <[email protected]>    
date     : Wed, 26 Apr 2023 07:10:06 +0900    
  
committer: Michael Paquier <[email protected]>    
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 <[email protected]>    
date     : Tue, 25 Apr 2023 13:54:10 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
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 <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
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 <[email protected]>    
date     : Tue, 25 Apr 2023 08:33:09 +0530    
  
committer: Amit Kapila <[email protected]>    
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  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/035_standby_logical_decoding.pl

Fix buffer refcount leak with FDW bulk inserts

commit   : 806fad7573e2b44de57888e3c04eab8eec4a69a8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Apr 2023 09:42:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Apr 2023 09:42:19 +0900    

Click here for diff

The leak would show up when using batch inserts with foreign tables  
included in a partition tree, as the slots used in the batch were not  
reset once processed.  In order to fix this problem, some  
ExecClearTuple() are added to clean up the slots used once a batch is  
filled and processed, mapping with the number of slots currently in use  
as tracked by the counter ri_NumSlots.  
  
This buffer refcount leak has been introduced in b676ac4 with the  
addition of the executor facility to improve bulk inserts for FDWs, so  
backpatch down to 14.  
  
Alexander has provided the patch (slightly modified by me).  The test  
for postgres_fdw comes from me, based on the test case that the author  
has sent in the report.  
  
Author: Alexander Pyhalov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/nodeModifyTable.c

Remove vacuum_defer_cleanup_age

commit   : 1118cd37eb61e6a2428f457a8b2026a7bb3f801a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 24 Apr 2023 12:20:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 24 Apr 2023 12:20:52 -0700    

Click here for diff

vacuum_defer_cleanup_age was introduced before hot_standby_feedback and  
replication slots existed. It is hard to use reasonably - commonly it will  
either be set too low (not preventing recovery conflicts, while still causing  
some bloat), or too high (causing a lot of bloat). The alternatives do not  
have that issue.  
  
That on its own might not be sufficient reason to remove  
vacuum_defer_cleanup_age, but it also complicates computation of xid  
horizons. See e.g. the bug fixed in be504a3e974. It also is untested.  
  
This commit removes TransactionIdRetreatSafely(), as there are no users  
anymore. There might be potential future users, hence noting that here.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_upgrade/server.c
M src/include/storage/standby.h

Fix memory leakage in plpgsql DO blocks that use cast expressions.

commit   : 441ee1677e6b580794c81943a937cd84363672f3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2023 14:19:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2023 14:19:46 -0400    

Click here for diff

Commit 04fe805a1 modified plpgsql so that datatype casts make use of  
expressions cached by plancache.c, in place of older code where these  
expression trees were managed by plpgsql itself.  However, I (tgl)  
forgot that we use a separate, shorter-lived cast info hashtable in  
DO blocks.  The new mechanism thus resulted in session-lifespan  
leakage of the plancache data once a DO block containing one or more  
casts terminated.  To fix, split the cast hash table into two parts,  
one that tracks only the plancache's CachedExpressions and one that  
tracks the expression state trees generated from them.  DO blocks need  
their own expression state trees and hence their own version of the  
second hash table, but there's no reason they can't share the  
CachedExpressions with regular plpgsql functions.  
  
Per report from Ajit Awekar.  Back-patch to v12 where the issue  
was introduced.  
  
Ajit Awekar and Tom Lane  
  
Discussion: https://postgr.es/m/CAHv6PyrNaqdvyWUspzd3txYQguFTBSnhx+m6tS06TnM+KWc_LQ@mail.gmail.com  

M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h

Rename ExecAggTransReparent, and improve its documentation.

commit   : fce3b26e97ca98de054734e2af7d9125661a9b3f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2023 13:01:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Apr 2023 13:01:33 -0400    

Click here for diff

The name of this function suggests that it ought to reparent R/W  
expanded objects to be children of the persistent aggcontext, instead  
of copying them.  In fact it does no such thing, and if you try to  
make it do so you will see multiple regression failures.  Rename it  
to the less-misleading ExecAggCopyTransValue, and add commentary  
about why that attractive-sounding optimization won't work.  Also  
adjust comments at call sites, some of which were describing logic  
that has since been moved into ExecAggCopyTransValue.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/executor/execExpr.h

doc: Update SQL features names

commit   : 5a8366ad75eb70cffa791119b404c897983260c6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 24 Apr 2023 15:39:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 24 Apr 2023 15:39:54 +0200    

Click here for diff

Some feature names have been adjusted over time upstream.  This pulls  
in those changes.  

M src/backend/catalog/sql_features.txt

ci: Remove OpenSSL 3.1 workaround for missing system CA

commit   : c5e4ec293ea527394fc1d0006ab88047b3ce580f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 24 Apr 2023 11:40:23 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 24 Apr 2023 11:40:23 +0200    

Click here for diff

Commit 0b5d1fb36 fixed the SSL test to properly handle the error message  
from OpenSSL when the system CA pool is missing of invalid, so with that  
we can remove the workaround in Cirrus for when Homebrew clears the cert  
from OPENSSLDIR.  
  
Author: Jacob Champion <[email protected]>  
Discussion: https://postgr.es/m/CAAWbhmj3JtKuRcHcMuf1eCJmoZxMXdzLaYpEGmzu9+kgRGpu3A@mail.gmail.com  

M .cirrus.yml

Remove duplicate lines of code

commit   : 69537f5d17eab2919c9d88880cb242de1e7a647d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 24 Apr 2023 11:16:17 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 24 Apr 2023 11:16:17 +0200    

Click here for diff

Commit 6df7a9698bb accidentally included two identical prototypes for  
default_multirange_selectivi() and commit 086cf1458c6 added a break;  
statement where one was already present, thus duplicating it.  While  
there is no bug caused by this, fix by removing the duplicated lines  
as they provide no value.  
  
Backpatch the fix for duplicate prototypes to v14 and the duplicate  
break statement fix to all supported branches to avoid backpatching  
hazards due to the removal.  
  
Reported-by: Anton Voloshin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/interfaces/ecpg/preproc/variable.c

Use elog to report unexpected action in handle_streamed_transaction().

commit   : 781ac42d43ab2b5af07fd720a01c68348a4d1d20    
  
author   : Masahiko Sawada <[email protected]>    
date     : Mon, 24 Apr 2023 15:37:14 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Mon, 24 Apr 2023 15:37:14 +0900    

Click here for diff

An oversight in commit 216a784829c.  
  
Author: Masahiko Sawada  
Reviewed-by: Kyotaro Horiguchi, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDDbM8_HJt-nMCvcjTK8K9hPzXWqJj7pyaUvR4mm_NrSg@mail.gmail.com  

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

Display 'password_required' option for \dRs+ command.

commit   : 19e65dff38bdccdf2cac7f2083342101df6bea57    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 24 Apr 2023 08:37:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 24 Apr 2023 08:37:58 +0530    

Click here for diff

The commit c3afe8cf5a added a new subscription option 'password_required'  
which should be shown with \dRs+ command.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila, Robert Haas  
Discussion: https://postgr.es/m/CAA4eK1LRz5sCZxwCW6OtpjLtWPvRwBihQOM4jzQm6ppfpexqGA@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Remove new <para id="contrib-obsolete">.

commit   : 244ab8c00c427d35901a6f1eb97e4e22b2916e7e    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 23 Apr 2023 18:58:19 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 23 Apr 2023 18:58:19 -0700    

Click here for diff

Just intagg is obsolete, and having a one-entry list gives undue weight.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/contrib.sgml

Validate ltree siglen GiST option to be int-aligned

commit   : 8bbd0cce92be98de9f4f727b8bf66fe26e5831ea    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 23 Apr 2023 13:58:25 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 23 Apr 2023 13:58:25 +0300    

Click here for diff

Unaligned siglen could lead to an unaligned access to subsequent key fields.  
  
Backpatch to 13, where opclass options were introduced.  
  
Reported-by: Alexander Lakhin  
Bug: 17847  
Discussion: https://postgr.es/m/17847-171232970bea406b%40postgresql.org  
Reviewed-by: Tom Lane, Pavel Borisov, Alexander Lakhin  
Backpatch-through: 13  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree_gist.c
M contrib/ltree/sql/ltree.sql
M doc/src/sgml/ltree.sgml

Fix custom validators call in build_local_reloptions()

commit   : cd115c3530bd59bb0305d62ccef1c9504207ff4c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 23 Apr 2023 13:55:49 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 23 Apr 2023 13:55:49 +0300    

Click here for diff

We need to call them only when validate == true.  
  
Backpatch to 13, where opclass options were introduced.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/2656633.1681831542%40sss.pgh.pa.us  
Reviewed-by: Tom Lane, Pavel Borisov  
Backpatch-through: 13  

M src/backend/access/common/reloptions.c

Doc: update pgindent/README some more.

commit   : 0ec0e2095579ca16fb4f3aee086e57fd1a7533eb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Apr 2023 11:52:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Apr 2023 11:52:46 -0400    

Click here for diff

In commit 2e6ba1315, I missed that there was a redundant  
second reference to pg_bsd_indent's old repo.  

M src/tools/pgindent/README

Fix initdb --no-locale.

commit   : 5cd1a5af4d17496a58678c8eb7ab792119c2d723    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 21 Apr 2023 13:11:18 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 21 Apr 2023 13:11:18 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Reported-by: Andrew Gierth  

M src/bin/initdb/initdb.c

Avoid character classification in regex escape parsing.

commit   : c04c6c5d6f5f213f217f1e356bf1c2d8b4e255a2    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 21 Apr 2023 08:19:41 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 21 Apr 2023 08:19:41 -0700    

Click here for diff

For regex escape sequences, just test directly for the relevant ASCII  
characters rather than using locale-sensitive character  
classification.  
  
This fixes an assertion failure when a locale considers a non-ASCII  
character, such as "൧", to be a digit.  
  
Reported-by: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs49Q6UoKGeT8pBkMtJGJd+16CBFZaaWUk9Du+2ERE5g_YA@mail.gmail.com  
Backpatch-through: 11  

M src/backend/regex/regc_lex.c

Reorder connection markers in loadbalance tests

commit   : a23ab2eebfb19bacb9e8d91edb822a0fec37334c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 21 Apr 2023 12:29:38 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 21 Apr 2023 12:29:38 +0200    

Click here for diff

Commit 7f5b198 introduced TAP tests that use string literals to mark  
the presence of a query in server logs.  Reorder the markers to make  
sure they are used in alphabetical order for easier debugging.  
  
Author: Gurjeet Singh <[email protected]>  
Reviewed-by: Jelte Fennema <[email protected]>  
Discussion: https://postgr.es/m/CABwTF4WcYAENqyUQS2crAYfDuJ497v82ty2-MirjaC+zz9e8nQ@mail.gmail.com  

M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl

Make libpq error messages consistent for translation

commit   : 60ce452729239f10ebbd0803a0ecc460f7f9238a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 21 Apr 2023 10:23:38 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 21 Apr 2023 10:23:38 +0200    

Click here for diff

The errormessage for an incorrect require_auth method wasn't using the  
common "invalid %s value" errormessage which lessens the burden on our  
translators.  Fix by changing to that format to make use of existing  
translations and to make error messages consistent in wording.  
  
Reported and fixed by Gurjeet Singh with some tweaking by myself.  
  
Author: Gurjeet Singh <[email protected]>  
Discussion: https://postgr.es/m/CABwTF4Xu3g9zohJ9obu8m7MKbf8g63NgpRDjwqPHQgAtB+Gb8Q@mail.gmail.com  

M src/interfaces/libpq/fe-connect.c
M src/test/authentication/t/001_password.pl

doc: Add documentation for PGLOADBALANCEHOSTS environment variable in libpq.

commit   : 0a16512d40a58c5046c2ab4ca7eabb8393f31c18    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 21 Apr 2023 16:46:41 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 21 Apr 2023 16:46:41 +0900    

Click here for diff

Commit 7f5b19817e introduced the PGLOADBALANCEHOSTS environment  
variable for connection load balancing in libpq. However, documentation  
for this variable was missing.  
  
Author: Fujii Masao  
Reviewed-by: Jelte Fennema  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml

Remove unused global variable

commit   : 84e05beb111335c0755ef37a7f4d64822170b76d    
  
author   : David Rowley <[email protected]>    
date     : Fri, 21 Apr 2023 11:41:58 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 21 Apr 2023 11:41:58 +1200    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_slru/test_slru.c

Fix incorrect function name reference

commit   : d91d1635292a290191339b868bcc71ef42ca50ce    
  
author   : David Rowley <[email protected]>    
date     : Fri, 21 Apr 2023 10:46:08 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 21 Apr 2023 10:46:08 +1200    

Click here for diff

This function was renamed in 0c9d84427 but this comment wasn't updated.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

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

Remove io prefix from pg_stat_io columns

commit   : 0ecb87e1fa07a733494e35636e55807b0f3fc1ed    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Apr 2023 07:21:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Apr 2023 07:21:50 +0900    

Click here for diff

a9c70b46 added the statistics view pg_stat_io which contained columns  
"io_context" and "io_object".  Given that the columns are in the  
pg_stat_io view, the "io" prefix is somewhat redundant, so remove it.  
  
The code variables referring to these fields are kept unchanged so as  
they can keep their context about I/O.  
  
Bump catalog version.  
  
Author: Melanie Plageman  
Reviewed-by: Kyotaro Horiguchi, Fabrízio de Royes Mello  
Discussion: https://postgr.es/m/CAAKRu_aAQoJWrvT2BYYQvJChFKra_O-5ra3jhzKJZqWsTR1CPQ@mail.gmail.com  

M contrib/amcheck/expected/check_heap.out
M contrib/amcheck/sql/check_heap.sql
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Use --strip-unneeded when stripping static libraries with GNU strip.

commit   : eab2d3147e3c13aca4a9aca52c0a9a581a8d224a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Apr 2023 18:12:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Apr 2023 18:12:32 -0400    

Click here for diff

We've long used "--strip-unneeded" for shared libraries but plain  
"-x" for static libraries when stripping symbols with GNU strip.  
There doesn't seem to be any really good reason for that though,  
since --strip-unneeded produces smaller output (as "-x" alone  
does not remove debug symbols).  Moreover it seems that  
llvm-strip, although it identifies as GNU strip, misbehaves when  
given "-x" for this purpose.  It's unclear whether that's  
intentional or a bug in llvm-strip, but in any case it seems like  
changing to use --strip-unneeded in all cases should be a win.  
  
Note that this doesn't change our behavior when dealing with  
non-GNU strip.  
  
Per gripes from Ed Maste and Palle Girgensohn.  Back-patch,  
in case anyone wants to use llvm-strip with stable branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M config/programs.m4
M configure
M src/makefiles/meson.build

Fix autovacuum cost debug logging

commit   : a9781ae11ba2fdb44a3a72c9a7ebb727140b25c5    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Apr 2023 15:45:44 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 20 Apr 2023 15:45:44 +0200    

Click here for diff

Commit 7d71d3dd0 introduced finer grained updates of autovacuum option  
changes by increasing the frequency of reading the configuration file.  
The debug logging of cost parameter was however changed such that some  
initial values weren't logged.  Fix by changing logging to use the old  
frequency of logging regardless of them changing.  
  
Also avoid taking a log for rendering the log message unless the set  
loglevel is such that the log entry will be emitted.  
  
Author: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoBS7o6Ljt_vfqPQPf67AhzKu3fR0iqk8B=vVYczMugKMQ@mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Doc: clarify NULLS NOT DISTINCT use in unique indexes

commit   : 0d0aeb04c1277edb0733cbf5bf4243c47a439015    
  
author   : David Rowley <[email protected]>    
date     : Thu, 20 Apr 2023 23:51:38 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 20 Apr 2023 23:51:38 +1200    

Click here for diff

indexes-unique.html mentioned nothing about the availability of NULLS NOT  
DISTINCT to modify the NULLs-are-not-equal behavior of unique indexes.  
Add this to the synopsis and clarify what it does regarding NULLs.  
  
Author: David Gilman, David Rowley  
Reviewed-by: Corey Huinker  
Discussion: https://postgr.es/m/CALBH9DDr3NLqzWop1z5uZE-M5G_GYUuAeHFHQeyzFbNd8W0d=Q@mail.gmail.com  
Backpatch-through: 15, where NULLS NOT DISTINCT was added  

M doc/src/sgml/indices.sgml

Restart the apply worker if the 'password_required' option is changed.

commit   : c1cc4e688b60090f194017c6e15e330a725fba3e    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 20 Apr 2023 08:56:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 20 Apr 2023 08:56:18 +0530    

Click here for diff

The apply worker is restarted if any subscription option that affects the  
remote connection was changed. In commit c3afe8cf5a, we added the option  
'password_required' which can affect the remote connection, so we should  
restart the worker if it was changed.  
  
Author: Amit Kapila  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/CAA4eK1+z9UDFEynXLsWeMMuUZc1iQkRwj2HNDtxUHTPo-u1F4A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

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

Remove obsolete defense against strxfrm() bugs.

commit   : 7d3d72b55edd1b7552a9a358991555994efab0e9    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 20 Apr 2023 13:15:23 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 20 Apr 2023 13:15:23 +1200    

Click here for diff

Old versions of Solaris and illumos had buffer overrun bugs in their  
strxfrm() implementations.  The bugs were fixed more than a decade ago  
and the relevant releases are long out of vendor support.  It's time to  
remove the defense added by commit be8b06c3.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ-ZPJwKHVLbqye92-ZXeLoCHu5wJL6L6HhNP7FkJ=meA@mail.gmail.com  

M src/backend/main/main.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/include/utils/pg_locale.h

Fix list_copy_head() with empty Lists

commit   : e35ded29566f679e52888a8d34468bb51bc78bed    
  
author   : David Rowley <[email protected]>    
date     : Thu, 20 Apr 2023 10:34:46 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 20 Apr 2023 10:34:46 +1200    

Click here for diff

list_copy_head() given an empty List would crash from trying to  
dereference the List to obtain its length.  Since NIL is how we represent  
an empty List, we should just be returning another empty List in this  
case.  
  
list_copy_head() is new to v16, so let's fix it now before too many people  
start coding around the buggy NIL behavior.  
  
Reported-by: Miroslav Bendik  
Discussion: https://postgr.es/m/CAPoEpV02WhawuWnmnKet6BqU63bEu7oec0pJc=nKMtPsHMzTXQ@mail.gmail.com  

M src/backend/nodes/list.c

Use nbtdesc "level" field name consistently.

commit   : 2584639653eec13726a25d6ea8a4b42153185723    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 19 Apr 2023 12:15:15 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 19 Apr 2023 12:15:15 -0700    

Click here for diff

The "lev" name that appeared in NEWROOT nbtree record desc output was  
inconsistent with the symbol name from the underlying C struct.  It was  
also inconsistent with nbtdesc output for other nearby record types with  
similar level fields.  
  
Standardize on "level" to make everything consistent.  
  
Follow-up to commit 1c453cfd.  

M src/backend/access/rmgrdesc/nbtdesc.c

Fix wal_consistency_checking enhanced desc output.

commit   : 50547a3fae0ce62e74c1d2175c7949937f2c69fc    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 19 Apr 2023 10:42:39 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 19 Apr 2023 10:42:39 -0700    

Click here for diff

Recent enhancements to rmgr desc routines that made the output summarize  
certain block data (added by commits 7d8219a4 and 1c453cfd) dealt with  
records that lack relevant block data (and so have nothing to give a  
more detailed summary of) by testing !DecodedBkpBlock.has_image.  As a  
result, more detailed descriptions of block data were not output when  
wal_consistency_checking was enabled.  
  
This bug affected records with summarizable block data that also  
happened to have an FPI that the REDO routine isn't supposed to apply  
(FPIs used for consistency checking purposes only).  The presence of  
such an FPI was incorrectly taken to indicate the absence of block data.  
  
To fix, test DecodedBkpBlock.has_data, not !DecodedBkpBlock.has_image.  
This is the exact condition that we care about, not an inexact proxy.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzm5Sc9cBg1qWV_cEBfLNJCrW9FjS-SoHVt8FLA7Ldn8yg@mail.gmail.com  

M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/include/access/xlogreader.h

Add missed case for tab completion of GRANT/REVOKE MAINTAIN.

commit   : 9e1e9d6560ec60535289ac15729a08e2f7cf4165    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Apr 2023 10:49:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Apr 2023 10:49:53 -0400    

Click here for diff

We failed to offer "ON" after "GRANT MAINTAIN".  
Oversight in commit 60684dd83.  
  
Ken Kato  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Fix errormessage for missing system CA in OpenSSL 3.1

commit   : 0b5d1fb36adda612bd3d5d032463a6eeb0729237    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 19 Apr 2023 12:54:58 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 19 Apr 2023 12:54:58 +0200    

Click here for diff

The error message for a missing or invalid system CA when using  
sslrootcert=system differs based on the OpenSSL version used.  
  
In OpenSSL 1.0.1-3.0 it is reported as SSL Error, with varying  
degrees of helpfulness in the error message. With OpenSSL 3.1 it  
is reported as an SSL SYSCALL error with "Undefined error" as  
the error message. This fix pulls out the particular error in  
OpenSSL 3.1 as a certificate verify error in order to help the  
user better figure out what happened, and to keep the ssl test  
working. While there is no evidence that extracing the errors  
will clobber errno, this adds a guard against that regardless  
to also make the consistent with how we handle OpenSSL errors  
elsewhere. It also memorizes the output from OpenSSL 3.0 in  
the test in cases where the system CA isn't responding.  
  
Reported-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-secure-openssl.c
M src/test/ssl/t/001_ssltests.pl

Remove some tabs in SQL code in C string literals

commit   : 77dedeb2c45745f592b504e181fa9d391d9afff0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Apr 2023 09:29:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Apr 2023 09:29:43 +0200    

Click here for diff

This is not handled uniformly throughout the code, but at least nearby  
code can be consistent.  

M src/backend/commands/subscriptioncmds.c

Fix generation of distribution tarball

commit   : dea4343535f9122c66f71944ed593b84e338b174    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Apr 2023 13:59:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Apr 2023 13:59:52 +0900    

Click here for diff

This issue can be reproduced by running `make dist` from the root of the  
tree.  Error introduced in fcb21b3, where additions of links in  
installation.sgml require custom rules in standalone-profile.xsl to make  
sure that ./INSTALL is generated correctly for the distribution tarball,  
where links are replaced by equivalent terms from the profile file  
changed by this commit.  
  
Per buildfarm member guaibasaurus.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/standalone-profile.xsl

Fix various typos and incorrect/outdated name references

commit   : 3f58a4e2960a9509036b7d94beab64a747dc59dc    
  
author   : David Rowley <[email protected]>    
date     : Wed, 19 Apr 2023 13:50:33 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 19 Apr 2023 13:50:33 +1200    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/pg_walinspect/pg_walinspect.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup_copy.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/replication/logical/tablesync.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/time/snapmgr.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_dump/pg_dump.c
M src/include/utils/pgstat_internal.h
M src/include/utils/sortsupport.h
M src/interfaces/libpq/fe-trace.c
M src/pl/plpython/plpy_main.c
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/029_on_error.pl
M src/tools/mark_pgdllimport.pl

Build ICU support by default.

commit   : fcb21b3acdcb9a60313325618fd7080aa36f1626    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 18 Apr 2023 13:20:11 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 18 Apr 2023 13:20:11 -0700    

Click here for diff

Discussion: https://postgr.es/m/82c4c816-06f6-d3e3-ba02-fca4a5cef065%40enterprisedb.com  
Reviewed-by: Peter Eisentraut  

M .cirrus.yml
M configure
M configure.ac
M doc/src/sgml/installation.sgml

Update time zone data files to tzdata release 2023c.

commit   : 4ddee4d9de9ba90bfba5762f635fa21b6edfaf48    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2023 14:46:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2023 14:46:39 -0400    

Click here for diff

DST law changes in Egypt, Greenland, Morocco, and Palestine.  
  
When observing Moscow time, Europe/Kirov and Europe/Volgograd now  
use the abbreviations MSK/MSD instead of numeric abbreviations,  
for consistency with other timezones observing Moscow time.  
  
Also, America/Yellowknife is no longer distinct from America/Edmonton;  
this affects some pre-1948 timestamps in that area.  

M src/timezone/data/tzdata.zi
M src/timezone/known_abbrevs.txt

Remove useless argument from nbtree dedup function.

commit   : 06e0652750e347bc3bf1dbb88d6a2a5d9b6f8faa    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 18 Apr 2023 10:33:15 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 18 Apr 2023 10:33:15 -0700    

Click here for diff

_bt_dedup_pass()'s heapRel argument hasn't been needed or used since  
commit cf2acaf4dc made deleting any existing LP_DEAD index tuples the  
caller's responsibility.  

M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/include/access/nbtree.h

Fix Utils.pm's locale-munging so that Perl itself is also affected.

commit   : b124104e73c0e91714969e1ae24d661264c76b96    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2023 13:31:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Apr 2023 13:31:31 -0400    

Click here for diff

Utils.pm has a BEGIN block that editorializes on the locale-related  
environment variables, primarily in order to stabilize the behavior  
of child programs.  It turns out that if the calling test script  
has already done "use locale", this fails to affect the behavior  
of Perl itself, causing locale behavior to be different between  
Perl and child programs.  That breaks commit cd82e5c79's attempt  
to deal with locale-specific behavior in psql.  
  
To fix, we just need to call setlocale() to redo the calculation  
of locale.  
  
Per report from Aleksander Alekseev.  No back-patch for now, since  
there are no locale-dependent TAP tests in prior branches, and  
I'm not yet convinced that this won't have side-effects of its own.  
  
Discussion: https://postgr.es/m/CAJ7c6TO9KpYYxoVVseWEQB5KtjWDkt8NfyAeKPcHoe2Jq+ykpw@mail.gmail.com  

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

Fix pg_basebackup with in-place tablespaces some more.

commit   : 363e8f9115469fe3d30a80b694cd60e9db3b2537    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 18 Apr 2023 11:23:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 18 Apr 2023 11:23:34 -0400    

Click here for diff

Commit c6f2f01611d4f2c412e92eb7893f76fa590818e8 purported to make  
this work, but problems remained. In a plain-format backup, the  
files from an in-place tablespace got included in the tar file for  
the main tablespace, which is wrong but it's not clear that it  
has any user-visible consequences. In a tar-format backup, the  
TABLESPACE_MAP option is used, and so we never iterated over  
pg_tblspc and thus never backed up the in-place tablespaces  
anywhere at all.  
  
To fix this, reverse the changes in that commit, so that when we scan  
pg_tblspc during a backup, we create tablespaceinfo objects even for  
in-place tablespaces. We set the field that would normally contain the  
absolute pathname to the relative path pg_tblspc/${TSOID}, and that's  
good enough to make basebackup.c happy without any further changes.  
  
However, pg_basebackup needs a couple of adjustments to make it work.  
First, it needs to understand that a relative path for a tablespace  
means it's an in-place tablespace.  Second, it needs to tolerate the  
situation where restoring the main tablespace tries to create  
pg_tblspc or a subdirectory and finds that it already exists, because  
we restore user-defined tablespaces before the main tablespace.  
  
Since in-place tablespaces are only intended for use in development  
and testing, no back-patch.  
  
Patch by me, reviewed by Thomas Munro and Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmobwvbEp+fLq2PykMYzizcvuNv0a7gPMJtxOTMOuuRLMHg@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/pg_basebackup.c
A src/bin/pg_basebackup/t/011_in_place_tablespace.pl

ecpg: Fix handling of strings in ORACLE compat code with SQLDA

commit   : f18029084784ec71a2e825cfcfd81b06d597ab93    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Apr 2023 11:20:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Apr 2023 11:20:41 +0900    

Click here for diff

When compiled with -C ORACLE, ecpg_get_data() had a one-off issue where  
it would incorrectly store the null terminator byte to str[-1] when  
varcharsize is 0, which is something that can happen when using SQLDA.  
This would eat 1 byte from the previous field stored, corrupting the  
results generated.  
  
All the callers of ecpg_get_data() estimate and allocate enough storage  
for the data received, and the fix of this commit relies on this  
assumption.  Note that this maps to the case where no padding or  
truncation is required.  
  
This issue has been introduced by 3b7ab43 with the Oracle compatibility  
option, so backpatch down to v11.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.stdout

Fix some typos and some incorrectly duplicated words

commit   : eef231e8161eb8031a928fe48134ef25ab81fe5e    
  
author   : David Rowley <[email protected]>    
date     : Tue, 18 Apr 2023 14:03:30 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 18 Apr 2023 14:03:30 +1200    

Click here for diff

Author: Justin Pryzby  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/user-manag.sgml
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/plancat.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/adt/xid8funcs.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pgbench/pgbench.c
M src/include/access/tableam.h
M src/include/backup/basebackup_target.h
M src/include/replication/output_plugin.h
M src/include/storage/s_lock.h
M src/test/isolation/specs/serializable-parallel-3.spec
M src/test/modules/unsafe_tests/expected/guc_privs.out
M src/test/modules/unsafe_tests/sql/guc_privs.sql
M src/tools/pg_bsd_indent/tests/elsecomment.0
M src/tools/pg_bsd_indent/tests/elsecomment.0.stdout

Fix various typos

commit   : b4dbf3e924b2556acbe103dc61ac71f9985ff24f    
  
author   : David Rowley <[email protected]>    
date     : Tue, 18 Apr 2023 13:23:23 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 18 Apr 2023 13:23:23 +1200    

Click here for diff

This fixes many spelling mistakes in comments, but a few references to  
invalid parameter names, function names and option names too in comments  
and also some in string constants  
  
Also, fix an #undef that was undefining the incorrect definition  
  
Author: Alexander Lakhin  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_heapam.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M meson.build
M src/backend/backup/basebackup.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/resowner/resowner.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/scripts/t/100_vacuumdb.pl
M src/include/access/rmgrdesc_utils.h
M src/include/port/pg_iovec.h
M src/include/regex/regcustom.h
M src/include/utils/memutils_memorychunk.h
M src/include/utils/tuplesort.h
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/port/dirmod.c
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm
M src/test/modules/ldap_password_func/meson.build
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/regress/pg_regress.c

Comment fix for 60684dd834.

commit   : e39d512f3e9b1e34ffba77c8fe120c2675f6873b    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 17 Apr 2023 13:39:32 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 17 Apr 2023 13:39:32 -0700    

Click here for diff

Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Update Solution.pm for HAVE_GSSAPI[_GSSAPI]_EXT_H, too.

commit   : 38358aab9a09d6304eb78e309a3bb969b68d249c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Apr 2023 16:00:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Apr 2023 16:00:39 -0400    

Click here for diff

Commit d48ac0070 was still a brick shy of a load.  
Per buildfarm (via Andrew Dunstan).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Solution.pm

Avoid trying to write an empty WAL record in log_newpage_range().

commit   : 3e383f9b68f13502789b234c2dc3274958bdbf78    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Apr 2023 14:22:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Apr 2023 14:22:06 -0400    

Click here for diff

If the last few pages in the specified range are empty (all zero),  
then log_newpage_range() could try to emit an empty WAL record  
containing no FPIs.  This at least upsets an Assert in  
ReserveXLogInsertLocation, and might perhaps have bad real-world  
consequences in non-assert builds.  
  
This has been broken since log_newpage_range() was introduced,  
but the case was hard if not impossible to hit before commit 3d6a98457  
decided it was okay to leave VM and FSM pages intentionally zero.  
Nonetheless, it seems prudent to back-patch.  log_newpage_range()  
was added in v12 but later back-patched, so this affects all  
supported branches.  
  
Matthias van de Meent, per report from Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix incorrect comment about nbtree WAL record.

commit   : cd7cdc550c2a00027d6ec1810d064ad636250b1f    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 17 Apr 2023 09:58:18 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 17 Apr 2023 09:58:18 -0700    

Click here for diff

The nbtree VACUUM WAL record stores its page offset number payload in  
blk 0 (just like the closely related nbtree DELETE WAL record).  Commit  
ebd551f5 fixed a similar issue with the DELETE WAL record, but missed  
this one.  

M src/include/access/nbtxlog.h

Further cleanup of autoconf output files for GSSAPI changes.

commit   : d48ac0070cff197125088959e5644ed051322f5e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Apr 2023 11:21:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Apr 2023 11:21:50 -0400    

Click here for diff

Running autoheader was missed in f7431bca8.  This is cosmetic since  
we aren't using these HAVE_ symbols, but let's get everything in  
sync while we're looking at this.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/pg_config.h.in

Update configure for ab969a376

commit   : ca07a6e7bd2cb1d6ea38a036be8d60e196935428    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 17 Apr 2023 10:13:08 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 17 Apr 2023 10:13:08 -0400    

Click here for diff

Commit ab969a376 updated configure.ac but neglected to update the actual  
configure script.  Fix that.  
  
Pointed out by Tom Lane  

M configure

doc: Add additional SQL features codes from SQL:2023

commit   : 1c77de98017022e45a0b12ddb71e202d55551f68    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2023 16:04:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2023 16:04:54 +0200    

Click here for diff

These were mysteriously omitted in c9f57541d9.  

M src/backend/catalog/sql_features.txt

Update Kerberos/GSSAPI configure/meson check

commit   : 1c52f9c042fb939ed55ff572daee71036720db57    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 17 Apr 2023 09:51:04 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 17 Apr 2023 09:51:04 -0400    

Click here for diff

Instead of checking for the much older gss_init_sec_context, check for  
gss_store_cred_into which was added in MIT Kerberos 1.11 (circa 2012).  
  
Discussion: https://postgr.es/m/2313469.1681695223%40sss.pgh.pa.us  

M configure.ac
M meson.build

Put new command-line option into sensible order in help output

commit   : 2434d60a2ae977a460eda401fd9f99cf619f4743    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2023 11:09:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Apr 2023 11:09:17 +0200    

Click here for diff

We have two existing conventions for long options: either alphabetical  
among short options, or all long options after all the short options.  
But the convention apparently used here, next to a functionally  
related option, is not one of them.  

M doc/src/sgml/ref/pg_waldump.sgml
M src/bin/pg_waldump/pg_waldump.c

Doc: remove notes about the version vacuumdb options are valid from

commit   : fde9c068818246f6d79649eff355a2b95106991d    
  
author   : David Rowley <[email protected]>    
date     : Mon, 17 Apr 2023 09:28:34 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 17 Apr 2023 09:28:34 +1200    

Click here for diff

Here we remove the notes which mention which version the given vacuumdb  
option is available from.  There are now 11 of these notes and they're  
both quite untidy and take up far more space than they seem to be worth.  
On running a print preview of the compiled HTML, removing these notes  
saves about 1 A4 page (~20% less space).  
  
If people need to see which options are available on older versions, then  
consulting the documents for that version seems like a good idea.  In any  
case, when using newer vacuumdb versions on older servers, the user will  
receive an error if they try to use an unsupported option.  
  
Additionally, 3 of the notes are warning about the option only being  
available from PostgreSQL 9.6 and later.  That version's support ended 2.5  
years ago.  So, it's quite clear that the value of these notes diminishes  
over time.  
  
Discussion: https://postgr.es/m/CAApHDvrCQn6tupx2R67VL9RP1Qy4dDuWKRvt4jaB0vk2akQchw@mail.gmail.com  

M doc/src/sgml/ref/vacuumdb.sgml

Ensure result of an aggregate's finalfunc is made read-only.

commit   : 78d5952dd0e66afc4447eec07f770991fa406cce    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Apr 2023 14:16:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Apr 2023 14:16:40 -0400    

Click here for diff

The finalfunc might return a read-write expanded object.  If we  
de-duplicate multiple call sites for the aggregate, any function(s)  
receiving the aggregate result earlier could alter or destroy the  
value that reaches the ones called later.  This is a brown-paper-bag  
bug in commit 42b746d4c, because we actually considered the need  
for read-only-ness but failed to realize that it applied to the case  
with a finalfunc as well as the case without.  
  
Per report from Justin Pryzby.  New error in HEAD,  
no need for back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Avoid using non-ASCII commentary in daitch_mokotoff.c.

commit   : 1c54b93a8cf959a826dfabd6cae55dce255df2f5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Apr 2023 12:57:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Apr 2023 12:57:32 -0400    

Click here for diff

Commit d6b5dee42 failed to suppress that warning from MSVC,  
so let's just get rid of all non-ASCII glyphs in the comments.  
The comment for iso8859_1_to_ascii_upper[] is not essential,  
and the other cases can be handled by spelling out the  
Unicode character names.  
  
(I'm now really in the dark as to why MSVC doesn't complain  
about predicate.c's comment.  But whatever.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/fuzzystrmatch/daitch_mokotoff.c

Doc: add note about --buffer-usage-limit being v16 onwards

commit   : e9f451accbde17d106ac6a92c8877992d4410629    
  
author   : David Rowley <[email protected]>    
date     : Sun, 16 Apr 2023 21:47:01 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 16 Apr 2023 21:47:01 +1200    

Click here for diff

Other vacuumdb options seem to have notes about which version they're  
available from, so let's follow this trend for the newly added  
--buffer-usage-limit option.  

M doc/src/sgml/ref/vacuumdb.sgml

Improve VACUUM/ANALYZE BUFFER_USAGE_LIMIT docs

commit   : c0235013c13b0adc9e7f1998ff5700e26ecdbd1f    
  
author   : David Rowley <[email protected]>    
date     : Sun, 16 Apr 2023 12:05:34 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 16 Apr 2023 12:05:34 +1200    

Click here for diff

This addresses various deficiencies in the documentation for VACUUM and  
ANALYZE's BUFFER_USEAGE_LIMIT docs.  
  
Here we declare "size" in the syntax synopsis for VACUUM and ANALYZE's  
BUFFER_USAGE_LIMIT option and then define exactly what values can be  
specified for it in the section for that below.  
  
Also, fix the incorrect ordering of vacuumdb options both in the documents  
and in vacuumdb's --help output.  These should be in alphabetical order.  
  
In passing also add the minimum/maximum range for the BUFFER_USAGE_LIMIT  
option.  These will also serve as example values that can be modified and  
used.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/vacuumdb.c

Fix assignment to array of domain over composite, redux.

commit   : 064eb89e83ea0f59426c92906329f1e6c423dfa4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2023 12:01:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2023 12:01:39 -0400    

Click here for diff

Commit 3e310d837 taught isAssignmentIndirectionExpr() to look through  
CoerceToDomain nodes.  That's not sufficient, because since commit  
04fe805a1 it's been possible for the planner to simplify  
CoerceToDomain to RelabelType when the domain has no constraints  
to enforce.  So we need to look through RelabelType too.  
  
Per bug #17897 from Alexander Lakhin.  Although 3e310d837 was  
back-patched to v11, it seems sufficient to apply this change  
to v12 and later, since 04fe805a1 came in in v12.  
  
Dmitry Dolgov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Remove some non-ASCII symbols from a comment.

commit   : d6b5dee42de71f547090f0cd2968112c50c24203    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2023 11:20:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Apr 2023 11:20:46 -0400    

Click here for diff

Buildfarm member hamerkop is unhappy that daitch_mokotoff.c "contains  
a character that cannot be represented in the current code page  
(932). Save the file in Unicode format to prevent data loss".  There  
are a lot of non-ASCII characters in comments, but I do not see any  
outside a comment, so this is just cosmetic.  Nonetheless the warning  
is fairly scary and people might waste time trying to understand the  
cause, so we ought to silence it.  
  
We have only one other occurrence of a non-ASCII character in .c or .h  
files in the tree: predicate.c mentions "Uwe Röhm".  It's far from  
clear why hamerkop isn't complaining about that too; but it isn't,  
so maybe there is some special provision for accented Roman letters.  
We can remove the non-letter symbols from the comment for  
iso8859_1_to_ascii_upper without any real loss of usefulness,  
so let's try that first to see if it silences the warning.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/fuzzystrmatch/daitch_mokotoff.c

Adjust Valgrind macro usage to protect chunk headers

commit   : 414d66220adb9189951fb4d410470f9f36f9cbd1    
  
author   : David Rowley <[email protected]>    
date     : Sat, 15 Apr 2023 11:59:52 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 15 Apr 2023 11:59:52 +1200    

Click here for diff

Prior to this commit we only ever protected MemoryChunk's requested_size  
field with Valgrind NOACCESS.  This means that if the hdrmask field is  
ever accessed accidentally then we're not going to get any warnings from  
Valgrind about it.  Valgrind would have warned us about the problem fixed  
in 92957ed98 had we already been doing this.  
  
Per suggestion from Tom Lane  
  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAApHDvr=FZNGbj252Z6M9BSFKoq6BMxgkQ2yEAGUYoo7RquqZg@mail.gmail.com  

M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c

Support RBM_ZERO_AND_CLEANUP_LOCK in ExtendBufferedRelTo(), add tests

commit   : 43a33ef54e503b61f269d088f2623ba3b9484ad7    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Apr 2023 11:30:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Apr 2023 11:30:20 -0700    

Click here for diff

For some reason I had not implemented RBM_ZERO_AND_CLEANUP_LOCK support in  
ExtendBufferedRelTo(), likely thinking it not being reachable. But it is  
reachable, e.g. when replaying a WAL record for a page in a relation that  
subsequently is truncated (likely only reachable when doing crash recovery or  
PITR, not during ongoing streaming replication).  
  
As now all of the RBM_* modes are supported, remove assertions checking mode.  
  
As we had no test coverage for this scenario, add a new TAP test. There's  
plenty more that ought to be tested in this area...  
  
Reported-by: Tom Lane <[email protected]>  
Reported-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/392271.1681238924%40sss.pgh.pa.us  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/buffer/bufmgr.c
M src/test/recovery/meson.build
A src/test/recovery/t/036_truncated_dropped.pl

NULL is not an ideal way to spell bool "false".

commit   : e4d905f772f7803d399b6e173ca9aa7ba8a35e5a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2023 13:31:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Apr 2023 13:31:51 -0400    

Click here for diff

Thinko in commit 6633cfb21, detected by buildfarm member hamerkop.  

M src/backend/libpq/be-secure-gssapi.c

doc: PQinitOpenSSL and PQinitSSL are obsolete in OpenSSL 1.1.0+

commit   : 928e05ddfd4031c67e101c5e74dbb5c8ec4f9e23    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 14 Apr 2023 10:15:50 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 14 Apr 2023 10:15:50 +0200    

Click here for diff

Starting with OpenSSL 1.1.0 there is no need to call PQinitOpenSSL  
or PQinitSSL to avoid duplicate initialization of OpenSSL.  Add a  
note to the documentation to explain this.  
  
Backpatch to all supported versions as older OpenSSL versions are  
equally likely to be used for all branches.  
  
Reported-by: Sebastien Flaesch <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/DBAP191MB12895BFFEC4B5FE0460D0F2FB0459@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM  
Backpatch-through: 11, all supported versions  

M doc/src/sgml/libpq.sgml

Fix whitespace

commit   : 12829058c424cba540ac8de33d129d02f8bd3449    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2023 10:04:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2023 10:04:57 +0200    

Click here for diff

M src/test/modules/ldap_password_func/Makefile

Add missing source files to nls.mk

commit   : 99322d6eee6445665c1fb131ec6130924b7673b6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2023 09:56:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Apr 2023 09:56:04 +0200    

Click here for diff

M src/bin/pg_dump/nls.mk
M src/bin/pg_rewind/nls.mk

Fix incorrect partition pruning logic for boolean partitioned tables

commit   : e0693faf797f997f45bee8e572e8b4288cc7eaeb    
  
author   : David Rowley <[email protected]>    
date     : Fri, 14 Apr 2023 16:20:27 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 14 Apr 2023 16:20:27 +1200    

Click here for diff

The partition pruning logic assumed that "b IS NOT true" was exactly the  
same as "b IS FALSE".  This is not the case when considering NULL values.  
Fix this so we correctly include any partition which could hold NULL  
values for the NOT case.  
  
Additionally, this fixes a bug in the partition pruning code which handles  
partitioned tables partitioned like ((NOT boolcol)).  This is a seemingly  
unlikely schema design, and it was untested and also broken.  
  
Here we add tests for the ((NOT boolcol)) case and insert some actual data  
into those tables and verify we do get the correct rows back when running  
queries.  I've also adjusted the existing boolpart tests to include some  
data and verify we get the correct results too.  
  
Both the bugs being fixed here could lead to incorrect query results with  
fewer rows being returned than expected.  No additional rows could have  
been returned accidentally.  
  
In passing, remove needless ternary expression.  It's more simple just to  
pass !is_not_clause to makeBoolConst().  It makes sense to do this so the  
code is consistent with the bug fix in the "else if" condition just below.  
  
David Kimura did submit a patch to fix the first of the issues here, but  
that's not what's being committed here.  
  
Reported-by: David Kimura  
Reviewed-by: Richard Guo, David Kimura  
Discussion: https://postgr.es/m/CAHnPFjQ5qxs6J_p+g8=ww7GQvfn71_JE+Tygj0S7RdRci1uwPw@mail.gmail.com  
Backpatch-through: 11, all supported versions  

M src/backend/partitioning/partprune.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

doc: Fix some grammar for logical decoding description and functions

commit   : c7dc56bd6b36b4d6b3c6cc1bb4735f7777272ca3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Apr 2023 13:08:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Apr 2023 13:08:02 +0900    

Click here for diff

This documentation is has been added for the support of logical decoding  
on standbys.  Some markups were missing, hence add some where required.  
  
Author: Thom Brown  
Reviewed-by: Justin Pryzby, Daniel Gustafsson  
Discussion: https://postgr.es/m/CAA-aLv7xCZ0nBJa-NWe0rxBB28TjFjS2JtjiZMoQ+0wsugG+hQ@mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml

Fix PHJ match bit initialization.

commit   : 558c9d75fe3b38508296840e606737c664fc3b70    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 14 Apr 2023 10:52:58 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 14 Apr 2023 10:52:58 +1200    

Click here for diff

Hash join tuples reuse the HOT status bit to indicate match status  
during hash join execution. Correct reuse requires clearing the bit in  
all tuples. Serial hash join and parallel multi-batch hash join do so  
upon inserting the tuple into the hashtable. Single batch parallel hash  
join and batch 0 of unexpected multi-batch hash joins forgot to do this.  
  
It hadn't come up before because hashtable tuple match bits are only  
used for right and full outer joins and parallel ROJ and FOJ were  
unsupported. 11c2d6fdf5 introduced support for parallel ROJ/FOJ but  
neglected to ensure the match bits were reset.  
  
Author: Melanie Plageman <[email protected]>  
Reported-by: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/flat/CAMbWs48Nde1Mv%3DBJv6_vXmRKHMuHZm2Q_g4F6Z3_pn%2B3EV6BGQ%40mail.gmail.com  

M src/backend/executor/nodeHash.c
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

Remove code in charge of freeing regexps generation by Lab.c

commit   : a28269708844246fb1ec00a536b391cac0a64972    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Apr 2023 07:27:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Apr 2023 07:27:44 +0900    

Click here for diff

bea3d7e has redesigned the regexp engine so as all the allocations go  
through palloc() with a dedicated memory context.  hba.c had to cope  
with the past memory management logic by going through all the HBA and  
ident lines generated, then directly free all the regexps found in  
AuthTokens to ensure that no leaks would happen.  Such leaks could  
happen for example in the postmaster after a SIGHUP, in the event of  
an HBA and/or ident reload failure where all the new content parsed must  
be discarded, including all the regexps that may have been compiled.  
  
Now that regexps are palloc()'d in their own memory context,  
MemoryContextDelete() is enough to ensure that all the compiled regexps  
are properly gone.  Simplifying this logic in hba.c has the effect to  
only remove code.  Most of it is new in v16, except the part for regexps  
compiled in ident entries for the system username, so doing this cleanup  
now rather than when v17 opens for business will reduce future diffs  
with the upcoming REL_16_STABLE.  
  
Some comments were incorrect since bea3d7e, now fixed to reflect the  
reality.  
  
Reviewed-by: Bertrand Drouvot, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c

Remove old GUC name mapping for "force_parallel_mode"

commit   : 0981846b9c3ab1dcc351798dcae6a2e35872a6c3    
  
author   : David Rowley <[email protected]>    
date     : Fri, 14 Apr 2023 10:19:45 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 14 Apr 2023 10:19:45 +1200    

Click here for diff

This GUC was renamed to debug_parallel_query in 5352ca22e.  That commit  
added an entry into map_old_guc_names[] to allow the old name still to  
work.  That was done to allow a transition time where the buildfarm  
configs could be swapped over to use debug_parallel_query instead.  That  
work is now complete.  
  
Here we remove the old name with the intention of breaking any user code  
which is using force_parallel_query.  As mentioned in the commit message  
for 5352ca22e, it appeared many users were misled into thinking that  
setting this GUC was doing something useful for them to make queries run  
more quickly.  
  
Discussion: https://postgr.es/m/CAApHDvoR7EOz7Tvyzrd18FO-Dw2Cp4Uyq25TEWguK+XyCJtzOw@mail.gmail.com  

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

Update Unicode data to CLDR 43

commit   : 83c470665822befb3bda92320defe766936b60df    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2023 22:10:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2023 22:10:08 +0200    

Click here for diff

No actual changes result.  

M src/Makefile.global.in

Harmonize some more function parameter names.

commit   : d6f0f95a6bb7fa43731c6db83226a3c574041659    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 13 Apr 2023 10:15:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 13 Apr 2023 10:15:20 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in a few places.  These  
inconsistencies were all introduced relatively recently, after the code  
base had parameter name mismatches fixed in bulk (see commits starting  
with commits 4274dc22 and 035ce1fe).  
  
pg_bsd_indent still has a couple of similar inconsistencies, which I  
(pgeoghegan) have left untouched for now.  
  
Like all earlier commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  

M src/backend/parser/parse_expr.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/pg_locale.c
M src/bin/pg_dump/pg_dump.c
M src/include/pgstat.h
M src/include/replication/worker_internal.h
M src/include/storage/buf_internals.h
M src/pl/plpython/plpy_resultobject.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/worker_spi/worker_spi.c

Explicitly require MIT Kerberos for GSSAPI

commit   : f7431bca8b0138bdbce7025871560d39119565a0    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 13 Apr 2023 08:55:13 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 13 Apr 2023 08:55:13 -0400    

Click here for diff

WHen building with GSSAPI support, explicitly require MIT Kerberos and  
check for gssapi_ext.h in configure.ac and meson.build.  Also add  
documentation explicitly stating that we now require MIT Kerberos when  
building with GSSAPI support.  
  
Reveiwed by: Johnathan Katz  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/installation.sgml
M meson.build
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-gssapi.c

De-Revert "Add support for Kerberos credential delegation"

commit   : 6633cfb21691840c33816a6dacaca0b504efb895    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 13 Apr 2023 08:55:07 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 13 Apr 2023 08:55:07 -0400    

Click here for diff

This reverts commit 3d03b24c3 (Revert Add support for Kerberos  
credential delegation) which was committed on the grounds of concern  
about portability, but on further review and discussion, it's clear that  
we are better off explicitly requiring MIT Kerberos as that appears to  
be the only GSSAPI library currently that's under proper maintenance  
and ongoing development.  The API used for storing credentials was added  
to MIT Kerberos over a decade ago while for the other libraries which  
appear to be mainly based on Heimdal, which exists explicitly to be a  
re-implementation of MIT Kerberos, the API never made it to a released  
version (even though it was added to the Heimdal git repo over 5 years  
ago..).  
  
This post-feature-freeze change was approved by the RMT.  
  
Discussion: https://postgr.es/m/ZDDO6jaESKaBgej0%40tamriel.snowman.net  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/postgres_fdw/connection.c
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/config.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/catalog/system_views.sql
M src/backend/foreign/foreign.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.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/backend/utils/misc/postgresql.conf.sample
M src/include/catalog/pg_proc.dat
M src/include/libpq/auth.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/interfaces/libpq/exports.txt
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-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/regress/expected/rules.out

doc: Make HTML ids discoverable

commit   : e2922702a3027945f139f9b0c7b4686423304e21    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2023 10:15:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2023 10:15:20 +0200    

Click here for diff

In the HTML output, this decorates section headers and variable list  
terms with a marker ("#") that is a link to the same section/term.  
That way, links inside a page can be discovered for easier sharing.  
The marker only appears when hovering.  
  
This now requires that all elements that are candidates for such a  
link have an id attribute.  Otherwise, an error will be generated.  
All previously missing ids have been added prior to this patch.  
  
Author: Brar Piening <[email protected]>  
Reviewed-by: Karl O. Pinc <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAB8KJ=jpuQU9QJe4+RgWENrK5g9jhoysMw2nvTN_esoOU0=a_w@mail.gmail.com  

M doc/src/sgml/stylesheet-html-common.xsl
M doc/src/sgml/stylesheet.css

Add missing XML ID attribute

commit   : a34901dd03edb473ddbd81ee5c7332575f6d8881    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2023 09:48:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Apr 2023 09:48:38 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/pgbuffercache.sgml

Skip the 004_io_direct.pl test if a pre-flight check fails.

commit   : 6ca8df2d61473327b0e90b9becfe109299f47b8a    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 13 Apr 2023 13:47:39 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 13 Apr 2023 13:47:39 +1200    

Click here for diff

The test previously had a list of OSes that direct I/O was expected to  
work on.  That worked well enough for the systems in our build farm, but  
didn't survive contact with the Debian build bots running on tmpfs via  
overlayfs.  tmpfs does not support O_DIRECT, but we don't want to  
exclude Linux generally.  
  
The new approach is to try to create an empty file with O_DIRECT from  
Perl first.  If that fails, we'll skip the test and report what the  
error was.  
  
Reported-by: Christoph Berg <[email protected]>  
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/ZDYd4A78cT2ULxZZ%40msg.df7cb.de  

M src/test/modules/test_misc/t/004_io_direct.pl

Remove overzealous assertion from PHJ.

commit   : b37d051b0e59e4324e346655a27509507813db79    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 13 Apr 2023 09:19:54 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 13 Apr 2023 09:19:54 +1200    

Click here for diff

We can't assert that we're the only process attached to a barrier after  
BarrierArriveAndDetachExceptLast().  Although that'll be true almost  
always, a late-starting parallel worker can attach very briefly (that  
is, immediately detach after checking the phase) right at that moment.  
BarrierArriveAndDetachExceptLast() already contains an assertion like  
that, but it holds a spinlock preventing the race.  This thinko caused a  
one-off failure on build farm animal chimaera.  
  
Diagnosed-by: Melanie Plageman <[email protected]>  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeHash.c

Revert "Adjust contrib/sepgsql regression test expected outputs."

commit   : 21e6bf4ddd045bc718c99ae551f25957ae91cb4d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Apr 2023 20:22:17 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Apr 2023 20:22:17 +0200    

Click here for diff

This reverts commit 76c111a7f166; should have been included in  
9ce04b50e120.  
  
Noted by Joe Conway  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out

Improve error messages introduced in be87200efd9 and 0fdab27ad68

commit   : 5ec69b71f17c353b27754deb8d94bb1f5cf7a029    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 12 Apr 2023 11:00:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 12 Apr 2023 11:00:37 -0700    

Click here for diff

Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/test/recovery/t/035_standby_logical_decoding.pl

Revert "Catalog NOT NULL constraints" and fallout

commit   : 9ce04b50e120275afbc03ca0b80839dde3da8308    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Apr 2023 19:29:21 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Apr 2023 19:29:21 +0200    

Click here for diff

This reverts commit e056c557aef4 and minor later fixes thereof.  
  
There's a few problems in this new feature -- most notably regarding  
pg_upgrade behavior, but others as well.  This new feature is not in any  
way critical on its own, so instead of scrambling to fix it we revert it  
and try again in early 17 with these issues in mind.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_constraint.h
M src/include/commands/tablecmds.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/cluster.out
M src/test/regress/expected/constraints.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/indexing.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/replica_identity.sql

basebackup_to_shell: Check for a NULL return from OpenPipeStream.

commit   : 8e82db97b0a474008d8212a63f34e449a8c50bcd    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 12 Apr 2023 11:37:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 12 Apr 2023 11:37:13 -0400    

Click here for diff

Per complaint from Peter Eisentraut.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/basebackup_to_shell/basebackup_to_shell.c

Document BaseBackupSync and BaseBackupWrite wait events.

commit   : 4b1ad19a4e221897d01fbfe68b89412c8c5a9cbb    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 12 Apr 2023 11:18:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 12 Apr 2023 11:18:40 -0400    

Click here for diff

Commit 3500ccc39b0dadd1068a03938e4b8ff562587ccc should have done  
this, but I overlooked it.  
  
Per complaint from Thomas Munro.  
  
Discussion: http://postgr.es/m/CA+hUKGJixAHc860Ej9Qzd_z96Z6aoajAgJ18bYfV3Lfn6t9=+Q@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Fix parallel-safety marking when moving initplans to another node.

commit   : 88ceac5d77f4ffb31f1e2d3df23d37e569ad5ff4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Apr 2023 10:46:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Apr 2023 10:46:30 -0400    

Click here for diff

Our policy since commit ab77a5a45 has been that a plan node having  
any initplans is automatically not parallel-safe.  (This could be  
relaxed, but not today.)  clean_up_removed_plan_level neglected  
this, and could attach initplans to a parallel-safe child plan  
node without clearing the plan's parallel-safe flag.  That could  
lead to "subplan was not initialized" errors at runtime, in case  
an initplan referenced another one and only the referencing one  
got transmitted to parallel workers.  
  
The fix in clean_up_removed_plan_level is trivial enough.  
materialize_finished_plan also moves initplans from one node  
to another, but it's okay because it already copies the source  
node's parallel_safe flag.  The other place that does this kind  
of thing is standard_planner's hack to inject a top-level Gather  
when debug_parallel_query is active.  But that's actually dead  
code given that we're correctly enforcing the "initplans aren't  
parallel safe" rule, so just replace it with an Assert that  
there are no initplans.  
  
Also improve some related comments.  
  
Normally we'd add a regression test case for this sort of bug.  
The mistake itself is already reached by existing tests, but there  
is accidentally no visible problem.  The only known test case that  
creates an actual failure seems too indirect and fragile to justify  
keeping it as a regression test (not least because it fails to fail  
in v11, though the bug is clearly present there too).  
  
Per report from Justin Pryzby.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c

doc: Reword unexplained abbreviation

commit   : 91199dd281f11b8fdd214210cb608012a9aaef88    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 12 Apr 2023 16:16:12 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 12 Apr 2023 16:16:12 +0200    

Click here for diff

The previous wording used MVF to indicate the Most Common Values'  
Frequencies, but the abbreviation was never explained or defined.  
Reword to mcv_freqs to make the use clearer.  
  
Also add MCF and MCV as acronyms as they were using <acronym>  
markup but were missing from the acronyms page.  
  
Reported-by: Eric Mutta <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/planstats.sgml

Fix incorrect format placeholders

commit   : 5f38a2034e4f18ad3a57421f070ae01c32137ef1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2023 10:05:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2023 10:05:50 +0200    

Click here for diff

M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/transam/xloginsert.c
M src/backend/utils/resowner/resowner.c

Update config.guess and config.sub

commit   : 906116ace1b8bc07161ee960015eb2b2d2a40118    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2023 09:16:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Apr 2023 09:16:19 +0200    

Click here for diff

M config/config.guess
M config/config.sub

doc: Fix some typos and grammar

commit   : 644b848f50ef75430c0134654f86e8234691e390    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Apr 2023 13:03:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Apr 2023 13:03:09 +0900    

Click here for diff

This is a first batch of the fixes, for the most obvious fixes.  A  
little bit more is under discussion.  
  
Author: Thom Brown, Justin Pryzby  
Discussion: https://postgr.es/m/CAA-aLv7xCZ0nBJa-NWe0rxBB28TjFjS2JtjiZMoQ+0wsugG+hQ@mail.gmail.com  

M doc/src/sgml/archive-modules.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reindex.sgml

Fix detection of unseekable files for fseek() and ftello() with MSVC

commit   : a923e21631a29dc8b8781d7d02b5003d0df64ca3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Apr 2023 09:09:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Apr 2023 09:09:38 +0900    

Click here for diff

Calling fseek() or ftello() on a handle to a non-seeking device such as  
a pipe or a communications device is not supported.  Unfortunately,  
MSVC's flavor of these routines, _fseeki64() and _ftelli64(), do not  
return an error when given a pipe as handle.  Some of the logic of  
pg_dump and restore relies on these routines to check if a handle is  
seekable, causing failures when passing the contents of pg_dump to  
pg_restore through a pipe, for example.  
  
This commit introduces wrappers for fseeko() and ftello() on MSVC so as  
any callers are able to properly detect the cases of non-seekable  
handles.  This relies mainly on GetFileType(), sharing a bit of code  
with the MSVC port for fstat().  The code in charge of getting a file  
type is refactored into a new file called win32common.c, shared by  
win32stat.c and the new win32fseek.c.  It includes the MSVC ports for  
fseeko() and ftello().  
  
Like 765f5df, this is backpatched down to 14, where the fstat()  
implementation for MSVC is able to understand about files larger than  
4GB in size.  Using a TAP test for that is proving to be tricky as  
IPC::Run handles the pipes by itself, still I have been able to check  
the fix manually.  
  
Reported-by: Daniel Watzinger  
Author: Juan José Santamaría Flecha, Michael Paquier  
Discussion: https://postgr.es/m/CAC+AXB26a4EmxM2suXxPpJaGrqAdxracd7hskLg-zxtPB50h7A@mail.gmail.com  
Backpatch-through: 14  

M configure
M configure.ac
M src/include/port/win32_port.h
M src/port/meson.build
A src/port/win32common.c
A src/port/win32fseek.c
M src/port/win32stat.c
M src/tools/msvc/Mkvcbuild.pm

Refine the guidelines for rmgrdesc authors.

commit   : c03c2eae0acbb82db8e626f71f367ef4b043d27d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 11 Apr 2023 15:26:24 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 11 Apr 2023 15:26:24 -0700    

Click here for diff

Clarify the goals of the recently added guidelines for rmgrdesc authors:  
to avoid gratuitous inconsistencies across resource managers, and to  
make it reasonably easy to write a reusable custom parser.  
  
Beyond that, the guidelines leave rmgrdesc authors with a significant  
amount of leeway.  This even includes the leeway to invent custom  
conventions (in cases where it's warranted).  
  
Follow-up to commit 7d8219a4.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkbYuvwYKm-Y-72QEh6SPMQcAo9uONv+mR3bMGcu9E_Cg@mail.gmail.com  

M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/include/access/rmgrdesc_utils.h

Fix Heap rmgr's desc output for infobits arrays.

commit   : 96149a180d56162b0288e8c8ec5ee2c1f076e88b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 11 Apr 2023 15:25:02 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 11 Apr 2023 15:25:02 -0700    

Click here for diff

Make heap desc routines that output status bit as arrays of constants  
avoid outputting array literals that contain superfluous punctuation  
characters that complicate parsing the output.  Also make sure that no  
heap desc routine repeats the same key name (at the same nesting level),  
for the same reason.  Arguably, these were both oversights in commit  
7d8219a4.  
  
In passing, make the desc output code (which covers Heap's DELETE,  
UPDATE, HOT_UPDATE, LOCK, and LOCK_UPDATED record types) consistent in  
terms of the output order of each field.  This order also matches WAL  
record struct order.  Heap's DELETE desc output now shows the record's  
xmax field for the first time (just like UPDATE/HOT_UPDATE records).  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=pNYtxiJ2Jx5Lj=fKo1OEZ4GE0p_kct+ugAUTqBwU46g@mail.gmail.com  

M src/backend/access/rmgrdesc/heapdesc.c

Fix xl_heap_lock WAL record field's data type.

commit   : e944063294fb9e85190f03948f5ce20331231e2f    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 11 Apr 2023 14:07:54 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 11 Apr 2023 14:07:54 -0700    

Click here for diff

Make xl_heap_lock's infobits_set field of type uint8, not int8.  Using  
int8 isn't appropriate given that the field just holds status bits.  
This fixes an oversight in commit 0ac5ad5134.  
  
In passing rename the nearby TransactionId field to "xmax" to make  
things consistency with related records, such as xl_heap_lock_updated.  
  
Deliberately avoid a bump in XLOG_PAGE_MAGIC.  No backpatch, either.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkCd3kOS8b7Rfxw7Mh1_6jvX=Nzo-CWR1VBTiOtVZkWHA@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/include/access/heapam_xlog.h

035_standby_logical_decoding: Add missing waits for replication

commit   : 57411c82ce8634888be807502ee6c50f219e0460    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 11 Apr 2023 11:17:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 11 Apr 2023 11:17:36 -0700    

Click here for diff

At least one slow buildfarm system (hoverfly) showed that the database  
creation was not replicated before we try to create logical replication slots  
on the standby, in that database.  
  
Reported-by: Noah Misch <[email protected]>  
Author: "Drouvot, Bertrand" <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/035_standby_logical_decoding.pl

Document new pg_subscription columns.

commit   : bc25d6c54a000ab67c183cb88eb4f12b1220e6f9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2023 11:00:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 11 Apr 2023 11:00:36 -0400    

Click here for diff

Commit 482675987bcdffb390ae735cfd5f34b485ae97c6 and commit  
c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6 forgot to take care  
of this.  
  
Noriyoshi Shinoda  
  
Discussion: http://postgr.es/m/DM4PR84MB17345D8760165F14A199B81CEE9A9@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/catalogs.sgml

Fix uninitialized variable in transformTableLikeClause()

commit   : 4c8a1b4769372037b28516e5c9acb39bb82fa92d    
  
author   : David Rowley <[email protected]>    
date     : Tue, 11 Apr 2023 23:01:12 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 11 Apr 2023 23:01:12 +1200    

Click here for diff

process_notnull_constraints should be set to false until we discover a NOT  
NULL column.  
  
Discovered while running Valgrind.  
  
Discussion: https://postgr.es/m/CAApHDvoMyiZVi1KW5WVdqMRzWsWkD3F7n6QD+BbAO6WTeAWsUQ@mail.gmail.com  

M src/backend/parser/parse_utilcmd.c

Improve ereports for VACUUM's BUFFER_USAGE_LIMIT option

commit   : 68a2a437f46716efd54d177edf9dbcc9916c903b    
  
author   : David Rowley <[email protected]>    
date     : Tue, 11 Apr 2023 19:36:34 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 11 Apr 2023 19:36:34 +1200    

Click here for diff

There's no need to check if opt->arg is NULL since defGetString() already  
does that and raises an ERROR if it is.  Let's just remove that check.  
  
Also, combine the two remaining ERRORs into a single check.  It seems  
better to give an indication about what sort of values we're looking for  
rather than just to state that the value given isn't valid.  Make  
BUFFER_USAGE_LIMIT uppercase in this ERROR message too.  It's already  
upper case in one other error message, so make that consistent.  
  
Reported-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuum.c
M src/test/regress/expected/vacuum.out

Doc: use "an SQL" consistently rather than "a SQL"

commit   : d866f0374ca688937b905fbebfcc2c5f8dc88b54    
  
author   : David Rowley <[email protected]>    
date     : Tue, 11 Apr 2023 18:52:17 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 11 Apr 2023 18:52:17 +1200    

Click here for diff

Similarly to what was done in 04539e73f and 7bdd489d3, we standardized on  
SQL being pronounced "es-que-ell" rather than "sequel" in our  
documentation.  
  
This fixes the instances of "a SQL" that have crept in during the v16  
cycle.  
  
Discussion: https://postgr.es/m/CAApHDvpML27UqFXnrYO1MJddsKVMQoiZisPvsAGhKE_tsKXquw%40mail.gmail.com  

M doc/src/sgml/ecpg.sgml

Clarify nbtree posting list update desc issue.

commit   : 26e65ebdb295fc88988655dbbf30c9fd020e2e07    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 10 Apr 2023 17:55:23 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 10 Apr 2023 17:55:23 -0700    

Click here for diff

Per complaint from Melanie Plageman.  
  
Follow-up to commit 5d6728e5.  
  
Reported-By: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/20230411002315.oyaicmcqrq2hb3ek@liskov  

M src/backend/access/rmgrdesc/nbtdesc.c

Doc: add missed entries in BRIN extensibility tables.

commit   : 4380c2509d51febad34e1fac0cfaeb98aaa716c5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2023 15:49:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2023 15:49:48 -0400    

Click here for diff

The tables in "71.3. Extensibility" listing the support functions  
for bloom and minmax-multi opclasses should include the associated  
options function.  While this isn't quite as required as the rest,  
you need it for full functionality of the opclass.  
  
Back-patch to v14 where these functions were added.  

M doc/src/sgml/brin.sgml

Fix nbtree posting list update desc output.

commit   : 5d6728e588c37a4e458db9d55b308c8a3832a944    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 10 Apr 2023 11:15:41 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 10 Apr 2023 11:15:41 -0700    

Click here for diff

We cannot use the generic array_desc approach with per-tuple nbtree  
posting list update metadata because array_desc can only deal with fixed  
width elements (e.g., page offset numbers).  Using array_desc led to  
incorrect rmgr descriptions for updates from nbtree DELETE/VACUUM WAL  
records.  
  
To fix, add specialized code to describe the update metadata as array  
elements in desc output.  We now iterate over the update metadata using  
an approach that matches related REDO routines.  
  
Also stop showing the updates offset number array separately in nbtree  
DELETE/VACUUM desc output.  It's redundant information, since the same  
page offset numbers appear in the description of each individual update  
element.  Also make some small tweaks to the way that we format arrays  
in all desc routines (not just nbtree desc routines) to make arrays a  
little less verbose.  
  
Oversight in commit 1c453cfd, which enhanced the nbtree rmgr desc  
routines.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkbYuvwYKm-Y-72QEh6SPMQcAo9uONv+mR3bMGcu9E_Cg@mail.gmail.com  

M doc/src/sgml/pgwalinspect.sgml
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/include/access/rmgrdesc_utils.h

Doc: adjust examples of EXTRACT() output to match current reality.

commit   : fbbd7edca867ea8f8bd7540492e527fdb16d954b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2023 13:09:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2023 13:09:18 -0400    

Click here for diff

EXTRACT(EPOCH), EXTRACT(SECOND), and some related cases print more  
trailing zeroes than they used to.  This behavior change happened  
with commit a2da77cdb (Change return type of EXTRACT to numeric),  
and it was intentional according to the commit log:  
  
    - Return values when extracting fields with possibly fractional  
      values, such as second and epoch, now have the full scale that the  
      value has internally (so, for example, '1.000000' instead of just  
      '1').  
  
It's been like that for two releases now, so while I suggested  
changing this back, it's probably better to adjust the documentation  
examples.  
  
Per bug #17866 from Евгений Жужнев.  Back-patch to v14 where the  
change came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Doc: avoid using pg_get_publication_tables() in an example.

commit   : 26f36fe844880ff68dc28493bba9aced5aad0034    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2023 12:22:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Apr 2023 12:22:10 -0400    

Click here for diff

pg_get_publication_tables() is undocumented because it's only meant  
as infrastructure for the pg_publication_tables system view.  
That being the case, we should use the view not the bare function  
in this sample query.  
  
Shi Yu  
  
Discussion: https://postgr.es/m/OSZPR01MB63107E83D07FEDEEABD83A23FD949@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_subscription.sgml

Simplify version check for SKIP clause

commit   : 6ff2e8cdd410f70057cfa6259ad395c1119aeb32    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sat, 8 Apr 2023 23:32:11 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sat, 8 Apr 2023 23:32:11 +0200    

Click here for diff

Checking for the required versions of IO::Pty as well as IPC::Run  
can be achieved with a single eval call, and by using the VERSION  
function the comparison is guaranteed to follow the same rules as  
calling 'use' on the module with a version.  
  
Reported-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/authentication/t/001_password.pl

Use higher wal_level for 004_io_direct.pl.

commit   : 980e8879f54a7a00ca6a5bae2fe9486c87ef3e8e    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 9 Apr 2023 08:27:36 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 9 Apr 2023 08:27:36 +1200    

Click here for diff

The new direct I/O test deliberately uses a very small shared_buffers to  
force some disk transfers without making the data set large and slow,  
but ran into a problem with wal_level = minimal: log_newpage_range()  
pins many buffers, leading to a few intermittent "no unpinned buffers  
available" errors.  
  
We could presumably fix that by adjusting shared_buffers, but crake  
seems to be trying to tell us something interesting with these settings,  
so let's just avoid wal_level = minimal in this test for now.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20230408060408.n7xdwk3mxj5oykt6%40awork3.anarazel.de  

M src/test/modules/test_misc/t/004_io_direct.pl

Improve indentation of multiline initialization expressions.

commit   : 064750af4f4ebab9c0d47d502c7ff7e3c9533f9f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Apr 2023 11:48:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Apr 2023 11:48:36 -0400    

Click here for diff

If a variable has an initialization expression that wraps onto the  
next line(s), pg_bsd_indent will now indent the continuation lines  
one stop, instead of aligning them flush with the variable declaration.  
  
We've been holding off applying this until the last v16 CF finished,  
but now it's time.  
  
Thomas Munro and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pg_bsd_indent/args.c
M src/tools/pg_bsd_indent/io.c
M src/tools/pgindent/pgindent

Try to unbreak MSVC builds for pg_waldump

commit   : bbec50de16d2bf6e1a2878ff0f7e39dbd86ecff8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 8 Apr 2023 11:19:18 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 8 Apr 2023 11:19:18 -0400    

Click here for diff

remedy an omission in commit 7d8219a444  

M src/tools/msvc/Mkvcbuild.pm

Suppress bogus printout during new 035_standby_logical_decoding.pl test.

commit   : 07690aab46ed5530643942726b27a503995dd835    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Apr 2023 10:50:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Apr 2023 10:50:46 -0400    

Click here for diff

Our convention for some time has been that successful tests shouldn't  
print anything on stderr.  A stray "diag" call violated that, and  
for that matter messed up the normal TAP progress display.  

M src/test/recovery/t/035_standby_logical_decoding.pl

Skip \password TAP test on old IPC::Run versions

commit   : 2e57ffe12f6b5c1498f29cb7c0d9e17c797d9da6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sat, 8 Apr 2023 15:51:45 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sat, 8 Apr 2023 15:51:45 +0200    

Click here for diff

IPC::Run versions prior to 0.98 cause the interactive session to time out,  
so SKIP the test in case these versions are detected (they are within the  
base requirement for our TAP tests in general).  Error reported by the BF  
and investigation by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/authentication/t/001_password.pl

Try to unbreak MSVC builds for fuzzystrmatch

commit   : 0e9b271890c09ecb60b08e45d377031b2385ebeb    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 8 Apr 2023 08:26:19 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 8 Apr 2023 08:26:19 -0400    

Click here for diff

Commit a290378a37 neglrected to add a recipe for MSVC to build the  
daitch_motokoff.h file.  
  
Per buildfarm animal bowerbird.  

M src/tools/msvc/Solution.pm

Revert "Add support for Kerberos credential delegation"

commit   : 3d03b24c350ab060bb223623bdff38835bd7afd0    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 8 Apr 2023 07:21:35 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 8 Apr 2023 07:21:35 -0400    

Click here for diff

This reverts commit 3d4fa227bce4294ce1cc214b4a9d3b7caa3f0454.  
  
Per discussion and buildfarm, this depends on APIs that seem to not  
be available on at least one platform (NetBSD).  Should be certainly  
possible to rework to be optional on that platform if necessary but bit  
late for that at this point.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/postgres_fdw/connection.c
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/config.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/catalog/system_views.sql
M src/backend/foreign/foreign.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.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/backend/utils/misc/postgresql.conf.sample
M src/include/catalog/pg_proc.dat
M src/include/libpq/auth.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/interfaces/libpq/exports.txt
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-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/regress/expected/rules.out

Redesign interrupt/cancel API for regex engine.

commit   : db4f21e4a34b1d5a3f7123e28e77f575d1a971ea    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 21:57:46 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 21:57:46 +1200    

Click here for diff

Previously, a PostgreSQL-specific callback checked by the regex engine  
had a way to trigger a special error code REG_CANCEL if it detected that  
the next call to CHECK_FOR_INTERRUPTS() would certainly throw via  
ereport().  
  
A later proposed bugfix aims to move some complex logic out of signal  
handlers, so that it won't run until the next CHECK_FOR_INTERRUPTS(),  
which makes the above design impossible unless we split  
CHECK_FOR_INTERRUPTS() into two phases, one to run logic and another to  
ereport().  We may develop such a system in the future, but for the  
regex code it is no longer necessary.  
  
An earlier commit moved regex memory management over to our  
MemoryContext system.  Given that the purpose of the two-phase interrupt  
checking was to free memory before throwing, something we don't need to  
worry about anymore, it seems simpler to inject CHECK_FOR_INTERRUPTS()  
directly into cancelation points, and just let it throw.  
  
Since the plan is to keep PostgreSQL-specific concerns separate from the  
main regex engine code (with a view to bein able to stay in sync with  
other projects), do this with a new macro INTERRUPT(), customizable in  
regcustom.h and defaulting to nothing.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  

M src/backend/regex/regc_locale.c
M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c
M src/backend/regex/regexec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/varlena.c
M src/include/regex/regcustom.h
M src/include/regex/regerrs.h
M src/include/regex/regex.h
M src/include/regex/regguts.h
M src/test/modules/test_regex/test_regex.c

Update contrib/trgm_regexp's memory management.

commit   : 6db75edb2ecbc9f6912f90b671b01ab4ac3a01b0    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 21:55:28 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 21:55:28 +1200    

Click here for diff

While no code change was necessary for this code to keep working, we  
don't need to use PG_TRY()/PG_FINALLY() with explicit clean-up while  
working with regexes anymore.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  

M contrib/pg_trgm/trgm_regexp.c

Update tsearch regex memory management.

commit   : 4f51429dd7f194e36af32b557ecdce555b5ab51b    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 21:54:45 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 21:54:45 +1200    

Click here for diff

Now that our regex engine uses palloc(), it's not necessary to set up a  
special memory context callback to free compiled regexes.  The regex has  
no resources other than the memory that is already going to be freed in  
bulk.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  

M src/backend/tsearch/spell.c
M src/include/tsearch/dicts/spell.h

Use MemoryContext API for regex memory management.

commit   : bea3d7e3831fa6a1395eadbad7d97cebc7aa8aee    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 21:52:35 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 21:52:35 +1200    

Click here for diff

Previously, regex_t objects' memory was managed with malloc() and free()  
directly.  Switch to palloc()-based memory management instead.  
Advantages:  
  
 * memory used by cached regexes is now visible with MemoryContext  
   observability tools  
  
 * cleanup can be done automatically in certain failure modes  
   (something that later commits will take advantage of)  
  
 * cleanup can be done in bulk  
  
On the downside, there may be more fragmentation (wasted memory) due to  
per-regex MemoryContext objects.  This is a problem shared with other  
cached objects in PostgreSQL and can probably be improved with later  
tuning.  
  
Thanks to Noah Misch for suggesting this general approach, which  
unblocks later work on interrupts.  
  
Suggested-by: Noah Misch <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  

M src/backend/regex/regprefix.c
M src/backend/utils/adt/regexp.c
M src/include/regex/regcustom.h

TAP test for logical decoding on standby

commit   : fcd77d53217b4c4049d176072a1763d6e11ca478    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 8 Apr 2023 02:24:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 8 Apr 2023 02:24:50 -0700    

Click here for diff

Author: "Drouvot, Bertrand" <[email protected]>  
Author: Amit Khandekar <[email protected]>  
Author: Craig Ringer <[email protected]> (in an older version)  
Author: Andres Freund <[email protected]>  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-by: Fabrízio de Royes Mello <[email protected]>  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/meson.build
A src/test/recovery/t/035_standby_logical_decoding.pl

Allow logical decoding on standbys

commit   : 0fdab27ad68a059a1663fa5ce48d76333f1bd74c    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 8 Apr 2023 02:20:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 8 Apr 2023 02:20:01 -0700    

Click here for diff

Unsurprisingly, this requires wal_level = logical to be set on the primary and  
standby. The infrastructure added in 26669757b6a ensures that slots are  
invalidated if the primary's wal_level is lowered.  
  
Creating a slot on a standby waits for a xl_running_xact record to be  
processed. If the primary is idle (and thus not emitting xl_running_xact  
records), that can take a while.  To make that faster, this commit also  
introduces the pg_log_standby_snapshot() function. By executing it on the  
primary, completion of slot creation on the standby can be accelerated.  
  
Note that logical decoding on a standby does not itself enforce that required  
catalog rows are not removed. The user has to use physical replication slots +  
hot_standby_feedback or other measures to prevent that. If catalog rows  
required for a slot are removed, the slot is invalidated.  
  
See 6af1793954e for an overall design of logical decoding on a standby.  
  
Bumps catversion, for the addition of the pg_log_standby_snapshot() function.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Author: Andres Freund <[email protected]> (in an older version)  
Author: Amit Khandekar <[email protected]> (in an older version)  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: FabrÌzio de Royes Mello <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  

M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_functions.sql
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/include/access/xlog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

For cascading replication, wake physical and logical walsenders separately

commit   : e101dfac3a53c20bfbf1ca85d30a368c2954facf    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 8 Apr 2023 00:24:24 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 8 Apr 2023 00:24:24 -0700    

Click here for diff

Physical walsenders can't send data until it's been flushed; logical  
walsenders can't decode and send data until it's been applied. On the  
standby, the WAL is flushed first, which will only wake up physical  
walsenders; and then applied, which will only wake up logical  
walsenders.  
  
Previously, all walsenders were awakened when the WAL was flushed. That  
was fine for logical walsenders on the primary; but on the standby the  
flushed WAL would have been not applied yet, so logical walsenders were  
awakened too early.  
  
Per idea from Jeff Davis and Amit Kapila.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Reviewed-By: Jeff Davis <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAA4eK1+zO5LUeisabX10c81LU-fWMKO4M9Wyg1cdkbW7Hqh6vQ@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h

Handle logical slot conflicts on standby

commit   : 26669757b6a7665c1069e77e6472bd8550193ca6    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 23:11:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 23:11:28 -0700    

Click here for diff

During WAL replay on the standby, when a conflict with a logical slot is  
identified, invalidate such slots. There are two sources of conflicts:  
1) Using the information added in 6af1793954e, logical slots are invalidated if  
   required rows are removed  
2) wal_level on the primary server is reduced to below logical  
  
Uses the infrastructure introduced in the prior commit. FIXME: add commit  
reference.  
  
Change InvalidatePossiblyObsoleteSlot() to use a recovery conflict to  
interrupt use of a slot, if called in the startup process. The new recovery  
conflict is added to pg_stat_database_conflicts, as confl_active_logicalslot.  
  
See 6af1793954e for an overall design of logical decoding on a standby.  
  
Bumps catversion for the addition of the pg_stat_database_conflicts column.  
Bumps PGSTAT_FILE_FORMAT_ID for the same reason.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Amit Khandekar <[email protected]> (in an older version)  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Fabrízio de Royes Mello <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/slot.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/standby.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_database.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/procsignal.h
M src/include/storage/standby.h
M src/test/regress/expected/rules.out

Support invalidating replication slots due to horizon and wal_level

commit   : be87200efd9308ccfe217ce8828f316e93e370da    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 22:40:27 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 22:40:27 -0700    

Click here for diff

Needed for logical decoding on a standby. Slots need to be invalidated because  
of the horizon if rows required for logical decoding are removed. If the  
primary's wal_level is lowered from 'logical', logical slots on the standby  
need to be invalidated.  
  
The new invalidation methods will be used in a subsequent commit.  
  
Logical slots that have been invalidated can be identified via the new  
pg_replication_slots.conflicting column.  
  
See 6af1793954e for an overall design of logical decoding on a standby.  
  
Bumps catversion for the addition of the new pg_replication_slots column.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Amit Khandekar <[email protected]> (in an older version)  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Fabrízio de Royes Mello <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/system-views.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
M src/test/regress/expected/rules.out

Fix underspecified sort order in inherit.sql

commit   : 2ed16aacf1af1e1a26bffb121a19d1ad5f5177f0    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 22:25:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 22:25:46 -0700    

Click here for diff

Introduced in e056c557aef4.  
  
Per buildfarm member prion.  

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

Prevent use of invalidated logical slot in CreateDecodingContext()

commit   : 4397abd0a2af955326c0608d63f3716ce5901004    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 22:19:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 22:19:05 -0700    

Click here for diff

Previously we had checks for this in multiple places. Support for logical  
decoding on standbys will add other forms of invalidation, making it worth  
while to centralize the checks.  
  
This slightly changes the error message for both the walsender and SQL  
interface. Particularly the SQL interface error was inaccurate, as the "This  
slot has never previously reserved WAL" portion was unreachable.  
  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/walsender.c

Replace replication slot's invalidated_at LSN with an enum

commit   : 15f8203a5975d6b9b78e2c64e213ed964b50c044    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 21:47:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 21:47:25 -0700    

Click here for diff

This is mainly useful because the upcoming logical-decoding-on-standby feature  
adds further reasons for invalidating slots, and we don't want to end up with  
multiple invalidated_* fields, or check different attributes.  
  
Eventually we should consider not resetting restart_lsn when invalidating a  
slot due to max_slot_wal_keep_size. But that's a user visible change, so left  
for later.  
  
Increases SLOT_VERSION, due to the changed field (with a different alignment,  
no less).  
  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/replication/slot.h
M src/tools/pgindent/typedefs.list

Add io_direct setting (developer-only).

commit   : d4e71df6d757fd21c363164a3a4d3b5681462662    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 11:04:49 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 11:04:49 +1200    

Click here for diff

Provide a way to ask the kernel to use O_DIRECT (or local equivalent)  
where available for data and WAL files, to avoid or minimize kernel  
caching.  This hurts performance currently and is not intended for end  
users yet.  Later proposed work would introduce our own I/O clustering,  
read-ahead, etc to replace the facilities the kernel disables with this  
option.  
  
The only user-visible change, if the developer-only GUC is not used, is  
that this commit also removes the obscure logic that would activate  
O_DIRECT for the WAL when wal_sync_method=open_[data]sync and  
wal_level=minimal (which also requires max_wal_senders=0).  Those are  
non-default and unlikely settings, and this behavior wasn't (correctly)  
documented.  The same effect can be achieved with io_direct=wal.  
  
Author: Thomas Munro <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Bharath Rupireddy <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGK1X532hYqJ_MzFWt0n1zt8trz980D79WbjwnT-yYLZpg%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/misc/guc_tables.c
M src/include/storage/fd.h
M src/include/storage/smgr.h
M src/include/utils/guc_hooks.h
M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/004_io_direct.pl

Introduce PG_IO_ALIGN_SIZE and align all I/O buffers.

commit   : faeedbcefd40bfdf314e048c425b6d9208896d90    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 10:38:09 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 8 Apr 2023 10:38:09 +1200    

Click here for diff

In order to have the option to use O_DIRECT/FILE_FLAG_NO_BUFFERING in a  
later commit, we need the addresses of user space buffers to be well  
aligned.  The exact requirements vary by OS and file system (typically  
sectors and/or memory pages).  The address alignment size is set to  
4096, which is enough for currently known systems: it matches modern  
sectors and common memory page size.  There is no standard governing  
O_DIRECT's requirements so we might eventually have to reconsider this  
with more information from the field or future systems.  
  
Aligning I/O buffers on memory pages is also known to improve regular  
buffered I/O performance.  
  
Three classes of I/O buffers for regular data pages are adjusted:  
(1) Heap buffers are now allocated with the new palloc_aligned() or  
MemoryContextAllocAligned() functions introduced by commit 439f6175.  
(2) Stack buffers now use a new struct PGIOAlignedBlock to respect  
PG_IO_ALIGN_SIZE, if possible with this compiler.  (3) The buffer  
pool is also aligned in shared memory.  
  
WAL buffers were already aligned on XLOG_BLCKSZ.  It's possible for  
XLOG_BLCKSZ to be configured smaller than PG_IO_ALIGNED_SIZE and thus  
for O_DIRECT WAL writes to fail to be well aligned, but that's a  
pre-existing condition and will be addressed by a later commit.  
  
BufFiles are not yet addressed (there's no current plan to use O_DIRECT  
for those, but they could potentially get some incidental speedup even  
in plain buffered I/O operations through better alignment).  
  
If we can't align stack objects suitably using the compiler extensions  
we know about, we disable the use of O_DIRECT by setting PG_O_DIRECT to  
0.  This avoids the need to consider systems that have O_DIRECT but  
can't align stack objects the way we want; such systems could in theory  
be supported with more work but we don't currently know of any such  
machines, so it's easier to pretend there is no O_DIRECT support  
instead.  That's an existing and tested class of system.  
  
Add assertions that all buffers passed into smgrread(), smgrwrite() and  
smgrextend() are correctly aligned, unless PG_O_DIRECT is 0 (= stack  
alignment tricks may be unavailable) or the block size has been set too  
small to allow arrays of buffers to be all aligned.  
  
Author: Thomas Munro <[email protected]>  
Author: Andres Freund <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGK1X532hYqJ_MzFWt0n1zt8trz980D79WbjwnT-yYLZpg@mail.gmail.com  

M contrib/bloom/blinsert.c
M contrib/pg_prewarm/pg_prewarm.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/storage.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/smgr/md.c
M src/backend/utils/sort/logtape.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_upgrade/file.c
M src/common/file_utils.c
M src/include/c.h
M src/include/pg_config_manual.h
M src/include/storage/fd.h
M src/tools/pgindent/typedefs.list

Doc: Fix the datatype of the newly added SUBSCRIPTION options.

commit   : d73c285af5c29a0b486643b77350bc23fbb6114c    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 8 Apr 2023 09:42:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 8 Apr 2023 09:42:50 +0530    

Click here for diff

In docs, the datatype of "password_required" and "run_as_owner" was  
incorrectly specified as a string.  
  
Author: Amit Kapila  
Reviewed-by: Sawada Masahiko  
Discussion: https://postgr.es/m/CAHut+Pu=pnJf=SS1583pknSQ3CbOqLCkWcJCQYt6zxTagHEdmw@mail.gmail.com  

M doc/src/sgml/ref/create_subscription.sgml

Add missing .gitignore entry.

commit   : db6957bae8d7716785aa3748b25a9a4b7c3ff304    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 23:32:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 23:32:49 -0400    

Click here for diff

Seems an oversight in 7d8219a44.  Fix before somebody commits  
a generated file.  

M src/bin/pg_waldump/.gitignore

Remove useless dependencies in daitch_mokotoff_header.pl.

commit   : 2bfbad9c42207b4ba75cfce9901fa78f2c024b61    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 23:22:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 23:22:28 -0400    

Click here for diff

Actually, the correct fix for this is "we don't need this at all",  
because this program isn't dealing in any non-ASCII data.  The  
dependency on Data::Dumper seems to be a leftover too.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/fuzzystrmatch/daitch_mokotoff_header.pl

Add support for Kerberos credential delegation

commit   : 3d4fa227bce4294ce1cc214b4a9d3b7caa3f0454    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 7 Apr 2023 21:58:04 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 7 Apr 2023 21:58:04 -0400    

Click here for diff

Support GSSAPI/Kerberos credentials being delegated to the server by a  
client.  With this, a user authenticating to PostgreSQL using Kerberos  
(GSSAPI) credentials can choose to delegate their credentials to the  
PostgreSQL server (which can choose to accept them, or not), allowing  
the server to then use those delegated credentials to connect to  
another service, such as with postgres_fdw or dblink or theoretically  
any other service which is able to be authenticated using Kerberos.  
  
Both postgres_fdw and dblink are changed to allow non-superuser  
password-less connections but only when GSSAPI credentials have been  
delegated to the server by the client and GSSAPI is used to  
authenticate to the remote system.  
  
Authors: Stephen Frost, Peifeng Qiu  
Reviewed-By: David Christensen  
Discussion: https://postgr.es/m/CO1PR05MB8023CC2CB575E0FAAD7DF4F8A8E29@CO1PR05MB8023.namprd05.prod.outlook.com  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/postgres_fdw/connection.c
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/config.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/catalog/system_views.sql
M src/backend/foreign/foreign.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.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/backend/utils/misc/postgresql.conf.sample
M src/include/catalog/pg_proc.dat
M src/include/libpq/auth.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/interfaces/libpq/exports.txt
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-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/regress/expected/rules.out

Pacify perlcritic.

commit   : edc627ae27632ae2be0e435aca02ed38005cb55f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 21:32:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 21:32:44 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M contrib/fuzzystrmatch/daitch_mokotoff_header.pl

Track IO times in pg_stat_io

commit   : ac8d53dae5ae2914aeb022dc514826f71c7206e6    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 16:05:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 16:05:26 -0700    

Click here for diff

a9c70b46dbe and 8aaa04b32S added counting of IO operations to a new view,  
pg_stat_io. Now, add IO timing for reads, writes, extends, and fsyncs to  
pg_stat_io as well.  
  
This combines the tracking for pgBufferUsage with the tracking for pg_stat_io  
into a new function pgstat_count_io_op_time(). This should make it a bit  
easier to avoid the somewhat costly instr_time conversion done for  
pgBufferUsage.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Bertrand Drouvot <[email protected]>  
Discussion: https://postgr.es/m/flat/CAAKRu_ay5iKmnbXZ3DsauViF3eMxu4m1oNnJXqV_HyqYeg55Ww%40mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/smgr/md.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Show more detail in nbtree rmgr descriptions.

commit   : 1c453cfd8976d9c6451ba45e27bf30375d574312    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 7 Apr 2023 16:46:23 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 7 Apr 2023 16:46:23 -0700    

Click here for diff

Show a detailed description of the page offset number arrays that appear  
in certain nbtree WAL records.  
  
Also brings nbtree desc routines in line with the guidelines established  
by recent commit 7d8219a4.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/flat/20230109215842.fktuhesvayno6o4g%40awork3.anarazel.de  

M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/include/access/rmgrdesc_utils.h

For Kerberos testing, disable DNS lookups

commit   : ce5e23408568452fd206b79ee411c6f34d80c46b    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 7 Apr 2023 19:36:46 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 7 Apr 2023 19:36:46 -0400    

Click here for diff

Similar to 8dff2f224, this disables DNS lookups by the Kerberos library  
to look up the KDC and the realm while the Kerberos tests are running.  
In some environments, these lookups can take a long time and end up  
timing out and causing tests to fail.  Further, since this isn't really  
our domain, we shouldn't be sending out these DNS requests during our  
tests.  

M src/test/kerberos/t/001_auth.pl

Show more detail in heapam rmgr descriptions.

commit   : 7d8219a444bd917d21234c97e2417a410f10ebd3    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 7 Apr 2023 16:08:52 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 7 Apr 2023 16:08:52 -0700    

Click here for diff

Add helper functions that output arrays in a standard format, and use  
the functions inside heapdesc routines.  This allows tools like  
pg_walinspect to show a detailed description of the page offset number  
arrays for records like PRUNE and VACUUM (unless there was an FPI).  
  
Also document the conventions that desc routines should follow.  Only  
the heapdesc routines follow the conventions for now, so they're just  
guidelines for the time being.  
  
Based on a suggestion from Andres Freund.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/flat/20230109215842.fktuhesvayno6o4g%40awork3.anarazel.de  

M doc/src/sgml/pgwalinspect.sgml
M src/backend/access/rmgrdesc/Makefile
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/meson.build
A src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/bin/pg_waldump/Makefile
A src/include/access/rmgrdesc_utils.h

Adjust contrib/sepgsql regression test expected outputs.

commit   : 76c111a7f16659f9018391f655764c8226461ca4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 18:17:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 18:17:22 -0400    

Click here for diff

Per buildfarm, the log output has changed as a consequence of  
commit e056c557a changing the catalog accesses performed in  
some commands.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out

Add support for Daitch-Mokotoff Soundex in contrib/fuzzystrmatch.

commit   : a290378a3752f787cdc2252889ba513f6fb393db    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 17:31:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 17:31:51 -0400    

Click here for diff

This modernized version of Soundex works significantly better than  
the original, particularly for non-English names.  
  
Dag Lem, reviewed by quite a few people along the way  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/fuzzystrmatch/.gitignore
M contrib/fuzzystrmatch/Makefile
A contrib/fuzzystrmatch/daitch_mokotoff.c
A contrib/fuzzystrmatch/daitch_mokotoff_header.pl
M contrib/fuzzystrmatch/expected/fuzzystrmatch.out
A contrib/fuzzystrmatch/expected/fuzzystrmatch_utf8.out
A contrib/fuzzystrmatch/expected/fuzzystrmatch_utf8_1.out
A contrib/fuzzystrmatch/fuzzystrmatch–1.1–1.2.sql
M contrib/fuzzystrmatch/fuzzystrmatch.control
M contrib/fuzzystrmatch/meson.build
M contrib/fuzzystrmatch/sql/fuzzystrmatch.sql
A contrib/fuzzystrmatch/sql/fuzzystrmatch_utf8.sql
M doc/src/sgml/fuzzystrmatch.sgml

Fix table name clash in recently introduced test

commit   : 728015a47016dcd734c516e43f326ae491b6a3d2    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 14:02:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 14:02:46 -0700    

Click here for diff

A few buildfarm animals recently started complaining about the "child"  
relation already existing. e056c557aef added a new child table to inherit.sql,  
but triggers.sql, running in the same parallel group, also uses a child table.  
  
Rename the new table to inh_child. It maybe worth renaming child, parent in  
other tests as well, but that's work for another day.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve IO accounting for temp relation writes

commit   : 704261ecc694db11d9b5feb4f05f57778214ba2f    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 13:24:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 13:24:26 -0700    

Click here for diff

Both pgstat_database and pgBufferUsage count IO timing for reads of temporary  
relation blocks into local buffers. However, both failed to count write IO  
timing for flushes of dirty local buffers. Fix.  
  
Additionally, FlushRelationBuffers() seems to have omitted counting write  
IO (both count and timing) stats for both pgstat_database and  
pgBufferUsage. Fix.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20230321023451.7rzy4kjj2iktrg2r%40awork3.anarazel.de  

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

Test SCRAM iteration changes with psql \password

commit   : bf5a894c557179b85500a307104b36e846e24f48    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 22:14:23 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 22:14:23 +0200    

Click here for diff

A version of this test was included in the original patch for altering  
SCRAM iteration count, but was omitted due to how interactive psql TAP  
sessions worked before being refactored.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/authentication/t/001_password.pl

Refactor background psql TAP functions

commit   : 664d757531e11ea5ef6971884ddb2a7af6fae69a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 22:14:20 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 22:14:20 +0200    

Click here for diff

This breaks out the background and interactive psql functionality into a  
new class, PostgreSQL::Test::BackgroundPsql.  Sessions are still initiated  
via PostgreSQL::Test::Cluster, but once started they can be manipulated by  
the new helper functions which intend to make querying easier.  A sample  
session for a command which can be expected to finish at a later time can  
be seen below.  
  
  my $session = $node->background_psql('postgres');  
  $bsession->query_until(qr/start/, q(  
    \echo start  
	CREATE INDEX CONCURRENTLY idx ON t(a);  
  ));  
  $bsession->quit;  
  
Patch by Andres Freund with some additional hacking by me.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/003_cic_2pc.pl
M src/bin/psql/t/010_tab_completion.pl
A src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/subscription/t/015_stream.pl

Fix underspecified sort order in test query

commit   : 32bc0d022dee250fac9fc787226abed96b8ff894    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2023 20:19:16 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2023 20:19:16 +0200    

Click here for diff

Fail in e056c557aef4.  

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

Add pg_buffercache_usage_counts() to contrib/pg_buffercache.

commit   : f3fa31327ecba75ee0e946abaa56dbf471ba704b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 14:25:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 14:25:45 -0400    

Click here for diff

It was pointed out that pg_buffercache_summary()'s report of  
the overall average usage count isn't that useful, and what  
would be more helpful in many cases is to report totals for  
each possible usage count.  Add a new function to do it like  
that.  Since pg_buffercache 1.4 is already new for v16,  
we don't need to create a new extension version; we'll just  
define this as part of 1.4.  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/20230130233040.GA2800702@nathanxps13  

M contrib/pg_buffercache/expected/pg_buffercache.out
M contrib/pg_buffercache/pg_buffercache–1.3–1.4.sql
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_buffercache/sql/pg_buffercache.sql
M doc/src/sgml/pgbuffercache.sgml

Catalog NOT NULL constraints

commit   : e056c557aef4006c3dfbf8a4b94b7ae88eb9fd67    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2023 19:20:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Apr 2023 19:20:53 +0200    

Click here for diff

We now create pg_constaint rows for NOT NULL constraints with  
contype='n'.  
  
We propagate these constraints during operations such as adding  
inheritance relationships, creating and attaching partitions, creating  
tables LIKE other tables.  We mostly follow the well-known rules of  
conislocal and coninhcount that we have for CHECK constraints, with some  
adaptations; for example, as opposed to CHECK constraints, we don't  
match NOT NULL ones by name when descending a hierarchy to alter it;  
instead we match by column number.  This means we don't require the  
constraint names to be identical across a hierarchy.  
  
For now, we omit them from system catalogs.  Maybe this is worth  
reconsidering.  We don't support NOT VALID nor DEFERRABLE clauses  
either; these can be added as separate features later (this patch is  
already large and complicated enough.)  
  
This has been very long in the making.  The first patch was written by  
Bernd Helmle in 2010 to add a new pg_constraint.contype value ('n'),  
which I (Álvaro) then hijacked in 2011 and 2012, until that one was  
killed by the realization that we ought to use contype='c' instead:  
manufactured CHECK constraints.  However, later SQL standard  
development, as well as nonobvious emergent properties of that design  
(mostly, failure to distinguish them from "normal" CHECK constraints as  
well as the performance implication of having to test the CHECK  
expression) led us to reconsider this choice, so now the current  
implementation uses contype='n' again.  
  
In 2016 Vitaly Burovoy also worked on this feature[1] but found no  
consensus for his proposed approach, which was claimed to be closer to  
the letter of the standard, requiring additional pg_attribute columns to  
track the OID of the NOT NULL constraint for that column.  
[1] https://postgr.es/m/CAKOSWNkN6HSyatuys8xZxzRCR-KL1OkHS5-b9qd9bf1Rad3PLA@mail.gmail.com  
  
Author: Álvaro Herrera <[email protected]>  
Author: Bernd Helmle <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
  
Discussion: https://postgr.es/m/CACA0E642A0267EDA387AF2B%40%5B172.26.14.62%5D  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAKOSWNkN6HSyatuys8xZxzRCR-KL1OkHS5-b9qd9bf1Rad3PLA@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_constraint.h
M src/include/commands/tablecmds.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/cluster.out
M src/test/regress/expected/constraints.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/indexing.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/replica_identity.sql

Doc: improve descriptions of max_[pred_]locks_per_transaction GUCs.

commit   : ff245a37888ae28da4e6eeacac83f00aa0986340    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 13:29:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 13:29:29 -0400    

Click here for diff

The old wording described these as being multiplied by max_connections  
plus max_prepared_transactions, which hasn't been exactly right for  
some time thanks to the addition of various auxiliary processes.  
Moreover, exactness here is a bit pointless given that the lock tables  
can expand into the initially-unallocated "slop" space in shared  
memory.  Rather than trying to track exactly what the code is doing,  
let's just use the term "server processes".  
  
Likewise adjust these GUCs' description strings in guc_tables.c.  
  
Wang Wei, reviewed by Nathan Bossart and myself  
  
Discussion: https://postgr.es/m/OS3PR01MB6275BDD09C9B875C65FCC5AB9EA39@OS3PR01MB6275.jpnprd01.prod.outlook.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc_tables.c

Add array_sample() and array_shuffle() functions.

commit   : 888f2ea0a81ff171087bdd1c5c1eeda3b78d73d4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 11:47:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 11:47:07 -0400    

Click here for diff

These are useful in Monte Carlo applications.  
  
Martin Kalcher, reviewed/adjusted by Daniel Gustafsson and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/array_userfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Fix locale-dependent test case.

commit   : cd82e5c79d145dddd7a30ed35e4d3b83945b56f3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 10:35:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Apr 2023 10:35:11 -0400    

Click here for diff

psql parses the interval argument of \watch with locale-dependent  
strtod().  In commit 00beecfe8 I added a test case that exercises  
a fractional interval, but I hard-coded 0.01 which doesn't work  
in locales where the radix point isn't ".".  We don't want to  
change this longstanding parsing behavior, so fix the test case  
to generate a suitably locale-aware spelling.  
  
Report and patch by Alexander Korotkov.  
  
Discussion: https://postgr.es/m/CAPpHfdv+10Uk6FWjsh3+ju7kHYr76LaRXbYayXmrM7FBU-=Hgg@mail.gmail.com  

M src/bin/psql/t/001_basic.pl

Fix copy-paste bug in 12f3867f553 triggering an assert after a write error

commit   : 21d7c05a5cf7637cbdf2739006936bb9d279d505    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 01:02:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Apr 2023 01:02:46 -0700    

Click here for diff

The same condition accidentally was copied to both branches. Manual testing  
confirms that otherwise the error recovery path works fine.  
  
Found while reviewing the logical-decoding-on-standby patch.  

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

Add tab-completion for newly added SUBSCRIPTION options.

commit   : 96c498d2f8ce5f0082c64793f94e2d0cfa7d7605    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 7 Apr 2023 10:32:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 7 Apr 2023 10:32:36 +0530    

Click here for diff

Commits c3afe8cf5a and 482675987b added new subscription options  
"password_required" and "run_as_owner". This patch adds tab-completion  
for these newly added options.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pu=pnJf=SS1583pknSQ3CbOqLCkWcJCQYt6zxTagHEdmw@mail.gmail.com  

M src/bin/psql/tab-complete.c

Add more protections in WAL record APIs against overflows

commit   : 8fcb32db98eda1ad2a0c0b40b1cbb5d9a7aa68f0    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Apr 2023 10:10:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Apr 2023 10:10:17 +0900    

Click here for diff

This commit adds a limit to the size of an XLogRecord at 1020MB, based  
on a suggestion by Heikki Linnakangas.  This counts for the overhead  
needed by the XLogReader when allocating the memory it needs to read a  
record in DecodeXLogRecordRequiredSpace(), based on the record size.  An  
assertion based on that is added to detect that any additions in the  
XLogReader facilities would not cause any overflows.  If that's ever the  
case, the upper bound allowed would need to be adjusted.  
  
Before this, it was possible for an external module to create WAL  
records large enough to be assembled but not replayable, causing  
failures when replaying such WAL records on standbys.  One case  
mentioned where this is possible is the in-core function  
pg_logical_emit_message() (wrapper for LogLogicalMessage), that allows  
to emit WAL records with an arbitrary amount of data potentially higher  
than the replay limit of approximately 1GB (limit of a palloc, minus the  
overhead needed by a XLogReader).  
  
This commit is a follow-up of ffd1b6b that has added similar protections  
for the block-level data.  Here, the checks are extended to the whole  
record length, mainrdata_len being extended from uint32 to uint64 with  
the routines registering buffer and record data still limited to uint32  
to minimize the checks when assembling a record.  All the error messages  
related to overflow checks are improved to provide more context about  
the error happening.  
  
Author: Matthias van de Meent  
Reviewed-by: Andres Freund, Heikki Linnakangas, Michael Paquier  
Discussion: https://postgr.es/m/CAEze2WgGiw+LZt+vHf8tWqB_6VxeLsMeoAuod0N=ij1q17n5pw@mail.gmail.com  

M src/backend/access/transam/xloginsert.c
M src/include/access/xlogrecord.h

Use ExtendBufferedRelTo() in XLogReadBufferExtended()

commit   : 26158b852d3adf6936008ce09c9ff2b947c8df40    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 17:45:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 17:45:42 -0700    

Click here for diff

Instead of extending the relation block-by-block, use ExtendBufferedRelTo(),  
introduced in 31966b151e6. This is faster and simpler.  
  
This also somewhat reduces the danger that disconnected segments pose (which  
can be "discovered" once the previous segment reaches SEGSIZE), as  
ExtendBufferedRelTo() won't extend past the block it has been asked. However,  
the risk of the content of such a disconnected segment being invalid  
remains.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Add --buffer-usage-limit option to vacuumdb

commit   : ae78cae3be627213528f2e08eb976d6906d754de    
  
author   : David Rowley <[email protected]>    
date     : Fri, 7 Apr 2023 12:47:10 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 7 Apr 2023 12:47:10 +1200    

Click here for diff

1cbbee033 added BUFFER_USAGE_LIMIT to the VACUUM and ANALYZE commands, so  
here we permit that option to be specified in vacuumdb.  
  
In passing, adjust the documents for vacuum_buffer_usage_limit and the  
BUFFER_USAGE_LIMIT VACUUM option to mention "kB" rather than "KB".  Do the  
same for the ERROR message in ExecVacuum() and  
check_vacuum_buffer_usage_limit().  Without that we might tell a user that  
the valid minimum value is 128 KB only to reject that because we accept  
only "kB" and not "KB".  
  
Also, add a small reminder comment in vacuum.h to try to trigger the  
memory of anyone adding new fields to VacuumParams that they might want to  
consider if vacuumdb needs to grow a new option too.  
  
Author: Melanie Plageman  
Reviewed-by: Justin Pryzby  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M src/backend/commands/vacuum.c
M src/bin/scripts/vacuumdb.c
M src/include/commands/vacuum.h
M src/test/regress/expected/vacuum.out

hio: Use ExtendBufferedRelBy() to extend tables more efficiently

commit   : 00d1e02be24987180115e371abaeb84738257ae2    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 16:35:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 16:35:21 -0700    

Click here for diff

While we already had some form of bulk extension for relations, it was fairly  
limited. It only amortized the cost of acquiring the extension lock, the  
relation itself was still extended one-by-one. Bulk extension was also solely  
triggered by contention, not by the amount of data inserted.  
  
To address this, use ExtendBufferedRelBy(), introduced in 31966b151e6, to  
extend the relation. We try to extend the relation by multiple blocks in two  
situations:  
  
1) The caller tells RelationGetBufferForTuple() that it will need multiple  
   pages. For now that's only used by heap_multi_insert(), see commit FIXME.  
  
2) If there is contention on the extension lock, use the number of waiters for  
   the lock as a multiplier for the number of blocks to extend by. This is  
   similar to what we already did. Previously we additionally multiplied the  
   numbers of waiters by 20, but with the new relation extension  
   infrastructure I could not see a benefit in doing so.  
  
Using the freespacemap to provide empty pages can cause significant  
contention, and adds measurable overhead, even if there is no contention. To  
reduce that, remember the blocks the relation was extended by in the  
BulkInsertState, in the extending backend. In case 1) from above, the blocks  
the extending backend needs are not entered into the FSM, as we know that we  
will need those blocks.  
  
One complication with using the FSM to record empty pages, is that we need to  
insert blocks into the FSM, when we already hold a buffer content lock. To  
avoid doing IO while holding a content lock, release the content lock before  
recording free space. Currently that opens a small window in which another  
backend could fill the block, if a concurrent VACUUM records the free  
space. If that happens, we retry, similar to the already existing case when  
otherBuffer is provided. In the future it might be worth closing the race by  
preventing VACUUM from recording the space in newly extended pages.  
  
This change provides very significant wins (3x at 16 clients, on my  
workstation) for concurrent COPY into a single relation. Even single threaded  
COPY is measurably faster, primarily due to not dirtying pages while  
extending, if supported by the operating system (see commit 4d330a61bb1). Even  
single-row INSERTs benefit, although to a much smaller degree, as the relation  
extension lock rarely is the primary bottleneck.  
  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Add VACUUM/ANALYZE BUFFER_USAGE_LIMIT option

commit   : 1cbbee03385763b066ae3961fc61f2cd01a0d0d7    
  
author   : David Rowley <[email protected]>    
date     : Fri, 7 Apr 2023 11:40:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 7 Apr 2023 11:40:31 +1200    

Click here for diff

Add new options to the VACUUM and ANALYZE commands called  
BUFFER_USAGE_LIMIT to allow users more control over how large to make the  
buffer access strategy that is used to limit the usage of buffers in  
shared buffers.  Larger rings can allow VACUUM to run more quickly but  
have the drawback of VACUUM possibly evicting more buffers from shared  
buffers that might be useful for other queries running on the database.  
  
Here we also add a new GUC named vacuum_buffer_usage_limit which controls  
how large to make the access strategy when it's not specified in the  
VACUUM/ANALYZE command.  This defaults to 256KB, which is the same size as  
the access strategy was prior to this change.  This setting also  
controls how large to make the buffer access strategy for autovacuum.  
  
Per idea by Andres Freund.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Reviewed-by: Andres Freund  
Reviewed-by: Justin Pryzby  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/buffer/README
M src/backend/storage/buffer/freelist.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/tab-complete.c
M src/include/miscadmin.h
M src/include/storage/bufmgr.h
M src/include/utils/guc_hooks.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

heapam: Pass number of required pages to RelationGetBufferForTuple()

commit   : 5279e9db8e8da3c310c0068da2de98df5a714b2e    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 14:18:24 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 14:18:24 -0700    

Click here for diff

A future commit will use this information to determine how aggressively to  
extend the relation by. In heap_multi_insert() we know accurately how many  
pages we need once we need to extend the relation, providing an accurate lower  
bound for how much to extend.  
  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Refresh cost-based delay params more frequently in autovacuum

commit   : 7d71d3dd080b9b147402db3365fe498f74704231    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 01:00:21 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 01:00:21 +0200    

Click here for diff

Allow autovacuum to reload the config file more often so that cost-based  
delay parameters can take effect while VACUUMing a relation. Previously,  
autovacuum workers only reloaded the config file once per relation  
vacuumed, so config changes could not take effect until beginning to  
vacuum the next table.  
  
Now, check if a reload is pending roughly once per block, when checking  
if we need to delay.  
  
In order for autovacuum workers to safely update their own cost delay  
and cost limit parameters without impacting performance, we had to  
rethink when and how these values were accessed.  
  
Previously, an autovacuum worker's wi_cost_limit was set only at the  
beginning of vacuuming a table, after reloading the config file.  
Therefore, at the time that autovac_balance_cost() was called, workers  
vacuuming tables with no cost-related storage parameters could still  
have different values for their wi_cost_limit_base and wi_cost_delay.  
  
Now that the cost parameters can be updated while vacuuming a table,  
workers will (within some margin of error) have no reason to have  
different values for cost limit and cost delay (in the absence of  
cost-related storage parameters). This removes the rationale for keeping  
cost limit and cost delay in shared memory. Balancing the cost limit  
requires only the number of active autovacuum workers vacuuming a table  
with no cost-based storage parameters.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_ZngzqnEODc7LmS1NH04Kt6Y9huSjz5pp7%2BDXhrjDA0gw%40mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/include/commands/vacuum.h

Separate vacuum cost variables from GUCs

commit   : a85c60a945acfcb1aaac0c521e5eb5a2477d9695    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 00:54:53 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 00:54:53 +0200    

Click here for diff

Vacuum code run both by autovacuum workers and a backend doing  
VACUUM/ANALYZE previously inspected VacuumCostLimit and VacuumCostDelay,  
which are the global variables backing the GUCs vacuum_cost_limit and  
vacuum_cost_delay.  
  
Autovacuum workers needed to override these variables with their  
own values, derived from autovacuum_vacuum_cost_limit and  
autovacuum_vacuum_cost_delay and worker cost limit balancing logic.  
This led to confusing code which, in some cases, both derived and  
set a new value of VacuumCostLimit from VacuumCostLimit.  
  
In preparation for refreshing these GUC values more often, introduce  
new, independent global variables and add a function to update them  
using the GUCs and existing logic.  
  
Per suggestion by Kyotaro Horiguchi  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_ZngzqnEODc7LmS1NH04Kt6Y9huSjz5pp7%2BDXhrjDA0gw%40mail.gmail.com  

M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/include/commands/vacuum.h
M src/include/postmaster/autovacuum.h

Make vacuum failsafe_active globally visible

commit   : 71a825194fd3f8c084f63bd2b0a8d11d753d25d3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 00:54:08 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 7 Apr 2023 00:54:08 +0200    

Click here for diff

While vacuuming a table in failsafe mode, VacuumCostActive should  
not be re-enabled.  This currently isn't a problem because vacuum  
cost parameters are only refreshed in between vacuuming tables and  
failsafe status is reset for every table.  
  
In preparation for allowing vacuum cost parameters to be updated  
more frequently, elevate LVRelState->failsafe_active to a global,  
VacuumFailsafeActive, which will be checked when determining whether  
or not to re-enable vacuum cost-related delays.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_ZngzqnEODc7LmS1NH04Kt6Y9huSjz5pp7%2BDXhrjDA0gw%40mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Stabilize just-added regression test cases.

commit   : 5499706bdf60235f787eae9d2b541444ef0b31b3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2023 18:13:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2023 18:13:49 -0400    

Click here for diff

The tests added by commits 029dea882 et al turn out to produce  
different output under -DRANDOMIZE_ALLOCATED_MEMORY.  This is  
not a bug exactly: that flag causes coerce_type() to invoke  
the input function twice when coercing an unknown-type literal  
to a specific type.  So you get tsqueryin's bleat about an empty  
tsquery twice.  Revise the test query to avoid that.  
  
Discussion: https://postgr.es/m/[email protected]  

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

psql: set SHELL_ERROR and SHELL_EXIT_CODE in more places.

commit   : 31ae2aa9d2c200a0d7d3283d749669a408ec7b65    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2023 17:33:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2023 17:33:38 -0400    

Click here for diff

Make the \g, \o, \w, and \copy commands set these variables  
when closing a pipe.  We missed doing this in commit b0d8f2d98,  
but it seems like a good idea.  
  
There are some remaining places in psql that intentionally don't  
update these variables after running a child program:  
	* pager invocations  
	* backtick evaluation within a prompt  
	* \e (edit query buffer)  
  
Corey Huinker and Tom Lane  
  
Discussion: https://postgr.es/m/CADkLM=eSKwRGF-rnRqhtBORRtL49QsjcVUCa-kLxKTqxypsakw@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/psqlscanslash.l

Fix ts_headline() edge cases for empty query and empty search text.

commit   : 029dea882a7aa34f46732473eed7c917505e6481    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2023 15:52:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2023 15:52:37 -0400    

Click here for diff

tsquery's GETQUERY() macro is only safe to apply to a tsquery  
that is known non-empty; otherwise it gives a pointer to garbage.  
Before commit 5a617d75d, ts_headline() avoided this pitfall, but  
only in a very indirect, nonobvious way.  (hlCover could not reach  
its TS_execute call, because if the query contains no lexemes  
then hlFirstIndex would surely return -1.)  After that commit,  
it fell into the trap, resulting in weird errors such as  
"unrecognized operator" and/or valgrind complaints.  In HEAD,  
fix this by not calling TS_execute_locations() at all for an  
empty query.  In the back branches, add a defensive check to  
hlCover() --- that's not fixing any live bug, but I judge the  
code a bit too fragile as-is.  
  
Also, both mark_hl_fragments() and mark_hl_words() were careless  
about the possibility of empty search text: in the cases where  
no match has been found, they'd end up telling mark_fragment() to  
mark from word indexes 0 to 0 inclusive, even when there is no  
word 0.  This is harmless since we over-allocated the prs->words  
array, but it does annoy valgrind.  Fix so that the end index is -1  
and thus mark_fragment() will do nothing in such cases.  
  
Bottom line is that this fixes a live bug in HEAD, but in the  
back branches it's only getting rid of a valgrind nitpick.  
Back-patch anyway.  
  
Per report from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/wparser_def.c
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/tsearch.sql

hio: Don't pin the VM while holding buffer lock while extending

commit   : 18103b7c5f1aed4ca22f75229346eddb6e20d725    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 11:11:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 11:11:13 -0700    

Click here for diff

Starting with commit 7db0cd2145f, RelationGetBufferForTuple() did a  
visibilitymap_pin() while holding an exclusive buffer content lock on a newly  
extended page, when using COPY FREEZE. We elsewhere try hard to avoid to doing  
IO while holding a content lock. And until 14f98e0af99, that happened while  
holding the relation extension lock.  
  
Practically, this isn't a huge issue, because COPY FREEZE is restricted to  
relations created or truncated in the current session, so it's unlikely  
there's a lot of contention.  
  
We can't avoid doing IO while holding the content lock by pinning the VM  
earlier, because we don't know which page it will be on.  
  
While we could just ignore the issue in this case, a future commit will add  
bulk relation extension, which needs to enter pages into the FSM while also  
trying to hold onto a buffer lock.  
  
To address this issue, use visibilitymap_pin_ok() to see if the relevant  
buffer is already pinned. If not, release the buffer, pin the VM buffer, and  
acquire the lock again. This opens up a small window for other backends to  
insert data onto the page - as the page is not entered into the freespacemap,  
other backends won't see it normally, but a concurrent vacuum could enter the  
page, if it started just after the relation is extended. In case the page is  
used by another backend, retry. This is very similar to how locking  
"otherBuffer" is already dealt with.  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: http://postgr.es/m/[email protected]  

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

hio: Relax rules for calling GetVisibilityMapPins()

commit   : bba9003b627f4742212bd060ae65fe5c9c3592f3    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 10:27:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Apr 2023 10:27:30 -0700    

Click here for diff

GetVisibilityMapPins() insisted on the buffer1/buffer2 being in a specific  
order. This required checks at the callsite. As a subsequent patch will add  
another callsite, move related logic into GetVisibilityMapPins().  
  
Discussion: https://postgr.es/m/[email protected]  

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

psql: add an optional execution-count limit to \watch.

commit   : 00beecfe839c878abb366b68272426ed5296bc2b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2023 13:18:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Apr 2023 13:18:14 -0400    

Click here for diff

\watch can now be told to stop after N executions of the query.  
  
With the idea that we might want to add more options to \watch  
in future, this patch generalizes the command's syntax to a list  
of name=value options, with the interval allowed to omit the name  
for backwards compatibility.  
  
Andrey Borodin, reviewed by Kyotaro Horiguchi, Nathan Bossart,  
Michael Paquier, Yugo Nagata, and myself  
  
Discussion: https://postgr.es/m/CAAhFRxiZ2-n_L1ErMm9AZjgmUK=qS6VHb+0SaMn8sqqbhF7How@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/t/001_basic.pl
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Support long distance matching for zstd compression

commit   : 2820adf7755d2a377546d5b55f5b1a4a39889336    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 6 Apr 2023 17:18:38 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 6 Apr 2023 17:18:38 +0200    

Click here for diff

zstd compression supports a special mode for finding matched in distant  
past, which may result in better compression ratio, at the expense of  
using more memory (the window size is 128MB).  
  
To enable this optional mode, use the "long" keyword when specifying the  
compression method (--compress=zstd:long).  
  
Author: Justin Pryzby  
Reviewed-by: Tomas Vondra, Jacob Champion  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/backup/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/common/compression.c
M src/include/common/compression.h

postgres_fdw: Add support for parallel abort.

commit   : 983ec23007bd83a649af9bc823f13feb0da27e0e    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 6 Apr 2023 17:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 6 Apr 2023 17:30:00 +0900    

Click here for diff

postgres_fdw aborts remote (sub)transactions opened on remote server(s)  
in a local (sub)transaction one by one when the local (sub)transaction  
aborts.  This patch allows it to abort the remote (sub)transactions in  
parallel to improve performance.  This is enabled by the server option  
"parallel_abort".  The default is false.  
  
Etsuro Fujita, reviewed by David Zhang.  
  
Discussion: http://postgr.es/m/CAPmGK15FuPVGx3TGHKShsbPKKtF1y58-ZLcKoxfN-nqLj1dZ%3Dg%40mail.gmail.com  

M contrib/postgres_fdw/connection.c
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/postgres-fdw.sgml

Move various prechecks from vacuum() into ExecVacuum()

commit   : b9b125b9c14381c4d04a446e335bb2da5f602596    
  
author   : David Rowley <[email protected]>    
date     : Thu, 6 Apr 2023 15:44:52 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 6 Apr 2023 15:44:52 +1200    

Click here for diff

vacuum() is used for both the VACUUM command and for autovacuum. There  
were many prechecks being done inside vacuum() that were just not relevant  
to autovacuum.  Let's move the bulk of these into ExecVacuum() so that  
they're only executed when running the VACUUM command.  This removes a  
small amount of overhead when autovacuum vacuums a table.  
  
While we are at it, allocate VACUUM's BufferAccessStrategy in ExecVacuum()  
and pass it into vacuum() instead of expecting vacuum() to make it if it's  
not already made by the calling function.  To make this work, we need to  
create the vacuum memory context slightly earlier, so we now need to pass  
that down to vacuum() so that it's available for use in other memory  
allocations.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/include/commands/vacuum.h

Convert many uses of ReadBuffer[Extended](P_NEW) to ExtendBufferedRel()

commit   : acab1b0914e426d28789731f50f5964dd4d2f054    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 18:57:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 18:57:29 -0700    

Click here for diff

A few places are not converted. Some because they are tackled in later  
commits (e.g. hio.c, xlogutils.c), some because they are more  
complicated (e.g. brin_pageops.c).  Having a few users of ReadBuffer(P_NEW) is  
good anyway, to ensure the backward compat path stays working.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blutils.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.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/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/commands/sequence.c

Use ExtendBufferedRelTo() in {vm,fsm}_extend()

commit   : fcdda1e4b50249c344e510ea93d4bd74d2743430    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 17:29:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 17:29:57 -0700    

Click here for diff

This uses ExtendBufferedRelTo(), introduced in 31966b151e6, to extend the  
visibilitymap and freespacemap to the size needed.  
  
It also happens to fix a warning introduced in 3d6a98457d8, reported by Tom  
Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/visibilitymap.c
M src/backend/storage/freespace/freespace.c

Always make a BufferAccessStrategy for ANALYZE

commit   : bccd6908ca82c6cba0c76b669bc81fc9f3fb60cd    
  
author   : David Rowley <[email protected]>    
date     : Thu, 6 Apr 2023 12:37:03 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 6 Apr 2023 12:37:03 +1200    

Click here for diff

32fbe0239 changed things so we didn't bother allocating the  
BufferAccessStrategy during VACUUM (ONLY_DATABASE_STATS); and VACUUM  
(FULL), however, it forgot to consider that VACUUM (FULL, ANALYZE) is a  
possible combination.  That change would have resulted in such a command  
allowing ANALYZE to make full use of shared buffers, which wasn't  
intended, so fix that.  
  
Reported-by: Melanie Plageman  
Discussion: https://postgr.es/m/CAAKRu_bJRKe+v_=OqwC+5sA3j5qv8rqdAwy3+yHaO3wmtfrCRg@mail.gmail.com  

M src/backend/commands/vacuum.c

Fix row tracking in pg_stat_statements with extended query protocol

commit   : 1d477a907e63941b58508136f92ac0b5058b68ab    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Apr 2023 09:29:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Apr 2023 09:29:03 +0900    

Click here for diff

pg_stat_statements relies on EState->es_processed to count the number of  
rows processed by ExecutorRun().  This proves to be a problem under the  
extended query protocol when the result of a query is fetched through  
more than one call of ExecutorRun(), as es_processed is reset each time  
ExecutorRun() is called.  This causes pg_stat_statements to report the  
number of rows calculated in the last execute fetch, rather than the  
global sum of all the rows processed.  
  
As pquery.c tells, this is a problem when a portal does not use  
holdStore.  For example, DMLs with RETURNING would report a correct  
tuple count as these do one execution cycle when the query is first  
executed to fill in the portal's store with one ExecutorRun(), feeding  
on the portal's store for each follow-up execute fetch depending on the  
fetch size requested by the client.  
  
The fix proposed for this issue is simple with the addition of an extra  
counter in EState that's preserved across multiple ExecutorRun() calls,  
incremented with the value calculated in es_processed.  This approach is  
not back-patchable, unfortunately.  
  
Note that libpq does not currently give any way to control the fetch  
size when using the extended v3 protocol, meaning that in-core testing  
is not possible yet.  This issue can be easily verified with the JDBC  
driver, though, with *autocommit disabled*.  Hence, having in-core tests  
requires more features, left for future discussion:  
- At least two new libpq routines splitting PQsendQueryGuts(), one for  
the bind/describe and a second for a series of execute fetches with a  
custom fetch size, likely in a fashion similar to what JDBC does.  
- A psql meta-command for the execute phase.  This part is not strictly  
mandatory, still it could be handy.  
  
Reported-by: Andrew Dunstan (original discovery by Simon Siggs)  
Author: Sami Imseih  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/include/nodes/execnodes.h

bufmgr: Introduce infrastructure for faster relation extension

commit   : 31966b151e6ab7a6284deab6e8fe5faddaf2ae4c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 16:21:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 16:21:09 -0700    

Click here for diff

The primary bottlenecks for relation extension are:  
  
1) The extension lock is held while acquiring a victim buffer for the new  
   page. Acquiring a victim buffer can require writing out the old page  
   contents including possibly needing to flush WAL.  
  
2) When extending via ReadBuffer() et al, we write a zero page during the  
   extension, and then later write out the actual page contents. This can  
   nearly double the write rate.  
  
3) The existing bulk relation extension infrastructure in hio.c just amortized  
   the cost of acquiring the relation extension lock, but none of the other  
   costs.  
  
Unfortunately 1) cannot currently be addressed in a central manner as the  
callers to ReadBuffer() need to acquire the extension lock. To address that,  
this this commit moves the responsibility for acquiring the extension lock  
into bufmgr.c functions. That allows to acquire the relation extension lock  
for just the required time. This will also allow us to improve relation  
extension further, without changing callers.  
  
The reason we write all-zeroes pages during relation extension is that we hope  
to get ENOSPC errors earlier that way (largely works, except for CoW  
filesystems). It is easier to handle out-of-space errors gracefully if the  
page doesn't yet contain actual tuples. This commit addresses 2), by using the  
recently introduced smgrzeroextend(), which extends the relation, without  
dirtying the kernel page cache for all the extended pages.  
  
To address 3), this commit introduces a function to extend a relation by  
multiple blocks at a time.  
  
There are three new exposed functions: ExtendBufferedRel() for extending the  
relation by a single block, ExtendBufferedRelBy() to extend a relation by  
multiple blocks at once, and ExtendBufferedRelTo() for extending a relation up  
to a certain size.  
  
To avoid duplicating code between ReadBuffer(P_NEW) and the new functions,  
ReadBuffer(P_NEW) now implements relation extension with  
ExtendBufferedRel(), using a flag to tell ExtendBufferedRel() that the  
relation lock is already held.  
  
Note that this commit does not yet lead to a meaningful performance or  
scalability improvement - for that uses of ReadBuffer(P_NEW) will need to be  
converted to ExtendBuffered*(), which will be done in subsequent commits.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/probes.d
M src/include/pgstat.h
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list

Allow to use system CA pool for certificate verification

commit   : 8eda7314652703a2ae30d6c4a69c378f6813a7f2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 5 Apr 2023 23:22:17 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 5 Apr 2023 23:22:17 +0200    

Click here for diff

This adds a new option to libpq's sslrootcert, "system", which will load  
the system trusted CA roots for certificate verification. This is a more  
convenient way to achieve this than pointing to the system CA roots  
manually since the location can differ by installation and be locally  
adjusted by env vars in OpenSSL.  
  
When sslrootcert is set to system, sslmode is forced to be verify-full  
as weaker modes aren't providing much security for public CAs.  
  
Changing the location of the system roots by setting environment vars is  
not supported by LibreSSL so the tests will use a heuristic to determine  
if the system being tested is LibreSSL or OpenSSL.  
  
The workaround in .cirrus.yml is required to handle a strange interaction  
between homebrew and the openssl@3 formula; hopefully this can be removed  
in the near future.  
  
The original patch was written by Thomas Habets, which was later revived  
by Jacob Champion.  
  
Author: Jacob Champion <[email protected]>  
Author: Thomas Habets <[email protected]>  
Reviewed-by: Jelte Fennema <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Magnus Hagander <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA%2BkHd%2BcJwCUxVb-Gj_0ptr3_KZPwi3%2B67vK6HnLFBK9MzuYrLA%40mail.gmail.com  

M .cirrus.yml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/runtime.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/t/001_uri.pl
A src/test/ssl/ssl/server-cn-only+server_ca.crt
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl

bufmgr: Support multiple in-progress IOs by using resowner

commit   : 12f3867f5534754c8bac5af35228d4079edc3a00    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 13:55:15 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 13:55:15 -0700    

Click here for diff

A future patch will add support for extending relations by multiple blocks at  
once. To be concurrency safe, the buffers for those blocks need to be marked  
as BM_IO_IN_PROGRESS. Until now we only had infrastructure for recovering from  
an IO error for a single buffer. This commit extends that infrastructure to  
multiple buffers by using the resource owner infrastructure.  
  
This commit increases the size of the ResourceOwnerData struct, which appears  
to have a just about measurable overhead in very extreme workloads. Medium  
term we are planning to substantially shrink the size of  
ResourceOwnerData. Short term the increase is small enough to not worry about  
it for now.  
  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/resowner/resowner.c
M src/include/storage/bufmgr.h
M src/include/utils/resowner_private.h

Support "Right Anti Join" plan shapes.

commit   : 16dc2703c5413534d4989e08253e8f4fcb0e2aab    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Apr 2023 16:59:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Apr 2023 16:59:00 -0400    

Click here for diff

Merge and hash joins can support antijoin with the non-nullable input  
on the right, using very simple combinations of their existing logic  
for right join and anti join.  This gives the planner more freedom  
about how to order the join.  It's particularly useful for hash join,  
since we may now have the option to hash the smaller table instead  
of the larger.  
  
Richard Guo, reviewed by Ronan Dunklau and myself  
  
Discussion: https://postgr.es/m/CAMbWs48xh9hMzXzSy3VaPzGAz+fkxXXTUbCLohX1_L8THFRm2Q@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeMergejoin.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/test/regress/expected/partition_join.out

bufmgr: Acquire and clean victim buffer separately

commit   : dad50f677c42de207168a3f08982ba23c9fc6720    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 13:47:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 13:47:46 -0700    

Click here for diff

Previously we held buffer locks for two buffer mapping partitions at the same  
time to change the identity of buffers.  Particularly for extending relations  
needing to hold the extension lock while acquiring a victim buffer is  
painful.But it also creates a bottleneck for workloads that just involve  
reads.  
  
Now we instead first acquire a victim buffer and write it out, if  
necessary. Then we remove that buffer from the old partition with just the old  
partition's partition lock held and insert it into the new partition with just  
that partition's lock held.  
  
By separating out the victim buffer acquisition, future commits will be able  
to change relation extensions to scale better.  
  
On my workstation, a micro-benchmark exercising buffered reads strenuously and  
under a lot of concurrency, sees a >2x improvement.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Acquire locks on views in AcquirePlannerLocks, too.

commit   : 65eb2d00c6c1bab29db9fa6575185a40d823fe9d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Apr 2023 15:56:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Apr 2023 15:56:07 -0400    

Click here for diff

Commit 47bb9db75 taught AcquireExecutorLocks to re-acquire locks  
on views using data from their RTE_SUBQUERY replacements, but  
it now seems like we should make AcquirePlannerLocks do the same.  
In this way, if a view has been redefined, we will notice that  
a bit earlier while checking validity of a cached plan and thereby  
avoid some wasted work.  
  
Report and patch by Amit Langote.  
  
Discussion: https://postgr.es/m/CA+HiwqH0xZOQ+GQAdKeckY1R4NOeHdzhtfxkAMJLSchpapNk5w@mail.gmail.com  

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

pg_dump: Add support for zstd compression

commit   : 84adc8e20f54e93a003cd316fa1eb9b03e393288    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 5 Apr 2023 21:38:04 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 5 Apr 2023 21:38:04 +0200    

Click here for diff

Allow pg_dump to use the zstd compression, in addition to gzip/lz4. Bulk  
of the new compression method is implemented in compress_zstd.{c,h},  
covering the pg_dump compression APIs. The rest of the patch adds test  
and makes various places aware of the new compression method.  
  
The zstd library (which this patch relies on) supports multithreaded  
compression since version 1.5. We however disallow that feature for now,  
as it might interfere with parallel backups on platforms that rely on  
threads (e.g. Windows). This can be improved / relaxed in the future.  
  
This also fixes a minor issue in InitDiscoverCompressFileHandle(), which  
was not updated to check if the file already has the .lz4 extension.  
  
Adding zstd compression was originally proposed in 2020 (see the second  
thread), but then was reworked to use the new compression API introduced  
in e9960732a9. I've considered both threads when compiling the list of  
reviewers.  
  
Author: Justin Pryzby  
Reviewed-by: Tomas Vondra, Jacob Champion, Andreas Karlsson  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/compress_io.c
A src/bin/pg_dump/compress_zstd.c
A src/bin/pg_dump/compress_zstd.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/tools/pginclude/cpluspluscheck
M src/tools/pgindent/typedefs.list

bufmgr: Add Pin/UnpinLocalBuffer()

commit   : 794f25944790ed0462cde3d6dc0f1ad02fcd6bba    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 10:42:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 10:42:17 -0700    

Click here for diff

So far these were open-coded in quite a few places, without a good reason.  
  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h

bufmgr: Add some more error checking [infrastructure] around pinning

commit   : 819b69a81d307e2ad8e9752cf062ebb57813960d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 10:42:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 10:42:17 -0700    

Click here for diff

This adds a few more assertions against a buffer being local in places we  
don't expect, and extracts the check for a buffer being pinned exactly once  
from LockBufferForCleanup() into its own function. Later commits will use this  
function.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: http://postgr.es/m/[email protected]  

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

Add smgrzeroextend(), FileZero(), FileFallocate()

commit   : 4d330a61bb1969df31f2cebfe1ba9d1d004346d8    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 10:06:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 10:06:39 -0700    

Click here for diff

smgrzeroextend() uses FileFallocate() to efficiently extend files by multiple  
blocks. When extending by a small number of blocks, use FileZero() instead, as  
using posix_fallocate() for small numbers of blocks is inefficient for some  
file systems / operating systems. FileZero() is also used as the fallback for  
FileFallocate() on platforms / filesystems that don't support fallocate.  
  
A big advantage of using posix_fallocate() is that it typically won't cause  
dirty buffers in the kernel pagecache. So far the most common pattern in our  
code is that we smgrextend() a page full of zeroes and put the corresponding  
page into shared buffers, from where we later write out the actual contents of  
the page. If the kernel, e.g. due to memory pressure or elapsed time, already  
wrote back the all-zeroes page, this can lead to doubling the amount of writes  
reaching storage.  
  
There are no users of smgrzeroextend() as of this commit. That will follow in  
future commits.  
  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: David Rowley <[email protected]>  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/include/storage/fd.h
M src/include/storage/md.h
M src/include/storage/smgr.h

Fix another issue with ENABLE/DISABLE TRIGGER on partitioned tables.

commit   : 4766eef3174b0b1bd8d2428381a7a33813386a6a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Apr 2023 12:56:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Apr 2023 12:56:29 -0400    

Click here for diff

In v13 and v14, the ENABLE/DISABLE TRIGGER USER variant malfunctioned  
on cloned triggers, failing to find the clones because it thought they  
were system triggers.  Other variants of ENABLE/DISABLE TRIGGER would  
improperly apply a superuserness check.  Fix by adjusting the is-it-  
a-system-trigger check to match reality in those branches.  (As far  
as I can find, this is the only place that got it wrong.)  
  
There's no such bug in v15/HEAD, because we revised the catalog  
representation of system triggers to be what this code was expecting.  
However, add the test case to these branches anyway, because this area  
is visibly pretty fragile.  Also remove an obsoleted comment.  
  
The recent v15/HEAD commit 6949b921d fixed a nearby bug.  I now see  
that my commit message for that was inaccurate: the behavior of  
recursing to clone triggers is older than v15, but it didn't apply  
to the case in v13/v14 because in those branches parent partitioned  
tables have no pg_trigger entries for foreign-key triggers.  But add  
the test case from that commit to v13/v14, just to show what is  
happening there.  
  
Per bug #17886 from DzmitryH.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Don't initialize page in {vm,fsm}_extend(), not needed

commit   : 3d6a98457d8e21d85bed86cfd3e1d1df1b260721    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 08:19:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Apr 2023 08:19:39 -0700    

Click here for diff

The read path needs to be able to initialize pages anyway, as relation  
extensions are not durable. By avoiding initializing pages, we can, in a  
future patch, extend the relation by multiple blocks at once.  
  
Using smgrextend() for {vm,fsm}_extend() is not a good idea in general, as at  
least one page of the VM/FSM will be read immediately after, always causing a  
cache miss, requiring us to read content we just wrote.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/visibilitymap.c
M src/backend/storage/freespace/freespace.c

Fix wrong word in comment.

commit   : 86a3fc7ec8a03bca7120894bababa7c734628b4c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 5 Apr 2023 09:50:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 5 Apr 2023 09:50:08 -0400    

Click here for diff

Reported by Peter Smith.  
  
Discussion: http://postgr.es/m/CAHut+Pt52ueOEAO-G5qeZiiPv1p9pBT_W5Vj3BTYfC8sD8LFxw@mail.gmail.com  

M src/backend/utils/init/usercontext.c

Update information_schema for SQL:2023

commit   : f275af8cb88e5a87b01467ad90704c945806d7dd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2023 09:47:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2023 09:47:07 +0200    

Click here for diff

This is mainly a light renumbering to match the sections in the  
standard.  
  
The comments for SQL_IMPLEMENTATION_INFO and SQL_SIZING are no longer  
applicable because the required information has been moved into part  
9.  

M src/backend/catalog/information_schema.sql

doc: Update error messages in RLS examples

commit   : 542b6347bf8876d89146097672c2c0128ad7c151    
  
author   : John Naylor <[email protected]>    
date     : Wed, 5 Apr 2023 14:16:19 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 5 Apr 2023 14:16:19 +0700    

Click here for diff

Since 8b9e9644d, the messages for failed permissions checks report  
"table" where appropriate, rather than "relation".  
  
Backpatch to all supported branches  

M doc/src/sgml/ddl.sgml

doc: Update SQL features/conformance information to SQL:2023

commit   : c9f57541d9705da44b9fbcb6e0c75dec3b41b57c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2023 08:55:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2023 08:55:44 +0200    

Click here for diff

Optional subfeatures have been changed to top-level features, so there  
is a bit of a churn in the list for that.  
  
Some existing functions have been added to the standard, so they are  
moved from the "other" to the "standard" lists in their sections.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/sql_features.txt
M src/include/catalog/catversion.h

Fix function reference in comment

commit   : fb6fad6ef1bb94b5bfde01a83951ad7eda7764bc    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 5 Apr 2023 09:06:32 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 5 Apr 2023 09:06:32 +0200    

Click here for diff

Commit a61b1f748 renamed ExecCheckRTEPerms to ExecCheckPermissions  
as part of a larger body of work, but missed this comment.  Fix by  
updating the referenced function name to make the comment the same  
as other occurrences.  
  
Author: Koshi Shibagaki <[email protected]>  
Discussion: https://postgr.es/m/OS3PR01MB653359ACBE8DBBE29EE2BC71FA909@OS3PR01MB6533.jpnprd01.prod.outlook.com  

M contrib/postgres_fdw/postgres_fdw.c

doc: Update SQL keywords list to SQL:2023

commit   : 1993f3feb74f30e71c4139ace66ccc1e0225b4a8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2023 07:55:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2023 07:55:28 +0200    

Click here for diff

Per previous convention (see  
ace397e9d24eddc56e7dffa921f506117b602d78), drop SQL:2011 and only keep  
the latest two standards and SQL-92.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/generate-keywords-table.pl
R088 doc/src/sgml/keywords/sql2011-02-nonreserved.txt doc/src/sgml/keywords/sql2023-02-nonreserved.txt
R086 doc/src/sgml/keywords/sql2011-02-reserved.txt doc/src/sgml/keywords/sql2023-02-reserved.txt
R100 doc/src/sgml/keywords/sql2011-09-nonreserved.txt doc/src/sgml/keywords/sql2023-09-nonreserved.txt
R100 doc/src/sgml/keywords/sql2011-09-reserved.txt doc/src/sgml/keywords/sql2023-09-reserved.txt
R086 doc/src/sgml/keywords/sql2011-14-nonreserved.txt doc/src/sgml/keywords/sql2023-14-nonreserved.txt
R100 doc/src/sgml/keywords/sql2011-14-reserved.txt doc/src/sgml/keywords/sql2023-14-reserved.txt

Fix minor signed/unsigned mixup

commit   : c209d317e9b818e25b30703c60113875acb73008    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2023 07:34:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Apr 2023 07:34:52 +0200    

Click here for diff

The chunk header is unsigned, and the output format takes unsigned, so  
casting it to signed in between is incorrect.  

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

meson: docs: Allow configuring simple/website style

commit   : 9d2a464a04846961ffa6b5f2c25b68bc2bf0af67    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 21:31:27 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 21:31:27 -0700    

Click here for diff

The meson docs generation hardcoded using the website style so far. Make it  
configurable via a meson option.  
  
Reviewed-by: Justin Pryzby <[email protected]>  
Reported-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml
M doc/src/sgml/meson.build
M meson_options.txt

docs: html: load stylesheet via custom.css.source

commit   : b8059bdf1ef8f7e215ec5010fcf6c3bd9c491eef    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 21:10:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 21:10:46 -0700    

Click here for diff

Until now the meson built docs did not have a working reference to the css  
stylesheet, it was copied in the make target. Instead of duplicating that for  
meson, use the docbook-xsl parameter custom.css.source to reference it. An  
additional benefit of that approach is that the stylesheet is now included in  
the single-file HTML documentation.  
  
Reported-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/Makefile
M doc/src/sgml/meson.build
M doc/src/sgml/stylesheet-html-common.xsl
M doc/src/sgml/stylesheet-html-nochunk.xsl
A doc/src/sgml/stylesheet.css.xml
M doc/src/sgml/stylesheet.xsl

docs: html: copy images to output as part of xslt build

commit   : 0012979d989fd1640ed17c32b303ebbd2294a3fc    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 21:05:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 21:05:52 -0700    

Click here for diff

Until now the meson built HTML docs had non-working references to images. They  
were copied in the make target. Instead of duplicating that for meson, copy  
them as part of the xslt stylesheet.  
  
Reported-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/Makefile
M doc/src/sgml/stylesheet-common.xsl
M doc/src/sgml/stylesheet.xsl

meson: add docs, docs_pdf options

commit   : ef07d351a1860a6e93c89cc7af3ae13366942bf0    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 21:29:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 21:29:39 -0700    

Click here for diff

Detect and report if the tools necessary to build documentation are available  
during configure. This is represented as two new options 'docs' and  
'docs_pdf', both defaulting to 'auto'.  
  
This should also fix a meson error about the installdocs target, when none of  
the doc tools are found.  
  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/ZB8331v5IhUA/[email protected]  

M doc/src/sgml/installation.sgml
M doc/src/sgml/meson.build
M meson.build
M meson_options.txt

meson: docs: Preparatory cleanups

commit   : 0ba827ecfc677cb449b3a370cf6613b4a770c4f8    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 20:50:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 20:50:43 -0700    

Click here for diff

These are just minor prerequisite changes for later commits. Kept separate for  
easier review.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/meson.build

commit   : 8df0d3d5303fa62d169985b8e68dbd40316010f1    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 5 Apr 2023 09:20:14 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 5 Apr 2023 09:20:14 +0530    

Click here for diff

Author: Kuroda Hayato  
Discussion: https://postgr.es/m/TYCPR01MB587073D91E372B8EF719931EF5929@TYCPR01MB5870.jpnprd01.prod.outlook.com  

M src/bin/pg_upgrade/t/001_basic.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

docs: Remove support for 'htmlhelp' format

commit   : d75c7fbaf94eab30c1f30db107237b64c3cf78e7    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 19:25:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 19:25:14 -0700    

Click here for diff

We had partial support for generating documentation suitable for .chm  
files. However, we only had wired up generating the input files using  
docbook-xsl, not generating an actual .chm file. Nor did we document how to do  
so.  Additionally, it was very slow to generate htmlhelp, as we never applied  
the docbook-xsl stylesheet performance improvements to htmlhelp.  
  
It doesn't look like there's any interest in the htmlhelp output, so remove  
it, instead of spending cycles to finish the support.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/Makefile
M doc/src/sgml/meson.build
D doc/src/sgml/stylesheet-hh.xsl

sequences: Lock buffer before initializing page

commit   : 3f695b31179b94a5eaa284ff588a983ff2dce932    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 16:38:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 4 Apr 2023 16:38:06 -0700    

Click here for diff

fill_seq_fork_with_data(), used to initialize a new sequence relation, only  
locked the buffer after calling PageInit(), even though PageInit() modifies  
page contents.  
  
This is unlikely to cause real-world issues, as the relation is exclusively  
locked at that point, and the buffer not yet marked dirty, so other processes  
should not access the buffer.  
  
This issue looks to have been present since the introduction of sequences in  
e8647c45d66a.  
  
Given the low risk, it does not seem worth backpatching the fix.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/sequence.c

doc: Add more details about pg_stat_get_xact_blocks_{fetched,hit}

commit   : e126d817c7af989c47366b0e344ee83d761f334a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Apr 2023 07:59:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Apr 2023 07:59:43 +0900    

Click here for diff

The explanation describing the dependency to system read() calls for  
these two functions has been removed in ddfc2d9.  And after more  
discussion about d69c404, we have concluded that adding more details  
makes them easier to understand.  
  
While on it, use the term "block read requests" (maybe found in cache)  
rather than "buffers fetched" and "buffer hits".  
  
Per discussion with Melanie Plageman, Kyotaro Horiguchi, Bertrand  
Drouvot and myself.  
  
Discussion: https://postgr.es/m/CAAKRu_ZmdiScT4q83OAbfmR5AH-L5zWya3SXjaxiJvhCob-e2A@mail.gmail.com  
Backpatch-through: 11  

M doc/src/sgml/monitoring.sgml

Fix MSVC warning introduced in ea1db8ae70.

commit   : 36320cbc164a8bc069f7a2d3990f47f5629f2020    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 4 Apr 2023 15:14:21 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 4 Apr 2023 15:14:21 -0700    

Click here for diff

Discussion: https://postgr.es/m/CA+hUKGJR1BhCORa5WdvwxztD3arhENcwaN1zEQ1Upg20BwjKWA@mail.gmail.com  
Reported-by: Thomas Munro  

M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c

Remove comment obsoleted by 11c2d6fd.

commit   : f303ec6210c4b858fd68531c92b8f0d490c91db5    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 5 Apr 2023 09:40:34 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 5 Apr 2023 09:40:34 +1200    

Click here for diff

Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/1604497.1680637072%40sss.pgh.pa.us  

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

Canonicalize ICU locale names to language tags.

commit   : ea1db8ae70e5f4ceaae34dc9c06a07d59aaa022e    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 4 Apr 2023 10:28:08 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 4 Apr 2023 10:28:08 -0700    

Click here for diff

Convert to BCP47 language tags before storing in the catalog, except  
during binary upgrade or when the locale comes from an existing  
collation or template database.  
  
The resulting language tags can vary slightly between ICU  
versions. For instance, "@colBackwards=yes" is converted to  
"und-u-kb-true" in older versions of ICU, and to the simpler (but  
equivalent) "und-u-kb" in newer versions.  
  
The process of canonicalizing to a language tag also understands more  
input locale string formats than ucol_open(). For instance,  
"fr_CA.UTF-8" is misinterpreted by ucol_open() and the region is  
ignored; effectively treating it the same as the locale "fr" and  
opening the wrong collator. Canonicalization properly interprets the  
language and region, resulting in the language tag "fr-CA", which can  
then be understood by ucol_open().  
  
This commit fixes a problem in prior versions due to ucol_open()  
misinterpreting locale strings as described above. For instance,  
creating an ICU collation with locale "fr_CA.UTF-8" would store that  
string directly in the catalog, which would later be passed to (and  
misinterpreted by) ucol_open(). After this commit, the locale string  
will be canonicalized to language tag "fr-CA" in the catalog, which  
will be properly understood by ucol_open(). Because this fix affects  
the resulting collator, we cannot change the locale string stored in  
the catalog for existing databases or collations; otherwise we'd risk  
corrupting indexes. Therefore, only canonicalize locales for  
newly-created (not upgraded) collations/databases. For similar  
reasons, do not backport.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

M doc/src/sgml/charset.sgml
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/utils/adt/pg_locale.c
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/include/utils/pg_locale.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Add a way to get the current function's OID in pl/pgsql.

commit   : d3d53f955cf6ad755ba3682577e0f6fa10106438    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Apr 2023 13:33:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Apr 2023 13:33:18 -0400    

Click here for diff

Invent "GET DIAGNOSTICS oid_variable = PG_ROUTINE_OID".  
This is useful for avoiding the maintenance nuisances that come  
with embedding a function's name in its body, as one might do  
for logging purposes for example.  Typically users would cast the  
result to regproc or regprocedure to get something human-readable,  
but we won't pre-judge whether that's appropriate.  
  
Pavel Stehule, reviewed by Kirk Wolak and myself  
  
Discussion: https://postgr.es/m/CAFj8pRA4zMd5pY-B89Gm64bDLRt-L+akOd34aD1j4PEstHHSVQ@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Add a run_as_owner option to subscriptions.

commit   : 482675987bcdffb390ae735cfd5f34b485ae97c6    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Apr 2023 12:03:03 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Apr 2023 12:03:03 -0400    

Click here for diff

This option is normally false, but can be set to true to obtain  
the legacy behavior where the subscription runs with the permissions  
of the subscription owner rather than the permissions of the  
table owner. The advantages of this mode are (1) it doesn't require  
that the subscription owner have permission to SET ROLE to each  
table owner and (2) since no role switching occurs, the  
SECURITY_RESTRICTED_OPERATION restrictions do not apply.  
  
On the downside, it allows any table owner to easily usurp  
the privileges of the subscription owner - basically, to take  
over their account. Because that's generally quite undesirable,  
we don't make this mode the default, but we do make it available,  
just in case the new behavior causes too many problems for someone.  
  
Discussion: http://postgr.es/m/CA+TgmoZ-WEeG6Z14AfH7KhmpX2eFh+tZ0z+vf0=eMDdbda269g@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/worker.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/regress/expected/subscription.out
A src/test/subscription/t/033_run_as_table_owner.pl

Perform logical replication actions as the table owner.

commit   : 1e10d49b65d6c26c61fee07999e4cd59eab2b765    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 4 Apr 2023 11:25:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 4 Apr 2023 11:25:23 -0400    

Click here for diff

Up until now, logical replication actions have been performed as the  
subscription owner, who will generally be a superuser.  Commit  
cec57b1a0fbcd3833086ba686897c5883e0a2afc documented hazards  
associated with that situation, namely, that any user who owns a  
table on the subscriber side could assume the privileges of the  
subscription owner by attaching a trigger, expression index, or  
some other kind of executable code to it. As a remedy, it suggested  
not creating configurations where users who are not fully trusted  
own tables on the subscriber.  
  
Although that will work, it basically precludes using logical  
replication in the way that people typically want to use it,  
namely, to replicate a database from one node to another  
without necessarily having any restrictions on which database  
users can own tables. So, instead, change logical replication to  
execute INSERT, UPDATE, DELETE, and TRUNCATE operations as the  
table owner when they are replicated.  
  
Since this involves switching the active user frequently within  
a session that is authenticated as the subscription user, also  
impose SECURITY_RESTRICTED_OPERATION restrictions on logical  
replication code. As an exception, if the table owner can SET  
ROLE to the subscription owner, these restrictions have no  
security value, so don't impose them in that case.  
  
Subscription owners are now required to have the ability to  
SET ROLE to every role that owns a table that the subscription  
is replicating. If they don't, replication will fail. Superusers,  
who normally own subscriptions, satisfy this property by default.  
Non-superusers users who own subscriptions will need to be  
granted the roles that own relevant tables.  
  
Patch by me, reviewed (but not necessarily in its entirety) by  
Jelte Fennema, Jeff Davis, and Noah Misch.  
  
Discussion: http://postgr.es/m/CA+TgmoaSCkg9ww9oppPqqs+9RVqCexYCE6Aq=UsYPfnOoDeFkw@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M src/backend/commands/tablecmds.c
M src/backend/replication/logical/worker.c
M src/backend/utils/init/Makefile
M src/backend/utils/init/meson.build
A src/backend/utils/init/usercontext.c
M src/include/commands/tablecmds.h
A src/include/utils/usercontext.h
M src/test/subscription/t/027_nosuperuser.pl

Add missing XML ID attributes

commit   : 3077324b03e81ab9894f1f510952273b78d98569    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2023 16:20:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Apr 2023 16:20:34 +0200    

Click here for diff

Author: Brar Piening <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/pgwalinspect.sgml

Code review for recent SQL/JSON commits

commit   : 71bfd1543f8b68e1013d3e8540b6b5aaf98e02e9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 4 Apr 2023 14:04:30 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 4 Apr 2023 14:04:30 +0200    

Click here for diff

- At the last minute and for no particularly good reason, I changed the  
  WITHOUT token to be marked especially for lookahead, from the one in  
  WITHOUT TIME to the one in WITHOUT UNIQUE.  Study of upcoming patches  
  (where a new WITHOUT ARRAY WRAPPER clause is added) showed me that the  
  former was better, so put it back the way the original patch had it.  
  
- update exprTypmod() for JsonConstructorExpr to return the typmod of  
  the RETURNING clause, as a comment there suggested.  Perhaps it's  
  possible for this to make a difference with datetime types, but I  
  didn't try to build a test case.  
  
- The nodeFuncs.c support code for new nodes was calling walker()  
  directly instead of the WALK() macro as introduced by commit 1c27d16e6e5c.  
  Modernize that.  Also add exprLocation() support for a couple of nodes  
  that missed it.  Lastly, reorder the code more sensibly.  
  
The WITHOUT_LA -> WITHOUT change means that stored rules containing  
either WITHOUT TIME ZONE or WITHOUT UNIQUE KEYS would change  
representation.  Therefore, bump catversion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parser.c
M src/include/catalog/catversion.h
M src/interfaces/ecpg/preproc/parser.c

bufmgr: Remove buffer-write-dirty tracepoints

commit   : 8a2b1b147728b11f6df569081d121b9e3135109d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 3 Apr 2023 18:02:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 3 Apr 2023 18:02:41 -0700    

Click here for diff

The trace point was using the relfileno / fork / block for the to-be-read-in  
buffer. Some upcoming work would make that more expensive to provide. We still  
have buffer-flush-start/done, which can serve most tracing needs that  
buffer-write-dirty could serve.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/probes.d

Make SP-GiST redirect cleanup more aggressive.

commit   : 05a304a855104a8eb6394e044bfbc8e761a4d635    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 3 Apr 2023 11:47:48 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 3 Apr 2023 11:47:48 -0700    

Click here for diff

Commit 61b313e4 made VACUUM pass down a heaprel to index AM bulkdelete  
and vacuumcleanup routines.  Although this was primarily intended as  
preparation for logical decoding on standbys, it also made it easy to  
correct an old deficiency in how we determine how to cleanup SP-GiST  
redirect and placeholder tuples.  
  
Pass the heaprel to GlobalVisTestFor() during cleanup of redirect and  
placeholder tuples, rather than pessimistically passing NULL.  
  
Author: Bertrand Drouvot <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/spgist/spgvacuum.c

Recycle deleted nbtree pages more aggressively.

commit   : e48c817395e1cdc85dbecc4ff3c18e34983ae3f2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 3 Apr 2023 11:31:43 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 3 Apr 2023 11:31:43 -0700    

Click here for diff

Commit 61b313e4 made nbtree consistently pass down a heaprel to low  
level routines like _bt_getbuf().  Although this was primarily intended  
as preparation for logical decoding on standbys, it also made it easy to  
correct an old deficiency in how nbtree VACUUM determines whether or not  
it's now safe to recycle deleted pages.  
  
Pass the heaprel to GlobalVisTestFor() in nbtree routines that deal with  
recycle safety.  nbtree now makes less pessimistic assumptions about  
recycle safety within non-catalog relations.  This enhancement  
complements the recycling enhancement added by commit 9dd963ae25.  
  
nbtree remains just as pessimistic as ever when it comes to recycle  
safety within indexes on catalog relations.  There is no fundamental  
reason why we need to treat catalog relations differently, though.  The  
behavioral inconsistency is a consequence of the way that nbtree uses  
nextXID values to implement what Lanin and Shasha call "the drain  
technique".  Note in particular that it has nothing to do with whether  
or not index tuples might still be required for an older MVCC snapshot.  
  
Author: Bertrand Drouvot <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkaiDxCje0yPuH=3Uh2p1V_2pFGY==xfbZoZu7Ax_NB8g@mail.gmail.com  

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

Move heaprel struct field next to index rel field.

commit   : a349b86603e11bad811bec111ec5330b9908e525    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 3 Apr 2023 11:01:11 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 3 Apr 2023 11:01:11 -0700    

Click here for diff

Commit 61b313e4 added a heaprel struct member to IndexVacuumInfo, but  
placed it last.  Move the heaprel struct member next to the index struct  
member to improve the code's readability.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznG=TV6S9d3VA=y0vBHbXwnLs9_LLdiML=aNJuHeriwxg@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuumparallel.c
M src/include/access/genam.h

Fix possible logical replication crash.

commit   : e7e7da2f8d57bbe6c8fb463a9eec51486000ba2e    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2023 13:11:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 3 Apr 2023 13:11:00 -0400    

Click here for diff

Commit c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6 added a new  
password_required option but forgot that you need database access  
to check whether an arbitrary role ID is a superuser.  
  
Report and patch by Hou Zhijie. I added a comment. Thanks to  
Alexander Lakhin for devising a way to reproduce the crash.  
  
Discussion: http://postgr.es/m/OS0PR01MB5716BFD7EC44284C89F40808948F9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

When using valgrind, log the current query after an error is detected.

commit   : a8a00124f1ddb9c8506ff75317f6dd64cc480e61    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Apr 2023 10:18:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Apr 2023 10:18:38 -0400    

Click here for diff

In USE_VALGRIND builds, add code to print the text of the current query  
to the valgrind log whenever the valgrind error count has increased  
during the query.  Valgrind will already have printed its report,  
if the error is distinct from ones already seen, so that this works  
out fairly well as a way of annotating the log.  
  
Onur Tirtir and Tom Lane  
  
Discussion: https://postgr.es/m/AM9PR83MB0498531E804DC8DF8CFF0E8FE9D09@AM9PR83MB0498.EURPRD83.prod.outlook.com  

M src/backend/tcop/postgres.c

Revert 764da7710b

commit   : b0b91ced167f02ced4adaf1b2ecdc6fa0f6eb6e9    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 3 Apr 2023 16:55:09 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 3 Apr 2023 16:55:09 +0300    

Click here for diff

Discussion: https://postgr.es/m/20230323003003.plgaxjqahjgkuxrk%40awork3.anarazel.de  

M src/backend/executor/nodeModifyTable.c

Revert 11470f544e

commit   : 2b65bf046d8a23be25502638da77a1592da2548d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 3 Apr 2023 16:54:31 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 3 Apr 2023 16:54:31 +0300    

Click here for diff

Discussion: https://postgr.es/m/20230323003003.plgaxjqahjgkuxrk%40awork3.anarazel.de  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/tableam.h
M src/include/executor/tuptable.h
M src/tools/pgindent/typedefs.list

Rename BufferAccessStrategyData.ring_size to nbuffers

commit   : 8d928e3a9fe7577e7abf2388b60cc67ed94f6d24    
  
author   : David Rowley <[email protected]>    
date     : Mon, 3 Apr 2023 23:31:16 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 3 Apr 2023 23:31:16 +1200    

Click here for diff

The new name better reflects what the field is - the size of the buffers[]  
array.  ring_size sounded more like it is in units of bytes.  
  
An upcoming commit allows a BufferAccessStrategy of custom sizes, so it  
seems relevant to improve this beforehand.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAAKRu_YefVbhg4rAxU2frYFdTap61UftH-kUNQZBvAs%2BYK81Zg%40mail.gmail.com  

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

Disable vacuum's use of a buffer access strategy during failsafe

commit   : 4830f102432518d06b50f61e0ab4c0c07082617b    
  
author   : David Rowley <[email protected]>    
date     : Mon, 3 Apr 2023 23:05:58 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 3 Apr 2023 23:05:58 +1200    

Click here for diff

Traditionally, vacuum always makes use of a buffer access strategy 32  
buffers in size.  This means that running vacuums tend not to cause too  
many shared buffers to become dirty, however, this can cause vacuums to  
run much more slowly than they otherwise could as WAL flushes will occur  
more frequently due to having to flush WAL out to the LSN of the dirty  
page before that page can be written to disk.  
  
When we are performing failsafe VACUUMs (as added in 1e55e7d17), we really  
want to make the vacuum work go as quickly as possible, so here we disable  
the buffer access strategy when entering failsafe mode while vacuuming a  
relation.  
  
Per idea and analyis from Andres Freund.  
  
In passing, also include some changes I had intended for 32fbe0239.  
  
Author: Melanie Plageman  
Reviewed-by: Justin Pryzby, David Rowley  
Discussion: https://postgr.es/m/20230111182720.ejifsclfwymw2reb%40awork3.anarazel.de  

M doc/src/sgml/config.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c

Fix typo in CI README

commit   : 525fb0a171a60ddea94c1953e24abef1da358888    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 3 Apr 2023 10:50:17 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 3 Apr 2023 10:50:17 +0200    

Click here for diff

s/fron/from/  

M src/tools/ci/README

Only make buffer strategy for vacuum when it's likely needed

commit   : 32fbe0239b03d868744758d5809eaf74f19c924d    
  
author   : David Rowley <[email protected]>    
date     : Mon, 3 Apr 2023 19:19:45 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 3 Apr 2023 19:19:45 +1200    

Click here for diff

VACUUM FULL and VACUUM ONLY_DATABASE_STATS will not use the vacuum  
strategy ring created in vacuum(), so don't waste effort making it in  
those cases.  
  
There are other conceivable cases where the buffer strategy also won't be  
used, but those are probably less common and not worth troubling over too  
much.  For example VACUUM (PROCESS_MAIN false, PROCESS_TOAST false).  
There are other cases too, but many of these are only discovered once  
inside vacuum_rel().  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAAKRu_ZLRuzkM3zKogiZAz2hUony37yLY4aaLb8fPf8fgqs5Og@mail.gmail.com  

M src/backend/commands/vacuum.c

pg_basebackup: Correct type of WalSegSz

commit   : 1980d3585e3c7fce74b811ca8d77733036cae76c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2023 07:13:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Apr 2023 07:13:52 +0200    

Click here for diff

The pg_basebackup code had WalSegSz as uint32, whereas the rest of the  
code has it as int.  This seems confusing, and using the extra range  
wouldn't actually work.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/1bf15c7a-0acd-1864-081e-7a28814310fe%40enterprisedb.com  

M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h

Remove some global variables from vacuum.c

commit   : 3f476c953495e4d52a1ac776f976df16964ba592    
  
author   : David Rowley <[email protected]>    
date     : Mon, 3 Apr 2023 15:07:25 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 3 Apr 2023 15:07:25 +1200    

Click here for diff

Using global variables because we don't want to pass these values around  
as parameters does not really seem like a great idea, so let's remove  
these two global variables and adjust a few functions to accept these  
values as parameters instead.  
  
This is part of a wider patch which intends to allow the size of the  
buffer access strategy that vacuum uses to be adjusted.  
  
Author: Melanie Plageman  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/CAAKRu_b1q_07uquUtAvLqTM%3DW9nzee7QbtzHwA4XdUo7KX_Cnw%40mail.gmail.com  

M src/backend/commands/vacuum.c

Doc: update pgindent/README.

commit   : 2e6ba13152624a837b67996eadfc58e75126071f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2023 20:01:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Apr 2023 20:01:34 -0400    

Click here for diff

I missed updating this when we pulled pg_bsd_indent into the tree.  

M src/tools/pgindent/README

Add info in WAL records in preparation for logical slot conflict handling

commit   : 6af1793954e8c5e753af83c3edb37ed3267dd179    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 2 Apr 2023 12:32:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 2 Apr 2023 12:32:19 -0700    

Click here for diff

This commit only implements one prerequisite part for allowing logical  
decoding. The commit message contains an explanation of the overall design,  
which later commits will refer back to.  
  
Overall design:  
  
1. We want to enable logical decoding on standbys, but replay of WAL  
from the primary might remove data that is needed by logical decoding,  
causing error(s) on the standby. To prevent those errors, a new replication  
conflict scenario needs to be addressed (as much as hot standby does).  
  
2. Our chosen strategy for dealing with this type of replication slot  
is to invalidate logical slots for which needed data has been removed.  
  
3. To do this we need the latestRemovedXid for each change, just as we  
do for physical replication conflicts, but we also need to know  
whether any particular change was to data that logical replication  
might access. That way, during WAL replay, we know when there is a risk of  
conflict and, if so, if there is a conflict.  
  
4. We can't rely on the standby's relcache entries for this purpose in  
any way, because the startup process can't access catalog contents.  
  
5. Therefore every WAL record that potentially removes data from the  
index or heap must carry a flag indicating whether or not it is one  
that might be accessed during logical decoding.  
  
Why do we need this for logical decoding on standby?  
  
First, let's forget about logical decoding on standby and recall that  
on a primary database, any catalog rows that may be needed by a logical  
decoding replication slot are not removed.  
  
This is done thanks to the catalog_xmin associated with the logical  
replication slot.  
  
But, with logical decoding on standby, in the following cases:  
  
- hot_standby_feedback is off  
- hot_standby_feedback is on but there is no a physical slot between  
  the primary and the standby. Then, hot_standby_feedback will work,  
  but only while the connection is alive (for example a node restart  
  would break it)  
  
Then, the primary may delete system catalog rows that could be needed  
by the logical decoding on the standby (as it does not know about the  
catalog_xmin on the standby).  
  
So, it’s mandatory to identify those rows and invalidate the slots  
that may need them if any. Identifying those rows is the purpose of  
this commit.  
  
Implementation:  
  
When a WAL replay on standby indicates that a catalog table tuple is  
to be deleted by an xid that is greater than a logical slot's  
catalog_xmin, then that means the slot's catalog_xmin conflicts with  
the xid, and we need to handle the conflict. While subsequent commits  
will do the actual conflict handling, this commit adds a new field  
isCatalogRel in such WAL records (and a new bit set in the  
xl_heap_visible flags field), that is true for catalog tables, so as to  
arrange for conflict handling.  
  
The affected WAL records are the ones that already contain the  
snapshotConflictHorizon field, namely:  
  
- gistxlogDelete  
- gistxlogPageReuse  
- xl_hash_vacuum_one_page  
- xl_heap_prune  
- xl_heap_freeze_page  
- xl_heap_visible  
- xl_btree_reuse_page  
- xl_btree_delete  
- spgxlogVacuumRedirect  
  
Due to this new field being added, xl_hash_vacuum_one_page and  
gistxlogDelete do now contain the offsets to be deleted as a  
FLEXIBLE_ARRAY_MEMBER. This is needed to ensure correct alignment.  
It's not needed on the others struct where isCatalogRel has  
been added.  
  
This commit just introduces the WAL format changes mentioned above. Handling  
the actual conflicts will follow in future commits.  
  
Bumps XLOG_PAGE_MAGIC as the several WAL records are changed.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Author: Andres Freund <[email protected]> (in an older version)  
Author: Amit Khandekar <[email protected]>  (in an older version)  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Fabrízio de Royes Mello <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  

M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/spgist/spgvacuum.c
M src/include/access/gistxlog.h
M src/include/access/hash_xlog.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtxlog.h
M src/include/access/spgxlog.h
M src/include/access/visibilitymapdefs.h
M src/include/access/xlog_internal.h
M src/include/utils/rel.h

Fix copy-pasto in contrib/auth_delay/meson.build variable name.

commit   : ab73291d263049f00a394b37940ed197616fc3f8    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 2 Apr 2023 09:31:10 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 2 Apr 2023 09:31:10 -0700    

Click here for diff

M contrib/auth_delay/meson.build

Use PG_TEST_TIMEOUT_DEFAULT in 019_replslot_limit.pl.

commit   : eaa1dd131ca0a4c8e221cd60cdfc69aa0f7efe42    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 2 Apr 2023 09:31:09 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 2 Apr 2023 09:31:09 -0700    

Click here for diff

Oversight in f2698ea02ca8a56f38935d2b300ac54936712558, which introduced  
the variable.  This lowers some 1000s timeouts to the configurable  
default of 180s, due to a lack of evidence for needing the longer  
timeout.  The alternative was 6*PG_TEST_TIMEOUT_DEFAULT, which we can  
adopt if the need arises.  Given the lack of observed trouble with these  
timeouts, no back-patch.  

M src/test/recovery/t/019_replslot_limit.pl

Pass down table relation into more index relation functions

commit   : 61b313e47eb987682441c675724c22bf4363c9c4    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 1 Apr 2023 20:12:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 1 Apr 2023 20:12:26 -0700    

Click here for diff

This is done in preparation for logical decoding on standby, which needs to  
include whether visibility affecting WAL records are about a (user) catalog  
table. Which is only known for the table, not the indexes.  
  
It's also nice to be able to pass the heap relation to GlobalVisTestFor() in  
vacuumRedirectAndPlaceholder().  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistutil.c
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/vacuumlazy.c
M src/backend/access/heap/visibilitymap.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/access/spgist/spgvacuum.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuumparallel.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/access/genam.h
M src/include/access/gist_private.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtree.h
M src/include/utils/tuplesort.h

Assert only valid flag bits are passed to visibilitymap_set()

commit   : a88a18b1250b9e6b40536e4dec04d32d655b8140    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 1 Apr 2023 17:55:33 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 1 Apr 2023 17:55:33 -0700    

Click here for diff

If visibilitymap_set() is called with flags containing a higher bit than  
VISIBILITYMAP_ALL_FROZEN, the state of neighboring pages is affected. While  
there was an assertion that *some* valid bits were set, it did not check  
that *only* valid bits were. Change that.  
  
Discussion: https://postgr.es/m/[email protected]  

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

hio: Release extension lock before initializing page / pinning VM

commit   : 14f98e0af996beff561f66d7436c6da5d2de524d    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 1 Apr 2023 17:50:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 1 Apr 2023 17:50:18 -0700    

Click here for diff

PageInit() while holding the extension lock is unnecessary after 0d1fe9f74e3  
started to use RBM_ZERO_AND_LOCK - nobody can look at the new page before we  
release the page lock. PageInit() zeroes the page, which isn't that cheap, so  
deferring it until after the extension lock is released seems like a good idea.  
  
Doing visibilitymap_pin() while holding the extension lock, introduced in  
7db0cd2145f2, looks like an accident. Due to the restrictions on  
HEAP_INSERT_FROZEN it's unlikely to be a performance issue, but it still seems  
better to move it out.  We also are doing the visibilitymap_pin() while  
holding the buffer lock, which will be fixed in a separate commit.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: http://postgr.es/m/[email protected]  

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

pg_dump: Use only LZ4 frame format for compression

commit   : 0070b66fef21e909adb283f7faa7b1978836ad75    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 1 Apr 2023 00:54:17 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 1 Apr 2023 00:54:17 +0200    

Click here for diff

After 0da243fed0 got committed, it was reported that in some cases the  
compression ratio is rather poor - particularly for custom format with  
narrow tables - due to writing the LZ4 header/footer for each row.  
  
This commit switches to LZ4F (LZ4 frame format), eliminating most of the  
overhead and greatly improving the compression ratio. This makes the  
compressed size about the same for plain and custom formats (just like  
for gzip, for example).  
  
LZ4F is now used by both compression APIs, which allowed refactoring and  
reusing more of the code. For consistency this also renames the LZ4File  
struct to LZ4State, and a number of functions are now prefixed with  
LZ4Stream_ (instead of LZ4File_).  
  
Patch by Georgios Kokolatos, based on report and initial patch by Justin  
Pryzby. Review and minor cleanups by me.  
  
Author: Georgios Kokolatos, Justin Pryzby  
Reported-by: Justin Pryzby  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/20230227044910.GO1653%40telsasoft.com  

M src/bin/pg_dump/compress_lz4.c

Doc: add Buffer Access Strategy to the glossary

commit   : c8f8d0eb1868cc88d481518d2b6aa0767116055c    
  
author   : David Rowley <[email protected]>    
date     : Sat, 1 Apr 2023 10:41:27 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 1 Apr 2023 10:41:27 +1300    

Click here for diff

It seems useful to add this to the glossary as there's discussion around  
adding an option to VACUUM to disable and adjust the size of the buffer  
access strategy that VACUUM uses.  
  
Author: Melanie Plageman  
Reviewed-by: Justin Pryzby, David Rowley  
Discussion: https://postgr.es/m/ZBYDTrD1kyGg%2BHkS%40telsasoft.com  

M doc/src/sgml/glossary.sgml

Add show_data option to pg_get_wal_block_info.

commit   : df4f3ab51730a4cdddfead0b264d394ee4925723    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 31 Mar 2023 14:02:52 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 31 Mar 2023 14:02:52 -0700    

Click here for diff

Allow users to opt out of returning FPI data and block data from  
pg_get_wal_block_info as an optimization.  Testing has shown that this  
can make function execution over twice as fast in some cases.  
  
When pg_get_wal_block_info is called with "show_data := false", it  
always returns NULL values for its block_data and block_fpi_data bytea  
output parameters.  Nothing else changes.  In particular, the function  
will still return the usual per-block summary of block data/FPI space  
overhead.  Use of "show_data := false" is therefore feasible with all  
queries that don't specifically require these raw binary strings.  
  
Follow-up to recent work in commit 122376f0.  There still hasn't been a  
stable release with the pg_get_wal_block_info function, so no bump in  
the pg_walinspect extension version.  
  
Per suggestion from Melanie Plageman.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_bJvbcYBRj2cN6G2xV7B7-Ja+pjTO1nEnEhRR8OXYiABA@mail.gmail.com  
Discussion: https://postgr.es/m/CAH2-Wzm9shOkEDM10_+qOZkRSQhKVxwBFiehH6EHWQQRd_rDPw@mail.gmail.com  

M contrib/pg_walinspect/expected/oldextversions.out
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/pg_walinspect–1.0–1.1.sql
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/pgwalinspect.sgml

SQL/JSON: support the IS JSON predicate

commit   : 6ee30209a6f161d0a267a33f090c70c579c87c00    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 31 Mar 2023 22:34:04 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 31 Mar 2023 22:34:04 +0200    

Click here for diff

This patch introduces the SQL standard IS JSON predicate. It operates  
on text and bytea values representing JSON, as well as on the json and  
jsonb types. Each test has IS and IS NOT variants and supports a WITH  
UNIQUE KEYS flag. The tests are:  
  
IS JSON [VALUE]  
IS JSON ARRAY  
IS JSON OBJECT  
IS JSON SCALAR  
  
These should be self-explanatory.  
  
The WITH UNIQUE KEYS flag makes these return false when duplicate keys  
exist in any object within the value, not necessarily directly contained  
in the outermost object.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Amit Langote <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/CAF4Au4w2x-5LTnN_bxky-mq4=WOqsGsxSpENCzHRAzSnEd8+WQ@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  

M doc/src/sgml/func.sgml
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/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/executor/execExpr.h
M src/include/nodes/makefuncs.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/json.h
M src/include/utils/jsonfuncs.h
M src/interfaces/ecpg/test/expected/sql-sqljson.c
M src/interfaces/ecpg/test/expected/sql-sqljson.stderr
M src/interfaces/ecpg/test/expected/sql-sqljson.stdout
M src/interfaces/ecpg/test/sql/sqljson.pgc
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Further tweaking of width_bucket() edge cases.

commit   : a2a0c7c29e47f39da905577659e66b0086b769cc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2023 16:29:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2023 16:29:55 -0400    

Click here for diff

I realized that the third overflow case I posited in commit b0e9e4d76  
actually should be handled in a different way: rather than tolerating  
the idea that the quotient could round to 1, we should clamp so that  
the output cannot be more than "count" when we know that the operand is  
less than bound2.  That being the case, we don't need an overflow-aware  
increment in that code path, which leads me to revert the movement of  
the pg_add_s32_overflow() call.  (The diff in width_bucket_float8  
might be easier to read by comparing against b0e9e4d76^.)  
  
What's more, width_bucket_numeric also has this problem of the quotient  
potentially rounding to 1, so add a clamp there too.  
  
As before, I'm not quite convinced that a back-patch is warranted.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

Reject system columns as elements of foreign keys.

commit   : f0d65c0eaf05d6acd3ae05cde4a31465eb3992b2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2023 11:18:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2023 11:18:49 -0400    

Click here for diff

Up through v11 it was sensible to use the "oid" system column as  
a foreign key column, but since that was removed there's no visible  
usefulness in making any of the remaining system columns a foreign  
key.  Moreover, since the TupleTableSlot rewrites in v12, such cases  
actively fail because of implicit assumptions that only user columns  
appear in foreign keys.  The lack of complaints about that seems  
like good evidence that no one is trying to do it.  Hence, rather  
than trying to repair those assumptions (of which there are at least  
two, maybe more), let's just forbid the case up front.  
  
Per this patch, a system column in either the referenced or  
referencing side of a foreign key will draw this error; however,  
putting one in the referenced side would have failed later anyway,  
since we don't allow unique indexes to be made on system columns.  
  
Per bug #17877 from Alexander Lakhin.  Back-patch to v12; the  
case still appears to work in v11, so we shouldn't break it there.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Ensure acquire_inherited_sample_rows sets its output parameters.

commit   : c2d7d679c1220af77023413b031902afe4d2fdd1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2023 10:08:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Mar 2023 10:08:40 -0400    

Click here for diff

The totalrows/totaldeadrows outputs were left uninitialized in cases  
where we find no analyzable child tables of a partitioned table.  This  
could lead to setting the partitioned table's pg_class.reltuples value  
to garbage.  It's not clear that that would have any very bad effects  
in practice, but fix it anyway because it's making valgrind unhappy.  
  
Reported and diagnosed by Alexander Lakhin (bug #17880).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/analyze.c

pg_regress: Emit TAP compliant output

commit   : 558fff0adfa02b6db6b003c64cca75e55f5187e2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 31 Mar 2023 13:00:02 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 31 Mar 2023 13:00:02 +0200    

Click here for diff

This converts pg_regress output format to emit TAP compliant output  
while keeping it as human readable as possible for use without TAP  
test harnesses. As verbose harness related information isn't really  
supported by TAP this also reduces the verbosity of pg_regress runs  
which makes scrolling through log output in buildfarm/CI runs a bit  
easier as well.  
  
As the meson TAP parser conumes whitespace, the leading indentation  
for differentiating parallel tests from sequential tests has been  
changed to a single character prefix.  
  
This patch has been around for an extended period of time, reviewers  
listed below may have been involved in reviewing a version quite  
different from the version in this commit.  The original idea for  
this patch was a hacking session with Jinbao Chen.  
  
TAP format testing is also enabled in meson as of this.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Nikolay Shaplov <[email protected]>  
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/regress.sgml
M meson.build
M src/Makefile.global.in
M src/test/regress/pg_regress.c

Move ExecEvalJsonConstructor new function to a more natural place

commit   : 9b058f6b0d9c3d1ccde4d51a72bf15ce731973a1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 31 Mar 2023 12:55:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 31 Mar 2023 12:55:25 +0200    

Click here for diff

Commit 7081ac46ace8 put it at the end of the file, but that doesn't look  
very nice.  

M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h

No need to add FORMAT to the keyword precedence list

commit   : 47a97098467fda56b497049430d0949f3a7dde01    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 31 Mar 2023 11:14:43 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 31 Mar 2023 11:14:43 +0200    

Click here for diff

Commit 7081ac46ace8 put it there.  Remove it.  

M src/backend/parser/gram.y

Add XML ID attributes to create_publication.sgml.

commit   : ed94e8563e036f3b42519f1c3b5ae1361e2a59bf    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 31 Mar 2023 08:59:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 31 Mar 2023 08:59:55 +0530    

Click here for diff

This commit adds XML ID attributes to all varlistentries in  
create_publication.sgml. This allows us to include links to refer to  
publication options, making documents more readable.  
  
Author: Kuroda Hayato  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/TYAPR01MB58668219FEA4EC231486A433F58E9@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/system-views.sgml

Bump PGSTAT_FILE_FORMAT_ID, omitted in 8aaa04b32d7

commit   : f95c1cd6b2fd7d70e219ea8c5fabf2c0a75d7705    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 19:44:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 19:44:40 -0700    

Click here for diff

I forgot to do so in the referenced commit. While the consequences of omitting  
the version change are likely to be harmless (besides discarding stats, as a  
PGSTAT_FILE_FORMAT_ID bump also does), it still seems worth doing.  

M src/include/pgstat.h

Track shared buffer hits in pg_stat_io

commit   : 8aaa04b32d790da595684de58ae4fc2db96becff    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 19:22:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 19:22:40 -0700    

Click here for diff

Among other things, this should make it easier to calculate a useful cache hit  
ratio by excluding buffer reads via buffer access strategies. As buffer access  
strategies reuse buffers (and thus evict the prior buffer contents), it is  
normal to see reads on repeated scans of the same data.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Bertrand Drouvot <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_beMa9Hzih40%3DXPYqhDVz6tsgUGTrhZXRo%3Dunp%2Bszb%3DUA%40mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/pgstatfuncs.c
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

Fix List memory issue in transformColumnDefinition

commit   : 6c3b697b19db6274da622cf0fe7a7ad32eeeced3    
  
author   : David Rowley <[email protected]>    
date     : Fri, 31 Mar 2023 12:13:05 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 31 Mar 2023 12:13:05 +1300    

Click here for diff

When calling generateSerialExtraStmts(), we would pass in the  
constraint->options.  In some cases, generateSerialExtraStmts() would  
modify the referenced List to remove elements from it, but doing so is  
invalid without assigning the list back to all variables that point to it.  
In the particular reported problem case, the List became empty, in which  
cases it became NIL, but the passed in constraint->options didn't get to  
find out about that and was left pointing to free'd memory.  
  
To fix this, just perform a list_copy() inside generateSerialExtraStmts().  
We could just do a list_copy() just before we perform the delete from the  
list, however, that seems less robust.  Let's make sure the generated  
CreateSeqStmt gets a completely different copy of the list to be safe.  
  
Bug: #17879  
Reported-by: Fei Changhong  
Diagnosed-by: Fei Changhong  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11, all supported versions  

M src/backend/parser/parse_utilcmd.c

Parallel Hash Full Join.

commit   : 11c2d6fdf5af1aacec9ca2005543f1b0fc4cc364    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 31 Mar 2023 11:01:51 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 31 Mar 2023 11:01:51 +1300    

Click here for diff

Full and right outer joins were not supported in the initial  
implementation of Parallel Hash Join because of deadlock hazards (see  
discussion).  Therefore FULL JOIN inhibited parallelism, as the other  
join strategies can't do that in parallel either.  
  
Add a new PHJ phase PHJ_BATCH_SCAN that scans for unmatched tuples on  
the inner side of one batch's hash table.  For now, sidestep the  
deadlock problem by terminating parallelism there.  The last process to  
arrive at that phase emits the unmatched tuples, while others detach and  
are free to go and work on other batches, if there are any, but  
otherwise they finish the join early.  
  
That unfairness is considered acceptable for now, because it's better  
than no parallelism at all.  The build and probe phases are run in  
parallel, and the new scan-for-unmatched phase, while serial, is usually  
applied to the smaller of the two relations and is either limited by  
some multiple of work_mem, or it's too big and is partitioned into  
batches and then the situation is improved by batch-level parallelism.  
  
Author: Melanie Plageman <[email protected]>  
Author: Thomas Munro <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BA6ftXPz4oe92%2Bx8Er%2BxpGZqto70-Q_ERwRaSyA%3DafNg%40mail.gmail.com  

M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/optimizer/path/joinpath.c
M src/include/executor/hashjoin.h
M src/include/executor/nodeHash.h
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

pg_stat_wal: Accumulate time as instr_time instead of microseconds

commit   : ca7b3c4c00042038ba9c282c4807e05c0a527e42    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 14:23:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 14:23:14 -0700    

Click here for diff

In instr_time.h it is stated that:  
  
* When summing multiple measurements, it's recommended to leave the  
* running sum in instr_time form (ie, use INSTR_TIME_ADD or  
* INSTR_TIME_ACCUM_DIFF) and convert to a result format only at the end.  
  
The reason for that is that converting to microseconds is not cheap, and can  
loose precision.  Therefore this commit changes 'PendingWalStats' to use  
'instr_time' instead of 'PgStat_Counter' while accumulating 'wal_write_time'  
and 'wal_sync_time'.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/storage/file/buffile.c
M src/backend/utils/activity/pgstat_wal.c
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

Show record information in pg_get_wal_block_info.

commit   : 122376f028a0e31b91d6c6bad2a9a6e994708547    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 30 Mar 2023 12:26:12 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 30 Mar 2023 12:26:12 -0700    

Click here for diff

Expand the output parameters in pg_walinspect's pg_get_wal_block_info  
function to return additional information that was previously only  
available from pg_walinspect's pg_get_wal_records_info function.  Some  
of the details are attributed to individual block references, rather  
than aggregated into whole-record values, since the function returns one  
row per block reference per WAL record (unlike pg_get_wal_records_info,  
which always returns one row per WAL record).  
  
This structure is much easier to work with when writing queries that  
track how individual blocks changed over time, or when attributing costs  
to individual blocks (not WAL records) is useful.  
  
This is the second time that pg_get_wal_block_info has been enhanced in  
recent weeks.  Commit 9ecb134a expanded on the original version of the  
function added in commit c31cf1c0 (where it first appeared under the  
name pg_get_wal_fpi_info).  There still hasn't been a stable release  
since commit c31cf1c0, so no bump in the pg_walinspect extension  
version.  
  
Author: Bharath Rupireddy <[email protected]>  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Reviewed-By: Kyotaro HORIGUCHI <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACVRK5=Z+2ZVsjgTTSkfEnQzCuwny7iigpG7g1btk4Ws2A@mail.gmail.com  

M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/pg_walinspect–1.0–1.1.sql
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/pgwalinspect.sgml

Simplify transformJsonAggConstructor() API

commit   : 63cc20205c1a0022d808a783b3025029bb09101e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Mar 2023 21:07:24 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Mar 2023 21:07:24 +0200    

Click here for diff

There's no need for callers to pass aggregate names so that the function  
can resolve them to OIDs, when callers can just pass aggregate OIDs  
directly to begin with.  

M src/backend/parser/parse_expr.c

Fix inconsistencies and style issues in new SQL/JSON code

commit   : 60966f56c3e4db9f9bdff485371ef3a50d53431f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Mar 2023 21:05:35 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Mar 2023 21:05:35 +0200    

Click here for diff

Reported by Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h

Fix setrefs.c code for adjusting partPruneInfos

commit   : 589bb816499e98b60aa5c406c409fb27b42b0e39    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Mar 2023 13:24:09 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Mar 2023 13:24:09 +0200    

Click here for diff

We were transferring partPruneInfos from PlannerInfo into PlannerGlobal  
wrong, essentially relying on all of them being transferred, and  
adjusting their list indexes based on that.  But apparently it's  
possible that some of them are skipped, so that strategy leads to a  
corrupted execution tree.  Instead, adjust each Append/MergeAppend's  
partpruneinfo index as we copy from one list to the other, which seems  
safer anyway.  This requires adjusting the RT offset of the RTE  
referenced in each partPruneInfo ahead of actually adjusting the RTE  
itself, which seems a bit too ad-hoc.  
  
This problem was introduced by commit ec386948948c.  However, it may be  
that we no longer require the change introduced there, so perhaps we  
should revert both the present commit and that one.  
  
Problem noticed by sqlsmith.  
  
Author: Amit Langote <[email protected]  
Discussion: https://postgr.es/m/CA+HiwqG6tbc2oadsbyyy24b2AL295XHQgyLRWghmA7u_SL1K8A@mail.gmail.com  

M src/backend/optimizer/plan/setrefs.c

Fix format code in fd.c debugging infrastructure

commit   : f9054b7a7cd47b93d6a59f15994ce72c51fe1e04    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 09:50:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 09:50:18 -0700    

Click here for diff

These were not sufficiently adjusted in 2d4f1ba6cfc.  

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

bufmgr: Fix undefined behaviour with, unrealistically, large temp_buffers

commit   : 558cf803876874c55d637a1e87417fa1c670efe1    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 09:50:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Mar 2023 09:50:18 -0700    

Click here for diff

Quoting Melanie:  
> Since if buffer is INT_MAX, then the -(buffer + 1) version invokes  
> undefined behavior while the -buffer - 1 version doesn't.  
  
All other places were already using the correct version. I (Andres), copied  
the code into more places in a patch. Melanie caught it in review, but to  
prevent more people from copying the bad code, fix it. Even if it is a  
theoretical issue.  
  
We really ought to wrap these accesses in a helper function...  
  
As this is a theoretical issue, don't backpatch.  
  
Reported-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_aW2SX_LWtwHgfnqYpBrunMLfE9PD6-ioPpkh92XH0qpg@mail.gmail.com  

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

Clean up role created in new subscription test.

commit   : e9d202a1499d6a70e80d080fcdba07fe6707845d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Mar 2023 13:07:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Mar 2023 13:07:04 -0400    

Click here for diff

This oversight broke repeated runs of "make installcheck".  

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

Fix documentation build for c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6.

commit   : 9c487efe355692a4a219df1a1e5330ac02079bf8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Mar 2023 12:06:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Mar 2023 12:06:34 -0400    

Click here for diff

This documentation hunk was intended to be part of that commit,  
but I goofed.  

M doc/src/sgml/ref/create_subscription.sgml

Add new predefined role pg_create_subscription.

commit   : c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Mar 2023 11:37:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Mar 2023 11:37:19 -0400    

Click here for diff

This role can be granted to non-superusers to allow them to issue  
CREATE SUBSCRIPTION. The non-superuser must additionally have CREATE  
permissions on the database in which the subscription is to be  
created.  
  
Most forms of ALTER SUBSCRIPTION, including ALTER SUBSCRIPTION .. SKIP,  
now require only that the role performing the operation own the  
subscription, or inherit the privileges of the owner. However, to  
use ALTER SUBSCRIPTION ... RENAME or ALTER SUBSCRIPTION ... OWNER TO,  
you also need CREATE permission on the database. This is similar to  
what we do for schemas. To change the owner of a schema, you must also  
have permission to SET ROLE to the new owner, similar to what we do  
for other object types.  
  
Non-superusers are required to specify a password for authentication  
and the remote side must use the password, similar to what is required  
for postgres_fdw and dblink.  A superuser who wants a non-superuser to  
own a subscription that does not rely on password authentication may  
set the new password_required=false property on that subscription. A  
non-superuser may not set password_required=false and may not modify a  
subscription that already has password_required=false.  
  
This new password_required subscription property works much like the  
eponymous postgres_fdw property.  In both cases, the actual semantics  
are that a password is not required if either (1) the property is set  
to false or (2) the relevant user is the superuser.  
  
Patch by me, reviewed by Andres Freund, Jeff Davis, Mark Dilger,  
and Stephen Frost (but some of those people did not fully endorse  
all of the decisions that the patch makes).  
  
Discussion: http://postgr.es/m/CA+TgmoaDH=0Xj7OBiQnsHTKcF2c4L+=gzPBUKSJLh8zed2_+Dg@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/drop_subscription.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/alter.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_subscription.h
M src/include/replication/walreceiver.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/027_nosuperuser.pl

Avoid overflow in width_bucket_float8().

commit   : b0e9e4d76ca212d429d9cd615ae62ac73a9a89ba    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Mar 2023 11:27:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Mar 2023 11:27:36 -0400    

Click here for diff

The original coding of this function paid little attention to the  
possibility of overflow.  There were actually three different hazards:  
  
1. The range from bound1 to bound2 could exceed DBL_MAX, which on  
IEEE-compliant machines produces +Infinity in the subtraction.  
At best we'd lose all precision in the result, and at worst  
produce NaN due to dividing Inf/Inf.  The range can't exceed  
twice DBL_MAX though, so we can fix this case by scaling all the  
inputs by 0.5.  
  
2. We computed count * (operand - bound1), which is also at risk of  
float overflow, before dividing.  Safer is to do the division first,  
producing a quotient that should be in [0,1), and even after allowing  
for roundoff error can't be outside [0,1]; then multiplying by count  
can't produce a result overflowing an int.  (width_bucket_numeric does  
the multiplication first on the grounds that that improves accuracy of  
its result, but I don't think that a similar argument can be made in  
float arithmetic.)  
  
3. If the division result does round to 1, and count is INT_MAX,  
the final addition of 1 would overflow an int.  We took care  
of that in the operand >= bound2 case but did not consider that  
it could be possible in the main path.  Fix that by moving the  
overflow-aware addition of 1 so it is done that way in all cases.  
  
The fix for point 2 creates a possibility that values very close to  
a bucket boundary will be rounded differently than they were before.  
I'm not troubled by that for HEAD, but it is an argument against  
putting this into the stable branches.  Given that the cases being  
fixed here are fairly extreme and unlikely to be hit in normal use,  
it seems best not to back-patch.  
  
Mats Kindahl and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/float.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

Fix pointer cast for seed calculation on 32-bit systems

commit   : 2fe7a6df94e69a20c57f71a0592133684cf612da    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Mar 2023 10:53:15 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Mar 2023 10:53:15 +0200    

Click here for diff

The fallback seed for when pg_strong_random cannot generate a high  
quality seed mixes in the address of the conn object, but the cast  
failed to take the word size into consideration. Fix by casting to  
a uintptr_t instead. The seed calculation was added in 7f5b19817e.  
  
The code as it stood generated the following warning on mamba and  
lapwing in the buildfarm:  
  
fe-connect.c: In function 'libpq_prng_init':  
fe-connect.c:1048:11: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]  
1048 |  rseed = ((uint64) conn) ^  
     |           ^  
  
Author: Hayato Kuroda <[email protected]>  
Discussion: https://postgr.es/m/TYAPR01MB58665250EDCD551CCA9AD117F58E9@TYAPR01MB5866.jpnprd01.prod.outlook.com  

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

Fix incorrect format placeholders

commit   : 261cf8962b8ce92ce62c47148bd72a2c2e3351b0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Mar 2023 08:33:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Mar 2023 08:33:43 +0200    

Click here for diff

M src/backend/storage/ipc/standby.c

Refactor pgoutput_change().

commit   : da324d6cd45bbbcc1682cc2fcbc4f575281916af    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 30 Mar 2023 11:10:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 30 Mar 2023 11:10:38 +0530    

Click here for diff

Instead of mostly-duplicate code for different operation  
(insert/update/delete) types, write a common code to compute old/new  
tuples, and check the row filter.  
  
Author: Hou Zhijie  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB5716194A47FFA8D91133687D94BF9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/replication/pgoutput/pgoutput.c

Fix outdated comments regarding TupleTableSlots

commit   : 902ecd3bd4e733d273e69fd420df6fab4ffbe79b    
  
author   : David Rowley <[email protected]>    
date     : Thu, 30 Mar 2023 16:37:03 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 30 Mar 2023 16:37:03 +1300    

Click here for diff

The tts_flag is named TTS_FLAG_SHOULDFREE, so use that instead of  
TTS_SHOULDFREE, which is the name of the macro that checks for that flag.  
  
Additionally, 4da597edf got rid of the TupleTableSlot.tts_tuple field but  
forgot to update a comment which referenced that field.  Fix that.  
  
Reported-by: Zhen Mingyang <[email protected]>  
Reported-by: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c
M src/include/executor/tuptable.h

Support connection load balancing in libpq

commit   : 7f5b19817eaf38e70ad1153db4e644ee9456853e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 29 Mar 2023 21:53:38 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 29 Mar 2023 21:53:38 +0200    

Click here for diff

This adds support for load balancing connections with libpq using a  
connection parameter: load_balance_hosts=<string>. When setting the  
param to random, hosts and addresses will be connected to in random  
order. This then results in load balancing across these addresses and  
hosts when multiple clients or frequent connection setups are used.  
  
The randomization employed performs two levels of shuffling:  
  
  1. The given hosts are randomly shuffled, before resolving them  
     one-by-one.  
  2. Once a host its addresses get resolved, the returned addresses  
     are shuffled, before trying to connect to them one-by-one.  
  
Author: Jelte Fennema <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: Michael Banck <[email protected]>  
Reviewed-by: Andrey Borodin <[email protected]>  
Discussion: https://postgr.es/m/PR3PR83MB04768E2FF04818EEB2179949F7A69@PR3PR83MB0476.EURPRD83.prod.outlook.  

M .cirrus.yml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/regress.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/meson.build
A src/interfaces/libpq/t/003_load_balance_host_list.pl
A src/interfaces/libpq/t/004_load_balance_dns.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/tools/pgindent/typedefs.list

Copy and store addrinfo in libpq-owned private memory

commit   : 44d85ba5a3361dea371d23bd91777ef4c0c4e506    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 29 Mar 2023 21:41:27 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 29 Mar 2023 21:41:27 +0200    

Click here for diff

This refactors libpq to copy addrinfos returned by getaddrinfo to  
memory owned by libpq such that future improvements can alter for  
example the order of entries.  
  
As a nice side effect of this refactor the mechanism for iteration  
over addresses in PQconnectPoll is now identical to its iteration  
over hosts.  
  
Author: Jelte Fennema <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: Michael Banck <[email protected]>  
Reviewed-by: Andrey Borodin <[email protected]>  
Discussion: https://postgr.es/m/PR3PR83MB04768E2FF04818EEB2179949F7A69@PR3PR83MB0476.EURPRD83.prod.outlook.com  

M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/tools/pgindent/typedefs.list

Fix dereference of dangling pointer in GiST index buffering build.

commit   : 8e5eef50c5b41fd39ad60365c9c1b46782f881ca    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Mar 2023 11:31:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Mar 2023 11:31:30 -0400    

Click here for diff

gistBuildCallback tried to fetch the size of an index tuple that  
might have already been freed by gistProcessEmptyingQueue.  
While this seems to usually be harmless in production builds,  
in principle it could result in a SIGSEGV, or more likely a bogus  
value for indtuplesSize leading to poor page-split decisions later  
in the build.  
  
The memory management here is confusing and could stand to be  
refactored, but for the moment it seems to be enough to fetch  
the tuple size sooner.  AFAICT the indtuples[Size] totals aren't  
used in between these places; even if they were, the updated  
values shouldn't be any worse to use.  So just move the  
incrementing of the totals up.  
  
It's not very clear why our valgrind-using buildfarm animals  
haven't noticed this problem, because the relevant code path  
does seem to be exercised according to the code coverage report.  
I think the reason that we didn't fix this bug after the first  
report is that I'd wanted to try to understand that better.  
However, now that it's been re-discovered let's just be pragmatic  
and fix it already.  
  
Original report by Alexander Lakhin (bug #16329),  
later rediscovered by Egor Chindyaskin (bug #17874).  
  
Patch by Alexander Lakhin (commentary by Pavel Borisov and me).  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gist/gistbuild.c

Add missing .gitignore entries.

commit   : 3aa961378b4e517908a4400cdc476ca299693de9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Mar 2023 09:16:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Mar 2023 09:16:53 -0400    

Click here for diff

Oversight in commit 7081ac46ace8c459966174400b53418683c9fe5c.  

M src/interfaces/ecpg/test/sql/.gitignore

Remove empty function BufmgrCommit().

commit   : 58c9600a9f5818f63712ae4262143c42517dcba7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Mar 2023 09:13:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Mar 2023 09:13:57 -0400    

Click here for diff

This function has been a no-op for over a decade.  Even if bufmgr  
regains a need to be called during commit, it seems unlikely that  
the most appropriate call points would be precisely here, so it's not  
doing us much good as a placeholder either.  Now, removing it probably  
doesn't save any noticeable number of cycles --- but the main call is  
inside the commit critical section, and the less work done there the  
better.  
  
Matthias van de Meent  
  
Discussion: https://postgr.es/m/CAEze2Wi1=tLKbxZnXzcD+8fYKyKqBtivVakLQC_mYBsP4Y8qVA@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

SQL/JSON: add standard JSON constructor functions

commit   : 7081ac46ace8c459966174400b53418683c9fe5c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 29 Mar 2023 12:11:36 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 29 Mar 2023 12:11:36 +0200    

Click here for diff

This commit introduces the SQL/JSON standard-conforming constructors for  
JSON types:  
  
JSON_ARRAY()  
JSON_ARRAYAGG()  
JSON_OBJECT()  
JSON_OBJECTAGG()  
  
Most of the functionality was already present in PostgreSQL-specific  
functions, but these include some new functionality such as the ability  
to skip or include NULL values, and to allow duplicate keys or throw  
error when they are found, as well as the standard specified syntax to  
specify output type and format.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Amit Langote <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/CAF4Au4w2x-5LTnN_bxky-mq4=WOqsGsxSpENCzHRAzSnEd8+WQ@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  

M doc/src/sgml/func.sgml
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/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/backend/parser/parse_target.c
M src/backend/parser/parser.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/executor/execExpr.h
M src/include/nodes/makefuncs.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-sqljson.c
A src/interfaces/ecpg/test/expected/sql-sqljson.stderr
A src/interfaces/ecpg/test/expected/sql-sqljson.stdout
M src/interfaces/ecpg/test/sql/Makefile
M src/interfaces/ecpg/test/sql/meson.build
A src/interfaces/ecpg/test/sql/sqljson.pgc
M src/test/regress/expected/json.out
M src/test/regress/expected/opr_sanity.out
A src/test/regress/expected/sqljson.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/opr_sanity.sql
A src/test/regress/sql/sqljson.sql
M src/tools/pgindent/typedefs.list

Fix some section numbers in information_schema.sql

commit   : 38b7437b9088b4859e4489a1a1a9ab7066f5b320    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2023 11:34:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2023 11:34:37 +0200    

Click here for diff

Some of the section numbers that appeared multiple times were not  
updated completely by previous changes d61d9aa750 and eb3a1376c9.  

M src/backend/catalog/information_schema.sql

meson: Change default buildtype to debugoptimized

commit   : 5aae36dc9c6842e4269b4a713f7ac6583bd8a318    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2023 09:24:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2023 09:24:37 +0200    

Click here for diff

This matches the Autoconf default (-O2 + debug) better.  The previous  
default setting "release" used -O3, which resulted in different  
compiler warnings.  At least for now, we want to avoid such  
divergence.  
  
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRBJD_Y-XcqwXSbWS24z%2B84FFX7ajhCan9ixc_m4bD63sA%40mail.gmail.com  

M doc/src/sgml/installation.sgml
M meson.build

Move definition of standard collations from initdb to pg_collation.dat

commit   : 563f21cda8fcb61a0b5f071affb79c86458e52f8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2023 09:45:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2023 09:45:21 +0200    

Click here for diff

The standard collations "ucs_basic" and "unicode" were defined in  
initdb, even though pg_collation.dat seems like the correct place for  
them.  It seems this was just forgotten during various reorganizations  
of initdb and pg_collation.dat/.h over time.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/08b58ecd-0d50-9395-ed51-dc8294e3fd2b%40enterprisedb.com  

M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.dat

Simplify useless 0L constants

commit   : 0d15afc875f44bcb0adc244c4d9034023f99b609    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2023 08:25:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Mar 2023 08:25:12 +0200    

Click here for diff

In ancient times, these belonged to arguments or fields that were  
actually of type long, but now they are not anymore, so this "L"  
decoration is just confusing.  (Some other 0L and other "L" constants  
remain, where they are actually associated with a long type.)  

M src/backend/access/transam/xlogarchive.c
M src/backend/backup/backup_manifest.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/matview.c
M src/backend/commands/portalcmds.c
M src/backend/executor/nodeHashjoin.c
M src/backend/storage/file/buffile.c
M src/backend/tcop/pquery.c
M src/backend/utils/sort/tuplestore.c

Avoid syncing data twice for the 'publish_via_partition_root' option.

commit   : 062a8444242404242f7c2b814fed37b329639408    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 29 Mar 2023 10:46:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 29 Mar 2023 10:46:58 +0530    

Click here for diff

When there are multiple publications for a subscription and one of those  
publishes via the parent table by using publish_via_partition_root and the  
other one directly publishes the child table, we end up copying the same  
data twice during initial synchronization. The reason for this was that we  
get both the parent and child tables from the publisher and try to copy  
the data for both of them.  
  
This patch extends the function pg_get_publication_tables() to take a  
publication list as its input parameter. This allows us to exclude a  
partition table whose ancestor is published by the same publication list.  
  
This problem does exist in back-branches but we decide to fix it there in  
a separate commit if required. The fix for back-branches requires quite  
complicated changes to fetch the required table information from the  
publisher as we can't update the function pg_get_publication_tables() in  
back-branches. We are not sure whether we want to deviate and complicate  
the code in back-branches for this problem as there are no field reports  
yet.  
  
Author: Wang wei  
Reviewed-by: Peter Smith, Jacob Champion, Kuroda Hayato, Vignesh C, Osumi Takamichi, Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB57167F45D481F78CDC5986F794B99@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/subscriptioncmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/031_column_list.pl
M src/tools/pgindent/typedefs.list

Add XML ID attributes to create_subscription.sgml.

commit   : de5a47af2d8003dee123815bb7e58913be9a03f3    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 29 Mar 2023 09:58:14 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 29 Mar 2023 09:58:14 +0530    

Click here for diff

Commit ecb696527c added an XML ID attribute to one varlistentry in  
create_subscription.sgml. Following 78ee60ed84, this commit adds XML ID  
attributes to all varlistentries in create_subscription.sgml.  
Additionally, links are added to refer to the subscription options,  
enhancing the readability of documents.  
  
Author: Kuroda Hayato  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/TYAPR01MB58667AE04D291924671E2051F5879@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml

pg_dump: Fix gzip compression of empty data

commit   : 00d9dcf5bebbb355152a60f0e2120cdf7f9e7ddd    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 29 Mar 2023 00:50:34 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 29 Mar 2023 00:50:34 +0200    

Click here for diff

The pg_dump Compressor API has three basic callbacks - Allocate, Write  
and End.  The gzip implementation (since e9960732a) wrongly assumed the  
Write function would always be called, and deferred the initialization  
of the internal compression system until the first such call.  But when  
there's no data to compress (e.g. for empty LO), this would result in  
not finalizing the compression state (because it was not actually  
initialized), producing invalid dump.  
  
Fixed by initializing the internal compression system in the Allocate  
call, whenever the caller provides the Write.  For decompression the  
state is not needed, so we leave the private_data member unpopulated.  
  
Introduces a pg_dump TAP test compressing an empty large object.  
  
This also rearranges the functions to their original order, to make  
diffs against older code simpler to understand.  Finally, replace an  
unreachable pg_fatal() with a simple assert check.  
  
Reported-by: Justin Pryzby  
Author: Justin Pryzby, Georgios Kokolatos  
Reviewed-by: Georgios Kokolatos, Tomas Vondra  
  
https://postgr.es/m/20230228235834.GC30529%40telsasoft.com  

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

Validate ICU locales.

commit   : 1671f990dd669c0b72e45c7bef0fd579a10676ed    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 28 Mar 2023 16:15:59 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 28 Mar 2023 16:15:59 -0700    

Click here for diff

For ICU collations, ensure that the locale's language exists in ICU,  
and that the locale can be opened.  
  
Basic validation helps avoid minor mistakes and misspellings, which  
often fall back to the root locale instead of the intended  
locale. It's even more important to avoid such mistakes in ICU  
versions 54 and earlier, where the same (misspelled) locale string  
could fall back to different locales depending on the environment.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

M doc/src/sgml/config.sgml
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
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/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/include/utils/pg_locale.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

amcheck: In verify_heapam, allows tuples with xmin 0.

commit   : b7cea58822c67724effc711ae28e4077a01a7cd6    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 28 Mar 2023 16:16:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 28 Mar 2023 16:16:53 -0400    

Click here for diff

Commit e88754a1965c0f40a723e6e46d670cacda9e19bd caused that case  
to be reported as corruption, but Peter Geoghegan pointed out that  
it can legitimately happen in the case of a speculative insertion  
that aborts, so we'd better not flag it as corruption after all.  
  
Back-patch to v14, like the commit that introduced the issue.  
  
Discussion: http://postgr.es/m/CAH2-WzmEabzcPTxSY-NXKH6Qt3FkAPYHGQSe2PtvGgj17ZQkCw@mail.gmail.com  

M contrib/amcheck/verify_heapam.c

Fix recent pg_walinspect fpi_length bug.

commit   : bade01cb4dd88f63bd9024cfdaec3d5001a805f3    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 28 Mar 2023 10:53:48 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 28 Mar 2023 10:53:48 -0700    

Click here for diff

Commit 0276ae42dd taught pg_walinspect's pg_get_wal_record_info()  
function to output NULLs rather than empty strings for its record  
description and block_ref output parameters.  However, it inadvertently  
moved the function call that sets fpi_length until after it was already  
set.  As a result, pg_get_wal_record_info() always output spurious  
fpi_length values of 0.  
  
Fix by switching the order back (but keep the behavioral change).  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkJmgSYkt6-smQ+57SxSmov+EKqFZdSimFewosoL_JKoA@mail.gmail.com  

M contrib/pg_walinspect/pg_walinspect.c

Fix corner-case planner failure for MERGE.

commit   : 326a33a289c7ba2dbf45f17e610b7be98dc11f67    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Mar 2023 11:36:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Mar 2023 11:36:50 -0400    

Click here for diff

MERGE planning could fail with "variable not found in subplan target  
list" if the target table is partitioned and all its partitions are  
excluded at plan time, or in the case where it has no partitions but  
used to have some.  This happened because distribute_row_identity_vars  
thought it didn't need to make the target table's reltarget list  
fully valid; but if we generate a join plan then that is required  
because the dummy Result node's tlist will be made from the reltarget.  
  
The same logic appears in distribute_row_identity_vars in v14,  
but AFAICS the problem is unreachable in that branch for lack of  
MERGE.  In other updating statements, the target table is always  
inner-joined to any other tables, so if the target is known dummy  
then the whole plan reduces to dummy, so no join nodes are created.  
So I'll refrain from back-patching this code change to v14 for now.  
  
Per report from Alvaro Herrera.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/appendinfo.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

initdb: emit message when using default ICU locale.

commit   : c1f1c1f87fd685981c45da528649c700b6ba0655    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 28 Mar 2023 07:55:57 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 28 Mar 2023 07:55:57 -0700    

Click here for diff

Helpful to determine from test logs whether the locale came from the  
environment or a command-line option.  
  
Discussion: https://postgr.es/m/04182066-7655-344a-b8b7-040b1b2490fb%40enterprisedb.com  
Reviewed-by: Peter Eisentraut  

M src/bin/initdb/initdb.c

initdb: replace check_icu_locale() with default_icu_locale().

commit   : f8ca22295e994338259174e5c66b6b23e5d9b55f    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 28 Mar 2023 07:55:45 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 28 Mar 2023 07:55:45 -0700    

Click here for diff

The extra checks done in check_icu_locale() are not necessary. An  
existing comment already pointed out that the checks would be done  
during post-bootstrap initialization, when the locale is opened by the  
backend. This was a mistake in commit 27b62377b4.  
  
This commit creates a simpler function default_icu_locale() to just  
return the locale of the default collator.  
  
Discussion: https://postgr.es/m/04182066-7655-344a-b8b7-040b1b2490fb%40enterprisedb.com  
Reviewed-by: Peter Eisentraut  

M src/bin/initdb/initdb.c

Fix error inconsistency in older ICU versions.

commit   : 8b3eb0c584beabfc0deaad01aed66cbddb978dcd    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 28 Mar 2023 07:55:30 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 28 Mar 2023 07:55:30 -0700    

Click here for diff

To support older ICU versions, we rely on  
icu_set_collation_attributes() to do error checking that is handled  
directly by ucol_open() in newer ICU versions. Commit 3b50275b12  
introduced a slight inconsistency, where the error report includes the  
fixed-up locale string, rather than the locale string passed to  
pg_ucol_open().  
  
Refactor slightly so that pg_ucol_open() handles the errors from both  
ucol_open() and icu_set_collation_attributes(), making it easier to  
see any differences between the error reports. It also makes  
pg_ucol_open() responsible for closing the UCollator on error, which  
seems like the right place.  
  
Discussion: https://postgr.es/m/04182066-7655-344a-b8b7-040b1b2490fb%40enterprisedb.com  
Reviewed-by: Peter Eisentraut  

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

Save a few bytes in pg_attribute

commit   : 90189eefc1e11822794e3386d9bafafd3ba3a6e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2023 09:58:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Mar 2023 09:58:14 +0200    

Click here for diff

Change the columns attndims, attstattarget, and attinhcount from int32  
to int16, and reorder a bit.  This saves some space (currently 4  
bytes) in pg_attribute and tuple descriptors, which translates into  
small performance benefits and/or room for new columns in pg_attribute  
needed by future features.  
  
attndims and attinhcount are never realistically used with values  
larger than int16.  Just to be sure, add some overflow checks.  
attstattarget is currently limited explicitly to 10000.  
  
For consistency, pg_constraint.coninhcount is also changed like  
attinhcount.  
  
Discussion: https://www.postgresql.org/message-id/flat/d07ffc2b-e0e8-77f7-38fb-be921dff71af%40enterprisedb.com  

M doc/src/sgml/catalogs.sgml
M src/backend/access/common/tupdesc.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_constraint.h

pg_walinspect: Adjust memory context name.

commit   : 637dce2254245321283ade9db1b7cc8d1f8cf308    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 27 Mar 2023 16:14:32 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 27 Mar 2023 16:14:32 -0700    

Click here for diff

Correct the name of the memory context used by the  
pg_get_wal_block_info() SQL-callable function.  
  
Oversight in commit 9ecb134a93.  

M contrib/pg_walinspect/pg_walinspect.c

Generate a few more functions of pgstatfuncs.c with macros

commit   : 4efd0bf7eaebb3e3f5a3a6edd0865f6973e709a6    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Mar 2023 07:35:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Mar 2023 07:35:33 +0900    

Click here for diff

Two new macros are added with their respective functions switched to  
use them.  These are for functions with millisecond stats, with and  
without "xact" in their names (for the stats that can be tracked within  
a transaction).  
  
While on it, prefix the macro for float8 on database entries with "_MS",  
as it does a us->ms conversion, based on a suggestion from Andres  
Freund.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

Reject attempts to alter composite types used in indexes.

commit   : a3c9d35ae168864bf7999b06e27dabe65a0915e9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Mar 2023 15:04:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Mar 2023 15:04:02 -0400    

Click here for diff

find_composite_type_dependencies() ignored indexes, which is a poor  
decision because an expression index could have a stored column of  
a composite (or other container) type even when the underlying table  
does not.  Teach it to detect such cases and error out.  We have to  
work a bit harder than for other relations because the pg_depend entry  
won't identify the specific index column of concern, but it's not much  
new code.  
  
This does not address bug #17872's original complaint that dropping  
a column in such a type might lead to violations of the uniqueness  
property that a unique index is supposed to ensure.  That seems of  
much less concern to me because it won't lead to crashes.  
  
Per bug #17872 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

amcheck: Generalize one of the recently-added update chain checks.

commit   : c87aff065c33e1a3c9bf0350f9160e84bfce1c36    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2023 13:37:16 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2023 13:37:16 -0400    

Click here for diff

Commit bbc1376b39627c6bddd8a0dc0a7dda24c91a97a0 checked that if  
a redirected line pointer pointed to a tuple, the tuple should be  
marked both HEAP_ONLY_TUPLE and HEAP_UPDATED. But Andres Freund  
pointed out that *any* tuple that is marked HEAP_ONLY_TUPLE should  
be marked HEAP_UPDATED, not just one that is the target of a  
redirected line pointer. Do that instead.  
  
To see why this is better, consider a redirect line pointer A  
which points to a heap-only tuple B which points (via CTID)  
to another heap-only tuple C. With the old code, we'd complain  
if B was not marked HEAP_UPDATED, but with this change, we'll  
complain if either B or C is not marked HEAP_UPDATED.  
  
(Note that, with or without this commit, if either B or C were  
not marked HEAP_ONLY_TUPLE, we would also complain about that.)  
  
Discussion: http://postgr.es/m/CA%2BTgmobLypZx%3DcOH%2ByY1GZmCruaoucHm77A6y_-Bo%3Dh-_3H28g%40mail.gmail.com  

M contrib/amcheck/verify_heapam.c
M src/bin/pg_amcheck/t/004_verify_heapam.pl

amcheck: Tighten up validation of redirect line pointers.

commit   : 80d5e3a615518e9eee8ba4afa5cf05ebe486dbf6    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2023 13:27:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Mar 2023 13:27:06 -0400    

Click here for diff

Commit bbc1376b39627c6bddd8a0dc0a7dda24c91a97a0 added a new lp_valid[]  
array which records whether or not a line pointer was thought to be  
valid, but entries could sometimes get set to true in cases where that  
wasn't actually safe. Fix that.  
  
Suppose A is a redirect line pointer and B is the other line pointer  
to which it points.  The old code could mishandle this situation in a  
couple of different ways.  First, if B was unused, we'd complain about  
corruption but still set lp_valid[A] = true, causing later code  
to try to access the B as if it were pointing to a tuple. Second,  
if B was dead, we wouldn't complain about corruption at all, which is  
an oversight, and would also set lp_valid[A] = true, which would  
again confuse later code. Fix all that.  
  
In the case where B is a redirect, the old code was correct, but  
refactor things a bit anyway so that all of these cases are handled  
more symmetrically. Also add an Assert() and some comments.  
  
Andres Freund and Robert Haas  
  
Discussion: http://postgr.es/m/20230323172607.y3lejpntjnuis5vv%40awork3.anarazel.de  

M contrib/amcheck/verify_heapam.c

doc: fix Apple Silicon Homebrew prefix change documentation

commit   : 5a91c79755034fecb546cbee76c14b89c514177c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 27 Mar 2023 14:16:45 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 27 Mar 2023 14:16:45 +0200    

Click here for diff

Commit 4c8d65408 incorrectly stated that Homebrew has changed its  
prefix for Apple M1 machines, but the prefix change applies to all  
Apple Silicon based machines.  Fix by writing Apple Silicon instead  
of Apple M1.  
  
Reported-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/docguide.sgml

doc: Fix XML_CATALOG_FILES env var for Apple M1 machines

commit   : 4c8d654084700f801f48827bb3531a6779b8b90e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 27 Mar 2023 11:56:19 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 27 Mar 2023 11:56:19 +0200    

Click here for diff

Homebrew changed the prefix for Apple M1 based machines, so our  
advice for XML_CATALOG_FILES needs to mention both.  More info  
on the Homebrew change can be found at:  
  
  https://github.com/Homebrew/brew/issues/9177  
  
Author: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/20230327082441.h7pa2vqiobbyo7rd@jrouhaud  

M doc/src/sgml/docguide.sgml

Make SCRAM iteration count configurable

commit   : b577743000cd0974052af3a71770a23760423102    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 27 Mar 2023 09:46:29 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 27 Mar 2023 09:46:29 +0200    

Click here for diff

Replace the hardcoded value with a GUC such that the iteration  
count can be raised in order to increase protection against  
brute-force attacks.  The hardcoded value for SCRAM iteration  
count was defined to be 4096, which is taken from RFC 7677, so  
set the default for the GUC to 4096 to match.  In RFC 7677 the  
recommendation is at least 15000 iterations but 4096 is listed  
as a SHOULD requirement given that it's estimated to yield a  
0.5s processing time on a mobile handset of the time of RFC  
writing (late 2015).  
  
Raising the iteration count of SCRAM will make stored passwords  
more resilient to brute-force attacks at a higher computational  
cost during connection establishment.  Lowering the count will  
reduce computational overhead during connections at the tradeoff  
of reducing strength against brute-force attacks.  
  
There are however platforms where even a modest iteration count  
yields a too high computational overhead, with weaker password  
encryption schemes chosen as a result.  In these situations,  
SCRAM with a very low iteration count still gives benefits over  
weaker schemes like md5, so we allow the iteration count to be  
set to one at the low end.  
  
The new GUC is intentionally generically named such that it can  
be made to support future SCRAM standards should they emerge.  
At that point the value can be made into key:value pairs with  
an undefined key as a default which will be backwards compatible  
with this.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/libpq/auth-scram.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/common/scram-common.c
M src/include/common/scram-common.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/libpq-int.h
M src/test/authentication/t/001_password.pl
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

meson: Fix support for empty darwin sysroot

commit   : c15631f0f596b2e6c4b03f24c03289d06d008783    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Mar 2023 08:41:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Mar 2023 08:41:40 +0200    

Click here for diff

The -isysroot options should only be added if the sysroot resolved to  
a nonempty string.  This matches the behavior in src/template/darwin  
(also documented in installation.sgml).  
  
Discussion: https://www.postgresql.org/message-id/flat/60765bf0-5027-4b23-9f78-4a365d28823f%40enterprisedb.com  

M meson.build

Improve a few things in pg_walinspect

commit   : 0276ae42ddea02682f514aaea449f183229ddbbc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Mar 2023 13:15:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Mar 2023 13:15:04 +0900    

Click here for diff

This improves a few things in pg_walinspect:  
- Return NULL rather than empty strings in pg_get_wal_records_info() for  
the block references and the record description if there is no  
information provided by the fallback.  This point has been raised by  
Peter Geoghegan.  
- Add a check on XLogRecHasAnyBlockRefs() for pg_get_wal_block_info(),  
to directly skip records that have no block references.  This speeds up  
the function a bit, depending on the number of records that have no  
block references.  
  
Author: Bharath Rupireddy  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACWL9RG8sGJHinggRNBTxgRWJTSxCkB+cE6=t3Phh=Ey+A@mail.gmail.com  

M contrib/pg_walinspect/pg_walinspect.c

Generate pg_stat_get_xact*() functions for relations using macros

commit   : 850f4b4c8cab03a084ccc89245df061639ad1769    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Mar 2023 09:57:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Mar 2023 09:57:41 +0900    

Click here for diff

This change replaces seven functions definitions by macros.  
  
This is the same idea as 8018ffb or 83a1a1b, taking advantage of the  
variable rename done in 8089517 for relation entries.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: clarify introduction to database roles.

commit   : 6eefe2ce463f55bb3b8da7d561ad2f75053189e0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2023 14:48:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2023 14:48:04 -0400    

Click here for diff

Word-smith section 22.1 ("Database Roles") a little bit in hopes  
of removing confusion about how the bootstrap superuser's name  
is chosen.  
  
While here, I couldn't help noticing that the claim that the bootstrap  
superuser is the only initially-existing role has been a lie since  
we started to invent predefined roles.  We don't want too much detail  
in this very introductory text, but it seems worth changing it to say  
that it's the only initially-existing login-capable role.  
  
Per documentation comment from Maja Zaloznik.  
  
Discussion: https://postgr.es/m/167931662853.3349090.18217722739345182859@wrigleys.postgresql.org  

M doc/src/sgml/user-manag.sgml

Fix oversights in array manipulation.

commit   : 554841699f0ee5b56ef5eaf35402934f1e025eda    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2023 13:41:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Mar 2023 13:41:06 -0400    

Click here for diff

The nested-arrays code path in ExecEvalArrayExpr() used palloc to  
allocate the result array, whereas every other array-creating function  
has used palloc0 since 18c0b4ecc.  This mostly works, but unused bits  
past the end of the nulls bitmap may end up undefined.  That causes  
valgrind complaints with -DWRITE_READ_PARSE_PLAN_TREES, and could  
cause planner misbehavior as cited in 18c0b4ecc.  There seems no very  
good reason why we should strive to avoid palloc0 in just this one case,  
so fix it the easy way with s/palloc/palloc0/.  
  
While looking at that I noted that we also failed to check for overflow  
of "nbytes" and "nitems" while summing the sizes of the sub-arrays,  
potentially allowing a crash due to undersized output allocation.  
For "nbytes", follow the policy used by other array-munging code of  
checking for overflow after each addition.  (As elsewhere, the last  
addition of the array's overhead space doesn't need an extra check,  
since palloc itself will catch a value between 1Gb and 2Gb.)  
For "nitems", there's no very good reason to sum the inputs at all,  
since we can perfectly well use ArrayGetNItems' result instead of  
ignoring it.  
  
Per discussion of this bug, also remove redundant zeroing of the  
nulls bitmap in array_set_element and array_set_slice.  
  
Patch by Alexander Lakhin and myself, per bug #17858 from Alexander  
Lakhin; thanks also to Richard Guo.  These bugs are a dozen years old,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/utils/adt/arrayfuncs.c

Add SysCacheGetAttrNotNull for guaranteed not-null attrs

commit   : d435f15fff3cf3cf5d6cfcfd63e21acc0f737829    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sat, 25 Mar 2023 22:49:33 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sat, 25 Mar 2023 22:49:33 +0100    

Click here for diff

When extracting an attr from a cached tuple in the syscache with  
SysCacheGetAttr the isnull parameter must be checked in case the  
attr cannot be NULL.  For cases when this is known beforehand, a  
wrapper is introduced which perform the errorhandling internally  
on behalf of the caller, invoking an elog in case of a NULL attr.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/index/indexam.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execReplication.c
M src/backend/executor/functions.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/init/postinit.c
M src/include/utils/syscache.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpython/plpy_procedure.c
M src/pl/tcl/pltcl.c

Comment on expectations for AutoVacuumWorkItem handlers.

commit   : e33967b13bbc6e4e1c1b5e9ecd1c45148cffcc53    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 25 Mar 2023 13:00:27 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 25 Mar 2023 13:00:27 -0700    

Click here for diff

This might prevent a repeat of the brin_summarize_range() vulnerability  
that commit a117cebd638dd02e5c2e791c25e43745f233111b fixed.  

M src/backend/postmaster/autovacuum.c

Fix CREATE INDEX progress reporting for multi-level partitioning.

commit   : 27f5c712b2c57d1c676fbf110705ac881057b57e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2023 15:33:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2023 15:33:56 -0400    

Click here for diff

The "partitions_total" and "partitions_done" fields were updated  
as though the current level of partitioning was the only one.  
In multi-level cases, not only could partitions_total change  
over the course of the command, but partitions_done could go  
backwards or exceed the currently-reported partitions_total.  
  
Fix by setting partitions_total to the total number of direct  
and indirect children once at command start, and then just  
incrementing partitions_done at appropriate points.  Invent  
a new progress monitoring function "pgstat_progress_incr_param"  
to simplify doing the latter.  We can avoid adding cost for the  
former when doing CREATE INDEX, because ProcessUtility already  
enumerates the children and it's pretty easy to pass the count  
down to DefineIndex.  In principle the same could be done in  
ALTER TABLE, but that's structurally difficult; for now, just  
eat the cost of an extra find_all_inheritors scan in that case.  
  
Ilya Gladyshev and Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/bootstrap/bootparse.y
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/tcop/utility.c
M src/backend/utils/activity/backend_progress.c
M src/include/commands/defrem.h
M src/include/utils/backend_progress.h

Fix abbreviated keys bug introduced in d87d548cd03.

commit   : 81a6d57e33515958203938cb686bf0c255255cff    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 25 Mar 2023 11:08:32 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 25 Mar 2023 11:08:32 -0700    

Click here for diff

Discussion: http://postgr.es/m/CAMkU=1z17XJatF-rMCY3Cjqcxer-Kyn57x6h3OSCpJ0LpAp0ig@mail.gmail.com  
Reported-by: Jeff Janes  

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

Doc: fix another "contents...exceed the available area" PDF warning.

commit   : f34a89353156ada8c75963b8089df11a493512cd    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2023 13:22:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Mar 2023 13:22:59 -0400    

Click here for diff

New since yesterday :-(  

M doc/src/sgml/docguide.sgml

Doc: fix examples for pg_input_error_info().

commit   : 7023207cfdb6d5863bdcc9c29bff9918846dddc6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Mar 2023 19:31:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Mar 2023 19:31:19 -0400    

Click here for diff

These were causing "contents ... exceed the available area"  
warnings in PDF builds, and also didn't quite follow our markup  
conventions for function examples.  To fix the overwidth  
problem, reduce the number of fields shown in one example,  
and also insert &zwsp; to let the header line be broken in  
a reasonable place.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

docs: Explain how to silence overly verbose messages by fop

commit   : 642d8779768ecddc2917747940885d11f844f6e9    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 24 Mar 2023 14:18:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 24 Mar 2023 14:18:40 -0700    

Click here for diff

Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/docguide.sgml

Invent GENERIC_PLAN option for EXPLAIN.

commit   : 3c05284d83b230728e59a25e828992037ef77096    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Mar 2023 17:07:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Mar 2023 17:07:14 -0400    

Click here for diff

This provides a very simple way to see the generic plan for a  
parameterized query.  Without this, it's necessary to define  
a prepared statement and temporarily change plan_cache_mode,  
which is a bit tedious.  
  
One thing that's a bit of a hack perhaps is that we disable  
execution-time partition pruning when the GENERIC_PLAN option  
is given.  That's because the pruning code may attempt to  
fetch the value of one of the parameters, which would fail.  
  
Laurenz Albe, reviewed by Julien Rouhaud, Christoph Berg,  
Michel Pelletier, Jim Jones, and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/parser/analyze.c
M src/bin/psql/tab-complete.c
M src/include/commands/explain.h
M src/include/executor/executor.h
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

meson: Fix oversight in install-quiet

commit   : 5b140dc8f094e8a11fccab6bdee50d4c599e7444    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 24 Mar 2023 09:39:35 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 24 Mar 2023 09:39:35 -0700    

Click here for diff

In e522049f239 I accidentally forgot to add meson_bin to the argument list for  
install-quiet. That kind of works on some platforms because the executable is  
just 'python', wich the path to meson in an argument. But on windows meson  
might be installed as an executable.  
  
Reported-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M meson.build

Avoid potential UCollator leak for older ICU versions.

commit   : a03b3b6b4a7275a66e38280f49fddb9aec8dff3d    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 24 Mar 2023 08:47:51 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 24 Mar 2023 08:47:51 -0700    

Click here for diff

ICU versions 53 and earlier rely on icu_set_collation_attributes() to  
process the attributes in the locale string. Avoid leaking the  
already-opened UCollator object if an error is encountered.  
  
Discussion: https://postgr.es/m/04182066-7655-344a-b8b7-040b1b2490fb%40enterprisedb.com  
Reviewed-by: Peter Eisentraut  

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

pg_locale.c: change ereport() to elog().

commit   : 9a242899158c776377696d445df74db270150385    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 24 Mar 2023 08:47:42 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 24 Mar 2023 08:47:42 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Reported-by: Peter Eisentraut  

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

amcheck: Fix verify_heapam for tuples where xmin or xmax is 0.

commit   : e88754a1965c0f40a723e6e46d670cacda9e19bd    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2023 15:29:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2023 15:29:28 -0400    

Click here for diff

In such cases, get_xid_status() doesn't set its output parameter (the  
third argument), so we shouldn't fall through to code which will test  
the value of that parameter. There are five existing calls to  
get_xid_status(), three of which seem to already handle this case  
properly.  This commit tries to fix the other two.  
  
If we're checking xmin and find that it is invalid (i.e. 0) just  
report that as corruption, similar to what's already done in the  
three cases that seem correct. If we're checking xmax and find  
that's invalid, that's fine: it just means that the tuple hasn't  
been updated or deleted.  
  
Thanks to Andres Freund and valgrind for finding this problem, and  
also to Andres for having a look at the patch.  This bug seems to go  
all the way back to where verify_heapam was first introduced, but  
wasn't detected until recently, possibly because of the new test cases  
added for update chain verification.  Back-patch to v14, where this  
code showed up.  
  
Discussion: http://postgr.es/m/CA+TgmoZAYzQZqyUparXy_ks3OEOfLD9-bEXt8N-2tS1qghX9gQ@mail.gmail.com  

M contrib/amcheck/verify_heapam.c

Fix typo in header comment

commit   : a04761ac77354930aebe7613b40bbdd749af5002    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 24 Mar 2023 09:03:31 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 24 Mar 2023 09:03:31 +0100    

Click here for diff

Commit 4c04be9b0 accidentally left off the _id portion of the function  
name in the header comment.  
  
Author: Junwang Zhao <[email protected]>  
Discussion: https://postgr.es/m/CAEG8a3LP+ytnAXSzR=yiEaQrde+iCybMHsuPn9n=UN3puV_1tw@mail.gmail.com  

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

Fix incorrect format placeholders

commit   : a9bc04b21182cb6030e248a4055dc793e901ef6d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2023 07:18:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Mar 2023 07:18:12 +0100    

Click here for diff

The fields of NLSVERSIONINFOEX are of type DWORD, which is unsigned  
long, so the results of the computations being printed are also of  
type unsigned long.  

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

meson: docs: add texinfo target

commit   : 069ef254f145889d15c6ce4be526ce9e05284dc6    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Mar 2023 23:08:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Mar 2023 23:08:06 -0700    

Click here for diff

M doc/src/sgml/meson.build

libpq: Add sslcertmode option to control client certificates

commit   : 36f40ce2dc66f1a36d6a12f7a0352e1c5bf1063e    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 Mar 2023 13:34:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 Mar 2023 13:34:26 +0900    

Click here for diff

The sslcertmode option controls whether the server is allowed and/or  
required to request a certificate from the client.  There are three  
modes:  
- "allow" is the default and follows the current behavior, where a  
configured client certificate is sent if the server requests one  
(via one of its default locations or sslcert).  With the current  
implementation, will happen whenever TLS is negotiated.  
- "disable" causes the client to refuse to send a client certificate  
even if sslcert is configured or if a client certificate is available in  
one of its default locations.  
- "require" causes the client to fail if a client certificate is never  
sent and the server opens a connection anyway.  This doesn't add any  
additional security, since there is no guarantee that the server is  
validating the certificate correctly, but it may helpful to troubleshoot  
more complicated TLS setups.  
  
sslcertmode=require requires SSL_CTX_set_cert_cb(), available since  
OpenSSL 1.0.2.  Note that LibreSSL does not include it.  
  
Using a connection parameter different than require_auth has come up as  
the simplest design because certificate authentication does not rely  
directly on any of the AUTH_REQ_* codes, and one may want to require a  
certificate to be sent in combination of a given authentication method,  
like SCRAM-SHA-256.  
  
TAP tests are added in src/test/ssl/, some of them relying on sslinfo to  
check if a certificate has been set.  These are compatible across all  
the versions of OpenSSL supported on HEAD (currently down to 1.0.1).  
  
Author: Jacob Champion  
Reviewed-by: Aleksander Alekseev, Peter Eisentraut, David G. Johnston,  
Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M doc/src/sgml/libpq.sgml
M meson.build
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/003_sslinfo.pl
M src/tools/msvc/Solution.pm

meson: add install-{quiet, world} targets

commit   : e522049f23998e64fd0b88cd66de8e8f42100bf1    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Mar 2023 21:20:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Mar 2023 21:20:18 -0700    

Click here for diff

To define our own install target, we need dependencies on the i18n targets,  
which we did not collect so far.  
  
Discussion: https://postgr.es/m/[email protected]  

M meson.build
M src/backend/po/meson.build
M src/bin/initdb/po/meson.build
M src/bin/pg_amcheck/po/meson.build
M src/bin/pg_archivecleanup/po/meson.build
M src/bin/pg_basebackup/po/meson.build
M src/bin/pg_checksums/po/meson.build
M src/bin/pg_config/po/meson.build
M src/bin/pg_controldata/po/meson.build
M src/bin/pg_ctl/po/meson.build
M src/bin/pg_dump/po/meson.build
M src/bin/pg_resetwal/po/meson.build
M src/bin/pg_rewind/po/meson.build
M src/bin/pg_test_fsync/po/meson.build
M src/bin/pg_test_timing/po/meson.build
M src/bin/pg_upgrade/po/meson.build
M src/bin/pg_verifybackup/po/meson.build
M src/bin/pg_waldump/po/meson.build
M src/bin/psql/po/meson.build
M src/bin/scripts/po/meson.build
M src/interfaces/ecpg/ecpglib/po/meson.build
M src/interfaces/ecpg/preproc/po/meson.build
M src/interfaces/libpq/po/meson.build
M src/interfaces/libpq/test/meson.build
M src/pl/plperl/po/meson.build
M src/pl/plpgsql/src/po/meson.build
M src/pl/plpython/po/meson.build
M src/pl/tcl/po/meson.build

meson: add install-{docs,doc-html,doc-man} targets

commit   : f13eb16485fec7958a59f263827b2333dea93e59    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Mar 2023 21:20:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Mar 2023 21:20:18 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/meson.build
M meson.build

meson: make install_test_files more generic, rename to install_files

commit   : 614c5f5f52d53d0b3ed3a829ebf7f5ebd53e7a5a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Mar 2023 21:20:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Mar 2023 21:20:18 -0700    

Click here for diff

Now it supports installing directories and directory contents as well. This  
will be used in a subsequent patch to install documentation.  
  
Discussion: https://postgr.es/m/[email protected]  

M meson.build
A src/tools/install_files
D src/tools/install_test_files

Doc: Improve description of the "batch_size" option for postgres_fdw.

commit   : 0f0a7183d7d8632a2bbcdad796580b4cc541c639    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 24 Mar 2023 12:55:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 24 Mar 2023 12:55:00 +0900    

Click here for diff

Document that the actual number of rows postgres_fdw inserts at once in  
the COPY case is determined in a similar way to the INSERT case, but it  
has a restriction that does not apply to the INSERT case.  
  
Follow-up for commit 97da48246.  
  
Reviewed-by: Daniel Gustafsson and Tatsuo Ishii  
Discussion: https://postgr.es/m/CAPmGK14NMXDMW4qK9kHUzudN9t71uvrMKPna02X6zwgQJ6E1_g%40mail.gmail.com  

M doc/src/sgml/postgres-fdw.sgml

commit   : bcaa1fafc82f2fd124e0ed39e7c94a7918548224    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 Mar 2023 10:14:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 Mar 2023 10:14:33 +0900    

Click here for diff

The same error message will be used for a different option, to be  
introduced in a separate patch.  Reshaping the error message as done  
here saves in translation.  
  
Extracted from a larger patch by the same author.  
  
Author: Jacob Champion  
Discussion: https://postgr.es/m/[email protected]  

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

Rename fields in pgstat structures for functions and relations

commit   : 8089517ab8b547daab78f404f99eb48fba91ee9d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 Mar 2023 08:46:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 Mar 2023 08:46:29 +0900    

Click here for diff

This commit renames the members of a few pgstat structures related to  
functions and relations, by respectively removing their prefix "f_" and  
"t_".  The statistics for functions and relations and handled in their  
own file, and pgstatfuncs.c associates each field in a structure  
variable named based on the object type handled, so no information is  
lost with this rename.  
  
This will help with some of the refactoring aimed for pgstatfuncs.c, as  
this makes more consistent the field names with the SQL functions  
retrieving them.  
  
Author: Bertrand Drouvot  
Reviewed-by: Michael Paquier, Melanie Plageman  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h

Implement find_my_exec()'s path normalization using realpath(3).

commit   : 11a0a8b529caeab101206ec4a33af95bb4445746    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Mar 2023 18:17:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Mar 2023 18:17:49 -0400    

Click here for diff

Replace the symlink-chasing logic in find_my_exec with realpath(3),  
which has been required by POSIX since SUSv2.  (Windows lacks  
realpath(), but there we can use _fullpath() which is functionally  
equivalent.)  The main benefit of this is that -- on all modern  
platforms at least -- realpath() avoids the chdir() shenanigans  
we used to perform while interpreting symlinks.  That had various  
corner-case failure modes so it's good to get rid of it.  
  
There is still ongoing discussion about whether we could skip the  
replacement of symlinks in some cases, but that's really matter  
for a separate patch.  Meanwhile I want to push this before we get  
too close to feature freeze, so that we can find out if there are  
showstopper portability issues.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/exec.c

doc: fix another case of missing productname markup

commit   : eb2618a03c53695532eaad680522c60dca0d4061    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 23 Mar 2023 21:35:26 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 23 Mar 2023 21:35:26 +0100    

Click here for diff

As a follow-up commit to 0f85db92b9, this adds <productname> markup  
to another case of "PostgreSQL".  
  
Author: Hayato Kuroda <[email protected]>  
Discussion: https://postgr.es/m/TYAPR01MB58667A7C8317E267467CC599F5869@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M doc/src/sgml/func.sgml

Count updates that move row to a new page.

commit   : ae4fdde1352fa6b2c9123e91435efafc78c370a0    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 23 Mar 2023 11:16:17 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 23 Mar 2023 11:16:17 -0700    

Click here for diff

Add pgstat counter to track row updates that result in the successor  
version going to a new heap page, leaving behind an original version  
whose t_ctid points to the new version.  The current count is shown by  
the n_tup_newpage_upd column of each of the pg_stat_*_tables views.  
  
The new n_tup_newpage_upd column complements the existing n_tup_hot_upd  
and n_tup_upd columns.  Tables that have high n_tup_newpage_upd values  
(relative to n_tup_upd) are good candidates for tuning heap fillfactor.  
  
Corey Huinker, with small tweaks by me.  
  
Author: Corey Huinker <[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CADkLM=ded21M9iZ36hHm-vj2rE2d=zcKpUQMds__Xm2pxLfHKA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/heap/heapam.c
M src/backend/catalog/system_views.sql
M src/backend/utils/activity/pgstat_relation.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/test/regress/expected/rules.out

Handle the "und" locale in ICU versions 54 and older.

commit   : 3b50275b12950280fb07193e24a4f400ed8a9fef    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 23 Mar 2023 09:50:06 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 23 Mar 2023 09:50:06 -0700    

Click here for diff

The "und" locale is an alternative spelling of the root locale, but it  
was not recognized until ICU 55. To maintain common behavior across  
all supported ICU versions, check for "und" and replace with "root"  
before opening.  
  
Previously, the lack of support for "und" was dangerous, because  
versions 54 and older fall back to the environment when a locale is  
not found. If the user specified "und" for the language (which is  
expected and documented), it could not only resolve to the wrong  
collator, but it could unexpectedly change (which could lead to  
corrupt indexes).  
  
This effectively reverts commit d72900bded, which worked around the  
problem for the built-in "unicode" collation, and is no longer  
necessary.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

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

amcheck: Fix a few bugs in new update chain validation.

commit   : 949e2e7c4f680ef86e93500ba4bee563ae4ce78e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2023 12:52:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Mar 2023 12:52:33 -0400    

Click here for diff

We shouldn't set successor[whatever] to an offset number that is less  
than FirstOffsetNumber or more than maxoff. We already avoided that  
for redirects, but not for CTID links. Allowing bad offset numbers  
into the successor[] array causes core dumps.  
  
We shouldn't use HeapTupleHeaderIsHotUpdated() because it checks  
stuff other than the status of the infomask2 bit HEAP_HOT_UPDATED.  
We only care about the status of that bit, not the other stuff  
that HeapTupleHeaderIsHotUpdated() checks. This mistake can cause  
verify_heapam() to report corruption when none is present.  
  
The first hunk of this patch was written by me. The other two were  
written by Andres Freund. This could probably do with more review  
before commit, but I'd like to try to get the buildfarm green again  
sooner rather than later.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/amcheck/verify_heapam.c

Add missing "-I." flag when building pg_bsd_indent.

commit   : dccef0f2f8f352de3f601f48b94093995ad839ef    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Mar 2023 13:01:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Mar 2023 13:01:31 -0400    

Click here for diff

This is evidently not required by most compilers, but buildfarm  
member fairywren is unhappy without it.  It looks like the meson  
infrastructure has this right already.  

M src/tools/pg_bsd_indent/Makefile

Minor comment improvements for compress_lz4

commit   : d0160ca11e31878f94dd491fcde3a22843e32665    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 23 Mar 2023 17:52:56 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 23 Mar 2023 17:52:56 +0100    

Click here for diff

Author: Tomas Vondra  
Reviewed-by: Georgios Kokolatos, Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/compress_lz4.c

Unify buffer sizes in pg_dump compression API

commit   : f081a48f9a91a245054e94926e2092bd7e85edff    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 23 Mar 2023 17:52:32 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 23 Mar 2023 17:52:32 +0100    

Click here for diff

Prior to the introduction of the compression API in e9960732a9, pg_dump  
would use the ZLIB_IN_SIZE/ZLIB_OUT_SIZE to size input/output buffers.  
Commit 0da243fed0 introduced similar constants for LZ4, but while gzip  
defined both buffers to be 4kB, LZ4 used 4kB and 16kB without any clear  
reasoning why that's desirable.  
  
Furthermore, parts of the code unaware of which compression is used  
(e.g. pg_backup_directory.c) continued to use ZLIB_OUT_SIZE directly.  
  
Simplify by replacing the various constants with DEFAULT_IO_BUFFER_SIZE,  
set to 4kB. The compression implementations still have an option to use  
a custom value, but considering 4kB was fine for 20+ years, I find that  
unlikely (and we'd probably just increase the default buffer size).  
  
Author: Georgios Kokolatos  
Reviewed-by: Tomas Vondra, Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/pg_backup_directory.c

Improve type handling in pg_dump's compress file API

commit   : d3b57755e60c2d3cfeddbc733c6168419d874414    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 23 Mar 2023 17:51:55 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 23 Mar 2023 17:51:55 +0100    

Click here for diff

After 0da243fed0 got committed, we've received a report about a compiler  
warning, related to the new LZ4File_gets() function:  
  
  compress_lz4.c: In function 'LZ4File_gets':  
  compress_lz4.c:492:19: warning: comparison of unsigned expression in  
                                  '< 0' is always false [-Wtype-limits]  
    492 |         if (dsize < 0)  
  
The reason is very simple - dsize is declared as size_t, which is an  
unsigned integer, and thus the check is pointless and we might fail to  
notice an error in some cases (or fail in a strange way a bit later).  
  
The warning could have been silenced by simply changing the type, but we  
realized the API mostly assumes all the libraries use the same types and  
report errors the same way (e.g. by returning 0 and/or negative value).  
  
But we can't make this assumption - the gzip/lz4 libraries already  
disagree on some of this, and even if they did a library added in the  
future might not.  
  
The right solution is to define what the API does, and translate the  
library-specific behavior in consistent way (so that the internal errors  
are not exposed to users of our compression API). So this adjusts the  
data types in a couple places, so that we don't miss library errors, and  
simplifies and unifies the error reporting to simply return true/false  
(instead of e.g. size_t).  
  
While at it, make sure LZ4File_open_write() does not clobber errno in  
case open_func() fails.  
  
Author: Georgios Kokolatos  
Reported-by: Alexander Lakhin  
Reviewed-by: Tomas Vondra, Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_directory.c

Wrap ICU ucol_open().

commit   : a326aac8f1719c37529ae090f66bac9e62c32346    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 23 Mar 2023 09:15:25 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 23 Mar 2023 09:15:25 -0700    

Click here for diff

Hide details of supporting older ICU versions in a wrapper  
function. The current code only needs to handle  
icu_set_collation_attributes(), but a subsequent commit will add  
additional version-specific code.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

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

Ignore generated columns during apply of update/delete.

commit   : adedf54e659ea37316a21c8d5a7aa8f711213d1c    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 23 Mar 2023 11:58:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 23 Mar 2023 11:58:36 +0530    

Click here for diff

We fail to apply updates and deletes when the REPLICA IDENTITY FULL is  
used for the table having generated columns. We didn't use to ignore  
generated columns while doing tuple comparison among the tuples from  
the publisher and subscriber during apply of updates and deletes.  
  
Author: Onder Kalaci  
Reviewed-by: Shi yu, Amit Kapila  
Backpatch-through: 12  
Discussion: https://postgr.es/m/CACawEhVQC9WoofunvXg12aXtbqKnEgWxoRx3+v8q32AWYsdpGg@mail.gmail.com  

M src/backend/executor/execReplication.c
M src/test/subscription/t/100_bugs.pl

Allow logical replication to copy tables in binary format.

commit   : ecb696527c01908d54b7a7aa2bd9179585b46459    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 23 Mar 2023 08:45:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 23 Mar 2023 08:45:51 +0530    

Click here for diff

This patch allows copying tables in the binary format during table  
synchronization when the binary option for a subscription is enabled.  
Previously, tables are copied in text format even if the subscription is  
created with the binary option enabled. Copying tables in binary format  
may reduce the time spent depending on column types.  
  
A binary copy for initial table synchronization is supported only when  
both publisher and subscriber are v16 or later.  
  
Author: Melih Mutlu  
Reviewed-by: Peter Smith, Shi yu, Euler Taveira, Vignesh C,  Kuroda Hayato, Osumi Takamichi, Bharath Rupireddy, Hou Zhijie  
Discussion: https://postgr.es/m/CAGPVpCQvAziCLknEnygY0v1-KBtg%2BOm-9JHJYZOnNPKFJPompw%40mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/replication/logical/tablesync.c
M src/test/subscription/t/014_binary.pl

Improve a bit the tests of pg_walinspect

commit   : 4f1882b960596c35d62c78fb44e14913eff49a85    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 Mar 2023 11:50:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 Mar 2023 11:50:35 +0900    

Click here for diff

This commit improves the tests of pg_walinspect on a few things:  
- Remove aggregates for queries that should fail.  If the code is  
reworked in such a way that the behavior of these queries is changed,  
we would get more input from them, written this way.  
- Expect at least one record reported in the valid queries doing scans  
across ranges, rather than zero records.  
- Adjust a few comments, for consistency.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVaoXW3nJD9zq8E66BEf-phgJfFcKRVJq9GXkuX0b3ULQ@mail.gmail.com  

M contrib/pg_walinspect/expected/oldextversions.out
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/sql/oldextversions.sql
M contrib/pg_walinspect/sql/pg_walinspect.sql

Improve the naming of Parallel Hash Join phases.

commit   : 8fba928fd78856712f69d96852f8061e77390fda    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 23 Mar 2023 12:39:43 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 23 Mar 2023 12:39:43 +1300    

Click here for diff

* Commit 3048898e dropped -ING from PHJ wait event names.  Update the  
  corresponding barrier phases names to match.  
  
* Rename the "DONE" phases to "FREE".  That's symmetrical with  
  "ALLOCATE", and names the activity that actually happens in that phase  
  (as we do for the other phases) rather than a state.  The bug fixed by  
  commit 8d578b9b might have been more obvious with this name.  
  
* Rename the batch/bucket growth barriers' "ALLOCATE" phases to  
  "REALLOCATE", a better description of what they do.  
  
* Update the high level comments about phases to highlight phases  
  are executed by a single process with an asterisk (mostly memory  
  management phases).  
  
No behavior change, as this is just improving internal identifiers.  The  
only user-visible sign of this is that a couple of wait events' display  
names change from "...Allocate" to "...Reallocate" in pg_stat_activity,  
to stay in sync with the internal names.  
  
Reviewed-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BMDpwF2Eo2LAvzd%3DpOh81wUTsrwU1uAwR-v6OGBB6%2B7g%40mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/utils/activity/wait_event.c
M src/include/executor/hashjoin.h
M src/include/utils/wait_event.h

Allow locking updated tuples in tuple_update() and tuple_delete()

commit   : 11470f544e3729c60fab890145b2e839cbc8905e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 Mar 2023 00:13:37 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 Mar 2023 00:13:37 +0300    

Click here for diff

Currently, in read committed transaction isolation mode (default), we have the  
following sequence of actions when tuple_update()/tuple_delete() finds  
the tuple updated by concurrent transaction.  
  
1. Attempt to update/delete tuple with tuple_update()/tuple_delete(), which  
   returns TM_Updated.  
2. Lock tuple with tuple_lock().  
3. Re-evaluate plan qual (recheck if we still need to update/delete and  
   calculate the new tuple for update).  
4. Second attempt to update/delete tuple with tuple_update()/tuple_delete().  
   This attempt should be successful, since the tuple was previously locked.  
  
This patch eliminates step 2 by taking the lock during first  
tuple_update()/tuple_delete() call.  Heap table access method saves some  
efforts by checking the updated tuple once instead of twice.  Future  
undo-based table access methods, which will start from the latest row version,  
can immediately place a lock there.  
  
The code in nodeModifyTable.c is simplified by removing the nested switch/case.  
  
Discussion: https://postgr.es/m/CAPpHfdua-YFw3XTprfutzGp28xXLigFtzNbuFY8yPhqeq6X5kg%40mail.gmail.com  
Reviewed-by: Aleksander Alekseev, Pavel Borisov, Vignesh C, Mason Sharp  
Reviewed-by: Andres Freund, Chris Travers  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/tableam.h
M src/include/executor/tuptable.h
M src/tools/pgindent/typedefs.list

Evade extra table_tuple_fetch_row_version() in ExecUpdate()/ExecDelete()

commit   : 764da7710bf68eebb2c0facb2f871bc3c7a705b6    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 Mar 2023 00:12:00 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 Mar 2023 00:12:00 +0300    

Click here for diff

When we lock tuple using table_tuple_lock() then we at the same time fetch  
the locked tuple to the slot.  In this case we can skip extra  
table_tuple_fetch_row_version() thank to we've already fetched the 'old' tuple  
and nobody can change it concurrently since it's locked.  
  
Discussion: https://postgr.es/m/CAPpHfdua-YFw3XTprfutzGp28xXLigFtzNbuFY8yPhqeq6X5kg%40mail.gmail.com  
Reviewed-by: Aleksander Alekseev, Pavel Borisov, Vignesh C, Mason Sharp  
Reviewed-by: Andres Freund, Chris Travers  

M src/backend/executor/nodeModifyTable.c

Fix new test case to work on (some?) big-endian architectures.

commit   : c75a623304bc361b4456f916d455ea175ffd8055    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Mar 2023 17:14:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Mar 2023 17:14:21 -0400    

Click here for diff

Use of pack("L") gets around the basic endian problem, but it doesn't  
deal with the fact that the order of the bitfields within the struct  
may differ.  This patch fixes it to work with gcc on NetBSD/macppc,  
but I wonder whether that will be enough --- in principle, there  
could be four different combinations of bitpatterns needed here.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_amcheck/t/004_verify_heapam.pl

Fix initdb's handling of min_wal_size and max_wal_size.

commit   : b48af6d174bb39bd688d52795aef2b9c10dd6e8c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Mar 2023 16:37:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Mar 2023 16:37:41 -0400    

Click here for diff

In commit 3e51b278d, I misinterpreted the coding in setup_config()  
as setting min_wal_size and max_wal_size to compile-time-constant  
values.  But it's not: there's a hidden dependency on --wal-segsize.  
Therefore leaving these variables commented out is the wrong thing.  
Per report from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c

Reduce memory leakage in initdb.

commit   : 4fe2aa7656dce2bd31d4807a6843ff495b9deb80    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Mar 2023 14:28:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Mar 2023 14:28:45 -0400    

Click here for diff

While testing commit 3e51b278d, I noted that initdb leaks about a  
megabyte worth of data due to the sloppy bookkeeping in its  
string-manipulating code.  That's not a huge amount on modern machines,  
but it's still kind of annoying, and it's easy to fix by recognizing  
that we might as well treat these arrays of strings as  
modifiable-in-place.  There's no caller that cares about preserving  
the old state of the array after replace_token or replace_guc_value.  
  
With this fix, valgrind sees only a few hundred bytes leaked during  
an initdb run.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c

Add "-c name=value" switch to initdb.

commit   : 3e51b278db6a4e2f50f3f6b9edc9667af1f934fd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Mar 2023 13:48:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Mar 2023 13:48:44 -0400    

Click here for diff

This option, or its long form --set, sets the GUC "name" to "value".  
The setting applies in the bootstrap and standalone servers run by  
initdb, and is also written into the generated postgresql.conf.  
  
This can save an extra editing step when creating a new cluster,  
but the real use-case is for coping with situations where the  
bootstrap server fails to start due to environmental issues;  
for example, if it's necessary to force huge_pages to off.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/initdb.sgml
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl

Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY WAL_LOG

commit   : 5df319f3d55d09fadb4f7e4b58c5b476a3aeceb4    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Mar 2023 21:57:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Mar 2023 21:57:40 -0700    

Click here for diff

RelationCopyStorageUsingBuffer() did not free the strategies used to access  
the source / target relation. They memory was released at the end of the  
transaction, but when using a template database with a lot of relations, the  
temporary leak can become big prohibitively big.  
  
RelationCopyStorageUsingBuffer() acquired the buffer for the target relation  
with RBM_NORMAL, therefore requiring a read of a block guaranteed to be  
zero. Use RBM_ZERO_AND_LOCK instead.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where STRATEGY WAL_LOG was introduced  

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

Teach verify_heapam() to validate update chains within a page.

commit   : bbc1376b39627c6bddd8a0dc0a7dda24c91a97a0    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 22 Mar 2023 08:48:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 22 Mar 2023 08:48:54 -0400    

Click here for diff

Prior to this commit, we only consider each tuple or line pointer  
on the page in isolation, but now we can do some validation of a line  
pointer against its successor. For example, a redirect line pointer  
shouldn't point to another redirect line pointer, and if a tuple  
is HOT-updated, the result should be a heap-only tuple.  
  
Himanshu Upadhyaya and Robert Haas, reviewed by Aleksander Alekseev,  
Andres Freund, and Peter Geoghegan.  

M contrib/amcheck/verify_heapam.c
M src/bin/pg_amcheck/t/004_verify_heapam.pl

doc: Add description of some missing monitoring functions

commit   : d69c404c4cc5985d8ae5b5ed38bed3400b317f82    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Mar 2023 18:31:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Mar 2023 18:31:52 +0900    

Click here for diff

This commit adds some documentation about two monitoring functions:  
- pg_stat_get_xact_blocks_fetched()  
- pg_stat_get_xact_blocks_hit()  
  
The description of these functions has been removed in ddfc2d9, later  
simplified by 5f2b089, assuming that all the functions whose  
descriptions were removed are used in system views.  Unfortunately, some  
of them were are not used in any system views, so they lacked  
documentation.  
  
This gap exists in the docs for a long time, so backpatch all the way  
down.  
  
Reported-by: Michael Paquier  
Author: Bertrand Drouvot  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M doc/src/sgml/monitoring.sgml

Fix a couple of typos

commit   : 88199b9d5fda605360ac903dd9d3de0ca36f0b8c    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Mar 2023 08:44:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Mar 2023 08:44:59 +0900    

Click here for diff

PL/pgSQL was misspelled in a few places, so fix these.  
  
Author: Zhang Mingli  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/1bd41572-9cd9-465e-9f59-ee45385e51b4@Spark  

M src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/sql/plpython_ereport.sql
M src/test/modules/test_pg_dump/t/001_base.pl

Support language tags in older ICU versions (53 and earlier).

commit   : 869650fa86adf74fca7f566c9317f6310f8b400c    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 21 Mar 2023 15:49:18 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 21 Mar 2023 15:49:18 -0700    

Click here for diff

By calling uloc_canonicalize() before parsing the attributes, the  
existing locale attribute parsing logic works on language tags as  
well.  
  
Fix a small memory leak, too.  
  
Discussion: http://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

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

Fix make maintainer-clean with queryjumblefuncs.*.c files in src/backend/nodes/

commit   : e8e1f96c497bda50ec02ed7360a6ed56c5f70f60    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Mar 2023 07:43:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Mar 2023 07:43:23 +0900    

Click here for diff

The files generated by gen_node_support.pl for query jumbling  
(queryjumblefuncs.funcs.c and queryjumblefuncs.switch.c) were not being  
removed on make maintainer-clean (they need to remain around after a  
simple "clean").  This commit makes the operation consistent with the  
copy, equal, out and read files.  
  
While on it, update a comment in the nodes'README where a reference to  
queryjumblefuncs.funcs.c was missing.  
  
Reported-by: Nathan Bossart  
Reviewed-by: Richard Guo, Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/Makefile
M src/backend/nodes/README

Fix incorrect comment in preptlist.c

commit   : b94c671648a6b2141f3309386023afd47f0bd886    
  
author   : David Rowley <[email protected]>    
date     : Wed, 22 Mar 2023 08:58:13 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 22 Mar 2023 08:58:13 +1300    

Click here for diff

Author: Etsuro Fujita  
Reviewed-by: Richard Guo, Tom Lane  
Discussion: https://postgr.es/m/CAPmGK15V8dcVxL9vcgVWPHV6pw1qzM42LzoUkQDB7-e+1onnJw@mail.gmail.com  

M src/backend/optimizer/prep/preptlist.c

Correct Memoize's estimated cache hit ratio calculation

commit   : f48b4f892f76ee2b34968013c8ea67b1dfd4fa26    
  
author   : David Rowley <[email protected]>    
date     : Wed, 22 Mar 2023 08:44:54 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 22 Mar 2023 08:44:54 +1300    

Click here for diff

As demonstrated by David Johnston, the Memoize cache hit ratio calculation  
wasn't quite correct.  
  
This change only affects the estimated hit ratio when the estimated number  
of entries to cache is estimated not to fit inside the cache.  For  
example, if we expect 2000 distinct cache key values and only expect to be  
able to cache 1000 of those at once due to memory constraints, with an  
estimate of 10000 calls, if we could store all entries then the hit ratio  
should be 80% to account for the first 2000 of the 10000 calls to be a  
cache miss due to the value not being cached yet.  If we can only store  
1000 entries for each of the 2000 distinct possible values at once then  
the 80% should be reduced by half to make the final estimate of 40%.  
Previously, the calculation would have produced an estimated hit ratio of  
30%, which wasn't correct.  
  
Apply to master only so as not to destabilize plans in the back branches.  
  
Reported-by: David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwZEmcNk3YQo2Xj4EDUOdY6qakad31rOD1Vc4q1_s68-Ew@mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvrV44LwiF4W_qf_RpbGYWSgp1kF=cZr+kTRRaALUfmXqw@mail.gmail.com  

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

Add SHELL_ERROR and SHELL_EXIT_CODE magic variables to psql.

commit   : b0d8f2d983cb25d1035fae1cd7de214dd67809b4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Mar 2023 13:03:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Mar 2023 13:03:42 -0400    

Click here for diff

These are set after a \! command or a backtick substitution.  
SHELL_ERROR is just "true" for error (nonzero exit status) or "false"  
for success, while SHELL_EXIT_CODE records the actual exit status  
following standard shell/system(3) conventions.  
  
Corey Huinker, reviewed by Maxim Orlov and myself  
  
Discussion: https://postgr.es/m/CADkLM=cWao2x2f+UDw15W1JkVFr_bsxfstw=NGea7r9m4j-7rQ@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/psqlscanslash.l
M src/common/wait_error.c
M src/include/port.h

docs: use consistent markup for PostgreSQL

commit   : 0f85db92b9ea167d3b9e90f3fb5fb3b9a93babc2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 21 Mar 2023 17:23:20 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 21 Mar 2023 17:23:20 +0100    

Click here for diff

"PostgreSQL" should use <productname> markup consistenktly, so that  
if we do apply styling on it it will be consistently applied.  Fix  
by renaming the one exception to the rule.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Avoid using atooid for numerical comparisons which arent Oids

commit   : 106f26a849bbb760a270e9a3c586aeb73899e26a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 21 Mar 2023 12:57:21 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 21 Mar 2023 12:57:21 +0100    

Click here for diff

The check for the number of roles in the target cluster for an upgrade  
selects the existing roles and performs a COUNT(*) over the result.  A  
value of one is the expected query result value indicating that only  
the install user is present in the new cluster. The result was converted  
with the function for converting a string containing an Oid into a numeric,  
which avoids potential overflow but makes the code less readable since  
it's not actually an Oid at all.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/check.c

pg_waldump: Allow hexadecimal values for -t/--timeline option

commit   : 4c8044c04455fe87dadefa4f7c69bfe6cdbe3cc5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Mar 2023 08:01:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Mar 2023 08:01:12 +0100    

Click here for diff

This makes it easier to specify values taken directly from WAL file  
names.  
  
The option parsing is arranged in the style of option_parse_int() (but  
we need to parse unsigned int), to allow future refactoring in the  
same manner.  
  
Reviewed-by: Sébastien Lardière <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/pg_waldump.sgml
M src/bin/pg_waldump/pg_waldump.c

Ignore dropped columns during apply of update/delete.

commit   : b797def5951fcd8eed2124b7316cc9027d6228cc    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 21 Mar 2023 09:47:21 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 21 Mar 2023 09:47:21 +0530    

Click here for diff

We fail to apply updates and deletes when the REPLICA IDENTITY FULL is  
used for the table having dropped columns. We didn't use to ignore dropped  
columns while doing tuple comparison among the tuples from the publisher  
and subscriber during apply of updates and deletes.  
  
Author: Onder Kalaci, Shi yu  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CACawEhVQC9WoofunvXg12aXtbqKnEgWxoRx3+v8q32AWYsdpGg@mail.gmail.com  

M src/backend/executor/execReplication.c
M src/test/subscription/t/100_bugs.pl

Fix race in parallel hash join batch cleanup, take II.

commit   : 8d578b9b2e37a4d9d6f422ced5126acec62365a7    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 21 Mar 2023 14:29:34 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 21 Mar 2023 14:29:34 +1300    

Click here for diff

With unlucky timing and parallel_leader_participation=off (not the  
default), PHJ could attempt to access per-batch shared state just as it  
was being freed.  There was code intended to prevent that by checking  
for a cleared pointer, but it was racy.  Fix, by introducing an extra  
barrier phase.  The new phase PHJ_BUILD_RUNNING means that it's safe to  
access the per-batch state to find a batch to help with, and  
PHJ_BUILD_DONE means that it is too late.  The last to detach will free  
the array of per-batch state as before, but now it will also atomically  
advance the phase, so that late attachers can avoid the hazard.  This  
mirrors the way per-batch hash tables are freed (see phases  
PHJ_BATCH_PROBING and PHJ_BATCH_DONE).  
  
An earlier attempt to fix this (commit 3b8981b6, later reverted) missed  
one special case.  When the inner side is empty (the "empty inner  
optimization), the build barrier would only make it to  
PHJ_BUILD_HASHING_INNER phase before workers attempted to detach from  
the hashtable.  In that case, fast-forward the build barrier to  
PHJ_BUILD_RUNNING before proceeding, so that our later assertions hold  
and we can still negotiate who is cleaning up.  
  
Revealed by build farm failures, where BarrierAttach() failed a sanity  
check assertion, because the memory had been clobbered by dsa_free().  
In non-assert builds, the result could be a segmentation fault.  
  
Back-patch to all supported releases.  
  
Author: Thomas Munro <[email protected]>  
Author: Melanie Plageman <[email protected]>  
Reported-by: Michael Paquier <[email protected]>  
Reported-by: David Geier <[email protected]>  
Tested-by: David Geier <[email protected]>  
Discussion: https://postgr.es/m/20200929061142.GA29096%40paquier.xyz  

M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/include/executor/hashjoin.h

Stabilize pg_stat_io writes test

commit   : ef719e7b32fc2ec9f78c2d9de099f7d75b61cd1b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Mar 2023 18:16:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Mar 2023 18:16:06 -0700    

Click here for diff

Counting writes only for io_context = 'normal' is unreliable, as backends  
using a buffer access strategy could flush all of the dirty buffers out from  
under the other backends and checkpointer. Change the test to count writes in  
any context. This achieves roughly the same coverage anyway.  
  
Reported-by: Justin Pryzby <[email protected]>  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/ZAnWU8WbXEDjrfUE%40telsasoft.com  

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

meson: rename html_help target to htmlhelp

commit   : 7730ceb43fe5ecaa2b3cb26eb0ed8ad2e18c2d46    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Mar 2023 17:23:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Mar 2023 17:23:57 -0700    

Click here for diff

Reported-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/meson.build

Add @extschema:name@ and no_relocate options to extensions.

commit   : 72a5b1fc880481914da2d4233077438dd87840ca    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Mar 2023 18:37:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Mar 2023 18:37:11 -0400    

Click here for diff

@extschema:name@ extends the existing @extschema@ feature so that  
we can also insert the schema name of some required extension,  
thus making cross-extension references robust even if they are in  
different schemas.  
  
However, this has the same hazard as @extschema@: if the schema  
name is embedded literally in an installed object, rather than being  
looked up once during extension script execution, then it's no longer  
safe to relocate the other extension to another schema.  To deal with  
that without restricting things unnecessarily, add a "no_relocate"  
option to extension control files.  This allows an extension to  
specify that it cannot handle relocation of some of its required  
extensions, even if in themselves those extensions are relocatable.  
We detect "no_relocate" requests of dependent extensions during  
ALTER EXTENSION SET SCHEMA.  
  
Regina Obe, reviewed by Sandro Santilli and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/extend.sgml
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_req_schema1–1.0.sql
A src/test/modules/test_extensions/test_ext_req_schema1.control
A src/test/modules/test_extensions/test_ext_req_schema2–1.0.sql
A src/test/modules/test_extensions/test_ext_req_schema2.control
A src/test/modules/test_extensions/test_ext_req_schema3–1.0.sql
A src/test/modules/test_extensions/test_ext_req_schema3.control

doc/PDF: Add page breaks for <sect1> in contrib appendix

commit   : 30e9f2608adf2f61fc2e1be13ef8bc88c250f303    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Mar 2023 14:01:09 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Mar 2023 14:01:09 +0100    

Click here for diff

This better separates the content for each extension/module.  
  
Author: Karl Pinc <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/stylesheet-fo.xsl

Ignore BRIN indexes when checking for HOT updates

commit   : 19d8e2308bc51ec4ab993ce90077342c915dd116    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 20 Mar 2023 10:34:07 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 20 Mar 2023 10:34:07 +0100    

Click here for diff

When determining whether an index update may be skipped by using HOT, we  
can ignore attributes indexed by block summarizing indexes without  
references to individual tuples that need to be cleaned up.  
  
A new type TU_UpdateIndexes provides a signal to the executor to  
determine which indexes to update - no indexes, all indexes, or only the  
summarizing indexes.  
  
This also removes rd_indexattr list, and replaces it with rd_attrsvalid  
flag. The list was not used anywhere, and a simple flag is sufficient.  
  
This was originally committed as 5753d4ee32, but then got reverted by  
e3fcca0d0d because of correctness issues.  
  
Original patch by Josef Simanek, various fixes and improvements by Tomas  
Vondra and me.  
  
Authors: Matthias van de Meent, Josef Simanek, Tomas Vondra  
Reviewed-by: Tomas Vondra, Alvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAFp7QwpMRGcDAQumN7onN9HjrJ3u4X3ZRXdGFT0K5G2JWvnbWg%40mail.gmail.com  

M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/table/tableam.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/commands/copyfrom.c
M src/backend/commands/indexcmds.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/makefuncs.c
M src/backend/utils/cache/relcache.c
M src/include/access/amapi.h
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/makefuncs.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Fix netmask handling in inet_minmax_multi_ops

commit   : e8583126833a53f4eebe28a8de45d128f01ff664    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 20 Mar 2023 09:51:50 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 20 Mar 2023 09:51:50 +0100    

Click here for diff

When calculating distance in brin_minmax_multi_distance_inet(), the  
netmask was applied incorrectly. This results in (seemingly) incorrect  
ordering of values, triggering an assert.  
  
For builds without asserts this is mostly harmless - we may merge other  
ranges, possibly resulting in slightly less efficient index. But it's  
still correct and the greedy algorithm doesn't guarantee optimality  
anyway.  
  
Backpatch to 14, where minmax-multi indexes were introduced.  
  
Reported by Dmitry Dolgov, investigation and fix by me.  
  
Reported-by: Dmitry Dolgov  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_minmax_multi.c
M src/test/regress/expected/brin_multi.out
M src/test/regress/sql/brin_multi.sql

doc: Additional information about timeline ID hexadecimal format

commit   : 0b51d423e974557e821d890c0a3a49e419a19caa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Mar 2023 08:48:46 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Mar 2023 08:48:46 +0100    

Click here for diff

Timeline IDs are sometimes presented to the user in hexadecimal format  
(for example in WAL file names).  Add a few bits of information to  
clarify this.  
  
Author: Sébastien Lardière <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml

Have the planner account for the Memoize cache key memory

commit   : 785f7095767e148995d276fe52f6b1e1af76e726    
  
author   : David Rowley <[email protected]>    
date     : Mon, 20 Mar 2023 16:26:04 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 20 Mar 2023 16:26:04 +1300    

Click here for diff

The Memoize executor node stores the cache key values along with the  
tuple(s) which were found in the outer node which match each key value,  
however, when the planner tried to estimate how many entries could be  
stored in the cache, it didn't take into account that the cache key must  
also be stored.  In many cases, this won't make a large difference as the  
key is likely small in comparison to the tuple(s) being stored, however,  
it's not impossible to craft cases where the key could take more memory  
than the tuple(s) stored for it.  
  
Here we adjust the planner so it takes into account the estimated amount  
of memory to store the cache key.  Effectively, this change will reduce  
the estimated cache hit ratio when it's thought that not all items will  
fit in the cache, thus Memoize will become more expensive in such cases.  
  
The executor already takes into account the memory consumed by the cache  
key, so here we only need to adjust the planner.  
  
Discussion: https://postgr.es/m/CAApHDvqGErGuyBfQvBQrTCHDbzLTqoiW=_G9sOzeFxWEc_7auA@mail.gmail.com  

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

Fix memory leak in Memoize cache key evaluation

commit   : 579ee5df14dfcf5213e502bb096121d2249167c2    
  
author   : David Rowley <[email protected]>    
date     : Mon, 20 Mar 2023 13:28:47 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 20 Mar 2023 13:28:47 +1300    

Click here for diff

When probing the Memoize cache to check if the current cache key values  
exist in the cache, we perform an evaluation of the expressions making up  
the cache key before probing the hash table for those values.  This  
operation could leak memory as it is possible that the cache key is an  
expression which requires allocation of memory, as was the case in bug  
17844.  
  
Here we fix this by correctly switching to the per tuple context before  
evaluating the cache expressions so that the memory is freed next time the  
per tuple context is reset.  
  
Bug: 17844  
Reported-by: Alexey Ermakov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where Memoize was introduced  

M src/backend/executor/nodeMemoize.c

Avoid copying undefined data in _readA_Const().

commit   : e060cd59fabda2a0b2a7e119a58887791d030942    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Mar 2023 15:36:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Mar 2023 15:36:16 -0400    

Click here for diff

nodeRead() will have created a Node struct that's only allocated big  
enough for the specific node type, so copying sizeof(union ValUnion)  
can be copying too much.  This provokes valgrind complaints, and with  
very bad luck could perhaps result in SIGSEGV.  
  
While at it, tidy up _equalA_Const to avoid duplicate checks of isnull.  
  
Per report from Alexander Lakhin.  This code is new as of a6bc33019,  
so no need to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/equalfuncs.c
M src/backend/nodes/readfuncs.c

Doc: fix documentation example for bytea hex output format.

commit   : 4f46f870fa56fa73d6678273f1bd059fdd93d5e6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Mar 2023 16:11:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Mar 2023 16:11:22 -0400    

Click here for diff

Per report from rsindlin  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Add functions to do timestamptz arithmetic in a non-default timezone.

commit   : 75bd846b68b09f33a57d9de96064ded4d392ca05    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Mar 2023 14:12:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Mar 2023 14:12:14 -0400    

Click here for diff

Add versions of timestamptz + interval, timestamptz - interval, and  
generate_series(timestamptz, ...) in which a timezone can be specified  
explicitly instead of defaulting to the TimeZone GUC setting.  
  
The new functions for the first two are named date_add and  
date_subtract.  This might seem too generic, but we could use  
overloading to add additional variants if that seems useful.  
  
Along the way, improve the docs' pretty inadequate explanation  
of how timestamptz +- interval works.  
  
Przemysław Sztoch and Gurjeet Singh; cosmetic changes and most of  
the docs work by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/timestamp.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamptz.sql

commit   : 0e681cf0390ddd720424cd134a2c42dffc2934fd    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 18 Mar 2023 18:04:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 18 Mar 2023 18:04:04 +0900    

Click here for diff

This caused ninja clean to not remove the two files generated by  
gen_node_support.pl for the query jumbling, for example:  
queryjumblefuncs.funcs.c and queryjumblefuncs.switch.c.  
  
Reported-by: Pavel Stehule  
Discussion: https://postgr.es/m/CAFj8pRBFiWVRyGYSPziyFuXJbHirNmfWwzbfTyCf8YOdiwK74w@mail.gmail.com  

M src/include/nodes/meson.build

Refactor datetime functions' timezone lookup code to reduce duplication.

commit   : 3e59e5048d0f20debe4ad79b2e02ca2a76c5daed    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Mar 2023 17:47:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Mar 2023 17:47:15 -0400    

Click here for diff

We already had five copies of essentially the same logic, and an  
upcoming patch introduces yet another use-case.  That's past my  
threshold of pain, so introduce a common subroutine.  There's not  
that much net code savings, but the chance of typos should go down.  
  
Inspired by a patch from Przemysław Sztoch, but different in detail.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/datetime.h

Fix typo

commit   : cc1392d4aa5206d6b4dcc1b036f7a001bcac4197    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2023 21:39:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2023 21:39:44 +0100    

Click here for diff

Introduced in de4d456b40.  
  
Reported-by: Erik Rijkers <[email protected]>  

M src/backend/commands/user.c

Fix t_isspace(), etc., when datlocprovider=i and datctype=C.

commit   : f413941f41d370a7893caa3e6ed384b89a0577fd    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 17 Mar 2023 11:47:35 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 17 Mar 2023 11:47:35 -0700    

Click here for diff

Check whether the datctype is C to determine whether t_isspace() and  
related functions use isspace() or iswspace().  
  
Previously, t_isspace() checked whether the database default collation  
was C; which is incorrect when the default collation uses the ICU  
provider.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  
Backpatch-through: 15  

M contrib/unaccent/expected/unaccent.out
D contrib/unaccent/expected/unaccent_1.out
M contrib/unaccent/sql/unaccent.sql
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/include/utils/pg_locale.h

Simplify and speed up pg_dump's creation of parent-table links.

commit   : 064709f803c05559d2849a62fdb855fbb91ffeb8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Mar 2023 13:43:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Mar 2023 13:43:10 -0400    

Click here for diff

Instead of trying to optimize this by skipping creation of the  
links for tables we don't plan to dump, just create them all in  
bulk with a single scan over the pg_inherits data.  The previous  
approach was more or less O(N^2) in the number of pg_inherits  
entries, not to mention being way too complicated.  
  
Also, don't create useless TableAttachInfo objects.  
It's silly to create a TableAttachInfo object that we're not  
going to dump, when we know perfectly well at creation time  
that it won't be dumped.  
  
Patch by me; thanks to Julien Rouhaud for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Fix pg_dump for hash partitioning on enum columns.

commit   : bc8cd50fefd369b217f80078585c486505aafb62    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Mar 2023 13:31:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Mar 2023 13:31:40 -0400    

Click here for diff

Hash partitioning on an enum is problematic because the hash codes are  
derived from the OIDs assigned to the enum values, which will almost  
certainly be different after a dump-and-reload than they were before.  
This means that some rows probably end up in different partitions than  
before, causing restore to fail because of partition constraint  
violations.  (pg_upgrade dodges this problem by using hacks to force  
the enum values to keep the same OIDs, but that's not possible nor  
desirable for pg_dump.)  
  
Users can work around that by specifying --load-via-partition-root,  
but since that's a dump-time not restore-time decision, one might  
find out the need for it far too late.  Instead, teach pg_dump to  
apply that option automatically when dealing with a partitioned  
table that has hash-on-enum partitioning.  
  
Also deal with a pre-existing issue for --load-via-partition-root  
mode: in a parallel restore, we try to TRUNCATE target tables just  
before loading them, in order to enable some backend optimizations.  
This is bad when using --load-via-partition-root because (a) we're  
likely to suffer deadlocks from restore jobs trying to restore rows  
into other partitions than they came from, and (b) if we miss getting  
a deadlock we might still lose data due to a TRUNCATE removing rows  
from some already-completed restore job.  
  
The fix for this is conceptually simple: just don't TRUNCATE if we're  
dealing with a --load-via-partition-root case.  The tricky bit is for  
pg_restore to identify those cases.  In dumps using COPY commands we  
can inspect each COPY command to see if it targets the nominal target  
table or some ancestor.  However, in dumps using INSERT commands it's  
pretty impractical to examine the INSERTs in advance.  To provide a  
solution for that going forward, modify pg_dump to mark TABLE DATA  
items that are using --load-via-partition-root with a comment.  
(This change also responds to a complaint from Robert Haas that  
the dump output for --load-via-partition-root is pretty confusing.)  
pg_restore checks for the special comment as well as checking the  
COPY command if present.  This will fail to identify the combination  
of --load-via-partition-root and --inserts in pre-existing dump files,  
but that should be a pretty rare case in the field.  If it does  
happen you will probably get a deadlock failure that you can work  
around by not using parallel restore, which is the same as before  
this bug fix.  
  
Having done this, there seems no remaining reason for the alarmism  
in the pg_dump man page about combining --load-via-partition-root  
with parallel restore, so remove that warning.  
  
Patch by me; thanks to Julien Rouhaud for review.  Back-patch to  
v11 where hash partitioning was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M src/bin/pg_dump/common.c
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
A src/bin/pg_dump/t/004_pg_dump_parallel.pl

commit   : de4d456b406bf502341ef526710d3f764b41e2c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2023 10:14:16 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2023 10:14:16 +0100    

Click here for diff

Mainly move some detail from errmsg to errdetail, remove explicit  
mention of superuser where appropriate, since that is implied in most  
permission checks, and make messages more uniform.  
  
Author: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20230316234701.GA903298@nathanxps13  

M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/file_fdw.c
M contrib/test_decoding/expected/permissions.out
M src/backend/backup/basebackup_server.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/copy.c
M src/backend/commands/user.c
M src/backend/replication/slot.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/tcop/utility.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/modules/unsafe_tests/expected/rolenames.out
M src/test/regress/expected/create_role.out
M src/test/regress/expected/dependency.out
M src/test/regress/expected/privileges.out

postgres_fdw: Remove useless if-test in GetConnection().

commit   : 39a3bdc9eba50628cecb7e3cada95271180c8744    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 17 Mar 2023 18:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 17 Mar 2023 18:15:00 +0900    

Click here for diff

Checking whether entry->conn is NULL after doing disconnect_pg_server()  
for that entry is pointless, as that function ensures that it is NULL.  
  
Thinko in commit 7fc1a81e4; this would be harmless, so patch HEAD only.  
  
Reviewed-by: Richard Guo and Daniel Gustafsson  
Discussion: https://postgr.es/m/CAPmGK169vQ83PQwQkoxO-AK2EeK1EsgsxixedM%2BBLWEAhZ_AqQ%40mail.gmail.com  

M contrib/postgres_fdw/connection.c

libpq: Use modern socket flags, if available.

commit   : bfc9497ece01c7c45437bc36387cb1ebe346f4d2    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 17 Mar 2023 17:08:02 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 17 Mar 2023 17:08:02 +1300    

Click here for diff

Since commit 7627b91cd5d, libpq has used FD_CLOEXEC so that sockets  
wouldn't be leaked to subprograms.  With enough bad luck, a  
multi-threaded program might fork in between the socket() and fcntl()  
calls.  We can close that tiny gap by using SOCK_CLOEXEC instead of a  
separate call.  While here, we might as well do the same for  
SOCK_NONBLOCK, to save another syscall.  
  
These flags are expected to appear in the next revision of the POSIX  
standard, specifically to address this problem.  Our Unixoid targets  
except macOS and AIX have had them for a long time, and macOS would  
hopefully use guarded availability to roll them out, so it seems enough  
to use a simple ifdef test for availability until we hear otherwise.  
Windows doesn't have them, but has non-inheritable sockets by default.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKb6FsAdQWcRL35KJsftv%2B9zXqQbzwkfRf1i0J2e57%2BhQ%40mail.gmail.com  

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

Fix incorrect format placeholders

commit   : 95a828378ed243a1b37cab6bda99746bfc0af509    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2023 07:35:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Mar 2023 07:35:43 +0100    

Click here for diff

Small fixup for 9637badd9f.  

M src/bin/pg_upgrade/pg_upgrade.c

tests: Prevent syslog activity by slapd, take 2

commit   : 64470973b12ae0fa45f7c364579305279bb58b93    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Mar 2023 23:03:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Mar 2023 23:03:31 -0700    

Click here for diff

Unfortunately it turns out that the logfile-only option added in b9f8d1cbad7  
is only available in openldap starting in 2.6.  
  
Luckily the option to control the log level (loglevel/-s) have been around for  
much longer. As it turns out loglevel/-s only control what goes into syslog,  
not what ends up in the file specified with 'logfile' and stderr.  
  
While we currently are specifying 'logfile', nothing ends up in it, as the  
option only controls debug messages, and we didn't set a debug level. The  
debug level can only be configured on the commandline and also prevents  
forking. That'd require larger changes, so this commit doesn't tackle that  
issue.  
  
Specify the syslog level when starting slapd using -s, as that allows to  
prevent all syslog messages if one uses '0' instead of 'none', while loglevel  
doesn't prevent the first message.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-  

M src/test/ldap/LdapServer.pm

Add macros for ReorderBufferTXN toptxn.

commit   : e709596b25bd184d6566dfff240e3f672a548afe    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 17 Mar 2023 08:29:41 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 17 Mar 2023 08:29:41 +0530    

Click here for diff

Currently, there are quite a few places in reorderbuffer.c that tries to  
access top-transaction for a subtransaction. This makes the code to access  
top-transaction consistent and easier to follow.  
  
Author: Peter Smith  
Reviewed-by: Vignesh C, Sawada Masahiko  
Discussion: https://postgr.es/m/CAHut+PuCznOyTqBQwjRUu-ibG-=KHyCv-0FTcWQtZUdR88umfg@mail.gmail.com  

M contrib/test_decoding/test_decoding.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/replication/reorderbuffer.h

Fix incorrect logic for determining safe WindowAgg run conditions

commit   : eb7d043c9bbadb75a87385113c578f1b30e9d195    
  
author   : David Rowley <[email protected]>    
date     : Fri, 17 Mar 2023 15:49:53 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 17 Mar 2023 15:49:53 +1300    

Click here for diff

The logic added in 9d9c02ccd to determine when a qual can be used as a  
WindowClause run condition failed to correctly check for subqueries in the  
qual.  This was being done correctly for normal subquery qual pushdowns,  
it's just that 9d9c02ccd failed to follow the lead on that.  
  
This also fixes various other cases where transforming the qual into a  
WindowClause run condition in the subquery should have been disallowed.  
  
Bug: #17826  
Reported-by: Anban Company  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15, where 9d9c02ccd was introduced.  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

tests: Minimize syslog activity by slapd

commit   : b9f8d1cbad7cdc4d0d29c5cdbb14e179a7111439    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Mar 2023 17:48:47 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Mar 2023 17:48:47 -0700    

Click here for diff

Until now the tests using slapd spammed syslog for every connection /  
query. Use logfile-only to prevent syslog activity. Unfortunately that only  
takes effect after logging the first message, but that's still much better  
than the prior situation.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-  

M src/test/ldap/LdapServer.pm

libpq: Remove code for SCM credential authentication

commit   : 98ae2c84a49e45c0434c7e1a55bb2fc71582f561    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Mar 2023 10:52:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Mar 2023 10:52:26 +0900    

Click here for diff

Support for SCM credential authentication has been removed in the  
backend in 9.1, and libpq has kept some code to handle it for  
compatibility.  
  
Commit be4585b, that did the cleanup of the backend code, has done  
so because the code was not really portable originally.  And, as there  
are likely little chances that this is used these days, this removes the  
remaining code from libpq.  An error will now be raised by libpq if  
attempting to connect to a server that returns AUTH_REQ_SCM_CREDS,  
instead.  
  
References to SCM credential authentication are removed from the  
protocol documentation.  This removes some meson and configure checks.  
  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M meson.build
M src/include/libpq/pqcomm.h
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/tools/msvc/Solution.pm

Small tidyup for commit d41a178b, part II.

commit   : 10b6745d313c6e8f3523306d3d415c57c9039c5d    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 17 Mar 2023 14:44:12 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 17 Mar 2023 14:44:12 +1300    

Click here for diff

Further to commit 6a9229da, checking for NULL is now redundant.  An "out  
of memory" error would have been thrown already by palloc() and treated  
as FATAL, so we can delete a few more lines.  
  
Back-patch to all releases, like those other commits.  
  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/4040668.1679013388%40sss.pgh.pa.us  

M src/backend/postmaster/postmaster.c

Enable use of Memoize atop an Append that came from UNION ALL.

commit   : 9bfd2822b3201f6b0de1e87305b11ee3885b36d9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Mar 2023 18:13:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Mar 2023 18:13:35 -0400    

Click here for diff

create_append_path() would only apply get_baserel_parampathinfo  
when the path is for a partitioned table, but it's also potentially  
useful for paths for UNION ALL appendrels.  Specifically, that  
supports building a Memoize path atop this one.  
  
While we're in the vicinity, delete some dead code in  
create_merge_append_plan(): there's no need for it to support  
parameterized MergeAppend paths, and it doesn't look like that  
is going to change anytime soon.  It'll be easy enough to undo  
this when/if it becomes useful.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4_ABSu4PWG2rE1q10tJugEXHWgru3U8dAgkoFvgrb6aEA@mail.gmail.com  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql

Work around spurious compiler warning in inet operators

commit   : 0dc40196f27531ab30bbbc516df9894edc276d6e    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Mar 2023 14:08:44 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Mar 2023 14:08:44 -0700    

Click here for diff

gcc 12+ has complaints like the following:  
  
../../../../../pgsql/src/backend/utils/adt/network.c: In function 'inetnot':  
../../../../../pgsql/src/backend/utils/adt/network.c:1893:34: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]  
 1893 |                         pdst[nb] = ~pip[nb];  
      |                         ~~~~~~~~~^~~~~~~~~~  
../../../../../pgsql/src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16  
   27 |         unsigned char ipaddr[16];       /* up to 128 bits of address */  
      |                       ^~~~~~  
../../../../../pgsql/src/include/utils/inet.h:27:23: note: at offset -1 into destination object 'ipaddr' of size 16  
  
This is due to a compiler bug:  
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104986  
  
It has been a year since the bug has been reported without getting fixed. As  
the warnings are verbose and use of gcc 12 is becoming more common, it seems  
worth working around the bug. Particularly because a simple reformulation of  
the loop condition fixes the issue and isn't any less readable.  
  
Author: Tom Lane <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-  

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

Small tidyup for commit d41a178b.

commit   : 6a9229da65c9553a1268764d46fb28043b83bfd6    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 17 Mar 2023 09:44:42 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 17 Mar 2023 09:44:42 +1300    

Click here for diff

A comment was left behind claiming that we needed to use malloc() rather  
than palloc() because the corresponding free would run in another  
thread, but that's not true anymore.  Remove that comment.  And, with  
the reason being gone, we might as well actually use palloc().  
  
Back-patch to supported releases, like d41a178b.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BpdM9v3Jv4tc2BFx2jh_daY3uzUyAGBhtDkotEQDNPYw%40mail.gmail.com  

M src/backend/postmaster/postmaster.c

Doc: mention CREATE+ATTACH PARTITION with CREATE TABLE...PARTITION OF.

commit   : f170b572d2b4cc232c5b6d391b4ecf3e368594b7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Mar 2023 16:50:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Mar 2023 16:50:56 -0400    

Click here for diff

Clarify that ATTACH/DETACH PARTITION can be used to perform partition  
maintenance with less locking than straight CREATE TABLE/DROP TABLE.  
This was already stated in some places, but not emphasized.  
  
Back-patch to v14 where DETACH PARTITION CONCURRENTLY was added.  
(We had lower lock levels for ATTACH PARTITION before that, but  
this wording wouldn't apply.)  
  
Justin Pryzby, reviewed by Robert Treat and Jakub Wartak;  
a little further wordsmithing by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_table.sgml

Tighten error checks in datetime input, and remove bogus "ISO" format.

commit   : 5b3c5953553bb9fb0b171abc6041e7c7e9ca5b4d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Mar 2023 14:18:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Mar 2023 14:18:28 -0400    

Click here for diff

DecodeDateTime and DecodeTimeOnly had support for date input in the  
style "Y2023M03D16", which the comments claimed to be an "ISO" format.  
However, so far as I can find there is no such format in ISO 8601;  
they write units before numbers in intervals, but not in datetimes.  
Furthermore, the lesser-known ISO 8601-2 spec actually defines an  
incompatible format "2023Y03M16D".  None of our documentation mentions  
such a format either.  So let's just drop it.  
  
That leaves us with only two cases for a prefix unit specifier in  
datetimes: Julian dates written as Jnnnn, and the "T" separator  
defined by ISO 8601.  Add checks to catch misuse of these specifiers,  
that is consecutive specifiers or a dangling specifier at the end of  
the string.  We do not however disallow a specifier that is separated  
from the field that it disambiguates (by noise words or unrelated  
fields).  That being the case, remove some overly-aggressive error  
checks from the ISOTIME cases.  
  
Joseph Koshakow, editorialized a bit by me; thanks also to  
Peter Eisentraut for some standards-reading.  
  
Discussion: https://postgr.es/m/CAAvxfHf2Q1gKLiHGnuPOiyf0ASvKUM4BnMfsXuwgtYEb_Gx0Zw@mail.gmail.com  

M src/backend/utils/adt/datetime.c
M src/test/regress/expected/horology.out
M src/test/regress/sql/horology.sql

Silence pedantic compiler warning introduced in ce340e530d1

commit   : 2b7259f855723f36d2ce81ad892583248dc1576f    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Mar 2023 09:41:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Mar 2023 09:41:13 -0700    

Click here for diff

.../src/common/file_utils.c: In function ‘pg_pwrite_zeros’:  
.../src/common/file_utils.c:543:9: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]  
  543 |         const static PGAlignedBlock zbuffer = {{0}};    /* worth BLCKSZ */  

M src/common/file_utils.c

Use "data directory" not "current directory" in error messages.

commit   : 2333803d84ddabedc5ec5940a180245b4d4dfcca    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Mar 2023 12:04:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Mar 2023 12:04:08 -0400    

Click here for diff

The user receiving the message might not understand where the  
server's "current directory" is.  "Data directory" seems clearer.  
(This would not be good for frontend code, but both of these  
messages are only issued in the backend.)  
  
Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/adminpack/adminpack.c
M contrib/adminpack/expected/adminpack.out
M src/backend/utils/adt/genfile.c

Integrate superuser check into has_rolreplication()

commit   : 442f8700656bb5ce525d352241a17bbab14193c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Mar 2023 15:43:33 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Mar 2023 15:43:33 +0100    

Click here for diff

This makes it consistent with similar functions like  
has_createrole_privilege() and allows removing some explicit superuser  
checks.  
  
Author: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20230310000313.GA3992372%40nathanxps13  

M src/backend/replication/slot.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c

Small code simplification

commit   : 3b7cd8c690f294185c1ba074fb7efdf687829361    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Mar 2023 15:33:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Mar 2023 15:33:43 +0100    

Click here for diff

Author: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20230310000313.GA3992372%40nathanxps13  

M src/backend/commands/user.c

pkg-config Requires.private entries should be comma-separated

commit   : 4ef1be5a0b676a9f030cc2e4837f4b5650ecb069    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Mar 2023 07:37:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Mar 2023 07:37:38 +0100    

Click here for diff

In the .pc (pkg-config) files generated by the make and meson builds,  
the Requires.private entries use different delimiters.  The make build  
uses spaces, the meson build uses commas. The pkg-config documentation  
says that it should be comma-separated, but apparently about half the  
.pc in the wild use just spaces.  The pkg-config source code  
acknowledges that both commas and spaces work.  
  
This changes the make build to use commas, for consistency.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/1fb52d61-0964-2d8e-87d9-e8be830e2b24%40enterprisedb.com  

M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/libpq/Makefile

Remove PgStat_BackendFunctionEntry

commit   : e731aeac8928592435f73465a03fae83a2db0ee2    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Mar 2023 14:22:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Mar 2023 14:22:34 +0900    

Click here for diff

This structure included only PgStat_FunctionCounts, and removing it  
facilitates some upcoming refactoring for pgstatfuncs.c to use more  
macros rather that mostly-duplicated functions.  
  
Author: Bertrand Drouvot  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

Tweak regression test of pg_walinspect to be less collation-sensitive

commit   : e643a315fc58deae20877e2e69358c95087fa09a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Mar 2023 13:24:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Mar 2023 13:24:12 +0900    

Click here for diff

\dx was used on pg_walinspect to list its objects in 1.0 but the names  
of the objects in this version do not have an order that is always  
guaranteed depending on the collation used.  Rather than append a  
COLLATE clause in the query of \dx, this tweaks the regression test to  
produce an output whose order is guaranteed.  
  
Reported-by: Andres Freund  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_walinspect/expected/oldextversions.out
M contrib/pg_walinspect/sql/oldextversions.sql

Add .gitignore to ldap_password_func

commit   : c9a272daaa43a29cbfca44f4823cab65cb9725bd    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Mar 2023 09:36:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Mar 2023 09:36:01 +0900    

Click here for diff

This bit has been forgotten in 419a8dd.  

A src/test/modules/ldap_password_func/.gitignore

Improve handling of psql \watch's interval argument

commit   : 6f9ee74d45aa7c1836b6c12b6e2a958327c16ab5    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Mar 2023 09:32:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Mar 2023 09:32:36 +0900    

Click here for diff

A failure in parsing the interval value defined in the \watch command  
was silently switched to 1s of interval between two queries, which can  
be confusing.  This commit improves the error handling, and a couple of  
tests are added to check after:  
- An incorrect value.  
- An out-of-range value.  
- A negative value.  
  
A value of zero is able to work now, meaning that there is no interval  
of time between two queries in a \watch loop.  No backpatch is done, as  
it could break existing applications.  
  
Author: Andrey Borodin  
Reviewed-by: Kyotaro Horiguchi, Nathan Bossart, Michael Paquier  
Discussion: https://postgr.es/m/CAAhFRxiZ2-n_L1ErMm9AZjgmUK=qS6VHb+0SaMn8sqqbhF7How@mail.gmail.com  

M src/bin/psql/command.c
M src/bin/psql/t/001_basic.pl

MSVC: Don't build ldap_password_func if not building with ldap

commit   : dccb4d1c039194a57bfb9b39f0412a2b7f7c5104    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 15 Mar 2023 18:30:22 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 15 Mar 2023 18:30:22 -0400    

Click here for diff

Blind attempt to fix issue with 419a8dd814 found on drongo.  

M src/tools/msvc/Mkvcbuild.pm

Don't try to read default for a non-existent attribute

commit   : b85e91023bf3fd5b4dbd35dc3eddbf0dc291c8ad    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 15 Mar 2023 17:16:57 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 15 Mar 2023 17:16:57 -0400    

Click here for diff

Oversight in commit 9f8377f7a2 for COPY .. DEFAULT  
  
per report from Alexander Lakhin  

M src/backend/commands/copyfromparse.c

Support [NO] INDENT option in XMLSERIALIZE().

commit   : 483bdb2afec9e33ff05fd48a00e2656e30e714b7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Mar 2023 16:58:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Mar 2023 16:58:59 -0400    

Click here for diff

This adds the ability to pretty-print XML documents ... according to  
libxml's somewhat idiosyncratic notions of what's pretty, anyway.  
One notable divergence from a strict reading of the spec is that  
libxml is willing to collapse empty nodes "<node></node>" to just  
"<node/>", whereas SQL and the underlying XML spec say that this  
option should only result in whitespace tweaks.  Nonetheless,  
it seems close enough to justify using the SQL-standard syntax.  
  
Jim Jones, reviewed by Peter Smith and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M src/backend/catalog/sql_features.txt
M src/backend/executor/execExprInterp.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/xml.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/xml.h
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Add a hook for modifying the ldapbind password

commit   : 419a8dd8142afef790dafd91ba39afac2ca48aaf    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 15 Mar 2023 16:37:28 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 15 Mar 2023 16:37:28 -0400    

Click here for diff

The hook can be installed by a shared_preload library.  
  
A similar mechanism could be used for radius paswords, for example, and  
the type name auth_password_hook_typ has been shosen with that in mind.  
  
John Naylor and Andrew Dunstan  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth.c
M src/include/libpq/auth.h
M src/test/modules/Makefile
A src/test/modules/ldap_password_func/Makefile
A src/test/modules/ldap_password_func/ldap_password_func.c
A src/test/modules/ldap_password_func/meson.build
A src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/meson.build

Support PlaceHolderVars in MERGE actions.

commit   : e3ac85014eb280ee2e82b36dc3be1b62c838b3e4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Mar 2023 11:59:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Mar 2023 11:59:18 -0400    

Click here for diff

preprocess_targetlist thought PHVs couldn't appear here.  
It was mistaken, as per report from Önder Kalacı.  
  
Surveying other pull_var_clause calls, I noted no similar errors,  
but I did notice that qual_is_pushdown_safe's assertion about  
!contain_window_function was pointless, because the following  
pull_var_clause call would complain about them anyway.  In HEAD  
only, remove the redundant Assert and improve the commentary.  
  
Discussion: https://postgr.es/m/CACawEhUuum-gC_2S3sXLTcsk7bUSPSHOD+g1ZpfKaDK-KKPPWA@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/prep/preptlist.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

doc: Add lists of modules trusted/obsolete

commit   : a0137388cb642bcc1ba10fb906b88658653c589d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 15 Mar 2023 09:32:44 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 15 Mar 2023 09:32:44 +0100    

Click here for diff

Author: Karl Pinc <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/contrib.sgml

Use nanosleep() to implement pg_usleep().

commit   : a948e49e2ef11815be0b211723bfc5b53b7f75a8    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 15 Mar 2023 17:38:11 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 15 Mar 2023 17:38:11 +1300    

Click here for diff

The previous coding based on select() had commentary about historical  
portability concerns.  Use POSIX nanosleep() instead.  
  
This has independently been suggested a couple of times before, but  
never managed to stick.  Since recent and proposed work removes other  
uses of select(), and associated code and comments relating to its  
non-portable interaction with signals, it seems like a good time to tidy  
up this case, too.  
  
Also modernize the explanation of why WaitLatch() is a better way to  
wait.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Suggested-by: Paul Guo <[email protected]>  
Suggested-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_b-q0hXCBUCAATh0Z4Zi6UkiC0k2DFgoD3nC-r3SkR3tg%40mail.gmail.com  
Discussion: https://postgr.es/m/CABQrizfxpBLZT5mZeE0js5oCh1tqEWvcGF3vMRCv5P-RwUY5dQ@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/port/pgsleep.c

Update obsolete comment about pg_usleep() accuracy.

commit   : e4da2a44c17a36904d4d083f9a96e90041d28f76    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 15 Mar 2023 16:14:36 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 15 Mar 2023 16:14:36 +1300    

Click here for diff

There are still some systems that use traditional tick-based sleep  
timing, but many including Linux, FreeBSD and macOS started using high  
resolution timer hardware more directly a decade or two ago.  Update our  
comment about that.  Also highlight that Windows is like the older  
Unixen in that respect.  
  
Author: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BogAon8_V223Ldv6taPR2uKH3X_UJ_A7LJAf3-VRARPA%40mail.gmail.com  

M src/port/pgsleep.c

Add the testcases for 89e46da5e5.

commit   : 805b821e77a3a7d8d7827711e82e87c7bf61c681    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 15 Mar 2023 09:31:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 15 Mar 2023 09:31:44 +0530    

Click here for diff

Forgot to add new testcases in commit 89e46da5e5.  
  
Author: Onder Kalaci, Amit Kapila  
Reviewed-by: Peter Smith, Shi yu, Hou Zhijie, Vignesh C, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/CACawEhVLqmAAyPXdHEPv1ssU2c=dqOniiGz7G73HfyS7+nGV4w@mail.gmail.com  

A src/test/subscription/t/032_subscribe_use_index.pl

Improve WIN32 port of fstat() to detect more file types

commit   : 765f5df726918bcdcfd16bcc5418e48663d1dd59    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Mar 2023 12:55:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Mar 2023 12:55:51 +0900    

Click here for diff

The current implementation of _pgfstat64() is ineffective in detecting a  
terminal handle or an anonymous named pipe.  This commit improves our  
port of fstat() to detect more efficiently such cases by relying on  
GetFileType(), and returning more correct data when the type found is  
either a FILE_TYPE_PIPE (_S_IFIFO) or a FILE_TYPE_CHAR (_S_IFCHR).  
  
This is part of a more global fix to address failures when feeding the  
output generated by pg_dump to pg_restore through a pipe, for example,  
but not all of it.   We are also going to need to do something about  
fseek() and ftello() which are not reliable on WIN32 for the same cases  
where fstat() was incorrect.  Fixing fstat() is independent of the rest,  
though, which is why both fixes are handled separately, and this is the  
first part of it.  
  
Reported-by: Daniel Watzinger  
Author: Daniel Watzinger, Juan José Santamaría Flecha  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/port/win32stat.c

Allow the use of indexes other than PK and REPLICA IDENTITY on the subscriber.

commit   : 89e46da5e511a6970e26a020f265c9fb4b72b1d2    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 15 Mar 2023 08:36:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 15 Mar 2023 08:36:38 +0530    

Click here for diff

Using REPLICA IDENTITY FULL on the publisher can lead to a full table scan  
per tuple change on the subscription when REPLICA IDENTITY or PK index is  
not available. This makes REPLICA IDENTITY FULL impractical to use apart  
from some small number of use cases.  
  
This patch allows using indexes other than PRIMARY KEY or REPLICA  
IDENTITY on the subscriber during apply of update/delete. The index that  
can be used must be a btree index, not a partial index, and it must have  
at least one column reference (i.e. cannot consist of only expressions).  
We can uplift these restrictions in the future. There is no smart  
mechanism to pick the index. If there is more than one index that  
satisfies these requirements, we just pick the first one. We discussed  
using some of the optimizer's low-level APIs for this but ruled it out  
as that can be a maintenance burden in the long run.  
  
This patch improves the performance in the vast majority of cases and the  
improvement is proportional to the amount of data in the table. However,  
there could be some regression in a small number of cases where the indexes  
have a lot of duplicate and dead rows. It was discussed that those are  
mostly impractical cases but we can provide a table or subscription level  
option to disable this feature if required.  
  
Author: Onder Kalaci, Amit Kapila  
Reviewed-by: Peter Smith, Shi yu, Hou Zhijie, Vignesh C, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/CACawEhVLqmAAyPXdHEPv1ssU2c=dqOniiGz7G73HfyS7+nGV4w@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
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
M src/test/subscription/meson.build

Fix fractional vacuum_cost_delay.

commit   : 720de00af49d3d46cb5c9b4753b52215f5029ac9    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 15 Mar 2023 13:57:00 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 15 Mar 2023 13:57:00 +1300    

Click here for diff

Commit 4753ef37 changed vacuum_delay_point() to use the WaitLatch() API,  
to fix the problem that vacuum could keep running for a very long time  
after the postmaster died.  
  
Unfortunately, that broke commit caf626b2's support for fractional  
vacuum_cost_delay, which shipped in PostgreSQL 12.  WaitLatch() works in  
whole milliseconds.  
  
For now, revert the change from commit 4753ef37, but add an explicit  
check for postmaster death.  That's an extra system call on systems  
other than Linux and FreeBSD, but that overhead doesn't matter much  
considering that we willingly went to sleep and woke up again.  (In  
later work, we might add higher resolution timeouts to the latch API so  
that we could do this with our standard programming pattern, but that  
wouldn't be back-patched.)  
  
Back-patch to 14, where commit 4753ef37 arrived.  
  
Reported-by: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_b-q0hXCBUCAATh0Z4Zi6UkiC0k2DFgoD3nC-r3SkR3tg%40mail.gmail.com  

M src/backend/commands/vacuum.c

Fix waitpid() emulation on Windows.

commit   : d41a178b3a7ac0c2ca16f70129899ddabc2ce468    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 15 Mar 2023 13:17:18 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 15 Mar 2023 13:17:18 +1300    

Click here for diff

Our waitpid() emulation didn't prevent a PID from being recycled by the  
OS before the call to waitpid().  The postmaster could finish up  
tracking more than one child process with the same PID, and confuse  
them.  
  
Fix, by moving the guts of pgwin32_deadchild_callback() into waitpid(),  
so that resources are released synchronously.  The process and PID  
continue to exist until we close the process handle, which only happens  
once we're ready to adjust our book-keeping of running children.  
  
This seems to explain a couple of failures on CI.  It had never been  
reported before, despite the code being as old as the Windows port.  
Perhaps Windows started recycling PIDs more rapidly, or perhaps timing  
changes due to commit 7389aad6 made it more likely to break.  
  
Thanks to Alexander Lakhin for analysis and Andres Freund for tracking  
down the root cause.  
  
Back-patch to all supported branches.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20230208012852.bvkn2am4h4iqjogq%40awork3.anarazel.de  

M src/backend/postmaster/postmaster.c

Fix corner case bug in numeric to_char() some more.

commit   : b081fe4199b69dc561f7d31c6a82b3ad996f657f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2023 19:17:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2023 19:17:31 -0400    

Click here for diff

The band-aid applied in commit f0bedf3e4 turns out to still need  
some work: it made sure we didn't set Np->last_relevant too small  
(to the left of the decimal point), but it didn't prevent setting  
it too large (off the end of the partially-converted string).  
This could result in fetching data beyond the end of the allocated  
space, which with very bad luck could cause a SIGSEGV, though  
I don't see any hazard of interesting memory disclosure.  
  
Per bug #17839 from Thiago Nunes.  The bug's pretty ancient,  
so back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/formatting.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

Allow pg_dump to include/exclude child tables automatically.

commit   : a563c24c9574b74f4883c004c89275bba03c3c26    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2023 16:09:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2023 16:09:03 -0400    

Click here for diff

This patch adds new pg_dump switches  
    --table-and-children=pattern  
    --exclude-table-and-children=pattern  
    --exclude-table-data-and-children=pattern  
which act the same as the existing --table, --exclude-table, and  
--exclude-table-data switches, except that any partitions or  
inheritance child tables of the table(s) matching the pattern  
are also included or excluded.  
  
Gilles Darold, reviewed by Stéphane Tachoires  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl

Remove unnecessary code in dependency_is_compatible_expression().

commit   : 684ffac8c7d2647d919495727d469c73129202ea    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2023 11:10:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Mar 2023 11:10:45 -0400    

Click here for diff

Scanning the expression for compatible Vars isn't really necessary,  
because the subsequent match against StatisticExtInfo entries will  
eliminate expressions containing other Vars just fine.  Moreover,  
this code hadn't stopped to think about what to do with  
PlaceHolderVars or Aggrefs in the clause; and at least for the PHV  
case, that demonstrably leads to failures.  Rather than work out  
whether it's reasonable to ignore those, let's just remove the  
whole stanza.  
  
Per report from Richard Guo.  Back-patch to v14 where this code  
was added.  
  
Discussion: https://postgr.es/m/CAMbWs48Mmvm-acGevXuwpB=g5JMqVSL6i9z5UaJyLGJqa-XPAA@mail.gmail.com  

M src/backend/statistics/dependencies.c

doc: spell out full productname

commit   : bdc8d803e8e0eb987b65da1a5528ac570a07bfe1    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 14 Mar 2023 14:41:55 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 14 Mar 2023 14:41:55 +0100    

Click here for diff

Use PostgreSQL consistently for referring to the productname rather  
than Postgres.  This also adds <productname> markup.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: "Jonathan S. Katz" <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/postgres-fdw.sgml

Rework design of functions in pg_walinspect

commit   : 5c1b6628075a30b4eed6eb5835c2d2734254fa86    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 14 Mar 2023 20:13:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 14 Mar 2023 20:13:02 +0900    

Click here for diff

This commit reworks a bit the set-returning functions of pg_walinspect,  
making them more flexible regarding their end LSN:  
- pg_get_wal_records_info()  
- pg_get_wal_stats()  
- pg_get_wal_block_info()  
  
The end LSNs given to these functions is now handled so as a value  
higher than the current LSN of the cluster (insert LSN for a primary, or  
replay LSN for a standby) does not raise an error, giving more  
flexibility to monitoring queries.  Instead, the functions return  
results up to the current LSN, as found at the beginning of each  
function call.  
  
As an effect of that, pg_get_wal_records_info_till_end_of_wal() and  
pg_get_wal_stats_till_end_of_wal() are now removed from 1.1, as the  
existing, equivalent functions are able to offer the same  
possibilities.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACU0_q-o4DSweyaW9NO1KBx-QkN6G_OzYQvpjf3CZVASkg@mail.gmail.com  

M contrib/pg_walinspect/expected/oldextversions.out
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/pg_walinspect–1.0–1.1.sql
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pg_walinspect/sql/oldextversions.sql
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/pgwalinspect.sgml

Add support for the error functions erf() and erfc().

commit   : d5d574146d71c362852748c82ba8b9c873f5bf24    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 14 Mar 2023 09:17:36 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 14 Mar 2023 09:17:36 +0000    

Click here for diff

Expose the standard error functions as SQL-callable functions. These  
are expected to be useful to people working with normal distributions,  
and we use them here to test the distribution from random_normal().  
  
Since these functions are defined in the POSIX and C99 standards, they  
should in theory be available on all supported platforms. If that  
turns out not to be the case, more work will be needed.  
  
On all platforms tested so far, using extra_float_digits = -1 in the  
regression tests is sufficient to allow for variations between  
implementations. However, past experience has shown that there are  
almost certainly going to be additional unexpected portability issues,  
so these tests may well need further adjustments, based on the  
buildfarm results.  
  
Dean Rasheed, reviewed by Nathan Bossart and Thomas Munro.  
  
Discussion: https://postgr.es/m/CAEZATCXv5fi7+Vu-POiyai+ucF95+YMcCMafxV+eZuN1B-=MkQ@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/float.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/float8.out
M src/test/regress/expected/random.out
M src/test/regress/sql/float8.sql
M src/test/regress/sql/random.sql

libpq: Add support for require_auth to control authorized auth methods

commit   : 3a465cc6783f586096d9f885c3fc544d82eb8f19    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 14 Mar 2023 14:00:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 14 Mar 2023 14:00:05 +0900    

Click here for diff

The new connection parameter require_auth allows a libpq client to  
define a list of comma-separated acceptable authentication types for use  
with the server.  There is no negotiation: if the server does not  
present one of the allowed authentication requests, the connection  
attempt done by the client fails.  
  
The following keywords can be defined in the list:  
- password, for AUTH_REQ_PASSWORD.  
- md5, for AUTH_REQ_MD5.  
- gss, for AUTH_REQ_GSS[_CONT].  
- sspi, for AUTH_REQ_SSPI and AUTH_REQ_GSS_CONT.  
- scram-sha-256, for AUTH_REQ_SASL[_CONT|_FIN].  
- creds, for AUTH_REQ_SCM_CREDS (perhaps this should be removed entirely  
now).  
- none, to control unauthenticated connections.  
  
All the methods that can be defined in the list can be negated, like  
"!password", in which case the server must NOT use the listed  
authentication type.  The special method "none" allows/disallows the use  
of unauthenticated connections (but it does not govern transport-level  
authentication via TLS or GSSAPI).  
  
Internally, the patch logic is tied to check_expected_areq(), that was  
used for channel_binding, ensuring that an incoming request is  
compatible with conn->require_auth.  It also introduces a new flag,  
conn->client_finished_auth, which is set by various authentication  
routines when the client side of the handshake is finished.  This  
signals to check_expected_areq() that an AUTH_REQ_OK from the server is  
expected, and allows the client to complain if the server bypasses  
authentication entirely, with for example the reception of a too-early  
AUTH_REQ_OK message.  
  
Regression tests are added in authentication TAP tests for all the  
keywords supported (except "creds", because it is around only for  
compatibility reasons).  A new TAP script has been added for SSPI, as  
there was no script dedicated to it yet.  It relies on SSPI being the  
default authentication method on Windows, as set by pg_regress.  
  
Author: Jacob Champion  
Reviewed-by: Peter Eisentraut, David G. Johnston, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/test/authentication/meson.build
M src/test/authentication/t/001_password.pl
A src/test/authentication/t/005_sspi.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/ssl/t/002_scram.pl

meson: fix openssl detection issues in 6a30027

commit   : 727400994d5a27f2859361f82d0ec9ac2b23385c    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 13 Mar 2023 14:44:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 13 Mar 2023 14:44:43 -0700    

Click here for diff

When not detecting openssl via pkg-config, we'd error out if the headers  
weren't found, even if -Dssl=auto. When detecting via pkg-config, but the  
headers could not be found, we'd error out because the ssl_int variable would  
not exist.  
  
Reported-by: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/20230313180432.GA246741@nathanxps13  

M meson.build

Fix JSON error reporting for many cases of erroneous string values.

commit   : 25a7812cd0867043ec0a045c41e6bd3981d69bc4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2023 15:19:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2023 15:19:00 -0400    

Click here for diff

The majority of error exit cases in json_lex_string() failed to  
set lex->token_terminator, causing problems for the error context  
reporting code: it would see token_terminator less than token_start  
and do something more or less nuts.  In v14 and up the end result  
could be as bad as a crash in report_json_context().  Older  
versions accidentally avoided that fate; but all versions produce  
error context lines that are far less useful than intended,  
because they'd stop at the end of the prior token instead of  
continuing to where the actually-bad input is.  
  
To fix, invent some macros that make it less notationally painful  
to do the right thing.  Also add documentation about what the  
function is actually required to do; and in >= v14, add an assertion  
in report_json_context about token_terminator being sufficiently  
far advanced.  
  
Per report from Nikolay Shaplov.  Back-patch to all supported  
versions.  
  
Discussion: https://postgr.es/m/7332649.x5DLKWyVIX@thinkpad-pgpro  

M src/backend/utils/adt/jsonfuncs.c
M src/common/jsonapi.c
M src/test/regress/expected/json_encoding.out
M src/test/regress/expected/json_encoding_1.out

Fix failure to detect some cases of improperly-nested aggregates.

commit   : 30dbdbe75384bcb034172c781b24bc982434a967    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2023 12:40:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Mar 2023 12:40:28 -0400    

Click here for diff

check_agg_arguments_walker() supposed that it needn't descend into  
the arguments of a lower-level aggregate function, but this is  
just wrong in the presence of multiple levels of sub-select.  The  
oversight would lead to executor failures on queries that should  
be rejected.  (Prior to v11, they actually were rejected, thanks  
to a "redundant" execution-time check.)  
  
Per bug #17835 from Anban Company.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_agg.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Add a DEFAULT option to COPY FROM

commit   : 9f8377f7a27910bf0f35bf5169a8046731948a79    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 13 Mar 2023 10:01:56 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 13 Mar 2023 10:01:56 -0400    

Click here for diff

This allows for a string which if an input field matches causes the  
column's default value to be inserted. The advantage of this is that  
the default can be inserted in some rows and not others, for which  
non-default data is available.  
  
The file_fdw extension is also modified to take allow use of this  
option.  
  
Israel Barth Rubio  
  
Discussion: https://postgr.es/m/CAO_rXXAcqesk6DsvioOZ5zmeEmpUN5ktZf-9=9yu+DTr0Xr8Uw@mail.gmail.com  

A contrib/file_fdw/data/copy_default.csv
M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/file_fdw.c
M contrib/file_fdw/sql/file_fdw.sql
M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/tab-complete.c
M src/include/commands/copy.h
M src/include/commands/copyfrom_internal.h
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql

Fix MERGE command tag for actions blocked by BEFORE ROW triggers.

commit   : 7b14e20b12cc8358cad9bdd05dd6b7de7f73c431    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 13 Mar 2023 11:09:39 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 13 Mar 2023 11:09:39 +0000    

Click here for diff

This ensures that the row count in the command tag for a MERGE is  
correctly computed in the case where UPDATEs or DELETEs are skipped  
due to a BEFORE ROW trigger returning NULL (the INSERT case was  
already handled correctly by ExecMergeNotMatched() calling  
ExecInsert()).  
  
Back-patch to v15, where MERGE was introduced.  
  
Discussion: https://postgr.es/m/CAEZATCU8XEmR0JWKDtyb7iZ%3DqCffxS9uyJt0iOZ4TV4RT%2Bow1w%40mail.gmail.com  

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

Fix concurrent update issues with MERGE.

commit   : 9321c79c86e6a6a4eac22e2235a21a8b68388723    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 13 Mar 2023 10:22:22 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 13 Mar 2023 10:22:22 +0000    

Click here for diff

If MERGE attempts an UPDATE or DELETE on a table with BEFORE ROW  
triggers, or a cross-partition UPDATE (with or without triggers), and  
a concurrent UPDATE or DELETE happens, the merge code would fail.  
  
In some cases this would lead to a crash, while in others it would  
cause the wrong merge action to be executed, or no action at all. The  
immediate cause of the crash was the trigger code calling  
ExecGetUpdateNewTuple() as part of the EPQ mechanism, which fails  
because during a merge ri_projectNew is NULL, since merge has its own  
per-action projection information, which ExecGetUpdateNewTuple() knows  
nothing about.  
  
Fix by arranging for the trigger code to exit early, returning the  
TM_Result and TM_FailureData information, if a concurrent modification  
is detected, allowing the merge code to do the necessary EPQ handling  
in its own way. Similarly, prevent the cross-partition update code  
from doing any EPQ processing for a merge, allowing the merge code to  
work out what it needs to do.  
  
This leads to a number of simplifications in nodeModifyTable.c. Most  
notably, the ModifyTableContext->GetUpdateNewTuple() callback is no  
longer needed, and mergeGetUpdateNewTuple() can be deleted, since  
there is no longer any requirement for get-update-new-tuple during a  
merge. Similarly, ModifyTableContext->cpUpdateRetrySlot is no longer  
needed. Thus ExecGetUpdateNewTuple() and the retry_slot handling of  
ExecCrossPartitionUpdate() can be restored to how they were in v14,  
before the merge code was added, and ExecMergeMatched() no longer  
needs any special-case handling for cross-partition updates.  
  
While at it, tidy up ExecUpdateEpilogue() a bit, making it handle  
recheckIndexes locally, rather than passing it in as a parameter,  
ensuring that it is freed properly. This dates back to when it was  
split off from ExecUpdate() to support merge.  
  
Per bug #17809 from Alexander Lakhin, and follow-up investigation of  
bug #17792, also from Alexander Lakhin.  
  
Back-patch to v15, where MERGE was introduced, taking care to preserve  
backwards-compatibility of the trigger API in v15 for any extensions  
that might use it.  
  
Discussion:  
  https://postgr.es/m/17809-9e6650bef133f0fe%40postgresql.org  
  https://postgr.es/m/17792-0f89452029662c36%40postgresql.org  

M src/backend/commands/trigger.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/commands/trigger.h
M src/test/isolation/expected/merge-delete.out
M src/test/isolation/expected/merge-match-recheck.out
M src/test/isolation/specs/merge-delete.spec
M src/test/isolation/specs/merge-match-recheck.spec

Fix expected test output

commit   : b2bd9a6796d60bae7bfc3d780b6727f76fca1a7d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 11:15:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 11:15:21 +0100    

Click here for diff

For builds without lz4, for 208bf364a9.  

M src/test/regress/expected/compression_1.out

Remove incidental md5() function uses from main regression tests

commit   : 208bf364a9cc80cc586d060726d076ba7d0c8dec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 10:15:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 10:15:44 +0100    

Click here for diff

Most of these calls were to generate some random data.  These can be  
replaced by appropriately adapted sha256() calls.  To keep the diff  
smaller, we wrap this into a helper function that produces the same  
output format and length as the md5() call.  
  
This will eventually allow these tests to pass in OpenSSL FIPS mode  
(which does not allow MD5 use).  
  
Similar work for other test suites will follow later.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/test/regress/expected/arrays.out
M src/test/regress/expected/brin.out
M src/test/regress/expected/brin_multi.out
M src/test/regress/expected/compression.out
M src/test/regress/expected/compression_1.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/largeobject.out
M src/test/regress/expected/largeobject_1.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/memoize.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/test_setup.out
M src/test/regress/sql/arrays.sql
M src/test/regress/sql/brin.sql
M src/test/regress/sql/brin_multi.sql
M src/test/regress/sql/compression.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/largeobject.sql
M src/test/regress/sql/matview.sql
M src/test/regress/sql/memoize.sql
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/stats_ext.sql
M src/test/regress/sql/test_setup.sql

Improve support for UNICODE collation on older ICU

commit   : d72900bdedc60fe20bc50d5d0e7dcb4bc0eb304e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 09:04:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 09:04:41 +0100    

Click here for diff

The recently added standard collation UNICODE (0d21d4b9bc) doesn't  
give consistent results on some build farm members with old ICU  
versions.  Apparently, the ICU locale specification 'und' (language  
tag style) misbehaves on some older ICU versions.  Replacing it with  
'' (ICU locale ID style) fixes it at least on some OS versions.  Let's  
see what the build farm says.  

M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h

Fix inconsistent error handling for GSS encryption in PQconnectPoll()

commit   : e0a09d4e354c9636c2b775c6f02e749236c78acf    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Mar 2023 16:36:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Mar 2023 16:36:20 +0900    

Click here for diff

The error cases for TLS and GSS encryption were inconsistent.  After TLS  
fails, the connection is marked as dead and follow-up calls of  
PQconnectPoll() would return immediately, but GSS encryption was not  
doing that, so the connection would still have been allowed to enter the  
GSS handling code.  This was handled incorrectly when gssencmode was set  
to "require".  "prefer" was working correctly, and this could not happen  
under "disable" as GSS encryption would not be attempted.  
  
This commit makes the error handling of GSS encryption on par with TLS  
portion, fixing the case of gssencmode=require.  
  
Reported-by: Jacob Champion  
Author: Michael Paquier  
Reviewed-by: Jacob Champion, Stephen Frost  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

cirrus/ccache: Use G rather than GB suffix

commit   : bf32ec225635cbdf15b11cbdc8553e3355cc52ba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 07:23:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 07:23:45 +0100    

Click here for diff

The former being the documented spelling.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20230203142656.GA1653%40telsasoft.com  

M .cirrus.yml

meson: Make auto the default of the ssl option

commit   : 6a3002715eca4ae68e4d76606a6b3fd56d633741    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 06:46:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Mar 2023 06:46:09 +0100    

Click here for diff

The 'ssl' option is of type 'combo', but we add a choice 'auto' that  
simulates the behavior of a feature option.  This way, openssl is used  
automatically by default if present, but we retain the ability to  
potentially select another ssl library.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/ad65ffd1-a9a7-fda1-59c6-f7dc763c3051%40enterprisedb.com  

M .cirrus.yml
M doc/src/sgml/installation.sgml
M meson.build
M meson_options.txt
M src/interfaces/libpq/meson.build
M src/makefiles/meson.build
M src/test/ssl/meson.build

Refactor and improve tests of pg_walinspect

commit   : 1f282c24e464d8b2647b86bf465e04cc540404f6    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Mar 2023 13:03:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Mar 2023 13:03:29 +0900    

Click here for diff

The regression tests of pg_walinspect are reworked on a few aspects:  
- Reorganization on the validation checks done for the start and end  
LSNs on the six SQL functions currently available in 1.1.  
- Addition of a few patterns doing bound checks for invalid start LSN,  
invalid end LSN, and failures in reading LSN positions, for anything  
that's been missing.  
- Use of a consistent style across the whole, limiting blank lines  
across the queries.  
- Addition of a new test script for upgrades.  For the time being, this  
is straight-forward with a check that the upgrade from 1.0 works  
correctly.  This will be made more complicated once the interface of  
this extension is reworked in 1.1 with a follow-up patch.  
  
Most of the contents of this commit are extracted from a larger patch by  
the same author, largely reorganized by me to minimize the differences  
with the upcoming work aimed to lift the bound checks on the input LSNs  
used by the functions of this extension.  
  
Author: Bharath Rupireddy, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACU0_q-o4DSweyaW9NO1KBx-QkN6G_OzYQvpjf3CZVASkg@mail.gmail.com  

M contrib/pg_walinspect/Makefile
A contrib/pg_walinspect/expected/oldextversions.out
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/meson.build
A contrib/pg_walinspect/sql/oldextversions.sql
M contrib/pg_walinspect/sql/pg_walinspect.sql

Work around implementation restriction in adjust_appendrel_attrs.

commit   : 767c598954bbf72e0535f667e2e0667765604b2a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Mar 2023 14:20:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Mar 2023 14:20:34 -0400    

Click here for diff

adjust_appendrel_attrs can't transfer nullingrel labeling to a non-Var  
translation expression (mainly because it's too late to wrap such an  
expression in a PlaceHolderVar).  I'd supposed in commit 2489d76c4  
that that restriction was unreachable because we'd not attempt to push  
problematic clauses down to an appendrel child relation.  I forgot that  
set_append_rel_size blindly converts all the parent rel's joininfo  
clauses to child clauses, and that list could well contain clauses  
from above a nulling outer join.  
  
We might eventually have to devise a direct fix for this implementation  
restriction, but for now it seems enough to filter out troublesome  
clauses while constructing the child's joininfo list.  Such clauses  
are certainly not useful while constructing paths for the child rel;  
they'll have to be applied later when we join the completed appendrel  
to something else.  So we don't need them here, and omitting them from  
the list should save a few cycles while processing the child rel.  
  
Per bug #17832 from Marko Tiikkaja.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Mark unsafe_tests module as not runnable with installcheck

commit   : 872e3d150e9aad110cfbd80c38b15e2219eacf45    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 12 Mar 2023 09:00:32 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 12 Mar 2023 09:00:32 -0400    

Click here for diff

This was an omission in the original creation of the module.  
  
Also slightly adjust some wording to avoid a double "is".  
  
Backpatch the non-meson piece of this to release 12, where the module  
was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/unsafe_tests/Makefile
M src/test/modules/unsafe_tests/README
M src/test/modules/unsafe_tests/meson.build

pg_amcheck: Minor test speedups

commit   : a4f23f9b3cddb86137a3b1683dcbe49d8b41ea7b    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 11 Mar 2023 15:41:47 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 11 Mar 2023 15:41:47 -0800    

Click here for diff

Freezing the relation N times and fetching the tuples one-by-one isn't that  
cheap. On my machine this reduces test times by a bit less than one second, on  
windows CI it's a few seconds.  
  
Reviewed-by: Mark Dilger <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_amcheck/t/004_verify_heapam.pl

amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before epoch 0

commit   : 4f5d461e048b9c56fe2fa8c7faf7010eed05ba82    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 11 Mar 2023 14:12:51 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 11 Mar 2023 14:12:51 -0800    

Click here for diff

64bit xids can't represent xids before epoch 0 (see also be504a3e974). When  
FullTransactionIdFromXidAndCtx() was passed such an xid, it'd create a 64bit  
xid far into the future. Noticed while adding assertions in the course of  
investigating be504a3e974, as amcheck's test create such xids.  
  
To fix the issue, just return FirstNormalFullTransactionId in this case. A  
freshly initdb'd cluster already has a newer horizon. The most minimal version  
of this would make the messages for some detected corruptions differently  
inaccurate. To make those cases accurate, switch  
FullTransactionIdFromXidAndCtx() to use the 32bit modulo difference between  
xid and nextxid to compute the 64bit xid, yielding sensible "in the future" /  
"in the past" answers.  
  
Reviewed-by: Mark Dilger <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, where heapam verification was introduced  

M contrib/amcheck/verify_heapam.c
M src/bin/pg_amcheck/t/004_verify_heapam.pl

amcheck: Fix ordering bug in update_cached_xid_range()

commit   : 16327240da29b70e41a65d49212b31da9a94e177    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 11 Mar 2023 14:12:51 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 11 Mar 2023 14:12:51 -0800    

Click here for diff

The initialization order in update_cached_xid_range() was wrong, calling  
FullTransactionIdFromXidAndCtx() before setting  
->next_xid. FullTransactionIdFromXidAndCtx() uses ->next_xid.  
  
In most situations this will not cause visible issues, because the next call  
to update_cached_xid_range() will use a less wrong ->next_xid. It's rare that  
xids advance fast enough for this to be a problem.  
  
Found while adding more asserts to the 64bit xid infrastructure.  
  
Reviewed-by: Mark Dilger <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, where heapam verification was introduced  

M contrib/amcheck/verify_heapam.c

meson: fix header path of ossp-uuid

commit   : 4e633016abe9b82053aafb2fe9d3317add73f74d    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 10 Mar 2023 17:18:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 10 Mar 2023 17:18:52 -0800    

Click here for diff

The ossp-uuid pkg-config file includes the necessary -I to include the header  
as uuid.h. Previously this would only work if ossp-uuid has its headers in  
ossp/ in an already searched path.  
  
Reported-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M meson.build

Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex.

commit   : 1925ac281a238fab50e208548f98daffdaaa0896    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Mar 2023 12:15:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Mar 2023 12:15:41 -0500    

Click here for diff

If the regex compiler can see that a regex is unsatisfiable  
(for example, '$foo') then it may emit an NFA having no arcs.  
pg_trgm's packGraph function did the wrong thing in this case;  
it would access off the end of a work array, and with bad luck  
could produce a corrupted output data structure causing more  
problems later.  This could end with wrong answers or crashes  
in queries using a pg_trgm GIN or GiST index with such a regex.  
  
Fix by not trying to de-duplicate if there aren't at least 2 arcs.  
  
Per bug #17830 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_trgm/expected/pg_word_trgm.out
M contrib/pg_trgm/sql/pg_word_trgm.sql
M contrib/pg_trgm/trgm_regexp.c

Ensure COPY TO on an RLS-enabled table copies no more than it should.

commit   : d66bb048c3130c7b7a4876fc9050291f9e4cad2b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2023 13:52:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Mar 2023 13:52:28 -0500    

Click here for diff

The COPY documentation is quite clear that "COPY relation TO" copies  
rows from only the named table, not any inheritance children it may  
have.  However, if you enabled row-level security on the table then  
this stopped being true, because the code forgot to apply the ONLY  
modifier in the "SELECT ... FROM relation" query that it constructs  
in order to allow RLS predicates to be attached.  Fix that.  
  
Report and patch by Antonin Houska (comment adjustments and test case  
by me).  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/3472.1675251957@antos  

M src/backend/commands/copy.c
M src/backend/commands/copyto.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

initdb: derive encoding from locale for ICU; similar to libc.

commit   : c45dc7ffbba2cb0bf180a0b9edadc22769143e7a    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 10 Mar 2023 10:51:24 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 10 Mar 2023 10:51:24 -0800    

Click here for diff

Previously, the default encoding was derived from the locale when  
using libc; while the default was always UTF-8 when using ICU. That  
would throw an error when the locale was not compatible with UTF-8.  
  
This commit causes initdb to derive the default encoding from the  
locale for both providers. If --no-locale is specified (or if the  
locale is C or POSIX), the default encoding will be UTF-8 for ICU  
(because ICU does not support SQL_ASCII) and SQL_ASCII for libc.  
  
Per buildfarm failure on system "hoverfly" related to commit  
27b62377b4.  
  
Discussion: https://postgr.es/m/d191d5841347301a8f1238f609471ddd957fc47e.camel%40j-davis.com  

M contrib/unaccent/meson.build
M doc/src/sgml/ref/initdb.sgml
M src/bin/initdb/initdb.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/scripts/t/020_createdb.pl
M src/test/icu/t/010_database.pl

Fix tests for non-ICU build

commit   : 3e623ebc7a22444ad3d15b36ffa3273c47283e18    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 14:27:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 14:27:55 +0100    

Click here for diff

missed in 0d21d4b9bc  

M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.icu.utf8_1.out
M src/test/regress/sql/collate.icu.utf8.sql

Add standard collation UNICODE

commit   : 0d21d4b9bc1f9da9dda29e5c4db0c6dd45408aaa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 13:35:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 13:35:00 +0100    

Click here for diff

This adds a new predefined collation named UNICODE, which sorts by the  
default Unicode collation algorithm specifications, per SQL standard.  
  
This only works if ICU support is built.  
  
Reviewed-by: Jeff Davis <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/charset.sgml
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Include headers of archive/ in installation

commit   : 6ad5793a491a2e70e5610988a13f31f43c8946ad    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 Mar 2023 20:08:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 Mar 2023 20:08:10 +0900    

Click here for diff

These new headers have been recently added in 35739b8, but they were not  
installed.  Sravan has provided the patch for configure/make, while I  
have fixed the meson part.  
  
Author: Sravan Kumar, Michael Paquier  
Discussion: https://postgr.es/m/CA+=NbjguiQy-MbVqfQ-jQ=2Fcmx3Zs36OkKb-vjt28jMTG0OOg@mail.gmail.com  

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

Add a test for UCS_BASIC collation

commit   : 012ee842590d7bb56f250c15e00a8611ba0ae1da    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 11:00:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 11:00:51 +0100    

Click here for diff

M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/collate.linux.utf8.sql

doc: Better example for custom ICU rules

commit   : cd427859745af4574d75e37ec7d427ccd2b8b24a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 09:25:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 09:25:03 +0100    

Click here for diff

Use a more practical example, and also add some explanation.  
  
Reported-by: Jeff Davis <[email protected]>  

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

Fix incorrect format placeholders

commit   : 470103697a17c4df516f9779fd3ff7f7c32d3cc5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 07:10:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Mar 2023 07:10:43 +0100    

Click here for diff

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

pg_walinspect: pg_get_wal_fpi_info() -> pg_get_wal_block_info()

commit   : 9ecb134a93f0a82540b0e0bed67b30d0c9eb836a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 Mar 2023 10:09:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 Mar 2023 10:09:07 +0900    

Click here for diff

This commit reworks pg_get_wal_fpi_info() to become aware of all the  
block information that can be attached to a record rather than just its  
full-page writes:  
- Addition of the block id as assigned by XLogRegisterBuffer(),  
XLogRegisterBlock() or XLogRegisterBufData().  
- Addition of the block data, as bytea, or NULL if none.  The length of  
the block data can be guessed with length(), so there is no need to  
store its length in a separate field.  
- Addition of the full-page image length, as counted without a hole or  
even compressed.  
- Modification of the handling of the full-page image data.  This is  
still a bytea, but it could become NULL if none is assigned to a block.  
- Addition of the full-page image flags, tracking if a page is stored  
with a hole, if it needs to be applied and the type of compression  
applied to it, as of all the BKPIMAGE_* values in xlogrecord.h.  
  
The information of each block is returned as one single record, with the  
record's ReadRecPtr included to be able to join the block information  
with the existing pg_get_wal_records_info().  Note that it is perfectly  
possible for a block to hold both data and full-page image.  
  
Thanks also to Kyotaro Horiguchi and Matthias van de Meent for the  
discussion.  
  
This commit uses some of the work proposed by Melanie, though it has  
been largely redesigned and rewritten by me.  Bharath has helped in  
refining a bit the whole.  
  
Reported-by: Melanie Plageman  
Author: Michael Paquier, Melanie Plageman, Bharath Rupireddy  
Discussion: https://postgr.es/m/CAAKRu_bORebdZmcV8V4cZBzU8M_C6tDDdbiPhCZ6i-iuSXW9TA@mail.gmail.com  

M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/pg_walinspect–1.0–1.1.sql
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/pgwalinspect.sgml

Fix test failure caused in 27b62377b4.

commit   : 8da2ec31eee432d6e51c50c3d73f88e81dede193    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 9 Mar 2023 15:34:41 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 9 Mar 2023 15:34:41 -0800    

Click here for diff

Per buildfarm system "prion".  

M src/bin/initdb/t/001_initdb.pl

Reject combining "epoch" and "infinity" with other datetime fields.

commit   : bcc704b52490492e6bd73c4444056b3e9644504d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2023 16:49:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Mar 2023 16:49:03 -0500    

Click here for diff

Datetime input formerly accepted combinations such as  
'1995-08-06 infinity', but this seems like a clear error.  
Reject any combination of regular y/m/d/h/m/s fields with  
these special tokens.  
  
Joseph Koshakow, reviewed by Keisuke Kuroda and myself  
  
Discussion: https://postgr.es/m/CAAvxfHdm8wwXwG_FFRaJ1nTHiMWb7YXS2YKCzCt8Q0a2ZoMcHg@mail.gmail.com  

M src/backend/utils/adt/datetime.c
M src/test/regress/expected/horology.out
M src/test/regress/sql/horology.sql

Use ICU by default at initdb time.

commit   : 27b62377b47f9e7bf58613608bc718c86ea91e91    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 9 Mar 2023 10:52:41 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 9 Mar 2023 10:52:41 -0800    

Click here for diff

If the ICU locale is not specified, initialize the default collator  
and retrieve the locale name from that.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

M contrib/citext/expected/citext_utf8.out
M contrib/citext/expected/citext_utf8_1.out
M contrib/citext/sql/citext_utf8.sql
M contrib/unaccent/expected/unaccent.out
A contrib/unaccent/expected/unaccent_1.out
M contrib/unaccent/sql/unaccent.sql
M doc/src/sgml/ref/initdb.sgml
M src/bin/initdb/Makefile
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/interfaces/ecpg/test/Makefile
M src/interfaces/ecpg/test/connect/test5.pgc
M src/interfaces/ecpg/test/expected/connect-test5.c
M src/interfaces/ecpg/test/expected/connect-test5.stderr
M src/interfaces/ecpg/test/meson.build
M src/test/icu/t/010_database.pl

HTML docs: Add padding to table.simplelist for more readable output

commit   : a7e584a7d68a9a2bcc7efaf442262771f9044248    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 9 Mar 2023 19:47:19 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 9 Mar 2023 19:47:19 +0100    

Click here for diff

This couples with a to-be-pushed pgweb patch to synchronize the other  
stylesheet under which these docs are rendered on the website.  
  
Author: Karl Pinc <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/stylesheet.css

Fix 9637badd9f.

commit   : 206b44bb24b3785bf6360361b757c1dae77ab0bb    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 9 Mar 2023 09:32:24 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 9 Mar 2023 09:32:24 -0800    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Reported-by: Andrew Dunstan  

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

pg_upgrade: copy locale and encoding information to new cluster.

commit   : 9637badd9f9209166140eb567602e91699dd2ffb    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 9 Mar 2023 08:28:05 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 9 Mar 2023 08:28:05 -0800    

Click here for diff

Previously, pg_upgrade checked that the old and new clusters were  
compatible, including the locale and encoding. But the new cluster was  
just created, and only template0 from the new cluster will be  
preserved (template1 and postgres are both recreated during the  
upgrade process).  
  
Because template0 is not sensitive to locale or encoding, just update  
the pg_database entry to be the same as template0 from the original  
cluster.  
  
This commit makes it easier to change the default initdb locale or  
encoding settings without causing needless incompatibilities.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut  

M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/meson.build
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

For Kerberos testing, disable reverse DNS lookup

commit   : 8dff2f224f4f49ddd4f45f590e7f46b160a4951b    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 9 Mar 2023 10:32:49 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 9 Mar 2023 10:32:49 -0500    

Click here for diff

In our Kerberos test suite, there isn't much need to worry about the  
normal canonicalization that Kerberos provides by looking up the reverse  
DNS for the IP address connected to, and in some cases it can actively  
cause problems (eg: a captive portal wifi where the normally not  
resolvable localhost address used ends up being resolved anyway, and  
not to the domain we are using for testing, causing the entire  
regression test to fail with errors about not being able to get a TGT  
for the remote realm for cross-realm trust).  
  
Therefore, disable it by adding rdns = false into the krb5.conf that's  
generated for the test.  
  
Reviewed-By: Heikki Linnakangas  
Discussion: https://postgr.es/m/Y/[email protected]  

M src/test/kerberos/t/001_auth.pl

Avoid criticizable perl code

commit   : 590a075789b541d5c1a190031fdcf061355bcfbc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 9 Mar 2023 12:02:18 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 9 Mar 2023 12:02:18 +0100    

Click here for diff

Using `require` / `->import` instead of `use` avoids the use of a  
"stringy eval", making for cleaner code that we don't need to silence  
perlcritic about.  
  
Per Andrew Dunstan  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl

Add b6dfee28 to .git-blame-ignore-revs

commit   : d00a4ad1d56bbdbc032257803c0a97a583aec211    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Mar 2023 19:26:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Mar 2023 19:26:03 +0900    

Click here for diff

Thanks to Álvaro Herrera for the poke.  

M .git-blame-ignore-revs

Improve/correct comments

commit   : 36ea345f8fa616fd9b40576310e54145aa70c1a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2023 09:59:46 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2023 09:59:46 +0100    

Click here for diff

Change comments for pg_cryptohash_init(), pg_cryptohash_update(),  
pg_cryptohash_final() in cryptohash.c to match cryptohash_openssl.c.  
In particular, the claim that these functions were "designed" to never  
fail was incorrect, since by design callers need to be prepared to  
handle failures, for compatibility with the cryptohash_openssl.c  
versions.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/common/cryptohash.c

Disallow specifying ICU rules unless locale provider is ICU

commit   : 544b452a5a598dd14d7a38d15a778932e58d18b0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2023 08:09:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Mar 2023 08:09:40 +0100    

Click here for diff

Follow-up for 30a53b7929; this was not checked in all cases.  
  
Reported-by: Jeff Davis <[email protected]>  

M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c

Run pgindent on libpq's fe-auth.c, fe-auth-scram.c and fe-connect.c

commit   : b6dfee28f2b44e28b123b77a91fb05c47da63501    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Mar 2023 15:09:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Mar 2023 15:09:45 +0900    

Click here for diff

A patch sent by Jacob Champion has been touching this area of the code,  
and the set of changes done in a9e9a9f has made a run of pgindent on  
these files a bit annoying to handle.  So let's clean up a bit the area,  
first, to ease the work on follow-up patches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix race in SERIALIZABLE READ ONLY.

commit   : 65e388d4182ae4eba5afe880471453d33a4097d8    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 9 Mar 2023 16:33:24 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 9 Mar 2023 16:33:24 +1300    

Click here for diff

Commit bdaabb9b started skipping doomed transactions when building the  
list of possible conflicts for SERIALIZABLE READ ONLY.  That makes  
sense, because doomed transactions won't commit, but a couple of subtle  
things broke:  
  
1.  If all uncommitted r/w transactions are doomed, a READ ONLY  
transaction would arbitrarily not benefit from the safe snapshot  
optimization.  It would not be taken immediately, and yet no other  
transaction would set SXACT_FLAG_RO_SAFE later.  
  
2.  In the same circumstances but with DEFERRABLE, GetSafeSnapshot()  
would correctly exit its wait loop without sleeping and then take the  
optimization in non-assert builds, but assert builds would fail a sanity  
check that SXACT_FLAG_RO_SAFE had been set by another transaction.  
  
This is similar to the case for PredXact->WritableSxactCount == 0.  We  
should opt out immediately if our possibleUnsafeConflicts list is empty  
after filtering.  
  
The code to maintain the serializable global xmin is moved down below  
the new opt out site, because otherwise we'd have to reverse its effects  
before returning.  
  
Back-patch to all supported releases.  Bug #17368.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/17116-d6ca217acc180e30%40postgresql.org  
Discussion: https://postgr.es/m/20110707212159.GF76634%40csail.mit.edu  

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

meson: tests: Adjust with_icu/ZSTD env vars for pg_dump, pg_basebackup

commit   : 8bf826528ae9ff7a543a49c0dce665fa9ec542cb    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 8 Mar 2023 16:53:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 8 Mar 2023 16:53:57 -0800    

Click here for diff

396d348b0 omitted adding with_icu to the pg_dump tests under  
meson. Conversely, e6927270c exported ZSTD for pg_basebackup's tests, despite  
pg_basebackup's ZSTD support not having any tests.  
  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/meson.build
M src/bin/pg_dump/meson.build

doc: Add guidelines to generate coverage reports with meson

commit   : f1c3963292e4efc7ea65be08a7a26f78bc91e257    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Mar 2023 09:21:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Mar 2023 09:21:47 +0900    

Click here for diff

These instructions were already available for configure-based builds,  
but not the meson-based builds.  This commit closes the gap.  
  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/regress.sgml

meson: Add target for installing test files & improve install_test_files

commit   : 0d237aeebaee17943af14159b83a202a3744dbb4    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Mar 2023 16:14:18 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Mar 2023 16:14:18 -0800    

Click here for diff

The changes in b6a0d469cae prevented installation of the test files during a  
normal install. However, the buildfarm intentionally tries to trun the tests  
against a "real" installation. The new install-test-files target provides that  
ability.  
  
Because we want to install into a normal directory, I removed the necessary  
munging of the target paths from meson.build and moved it into  
install-test-files. I also added DESTDIR support, so that installing can  
redirect the directory if desired. That's used for the tmp_install/  
installation now.  
  
I didn't like the number of arguments necessary for install_test_files, so I  
changed it to use  
  --install target list of files  
which makes it easier to use for further directories, if/when we need them.  
  
Discussion: https://postgr.es/m/[email protected]  

M meson.build
M src/tools/install_test_files

001_libpq_pipeline.pl: use Test::Differences if available

commit   : 87e4f24d82939ef532b68f37fc66e6a48cff2cd9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Mar 2023 18:31:55 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Mar 2023 18:31:55 +0100    

Click here for diff

When one of these tests fails to match the trace, this better shows what  
the problem is.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  

M src/test/modules/libpq_pipeline/README
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl

Allow tailoring of ICU locales with custom rules

commit   : 30a53b792959b36f07200dae246067b3adbcc0b9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2023 16:35:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2023 16:35:42 +0100    

Click here for diff

This exposes the ICU facility to add custom collation rules to a  
standard collation.  
  
New options are added to CREATE COLLATION, CREATE DATABASE, createdb,  
and initdb to set the rules.  
  
Reviewed-by: Laurenz Albe <[email protected]>  
Reviewed-by: Daniel Verite <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/catalogs.sgml
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/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/bin/scripts/createdb.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/utils/pg_locale.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/psql.out
M src/test/regress/sql/collate.icu.utf8.sql

Clean up comments

commit   : b1534ed99dc35878e1f9300759e4f10893a32d45    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2023 15:56:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2023 15:56:32 +0100    

Click here for diff

Reformat some of the comments in MergeAttributes().  A lot of code has  
been added here over time, and the comments could use a bit of editing  
to make the code flow read better.  

M src/backend/commands/tablecmds.c

Break up long GETTEXT_FILES lists

commit   : 2a71ad64cb27a86afa2a86bde70df3522aee7bae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2023 15:05:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2023 15:05:43 +0100    

Click here for diff

One file per line seems best.  We already did this in some cases.  
This adopts the same format everywhere (except in some cases where the  
list reasonably fits on one line).  

M src/bin/initdb/nls.mk
M src/bin/pg_ctl/nls.mk
M src/bin/pg_dump/nls.mk
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_rewind/nls.mk
M src/bin/pg_upgrade/nls.mk
M src/bin/pg_waldump/nls.mk
M src/bin/psql/nls.mk
M src/bin/scripts/nls.mk
M src/interfaces/libpq/nls.mk
M src/pl/plpgsql/src/nls.mk
M src/pl/plpython/nls.mk

Update comment

commit   : 822e8e295166f000e337a9b105692521e1fdc762    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2023 14:22:06 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Mar 2023 14:22:06 +0100    

Click here for diff

There was apparently an attempt here to list all the object types that  
ACL_USAGE applies to, but it wasn't complete.  So instead of trying to  
keep up, put in a more timeless comment.  

M src/include/nodes/parsenodes.h

Reflect normalization of query strings for utilities in pg_stat_statements

commit   : daa8365a900729fe2a8d427fbeff19e763e35723    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Mar 2023 15:00:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Mar 2023 15:00:50 +0900    

Click here for diff

Applying normalization changes how the following query strings are  
reflected in pg_stat_statements, by showing Const nodes with a  
dollar-signed parameter as this is how such queries are structured  
internally once parsed:  
- DECLARE  
- EXPLAIN  
- CREATE MATERIALIZED VIEW  
- CREATE TABLE AS  
  
More normalization could be done in the future depending on the parts  
where query jumbling is applied (like A_Const nodes?), the changes being  
reflected in the regression tests in majority created in de2aca2.  This  
just allows the basics to work for utility queries using Const nodes.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/cursors.out
M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/pg_stat_statements.c

Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids

commit   : be504a3e974d75be6f95c8f9b7367126034f2d12    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Mar 2023 21:36:46 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Mar 2023 21:36:46 -0800    

Click here for diff

When vacuum_defer_cleanup_age is bigger than the current xid, including the  
epoch, the subtraction of vacuum_defer_cleanup_age would lead to a wrapped  
around xid. While that normally is not a problem, the subsequent conversion to  
a 64bit xid results in a 64bit-xid very far into the future. As that xid is  
used as a horizon to detect whether rows versions are old enough to be  
removed, that allows removal of rows that are still visible (i.e. corruption).  
  
If vacuum_defer_cleanup_age was never changed from the default, there is no  
chance of this bug occurring.  
  
This bug was introduced in dc7420c2c92.  A lesser version of it exists in  
12-13, introduced by fb5344c969a, affecting only GiST.  
  
The 12-13 version of the issue can, in rare cases, lead to pages in a gist  
index getting recycled too early, potentially causing index entries to be  
found multiple times.  
  
The fix is fairly simple - don't allow vacuum_defer_cleanup_age to retreat  
further than FirstNormalTransactionId.  
  
Patches to make similar bugs easier to find, by adding asserts to the 64bit  
xid infrastructure, have been proposed, but are not suitable for backpatching.  
  
Currently there are no tests for vacuum_defer_cleanup_age. A patch introducing  
infrastructure to make writing a test easier has been posted to the list.  
  
Reported-by: Michail Nikolaev <[email protected]>  
Reviewed-by: Matthias van de Meent <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, but impact/fix is smaller for 12-13  

M src/backend/storage/ipc/procarray.c

Refine query jumbling handling for CallStmt

commit   : a4e003338d1832981354f5f89d9d5858439fd669    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Mar 2023 14:38:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Mar 2023 14:38:35 +0900    

Click here for diff

Previously, all the nodes of CallStmt were included in the jumbling,  
causing a duplicate in the computation as the transformed state of the  
CALL query was included as well as the parsed state (transformed  
FuncCall with all the input arguments and potential output arguments).  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/include/nodes/parsenodes.h

meson: don't require 'touch' binary, make use of 'cp' optional

commit   : 401874ab020b44d8000ac90debef43a146b96d5a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Mar 2023 18:24:18 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Mar 2023 18:24:18 -0800    

Click here for diff

We already didn't use touch (some earlier version of the meson build did ),  
and cp is only used for updating unicode files. The latter already depends on  
the optional availability of 'wget', so doing the same for 'cp' makes sense.  
  
Eventually we probably want a portable command for updating source code as  
part of a target, but for now...  
  
Reported-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M meson.build
M src/common/unicode/meson.build

Ignore IntoClause.viewQuery in query jumbling

commit   : d69cd3a2e29c68a3fdfd4e97167f9a7c6ad29e80    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Mar 2023 11:41:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Mar 2023 11:41:52 +0900    

Click here for diff

IntoClause.viewQuery is a copy of the parsed-but-not-rewritten SELECT  
clause copied to IntoClause when transforming CreateTableAsStmt for a  
materialized view.  Including a second copy of the SELECT Query into the  
query jumbling was leading to an incorrect numbering of the Const node  
locations, as these would be counted twice instead of once.  
  
This becomes visible once the query normalization is applied to CREATE  
MATERIALIZED VIEW in pg_stat_statements in the shape of a query string  
using only odd numbers for the normalized constants, (regression tests  
added in pg_stat_statements as of de2aca2 would show the difference).  
Including the original Query from CreateTableAsStmt is enough for the  
query jumbling.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/include/nodes/primnodes.h

Improve readability of code PROCESS_MAIN in vacuum_rel()

commit   : ee56048b0ecfee67a76ba8502b91cb5d91b6b03d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Mar 2023 09:16:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Mar 2023 09:16:44 +0900    

Click here for diff

4211fbd has been handling PROCESS_MAIN in vacuum_rel() with an "if/else  
if" structure to avoid an extra level of indentation, but this has been  
found as being rather parse to read.  This commit updates the code so as  
we check for PROCESS_MAIN in a single place and then handle its  
subpaths, FULL or non-FULL vacuums.  Some comments are added to make  
that clearer for the reader.  
  
Reported-by: Melanie Plageman  
Author: Nathan Bossart  
Reviewed-by: Michael Paquier, Melanie Plageman  
Discussion: https://postgr.es/m/20230306194009.5cn6sp3wjotd36nu@liskov  

M src/backend/commands/vacuum.c

Fix more bugs caused by adding columns to the end of a view.

commit   : 99be6feec9717058b9ac9d80f3584e0a9a6e8580    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2023 18:21:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Mar 2023 18:21:37 -0500    

Click here for diff

If a view is defined atop another view, and then CREATE OR REPLACE  
VIEW is used to add columns to the lower view, then when the upper  
view's referencing RTE is expanded by ApplyRetrieveRule we will have  
a subquery RTE with fewer eref->colnames than output columns.  This  
confuses various code that assumes those lists are always in sync,  
as they are in plain parser output.  
  
We have seen such problems before (cf commit d5b760ecb), and now  
I think the time has come to do what was speculated about in that  
commit: let's make ApplyRetrieveRule synthesize some column names to  
preserve the invariant that holds in parser output.  Otherwise we'll  
be chasing this class of bugs indefinitely.  Moreover, it appears from  
testing that this actually gives us better results in the test case  
d5b760ecb added, and likely in other corner cases that we lack  
coverage for.  
  
In HEAD, I replaced d5b760ecb's hack to make expandRTE exit early with  
an elog(ERROR) call, since the case is now presumably unreachable.  
But it seems like changing that in back branches would bring more risk  
than benefit, so there I just updated the comment.  
  
Per bug #17811 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Add support for unit "B" to pg_size_bytes()

commit   : ce1215d9b05b524339e31b7bba1f481af8b16fc8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Mar 2023 20:26:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Mar 2023 20:26:29 +0100    

Click here for diff

This makes it consistent with the units support in GUC.  
  
Reviewed-by: David Rowley <[email protected]>  
Reviewed-by: Dean Rasheed <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/0106914a-9eb5-22be-40d8-652cc88c827d%40enterprisedb.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/dbsize.c
M src/test/regress/expected/dbsize.out
M src/test/regress/sql/dbsize.sql

doc: Update pg_size_pretty documentation about petabytes support

commit   : af4d5715fc73c2ae2a22226e6f46958201464955    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Mar 2023 19:30:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Mar 2023 19:30:14 +0100    

Click here for diff

Missing documentation update for ca2e4472ba.  
  
Discussion: https://www.postgresql.org/message-id/CAApHDvrCwMgSD_93LZr4CLMas8Hc61fXAQ-Cd4%3D%2ByoRfHnYbJA%40mail.gmail.com  

M doc/src/sgml/func.sgml

Fix flakey pg_stat_io test

commit   : 1be0fdb9de559ce8daf6d5603f0329cbd056111a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Mar 2023 10:03:42 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Mar 2023 10:03:42 -0800    

Click here for diff

Wrap test of pg_stat_io's tracking of shared buffer reads in a transaction to  
prevent concurrent accesses (e.g. by autovacuum) causing spurious test  
failures.  
  
Reported-by: Tom Lane <[email protected]>  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20230306190919.ai6mxdq3sygyyths%40awork3.anarazel.de  

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

Make get_extension_schema() available

commit   : e20b1ea1575cb523821d51e9934d8d6dab835335    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 7 Mar 2023 14:18:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 7 Mar 2023 14:18:20 +0900    

Click here for diff

This routine is able to retrieve the OID of the schema used with an  
extension (pg_extension.extnamespace), or InvalidOid if this information  
is not available.  plpgsql_check embeds a copy of this code when  
performing checks on functions, as one out-of-core example.  
  
Author: Pavel Stehule  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/CAFj8pRD+9x55hjDoi285jCcjPc8uuY_D+FLn5RpXggdz+4O2sQ@mail.gmail.com  

M src/backend/commands/extension.c
M src/include/commands/extension.h

Fix incorrect comment in pg_get_partkeydef()

commit   : cf96907aadca454c4094819c2ecddee07eafe203    
  
author   : David Rowley <[email protected]>    
date     : Tue, 7 Mar 2023 14:33:28 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 7 Mar 2023 14:33:28 +1300    

Click here for diff

The comment claimed the output of the function was prefixed by "PARTITION  
BY".  This is incorrect.  
  
Author: Japin Li  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/MEYP282MB166923B446FF5FE55B9DACB7B6B69@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

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

Improve cleanup phases in regression tests of pg_stat_statements

commit   : 9a714b9d6ec0a562bc9242ec17122321cd174588    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 7 Mar 2023 08:58:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 7 Mar 2023 08:58:13 +0900    

Click here for diff

As shaped, two DROP ROLE queries included in "user_activity" were  
showing in the reports for "wal".  The intention is to keep each test  
isolated and independent, so this is incorrect.  This commit adds some  
calls to pg_stat_statements_reset() to clean up the statistics once each  
test finishes, so as there are no risks of overlap in the reports for  
individial scenarios.  
  
The addition in "user_activity" fixes the output of "wal".  The new  
resets done in "level_tracking" and "utility" are added for consistency  
with the rest, though they do not affect the stats generated in the  
other tests.  
  
Oversight in d0028e3.  
  
Reported-by: Andrei Zubkov  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/expected/user_activity.out
M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/expected/wal.out
M contrib/pg_stat_statements/sql/level_tracking.sql
M contrib/pg_stat_statements/sql/user_activity.sql
M contrib/pg_stat_statements/sql/utility.sql

Fix some more cases of missed GENERATED-column updates.

commit   : 7fee7871b4302e916577df130344060d0f9b8004    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Mar 2023 18:31:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Mar 2023 18:31:16 -0500    

Click here for diff

If UPDATE is forced to retry after an EvalPlanQual check, it neglected  
to repeat GENERATED-column computations, even though those might well  
have changed since we're dealing with a different tuple than before.  
Fixing this is mostly a matter of looping back a bit further when  
we retry.  In v15 and HEAD that's most easily done by altering the API  
of ExecUpdateAct so that it includes computing GENERATED expressions.  
  
Also, if an UPDATE in a partitioned table turns into a cross-partition  
INSERT operation, we failed to recompute GENERATED columns.  That's a  
bug since 8bf6ec3ba allowed partitions to have different generation  
expressions; although it seems to have no ill effects before that.  
Fixing this is messier because we can now have situations where the same  
query needs both the UPDATE-aligned set of GENERATED columns and the  
INSERT-aligned set, and it's unclear which set will be generated first  
(else we could hack things by forcing the INSERT-aligned set to be  
generated, which is indeed how fe9e658f4 made it work for MERGE).  
The best fix seems to be to build and store separate sets of expressions  
for the INSERT and UPDATE cases.  That would create ABI issues in the  
back branches, but so far it seems we can leave this alone in the back  
branches.  
  
Per bug #17823 from Hisahiro Kauchi.  The first part of this affects all  
branches back to v12 where GENERATED columns were added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/include/nodes/execnodes.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Silence -Wmissing-braces complaints in file_utils.c

commit   : d937904cce6a3d82e4f9c2127de7b59105a134b3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 7 Mar 2023 07:42:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 7 Mar 2023 07:42:36 +0900    

Click here for diff

Per buildfarm member lapwing, coupled with an offline poke from Julien  
Rouhaud.  
  
6392f2a was a similar case.  

M src/common/file_utils.c

Fill EState.es_rteperminfos more systematically.

commit   : b803b7d132e3505ab77c29acf91f3d1caa298f95    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Mar 2023 13:10:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Mar 2023 13:10:57 -0500    

Click here for diff

While testing a fix for bug #17823, I discovered that EvalPlanQualStart  
failed to copy es_rteperminfos from the parent EState, resulting in  
failure if anything in EPQ execution wanted to consult that information.  
  
This led me to conclude that commit a61b1f748 had been too haphazard  
about where to fill es_rteperminfos, and that we need to be sure that  
that happens exactly where es_range_table gets filled.  So I changed the  
signature of ExecInitRangeTable to help ensure that this new requirement  
doesn't get missed.  (Indeed, pgoutput.c was also failing to fill it.  
Maybe we don't ever need it there, but I wouldn't bet on that.)  
  
No test case yet; one will arrive with the fix for #17823.  
But that needs to be back-patched, while this fix is HEAD-only.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyfrom.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/executor/executor.h

Reword overly-optimistic comment about backup checksum verification.

commit   : e76cbb6cd64d9c9cdf76a56318ba5249bf694b69    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Mar 2023 10:35:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Mar 2023 10:35:15 -0500    

Click here for diff

The comment implies that a single retry is sufficient to avoid  
spurious checksum failures, but in fact no number of retries is  
sufficient for that purpose. Update the comment accordingly.  
  
Patch by me, reviewed by Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmoZ_fFAoU6mrHt9QBs+dcYhN6yXenGTTMRebZNhtwPwHyg@mail.gmail.com  

M src/backend/backup/basebackup.c

Remove an old comment that doesn't seem especially useful.

commit   : f3948b5c9152e4beb33c0a4ff4ee193d264a5535    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2023 14:51:56 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2023 14:51:56 -0500    

Click here for diff

The functions that follow are concerned with various things, of  
which the tar format is only one, so this comment doesn't really  
seem helpful. The file isn't really divided into sections in the  
way that this comment seems to contemplate -- or at least, not  
any more.  
  
Patch by me, reviewed by Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmoZ_fFAoU6mrHt9QBs+dcYhN6yXenGTTMRebZNhtwPwHyg@mail.gmail.com  

M src/backend/backup/basebackup.c

In basebackup.c, perform end-of-file test after checksum validation.

commit   : 33352b9279f5e109aae74d61531d33d8fb12253e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2023 12:04:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Feb 2023 12:04:16 -0500    

Click here for diff

We read blocks of data from files that we're backing up in chunks,  
some multiple of BLCKSZ for each read. If checksum verification fails,  
we then try rereading just the one block for which validation failed.  
If that block happened to be the first block of the chunk, and if  
the file was concurrently truncated to remove that block, then we'd  
reach a call to bbsink_archive_contents() with a buffer length of 0.  
That causes an assertion failure.  
  
As far as I can see, there are no particularly bad consequences if  
this happens in a non-assert build, and it's pretty unlikely to happen  
in the first place because it requires a series of somewhat unlikely  
things to happen in very quick succession. However, assertion failures  
are bad, so rearrange the code to avoid that possibility.  
  
Patch by me, reviewed by Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmoZ_fFAoU6mrHt9QBs+dcYhN6yXenGTTMRebZNhtwPwHyg@mail.gmail.com  

M src/backend/backup/basebackup.c

Fix handling of default option values in createuser

commit   : d3406d80360776bbcafa05d8b966806012f9594e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 6 Mar 2023 14:16:32 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 6 Mar 2023 14:16:32 +0100    

Click here for diff

Add description of which one is the default between two complementary  
options of --bypassrls and --replication in the help text and docs. In  
correspondence let the command always include the tokens corresponding  
to every options of that kind in the SQL command sent to server. Tests  
are updated accordingly.  
  
Also fix the checks of some trivalue vars which were using literal zero  
for checking default value instead of the enum label TRI_DEFAULT. While  
not a bug, since TRI_DEFAULT is defined as zero, fixing improves read-  
ability improved readability (and avoid bugs if the enum is changed).  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/createuser.sgml
M src/bin/scripts/createuser.c
M src/bin/scripts/t/040_createuser.pl

Add PROCESS_MAIN to VACUUM

commit   : 4211fbd8413b26e0abedbe4338aa7cda2cd469b4    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Mar 2023 16:41:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Mar 2023 16:41:05 +0900    

Click here for diff

Disabling this option is useful to run VACUUM (with or without FULL) on  
only the toast table of a relation, bypassing the main relation.  This  
option is enabled by default.  
  
Running directly VACUUM on a toast table was already possible without  
this feature, by using the non-deterministic name of a toast relation  
(as of pg_toast.pg_toast_N, where N would be the OID of the parent  
relation) in the VACUUM command, and it required a scan of pg_class to  
know the name of the toast table.  So this feature is basically a  
shortcut to be able to run VACUUM or VACUUM FULL on a toast relation,  
using only the name of the parent relation.  
  
A new switch called --no-process-main is added to vacuumdb, to work as  
an equivalent of PROCESS_MAIN.  
  
Regression tests are added to cover VACUUM and VACUUM FULL, looking at  
pg_stat_all_tables.vacuum_count to see how many vacuums have run on  
each table, main or toast.  
  
Author: Nathan Bossart  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/20221230000028.GA435655@nathanxps13  

M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c
M src/include/commands/vacuum.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Improve the regression tests of VACUUM (PROCESS_TOAST)

commit   : 46d490ac19a7ca93a5c0f47e5a0e759b5385a8ae    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Mar 2023 15:40:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Mar 2023 15:40:56 +0900    

Click here for diff

All the regression tests of VACUUM (PROCESS_TOAST) were only checking if  
the commands were able to run, without checking if VACUUM was really  
running on what it should.  This expands this set of tests so as we now  
look at pg_stat_all_tables.vacuum_count to see how many vacuums have  
been run on a given table and its toast relation.  
  
Extracted from a larger patch by the same author, as this is useful on  
its own.  
  
Special thanks to Álvaro Herrera for the idea of using  
pg_stat_all_tables to check the state of the toast relation.  
  
Author: Nathan Bossart  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/20221230000028.GA435655@nathanxps13  

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

Deduplicate handling of binary and text modes in logicalrep_read_tuple().

commit   : 9effa5523601de52c94fb778b4a00a183a9aa056    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 6 Mar 2023 09:54:57 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 6 Mar 2023 09:54:57 +0530    

Click here for diff

Author: Bharath Rupireddy  
Reviewed-by: Peter Smith  
Discussion: https://postgr.es/m/CALj2ACXdbq7kW_+bRrSGMsR6nefCvwbHBJ5J51mr3gFf7QysTA@mail.gmail.com  

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

Revise pg_pwrite_zeros()

commit   : ce340e530d1f76367379a8d230ad5f411e5f25d2    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Mar 2023 13:21:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Mar 2023 13:21:33 +0900    

Click here for diff

The following changes are made to pg_write_zeros(), the API able to  
write series of zeros using vectored I/O:  
- Add of an "offset" parameter, to write the size from this position  
(the 'p' of "pwrite" seems to mean position, though POSIX does not  
outline ythat directly), hence the name of the routine is incorrect if  
it is not able to handle offsets.  
- Avoid memset() of "zbuffer" on every call.  
- Avoid initialization of the whole IOV array if not needed.  
- Group the trailing write() call with the main write() call,  
simplifying the function logic.  
  
Author: Andres Freund  
Reviewed-by: Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/bin/pg_basebackup/walmethods.c
M src/common/file_utils.c
M src/include/common/file_utils.h

Fix assert failures in parallel SERIALIZABLE READ ONLY.

commit   : 47c0accbe05b5774a8a30e42e56e8d6026c9a858    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 6 Mar 2023 15:07:15 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 6 Mar 2023 15:07:15 +1300    

Click here for diff

1.  Make sure that we don't decrement SxactGlobalXminCount twice when  
the SXACT_FLAG_RO_SAFE optimization is reached in a parallel query.  
This could trigger a sanity check failure in assert builds.  Non-assert  
builds recompute the count in SetNewSxactGlobalXmin(), so the problem  
was hidden, explaining the lack of field reports.  Add a new isolation  
test to exercise that case.  
  
2.  Remove an assertion that the DOOMED flag can't be set on a partially  
released SERIALIZABLEXACT.  Instead, ignore the flag (our transaction  
was already determined to be read-only safe, and DOOMED is in fact set  
during partial release, and there was already an assertion that it  
wasn't set sooner).  Improve an existing isolation test so that it  
reaches that case (previously it wasn't quite testing what it was  
supposed to be testing; see discussion).  
  
Back-patch to 12.  Bug #17116.  Defects in commit 47a338cf.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/17116-d6ca217acc180e30%40postgresql.org  

M src/backend/storage/lmgr/predicate.c
M src/test/isolation/expected/serializable-parallel-2.out
A src/test/isolation/expected/serializable-parallel-3.out
M src/test/isolation/isolation_schedule
M src/test/isolation/specs/serializable-parallel-2.spec
A src/test/isolation/specs/serializable-parallel-3.spec

SQL JSON path enhanced numeric literals

commit   : 102a5c164a91d717632f3a24f1289a5fa4861973    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 5 Mar 2023 15:02:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 5 Mar 2023 15:02:01 +0100    

Click here for diff

Add support for non-decimal integer literals and underscores in  
numeric literals to SQL JSON path language.  This follows the rules of  
ECMAScript, as referred to by the SQL standard.  
  
Internally, all the numeric literal parsing of jsonpath goes through  
numeric_in, which already supports all this, so this patch is just a  
bit of lexer work and some tests and documentation.  
  
Reviewed-by: Dean Rasheed <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/json.sgml
M src/backend/catalog/sql_features.txt
M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonpath.sql

Avoid failure when altering state of partitioned foreign-key triggers.

commit   : 6949b921d545809a83f8a6bad4948f9012a76fb6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Mar 2023 13:32:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Mar 2023 13:32:35 -0500    

Click here for diff

Beginning in v15, if you apply ALTER TABLE ENABLE/DISABLE TRIGGER to  
a partitioned table, it also affects the partitions' cloned versions  
of the affected trigger(s).  The initial implementation of this  
located the clones by name, but that fails on foreign-key triggers  
which have names incorporating their own OIDs.  We can fix that, and  
also make the behavior more bulletproof in the face of user-initiated  
trigger renames, by identifying the cloned triggers by tgparentid.  
  
Following the lead of earlier commits in this area, I took care not  
to break ABI in the v15 branch, even though I rather doubt there  
are any external callers of EnableDisableTrigger.  
  
While here, update the documentation, which was not touched when  
the semantics were changed.  
  
Per bug #17817 from Alan Hodgson.  Back-patch to v15; older versions  
do not have this behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/include/commands/trigger.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Tighten header pre-inclusions in headerscheck and cpluspluscheck.

commit   : f62975b2af6ace276a1d564a070b0aef479025af    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Mar 2023 12:11:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Mar 2023 12:11:50 -0500    

Click here for diff

We allow our header files to depend on the appropriate one of  
postgres.h, postgres_fe.h, or c.h having already been included.  
However, there are a few headers such as libpq-fe.h that are  
meant to be used by client applications and therefore must  
compile without any assumptions about previous inclusions.  
These test scripts failed to consider that, which seems quite  
hazardous since we might not immediately notice such a problem  
otherwise.  Hence, adjust these scripts to test relevant libpq  
and ecpg headers with no prior inclusion.  
  
While at it, we can also make an effort to actually use the  
relevant one of postgres.h, postgres_fe.h, or c.h.  I added  
some rules that guess which one to use based on the first-level  
src subdirectory, e.g. use postgres_fe.h under src/bin/.  
These rules are hardly water-tight but they seem to work today,  
and we can always refine them in the future.  
  
These changes don't reveal any live problems today, which is good,  
but they should make these scripts more able to catch future bugs.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Update some incorrect comments about xlog records.

commit   : ebd551f586a801dee426e49ba72fb213e8013890    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Mar 2023 12:52:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Mar 2023 12:52:04 -0500    

Click here for diff

The comments claim that certain pieces of data are part of the main  
WAL record data when in reality they are part of the data for  
block 0. Repair.  
  
Bertrand Drouvot, reviewed by Amit Kapila. Originally reported by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/access/gistxlog.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtxlog.h

meson: Prevent installation of test files during main install

commit   : b6a0d469cae4410a05b5e109748278065a931b68    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2023 07:18:20 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2023 07:18:20 +0100    

Click here for diff

Previously, meson installed modules under src/test/modules/ as part of  
a normal installation, even though these files are only meant for use  
by tests.  This is because there is no way to set up up the build  
system to install extra things only when told.  
  
This patch fixes that with a workaround: We don't install these  
modules as part of meson install, but we create a new "test" that runs  
before the real tests whose action it is to install these files.  The  
installation is done by manual copies using a small helper script.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/2a039e8e-f31f-31e8-afe7-bab3130ad2de%40enterprisedb.com  

M meson.build
M src/backend/meson.build
M src/test/modules/delay_execution/meson.build
M src/test/modules/dummy_index_am/meson.build
M src/test/modules/dummy_seclabel/meson.build
M src/test/modules/plsample/meson.build
M src/test/modules/spgist_name_ops/meson.build
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/modules/test_bloomfilter/meson.build
M src/test/modules/test_copy_callbacks/meson.build
M src/test/modules/test_custom_rmgrs/meson.build
M src/test/modules/test_ddl_deparse/meson.build
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_ginpostinglist/meson.build
M src/test/modules/test_integerset/meson.build
M src/test/modules/test_lfind/meson.build
M src/test/modules/test_oat_hooks/meson.build
M src/test/modules/test_parser/meson.build
M src/test/modules/test_pg_db_role_setting/meson.build
M src/test/modules/test_pg_dump/meson.build
M src/test/modules/test_predtest/meson.build
M src/test/modules/test_rbtree/meson.build
M src/test/modules/test_regex/meson.build
M src/test/modules/test_rls_hooks/meson.build
M src/test/modules/test_shm_mq/meson.build
M src/test/modules/test_slru/meson.build
M src/test/modules/worker_spi/meson.build
M src/test/regress/meson.build
A src/tools/install_test_files

Fix incorrect format placeholders

commit   : b1307b8b60111be8ddd8d6127701883c047bed15    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2023 07:01:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Mar 2023 07:01:18 +0100    

Click here for diff

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

Force testing of query jumbling in 027_stream_regress.pl

commit   : d28a449854202d0a409e13e2e73f78373da1ed75    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 3 Mar 2023 10:41:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 3 Mar 2023 10:41:51 +0900    

Click here for diff

Coverage of the query jumbling code has always relied on the queries  
included in the regression tests of pg_stat_statements.  This has its  
limitations, as a lot of query patterns have never really stressed the  
query jumbling code.  The situation got a bit worse since the query  
jumbling has been added in the backend core code (5fd9dfa), hence new  
nodes that should be included in the jumbling could easily be missed,  
resulting in failures in pg_stat_statements or any modules that require  
query ID computations.  Forcing a load of pg_stat_statements in  
027_stream_regress.pl ensures that nodes are never missed in the  
computations, without having to rely on a buildfarm member for this  
check.  
  
Before this commit, the line coverage of queryjumblefuncs.funcs.c was  
around 48.5%, now up to 94.6% just by running 027_stream_regress.pl.  
A basic check is added to show that pg_stat_statements reports are  
generated after the main regression test suite is finished.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/Makefile
M src/test/recovery/README
M src/test/recovery/t/027_stream_regress.pl

Refactor more the regression tests of pg_stat_statements

commit   : d0028e35a05ac71aebf28325c8ddb59a27cb63c0    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 3 Mar 2023 08:46:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 3 Mar 2023 08:46:11 +0900    

Click here for diff

This commit expands more the refactoring of the regression tests of  
pg_stat_statements, with tests moved out of pg_stat_statements.sql into  
separate files.  The following file structure is now used:  
- select is mostly the former pg_stat_statements.sql, renamed.  
- dml for INSERT/UPDATE/DELETE and MERGE  
- user_activity, to test role-level checks and stat resets.  
- wal, to check the WAL generation after some queries.  
  
Like e8dbdb1, there is no change in terms of code coverage or results,  
and this finishes the split I was aiming for in these tests.  Most of  
the tests used "test" of "pgss_test" as names for the tables used, these  
are renamed to less generic names.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/Y/7Y9U/y/[email protected]  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/expected/dml.out
D contrib/pg_stat_statements/expected/pg_stat_statements.out
A contrib/pg_stat_statements/expected/select.out
A contrib/pg_stat_statements/expected/user_activity.out
A contrib/pg_stat_statements/expected/wal.out
M contrib/pg_stat_statements/meson.build
A contrib/pg_stat_statements/sql/dml.sql
D contrib/pg_stat_statements/sql/pg_stat_statements.sql
A contrib/pg_stat_statements/sql/select.sql
A contrib/pg_stat_statements/sql/user_activity.sql
A contrib/pg_stat_statements/sql/wal.sql

Harden new test case against force_parallel_mode = regress.

commit   : 98a88bc2bcd60e41ca70e2f1e13eee827e23eefb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 17:47:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 17:47:20 -0500    

Click here for diff

Per buildfarm: worker processes can't see a role created in  
the current transaction.  

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

Show "internal name" not "source code" in psql's \df+ command.

commit   : 3dfae91f7a1293e0a57526edcfca8690c176c681    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 17:15:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 17:15:00 -0500    

Click here for diff

Our previous habit of showing the full function body is really  
pretty unfriendly for tabular viewing of functions, and now that  
we have \sf and \ef commands there seems no good reason why \df+  
has to do it.  It still seems to make sense to show prosrc for  
internal and C-language functions, since in those cases prosrc  
is just the C function name; but then let's rename the column to  
"Internal name" which is a more accurate descriptor.  
  
Isaac Morland  
  
Discussion: https://postgr.es/m/CAMsGm5eqKc6J1=Lwn=ZONG=6ZDYWRQ4cgZQLqMuZGB1aVt_JBg@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/describe.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Don't leak descriptors into subprograms.

commit   : 1da569ca1f1fd08ae728ccde0952b688feff7d9c    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 3 Mar 2023 10:28:47 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 3 Mar 2023 10:28:47 +1300    

Click here for diff

Open long-lived data and WAL file descriptors with O_CLOEXEC.  This flag  
was introduced by SUSv4 (POSIX.1-2008), and by now all of our target  
Unix systems have it.  Our open() implementation for Windows already had  
that behavior, so provide a dummy O_CLOEXEC flag on that platform.  
  
For now, callers of open() and the "thin" wrappers in fd.c that deal in  
raw descriptors need to pass in O_CLOEXEC explicitly if desired.  This  
commit does that for WAL files, and automatically for everything  
accessed via VFDs including SMgrRelation and BufFile.  (With more  
discussion we might decide to turn it on automatically for the thin  
open()-wrappers too to avoid risk of missing places that need it, but  
these are typically used for short-lived descriptors where we don't  
expect to fork/exec, and it's remotely possible that extensions could be  
using these APIs and passing descriptors to subprograms deliberately, so  
that hasn't been done here.)  
  
Do the same for sockets and the postmaster pipe with FD_CLOEXEC.  (Later  
commits might use modern interfaces to remove these extra fcntl() calls  
and more where possible, but we'll need them as a fallback for a couple  
of systems, so do it that way in this initial commit.)  
  
With this change, subprograms executed for archiving, copying etc will  
no longer have access to the server's descriptors, other than the ones  
that we decide to pass down.  
  
Reviewed-by: Andres Freund <[email protected]> (earlier version)  
Discussion: https://postgr.es/m/CA%2BhUKGKb6FsAdQWcRL35KJsftv%2B9zXqQbzwkfRf1i0J2e57%2BhQ%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/libpq/pqcomm.c
M src/backend/storage/file/fd.c
M src/backend/utils/init/miscinit.c
M src/include/port/win32_port.h

Remove local optimizations of empty Bitmapsets into null pointers.

commit   : 6b661b01f48bb0d3129ad0e3909210a6ba0534b3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 12:01:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 12:01:47 -0500    

Click here for diff

These are all dead code now that it's done centrally.  
  
Patch by me; thanks to Nathan Bossart and Richard Guo for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execUtils.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/backend/rewrite/rewriteManip.c
M src/pl/plpgsql/src/pl_exec.c

Require empty Bitmapsets to be represented as NULL.

commit   : 00b41463c21615f9bf3927f207e37f9e215d32e6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 11:47:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 11:47:26 -0500    

Click here for diff

When I designed the Bitmapset module, I set things up so that an empty  
Bitmapset could be represented either by a NULL pointer, or by an  
allocated object all of whose bits are zero.  I've recently come to  
the conclusion that that was a bad idea and we should instead have a  
convention like the longstanding invariant for Lists, whereby an empty  
list is represented by NIL and nothing else.  
  
To do this, we need to fix bms_intersect, bms_difference, and a couple  
of other functions to check for having produced an empty result; but  
then we can replace bms_is_empty(a) by a simple "a == NULL" test.  
  
This is very likely a (marginal) win performance-wise, because we  
call bms_is_empty many more times than those other functions put  
together.  However, the real reason to do it is that we have various  
places that have hand-implemented a rule about "this Bitmapset  
variable must be exactly NULL if empty", so that they can use  
checks-for-null in place of bms_is_empty calls in particularly hot  
code paths.  That is a really fragile, mistake-prone way to do things,  
and I'm surprised that we've seldom been bitten by it.  It's not well  
documented at all which variables have this property, so you can't  
readily tell which code might be violating those conventions.  By  
making the convention universal, we can eliminate a subtle source of  
bugs.  
  
Patch by me; thanks to Nathan Bossart and Richard Guo for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/bitmapset.c
M src/include/nodes/bitmapset.h

Mop up some undue familiarity with the innards of Bitmapsets.

commit   : 141225b2518f20ca7bd68d4458953c3404d2e364    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 11:37:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 11:37:37 -0500    

Click here for diff

nodeAppend.c used non-nullness of appendstate->as_valid_subplans as  
a state flag to indicate whether it'd done ExecFindMatchingSubPlans  
(or some sufficient approximation to that).  This was pretty  
questionable even in the beginning, since it wouldn't really work  
right if there are no valid subplans.  It got more questionable  
after commit 27e1f1456 added logic that could reduce as_valid_subplans  
to an empty set: at that point we were depending on unspecified  
behavior of bms_del_members, namely that it'd not return an empty  
set as NULL.  It's about to start doing that, which breaks this  
logic entirely.  Hence, add a separate boolean flag to signal  
whether as_valid_subplans has been computed.  
  
Also fix a previously-cosmetic bug in nodeAgg.c, wherein it ignored  
the return value of bms_del_member instead of updating its pointer.  
  
Patch by me; thanks to Nathan Bossart and Richard Guo for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/include/nodes/execnodes.h

Remove bms_first_member().

commit   : 462bb7f12851c215dfc21a88ae0ed4bf7fcb36a3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 11:34:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Mar 2023 11:34:29 -0500    

Click here for diff

This function has been semi-deprecated ever since we invented  
bms_next_member().  Its habit of scribbling on the input bitmapset  
isn't great, plus for sufficiently large bitmapsets it would take  
O(N^2) time to complete a loop.  Now we have the additional problem  
that reducing the input to empty while leaving it still accessible  
would violate a planned invariant.  So let's just get rid of it,  
after updating the few extant callers to use bms_next_member().  
  
Patch by me; thanks to Nathan Bossart and Richard Guo for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/file_fdw/file_fdw.c
M contrib/sepgsql/dml.c
M src/backend/access/heap/heapam.c
M src/backend/executor/nodeAgg.c
M src/backend/nodes/bitmapset.c
M src/backend/optimizer/plan/subselect.c
M src/backend/parser/parse_expr.c
M src/backend/replication/logical/relation.c
M src/include/nodes/bitmapset.h

Mark options as deprecated in usage output

commit   : 2f80c95740f88e9e3e04ee0c2063e55a497315b4    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 2 Mar 2023 14:36:37 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 2 Mar 2023 14:36:37 +0100    

Click here for diff

Some deprecated options were not marked as such in usage output.  This  
does so across the installed binaries in an attempt to provide consistent  
markup for this.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/oid2name/oid2name.c
M src/backend/main/main.c
M src/bin/pg_dump/pg_dump.c

Fix outdated references to guc.c

commit   : 7ab1bc2939f32aa995bdb81eaac3bb28f908e980    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 2 Mar 2023 13:49:39 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 2 Mar 2023 13:49:39 +0100    

Click here for diff

Commit 0a20ff54f split out the GUC variables from guc.c into a new file  
guc_tables.c. This updates comments referencing guc.c regarding variables  
which are now in guc_tables.c.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/variable.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/storage/lmgr/predicate.c
M src/bin/pg_dump/dumputils.c
M src/include/miscadmin.h
M src/test/modules/test_misc/t/003_check_guc.pl
M src/timezone/pgtz.c

Make some xlogreader messages more accurate

commit   : 4ac30ba4f29d4b586b131404b0d514f16501272a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Mar 2023 07:42:39 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Mar 2023 07:42:39 +0100    

Click here for diff

When you have some invalid WAL, you often get a message like "wanted  
24, got 0".  This is a bit incorrect, since it really wanted *at  
least* 24, not exactly 24.  This updates the messages to that effect,  
and also adds that detail to one message where it was available but  
not printed.  
  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Jeevan Ladhe <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/726d782b-5e45-0c3e-d775-6686afe9aa83%40enterprisedb.com  

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

pageinspect: Fix crash with gist_page_items()

commit   : be753639d35df72c1a7b42ec114393fd962f2b01    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Mar 2023 14:03:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Mar 2023 14:03:02 +0900    

Click here for diff

Attempting to use this function with a raw page not coming from a GiST  
index would cause a crash, as it was missing the same sanity checks as  
gist_page_items_bytea().  This slightly refactors the code so as all the  
basic validation checks for GiST pages are done in a single routine,  
in the same fashion as the pageinspect functions for hash and BRIN.  
  
This fixes an issue similar to 076f4d9.  A test is added to stress for  
this case.  While on it, I have added a similar test for  
brin_page_items() with a combination make of a valid GiST index and a  
raw btree page.  This one was already protected, but it was not tested.  
  
Reported-by: Egor Chindyaskin  
Author: Dmitry Koval  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/sql/brin.sql
M contrib/pageinspect/sql/gist.sql

Avoid fetching one past the end of translate()'s "to" parameter.

commit   : d7056bc1c71d2d876adb60dda8e0ba962e8279df    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Mar 2023 11:30:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Mar 2023 11:30:17 -0500    

Click here for diff

This is usually harmless, but if you were very unlucky it could  
provoke a segfault due to the "to" string being right up against  
the end of memory.  Found via valgrind testing (so we might've  
found it earlier, except that our regression tests lacked any  
exercise of translate()'s deletion feature).  
  
Fix by switching the order of the test-for-end-of-string and  
advance-pointer steps.  While here, compute "to_ptr + tolen"  
just once.  (Smarter compilers might figure that out for  
themselves, but let's just make sure.)  
  
Report and fix by Daniil Anisimov, in bug #17816.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/oracle_compat.c
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

Improve wording in pg_dump compression docs

commit   : 6095069b40d7f01d5e7771d23b18d65dc029fc0d    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 1 Mar 2023 16:08:33 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 1 Mar 2023 16:08:33 +0100    

Click here for diff

A couple minor corrections in pg_dump comments and docs, related to the  
recently introduced compression API.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c

Fix condition in pg_dump TAP test

commit   : 34ce11437497fbbdd44f26d6f1cc9d40f84da679    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 1 Mar 2023 15:53:51 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 1 Mar 2023 15:53:51 +0100    

Click here for diff

The condition checking compression support was parenthesized  
incorrectly after adding lz4, so fix that.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

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

meson: Add equivalent of configure --disable-rpath option

commit   : d2f44cc36e60b5490e56fd2aa7d3381764a38d36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2023 07:41:02 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Mar 2023 07:41:02 +0100    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/33e957e6-4b4e-b0ed-1cc1-6335a24543ff%40enterprisedb.com  

M doc/src/sgml/installation.sgml
M meson.build
M meson_options.txt
M src/makefiles/meson.build

doc: Mention de-normalization of deallocated entries in pg_stat_statements

commit   : 6da67a0c111a29e876b7172d081c7d152d23ea3d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Mar 2023 10:47:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Mar 2023 10:47:01 +0900    

Click here for diff

The current implementation of query normalization in pg_stat_statements  
is optimistic.  If an entry is deallocated between the post-analyze hook  
and the planner and/or execution hook, it can be possible to find query  
strings with literal constant values (like "SELECT 1, 2") rather than  
their normalized flavor (like "SELECT $1, $2").  
  
This commit adds in the documentation a paragraph about this limitation,  
and that this risk can be reduced by increasing pg_stat_statements.max,  
particularly if pg_stat_statements_info reports a high number of  
deallocations.  
  
Author: Sami Imseih  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgstatstatements.sgml

doc: Update pg_stat_statements about query ID calculation of utilities

commit   : 6a88a058614bc921d6cab1cc50330ddee283c810    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Mar 2023 10:31:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Mar 2023 10:31:55 +0900    

Click here for diff

Since 3db72eb, the calculation of the query ID hash for utilities is not  
done based on the textual query strings, but on their internal Query  
representation, meaning that there can be an overlap when they use  
literal constants.  The documentation of pg_stat_statements was missing  
a refresh about that.  
  
Extracted from a larger patch by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgstatstatements.sgml

Suppress more compiler warnings in new pgstats code.

commit   : b1b86820d84e4ddca9396aa6b7c5a496382fe950    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Feb 2023 20:30:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Feb 2023 20:30:37 -0500    

Click here for diff

Per buildfarm, we didn't get rid of quite all of the  
-Wtautological-constant-out-of-range-compare warnings  
in pgstat_io.c.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat_io.c

doc: Fix description of pg_get_wal_stats_till_end_of_wal() in pg_walinspect

commit   : 019f8624664dbf1e25e2bd721c7e99822812d109    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Mar 2023 08:38:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Mar 2023 08:38:43 +0900    

Click here for diff

end_lsn was mentioned as an input parameter, but that should not be the  
case.  Error introduced in 58597ed.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/20230228195740.GA1397484@nathanxps13  
Backpatch-through: 15  

M doc/src/sgml/pgwalinspect.sgml

Fix logic buglets in pg_dump's flagInhAttrs().

commit   : 128dd9f9eca0b633b51ffcd5b0f798fbc48ec4c0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Feb 2023 18:06:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Feb 2023 18:06:45 -0500    

Click here for diff

As it stands, flagInhAttrs() can make changes in table properties that  
change decisions made at other tables during other iterations of its  
loop.  This is a pretty bad idea, since we visit the tables in OID  
order which is not necessarily related to inheritance relationships.  
So far as I can tell, the consequences are just cosmetic: we might  
dump DEFAULT or GENERATED expressions that we don't really need to  
because they match properties of the parent.  Nonetheless, it's buggy,  
and somebody might someday add functionality here that fails less  
benignly when the traversal order varies.  
  
One issue is that when we decide we needn't dump a particular  
GENERATED expression, we physically unlink the struct for it,  
so that it will now look like the table has no such expression,  
causing the wrong choice to be made at any child visited later.  
We can improve that by instead clearing the dobj.dump flag,  
and taking care to check that flag when it comes time to dump  
the expression or not.  
  
The other problem is that if we decide we need to fake up a DEFAULT  
NULL clause to override a default that would otherwise get inherited,  
we modify the data structure in the reverse fashion, creating an  
attrdefs entry where there hadn't been one.  It's harder to avoid  
doing that, but since the backend won't report a plain "DEFAULT NULL"  
property we can modify the code to recognize ones we just added.  
  
Add some commentary to perhaps forestall future mistakes of the  
same ilk.  
  
Since the effects of this seem only cosmetic, no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c

Remove unnecessary and problematic collate.windows.win1252 tests

commit   : b5737efea00717173c0cc889ebd115966abd8c8c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 28 Feb 2023 15:47:07 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 28 Feb 2023 15:47:07 -0500    

Click here for diff

Some windows instances can't handle setting lc_time to a non BCP 47  
locale, and the removed tests in any case don't really make lots of  
sense here.  
  
Juan José Santamaría Flecha  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/collate.windows.win1252.out
M src/test/regress/sql/collate.windows.win1252.sql

Drop test view when done with it.

commit   : 71a75626d5271f2bcdbdc43b8c13065c4634fd9f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2023 20:27:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2023 20:27:48 -0500    

Click here for diff

The view just added by commit 53fe7e6cb decompiles differently  
in v15 than HEAD (presumably as a consequence of 47bb9db75).  
That causes failures in cross-version upgrade testing.  
  
We could teach AdjustUpgrade.pm to compensate for that, but it  
seems less painful to just drop the view after we're done with it.  
  
Per buildfarm.  

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

Fix expected output of xml_2.out

commit   : 737668d9e320e452b4eeec6e5cec86284de67e0f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Feb 2023 08:37:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Feb 2023 08:37:37 +0900    

Click here for diff

Per buildfarm members snakefly, parula and prion, that reflect the  
results coming from the latest versions of libxml2.  
  
Oversight in b8da37b in the shape of an incorrect copy-paste.  The CI  
was green, but it does not stress this expected output.  

M src/test/regress/expected/xml_2.out

Rework pg_input_error_message(), now renamed pg_input_error_info()

commit   : b8da37b3ada2e547983538b3e49f8079f85ce120    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Feb 2023 08:04:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Feb 2023 08:04:13 +0900    

Click here for diff

pg_input_error_info() is now a SQL function able to return a row with  
more than just the error message generated for incorrect data type  
inputs when these are able to handle soft failures, returning more  
contents of ErrorData, as of:  
- The error message (same as before).  
- The error detail, if set.  
- The error hint, if set.  
- SQL error code.  
  
All the regression tests that relied on pg_input_error_message() are  
updated to reflect the effects of the rename.  
  
Per discussion with Tom Lane and Andrew Dunstan.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M contrib/cube/expected/cube.out
M contrib/cube/sql/cube.sql
M contrib/hstore/expected/hstore.out
M contrib/hstore/sql/hstore.sql
M contrib/intarray/expected/_int.out
M contrib/intarray/sql/_int.sql
M contrib/isn/expected/isn.out
M contrib/isn/sql/isn.sql
M contrib/ltree/expected/ltree.out
M contrib/ltree/sql/ltree.sql
M contrib/seg/expected/seg.out
M contrib/seg/sql/seg.sql
M doc/src/sgml/func.sgml
M src/backend/utils/adt/misc.c
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/arrays.out
M src/test/regress/expected/bit.out
M src/test/regress/expected/boolean.out
M src/test/regress/expected/box.out
M src/test/regress/expected/char.out
M src/test/regress/expected/char_1.out
M src/test/regress/expected/char_2.out
M src/test/regress/expected/date.out
M src/test/regress/expected/domain.out
M src/test/regress/expected/enum.out
M src/test/regress/expected/float4-misrounded-input.out
M src/test/regress/expected/float4.out
M src/test/regress/expected/float8.out
M src/test/regress/expected/geometry.out
M src/test/regress/expected/inet.out
M src/test/regress/expected/int2.out
M src/test/regress/expected/int4.out
M src/test/regress/expected/int8.out
M src/test/regress/expected/interval.out
M src/test/regress/expected/json.out
M src/test/regress/expected/json_encoding.out
M src/test/regress/expected/json_encoding_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/line.out
M src/test/regress/expected/lseg.out
M src/test/regress/expected/macaddr.out
M src/test/regress/expected/macaddr8.out
M src/test/regress/expected/money.out
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/numeric.out
M src/test/regress/expected/oid.out
M src/test/regress/expected/path.out
M src/test/regress/expected/pg_lsn.out
M src/test/regress/expected/point.out
M src/test/regress/expected/polygon.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/expected/regproc.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/strings.out
M src/test/regress/expected/tid.out
M src/test/regress/expected/time.out
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/expected/timetz.out
M src/test/regress/expected/tstypes.out
M src/test/regress/expected/uuid.out
M src/test/regress/expected/varchar.out
M src/test/regress/expected/varchar_1.out
M src/test/regress/expected/varchar_2.out
M src/test/regress/expected/xid.out
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/arrays.sql
M src/test/regress/sql/bit.sql
M src/test/regress/sql/boolean.sql
M src/test/regress/sql/box.sql
M src/test/regress/sql/char.sql
M src/test/regress/sql/date.sql
M src/test/regress/sql/domain.sql
M src/test/regress/sql/enum.sql
M src/test/regress/sql/float4.sql
M src/test/regress/sql/float8.sql
M src/test/regress/sql/geometry.sql
M src/test/regress/sql/inet.sql
M src/test/regress/sql/int2.sql
M src/test/regress/sql/int4.sql
M src/test/regress/sql/int8.sql
M src/test/regress/sql/interval.sql
M src/test/regress/sql/json.sql
M src/test/regress/sql/json_encoding.sql
M src/test/regress/sql/jsonb.sql
M src/test/regress/sql/jsonpath.sql
M src/test/regress/sql/line.sql
M src/test/regress/sql/lseg.sql
M src/test/regress/sql/macaddr.sql
M src/test/regress/sql/macaddr8.sql
M src/test/regress/sql/money.sql
M src/test/regress/sql/multirangetypes.sql
M src/test/regress/sql/numeric.sql
M src/test/regress/sql/oid.sql
M src/test/regress/sql/path.sql
M src/test/regress/sql/pg_lsn.sql
M src/test/regress/sql/point.sql
M src/test/regress/sql/polygon.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rangetypes.sql
M src/test/regress/sql/regproc.sql
M src/test/regress/sql/rowtypes.sql
M src/test/regress/sql/strings.sql
M src/test/regress/sql/tid.sql
M src/test/regress/sql/time.sql
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql
M src/test/regress/sql/timetz.sql
M src/test/regress/sql/tstypes.sql
M src/test/regress/sql/uuid.sql
M src/test/regress/sql/varchar.sql
M src/test/regress/sql/xid.sql
M src/test/regress/sql/xml.sql

Suppress compiler warnings in new pgstats code.

commit   : 728560db7d868b3ded9a8675742083ab89bcff7c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2023 17:21:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2023 17:21:31 -0500    

Click here for diff

Some clang versions whine about comparing an enum variable to  
a value outside the range of the enum, on the grounds that the  
result must be constant.  In the cases we fix here, the loops  
will terminate only if the enum variable can in fact hold a  
value one beyond its declared range.  While that's very likely  
to always be true for these enum types, it still seems like a  
poor coding practice to assume it; so use "int" loop variables  
instead to silence the warnings.  (This matches what we've done  
in other places, for example loops over the range of ForkNumber.)  
  
While at it, let's drop the XXX_FIRST macros for these enums and just  
write zeroes for the loop start values.  The apparent flexibility  
seems rather illusory given that iterating up to one-less-than-  
the-number-of-values is only correct for a zero-based range.  
  
Melanie Plageman  
  
Discussion: https://postgr.es/m/[email protected]  

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

Harden postgres_fdw tests against unexpected cache flushes.

commit   : 53fe7e6cb81b26218f8652f5f3fe4fece944f958    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2023 16:29:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Feb 2023 16:29:51 -0500    

Click here for diff

postgres_fdw will close its remote session if an sinval cache reset  
occurs, since it's possible that that means some FDW parameters  
changed.  We had two tests that were trying to ensure that the  
session remains alive by setting debug_discard_caches = 0; but  
that's not sufficient.  Even though the tests seem stable enough  
in the buildfarm, they flap a lot under CI.  
  
In the first test, which is checking the ability to recover from  
a lost connection, we can stabilize the results by just not  
caring whether pg_terminate_backend() finds a victim backend.  
If a reset did happen, there won't be a session to terminate  
anymore, but the test can proceed anyway.  (Arguably, we are  
then not testing the unintentional-disconnect case, but as long  
as that scenario is exercised in most runs I think it's fine;  
testing the reset-driven case is of value too.)  
  
In the second test, which is trying to verify the application_name  
displayed in pg_stat_activity by a remote session, we had a race  
condition in that the remote session might go away before we can  
fetch its pg_stat_activity entry.  We can close that race and make  
the test more certainly test what it intends to by arranging things  
so that the remote session itself fetches its pg_stat_activity entry  
(based on PID rather than a somewhat-circular assumption about the  
application name).  
  
Both tests now demonstrably pass under debug_discard_caches = 1,  
so we can remove that hack.  
  
Back-patch into relevant back branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Replace single-quotes with double-quotes in a few SGML attributes.

commit   : 46647cc4b86aa529f50b343a6a8cdb8f187ec8da    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Feb 2023 09:55:39 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Feb 2023 09:55:39 +0200    

Click here for diff

Both are valid SGML, but let's be consistent.  
  
Author: Peter Smith  
Discussion: https://www.postgresql.org/message-id/CAHut%2BPtghjg0SBUTv%3D4Bpcy68d1zD3VAnZ3wX1DQSp39XKD9Sw%40mail.gmail.com  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/user-manag.sgml

pg_rewind: Remove notice in docs about running CHECKPOINT after promote.

commit   : 0a0500207a94185e73373d7056a22e41de8f9d64    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Feb 2023 09:34:43 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Feb 2023 09:34:43 +0200    

Click here for diff

Commit 009eeee746 made it unnecessary. pg_rewind now works on a  
recently promoted standby.  
  
Author: Kyotaro Horiguchi, Keisuke Kuroda  
Discussion: https://www.postgresql.org/message-id/aeb5f31a-8de2-40a8-64af-ab659a309d6b%40iki.fi  

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

Update types in smgr API

commit   : b9f0e54bc955ba3f6187d238b03c9c99c576a6af    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Feb 2023 07:45:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Feb 2023 07:45:44 +0100    

Click here for diff

Change data buffer to void *, from char *, and add const where  
appropriate.  This makes it match the File API (see also  
2d4f1ba6cfc2f0a977f1c30bda9848041343e248) and stdio.  
  
Discussion: https://www.postgresql.org/message-id/flat/11dda853-bb5b-59ba-a746-e168b1ce4bdb%40enterprisedb.com  

M contrib/bloom/blinsert.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/include/storage/md.h
M src/include/storage/smgr.h

Change xl_hash_vacuum_one_page.ntuples from int to uint16.

commit   : a6cd1fc692eff708fd42c72b03f756fa1860530e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 27 Feb 2023 08:32:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 27 Feb 2023 08:32:45 +0530    

Click here for diff

This will create two bytes of padding space in xl_hash_vacuum_one_page which  
can be used for future patches. This makes the datatype of  
xl_hash_vacuum_one_page.ntuples same as gistxlogDelete.ntodelete which is  
advisable as both are used for the same purpose.  
  
Author: Bertrand Drouvot  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/hash_xlog.h
M src/include/access/xlog_internal.h

Silence more compiler warnings introduced by d87d548cd0.

commit   : ded7b7bbc3086a02296822a7a8e8bfbac9bdf5d6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Feb 2023 14:05:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Feb 2023 14:05:03 -0500    

Click here for diff

Per buildfarm, there are still a couple of functions where we  
get warnings from compilers that don't know that elog(ERROR)  
doesn't return.  

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

Don't force SQL_ASCII/no-locale for installcheck in vcregress.pl

commit   : 18f2f8b8b02cdedf89a943498262cf23a3eb7f61    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 26 Feb 2023 06:48:41 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 26 Feb 2023 06:48:41 -0500    

Click here for diff

It's been this way for a very long time, but it appears to have been  
masking an issue that only manifests with different settings. Therefore,  
run the tests in the installation's default encoding/locale.  
  
Backpatch to all live branches.  

M src/tools/msvc/vcregress.pl

Doc: Miscellaneous doc updates for MERGE.

commit   : ee7e8f3838733f09a67e1421f0d7c6498cd68ab0    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 26 Feb 2023 09:06:04 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 26 Feb 2023 09:06:04 +0000    

Click here for diff

Update a few places in the documentation that should mention MERGE  
among the list of applicable commands. In a couple of places, a  
slightly more detailed description of what happens for MERGE seems  
appropriate.  
  
Reviewed by Alvaro Herrera.  
  
Discussion: http://postgr.es/m/CAEZATCWqHLcxab89ATMQZNGFG_mxDPM%2BjzkSbXKD3JYPfRGvtw%40mail.gmail.com  

M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/set_transaction.sgml
M doc/src/sgml/xfunc.sgml

commit   : 87f3667ec079c4acc2c87be51bf41e54d0b6f698    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Feb 2023 14:44:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Feb 2023 14:44:14 -0500    

Click here for diff

We already tried to fix this in commits 3f7323cbb et al (and follow-on  
fixes), but now it emerges that there are still unfixed cases;  
moreover, these cases affect all branches not only pre-v14.  I thought  
we had eliminated all cases of making multiple clones of an UPDATE's  
target list when we nuked inheritance_planner.  But it turns out we  
still do that in some partitioned-UPDATE cases, notably including  
INSERT ... ON CONFLICT UPDATE, because ExecInitPartitionInfo thinks  
it's okay to clone and modify the parent's targetlist.  
  
This fix is based on a suggestion from Andres Freund: let's stop  
abusing the ParamExecData.execPlan mechanism, which was only ever  
meant to handle initplans, and instead solve the execution timing  
problem by having the expression compiler move MULTIEXPR_SUBLINK steps  
to the front of their expression step lists.  This is feasible because  
(a) all branches still in support compile the entire targetlist of  
an UPDATE into a single ExprState, and (b) we know that all  
MULTIEXPR_SUBLINKs do need to be evaluated --- none could be buried  
inside a CASE, for example.  There is a minor semantics change  
concerning the order of execution of the MULTIEXPR's subquery versus  
other parts of the parent targetlist, but that seems like something  
we can get away with.  By doing that, we no longer need to worry  
about whether different clones of a MULTIEXPR_SUBLINK share output  
Params; their usage of that data structure won't overlap.  
  
Per bug #17800 from Alexander Lakhin.  Back-patch to all supported  
branches.  In v13 and earlier, we can revert 3f7323cbb and follow-on  
fixes; however, I chose to keep the SubPlan.subLinkId field added  
in ccbb54c72.  We don't need that anymore in the core code, but it's  
cheap enough to fill, and removing a plan node field in a minor  
release seems like it'd be asking for trouble.  
  
Andres Freund and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/nodeSubplan.c
M src/include/nodes/primnodes.h
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Fix mishandling of OLD/NEW references in subqueries in rule actions.

commit   : a7d71c41dbd691ac86cc47114dab9db4b31f27ad    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 25 Feb 2023 14:41:12 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 25 Feb 2023 14:41:12 +0000    

Click here for diff

If a rule action contains a subquery that refers to columns from OLD  
or NEW, then those are really lateral references, and the planner will  
complain if it sees such things in a subquery that isn't marked as  
lateral. However, at rule-definition time, the user isn't required to  
mark the subquery with LATERAL, and so it can fail when the rule is  
used.  
  
Fix this by marking such subqueries as lateral in the rewriter, at the  
point where they're used.  
  
Dean Rasheed and Tom Lane, per report from Alexander Lakhin.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/5e09da43-aaba-7ea7-0a51-a2eb981b058b%40gmail.com  

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

Silence compiler warnings introduced by d87d548cd0.

commit   : 05fc551796e82c451a6f2bc39d1eafb3be3d2657    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 24 Feb 2023 09:11:35 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 24 Feb 2023 09:11:35 -0800    

Click here for diff

Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

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

Fix comment indentation and whitespace

commit   : 62d56f6720cd9483ede8a410a1a2cd6a0202c091    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Feb 2023 14:29:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Feb 2023 14:29:18 +0100    

Click here for diff

The previous layout satisfied pgindent but failed the git whitespace  
check.  Fix by not putting the comment first in the line, which  
pgindent does not handle well.  
  
Discussion: https://www.postgresql.org/message-id/flat/480e3c67-b703-46ff-a418-d3b481d68372%40enterprisedb.com  

M contrib/postgres_fdw/connection.c

Disallow NULLS NOT DISTINCT indexes for primary keys

commit   : d9595232579a3a9fadf4ce0b4cd58c1a3fc3b2f7    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 24 Feb 2023 11:09:50 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 24 Feb 2023 11:09:50 +0100    

Click here for diff

A unique index which is created with non-distinct NULLS cannot be  
used for backing a primary key constraint.  Make sure to disallow  
such table alterations and teach pg_dump to drop the non-distinct  
NULLS clause on indexes where this has been set.  
  
Bug: 17720  
Reported-by: Reiner Peterke <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

pg_dump: Remove move "blob" terminology

commit   : 94851e4b905042de559d073b6590039ab4598c7c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 24 Feb 2023 08:49:28 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 24 Feb 2023 08:49:28 +0100    

Click here for diff

Commit e9960732a9618 accidentally introduced the blob terminology in  
error messages which had previously been altered by commit 35ce24c33  
from "blob" to "LO". This reverts back to "LO".  
  
Reported-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://www.postgresql.org/message-id/flat/868a381f-4650-9460-1726-1ffd39a270b4%40enterprisedb.com  

M src/bin/pg_dump/pg_backup_directory.c

Fix incorrect format placeholders

commit   : 318b1c0cc1660c51c06a716de5d36367afa2499e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Feb 2023 08:02:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Feb 2023 08:02:48 +0100    

Click here for diff

M src/backend/statistics/dependencies.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c

meson: windows: Fix tmp_install + prefix computation with meson 1.0.1

commit   : 4fc53819a45fe6e7233a69bb279557b2070dcc40    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Feb 2023 19:34:25 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Feb 2023 19:34:25 -0800    

Click here for diff

In d0366bfb3b21 I said:  
    Instead of trying to do this in meson.build, call out to the implementation  
    meson install uses. This isn't pretty, but it's more reliable than what we had  
    before.  
  
Unfortunately it was too ugly - to fix a bug, meson 1.0.1 changed the way the  
meson internal runpython helper works, resulting in the previous sys.argv[]  
indices not working anymore.  Just open-code it - it's just a few characters  
longer.  
  
Committing this quickly to allow ci/cfbot to work with meson 1.0.1 on windows.  

M meson.build

Don't repeatedly register cache callbacks in pgoutput plugin.

commit   : 05172f1f37496acc13769b8cc0af6e77591be90f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2023 15:40:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2023 15:40:27 -0500    

Click here for diff

Multiple cycles of starting up and shutting down the plugin within a  
single session would eventually lead to "out of relcache_callback_list  
slots", because pgoutput_startup blindly re-registered its cache  
callbacks each time.  Fix it to register them only once, as all other  
users of cache callbacks already take care to do.  
  
This has been broken all along, so back-patch to all supported branches.  
  
Shi Yu  
  
Discussion: https://postgr.es/m/OSZPR01MB631004A78D743D68921FFAD3FDA79@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/pgoutput/pgoutput.c

Add LZ4 compression to pg_dump

commit   : 0da243fed0875932f781aff08df782b56af58d02    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 23 Feb 2023 21:19:19 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 23 Feb 2023 21:19:19 +0100    

Click here for diff

Expand pg_dump's compression streaming and file APIs to support the lz4  
algorithm. The newly added compress_lz4.{c,h} files cover all the  
functionality of the aforementioned APIs. Minor changes were necessary  
in various pg_backup_* files, where code for the 'lz4' file suffix has  
been added, as well as pg_dump's compression option parsing.  
  
Author: Georgios Kokolatos  
Reviewed-by: Michael Paquier, Rachel Heaton, Justin Pryzby, Shi Yu, Tomas Vondra  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss%3D%40protonmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/compress_io.c
A src/bin/pg_dump/compress_lz4.c
A src/bin/pg_dump/compress_lz4.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/tools/pginclude/cpluspluscheck
M src/tools/pgindent/typedefs.list

Remove unnecessary #ifdef USE_ICU and branch.

commit   : e0b3074e894496b41b57fd1c96ede68803cf3df8    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 23 Feb 2023 11:20:00 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 23 Feb 2023 11:20:00 -0800    

Click here for diff

Now that the provider-independent API pg_strnxfrm() is available, we  
no longer need the special cases for ICU in hashfunc.c and varchar.c.  
  
Reviewed-by: Peter Eisentraut, Peter Geoghegan  
Discussion: https://postgr.es/m/a581136455c940d7bd0ff482d3a2bd51af25a94f.camel%40j-davis.com  

M src/backend/access/hash/hashfunc.c
M src/backend/utils/adt/varchar.c

Refactor to introduce pg_locale_deterministic().

commit   : 6974a8f7682beeb515b78b34a5253d5f96552f58    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 23 Feb 2023 11:17:41 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 23 Feb 2023 11:17:41 -0800    

Click here for diff

Avoids the need of callers to test for NULL, and also avoids the need  
to access the pg_locale_t structure directly.  
  
Reviewed-by: Peter Eisentraut, Peter Geoghegan  
Discussion: https://postgr.es/m/a581136455c940d7bd0ff482d3a2bd51af25a94f.camel%40j-davis.com  

M src/backend/access/hash/hashfunc.c
M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/include/utils/pg_locale.h

Refactor to add pg_strcoll(), pg_strxfrm(), and variants.

commit   : d87d548cd0304477413a73e9c1d148fb2d40b50d    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 23 Feb 2023 10:55:20 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 23 Feb 2023 10:55:20 -0800    

Click here for diff

Offers a generally better separation of responsibilities for collation  
code. Also, a step towards multi-lib ICU, which should be based on a  
clean separation of the routines required for collation providers.  
  
Callers with NUL-terminated strings should call pg_strcoll() or  
pg_strxfrm(); callers with strings and their length should call the  
variants pg_strncoll() or pg_strnxfrm().  
  
Reviewed-by: Peter Eisentraut, Peter Geoghegan  
Discussion: https://postgr.es/m/a581136455c940d7bd0ff482d3a2bd51af25a94f.camel%40j-davis.com  

M src/backend/access/hash/hashfunc.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/include/utils/pg_locale.h

Introduce a generic pg_dump compression API

commit   : e9960732a9618d5f744ff43a09622c9185798760    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 23 Feb 2023 18:33:30 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 23 Feb 2023 18:33:30 +0100    

Click here for diff

Switch pg_dump to use the Compression API, implemented by bf9aa490db.  
  
The CompressFileHandle replaces the cfp* family of functions with a  
struct of callbacks for accessing (compressed) files. This allows adding  
new compression methods simply by introducing a new struct instance with  
appropriate implementation of the callbacks.  
  
Archives compressed using custom compression methods store an identifier  
of the compression algorithm in their header instead of the compression  
level. The header version is bumped.  
  
Author: Georgios Kokolatos  
Reviewed-by: Michael Paquier, Rachel Heaton, Justin Pryzby, Tomas Vondra  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss%3D%40protonmail.com  

M src/bin/pg_dump/Makefile
A src/bin/pg_dump/compress_gzip.c
A src/bin/pg_dump/compress_gzip.h
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
A src/bin/pg_dump/compress_none.c
A src/bin/pg_dump/compress_none.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/common/compression.h
M src/tools/pginclude/cpluspluscheck
M src/tools/pgindent/typedefs.list

Fix mis-handling of outer join quals generated by EquivalenceClasses.

commit   : 739f1d6218f5ce1e0243127ab23f431a7d07977c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2023 11:05:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Feb 2023 11:05:58 -0500    

Click here for diff

It's possible, in admittedly-rather-contrived cases, for an eclass  
to generate a derived "join" qual that constrains the post-outer-join  
value(s) of some RHS variable(s) without mentioning the LHS at all.  
While the mechanisms were set up to work for this, we fell foul of  
the "get_common_eclass_indexes" filter installed by commit 3373c7155:  
it could decide that such an eclass wasn't relevant to the join, so  
that the required qual clause wouldn't get emitted there or anywhere  
else.  
  
To fix, apply get_common_eclass_indexes only at inner joins, where  
its rule is still valid.  At an outer join, fall back to examining all  
eclasses that mention either input (or the OJ relid, though it should  
be impossible for an eclass to mention that without mentioning either  
input).  Perhaps we can improve on that later, but the cost/benefit of  
adding more complexity to skip some irrelevant eclasses is dubious.  
  
To allow cheaply distinguishing outer from inner joins, pass the  
ojrelid to generate_join_implied_equalities as a separate argument.  
This also allows cleaning up some sloppiness that had crept into  
the definition of its join_relids argument, and it allows accurate  
calculation of nominal_join_relids for a child outer join.  (The  
latter oversight seems not to have been a live bug, but it certainly  
could have caused problems in future.)  
  
Also fix what might be a live bug in check_index_predicates: it was  
being sloppy about what it passed to generate_join_implied_equalities.  
  
Per report from Richard Guo.  
  
Discussion: https://postgr.es/m/CAMbWs4-DsTBfOvXuw64GdFss2=M5cwtEhY=0DCS7t2gT7P6hSA@mail.gmail.com  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/paths.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Prepare pg_dump internals for additional compression methods

commit   : 03d02f54a64089284582cc60d94a8af09ff4e081    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 23 Feb 2023 15:38:14 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 23 Feb 2023 15:38:14 +0100    

Click here for diff

Commit bf9aa490db introduced a compression API in compress_io.{c,h} to  
make reuse easier, and allow adding more compression algorithms.  
However, pg_backup_archiver.c was not switched to this API and continued  
to call the compression directly.  
  
This commit teaches pg_backup_archiver.c about the compression API, so  
that it can benefit from bf9aa490db (simpler code, easier addition of  
new compression methods).  
  
Author: Georgios Kokolatos  
Reviewed-by: Michael Paquier, Rachel Heaton, Justin Pryzby, Tomas Vondra  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss%3D%40protonmail.com  

M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h

pg_rewind: Fix determining TLI when server was just promoted.

commit   : 009eeee746825090ec7194321a3db4b298d6571e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Feb 2023 15:22:53 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 23 Feb 2023 15:22:53 +0200    

Click here for diff

If the source server was just promoted, and it hasn't written the  
checkpoint record yet, pg_rewind considered the server to be still on  
the old timeline. Because of that, it would claim incorrectly that no  
rewind is required. Fix that by looking at minRecoveryPointTLI in the  
control file in addition to the ThisTimeLineID on the checkpoint.  
  
This has been a known issue since forever, and we had worked around it  
in the regression tests by issuing a checkpoint after each promotion,  
before running pg_rewind. But that was always quite hacky, so better  
to fix this properly. This doesn't add any new tests for this, but  
removes the previously-added workarounds from the existing tests, so  
that they should occasionally hit this codepath again.  
  
This is arguably a bug fix, but don't backpatch because we haven't  
really treated it as a bug so far. Also, the patch didn't apply  
cleanly to v13 and below. I'm sure sure it could be made to work on  
v13, but doesn't seem worth the risk and effort.  
  
Reviewed-by: Kyotaro Horiguchi, Ibrar Ahmed, Aleksander Alekseev  
Discussion: https://www.postgresql.org/message-id/9f568c97-87fe-a716-bd39-65299b8a60f4%40iki.fi  

M src/bin/pg_rewind/pg_rewind.c
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/RewindTest.pm

Fix multi-row DEFAULT handling for INSERT ... SELECT rules.

commit   : 75c737636b8a1e9a110e580f1caee181023447e2    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 23 Feb 2023 10:53:01 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 23 Feb 2023 10:53:01 +0000    

Click here for diff

Given an updatable view with a DO ALSO INSERT ... SELECT rule, a  
multi-row INSERT ... VALUES query on the view fails if the VALUES list  
contains any DEFAULTs that are not replaced by view defaults. This  
manifests as an "unrecognized node type" error, or an Assert failure,  
in an assert-enabled build.  
  
The reason is that when RewriteQuery() attempts to replace the  
remaining DEFAULT items with NULLs in any product queries, using  
rewriteValuesRTEToNulls(), it assumes that the VALUES RTE is located  
at the same rangetable index in each product query. However, if the  
product query is an INSERT ... SELECT, then the VALUES RTE is actually  
in the SELECT part of that query (at the same index), rather than the  
top-level product query itself.  
  
Fix, by descending to the SELECT in such cases. Note that we can't  
simply use getInsertSelectQuery() for this, since that expects to be  
given a raw rule action with OLD and NEW placeholder entries, so we  
duplicate its logic instead.  
  
While at it, beef up the checks in getInsertSelectQuery() by checking  
that the jointree->fromlist node is indeed a RangeTblRef, and that the  
RTE it points to has rtekind == RTE_SUBQUERY.  
  
Per bug #17803, from Alexander Lakhin. Back-patch to all supported  
branches.  
  
Dean Rasheed, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/17803-53c63ed4ecb4eac6%40postgresql.org  

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

Consider a failed process as a failed test in pg_regress

commit   : 337903a16fb0980950a98a17c388b28da8642446    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 23 Feb 2023 09:25:47 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 23 Feb 2023 09:25:47 +0100    

Click here for diff

Commit 55de145d1cf added reporting of child process failures, but the  
test suite is still allowed to pass even if the process failed. Since  
regress tests are higher level tests, a false positive is more likely  
in this case so report failed test processes as failed tests.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Add static assertion ensuring sizeof(ExprEvalStep) <= 64 bytes

commit   : 78be04e4c672a3ffb9c92dbb172dbd16edce8941    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 22 Feb 2023 14:27:56 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 22 Feb 2023 14:27:56 -0800    

Click here for diff

This was previously only documented in a comment. Given the size of the  
struct, it's not hard to miss that comment. As evidenced by the commits  
leading up to fe3caa14393, 67b26703b41.  
  
It's possible, but not likely, that we might have to weaken these assertions  
on a less commonly used architecture.  
  
Author: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/include/executor/execExpr.h

Check for unbounded authentication exchanges in libpq.

commit   : 5e044471a1aa8714d4fc59ea0d599009aaa05278    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 22 Feb 2023 21:27:38 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 22 Feb 2023 21:27:38 +0200    

Click here for diff

A couple of code paths in CONNECTION_AWAITING_RESPONSE will eagerly read  
bytes off a connection that should be closed. Don't let a misbehaving  
server chew up client resources here; a v2 error can't be infinitely  
long, and a v3 error should be bounded by its original message length.  
  
For the existing error_return cases, I added some additional error  
messages for symmetry with the new ones, and cleaned up some message  
rot.  
  
Author: Jacob Champion  
Discussion: https://www.postgresql.org/message-id/8e729daf-7d71-6965-9687-8bc0630599b3%40timescale.com  

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

Fix some issues with wrong placement of pseudo-constant quals.

commit   : a75ff55c83342656266deb1890bcdd27466333ea    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Feb 2023 12:39:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Feb 2023 12:39:07 -0500    

Click here for diff

initsplan.c figured that it could push Var-free qual clauses to  
the top of the current JoinDomain, which is okay in the abstract.  
But if the current domain is inside some outer join, and we later  
commute an inside-the-domain outer join with one outside it,  
we end up placing the pushed-up qual clause incorrectly.  
  
In distribute_qual_to_rels, avoid this by using the syntactic scope  
of the qual clause; with the exception that if we're in the top-level  
join domain we can still use the full query relid set, ensuring the  
resulting gating Result node goes to the top of the plan.  (This is  
approximately as smart as the pre-v16 code was.  Perhaps we can do  
better later, but it's not clear that such cases are worth a lot of  
sweat.)  
  
In process_implied_equality, we don't have a clear notion of syntactic  
scope, but we do have the results of SpecialJoinInfo construction.  
Thumb through those and remove any lower outer joins that might get  
commuted to above the join domain.  Again, we can make an exception  
for the top-level join domain.  It'd be possible to work harder here  
(for example, by keeping outer joins that aren't shown as potentially  
commutable), but I'm going to stop here for the moment.  This issue  
has convinced me that the current representation of join domains  
probably needs further refinement, so I'm disinclined to write  
inessential dependent logic just yet.  
  
In passing, tighten the qualscope passed to process_implied_equality  
by generate_base_implied_equalities_no_const; there's no need for  
it to be larger than the rel we are currently considering.  
  
Tom Lane and Richard Guo, per report from Tender Wang.  
  
Discussion: https://postgr.es/m/CAHewXNk9eJ35ru5xATWioTV4+xZPHptjy9etdcNPjUfY9RQ+uQ@mail.gmail.com  

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

Fix snapshot handling in logicalmsg_decode

commit   : 7fe1aa991b622feaabfac5ed9c918fe8a1d598c9    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 22 Feb 2023 15:24:09 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 22 Feb 2023 15:24:09 +0100    

Click here for diff

Whe decoding a transactional logical message, logicalmsg_decode called  
SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot  
yet at that point. We don't actually need the snapshot in this case  
(during replay we'll have the snapshot from the transaction), so in  
practice this is harmless. But in assert-enabled build this crashes.  
  
Fixed by requesting the snapshot only in non-transactional case, where  
we are guaranteed to have SNAPBUILD_CONSISTENT.  
  
Backpatch to 11. The issue exists since 9.6.  
  
Backpatch-through: 11  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Add missing support for the latest SPI status codes.

commit   : d0460a31de6acc8bbb86e9e3d646f1113ebb0c20    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 22 Feb 2023 13:23:09 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 22 Feb 2023 13:23:09 +0000    

Click here for diff

SPI_result_code_string() was missing support for SPI_OK_TD_REGISTER,  
and in v15 and later, it was missing support for SPI_OK_MERGE, as was  
pltcl_process_SPI_result().  
  
The last of those would trigger an error if a MERGE was executed from  
PL/Tcl. The others seem fairly innocuous, but worth fixing.  
  
Back-patch to all supported branches. Before v15, this is just adding  
SPI_OK_TD_REGISTER to SPI_result_code_string(), which is unlikely to  
be seen by anyone, but seems worth doing for completeness.  
  
Reviewed by Tom Lane.  
  
Discussion:  
  https://postgr.es/m/CAEZATCUg8V%2BK%2BGcafOPqymxk84Y_prXgfe64PDoopjLFH6Z0Aw%40mail.gmail.com  
  https://postgr.es/m/CAEZATCUMe%2B_KedPMM9AxKqm%3DSZogSxjUcrMe%2BsakusZh3BFcQw%40mail.gmail.com  

M doc/src/sgml/spi.sgml
M src/backend/executor/spi.c
M src/pl/tcl/pltcl.c

Fix Assert failure for MERGE into a partitioned table with RLS.

commit   : 0d3b49d4af7509032c847bfc956aac98d30644bf    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 22 Feb 2023 10:51:34 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 22 Feb 2023 10:51:34 +0000    

Click here for diff

In ExecInitPartitionInfo(), the Assert when building the WITH CHECK  
OPTION list for the new partition assumed that the command would be an  
INSERT or UPDATE, but it can also be a MERGE. This can be triggered by  
a MERGE into a partitioned table with RLS checks to enforce.  
  
Fix, and back-patch to v15, where MERGE was introduced.  
  
Discussion: https://postgr.es/m/CAEZATCWWFtQmW67F3XTyMU5Am10Oxa_b8oe0x%2BNu5Mo%2BCdRErg%40mail.gmail.com  

M src/backend/executor/execPartition.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

Remove newly added asserts from pg_bitutils.h

commit   : 83a611a259d41e305364b8de58f6b33a63cbda66    
  
author   : John Naylor <[email protected]>    
date     : Wed, 22 Feb 2023 17:22:43 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 22 Feb 2023 17:22:43 +0700    

Click here for diff

These were valuable during development, but are unlikely to tell us  
anything going forward. This reverts 204b0cbec and adjusts the content  
of 677319746 to more closely match the more-readable original style.  
  
Per review from Tom Lane  
  
Discussion: https://www.postgresql.org/message-id/3567481.1676906261%40sss.pgh.pa.us  

M src/include/port/pg_bitutils.h

doc: Add default value of createrole_self_grant

commit   : e00bc6c92277bdfb9dc6b56df067b22f549e43b8    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 22 Feb 2023 11:05:20 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 22 Feb 2023 11:05:20 +0100    

Click here for diff

Document that the default value for createrole_self_grant is an empty  
string which in turn disable the feature.  
  
Author: Shi Yu <[email protected]>  
Discussion: https://postgr.es/m/OSZPR01MB63105D0D96A9A72A7FCD4FFEFDA09@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M doc/src/sgml/config.sgml

Fix MERGE command tag for cross-partition updates.

commit   : 80a48e0f21c51ed65fe647b18019ab6f8eab15cd    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 22 Feb 2023 09:39:09 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 22 Feb 2023 09:39:09 +0000    

Click here for diff

This ensures that the row count in the command tag for a MERGE is  
correctly computed. Previously, if MERGE updated a partitioned table,  
the row count would be incorrect if any row was moved to a different  
partition, since such updates were counted twice.  
  
Back-patch to v15, where MERGE was introduced.  
  
Discussion: https://postgr.es/m/CAEZATCWRMG7XX2QEsVL1LswmNo2d_YG8tKTLkpD3=Lp644S7rg@mail.gmail.com  

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

Implement ANY_VALUE aggregate

commit   : 2ddab010c2777c6a965cea82dc1b809ddc33ecc1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Feb 2023 09:32:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Feb 2023 09:32:12 +0100    

Click here for diff

SQL:2023 defines an ANY_VALUE aggregate whose purpose is to emit an  
implementation-dependent (i.e. non-deterministic) value from the  
aggregated rows.  
  
Author: Vik Fearing <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: David Rowley <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/utils/adt/misc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

gitattributes: Ignore imported pg_bsd_indent code for whitespace checks

commit   : 7e5ddf7e4d1ee36233371661c5e96007c8d7c665    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Feb 2023 09:00:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Feb 2023 09:00:28 +0100    

Click here for diff

M .gitattributes

pg_dump: Remove some dead code

commit   : f198f0a48cdcfa47f4291639e054ccf9035d8e49    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Feb 2023 08:21:16 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Feb 2023 08:21:16 +0100    

Click here for diff

Client-side tracking of atttypmod has been unused since 64f3524, when  
server-side format_type() started being used exclusively.  So remove  
this dead code.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/144be239-c893-9361-704f-ac85b5b98d1a%40enterprisedb.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Fix small memory leak in psql's \bind command

commit   : 8bf5af2ee6ea82a79817692de94347086da96b43    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Feb 2023 14:22:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Feb 2023 14:22:13 +0900    

Click here for diff

psql_scan_slash_option() returns a malloc()'d result through a  
PQExpBuffer, and exec_command_bind() was doing an extra allocation of  
this option for no effect.  
  
Introduced in 5b66de3.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Corey Huinker  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

doc: Add missing values for meson options -Dcassert and -Db_coverage

commit   : 1a943d03d60e6a45036c77ca31d02ebd6e3ee169    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Feb 2023 10:55:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Feb 2023 10:55:14 +0900    

Click here for diff

The -Dcassert and -Db_coverage that can be specified to a meson command  
require values after an equal sign but the documentation did not  
properly reflect that.  All the other options specify the argument  
values they expect, so close the gap.  
  
Author: Jelte Fennema  
Discussion: https://postgr.es/m/CAGECzQRXd1z+AoQ4tC5tqPk1_NQJohf6xwdEL=z9KgxHau2maQ@mail.gmail.com  

M doc/src/sgml/installation.sgml

Fix corruption of templates after CREATE DATABASE .. STRATEGY WAL_LOG

commit   : 8a8661828ae14e4d3b6beac5e8d8b37bd4e79004    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Feb 2023 10:14:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Feb 2023 10:14:52 +0900    

Click here for diff

WAL_LOG does a scan of the template's pg_class to determine the set of  
relations that need to be copied from a template database to the new  
one.  However, as coded in 9c08aea, this copy strategy would load the  
pages of pg_class without considering it as a permanent relation,  
causing the loaded pages to never be flushed when they should.  Any  
modification of the template's pg_class, mostly through DDLs, would then  
be missed, causing corruptions.  
  
STRATEGY = WAL_LOG is the default over FILE_COPY since it has been  
introduced, so any changes done to pg_class on a database template would  
be gone.  Updates of database templates should be a rare thing, so the  
impact of this bug should be hopefully limited.  The pre-14 default  
strategy FILE_COPY is safe, and can be used as a workaround.  
  
Ryo Matsumura has found and analyzed the issue, and Nathan has written a  
test able to reproduce the failure (with few tweaks from me).  
  
Backpatch down to 15, where STRATEGY = WAL_LOG has been introduced.  
  
Author: Nathan Bossart, Ryo Matsumura  
Reviewed-by: Dilip Kumar, Michael Paquier  
Discussion: https://postgr.es/m/TYCPR01MB6868677E499C9AD5123084B5E8A39@TYCPR01MB6868.jpnprd01.prod.outlook.com  
Backpatch-through: 15  

M src/backend/commands/dbcommands.c
M src/test/recovery/meson.build
A src/test/recovery/t/034_create_database.pl

Fix erroneous Valgrind markings in AllocSetRealloc.

commit   : b3e184a5d4fdbc43d2cb99865ea2e073c09b9584    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2023 18:47:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Feb 2023 18:47:46 -0500    

Click here for diff

If asked to decrease the size of a large (>8K) palloc chunk,  
AllocSetRealloc could improperly change the Valgrind state of memory  
beyond the new end of the chunk: it would mark data UNDEFINED as far  
as the old end of the chunk after having done the realloc(3) call,  
thus tromping on the state of memory that no longer belongs to it.  
One would normally expect that memory to now be marked NOACCESS,  
so that this mislabeling might prevent detection of later errors.  
If realloc() had chosen to move the chunk someplace else (unlikely,  
but well within its rights) we could also mismark perfectly-valid  
DEFINED data as UNDEFINED, causing false-positive valgrind reports  
later.  Also, any malloc bookkeeping data placed within this area  
might now be wrongly marked, causing additional problems.  
  
Fix by replacing relevant uses of "oldsize" with "Min(size, oldsize)".  
It's sufficient to mark as far as "size" when that's smaller, because  
whatever remains in the new chunk size will be marked NOACCESS below,  
and we expect realloc() to have taken care of marking the memory  
beyond the new official end of the chunk.  
  
While we're here, also rename the function's "oldsize" variable  
to "oldchksize" to more clearly explain what it actually holds,  
namely the distance to the end of the chunk (that is, requested size  
plus trailing padding).  This is more consistent with the use of  
"size" and "chksize" to hold the new requested size and chunk size.  
Add a new variable "oldsize" in the one stanza where we're actually  
talking about the old requested size.  
  
Oversight in commit c477f3e44.  Back-patch to all supported branches,  
as that was, just in case anybody wants to do valgrind testing on back  
branches.  
  
Karina Litskevich  
  
Discussion: https://postgr.es/m/CACiT8iaAET-fmzjjZLjaJC4zwSJmrFyL7LAdHwaYyjjQOQ4hcg@mail.gmail.com  

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

Remove obsolete coding for early macOS.

commit   : a1f45f69bbfc4b44c8adb708e4a4f6db65a67a64    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 22 Feb 2023 09:53:15 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 22 Feb 2023 09:53:15 +1300    

Click here for diff

Commits 04cad8f7 and 0c088568 supported old macOS systems that didn't  
define O_CLOEXEC or O_DSYNC yet, but those arrived in macOS releases  
10.7 and 10.6 (respectively), which themselves reached EOL around a  
decade ago.  We've already made use of other POSIX features that early  
macOS vintages can't compile (for example commits 623cc673, d2e15083).  
  
A later commit will use O_CLOEXEC on POSIX systems so it would be  
strange to pretend here that it's optional, and we might as well give  
O_DSYNC the same treatment since the reference is also guarded by a test  
for a macOS-specific macro, and we know that current Macs have it.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKb6FsAdQWcRL35KJsftv%2B9zXqQbzwkfRf1i0J2e57%2BhQ%40mail.gmail.com  

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

Fix handling of escape sequences in postgres_fdw.application_name

commit   : 8427ce4c379ee3774b8a9aca13ca7f4bfb76ba85    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Feb 2023 20:01:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Feb 2023 20:01:43 +0900    

Click here for diff

postgres_fdw.application_name relies on MyProcPort to define the data  
that should be added to escape sequences %u (user name) or %d (database  
name).  However this code could be run in processes that lack a  
MyProcPort, like an autovacuum process, causing crashes.  
  
The code generating the application name is made more flexible with this  
commit, so as it now generates no data for %u and %d if MyProcPort is  
missing, and a simple "unknown" if MyProcPort exists, but the expected  
fields are not set.  
  
Reported-by: Alexander Lakhin  
Author: Kyotaro Horiguchi, Michael Paquier  
Reviewed-by: Hayato Kuroda, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M contrib/postgres_fdw/option.c

pgbench: Prepare commands in pipelines in advance

commit   : 038f586d5f1d90c6ed58544a068696bb81a4e12e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Feb 2023 10:56:37 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Feb 2023 10:56:37 +0100    

Click here for diff

Failing to do so results in an error when a pgbench script tries to  
start a serializable transaction inside a pipeline, because by the time  
BEGIN ISOLATION LEVEL SERIALIZABLE is executed, we're already in a  
transaction that has acquired a snapshot, so the server rightfully  
complains.  
  
We can work around that by preparing all commands in the pipeline before  
actually starting the pipeline.  This changes the existing code in two  
aspects: first, we now prepare each command individually at the point  
where that command is about to be executed; previously, we would prepare  
all commands in a script as soon as the first command of that script  
would be executed.  It's hard to see that this would make much of a  
difference (particularly since it only affects the first time to execute  
each script in a client), but I didn't actually try to measure it.  
  
Secondly, we no longer use PQsendPrepare() in pipeline mode, but only  
PQprepare.  There's no specific reason for this change other than no  
longer needing to do differently in pipeline mode.  (Previously we had  
no choice, because in pipeline mode PQprepare could not be used.)  
  
Backpatch to 14, where pgbench got support for pipeline mode.  
  
Reported-by: Yugo NAGATA <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Detect overflow in timestamp[tz] subtraction.

commit   : 8028e294b456bf1539649527fd98b3985fa4752a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2023 17:26:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2023 17:26:25 -0500    

Click here for diff

It's possible to overflow the int64 microseconds field of the  
output interval when subtracting two timestamps.  Detect that  
instead of silently returning a bogus result.  
  
Nick Babadzhanian  
  
Discussion: https://postgr.es/m/CABw73Uq2oJ3E+kYvvDuY04EkhhkChim2e-PaghBDjOmgUAMWGw@mail.gmail.com  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Fix parsing of ISO-8601 interval fields with exponential notation.

commit   : f0d0394e84ceeda6f22eb3fdb89bd8adbfc13985    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2023 16:55:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2023 16:55:59 -0500    

Click here for diff

Historically we've accepted interval input like 'P.1e10D'.  This  
is probably an accident of having used strtod() to do the parsing,  
rather than something anyone intended, but it's been that way for  
a long time.  Commit e39f99046 broke this by trying to parse the  
integer and fractional parts separately, without accounting for  
the possibility of an exponent.  In principle that coding allowed  
for precise conversions of field values wider than 15 decimal  
digits, but that does not seem like a goal worth sweating bullets  
for.  So, rather than trying to manage an exponent on top of the  
existing complexity, let's just revert to the previous coding that  
used strtod() by itself.  We can still improve on the old code to  
the extent of allowing the value to range up to 1.0e15 rather than  
only INT_MAX.  (Allowing more than that risks creating problems  
due to precision loss: the converted fractional part might have  
absolute value more than 1.  Perhaps that could be dealt with in  
some way, but it really does not seem worth additional effort.)  
  
Per bug #17795 from Alexander Lakhin.  Back-patch to v15 where  
the faulty code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/datetime.c
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Prevent join removal from removing the query's result relation.

commit   : f6db76c55509a60cc8c22ced56ff9322ee6f1742    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2023 15:18:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2023 15:18:22 -0500    

Click here for diff

This was not something that required consideration before MERGE  
was invented; but MERGE builds a join tree that left-joins to the  
result relation, meaning that remove_useless_joins will consider  
removing it.  That should generally be stopped by the query's use  
of output variables from the result relation.  However, if the  
result relation is inherited (e.g. a partitioned table) then  
we don't add any row identity variables to the query until  
expand_inherited_rtentry, which happens after join removal.  
  
This was exposed as of commit 3c569049b, which made it possible  
to deduce that a partitioned table could contain at most one row  
matching a join key, enabling removal of the not-yet-expanded  
result relation.  Ooops.  
  
To fix, let's just teach join_is_removable that the query result  
rel is never removable.  It's a cheap enough test in any case,  
and it'll save some cycles that we'd otherwise expend in proving  
that it's not removable, even in the cases we got right.  
  
Back-patch to v15 where MERGE was added.  Although I think the  
case cannot be reached in v15, this seems like cheap insurance.  
  
Per investigation of a report from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Limit memory usage of pg_walinspect functions.

commit   : 69e8c7cf1dfa08ae099c33d0d371ad69d405903d    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 20 Feb 2023 10:29:53 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 20 Feb 2023 10:29:53 -0800    

Click here for diff

GetWALRecordsInfo() and pg_get_wal_fpi_info() can leak memory across  
WAL record iterations. Fix this by using a temporary memory context  
that's reset for each WAL record iteraion.  
  
Also a use temporary context for loops in GetXLogSummaryStats(). The  
number of iterations is a small constant, so the previous behavior was  
not a leak, but fix for clarity (but no need to backport).  
  
Backport GetWALRecordsInfo() change to version  
15. pg_get_wal_fpi_info() didn't exist in version 15.  
  
Reported-by: Peter Geoghegan  
Author: Bharath Rupireddy  
Discussion: https://www.postgresql.org/message-id/CAH2-WznLEJjn7ghmKOABOEZYuJvkTk%3DGKU3m0%2B-XBAH%2BerPiJQ%40mail.gmail.com  
Backpatch-through: 15  

M contrib/pg_walinspect/pg_walinspect.c

Remove gratuitous assumptions about what make_modifytable can see.

commit   : c6c3b3bc3de1be016de646403b923c1c8a2521cb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2023 12:06:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Feb 2023 12:06:30 -0500    

Click here for diff

For no clearly good reason, make_modifytable assumed that it  
could not reach its get-the-FDW-info-the-hard-way path in MERGE.  
It's currently possible to demonstrate that assertion failing,  
which seems to be due to an upstream planner bug; but there's no  
good reason to do it like this at all.  Let's apply the principle  
of separation of concerns and make the MERGE check separately,  
after getting or not getting the fdwroutine pointer.  
  
Per report from Alexander Lakhin.  No test case, since I think  
the potential test condition will go away soon.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/createplan.c

Correctly set userid of subquery relations' child rels

commit   : a316a3bc6d3f57e3fe0d287d11eb4f114388b1b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Feb 2023 16:00:42 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Feb 2023 16:00:42 +0100    

Click here for diff

The RelOptInfo->userid field (the user ID to check permissions as) of an  
"otherrel" relation was being copied from its parent relation, which is  
correct in most cases but wrong when the parent is a subquery.  In that  
case, using the value from the RTEPermissionInfo of the child itself is  
the appropriate thing to do.  
  
Coming up with a test case where user-visible behavior changes proves  
hard enough, so we don't add one here.  
  
Bug introduced by a61b1f74823c, discovered by Amit while reviewing  
nearby code.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqE0WY_AhLnGtTsY7eYebG212XWbM-D8gr2A_ToOHyCywQ@mail.gmail.com  

M src/backend/optimizer/util/relnode.c

Optimize generate_orderedappend_paths

commit   : 94cad7a3e6040e23d51b9d4869fc20e3e56ddbf7    
  
author   : David Rowley <[email protected]>    
date     : Mon, 20 Feb 2023 22:48:58 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 20 Feb 2023 22:48:58 +1300    

Click here for diff

In generate_orderedappend_paths(), when match_partition_order_desc was  
true, we would lcons() items to various lists in a loop over each live  
partition.  When the number of live partitions was large, the lcons()  
could show up in profiles due to it having to perform memmove() to make  
way for the new list item.  
  
Here we adjust things so that we just perform the loop over the live  
partitions backwards when match_partition_order_desc is true.  This allows  
us to simplify the logic in the loop.  Now, as far as the guts of the loop  
knows, there's no difference between match_partition_order and  
match_partition_order_desc.  We can just set match_partition_order to true  
so that we build the correct list of paths for the asc and desc case. Per  
idea from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add MSVC support for pg_leftmost_one_pos32() and friends

commit   : 67731974644ce77129d282434065c3f0be04be92    
  
author   : John Naylor <[email protected]>    
date     : Wed, 8 Feb 2023 12:05:58 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 8 Feb 2023 12:05:58 +0700    

Click here for diff

To allow testing for general support for fast bitscan intrinsics,  
add symbols HAVE_BITSCAN_REVERSE and HAVE_BITSCAN_FORWARD.  
  
Also do related cleanup in AllocSetFreeIndex(): Previously, we  
tested for HAVE__BUILTIN_CLZ and copied the relevant internals of  
pg_leftmost_one_pos32(), with a special fallback that does less  
work than the general fallback for that function. Now that we have  
a more general test, we just call pg_leftmost_one_pos32() directly  
for platforms with intrinsic support. On gcc at least, there is no  
difference in the binary for non-assert builds.  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsEPc%2BFnX_0vmmQ5DHv60sk4rL_RZJ%2BMD6ei%3D76L0kFMvA%40mail.gmail.com  

M src/backend/utils/mmgr/aset.c
M src/include/port/pg_bitutils.h

Add assert checking to pg_leftmost_one_pos32() and friends

commit   : 204b0cbecb82ab3fde2e12998a89e7227cd64094    
  
author   : John Naylor <[email protected]>    
date     : Tue, 24 Jan 2023 14:39:26 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 24 Jan 2023 14:39:26 +0700    

Click here for diff

Discussion: https://www.postgresql.org/message-id/CAFBsxsEPc%2BFnX_0vmmQ5DHv60sk4rL_RZJ%2BMD6ei%3D76L0kFMvA%40mail.gmail.com  

M src/include/port/pg_bitutils.h

Speedup and increase usability of set proc title functions

commit   : 2cb82e2acfba069d00c6bd253d58df03d315672a    
  
author   : David Rowley <[email protected]>    
date     : Mon, 20 Feb 2023 16:18:27 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 20 Feb 2023 16:18:27 +1300    

Click here for diff

The setting of the process title could be seen on profiles of very  
fast-to-execute queries.  In many locations where we call  
set_ps_display() we pass along a string constant, the length of which is  
known during compilation.  Here we effectively rename set_ps_display() to  
set_ps_display_with_len() and then add a static inline function named  
set_ps_display() which calls strlen() on the given string.  This allows  
the compiler to optimize away the strlen() call when dealing with  
call sites passing a string constant.  We can then also use memcpy()  
instead of strlcpy() to copy the string into the destination buffer.  
That's significantly faster than strlcpy's byte-at-a-time way of  
copying.  
  
Here we also take measures to improve some code which was adjusting the  
process title to add a " waiting" suffix to it.  Call sites which require  
this can now just call set_ps_display_suffix() to add or adjust the suffix  
and call set_ps_display_remove_suffix() to remove it again.  
  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CAApHDvocBvvk-0gWNA2Gohe+sv9fMcv+fK_G+siBKJrgDG4O7g@mail.gmail.com  

M src/backend/replication/syncrep.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lock.c
M src/backend/tcop/postgres.c
M src/backend/utils/misc/ps_status.c
M src/include/utils/ps_status.h

Expand regression tests of pg_stat_statements for utility queries

commit   : de2aca288569fd0cabb425c0858e92e2c8c938cb    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 20 Feb 2023 10:16:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 20 Feb 2023 10:16:51 +0900    

Click here for diff

This commit adds more coverage for utility statements so as it is  
possible to track down all the effects of query normalization done for  
all the queries that use either Const or A_Const nodes, which are the  
nodes where normalization makes the most sense as they apply to  
constants (well, most of the time, really).  
  
This set of queries is extracted from an analysis done while looking at  
full dumps of the regression database when applying different levels of  
normalization to either Const or A_Const nodes for utilities, as of a  
minimal set of these, for:  
- All relkinds (CREATE, ALTER, DROP)  
- Policies  
- Cursors  
- Triggers  
- Types  
- Rules  
- Statistics  
- CALL  
- Transaction statements (isolation level, options)  
- EXPLAIN  
- COPY  
  
Note that pg_stat_statements is not switched yet to show any  
normalization for utilities, still it improves the default coverage of  
the query jumbling code (not by as much as enabling query jumbling on  
the main regression test suite, though):  
- queryjumblefuncs.funcs.c: 36.8% => 48.5%  
- queryjumblefuncs.switch.c: 33.2% => 43.1%  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/expected/cursors.out
M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/meson.build
A contrib/pg_stat_statements/sql/cursors.sql
M contrib/pg_stat_statements/sql/utility.sql

Refactor tests of pg_stat_statements for planning, utility and level tracking

commit   : e8dbdb15dbc8529518ab0303bf358d07c7ad9e18    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 20 Feb 2023 09:28:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 20 Feb 2023 09:28:29 +0900    

Click here for diff

pg_stat_statements.sql acts as the main file for all the core tests of  
the module, but things have become complicated to follow over the years  
as some of the sub-scenarios tested in this file rely on assumptions  
that come from completely different areas of it, like a GUC setup or a  
relation created previously.  For example, row tracking for CTAS/COPY  
was looking at the number of plans, which was not necessary, or level  
tracking was mixed with checks on planner counts.  
  
This commit refactors the tests of pg_stat_statements, by moving test  
cases out of pg_stat_statements.sql into their own file, as of:  
- Planning-related tests in planning.sql, for [re]plan counts and  
top-level handling.  These depend on pg_stat_statements.track_planning.  
- Utilities in utility.sql (pg_stat_statements.track_utility), that  
includes now the tests for:  
-- Row tracking for CTAS, CREATE MATERIALIZED VIEW, COPY.  
-- Basic utility statements.  
-- SET statements.  
- Tracking level, depending on pg_stat_statements.track.  This part has  
been looking at scenarios with DO blocks, PL functions and SQL  
functions.  
  
pg_stat_statements.sql (still named the same for now) still includes  
some checks for role-level tracking and WAL generation metrics, that  
ought to become independent in the long term for clarity.  
  
While on it, this switches the order of the attributes when querying  
pg_stat_statements, the query field becoming last.  This makes much  
easier the tracking of changes related to normalization, as queries are  
the only variable-length attributes queried (unaligned mode would be one  
extra choice, but that reduces the checks on the other fields).  
  
Test scenarios and their results match exactly with what was happening  
before this commit in terms of calls, number of plans, number of rows,  
cached data or level tracking, so this has no effect on the coverage in  
terms of what is produced by the reports in the table  
pg_stat_statements.  A follow-up patch will extend more the tests of  
pg_stat_statements around utilities, so this split creates a foundation  
for this purpose, without complicating more pg_stat_statements.sql.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/expected/cleanup.out
A contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/expected/pg_stat_statements.out
A contrib/pg_stat_statements/expected/planning.out
A contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/meson.build
A contrib/pg_stat_statements/sql/cleanup.sql
A contrib/pg_stat_statements/sql/level_tracking.sql
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
A contrib/pg_stat_statements/sql/planning.sql
A contrib/pg_stat_statements/sql/utility.sql

Fix handling of multi-column BRIN indexes

commit   : e72910f8080185b6ade9ef7caa5c891dba3cb51c    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 19 Feb 2023 00:41:18 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 19 Feb 2023 00:41:18 +0100    

Click here for diff

When evaluating clauses on multiple scan keys of a multi-column BRIN  
index, we can stop processing as soon as we find a scan key eliminating  
the range, and the range should not be added to tbe bitmap.  
  
That's how it worked before 14, but since a681e3c107a the code treated  
the range as matching if it matched at least the last scan key.  
  
Backpatch to 14, where this code was introduced.  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/ebc18613-125e-60df-7520-fcbe0f9274fc%40enterprisedb.com  

M src/backend/access/brin/brin.c

Print the correct aliases for DML target tables in ruleutils.

commit   : 393430f57544dfd550135e0191cc91139926b682    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Feb 2023 16:40:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Feb 2023 16:40:34 -0500    

Click here for diff

ruleutils.c blindly printed the user-given alias (or nothing if there  
hadn't been one) for the target table of INSERT/UPDATE/DELETE queries.  
That works a large percentage of the time, but not always: for queries  
appearing in WITH, it's possible that we chose a different alias to  
avoid conflict with outer-scope names.  Since the chosen alias would  
be used in any Var references to the target table, this'd lead to an  
inconsistent printout with consequences such as dump/restore failures.  
  
The correct logic for printing (or not) a relation alias was embedded  
in get_from_clause_item.  Factor it out to a separate function so that  
we don't need a jointree node to use it.  (Only a limited part of that  
function can be reached from these new call sites, but this seems like  
the cleanest non-duplicative factorization.)  
  
In passing, I got rid of a redundant "\d+ rules_src" step in rules.sql.  
  
Initial report from Jonathan Katz; thanks to Vignesh C for analysis.  
This has been broken for a long time, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CALDaNm1MMntjmT_NJGp-Z=xbF02qHGAyuSHfYHias3TqQbPF2w@mail.gmail.com  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Fix incorrect format placeholder

commit   : 881a91781f49b6116ee6ce49b5bcc03da7200423    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2023 14:10:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Feb 2023 14:10:48 +0100    

Click here for diff

M src/test/modules/test_slru/test_slru.c

Redesign archive modules

commit   : 35739b87dcfef9fc0186aca659f262746fecd778    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Feb 2023 14:26:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Feb 2023 14:26:42 +0900    

Click here for diff

A new callback named startup_cb, called shortly after a module is  
loaded, is added.  This makes possible the initialization of any  
additional state data required by a module.  This initial state data can  
be saved in a ArchiveModuleState, that is now passed down to all the  
callbacks that can be defined in a module.  With this design, it is  
possible to have a per-module state, aimed at opening the door to the  
support of more than one archive module.  
  
The initialization of the callbacks is changed so as  
_PG_archive_module_init() does not anymore give in input a  
ArchiveModuleCallbacks that a module has to fill in with callback  
definitions.  Instead, a module now needs to return a const  
ArchiveModuleCallbacks.  
  
All the structure and callback definitions of archive modules are moved  
into their own header, named archive_module.h, from pgarch.h.  
Command-based archiving follows the same line, with a new set of files  
named shell_archive.{c,h}.  
  
There are a few more items that are under discussion to improve the  
design of archive modules, like the fact that basic_archive calls  
sigsetjmp() by itself to define its own error handling flow.  These will  
be adjusted later, the changes done here cover already a good portion  
of what has been discussed.  
  
Any modules created for v15 will need to be adjusted to this new  
design.  
  
Author: Nathan Bossart  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/basic_archive/basic_archive.c
M doc/src/sgml/archive-modules.sgml
M src/backend/Makefile
A src/backend/archive/Makefile
A src/backend/archive/meson.build
R073 src/backend/postmaster/shell_archive.c src/backend/archive/shell_archive.c
M src/backend/meson.build
M src/backend/postmaster/Makefile
M src/backend/postmaster/meson.build
M src/backend/postmaster/pgarch.c
M src/backend/utils/misc/guc_tables.c
A src/include/archive/archive_module.h
A src/include/archive/shell_archive.h
M src/include/postmaster/pgarch.h
M src/tools/pgindent/typedefs.list

Remove obsolete platforms from ps_status.c.

commit   : d2ea2d310dfdc40328aca5b6c52225de78432e01    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 17 Feb 2023 15:18:18 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 17 Feb 2023 15:18:18 +1300    

Click here for diff

Time to remove various code, comments and configure/meson probes  
relating to ancient BSD, SunOS, GNU/Hurd, IRIX, NeXT and Unixware.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJMNGUAqf27WbckYFrM-Mavy0RKJvocfJU%3DJ2XcAZyv%2Bw%40mail.gmail.com  

M configure
M configure.ac
M meson.build
M src/backend/utils/misc/ps_status.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Fix check for child column generation status matching parent.

commit   : a0fa18cc0d6e4dc3dc24b57ae11253356c55d6c4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Feb 2023 18:51:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Feb 2023 18:51:55 -0500    

Click here for diff

In commit 8bf6ec3ba, I mistakenly supposed that MergeAttributes'  
loop over saved_schema was reprocessing column definitions that  
had already been checked earlier: there is a variant syntax for  
creating a child partition in which that's not true.  So we need  
to duplicate the full check appearing further up.  
  
(Actually, I believe that the "if (restdef->identity)" part is  
not reachable, because we reject identity on partitions earlier.  
But it seems wise to keep the check, in case that's ever relaxed,  
and to keep this code in sync with the other instance.)  
  
Per report from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pgindent: mention directory arguments in help text

commit   : afa7930462f576155a3a6e7716def3db1790fc41    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 16 Feb 2023 11:42:13 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 16 Feb 2023 11:42:13 -0500    

Click here for diff

Shi Yu  

M src/tools/pgindent/pgindent

Remove duplicated comment in nodeModifyTable.c

commit   : 17feb6a566b77bf62ca453dec215adcc71755c20    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Feb 2023 17:13:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Feb 2023 17:13:26 +0900    

Click here for diff

Author: Amul Sul  
Discussion: https://postgr.es/m/CAAJ_b97badUU8_DHNoFCXZxF6YUk0Yb=53rrum168hd1haJgpQ@mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Add a new wait state and use it when sending data in the apply worker.

commit   : fce003cfde219b7016140f83f67ebcfdf75aa0dc    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 16 Feb 2023 07:46:31 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 16 Feb 2023 07:46:31 +0530    

Click here for diff

d9d7fe68d3 made use of an existing wait event when sending data from the  
apply worker, but we should have invented a new wait event since this is a  
new place to wait.  
  
This patch corrects the mistake by using a new wait event  
"LogicalApplySendData".  
  
Author: Hou Zhijie  
Reviewed-by: Peter Smith  
Discussion: https://postgr.es/m/CA+TgmobWzbr9H3yN3dLVckviEZKemPwd+XyCFKEgyZQZhgP66Q@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/replication/logical/applyparallelworker.c
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h

Add description for new patterns supported in HBA and ident sample files

commit   : 1b43743f1174a5b98f77c8090a89d829c2874441    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Feb 2023 07:38:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Feb 2023 07:38:52 +0900    

Click here for diff

Support for regexps in database and role entries for pg_hba.conf has  
been added in 8fea8683, and efb6f4a has extended support of pg-user in  
pg_ident.conf, still both of them have missed a short description about  
the new patterns supported in their respective sample files.  
  
This commit closes the gap, by providing a short description of all the  
new features supported for each entry type.  
  
Reported-by: Pavel Luzanov  
Reviewed-by: Jelte Fennema, Pavel Luzanov  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/pg_hba.conf.sample
M src/backend/libpq/pg_ident.conf.sample

Don't rely on uninitialized value in MERGE / DELETE

commit   : fd923b5de94cdd3a7d05dcb843667dc228ea7fa3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 15 Feb 2023 20:37:44 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 15 Feb 2023 20:37:44 +0100    

Click here for diff

On MERGE / WHEN MATCHED DELETE it's not possible to get cross-partition  
updates, so we don't initialize cpUpdateRetrySlot; however, the code was  
not careful to ignore the value in that case.  Make it do so.  
  
Backpatch to 15.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Dean Rasheed <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Rename force_parallel_mode to debug_parallel_query

commit   : 5352ca22e0012d48055453ca9992a9515d811291    
  
author   : David Rowley <[email protected]>    
date     : Wed, 15 Feb 2023 21:21:59 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 15 Feb 2023 21:21:59 +1300    

Click here for diff

force_parallel_mode is meant to be used to allow us to exercise the  
parallel query infrastructure to ensure that it's working as we expect.  
It seems some users think this GUC is for forcing the query planner into  
picking a parallel plan regardless of the costs.  A quick look at the  
documentation would have made them realize that they were wrong, but the  
GUC is likely too conveniently named which, evidently, seems to often  
result in users expecting that it forces the planner into usefully  
parallelizing queries.  
  
Here we rename the GUC to something which casual users are less likely to  
mistakenly think is what they need to make their query run more quickly.  
  
For now, the old name can still be used.  We'll revisit if the old name  
mapping can be removed once the buildfarm configs are all updated.  
  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CAApHDvrsOi92_uA7PEaHZMH-S4Xv+MGhQWA+GrP8b1kjpS1HjQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/regress.sgml
M src/backend/access/transam/parallel.c
M src/backend/commands/explain.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_tables.c
M src/include/optimizer/optimizer.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/isolation/expected/deadlock-parallel.out
M src/test/isolation/specs/deadlock-parallel.spec
M src/test/isolation/specs/serializable-parallel.spec
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/with.out
M src/test/regress/sql/multirangetypes.sql
M src/test/regress/sql/rangetypes.sql
M src/test/regress/sql/select_parallel.sql
M src/test/regress/sql/with.sql

doc: Fix spelling of option -Dtap_tests for meson

commit   : 8e0e0698f12bd77da38f6863ecdbe88a63ed49dc    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Feb 2023 15:01:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Feb 2023 15:01:24 +0900    

Click here for diff

This option was documented as -Dtap-tests, but the option requires an  
underscore in its name.  
  
Author: Katsuragi Yuta  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml

Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates

commit   : 9244c11afe23bce9358de3d36404151139e968d9    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Feb 2023 10:12:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Feb 2023 10:12:16 +0900    

Click here for diff

OpenSSL 1.1.1 and newer versions have added support for RSA-PSS  
certificates, which requires the use of a specific routine in OpenSSL to  
determine which hash function to use when compiling it when using  
channel binding in SCRAM-SHA-256.  X509_get_signature_nid(), that is the  
original routine the channel binding code has relied on, is not able to  
determine which hash algorithm to use for such certificates.  However,  
X509_get_signature_info(), new to OpenSSL 1.1.1, is able to do it.  This  
commit switches the channel binding logic to rely on  
X509_get_signature_info() over X509_get_signature_nid(), which would be  
the choice when building with 1.1.1 or newer.  
  
The error could have been triggered on the client or the server, hence  
libpq and the backend need to have their related code paths patched.  
Note that attempting to load an RSA-PSS certificate with OpenSSL 1.1.0  
or older leads to a failure due to an unsupported algorithm.  
  
The discovery of relying on X509_get_signature_info() comes from Jacob,  
the tests have been written by Heikki (with few tweaks from me), while I  
have bundled the whole together while adding the bits needed for MSVC  
and meson.  
  
This issue exists since channel binding exists, so backpatch all the way  
down.  Some tests are added in 15~, triggered if compiling with OpenSSL  
1.1.1 or newer, where the certificate and key files can easily be  
generated for RSA-PSS.  
  
Reported-by: Gunnar "Nick" Bluth  
Author: Jacob Champion, Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M configure
M configure.ac
M meson.build
M src/backend/libpq/be-secure-openssl.c
M src/include/libpq/libpq-be.h
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/README
A src/test/ssl/conf/server-rsapss.config
A src/test/ssl/ssl/server-rsapss.crt
A src/test/ssl/ssl/server-rsapss.key
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/002_scram.pl
M src/tools/msvc/Solution.pm

Fix make_etags failure on Mac.

commit   : 87f21d2c68900ea4ccc6e20a9a3c941fafa9f94a    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 15 Feb 2023 09:52:42 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 15 Feb 2023 09:52:42 +0900    

Click here for diff

Previously make_etags always ran make_ctags -e when make_etags was  
executed.  However, because non-Exuberant ctags on Mac does not  
support -e option (and also on other platforms including old Linux),  
ctags failed. To avoid the failure change make_ctags so that if  
non-Exuberant ctags is used and ctags -e option is requested, run  
etags command instead. If etags command does not exist, make_ctags  
will fail.  
  
Also refactor make_ctags and tweak make_etags to emit proper usage  
message.  
  
Author: Fujii Masao  
Reviewed-by: Tatsuo Ishii  
Discussion: https://www.postgresql.org/message-id/369c13b9-8b0f-d6f9-58fc-61258ec8f713%40oss.nttdata.com  

M src/tools/make_ctags
M src/tools/make_etags

Change argument type of pq_sendbytes from char * to void *

commit   : 3b12e68a5c4609deb9fc69607e0aec072700c0a9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Feb 2023 13:32:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Feb 2023 13:32:19 +0100    

Click here for diff

This is a follow-up to 1f605b82ba66ece8b421b10d41094dd2e3c0c48b.  It  
allows getting rid of further casts at call sites.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/pqformat.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/include/libpq/pqformat.h

Correct docs for the default locale_provider of a new database.

commit   : a8a44828a2e15c95a15549063205b779f7055f1c    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 13 Feb 2023 17:14:44 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 13 Feb 2023 17:14:44 -0800    

Click here for diff

If the locale provider is not specified, it defaults to be the same as  
the template from which it was created. Previously, the documentation  
said the default was libc.  
  
Also adjust wording of CREATE DATABASE and CREATE COLLATION docs to be  
definite that there are exactly two possible collation providers.  
  
Discussion: https://postgr.es/m/6befdaada61c046b67f3b269f7fa6f069a35803e.camel%40j-davis.com  
Reviewed-by: Nathan Bossart  

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

When removing a relation from the query, drop its RelOptInfo.

commit   : e9a20e451f3aa0b64da807338012c65d8664d0ac    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Feb 2023 13:35:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Feb 2023 13:35:38 -0500    

Click here for diff

In commit b78f6264e I opined that it was "too risky" to delete a  
relation's RelOptInfo from the planner's data structures when we have  
realized that we don't need to join to it; so instead we just marked  
it as a dead relation.  In hindsight that judgment seems flawed: any  
subsequent access to such a dead relation is arguably a bug in  
itself, so leaving the RelOptInfo present just helps to mask bugs.  
Let's delete it instead, allowing removal of the whole notion of a  
"dead relation".  So far as the regression tests can find, this  
requires no other code changes, except for one Assert in equivclass.c  
that was very dubiously not complaining about access to a dead rel.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/include/nodes/pathnodes.h

Fix buggy recursion in flatten_rtes_walker().

commit   : c7468c73f7b6e842a53c12eaee5578a76a8fa7a6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Feb 2023 12:19:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Feb 2023 12:19:58 -0500    

Click here for diff

Must save-and-restore the context we are modifying.  
Oversight in commit a61b1f748.  
  
Tender Wang  
  
Discussion: https://postgr.es/m/CAHewXNnnNySD_YcKNuFpQDV2gxWA7_YLWqHmYVcyoOYxn8kY2A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

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

Fix thinkos in have_unsafe_outer_join_ref; reduce to Assert check.

commit   : f50f029c497da35927491f16964f7aa993ecbae5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Feb 2023 11:45:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Feb 2023 11:45:32 -0500    

Click here for diff

Late in the development of commit 2489d76c4, I (tgl) incorrectly  
concluded that the new function have_unsafe_outer_join_ref couldn't  
ever reach its inner loop.  That should be the case if the inner  
rel's parameterization is based on just one Var, but it could be  
based on Vars from several relations, and then not only is the  
inner loop reachable but it's wrongly coded.  
  
Despite those errors, it still appears that the whole thing is  
redundant given previous join_is_legal checks, so let's arrange  
to only run it in assert-enabled builds.  
  
Diagnosis and patch by Richard Guo, per fuzz testing by Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove obsolete pgindent options --code-base and --build

commit   : b16259b3c1897cf90855a94e5cb126d6c75e3cf3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 13 Feb 2023 08:13:03 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 13 Feb 2023 08:13:03 -0500    

Click here for diff

Now that we have the sources for pg_bsd_indent in our code base these  
are redundant.  
  
It is now required to provide a list of files or directories to pgindent,  
either by using --commit or on the command line. The equivalent of  
previously running pgindent with no parameters is now `pgindent .`  
  
Some extra checks are also added. duplicate files in the file list are  
skipped, and there is a warning if no files are specified.  
  
If the --commit option is used, the script now chdir's to the source  
root, as git always reports files relative to that. (Fixes a gripe from  
Justin Pryzby)  
  
Reviewed by Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pgindent/pgindent
M src/tools/pgindent/pgindent.man

Fix object identity string for transforms

commit   : 9a312562314abcec91ae9cff3a4af37196c3886e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 Feb 2023 14:03:09 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 Feb 2023 14:03:09 +0100    

Click here for diff

In commit ad89a5d115b3, we added an unhelpful 'ON' that doesn't match  
the input syntax.  This was discovered while adding code to support for  
DDL in logical replication.  
  
No backpatch because of the change of behavior, however improbable it  
may be that somebody is depending on this.  
  
Author: Zheng Li <[email protected]>  
Discussion: https://postgr.es/m/CAAD30UKg8rXeGM8Oy_MAmxKBL_K5DiHXdeNF=hUefcu1C_6VfQ@mail.gmail.com  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out

Add wait_for_replay_catchup wrapper to Cluster.pm

commit   : a1acdacada4aaeb233d819f519d16a9eb85a6eef    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 Feb 2023 11:52:19 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 Feb 2023 11:52:19 +0100    

Click here for diff

This simplifies a few lines of Perl test code a bit.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/t/007_standby_source.pl
M src/test/modules/brin/t/02_wal_consistency.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/030_stats_cleanup_replica.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/033_replay_tsp_drops.pl

Fix pfree issue in presorted DISTINCT aggregate code

commit   : ec5a010ab25bf40012fde78b34724971e38e08a4    
  
author   : David Rowley <[email protected]>    
date     : Mon, 13 Feb 2023 23:38:21 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 13 Feb 2023 23:38:21 +1300    

Click here for diff

The logic in this area was recently changed in 7da51590e, however, in that  
commit, I neglected to consider that the conditions in which we should  
pfree the old Datum needed to be updated after that change.  This could  
result in trying to pfree a NULL value, as was demonstrated by Alexander  
Lakhin.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c

Consolidate ItemPointer to Datum conversion functions

commit   : bd944884e92af7082063428a1124a15041597c33    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Feb 2023 09:50:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Feb 2023 09:50:14 +0100    

Click here for diff

Instead of defining the same set of macros several times, define it  
once in an appropriate header file.  In passing, convert to inline  
functions.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/844dd4c5-e5a1-3df1-bfaf-d1e1c2a16e45%40enterprisedb.com  

M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M src/backend/utils/adt/tid.c
M src/include/storage/itemptr.h

Fix incorrect presorted DISTINCT aggregate if condition

commit   : 7da51590ed6cd46ff886e8e4d08e8703db9c2b5b    
  
author   : David Rowley <[email protected]>    
date     : Mon, 13 Feb 2023 20:38:37 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 13 Feb 2023 20:38:37 +1300    

Click here for diff

Here we fix a faulty "if" condition which failed to correctly handle two  
or more consecutive NULL transition values when checking if the new value  
is DISTINCT from the old value for presorted aggregates.  Given a suitably  
non-strict aggregate transition function, a byref aggregate could cause a  
crash due to calling the type's equality function and passing along a  
(Datum) 0 value to test for equality, the equality function would then try  
to dereference that 0 Datum and segfault.  For byval types, there'd have  
been no crash and the equality function would have seen that the two 0  
Datums matched, which (only by chance) meant the calling code would have  
worked correctly.  
  
Here we ensure that we only call the equality function when neither of  
the input values are NULL.  
  
This code is all new as of 1349d2790, so no backpatch needed.  
  
Reported-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

Disable WindowAgg inverse transitions when subplans are present

commit   : 836c31ba508c154bc4c4ebb6270761586a6df797    
  
author   : David Rowley <[email protected]>    
date     : Mon, 13 Feb 2023 17:11:03 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 13 Feb 2023 17:11:03 +1300    

Click here for diff

When an aggregate function is used as a WindowFunc and a tuple transitions  
out of the window frame, we ordinarily try to make use of the aggregate  
function's inverse transition function to "unaggregate" the exiting tuple.  
  
This optimization is disabled for various cases, including when the  
aggregate contains a volatile function.  In such a case we'd be unable to  
ensure that the transition value was calculated to the same value during  
transitions and inverse transitions.  Unfortunately, we did this check by  
calling contain_volatile_functions() which does not recursively search  
SubPlans for volatile functions.  If the aggregate function's arguments or  
its FILTER clause contained a subplan with volatile functions then we'd  
fail to notice this.  
  
Here we fix this by just disabling the optimization when the WindowFunc  
contains any subplans.  Volatile functions are not the only reason that a  
subplan may have nonrepeatable results.  
  
Bug: #17777  
Reported-by: Anban Company  
Discussion: https://postgr.es/m/17777-860b739b6efde977%40postgresql.org  
Reviewed-by: Tom Lane  
Backpatch-through: 11  

M src/backend/executor/nodeWindowAgg.c

Mark more nodes with attribute no_query_jumble

commit   : 2a507f6fd8b75c5197a58aac7c8003befd072003    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Feb 2023 09:07:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Feb 2023 09:07:33 +0900    

Click here for diff

This commit removes most of the Plan and Path nodes, which should never  
be included in the query jumbling because we ignore these in Query  
nodes.  This is facilitated by making no_query_jumble an inherited  
attribute, like no_copy, no_equal and no_read when the supertype of a  
node is found as marked with that.  
  
RawStmt is not used in parsed queries, so it can be removed from the  
query jumbling.  A couple of nodes defined in pathnodes.h, plannodes.h  
and primnodes.h with NodeTag as supertype need to be marked  
individually.  
  
Forcing the execution of the query jumbling code with compute_query_id =  
auto while pg_stat_statements is loaded brings the code coverage of  
queryjumblefuncs.funcs.c to 95.6%.  
  
The core code does not yet include a way to enforce the execution in  
query jumbling except in pg_stat_statements, so the numbers I am  
mentioning above will not reflect on the default coverage report with  
just what is done in this commit.  
  
Reported-by: Tom Lane  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/utils/rel.h

Make pg_bsd_indent's .h files inclusion-order-safe.

commit   : 6ded4a5a3de1e8d5f3ec50efd4a2d7a39d2550a6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 13:06:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 13:06:37 -0500    

Click here for diff

As-is, they failed headerscheck.  Per buildfarm.  

M src/tools/pg_bsd_indent/indent.h

Avoid dereferencing an undefined pointer in DecodeInterval().

commit   : 5e80d3515488a12f776ba14a07fbb5aa6b3ef013    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 12:50:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 12:50:55 -0500    

Click here for diff

Commit e39f99046 moved some code up closer to the start of  
DecodeInterval(), without noticing that it had been implicitly  
relying on previous checks to reject the case of empty input.  
Given empty input, we'd now dereference a pointer that hadn't been  
set, possibly leading to a core dump.  (But if we fail to provoke  
a SIGSEGV, nothing bad happens, and the expected syntax error is  
thrown a bit later.)  
  
Per bug #17788 from Alexander Lakhin.  Back-patch to v15 where  
the fault was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/datetime.c
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Integrate pg_bsd_indent into our build/test infrastructure.

commit   : 156c049beed9d3f243cdceaf89456ea6a2995493    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 12:22:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 12:22:21 -0500    

Click here for diff

Update the Makefile and build directions for in-tree build,  
and add Meson build infrastructure.  Also convert the ad-hoc  
test target into a TAP test.  
  
Currently, the Make build system will not build pg_bsd_indent  
by default, while the Meson system will.  Both will test it  
during "make check-world" or "ninja test".  Neither will install  
it automatically.  (We might change some of these decisions later.)  
  
Also fix a few portability nits noted during early testing.  
  
Also, exclude pg_bsd_indent from pgindent's purview; at least for  
now, we'll leave it formatted similarly to the FreeBSD original.  
  
Tom Lane and Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M src/Makefile
M src/meson.build
M src/tools/pg_bsd_indent/.gitignore
M src/tools/pg_bsd_indent/Makefile
M src/tools/pg_bsd_indent/README
D src/tools/pg_bsd_indent/README.pg_bsd_indent
M src/tools/pg_bsd_indent/args.c
M src/tools/pg_bsd_indent/indent.c
M src/tools/pg_bsd_indent/indent.h
A src/tools/pg_bsd_indent/meson.build
A src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
M src/tools/pgindent/exclude_file_patterns

commit   : b44e5fced3e5a6d3d971a51757a306eacc349bf3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 12:03:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 12:03:01 -0500    

Click here for diff

To avoid confusion, make the copyright notices in these files  
match the 3-clause form of the BSD license, per the blanket  
policy update that UC Berkeley issued years ago.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pg_bsd_indent/README
M src/tools/pg_bsd_indent/args.c
M src/tools/pg_bsd_indent/indent.c
M src/tools/pg_bsd_indent/indent_codes.h
M src/tools/pg_bsd_indent/indent_globs.h
M src/tools/pg_bsd_indent/io.c
M src/tools/pg_bsd_indent/lexi.c
M src/tools/pg_bsd_indent/parse.c
M src/tools/pg_bsd_indent/pr_comment.c

Import pg_bsd_indent sources.

commit   : 4e831f4cee140b004fae44d528d47c284d8ac9eb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 11:59:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Feb 2023 11:59:18 -0500    

Click here for diff

This brings in an exact copy of the pg_bsd_indent repo as of  
commit d301442799cea44e5ccb04331afc537764ec77c5 (2020-12-28).  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

A src/tools/pg_bsd_indent/.gitignore
A src/tools/pg_bsd_indent/Makefile
A src/tools/pg_bsd_indent/README
A src/tools/pg_bsd_indent/README.pg_bsd_indent
A src/tools/pg_bsd_indent/args.c
A src/tools/pg_bsd_indent/err.c
A src/tools/pg_bsd_indent/err.h
A src/tools/pg_bsd_indent/indent.1
A src/tools/pg_bsd_indent/indent.c
A src/tools/pg_bsd_indent/indent.h
A src/tools/pg_bsd_indent/indent_codes.h
A src/tools/pg_bsd_indent/indent_globs.h
A src/tools/pg_bsd_indent/io.c
A src/tools/pg_bsd_indent/lexi.c
A src/tools/pg_bsd_indent/parse.c
A src/tools/pg_bsd_indent/pr_comment.c
A src/tools/pg_bsd_indent/tests/binary.0
A src/tools/pg_bsd_indent/tests/binary.0.stdout
A src/tools/pg_bsd_indent/tests/comments.0
A src/tools/pg_bsd_indent/tests/comments.0.stdout
A src/tools/pg_bsd_indent/tests/comments.pro
A src/tools/pg_bsd_indent/tests/cppelsecom.0
A src/tools/pg_bsd_indent/tests/cppelsecom.0.stdout
A src/tools/pg_bsd_indent/tests/declarations.0
A src/tools/pg_bsd_indent/tests/declarations.0.stdout
A src/tools/pg_bsd_indent/tests/elsecomment.0
A src/tools/pg_bsd_indent/tests/elsecomment.0.stdout
A src/tools/pg_bsd_indent/tests/elsecomment.pro
A src/tools/pg_bsd_indent/tests/enum.0
A src/tools/pg_bsd_indent/tests/enum.0.stdout
A src/tools/pg_bsd_indent/tests/f_decls.0
A src/tools/pg_bsd_indent/tests/f_decls.0.stdout
A src/tools/pg_bsd_indent/tests/float.0
A src/tools/pg_bsd_indent/tests/float.0.stdout
A src/tools/pg_bsd_indent/tests/label.0
A src/tools/pg_bsd_indent/tests/label.0.stdout
A src/tools/pg_bsd_indent/tests/label.pro
A src/tools/pg_bsd_indent/tests/list_head.0
A src/tools/pg_bsd_indent/tests/list_head.0.stdout
A src/tools/pg_bsd_indent/tests/nsac.0
A src/tools/pg_bsd_indent/tests/nsac.0.stdout
A src/tools/pg_bsd_indent/tests/nsac.pro
A src/tools/pg_bsd_indent/tests/offsetof.0
A src/tools/pg_bsd_indent/tests/offsetof.0.stdout
A src/tools/pg_bsd_indent/tests/parens.0
A src/tools/pg_bsd_indent/tests/parens.0.stdout
A src/tools/pg_bsd_indent/tests/parens.pro
A src/tools/pg_bsd_indent/tests/sac.0
A src/tools/pg_bsd_indent/tests/sac.0.stdout
A src/tools/pg_bsd_indent/tests/sac.pro
A src/tools/pg_bsd_indent/tests/struct.0
A src/tools/pg_bsd_indent/tests/struct.0.stdout
A src/tools/pg_bsd_indent/tests/surplusbad.0
A src/tools/pg_bsd_indent/tests/surplusbad.0.stdout
A src/tools/pg_bsd_indent/tests/surplusbad.pro
A src/tools/pg_bsd_indent/tests/types_from_file.0
A src/tools/pg_bsd_indent/tests/types_from_file.0.stdout
A src/tools/pg_bsd_indent/tests/types_from_file.list
A src/tools/pg_bsd_indent/tests/types_from_file.pro
A src/tools/pg_bsd_indent/tests/wchar.0
A src/tools/pg_bsd_indent/tests/wchar.0.stdout

pgindent: filter files for the --commit option

commit   : dab07e8c6896df3129bc153ead1f107e695652ee    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 12 Feb 2023 08:43:44 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 12 Feb 2023 08:43:44 -0500    

Click here for diff

per gripe from Shi Yu, solution from Jelte Fennema  
  
Also add a check that the file exists, and issue a warning if it  
doesn't.  
  
As an efficiency measure, avoid processing any file more than once.  
  
Discussion: https://postgr.es/m/TYAPR01MB6315B86619944D4A6B56842DFDDE9@TYAPR01MB6315.jpnprd01.prod.outlook.com  

M src/tools/pgindent/pgindent

Add tests for pg_stat_io

commit   : 10a082bf72150f49c34fcf152565c77d80f31a9c    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 11 Feb 2023 09:54:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 11 Feb 2023 09:54:44 -0800    

Click here for diff

Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/expected/check_heap.out
M contrib/amcheck/sql/check_heap.sql
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Create regress_tblspc in test_setup

commit   : 9c83bbcf7ef6b4236d117b25d8a754483e6488db    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 11 Feb 2023 09:52:36 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 11 Feb 2023 09:52:36 -0800    

Click here for diff

An upcoming test needs to use a tablespace as part of its test. Historically,  
we wanted tablespace creation be done in a dedicated file, so it's easy to  
disable when testing replication. But that is not necessary anymore, due to  
allow_in_place_tablespaces.  
  
Create regress_tblspace tablespace in test_setup. Move the tablespace test to  
the end of the parallel schedule, so other tests can use it.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/tablespace.out
M src/test/regress/expected/test_setup.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/tablespace.sql
M src/test/regress/sql/test_setup.sql

Add pg_stat_io view, providing more detailed IO statistics

commit   : a9c70b46dbe152e094f137f7e6ba9cd3a638ee25    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 11 Feb 2023 09:51:58 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 11 Feb 2023 09:51:58 -0800    

Click here for diff

Builds on 28e626bde00 and f30d62c2fc6. See the former for motivation.  
  
Rows of the view show IO operations for a particular backend type, IO target  
object, IO context combination (e.g. a client backend's operations on  
permanent relations in shared buffers) and each column in the view is the  
total number of IO Operations done (e.g. writes). So a cell in the view would  
be, for example, the number of blocks of relation data written from shared  
buffers by client backends since the last stats reset.  
  
In anticipation of tracking WAL IO and non-block-oriented IO (such as  
temporary file IO), the "op_bytes" column specifies the unit of the "reads",  
"writes", and "extends" columns for a given row.  
  
Rows for combinations of IO operation, backend type, target object and context  
that never occur, are ommitted entirely. For example, checkpointer will never  
operate on temporary relations.  
  
Similarly, if an IO operation never occurs for such a combination, the IO  
operation's cell will be null, to distinguish from 0 observed IO  
operations. For example, bgwriter should not perform reads.  
  
Note that some of the cells in the view are redundant with fields in  
pg_stat_bgwriter (e.g. buffers_backend). For now, these have been kept for  
backwards compatibility.  
  
Bumps catversion.  
  
Author: Melanie Plageman <[email protected]>  
Author: Samay Sharma <[email protected]>  
Reviewed-by: Maciek Sakrejda <[email protected]>  
Reviewed-by: Lukas Fittl <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Fix join removal logic to clean up sub-RestrictInfos of OR clauses.

commit   : 44e56baa80ff5fba150897308c8f25aa2251b16c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Feb 2023 14:52:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Feb 2023 14:52:36 -0500    

Click here for diff

analyzejoins.c took care to clean out removed relids from the  
clause_relids and required_relids of RestrictInfos associated with  
the doomed rel ... but it paid no attention to the fact that if such a  
RestrictInfo contains an OR clause, there will be sub-RestrictInfos  
containing similar fields.  
  
I'm more than a bit surprised that this oversight hasn't caused  
visible problems before.  In any case, it's certainly broken now,  
so add logic to clean out the sub-RestrictInfos recursively.  
We might need to back-patch this someday.  
  
Per bug #17786 from Robins Tharakan.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Further fixes in qual nullingrel adjustment for outer join commutation.

commit   : acc5821e4dcb6b7df6ad1f806459f95fcaebadfc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Feb 2023 13:31:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Feb 2023 13:31:00 -0500    

Click here for diff

One of the add_nulling_relids calls in deconstruct_distribute_oj_quals  
added an OJ relid to too few Vars, while the other added it to too  
many.  We should consider the syntactic structure not  
min_left/righthand while deciding which Vars to decorate, and when  
considering pushing up a lower outer join pursuant to transforming the  
second form of OJ identity 3 to the first form, we only want to  
decorate Vars coming from its LHS.  
  
In a related bug, I realized that make_outerjoininfo was failing to  
check a very basic property that's needed to apply OJ identity 3:  
the syntactically-upper outer join clause can't refer to the lower  
join's LHS.  This didn't break the join order restriction logic,  
but it led to setting bogus commute_xxx bits, possibly resulting  
in bogus nullingrel markings in modified quals.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/CAMbWs497CmBruMx1SOjepWEz+T5NWa4scqbdE9v7ZzSXqH_gQw@mail.gmail.com  
Discussion: https://postgr.es/m/CAEP4nAx9C5gXNBfEA0JBfz7B+5f1Bawt-RWQWyhev-wdps8BZA@mail.gmail.com  

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

Fix incorrect format placeholder

commit   : f8ba1bf4e48369450cdc71b5bf12d8f7bdaf10f3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Feb 2023 12:00:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Feb 2023 12:00:51 +0100    

Click here for diff

M src/backend/parser/parse_relation.c

Fix typo in parsenodes.h

commit   : 9e8b694d819d96f65f8de33102858bd6bff4b54a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 Feb 2023 15:37:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 Feb 2023 15:37:41 +0900    

Click here for diff

Introduced in a61b1f7 when RTEPermissionInfo got added.  Issue spotted  
while reviewing the area for a different patch.  

M src/include/nodes/parsenodes.h

pgstat: Track more detailed relation IO statistics

commit   : f30d62c2fc60acfa62d3b83a73dc9bf7f83cfe2f    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 9 Feb 2023 22:22:26 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 9 Feb 2023 22:22:26 -0800    

Click here for diff

Commit 28e626bde00 introduced the infrastructure for tracking more detailed IO  
statistics. This commit adds the actual collection of the new IO statistics  
for relations and temporary relations. See aforementioned commit for goals and  
high-level design.  
  
The changes in this commit are fairly straight-forward. The bulk of the change  
is to passing sufficient information to the callsites of pgstat_count_io_op().  
  
A somewhat unsightly detail is that it currently is hard to find a better  
place to count fsyncs than in md.c, whereas the other pgstat_count_io_op()  
calls are in bufmgr.c/localbuf.c. As the number of fsyncs is tied to md.c  
implementation details, it's not obvious there is a better answer.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/smgr/md.c
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h

Fix help text spacing in pgindent

commit   : 40d0b2d4153d903d41adee6a303428540389191b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 9 Feb 2023 13:31:52 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 9 Feb 2023 13:31:52 -0500    

Click here for diff

Author: Noriyoshi Shinoda  

M src/tools/pgindent/pgindent

Fix various typos in code and tests

commit   : ef7002dbe0b06e4e5b42c89becd4eb9be2e9aa89    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Feb 2023 14:43:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Feb 2023 14:43:53 +0900    

Click here for diff

Most of these are recent, and the documentation portions are new as of  
v16 so there is no need for a backpatch.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_schema.sgml
M src/backend/commands/dbcommands.c
M src/backend/executor/execMain.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/lib/ilist.h
M src/include/partitioning/partdesc.h
M src/include/port/simd.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_procedure.sql
M src/test/subscription/t/031_column_list.pl

Remove uses of AssertVariableIsOfType() obsoleted by f2b73c8

commit   : 30b789eafed2cbbc3de9c9025a30eefdffacb79c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 8 Feb 2023 21:06:46 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 8 Feb 2023 21:06:46 -0800    

Click here for diff

Author: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/20230208172705.GA451849@nathanxps13  

M contrib/basic_archive/basic_archive.c
M contrib/test_decoding/test_decoding.c
M src/backend/postmaster/shell_archive.c
M src/backend/replication/pgoutput/pgoutput.c

pgstat: Infrastructure for more detailed IO statistics

commit   : 28e626bde00efe8051fbd677227c97b1aa3c6a1a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 8 Feb 2023 20:53:42 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 8 Feb 2023 20:53:42 -0800    

Click here for diff

This commit adds the infrastructure for more detailed IO statistics. The calls  
to actually count IOs, a system view to access the new statistics,  
documentation and tests will be added in subsequent commits, to make review  
easier.  
  
While we already had some IO statistics, e.g. in pg_stat_bgwriter and  
pg_stat_database, they did not provide sufficient detail to understand what  
the main sources of IO are, or whether configuration changes could avoid  
IO. E.g., pg_stat_bgwriter.buffers_backend does contain the number of buffers  
written out by a backend, but as that includes extending relations (always  
done by backends) and writes triggered by the use of buffer access strategies,  
it cannot easily be used to tune background writer or checkpointer. Similarly,  
pg_stat_database.blks_read cannot easily be used to tune shared_buffers /  
compute a cache hit ratio, as the use of buffer access strategies will often  
prevent a large fraction of the read blocks to end up in shared_buffers.  
  
The new IO statistics count IO operations (evict, extend, fsync, read, reuse,  
and write), and are aggregated for each combination of backend type (backend,  
autovacuum worker, bgwriter, etc), target object of the IO (relations, temp  
relations) and context of the IO (normal, vacuum, bulkread, bulkwrite).  
  
What is tracked in this series of patches, is sufficient to perform the  
aforementioned analyses. Further details, e.g. tracking the number of buffer  
hits, would make that even easier, but was left out for now, to keep the scope  
of the already large patchset manageable.  
  
Bumps PGSTAT_FILE_FORMAT_ID.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
A src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/miscadmin.h
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h
M src/tools/pgindent/typedefs.list

Fix bugs in GetSafeSnapshotBlockingPids(), introduced in 96003717645

commit   : 49c2c5fcb1e1e4311f08687f78dd9121330ae637    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 8 Feb 2023 18:19:36 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 8 Feb 2023 18:19:36 -0800    

Click here for diff

While removing the use of SHM_QUEUE from predicate.c, in 96003717645, I made  
two mistakes in GetSafeSnapshotBlockingPids():  
- Removed the check for output_size  
- Previously, when the first loop didn't find a matching proc, sxact would be  
  NULL. But with naive use of dlist_foreach() it ends up as the value of the  
  last iteration.  
  
The second issue is the cause of occasional failures in the deadlock-hard and  
deadlock-soft isolation tests that we have been observing on CI. The issue was  
very hard to reproduce, as it requires the transactions.sql regression test to  
run at the same time as the deadlock-{hard,soft} isolation test.  
  
I did not find other similar mistakes in 96003717645.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Stop recommending auto-download of DTD files, and indeed disable it.

commit   : 969509c3f2e3b4c32dcf264f9d642b5ef01319f3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Feb 2023 17:15:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Feb 2023 17:15:23 -0500    

Click here for diff

It appears no longer possible to build the SGML docs without a local  
installation of the DocBook DTD, because sourceforge.net now only  
permits HTTPS access, and no common version of xsltproc supports that.  
Hence, remove the bits of our documentation suggesting that that's  
possible or useful.  
  
In fact, we might as well add the --nonet option to the build recipes  
automatically, for a bit of extra security.  
  
Also fix our documentation-tool-installation recipes for macOS to  
ensure that xmllint and xsltproc are pulled in from MacPorts or  
Homebrew.  The previous recipes assumed you could use the  
Apple-supplied versions of these tools; which still works, except that  
you'd need to set an environment variable to ensure that they would  
find DTD files provided by those package managers.  Simpler and easier  
to just recommend pulling in the additional packages.  
  
In HEAD, also document how to build docs using Meson, and adjust  
"ninja docs" to just build the HTML docs, for consistency with the  
default behavior of doc/src/sgml/Makefile.  
  
In a fit of neatnik-ism, I also made the ordering of the package  
lists match the order in which the tools are described at the head  
of the appendix.  
  
Aleksander Alekseev, Peter Eisentraut, Tom Lane  
  
Discussion: https://postgr.es/m/CAJ7c6TO8Aro2nxg=EQsVGiSDe-TstP4EsSvDHd7DSRsP40PgGA@mail.gmail.com  

M doc/src/sgml/Makefile
M doc/src/sgml/docguide.sgml
M doc/src/sgml/images/Makefile
M doc/src/sgml/meson.build

pgindent: more ways to find files to indent

commit   : 068a243b7771890052a32c577a44c48facd34884    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 8 Feb 2023 17:01:54 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 8 Feb 2023 17:01:54 -0500    

Click here for diff

A new --commit option will add all the files in a commit to the file  
list. The option can be specified more than once.  
  
Also, if a directory is given on the command line, all the files in that  
directory tree will be added to the file list.  
  
Per suggestions from Robert Haas  
  
Reviewed by Jelte Fennema  
  
Discussion: https://postgr.es/m/CA+TgmoY59Ksso81RNLArNxj0a7xaqV_F_u7gSMHbgdc2kG5Vpw@mail.gmail.com  

M src/tools/pgindent/pgindent

Further tighten nullingrel marking rules in build_joinrel_tlist().

commit   : d1c9c864fc042412e9b674d79a0e70972053ce15    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Feb 2023 14:45:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Feb 2023 14:45:36 -0500    

Click here for diff

The code I added in fee7b77b9 could misbehave if commute_above_r  
contains multiple relids.  While adding too many relids here is  
probably harmless (pre-fee7b77b9, we did it all the time), it's  
not very expensive to be accurate: we just have to intersect  
commute_above_r with the join's relids.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/relnode.c

remove_rel_from_query() must clean up PlaceHolderVar.phrels fields.

commit   : 798c0176342150c8fe1404b0007b299db2e73ce0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Feb 2023 14:08:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Feb 2023 14:08:46 -0500    

Click here for diff

While we got away with this sloppiness before, it's not okay now  
that fee7b77b9 caused build_joinrel_tlist() to make use of phrels.  
Per report from Robins Tharakan.  
  
Richard Guo (some cosmetic tweaks by me)  
  
Discussion: https://postgr.es/m/CAMbWs4_ngw9sKxpTE8hqk=-ooVX_CQP3DarA4HzkRMz_JKpTrA@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   : b7e84c65d5b2d694a669ae1db8ab1d6c51ef8596    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Feb 2023 16:56:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Feb 2023 16:56:21 +0900    

Click here for diff

No GUCs that use NO_SHOW_ALL are reported in pg_show_all_settings(),  
hence trying to check combinations of flags related to it is pointless.  
  
These queries have been introduced by d10e41d, so backpatch down to 15  
to keep all the branches consistent.  Equivalent checks based on  
NO_SHOW_ALL could be added in check_GUC_init() when a GUC is initially  
loaded, but this can be done only on HEAD.  
  
Author: Nitin Jadhav  
Discussion: https://postgr.es/m/CAMm1aWaYe0muu3ABo7iSAgK+OWDS9yNe8GGRYnCyeEpScYKa+g@mail.gmail.com  
Backpatch-through: 15  

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

Remove stray duplicated comment in heapam.h

commit   : 9ed50ab3496f5fdc46d1051a005d5236495c92d7    
  
author   : David Rowley <[email protected]>    
date     : Wed, 8 Feb 2023 16:03:26 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 8 Feb 2023 16:03:26 +1300    

Click here for diff

This is just the same as what's written under the rs_numblocks field.  
  
Reported-by: Melanie Plageman  
Discussion: https://postgr.es/m/20230207204127.7vs6krqjqn5farr7@liskov  

M src/include/access/heapam.h

Fix the logical replication timeout during large DDLs.

commit   : 8c58624df46222d4d09c5655d8350f3b037880c8    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 8 Feb 2023 07:58:25 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 8 Feb 2023 07:58:25 +0530    

Click here for diff

The DDLs like Refresh Materialized views that generate lots of temporary  
data due to rewrite rules may not be processed by output plugins (for  
example pgoutput). So, we won't send keep-alive messages for a long time  
while processing such commands and that can lead the subscriber side to  
timeout. We have previously fixed a similar case for large transactions in  
commit f95d53eded where the output plugin filters all or most of the  
changes but missed to handle the DDLs.  
  
We decided not to backpatch this as this adds a new callback in the  
existing exposed structure and moreover, users can increase the  
wal_sender_timeout and wal_receiver_timeout to avoid this problem.  
  
Author: Wang wei, Hou Zhijie  
Reviewed-by: Peter Smith, Ashutosh Bapat, Shi yu, Amit Kapila  
Discussion: https://postgr.es/m/OS3PR01MB6275478E5D29E4A563302D3D9E2B9@OS3PR01MB6275.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/CAA5-nLARN7-3SLU_QUxfy510pmrYK6JJb=bk3hcgemAM_pAv+w@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/replication/reorderbuffer.h
M src/tools/pgindent/typedefs.list

Rethink nullingrel marking rules in build_joinrel_tlist().

commit   : fee7b77b9000f35e445de9954a8cbf241f181e60    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2023 18:26:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2023 18:26:16 -0500    

Click here for diff

The logic for when to add the current outer join's own relid  
to the nullingrels sets of output Vars and PHVs was overly  
complicated and underly correct.  Not sure why I didn't think  
of this before, but since what we want is marking per the  
syntactic structure, we can just consult our records about  
the syntactic structure, ie syn_righthand/syn_lefthand.  
  
Also, tighten the rule about when to add the commute_above_r  
bits, in hopes of eliminating some squishy reasoning.  I do not  
know of a reason to think that that's broken as-is, but this way  
seems better.  
  
Per bug #17781 from Robins Tharakan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/relnode.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Doc: make src/test/*/README match current reality.

commit   : e2c78e7ab4b6056ceb79415fddcf126868d028f5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2023 14:30:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2023 14:30:30 -0500    

Click here for diff

Commit c3382a3c3, which moved the implementation of PG_TEST_EXTRA  
from src/test/Makefile into individual test scripts, broke the  
directions given in the subdirectory README files about how to run  
these tests by hand.  Update.  Also mention wal_consistency_checking  
in recovery/README --- that omission isn't the fault of c3382a3c3,  
but it's still an omission.  

M src/test/kerberos/README
M src/test/ldap/README
M src/test/recovery/README
M src/test/ssl/README

Remove leftover code in deconstruct_distribute_oj_quals().

commit   : 2cbbffff05b853733ae19ca7047cfeb9a346a497    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2023 11:56:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Feb 2023 11:56:43 -0500    

Click here for diff

The initial "put back OJ relids" adjustment of ojscope was  
incorrect and unnecessary; it seems to be a leftover from  
when I (tgl) was trying to get this function to work at all.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4-L2C47ZGZPabBAi5oDZsKmsbvhYcGCy5o=gCjsaG_ZQA@mail.gmail.com  

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

Remove useless casts to (void *) in arguments of some system functions

commit   : aa6954104644334c53838f181053b9f7aa13f58c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Feb 2023 06:53:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Feb 2023 06:53:05 +0100    

Click here for diff

The affected functions are: bsearch, memcmp, memcpy, memset, memmove,  
qsort, repalloc  
  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/fd9adf5d-b1aa-e82f-e4c7-263c30145807%40enterprisedb.com  

M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_uuid.c
M contrib/citext/citext.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_tool.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M doc/src/sgml/xfunc.sgml
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistutil.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/catalog/dependency.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/analyze.c
M src/backend/commands/collationcmds.c
M src/backend/commands/vacuum.c
M src/backend/executor/nodeTidscan.c
M src/backend/nodes/tidbitmap.c
M src/backend/partitioning/partbounds.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/ipc/procarray.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_utils.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/function.c
M src/bin/pgbench/pgbench.c
M src/tutorial/funcs.c

Use appropriate wait event when sending data in the apply worker.

commit   : d9d7fe68d35e1e10c7c8276d07f5abf9c477cb13    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 7 Feb 2023 09:58:19 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 7 Feb 2023 09:58:19 +0530    

Click here for diff

Currently, we reuse WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE in the  
apply worker while sending data to the parallel apply worker via a shared  
memory queue. This is not appropriate as one won't be able to distinguish  
whether the worker is waiting for sending data or for the state change.  
  
To patch instead uses the wait event WAIT_EVENT_MQ_SEND which has been  
already used in blocking mode while sending data via a shared memory  
queue.  
  
Author: Hou Zhijie  
Reviewed-by: Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB57161C680B22E4C591628EE994DA9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

More refactoring of heapgettup() and heapgettup_pagemode()

commit   : cfcf56f92398c2827fcca9406e7c7ea6caab83c2    
  
author   : David Rowley <[email protected]>    
date     : Tue, 7 Feb 2023 17:24:07 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 7 Feb 2023 17:24:07 +1300    

Click here for diff

Here we further simplify the code in heapgettup() and  
heapgettup_pagemode() to make better use of the helper functions added in  
the previous recent refactors in this area.  
  
In passing, remove an unneeded cast added in 8ca6d49f6.  
  
Author: Melanie Plageman  
Reviewed-by: Andres Freund, David Rowley  
Discussion: https://postgr.es/m/CAAKRu_YSOnhKsDyFcqJsKtBSrd32DP-jjXmv7hL0BPD-z0TGXQ@mail.gmail.com  

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

Include values of A_Const nodes in query jumbling

commit   : 9ba37b2cb6a174b37fc51d0649ef73e56eae27fc    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 7 Feb 2023 09:03:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 7 Feb 2023 09:03:54 +0900    

Click here for diff

Like the implementation for node copy, write and read, this node  
requires a custom implementation so as the query jumbling is able to  
consider the correct value assigned to it, depending on its type (int,  
float, bool, string, bitstring).  
  
Based on a dump of pg_stat_statements from the regression database, this  
would confuse the query jumbling of the following queries:  
- SET.  
- COPY TO with SELECT queries.  
- START TRANSACTION with different isolation levels.  
- ALTER TABLE with default expressions.  
- CREATE TABLE with partition bounds.  
  
Note that there may be a long-term argument in tracking the location of  
such nodes so as query strings holding such nodes could be normalized,  
but this is left as a separate discussion.  
  
Oversight in 3db72eb.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
M src/backend/nodes/queryjumblefuncs.c
M src/include/nodes/parsenodes.h

ci: freebsd: stop postgres instance on failure, to prevent log upload failures

commit   : 209f0f0e8516dfb382afdd2375c8b84c912dc420    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 6 Feb 2023 15:41:38 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 6 Feb 2023 15:41:38 -0800    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

Fix more outdated comments

commit   : 6c14fb17e4be70e0f3c03d2f9f6c540b6d5bdcbe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 22:58:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 22:58:44 +0100    

Click here for diff

Same as in f5da3d8 but for write_relcache_init_file(), the comments  
had gotten a bit wrong due to code added over time.  

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

Fix up outdated comments

commit   : f5da3d85b95640ac754ee14c47aeb90003e6d7c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 22:39:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 22:39:48 +0100    

Click here for diff

The existing comments in load_relcache_init_file() were not flexible  
when new entries were added at the end, so they ended up a bit wrong.  
Simplify the comments to avoid this issue.  

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

Fix up join removal's interaction with PlaceHolderVars.

commit   : cad56920513e5b7ccdd3d41b0ea893eb3383f863    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2023 15:44:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Feb 2023 15:44:57 -0500    

Click here for diff

The portion of join_is_removable() that checks PlaceHolderVars  
can be made a little more accurate and intelligible than it was.  
The key point is that we can allow join removal even if a PHV  
mentions the target rel in ph_eval_at, if that mention was only  
added as a consequence of forcing the PHV up to a join level  
that's at/above the outer join we're trying to get rid of.  
We can check that by testing for the OJ's relid appearing in  
ph_eval_at, indicating that it's supposed to be evaluated after  
the outer join, plus the existing test that the contained  
expression doesn't actually mention the target rel.  
  
While here, add an explicit check that there'll be something left  
in ph_eval_at after we remove the target rel and OJ relid.  There  
is an Assert later on about that, and I'm not too sure that the  
case could happen for a PHV satisfying the other constraints,  
but let's just check.  (There was previously a bms_is_subset test  
that meant to cover this risk, but it's broken now because it  
doesn't account for the fact that we'll also remove the OJ relid.)  
  
The real reason for revisiting this code though is that the  
Assert I left behind in 8538519db turns out to be easily  
reachable, because if a PHV of this sort appears in an upper-level  
qual clause then that clause's clause_relids will include the  
PHV's ph_eval_at relids.  This is a mirage though: we have or soon  
will remove these relids from the PHV's ph_eval_at, and therefore  
they no longer belong in qual clauses' clause_relids either.  
Remove that Assert in join_is_removable, and replace the similar  
one in remove_rel_from_query with code to remove the deleted relids  
from clause_relids.  
  
Per bug #17773 from Robins Tharakan.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Fix SQL keywords lists

commit   : 7ba09efe248fe5e15bd6d4c4d0612ea63b66a860    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 17:54:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 17:54:10 +0100    

Click here for diff

Some keywords were listed as both reserved and nonreserved.  Fix as  
appropriate.  

M doc/src/sgml/keywords/sql2016-02-reserved.txt

Disable STARTUP_PROGRESS_TIMEOUT in standby mode.

commit   : 8a2f783cc489e4e1820163c1c439125aad4d7a92    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 6 Feb 2023 10:51:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 6 Feb 2023 10:51:08 -0500    

Click here for diff

In standby mode, we don't actually report progress of recovery,  
but up until now, startup_progress_timeout_handler() nevertheless  
got called every log_startup_progress_interval seconds. That's  
an unnecessary expense, so avoid it.  
  
Report by Thomas Munro. Patch by Bharath Rupireddy, reviewed by  
Simon Riggs, Thomas Munro, and me. Back-patch to v15, where  
the problem was introduced.  
  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGKCHSffAj8zZJKJvNX7ygnQFxVD6wm1d-2j3fVw%2BMafPQ%40mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/postmaster/startup.c
M src/include/postmaster/startup.h

doc: Fix description of SQL standard parts

commit   : 0ae4e49fa66342b7c6294a6534db51284f5385b7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 14:01:16 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 14:01:16 +0100    

Click here for diff

The splitting into parts actually started earlier than the text had  
claimed, but that is ancient history anyway by now and does not need  
to be mentioned.  Update that and tweak the text a bit.  

M doc/src/sgml/features.sgml

Remove useless casts to (void *) in hash_search() calls

commit   : 54a177a948b0a773c25c6737d1cc3cc49222a526    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 09:05:20 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Feb 2023 09:05:20 +0100    

Click here for diff

Some of these appear to be leftovers from when hash_search() took a  
char * argument (changed in 5999e78fc45dcb91784b64b6e9ae43f4e4f68ca2).  
  
Since after this there is some more horizontal space available, do  
some light reformatting where suitable.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/fd9adf5d-b1aa-e82f-e4c7-263c30145807%40enterprisedb.com  

M contrib/postgres_fdw/shippable.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/storage.c
M src/backend/optimizer/util/predtest.c
M src/backend/parser/parse_oper.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/time/combocid.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c

Extend check_GUC_init() with checks on flag combinations when loading GUCs

commit   : 009f8d17146da72478fcb8f544b793c443fa254c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Feb 2023 15:22:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Feb 2023 15:22:04 +0900    

Click here for diff

This extends the work begun by a73952b, with the addition of a GUC check  
for flag combinations in check_GUC_init(), making sure that anything  
defined with GUC_NO_SHOW_ALL also includes GUC_NOT_IN_SAMPLE, as first  
step.  There has never been any GUCs of this kind in the core code, and  
this combination makes little sense as a parameter marked as not fit for  
SHOW ALL should not be hidden in postgresql.conf.sample.  
  
Note that GUCs marked with GUC_NO_SHOW_ALL are not listed under  
pg_settings or SHOW ALL (still they can be queried individually), making  
them unfit for checks via SQL queries in the regression tests that do a  
full scan of the parameters available.  The SQL tests are still a bit  
incorrect about that, and will be cleaned up in a separate commit.  We  
have also discussed the possibility to extend the SQL functions for GUCs  
so as they could show more information about parameters defined with  
GUC_NO_SHOW_ALL, though it has been concluded that this is not worth the  
extra complication in the long run, an enforced policy at initialization  
time being enough to do the same job.  
  
Per discussion with Nitin Jadhav and Tom Lane.  
  
Discussion: https://postgr.es/m/CAMm1aWaYe0muu3ABo7iSAgK+OWDS9yNe8GGRYnCyeEpScYKa+g@mail.gmail.com  

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

Add support for progress reporting to pg_verifybackup

commit   : d07c2948bfe577cfeaa4eb564c5e62bcb6cb1955    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Feb 2023 14:40:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Feb 2023 14:40:31 +0900    

Click here for diff

This adds a new option to pg_verifybackup called -P/--progress, showing  
every second some information about the progress of the checksum  
verification based on the data of a backup manifest.  
  
Similarly to what is done for pg_rewind and pg_basebackup, the  
information printed in the progress report consists of the current  
amount of data computed and the total amount of data that will be  
computed.  Note that files found with an incorrect size do not have  
their checksum verified, hence their size is not appended to the total  
amount of data estimated during the first scan of the manifest data  
(such incorrect sizes could be overly high, for one, falsifying the  
progress report).  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoC5+JOgMd4o3z_oxw0f8JDSsCYY7zSbhe-O9x7f33rw_A@mail.gmail.com  

M doc/src/sgml/ref/pg_verifybackup.sgml
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/t/004_options.pl

Properly NULL-terminate GSS receive buffer on error packet reception

commit   : 71c37797d7bd78266146a5829ab62b3687c47295    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Feb 2023 11:20:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Feb 2023 11:20:07 +0900    

Click here for diff

pqsecure_open_gss() includes a code path handling error messages with  
v2-style protocol messages coming from the server.  The client-side  
buffer holding the error message does not force a NULL-termination, with  
the data of the server getting copied to the errorMessage of the  
connection.  Hence, it would be possible for a server to send an  
unterminated string and copy arbitrary bytes in the buffer receiving the  
error message in the client, opening the door to a crash or even data  
exposure.  
  
As at this stage of the authentication process the exchange has not been  
completed yet, this could be abused by an attacker without Kerberos  
credentials.  Clients that have a valid kerberos cache are vulnerable as  
libpq opportunistically requests for it except if gssencmode is  
disabled.  
  
Author: Jacob Champion  
Backpatch-through: 12  
Security: CVE-2022-41862  

M src/interfaces/libpq/fe-secure-gssapi.c

Revert refactoring of restore command code to shell_restore.c

commit   : 2f6e15ac93c58c1140e4a4affe61e78f7346497a    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Feb 2023 08:28:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Feb 2023 08:28:42 +0900    

Click here for diff

This reverts commits 24c35ec and 57169ad.  PreRestoreCommand() and  
PostRestoreCommand() need to be put closer to the system() call calling  
a restore_command, as they enable in_restore_command for the startup  
process which would in turn trigger an immediate proc_exit() in the  
SIGTERM handler.  Perhaps we could get rid of this behavior entirely,  
but 24c35ec has made the window where the flag is enabled much larger  
than it was, and any Postgres-like actions (palloc, etc.) taken by code  
paths while the flag is enabled could lead to more severe issues in the  
shutdown processing.  
  
Note that curculio has showed that there are much more problems in this  
area, unrelated to this change, actually, hence the issues related to  
that had better be addressed first.  Keeping the code of HEAD in line  
with the stable branches should make that a bit easier.  
  
Per discussion with Andres Freund and Nathan Bossart.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/Makefile
M src/backend/access/transam/meson.build
D src/backend/access/transam/shell_restore.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/common/Makefile
A src/common/archive.c
M src/common/meson.build
M src/fe_utils/archive.c
M src/include/access/xlogarchive.h
A src/include/common/archive.h
M src/tools/msvc/Mkvcbuild.pm

Fix over-optimistic updating of info about commutable outer joins.

commit   : b2d0e13a0a4c31167d01e9871f907060c80b8fae    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Feb 2023 14:25:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Feb 2023 14:25:10 -0500    

Click here for diff

make_outerjoininfo was set up to update SpecialJoinInfo's  
commute_below, commute_above_l, commute_above_r fields as soon as  
it found a pair of outer joins that look like they can commute.  
However, this decision could be negated later in the same loop due  
to finding an intermediate outer join that prevents commutation.  
That left us with commute_xxx fields that were contradictory to the  
join order restrictions expressed in min_lefthand/min_righthand.  
The latter fields would keep us from actually choosing a bad join  
order; but the inconsistent commute_xxx fields could bollix details  
such as the varnullingrels values created for intermediate join  
relation targetlists, ending in an assertion failure in setrefs.c.  
  
To fix, wait till the end of make_outerjoininfo where we have  
accurate values for min_lefthand/min_righthand, and then insert  
only relids not present in those sets into the commute_xxx fields.  
  
Per SQLSmith testing by Robins Tharakan.  Note that while Robins  
bisected the failure to commit b448f1c8d, it's really the fault of  
2489d76c4.  The outerjoin_delayed logic removed in the later commit  
was keeping us from deciding that troublesome join pairs commute,  
at least in the specific example seen here.  
  
Discussion: https://postgr.es/m/CAEP4nAyAORgE8K_RHSmvWbE9UaChhjbEL1RrDU3neePwwRUB=A@mail.gmail.com  

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

Fix thinko in qual distribution.

commit   : 9f452feeeb830534dc2ce743a2a14b109128326d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Feb 2023 17:40:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Feb 2023 17:40:35 -0500    

Click here for diff

deconstruct_distribute tweaks the outer join scope (ojscope)  
it passes to distribute_qual_to_rels when considering an outer  
join qual that's above potentially-commutable outer joins.  
However, if the current join is *not* potentially commutable,  
we shouldn't do that.  The argument that distribute_qual_to_rels  
will not do something wrong with the bogus ojscope falls flat  
if we don't pass it non-null postponed_oj_qual_list.  Moreover,  
there's no need to play games in this case since we aren't going  
to commute anything.  
  
Per SQLSmith testing by Robins Tharakan.  
  
Discussion: https://postgr.es/m/CAEP4nAw74k4b-=93gmfCNX3MOY3y4uPxqbk_MnCVEpdsqHJVsg@mail.gmail.com  

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

Fix thinko in outer-join removal.

commit   : 8538519db107777a6b06b7277185e6605caf8d4c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Feb 2023 15:19:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Feb 2023 15:19:54 -0500    

Click here for diff

If we have a RestrictInfo that mentions both the removal-candidate  
relation and the outer join's relid, then that is a pushed-down  
condition not a join condition, so it should be grounds for deciding  
that we can't remove the outer join.  In commit 2489d76c4, I'd blindly  
included the OJ's relid into "joinrelids" as per the new standard  
convention, but the checks of attr_needed and ph_needed should only  
allow the join's input rels to be mentioned.  
  
Having done that, the check for references in pushed-down quals  
a few lines further down should be redundant.  I left it in place  
as an Assert, though.  
  
While researching this I happened across a couple of comments that  
worried about the effects of update_placeholder_eval_levels.  
That's gone as of b448f1c8d, so we can remove some worry.  
  
Per bug #17769 from Robins Tharakan.  The submitted test case  
triggers this more or less accidentally because we flatten out  
a LATERAL sub-select after we've done join strength reduction;  
if we did that in the other order, this problem would be masked  
because the outer join would get simplified to an inner join.  
To ensure that the committed test case will continue to test  
what it means to even if we make that happen someday, use a  
test clause involving COALESCE(), which will prevent us from  
using it to do join strength reduction.  
  
Patch by me, but thanks to Richard Guo for initial investigation.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rethink treatment of "postponed" quals in deconstruct_jointree().

commit   : 5840c2027264d5dfad743c50874e0ebf8b840f3f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Feb 2023 12:45:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Feb 2023 12:45:53 -0500    

Click here for diff

After pulling up LATERAL subqueries, we may have qual clauses that  
refer to relations outside their syntactic scope.  Before doing any  
such pullup, prepjointree.c checks to make sure that it wouldn't  
create a semantically-invalid situation; but we leave it to  
deconstruct_jointree() to actually move these quals up the join  
tree to a place where they can be evaluated.  In commit 2489d76c4,  
I (tgl) refactored deconstruct_jointree() in a way that caused  
assertion failures while moving such quals, because the new logic  
failed to distinguish "this jointree node is a parent of the source  
one" from "this jointree node is processed after the source  
one in depth-first order".  
  
Fix this, and at the same time reduce the overhead a bit, by  
getting rid of the common PostponedQual list and instead making each  
JoinTreeItem contain a list of quals that needed to be postponed to  
its level.  We can help distribute_qual_to_rels find the appropriate  
JoinTreeItem efficiently by adding parent-item links to the  
JoinTreeItem data structure.  This ends up being the same number  
of relid subset checks as the original (pre-bug) logic, but less  
list manipulation is required during multi-level postponements.  
  
Richard Guo and Tom Lane, per bug #17768 from Robins Tharakan.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Allow underscores in integer and numeric constants.

commit   : faff8f8e47f18c7d589453e2e0d841d2bd96c1ac    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 4 Feb 2023 09:48:51 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 4 Feb 2023 09:48:51 +0000    

Click here for diff

This allows underscores to be used in integer and numeric literals,  
and their corresponding type input functions, for visual grouping.  
For example:  
  
    1_500_000_000  
    3.14159_26535_89793  
    0xffff_ffff  
    0b_1001_0001  
  
A single underscore is allowed between any 2 digits, or immediately  
after the base prefix indicator of non-decimal integers, per SQL:202x  
draft.  
  
Peter Eisentraut and Dean Rasheed  
  
Discussion: https://postgr.es/m/84aae844-dc55-a4be-86d9-4f0fa405cc97%40enterprisedb.com  

M doc/src/sgml/syntax.sgml
M src/backend/catalog/sql_features.txt
M src/backend/parser/parse_node.c
M src/backend/parser/scan.l
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/pl/plpgsql/src/expected/plpgsql_trap.out
M src/pl/plpgsql/src/sql/plpgsql_trap.sql
M src/test/regress/expected/int2.out
M src/test/regress/expected/int4.out
M src/test/regress/expected/int8.out
M src/test/regress/expected/numeric.out
M src/test/regress/expected/numerology.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/int2.sql
M src/test/regress/sql/int4.sql
M src/test/regress/sql/int8.sql
M src/test/regress/sql/numeric.sql
M src/test/regress/sql/numerology.sql
M src/test/regress/sql/partition_prune.sql

commit   : 1b6f632a35f8715f8c64e7930adebc7f1d292074    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 4 Feb 2023 07:56:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 4 Feb 2023 07:56:09 +0100    

Click here for diff

These are leftovers obsoleted by  
cfd9be939e9c516243c5b6a49ad1e1a9a38f1052.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/e7887965-9e70-fd01-c2d1-5bc02f9169aa%40enterprisedb.com  

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

Make int64_div_fast_to_numeric() more robust.

commit   : b2d47928908d7a99b8e39198d0e8e9e0cb2b024b    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 3 Feb 2023 11:13:34 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 3 Feb 2023 11:13:34 +0000    

Click here for diff

The prior coding of int64_div_fast_to_numeric() had a number of bugs  
that would cause it to fail under different circumstances, such as  
with log10val2 <= 0, or log10val2 a multiple of 4, or in the "slow"  
numeric path with log10val2 >= 10.  
  
None of those could be triggered by any of our current code, which  
only uses log10val2 = 3 or 6. However, they made it a hazard for any  
future code that might use it. Also, since this is exported by  
numeric.c, users writing their own C code might choose to use it.  
  
Therefore fix, and back-patch to v14, where it was introduced.  
  
Dean Rasheed, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CAEZATCW8gXgW0tgPxPgHDPhVX71%2BSWFRkhnXy%2BTfGDsKLepu2g%40mail.gmail.com  

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

doc: Fix XML formatting that psql cannot handle

commit   : 2010d8b75a6eb0f2ce90ae24cba99775c3d343e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Feb 2023 09:04:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Feb 2023 09:04:35 +0100    

Click here for diff

Breaking <phrase> over two lines is not handled by psql's  
create_help.pl.  (It creates faulty \help output.)  
  
Undo the formatting change introduced by  
9bdad1b5153e5d6b77a8f9c6e32286d6bafcd76d to fix this for now.  

M doc/src/sgml/ref/fetch.sgml
M doc/src/sgml/ref/move.sgml

ci: Use windows VMs instead of windows containers

commit   : 98811323c8e9a1995b828a47504b6608f0f3f59a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 2 Feb 2023 21:31:24 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 2 Feb 2023 21:31:24 -0800    

Click here for diff

So far we have used containers for testing windows on cirrus-ci. Unfortunately  
they come with substantial overhead: First, the container images are pulled  
onto the host on-demand. Due to the large size of windows containers, that  
ends up taking nearly 4 minutes. Secondly, IO is slow, leading to CI runs  
taking long.  
  
Thus switch to windows VMs, improving windows CI times by well over 2x.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI was added  

M .cirrus.yml

Reduce code duplication between heapgettup and heapgettup_pagemode

commit   : 7ae0ab0ad9704b10400a611a9af56c63304c27a5    
  
author   : David Rowley <[email protected]>    
date     : Fri, 3 Feb 2023 16:20:43 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 3 Feb 2023 16:20:43 +1300    

Click here for diff

The code to get the next block number was exactly the same between these  
two functions, so let's just put it into a helper function and call that  
from both locations.  
  
Author: Melanie Plageman  
Reviewed-by: Andres Freund, David Rowley  
Discussion: https://postgr.es/m/CAAKRu_bvkhka0CZQun28KTqhuUh5ZqY=_T8QEqZqOL02rpi2bw@mail.gmail.com  

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

Optimize the origin drop functionality.

commit   : 3e577ff602fe3438ac60771c4a6d027d881619b0    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 3 Feb 2023 08:29:08 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 3 Feb 2023 08:29:08 +0530    

Click here for diff

To interlock against concurrent drops, we use to hold ExclusiveLock on  
pg_replication_origin till xact commit. This blocks even concurrent drops  
of different origins by tablesync workers. So, instead, lock the specific  
origin to interlock against concurrent drops.  
  
This reduces the test time variability in src/test/subscription where  
multiple tables are being synced.  
  
Author: Vignesh C  
Reviewed-by: Hou Zhijie, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

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

ci: Upgrade macOS version from 12 to 13.

commit   : 2e9f120b657e540b36843dbb075dab196e79fbfd    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 3 Feb 2023 14:26:54 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 3 Feb 2023 14:26:54 +1300    

Click here for diff

Back-patch to 15, where in-tree CI began.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/1441145.1675300332%40sss.pgh.pa.us  

M .cirrus.yml

Add helper functions to simplify heapgettup code

commit   : 8ca6d49f634124e2f77f5c02af244c4ca4a3b1e9    
  
author   : David Rowley <[email protected]>    
date     : Fri, 3 Feb 2023 12:38:42 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 3 Feb 2023 12:38:42 +1300    

Click here for diff

Here we add heapgettup_start_page() and heapgettup_continue_page() to  
simplify the code in the heapgettup() function.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAAKRu_bvkhka0CZQun28KTqhuUh5ZqY=_T8QEqZqOL02rpi2bw@mail.gmail.com  

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

Further refactor of heapgettup and heapgettup_pagemode

commit   : f9bc34fcb664e93d1fa3c3873527dce6f4cc495f    
  
author   : David Rowley <[email protected]>    
date     : Fri, 3 Feb 2023 11:48:39 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 3 Feb 2023 11:48:39 +1300    

Click here for diff

Backward and forward scans share much of the same page acquisition code.  
Here we consolidate that code to reduce some duplication.  
  
Additionally, add a new rs_coffset field to HeapScanDescData to track the  
offset of the current tuple.  The new field fits nicely into the padding  
between a bool and BlockNumber field and saves having to look at the last  
returned tuple to figure out which offset we should be looking at for the  
current tuple.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAAKRu_bvkhka0CZQun28KTqhuUh5ZqY=_T8QEqZqOL02rpi2bw@mail.gmail.com  

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

Retire PG_SETMASK() macro.

commit   : cdf6518ef08ee602b94db4e5ba5887a1d7053c24    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 3 Feb 2023 10:34:56 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 3 Feb 2023 10:34:56 +1300    

Click here for diff

In the 90s we needed to deal with computers that still had the  
pre-standard signal masking APIs.  That hasn't been relevant for a very  
long time on Unix systems, and c94ae9d8 got rid of a remaining  
dependency in our Windows porting code.  PG_SETMASK didn't expose  
save/restore functionality, so we'd already started using sigprocmask()  
directly in places, creating the visual distraction of having two ways  
to spell it.  It's not part of the API that extensions are expected to  
be using (but if they are, the change will be trivial).  It seems like a  
good time to drop the old macro and just call the standard POSIX  
function.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BKfQgrhHP2DLTohX1WwubaCBHmTzGnAEDPZ-Gug-Xskg%40mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walreceiver.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/miscinit.c
M src/include/libpq/pqsignal.h

Document installing perltidy with cpanm

commit   : e0d70a91a04b942980ab06bc471d2b5b65952459    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 2 Feb 2023 08:54:38 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 2 Feb 2023 08:54:38 -0500    

Click here for diff

Installing with plain cpan failed for me recently, as the archive it  
searched has been purged of old releases. However, you can give cpanm a  
complete URL to the exact version you want to install, so document using  
that.  

M src/tools/pgindent/README

Clarify the choice of rscale in numeric_sqrt().

commit   : 0736fc1ceb0659a9f73699910ac56603336daeee    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 2 Feb 2023 09:41:22 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 2 Feb 2023 09:41:22 +0000    

Click here for diff

Improve the comment explaining the choice of rscale in numeric_sqrt(),  
and ensure that the code works consistently when other values of  
NBASE/DEC_DIGITS are used.  
  
Note that, in practice, we always expect DEC_DIGITS == 4, and this  
does not change the computation in that case.  
  
Joel Jacobson and Dean Rasheed  
  
Discussion: https://postgr.es/m/06712c29-98e9-43b3-98da-f234d81c6e49%40app.fastmail.com  

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

Ensure that numeric.c compiles with other NBASE values.

commit   : 9a84f2947bf9345ad6b93ba37da63633649eaea8    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 2 Feb 2023 09:39:08 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 2 Feb 2023 09:39:08 +0000    

Click here for diff

As noted in the comments, support for different NBASE values is really  
only of historical interest, but as long as we're keeping it, we might  
as well make sure that it compiles.  
  
Joel Jacobson  
  
Discussion: https://postgr.es/m/06712c29-98e9-43b3-98da-f234d81c6e49%40app.fastmail.com  

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

Doc: Abstract AF_UNIX sockets don't work on Windows.

commit   : 117d2604c2a59eb853e894410b94b4c453f8bd43    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 2 Feb 2023 18:13:44 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 2 Feb 2023 18:13:44 +1300    

Click here for diff

An early release of AF_UNIX in Windows apparently supported Linux-style  
"abstract" Unix sockets, but they do not seem to work in current Windows  
versions and there is no mention of any of this in the Winsock  
documentation.  Remove the mention of Windows from the documentation.  
  
Back-patch to 14, where commit c9f0624b landed.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKrYbSZhrk4NGfoQGT_3LQS5pC5KNE1g0tvE_pPBZ7uew%40mail.gmail.com  

M doc/src/sgml/config.sgml

Allow the logical_replication_mode to be used on the subscriber.

commit   : 9f2213a7c575bae43a2d41abc8b60770066ca81c    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 2 Feb 2023 08:15:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 2 Feb 2023 08:15:18 +0530    

Click here for diff

Extend the existing developer option 'logical_replication_mode' to help  
test the parallel apply of large transactions on the subscriber.  
  
When set to 'buffered', the leader sends changes to parallel apply workers  
via a shared memory queue. When set to 'immediate', the leader serializes  
all changes to files and notifies the parallel apply workers to read and  
apply them at the end of the transaction.  
  
This helps in adding tests to cover the serialization code path in  
parallel streaming mode.  
  
Author: Hou Zhijie  
Reviewed-by: Peter Smith, Kuroda Hayato, Sawada Masahiko, Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1+wyN6zpaHUkCLorEWNx75MG0xhMwcFhvjqm2KURZEAGw@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/replication/logical/applyparallelworker.c
M src/backend/utils/misc/guc_tables.c
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

Refactor heapam.c adding heapgettup_initial_block function

commit   : fb1a59de0c52609653166aafc6ce8679a9cfe54b    
  
author   : David Rowley <[email protected]>    
date     : Thu, 2 Feb 2023 14:17:15 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 2 Feb 2023 14:17:15 +1300    

Click here for diff

Here we adjust heapgettup() and heapgettup_pagemode() to move the code  
that fetches the first block number to scan out into a helper function.  
This removes some code duplication.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAAKRu_bvkhka0CZQun28KTqhuUh5ZqY=_T8QEqZqOL02rpi2bw@mail.gmail.com  

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

meson: Fix typo in pkgconfig generation

commit   : 253432f42661fdd67d235252949e2838aa6421fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Feb 2023 18:14:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Feb 2023 18:14:01 +0100    

Click here for diff

Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/07b37c70-349a-8fcd-bcc9-6c3ce0f6c2a4%40enterprisedb.com  

M src/interfaces/ecpg/ecpglib/meson.build

Simplify main waiting loop of the archiver process

commit   : 38cc08546459a9052b6ed43cdb28973288db38c6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Feb 2023 15:46:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Feb 2023 15:46:04 +0900    

Click here for diff

As coded, the timeout given to WaitLatch() was always equal to  
PGARCH_AUTOWAKE_INTERVAL, as time() was called two times repeatedly.  
This simplification could have been done in d75288f.  
  
While on it, this adjusts a comment in pgarch.c to describe the archiver  
in a more neutral way.  
  
Author: Sravan Kumar, Nathan Bossart  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CA+=NbjjqYE9-Lnw7H7DAiS5jebmoMikwZQb_sBP7kgBCn9q6Hg@mail.gmail.com  

M src/backend/postmaster/pgarch.c

commit   : fbed4bc59e362e13fb0d0e0b08c995c18c7e4d5a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 31 Jan 2023 17:36:39 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 31 Jan 2023 17:36:39 -0800    

Click here for diff

Thanks to Robins to find the issue and Nathan for promptly writing a test case  
to prevent future problems like this.  
  
Reported-by: Nathan Bossart <[email protected]>  
Reported-by: Robins Tharakan <[email protected]>  
Author: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/20230130193008.GA2740781@nathanxps13  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/dblink/sql/dblink.sql

Try to fix pg_upgrade test on Windows, again.

commit   : c2891175052772b603da6d0ae634e42b63b7f274    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 1 Feb 2023 14:29:51 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 1 Feb 2023 14:29:51 +1300    

Click here for diff

Further to commit 54e72b66e, if rmtree() fails while cleaning up in  
pg_upgrade, try again.  This gives our Windows unlink() wrapper a chance  
to reach its wait-for-the-other-process-to-go-away logic, if the first  
go around initiated the unlink of a file that a concurrently exiting  
program still has open.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKCVy2%3Do%3Dd8c2Va6a_3Rpf_KkhUitkWCZ3hzuO2VwLMXA%40mail.gmail.com  

M src/bin/pg_upgrade/util.c

Update time zone data files to tzdata release 2022g.

commit   : 758f44bc3a365bed6b82db098bebc26ef441ba42    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Jan 2023 17:36:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Jan 2023 17:36:55 -0500    

Click here for diff

DST law changes in Greenland and Mexico.  Notably, a new timezone  
America/Ciudad_Juarez has been split off from America/Ojinaga.  
  
Historical corrections for northern Canada, Colombia, and Singapore.  

M src/timezone/data/tzdata.zi

Remove dead NoMovementScanDirection code

commit   : e9aaf06328c7f962f8586618981e9763d31402a3    
  
author   : David Rowley <[email protected]>    
date     : Wed, 1 Feb 2023 10:52:41 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 1 Feb 2023 10:52:41 +1300    

Click here for diff

Here remove some dead code from heapgettup() and heapgettup_pagemode()  
which was trying to support NoMovementScanDirection scans.  This code can  
never be reached as standard_ExecutorRun() never calls ExecutePlan with  
NoMovementScanDirection.  
  
Additionally, plans which were scanning an unordered index would use  
NoMovementScanDirection rather than ForwardScanDirection.  There was no  
real need for this, so here we adjust this so we use ForwardScanDirection  
for unordered index scans.  A comment in pathnodes.h claimed that  
NoMovementScanDirection was used for PathKey reasons, but if that was  
true, it no longer is, per code in build_index_paths().  
  
This does change the non-text format of the EXPLAIN output so that  
unordered index scans now have a "Forward" scan direction rather than  
"NoMovement".  The text format of EXPLAIN has not changed.  
  
Author: Melanie Plageman  
Reviewed-by: Tom Lane, David Rowley  
Discussion: https://postgr.es/m/CAAKRu_bvkhka0CZQun28KTqhuUh5ZqY=_T8QEqZqOL02rpi2bw@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/commands/explain.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/access/sdir.h
M src/include/access/tableam.h
M src/include/nodes/pathnodes.h

Doc: clarify use of NULL to drop comments and security labels.

commit   : 856ca51a23b56df6aab3ee9bffc66334b79be355    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Jan 2023 14:32:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Jan 2023 14:32:24 -0500    

Click here for diff

This was only mentioned in the description of the text/label, which  
are marked as being in quotes in the synopsis, which can cause  
confusion (as witnessed on IRC).  
  
Also separate the literal and NULL cases in the parameter list, per  
suggestion from Tom Lane.  
  
Also add an example of dropping a security label.  
  
Dagfinn Ilmari Mannsåker, with some tweaks by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/security_label.sgml

Remove over-optimistic Assert.

commit   : eae0e20deffb0a73f7cb0e94746f94a1347e71b1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Jan 2023 11:57:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Jan 2023 11:57:47 -0500    

Click here for diff

In commit 2489d76c4, I'd thought it'd be safe to assert that a  
PlaceHolderVar appearing in a scan-level expression has empty  
nullingrels.  However this is not so, as when we determine that a  
join relation is certainly empty we'll put its targetlist into a  
Result-with-constant-false-qual node, and nothing is done to adjust  
the nullingrels of the Vars or PHVs therein.  (Arguably, a Result  
used in this way isn't really a scan-level node, but it certainly  
isn't an upper node either ...)  
  
It's not clear this is worth any close analysis, so let's just  
take out the faulty Assert.  
  
Per report from Robins Tharakan.  I added a test case based on  
his example, just in case somebody tries to tighten this up.  
  
Discussion: https://postgr.es/m/CAEP4nAz7Enq3+DEthGG7j27DpuwSRZnW0Nh6jtNh75yErQ_nbA@mail.gmail.com  

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

Generate code for query jumbling through gen_node_support.pl

commit   : 3db72ebcbe20debc6552500ee9ccb4b2007f12f8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 31 Jan 2023 15:24:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 31 Jan 2023 15:24:05 +0900    

Click here for diff

This commit changes the query jumbling code in queryjumblefuncs.c to be  
generated automatically based on the information of the nodes in the  
headers of src/include/nodes/ by using gen_node_support.pl.  This  
approach offers many advantages:  
- Support for query jumbling for all the utility statements, based on the  
state of their parsed Nodes and not only their query string.  This will  
greatly ease the switch to normalize the information of some DDLs, like  
SET or CALL for example (this is left unchanged and should be part of a  
separate discussion).  With this feature, the number of entries stored  
for utilities in pg_stat_statements is reduced (for example now  
"CHECKPOINT" and "checkpoint" mean the same thing with the same query  
ID).  
- Documentation of query jumbling directly in the structure definition  
of the nodes.  Since this code has been introduced in pg_stat_statements  
and then moved to code, the reasons behind the choices of what should be  
included in the jumble are rather sparse.  Note that some explanation is  
added for the most relevant parts, as a start.  
- Overall code reduction and more consistency with the other parts  
generating read, write and copy depending on the nodes.  
  
The query jumbling is controlled by a couple of new node attributes,  
documented in nodes/nodes.h:  
- custom_query_jumble, to mark a Node as having a custom  
implementation.  
- no_query_jumble, to ignore entirely a Node.  
- query_jumble_ignore, to ignore a field in a Node.  
- query_jumble_location, to mark a location in a Node, for  
normalization.  This can apply only to int fields, with "location" in  
their name (only Const as of this commit).  
  
There should be no compatibility impact on pg_stat_statements, as the  
new code applies the jumbling to the same fields for each node (its  
regression tests have no modification, for one).  
  
Some benchmark of the query jumbling between HEAD and this commit for  
SELECT and DMLs has proved that this new code does not cause a  
performance regression, with computation times close for both methods.  
For utility queries, the new method is slower than the previous method  
of calculating a hash of the query string, though we are talking about  
extra ns-level changes based on what I measured, which is unnoticeable  
even for OLTP workloads as a query ID is calculated once per query  
post-parse analysis.  
  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/Y5BHOUhX3zTH/[email protected]  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
M src/backend/nodes/README
M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/meson.build
M src/backend/nodes/queryjumblefuncs.c
M src/include/nodes/bitmapset.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h

Remove recovery test 011_crash_recovery.pl

commit   : 8c1cd726c5d997d5d170505ec15a2dc1dfe81d6a    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 31 Jan 2023 12:46:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 31 Jan 2023 12:46:56 +0900    

Click here for diff

This test has been added as of 857ee8e that has introduced the SQL  
function txid_status(), with the purpose of checking that a transaction  
ID still in-progress during a crash is correctly marked as aborted after  
recovery finishes.  
  
This test is unstable, and some configuration scenarios may that easier  
to reproduce (wal_level=minimal, wal_compression=on) because the WAL  
holding the information about the in-progress transaction ID may not  
have made it to disk yet, hence a post-crash recovery may cause the same  
XID to be reused, triggering a test failure.  
  
We have discussed a few approaches, like making this function force a  
WAL flush to make it reliable across crashes, but we don't want to pay a  
performance penalty in some scenarios, as well.  The test could have  
been tweaked to enforce a checkpoint but that actually breaks the  
promise of the test to rely on a stable result of txid_status() after  
a crash.  
  
This issue has been reported a few times across the past years, with an  
original report from Kyotaro Horiguchi.  The buildfarm machines tanager,  
hachi and gokiburi enable wal_compression, and fail on this test  
periodically.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/test/recovery/meson.build
D src/test/recovery/t/011_crash_recovery.pl

Refactor rmtree() to use get_dirent_type().

commit   : 54e72b66ed1a55c2fa558bc60d534bdc61dbb62f    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 31 Jan 2023 13:07:44 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 31 Jan 2023 13:07:44 +1300    

Click here for diff

Switch to get_dirent_type() instead of lstat() while traversing a  
directory tree, to see if that fixes the intermittent ENOTEMPTY failures  
seen in recent pg_upgrade tests, on Windows CI.  While refactoring, also  
use AllocateDir() instead of opendir() in the backend, which knows how  
to handle descriptor pressure.  
  
Our CI system currently uses Windows Server 2019, a version known not to  
have POSIX unlink semantics enabled by default yet, unlike typical  
Windows 10 and 11 systems.  That might explain why we see this flapping  
on CI but (apparently) not in the build farm, though the frequency is  
quite low.  
  
The theory is that some directory entry must be in state  
STATUS_DELETE_PENDING, which lstat() would report as ENOENT, though  
unfortunately we don't know exactly why yet.  With this change, rmtree()  
will not skip them, and try to unlink (again).  Our unlink() wrapper  
should either wait a short time for them to go away when some other  
process closes the handle, or log a message to tell us the path of the  
problem file if not, so we can dig further.  
  
Discussion: https://postgr.es/m/20220919213217.ptqfdlcc5idk5xup%40awork3.anarazel.de  

M src/common/rmtree.c

Invent "join domains" to replace the below_outer_join hack.

commit   : 3bef56e11650a33f70adeb6dd442bc2b48bb9b72    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2023 13:50:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2023 13:50:25 -0500    

Click here for diff

EquivalenceClasses are now understood as applying within a "join  
domain", which is a set of inner-joined relations (possibly underneath  
an outer join).  We no longer need to treat an EC from below an outer  
join as a second-class citizen.  
  
I have hopes of eventually being able to treat outer-join clauses via  
EquivalenceClasses, by means of only applying deductions within the  
EC's join domain.  There are still problems in the way of that, though,  
so for now the reconsider_outer_join_clause logic is still here.  
  
I haven't been able to get rid of RestrictInfo.is_pushed_down either,  
but I wonder if that could be recast using JoinDomains.  
  
I had to hack one test case in postgres_fdw.sql to make it still test  
what it was meant to, because postgres_fdw is inconsistent about  
how it deals with quals containing non-shippable expressions; see  
https://postgr.es/m/[email protected].  That should  
be improved, but I don't think it's within the scope of this patch  
series.  
  
Patch by me; thanks to Richard Guo for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h

Do assorted mop-up in the planner.

commit   : b448f1c8d83f8b65e2f0080c556ee21a7076da25    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2023 13:44:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2023 13:44:36 -0500    

Click here for diff

Remove RestrictInfo.nullable_relids, along with a good deal of  
infrastructure that calculated it.  One use-case for it was in  
join_clause_is_movable_to, but we can now replace that usage with  
a check to see if the clause's relids include any outer join  
that can null the target relation.  The other use-case was in  
join_clause_is_movable_into, but that test can just be dropped  
entirely now that the clause's relids include outer joins.  
Furthermore, join_clause_is_movable_into should now be  
accurate enough that it will accept anything returned by  
generate_join_implied_equalities, so we can restore the Assert  
that was diked out in commit 95f4e59c3.  
  
Remove the outerjoin_delayed mechanism.  We needed this before to  
prevent quals from getting evaluated below outer joins that should  
null some of their vars.  Now that we consider varnullingrels while  
placing quals, that's taken care of automatically, so throw the  
whole thing away.  
  
Teach remove_useless_result_rtes to also remove useless FromExprs.  
Having done that, the delay_upper_joins flag serves no purpose any  
more and we can remove it, largely reverting 11086f2f2.  
  
Use constant TRUE for "dummy" clauses when throwing back outer joins.  
This improves on a hack I introduced in commit 6a6522529.  If we  
have a left-join clause l.x = r.y, and a WHERE clause l.x = constant,  
we generate r.y = constant and then don't really have a need for the  
join clause.  But we must throw the join clause back anyway after  
marking it redundant, so that the join search heuristics won't think  
this is a clauseless join and avoid it.  That was a kluge introduced  
under time pressure, and after looking at it I thought of a better  
way: let's just introduce constant-TRUE "join clauses" instead,  
and get rid of them at the end.  This improves the generated plans for  
such cases by not having to test a redundant join clause.  We can also  
get rid of the ugly hack used to mark such clauses as redundant for  
selectivity estimation.  
  
Patch by me; thanks to Richard Guo for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/placeholder.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/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/planmain.h
M src/include/optimizer/restrictinfo.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Make Vars be outer-join-aware.

commit   : 2489d76c4906f4461a364ca8ad7e0751ead8aa0d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2023 13:16:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2023 13:16:20 -0500    

Click here for diff

Traditionally we used the same Var struct to represent the value  
of a table column everywhere in parse and plan trees.  This choice  
predates our support for SQL outer joins, and it's really a pretty  
bad idea with outer joins, because the Var's value can depend on  
where it is in the tree: it might go to NULL above an outer join.  
So expression nodes that are equal() per equalfuncs.c might not  
represent the same value, which is a huge correctness hazard for  
the planner.  
  
To improve this, decorate Var nodes with a bitmapset showing  
which outer joins (identified by RTE indexes) may have nulled  
them at the point in the parse tree where the Var appears.  
This allows us to trust that equal() Vars represent the same value.  
A certain amount of klugery is still needed to cope with cases  
where we re-order two outer joins, but it's possible to make it  
work without sacrificing that core principle.  PlaceHolderVars  
receive similar decoration for the same reason.  
  
In the planner, we include these outer join bitmapsets into the relids  
that an expression is considered to depend on, and in consequence also  
add outer-join relids to the relids of join RelOptInfos.  This allows  
us to correctly perceive whether an expression can be calculated above  
or below a particular outer join.  
  
This change affects FDWs that want to plan foreign joins.  They *must*  
follow suit when labeling foreign joins in order to match with the  
core planner, but for many purposes (if postgres_fdw is any guide)  
they'd prefer to consider only base relations within the join.  
To support both requirements, redefine ForeignScan.fs_relids as  
base+OJ relids, and add a new field fs_base_relids that's set up by  
the core planner.  
  
Large though it is, this commit just does the minimum necessary to  
install the new mechanisms and get check-world passing again.  
Follow-up patches will perform some cleanup.  (The README additions  
and comments mention some stuff that will appear in the follow-up.)  
  
Patch by me; thanks to Richard Guo for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/commands/explain.c
M src/backend/executor/execScan.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
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/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteManip.c
M src/backend/utils/adt/selfuncs.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h
M src/include/rewrite/rewriteManip.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/join.sql

Doc: clarify behavior of boolean options in replication commands.

commit   : ec7e053a98f39a9e3c7e6d35f0d2e83933882399    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2023 11:59:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jan 2023 11:59:37 -0500    

Click here for diff

defGetBoolean() allows the "value" part of "option = value"  
syntax to be omitted, in which case it's taken as "true".  
This is acknowledged in our syntax summaries for relevant commands,  
but we don't seem to have documented the actual behavior anywhere.  
Do so for CREATE/ALTER PUBLICATION/SUBSCRIPTION.  Use generic  
boilerplate text for this, with the idea that we can copy-and-paste  
it into other relevant reference pages, whenever someone gets  
around to that.  
  
Peter Smith, edited a bit by me  
  
Discussion: https://postgr.es/m/CAHut+PvwjZfdGt2R8HTXgSZft=jZKymrS8KUg31pS7zqaaWKKw@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml

Ensure that MERGE recomputes GENERATED expressions properly.

commit   : fe9e658f4d7fbc12d2b6a74c4ee90c73e53d68ef    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 30 Jan 2023 10:04:57 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 30 Jan 2023 10:04:57 +0000    

Click here for diff

This fixes a bug that, under some circumstances, would cause MERGE to  
fail to properly recompute expressions for GENERATED STORED columns.  
  
Formerly, ExecInitModifyTable() did not call ExecInitStoredGenerated()  
for a MERGE command, which meant that the generated expressions  
information was not computed until later, when the first merge action  
was executed. However, if the first merge action to execute was an  
UPDATE, then ExecInitStoredGenerated() could decide to skip some some  
generated columns, if the columns on which they depended were not  
updated, which was a problem if the MERGE also contained an INSERT  
action, for which no generated columns should be skipped.  
  
So fix by having ExecInitModifyTable() call ExecInitStoredGenerated()  
for MERGE, and assume that it isn't safe to skip any generated columns  
in a MERGE. Possibly that could be relaxed, by allowing some generated  
columns to be skipped for a MERGE without an INSERT action, but it's  
not clear that it's worth the effort.  
  
Noticed while investigating bug #17759. Back-patch to v15, where MERGE  
was added.  
  
Dean Rasheed, reviewed by Tom Lane.  
  
Discussion:  
  https://postgr.es/m/17759-e76d9bece1b5421c%40postgresql.org  
  https://postgr.es/m/CAEZATCXb_ezoMCcL0tzKwRGA1x0oeE%3DawTaysRfTPq%2B3wNJn8g%40mail.gmail.com  

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

Rename GUC logical_decoding_mode to logical_replication_mode.

commit   : 1e8b61735cfb1a4feb72cb9ea83db690fedbfef1    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 30 Jan 2023 08:02:08 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 30 Jan 2023 08:02:08 +0530    

Click here for diff

Rename the developer option 'logical_decoding_mode' to the more flexible  
name 'logical_replication_mode' because doing so will make it easier to  
extend this option in the future to help test other areas of logical  
replication.  
  
Currently, it is used on the publisher side to allow streaming or  
serializing each change in logical decoding. In the upcoming patch, we are  
planning to use it on the subscriber. On the subscriber, it will allow  
serializing the changes to file and notifies the parallel apply workers to  
read and apply them at the end of the transaction.  
  
We discussed exposing this parameter as a subscription option but  
it did not seem advisable since it is primarily used for testing/debugging  
and there is no other such parameter. We also discussed having separate  
GUCs for publisher and subscriber but for current testing/debugging  
requirements, one GUC is sufficient.  
  
Author: Hou Zhijie  
Reviewed-by: Peter Smith, Kuroda Hayato, Sawada Masahiko, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoAy2c=Mx=FTCs+EwUsf2kQL5MmU3N18X84k0EmCXntK4g@mail.gmail.com  
Discussion: https://postgr.es/m/CAA4eK1+wyN6zpaHUkCLorEWNx75MG0xhMwcFhvjqm2KURZEAGw@mail.gmail.com  

M doc/src/sgml/config.sgml
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/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
M src/tools/pgindent/typedefs.list

Remove unneeded volatile qualifiers from postmaster.c.

commit   : 8d2c1913ed3df9384973399deeb75fc1e55943fe    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 28 Jan 2023 14:57:31 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 28 Jan 2023 14:57:31 +1300    

Click here for diff

Several flags were marked volatile and in some cases used sig_atomic_t  
because they were accessed from signal handlers.  After commit 7389aad6,  
we can just use unqualified bool.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLMoeZNZY6gYdLUQmuoW_a8bKyLvtuZkd_zHcGVOfDzBA%40mail.gmail.com  

M src/backend/postmaster/postmaster.c

Minor GUC code refactoring.

commit   : e4e89eb5bbfdae30349b38344e9c604411174f6b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Jan 2023 12:13:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Jan 2023 12:13:41 -0500    

Click here for diff

Split out "ConfigOptionIsVisible" to perform the privilege  
check for GUC_SUPERUSER_ONLY GUCs (which these days can also  
be read by pg_read_all_settings role members), and move the  
should-we-show-it checks from GetConfigOptionValues to its  
sole caller.  
  
This commit also removes get_explain_guc_options's check of  
GUC_NO_SHOW_ALL, which seems to have got cargo-culted in there.  
While there's no obvious use-case for marking a GUC both  
GUC_EXPLAIN and GUC_NO_SHOW_ALL, if it were set up that way  
one would expect EXPLAIN to show it --- if that's not what  
you want, then don't set GUC_EXPLAIN.  
  
In passing, simplify the loop logic in show_all_settings.  
  
Nitin Jadhav, Bharath Rupireddy, Tom Lane  
  
Discussion: https://postgr.es/m/CAMm1aWYgfekpRK-Jz5=pM_bV+Om=ktGq1vxTZ_dr1Z6MV-qokA@mail.gmail.com  

M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/include/utils/guc_tables.h

Allow multiple --excludes options in pgindent

commit   : a1c4cd6f2c8857fbb78d043a0b3c7d397e48ef2e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 27 Jan 2023 09:38:59 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 27 Jan 2023 09:38:59 -0500    

Click here for diff

This includes a unification of the logic used to find the excludes file  
and the typedefs file.  
  
Also, remove the dangerous and deprecated feature where the first  
non-option argument was taken as a typdefs file if it wasn't a .c or .h  
file, remove some extraneous blank lines, and improve the documentation  
somewhat.  

M src/tools/pgindent/pgindent
M src/tools/pgindent/pgindent.man

meson: Fix installation path computation

commit   : 8f6858064b1442f9ad057d289b0e4f018a2ad8aa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 27 Jan 2023 10:49:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 27 Jan 2023 10:49:17 +0100    

Click here for diff

We have the long-standing logic to append "postgresql" to some  
installation paths if it does not already contain "pgsql" or  
"postgres".  The existing meson implementation of that only considered  
the subdirectory under the prefix, not the prefix itself.  Fix that,  
so that it now works the same way as the implementation in  
Makefile.global.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M meson.build

doc: Adjust a few more references to "postmaster"

commit   : 17e72ec45d313b98bd90b95bc71b4cc77c2c89c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 27 Jan 2023 08:42:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 27 Jan 2023 08:42:08 +0100    

Click here for diff

Reported-by: Karl O. Pinc <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/runtime.sgml

Teach planner about more monotonic window functions

commit   : 456fa635a909ee36f73ca84d340521bd730f265f    
  
author   : David Rowley <[email protected]>    
date     : Fri, 27 Jan 2023 16:08:41 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 27 Jan 2023 16:08:41 +1300    

Click here for diff

9d9c02ccd introduced runConditions for window functions to allow  
monotonic window function evaluation to be made more efficient when the  
window function value went beyond some value that it would never go back  
from due to its monotonic nature.  That commit added prosupport functions  
to inform the planner that row_number(), rank(), dense_rank() and some  
forms of count(*) were monotonic.  Here we add support for ntile(),  
cume_dist() and percent_rank().  
  
Reviewed-by: Melanie Plageman  
Discussion: https://postgr.es/m/CAApHDvqR+VqB8s+xR-24bzJbU8xyFrBszJ17qKgECf7cWxLCaA@mail.gmail.com  

M src/backend/utils/adt/windowfuncs.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Fix behavior with pg_restore -l and compressed dumps

commit   : 783d8abc3b63267194ca21b679caf8d152b93358    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Jan 2023 10:19:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Jan 2023 10:19:50 +0900    

Click here for diff

pg_restore -l has always been able to read the TOC data of a dump even  
if its binary has no support for compression, for both compressed and  
uncompressed dumps.  5e73a60 has introduced a backward-incompatible  
behavior by switching a warning to a hard error in the code path reading  
the header data of a dump, preventing the TOC items to be listed even if  
pg_restore -l, with no support for compression, is used on a compressed  
dump.  Most modern systems should have support for zlib, but it can be  
also possible that somebody relies on the past behavior when copying  
over a dump where binaries are not built with zlib support (most likely  
some WIN32 flavors these days, though most environments should provide  
that).  
  
There is no easy way to have a regression test for this pattern, as it  
requires a mix of dump/restore commands with different compilation  
options, with and without compression.  One possibility I see here would  
be to have a command-line option that enforces a non-compression check  
for a build that supports compression, but that does not seem worth the  
cost, either.  
  
Reported-by: Justin Pryzby  
Author: Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup_archiver.c

Improve TimestampDifferenceMilliseconds to cope with overflow sanely.

commit   : 3a28d78089289794fda86cdbd275fc4756c6c6aa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2023 17:09:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2023 17:09:12 -0500    

Click here for diff

We'd like to use TimestampDifferenceMilliseconds with the stop_time  
possibly being TIMESTAMP_INFINITY, but up to now it's disclaimed  
responsibility for overflow cases.  Define it to clamp its output to  
the range [0, INT_MAX], handling overflow correctly.  (INT_MAX rather  
than LONG_MAX seems appropriate, because the function is already  
described as being intended for calculating wait times for WaitLatch  
et al, and that infrastructure only handles waits up to INT_MAX.  
Also, this choice gets rid of cross-platform behavioral differences.)  
  
Having done that, we can replace some ad-hoc code in walreceiver.c  
with a simple call to TimestampDifferenceMilliseconds.  
  
While at it, fix some buglets in existing callers of  
TimestampDifferenceMilliseconds: basebackup_copy.c had not read the  
memo about TimestampDifferenceMilliseconds never returning a negative  
value, and postmaster.c had not read the memo about Min() and Max()  
being macros with multiple-evaluation hazards.  Neither of these  
quite seem worth back-patching.  
  
Patch by me; thanks to Nathan Bossart for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/backup/basebackup_copy.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/walreceiver.c
M src/backend/utils/adt/timestamp.c

Code review for commit 05a7be935.

commit   : 24ff700f6aee2e8b915399e03934c6fe9b593d3f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2023 12:51:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2023 12:51:00 -0500    

Click here for diff

Avoid having walreceiver code know explicitly about the precision  
and underlying datatype of TimestampTz.  (There is still one  
calculation that knows that, which should be replaced with use of  
TimestampDifferenceMilliseconds; but we need to figure out what to do  
about overflow cases first.)  
  
In support of this, provide a TimestampTzPlusSeconds macro, as well  
as TIMESTAMP_INFINITY and TIMESTAMP_MINUS_INFINITY macros.  (We could  
have used the existing DT_NOEND and DT_NOBEGIN symbols, but I judged  
those too opaque and confusing.)  
  
Move GetCurrentTimestamp calls so that it's more obvious that we  
are not using stale values of "now" anyplace.  This doesn't result  
in net more calls, and might indeed make for net fewer.  
  
Avoid having a dummy value in the WalRcvWakeupReason enum, so that  
we can hope for the compiler to catch overlooked switch cases.  
  
Nathan Bossart and Tom Lane  
  
Discussion: https://postgr.es/m/20230125235004.GA1327755@nathanxps13  

M src/backend/replication/walreceiver.c
M src/include/datatype/timestamp.h
M src/include/utils/timestamp.h

Doc: use less-awkward phrasing.

commit   : e35bb9f1582d3c2885de65a60d6b296877c7ed0e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2023 11:34:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jan 2023 11:34:17 -0500    

Click here for diff

Improve wording in note about tools required to build  
from the source repository.  
  
Laurenz Albe, per gripe from Riivo Kolka  
  
Discussion: https://postgr.es/m/167463493588.2667301.13267758265445155872@wrigleys.postgresql.org  

M doc/src/sgml/sourcerepo.sgml

DROP ROLE regress_role_limited_admin at end of test

commit   : 14fb38626f3ff0f96144cd7535ce5feaba3a18a0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 26 Jan 2023 08:14:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 26 Jan 2023 08:14:41 -0500    

Click here for diff

This is required by project policy, and I overlooked the need for  
it (again) by accident.  
  
Reported by Álvaro Herrara.  
  
Discussion: http://postgr.es/m/[email protected]  

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

commit   : 37e267335068059ac9bd4ec5d06b493afb4b73e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2023 11:33:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2023 11:33:01 +0100    

Click here for diff

This has long been deprecated.  Some of the build systems didn't even  
install it.  
  
Also remove man page.  
  
Reviewed-by: Karl O. Pinc <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/allfiles.sgml
D doc/src/sgml/ref/postmaster.sgml
M doc/src/sgml/reference.sgml
M src/backend/Makefile

Remove gratuitous references to postmaster program

commit   : 81266442fbcb19ec184134f0a256207f05026520    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2023 10:48:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Jan 2023 10:48:32 +0100    

Click here for diff

"postgres" has long been officially preferred over "postmaster" as the  
name of the program to invoke to run the server.  Some example scripts  
and code comments still used the latter.  Change those.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/start-scripts/freebsd
M contrib/start-scripts/linux
M src/port/path.c

Revert "Add eager and lazy freezing strategies to VACUUM."

commit   : 6c6b4972664491de408670354fdbccc7c83a1c89    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 25 Jan 2023 22:22:27 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 25 Jan 2023 22:22:27 -0800    

Click here for diff

This reverts commit 4d417992613949af35530b4e8e83670c4e67e1b2.  Broad  
concerns about regressions caused by eager freezing strategy have been  
raised.  Whether or not these concerns can be worked through in any time  
frame is far from certain.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/commands/vacuum.h
M src/include/utils/rel.h

Clarify documentation for CLUSTER on partitioned tables.

commit   : 8b5f36bb6c16c030561d83b74b8c3270dbf48b68    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 25 Jan 2023 20:23:32 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 25 Jan 2023 20:23:32 -0800    

Click here for diff

Author: Nathan Bossart  
Discussion: https://postgr.es/m/20230114224000.GA2505377@nathanxps13  

M doc/src/sgml/ref/cluster.sgml

Make auto_explain print the query identifier in verbose mode

commit   : 9d2d9728b8d546434aade4f9667a59666588edd6    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 26 Jan 2023 12:23:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 26 Jan 2023 12:23:16 +0900    

Click here for diff

When auto_explain.log_verbose is on, auto_explain should print in the  
logs plans equivalent to the EXPLAIN (VERBOSE).  However, when  
compute_query_id is on, query identifiers were not showing up, being  
only handled by EXPLAIN (VERBOSE).  This brings auto_explain on par with  
EXPLAIN regarding that.  Note that like EXPLAIN, auto_explain does not  
show the query identifier when compute_query_id=regress.  
  
The change is done so as the choice of printing the query identifier is  
done in ExplainPrintPlan() rather than in ExplainOnePlan(), to avoid a  
duplication of the logic dealing with the query ID.  auto_explain is the  
only in-core caller of ExplainPrintPlan().  
  
While looking at the area, I have noticed that more consolidation  
between EXPLAIN and auto_explain would be in order for the logging of  
the plan duration and the buffer usage.  This refactoring is left as a  
future change.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Justin Pryzby, Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/t/001_auto_explain.pl
M src/backend/commands/explain.c

Fix rare sharedtuplestore.c corruption.

commit   : ffcf6f4cfca5a4ce2ac7ff7e8fa17541a5a9caea    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 26 Jan 2023 14:50:07 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 26 Jan 2023 14:50:07 +1300    

Click here for diff

If the final chunk of an oversized tuple being written out to disk was  
exactly 32760 bytes, it would be corrupted due to a fencepost bug.  
  
Bug #17619.  Back-patch to 11 where the code arrived.  
  
While testing that (see test module in archives), I (tmunro) noticed  
that the per-participant page counter was not initialized to zero as it  
should have been; that wasn't a live bug when it was written since DSM  
memory was originally always zeroed, but since 14  
min_dynamic_shared_memory might be configured and it supplies non-zeroed  
memory, so that is also fixed here.  
  
Author: Dmitry Astapov <[email protected]>  
Discussion: https://postgr.es/m/17619-0de62ceda812b8b5%40postgresql.org  

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

Revert "Rename contrib module basic_archive to basic_wal_module"

commit   : 9aeff092c05820d6a9252d7a3f8db86f71f2205f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 26 Jan 2023 09:13:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 26 Jan 2023 09:13:39 +0900    

Click here for diff

This reverts commit 0ad3c60, as per feedback from Tom Lane, Robert Haas  
and Andres Freund.  The new name used for the module had little  
support.  
  
This moves back to basic_archive as module name, and we will likely use  
that as template for recovery modules, as well.  
  
Discussion: https://postgr.es/m/CA+TgmoYG5uGOp7DGFT5gzC1kKFWGjkLSj_wOQxGhfMcvVEiKGA@mail.gmail.com  

M contrib/Makefile
R100 contrib/basic_wal_module/.gitignore contrib/basic_archive/.gitignore
R055 contrib/basic_wal_module/Makefile contrib/basic_archive/Makefile
R093 contrib/basic_wal_module/basic_wal_module.c contrib/basic_archive/basic_archive.c
A contrib/basic_archive/basic_archive.conf
R100 contrib/basic_wal_module/expected/basic_wal_module.out contrib/basic_archive/expected/basic_archive.out
A contrib/basic_archive/meson.build
R100 contrib/basic_wal_module/sql/basic_wal_module.sql contrib/basic_archive/sql/basic_archive.sql
D contrib/basic_wal_module/basic_wal_module.conf
D contrib/basic_wal_module/meson.build
M contrib/meson.build
D doc/src/sgml/appendix-obsolete-basic-archive.sgml
M doc/src/sgml/appendix-obsolete.sgml
M doc/src/sgml/archive-modules.sgml
R064 doc/src/sgml/basic-wal-module.sgml doc/src/sgml/basic-archive.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml

Doc: update VACUUM VERBOSE freezing tip.

commit   : 1a8e72bff781e869e5b5dc76fa18e3ae08181656    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 25 Jan 2023 14:31:41 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 25 Jan 2023 14:31:41 -0800    

Click here for diff

VACUUM VERBOSE/autovacuuming logging have reported on the number of  
pages frozen by VACUUM since commit d977ffd9 added that capability.  
This information is directly related to relfrozenxid advancement, so  
update an older tip from the documentation about how relfrozenxid is  
reported on by the same instrumentation code.  Now the tip directly  
mentions newly frozen pages, too.  

M doc/src/sgml/maintenance.sgml

Add eager and lazy freezing strategies to VACUUM.

commit   : 4d417992613949af35530b4e8e83670c4e67e1b2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 25 Jan 2023 14:15:38 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 25 Jan 2023 14:15:38 -0800    

Click here for diff

Eager freezing strategy avoids large build-ups of all-visible pages.  It  
makes VACUUM trigger page-level freezing whenever doing so will enable  
the page to become all-frozen in the visibility map.  This is useful for  
tables that experience continual growth, particularly strict append-only  
tables such as pgbench's history table.  Eager freezing significantly  
improves performance stability by spreading out the cost of freezing  
over time, rather than doing most freezing during aggressive VACUUMs.  
It complements the insert autovacuum mechanism added by commit b07642db.  
  
VACUUM determines its freezing strategy based on the value of the new  
vacuum_freeze_strategy_threshold GUC (or reloption) with logged tables.  
Tables that exceed the size threshold use the eager freezing strategy.  
Unlogged tables and temp tables always use eager freezing strategy,  
since the added cost is negligible there.  Non-permanent relations won't  
incur any extra overhead in WAL written (for the obvious reason), nor in  
pages dirtied (since any extra freezing will only take place on pages  
whose PD_ALL_VISIBLE bit needed to be set either way).  
  
VACUUM uses lazy freezing strategy for logged tables that fall under the  
GUC size threshold.  Page-level freezing triggers based on the criteria  
established in commit 1de58df4, which added basic page-level freezing.  
  
Eager freezing is strictly more aggressive than lazy freezing.  Settings  
like vacuum_freeze_min_age still get applied in just the same way in  
every VACUUM, independent of the strategy in use.  The only mechanical  
difference between eager and lazy freezing strategies is that only the  
former applies its own additional criteria to trigger freezing pages.  
Note that even lazy freezing strategy will trigger freezing whenever a  
page happens to have required that an FPI be written during pruning,  
provided that the page will thereby become all-frozen in the visibility  
map afterwards (due to the FPI optimization from commit 1de58df4).  
  
The vacuum_freeze_strategy_threshold default setting is 4GB.  This is a  
relatively low setting that prioritizes performance stability.  It will  
be reviewed at the end of the Postgres 16 beta period.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Jeff Davis <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Reviewed-By: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkFok_6EAHuK39GaW4FjEFQsY=3J0AAd6FXk93u-Xq3Fg@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/commands/vacuum.h
M src/include/utils/rel.h

plpython: Stop undefining _POSIX_C_SOURCE, _XOPEN_SOURCE

commit   : 642e8821d713d75f142ef4eda14e490ba0fb810b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 25 Jan 2023 09:59:26 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 25 Jan 2023 09:59:26 -0800    

Click here for diff

We undefined them to avoid warnings about macro redefinitions. But we haven't  
fully followed the necessary include order, since at least 147c2482542, in  
2011.  Recently the combination of the include order rules not being followed  
and undefining _POSIX_C_SOURCE started to cause a compile failure, starting  
with 03023a2664f. Undefining _POSIX_C_SOURCE hides clock_gettime(), which is  
referenced in an inline function as of 03023a2664f, whereas it was a macro  
before.  
  
After seeing some evidence that undefining _POSIX_C_SOURCE et al isn't  
required, I tried to build postgres with plpython on most of our supported  
platforms (except DragonFlyBSD and Illumos, but similar systems were tested),  
with/without the #undefines. No compiler warning / behavioral difference.  
  
The oldest supported python version, 3.2, defines _POSIX_C_SOURCE to 200112L  
ad _XOPEN_SOURCE to 600, whereas newer versions of python use 200809L/700  
respectively. As _POSIX_C_SOURCE/_XOPEN_SOURCE will default to the newer  
operating system on most platforms, it's possible that when using python 3.2  
new warnings would be emitted - but that seems acceptable.  
  
It's possible that this approach won't work on some older platforms. But  
getting rid of most of the include-order complexity seems promising, and it's  
an easily revertible patch if we end up having to go another way.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpython/plpython.h

plpython: Avoid the need to redefine *printf macros

commit   : 23c12329a755ad9c70135463d3f067241daf1dcc    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 25 Jan 2023 09:59:26 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 25 Jan 2023 09:59:26 -0800    

Click here for diff

Until now we undefined and then redefined a lot of *printf macros due to  
worries about conflicts with Python.h macro definitions. Current Python.h  
doesn't define any *printf macros, and older versions just defined snprintf,  
vsnprintf, guarded by #if defined(MS_WIN32) && !defined(HAVE_SNPRINTF).  
  
Thus we can replace the undefine/define section with a single  
 #define HAVE_SNPRINTF 1  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpython/plpython.h

Avoid type cheats for invalid dsa_handles and dshash_table_handles.

commit   : 3b4ac33254e1291f0b3c94f1cb770137c418ce2e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2023 11:48:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Jan 2023 11:48:38 -0500    

Click here for diff

Invent separate macros for "invalid" values of these types, so that  
we needn't embed knowledge of their representations into calling code.  
These are all zeroes anyway ATM, so this is not fixing any live bug,  
but it makes the code cleaner and more future-proof.  
  
I (tgl) also chose to move DSM_HANDLE_INVALID into dsm_impl.h,  
since it seems like it should live beside the typedef for dsm_handle.  
  
Hou Zhijie, Nathan Bossart, Kyotaro Horiguchi, Tom Lane  
  
Discussion: https://postgr.es/m/OS0PR01MB5716860B1454C34E5B179B6694C99@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/launcher.c
M src/backend/storage/ipc/dsm.c
M src/backend/utils/mmgr/dsa.c
M src/include/lib/dshash.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/utils/dsa.h

doc: Fix network_ops -> inet_ops in SpGiST operator class list

commit   : d7c4830abb1867ca4fb83add2a5fac558f778b6a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Jan 2023 20:00:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Jan 2023 20:00:36 +0900    

Click here for diff

network_ops is an opclass family of SpGiST, and the opclass able to  
work on the inet type is named inet_ops.  
  
Oversight in 7a1cd52, that reworked the design of the table listing all  
the operators available.  
  
Reported-by: Laurence Parry  
Reviewed-by: Tom Lane, David G. Johnston  
Discussion: https://postgr.es/m/167458110639.2667300.14741268666497110766@wrigleys.postgresql.org  
Backpatch-through: 14  

M doc/src/sgml/spgist.sgml

Rename contrib module basic_archive to basic_wal_module

commit   : 0ad3c60caf5f77edfefaf8850fbba5ea4fe28640    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Jan 2023 14:36:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Jan 2023 14:36:51 +0900    

Click here for diff

This rename is in preparation for the introduction of recovery modules,  
where basic_wal_module will be used as a base template for the set of  
callbacks introduced.  The former name did not really reflect all that.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/20221227192449.GA3672473@nathanxps13  

M contrib/Makefile
D contrib/basic_archive/basic_archive.conf
D contrib/basic_archive/meson.build
R100 contrib/basic_archive/.gitignore contrib/basic_wal_module/.gitignore
R055 contrib/basic_archive/Makefile contrib/basic_wal_module/Makefile
R093 contrib/basic_archive/basic_archive.c contrib/basic_wal_module/basic_wal_module.c
A contrib/basic_wal_module/basic_wal_module.conf
R100 contrib/basic_archive/expected/basic_archive.out contrib/basic_wal_module/expected/basic_wal_module.out
A contrib/basic_wal_module/meson.build
R100 contrib/basic_archive/sql/basic_archive.sql contrib/basic_wal_module/sql/basic_wal_module.sql
M contrib/meson.build
A doc/src/sgml/appendix-obsolete-basic-archive.sgml
M doc/src/sgml/appendix-obsolete.sgml
M doc/src/sgml/archive-modules.sgml
R064 doc/src/sgml/basic-archive.sgml doc/src/sgml/basic-wal-module.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml

Process pending postmaster work before connections.

commit   : 239b1753421ccbd52f4f628a9265c3034d38b80f    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 25 Jan 2023 14:28:01 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 25 Jan 2023 14:28:01 +1300    

Click here for diff

Modify the new event loop code from commit 7389aad6 so that it checks  
for work requested by signal handlers even if it doesn't see a latch  
event yet.  
  
This gives priority to shutdown and reload requests where the latch will  
be reported later in the event array, or in a later call to  
WaitEventSetWait(), due to scheduling details.  In particular, this  
guarantees that a SIGHUP-then-connect sequence (as seen in  
authentication tests) causes the postmaster to process the reload before  
accepting the connection.  If the WaitEventSetWait() call saw the socket  
as ready, and the reload signal was generated before the connection,  
then the latest time the signal handler should be able to run is after  
poll/epoll_wait/kevent returns but before we check the  
pending_pm_reload_request flag.  
  
While here, also shift the handling of child exit below reload requests,  
per Tom Lane's observation that that might start new processes, so we  
should make sure we pick up new settings first.  
  
This probably explains the one-off failure of build farm animal  
malleefowl.  
  
Reported-by: Hou Zhijie <[email protected]>  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/OS0PR01MB57163D3BF2AB42ECAA94E5C394C29%40OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/postmaster/postmaster.c

Update more obsolete multixact.c comments.

commit   : 8f8f11593258d04e9a58365865f7daf123e24bb1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 24 Jan 2023 15:15:33 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 24 Jan 2023 15:15:33 -0800    

Click here for diff

Update some remaining comments in multixact.c that still described SLRU  
truncation as happening in the checkpointer, rather than during VACUUM.  
  
Follow-up to commit 5212d447.  
  
Shi yu, with tweaks by me.  
  
Author: Shi yu <[email protected]>  
Discussion: https://postgr.es/m/OSZPR01MB631066BF246F8F74E83222FCFDC69@OSZPR01MB6310.jpnprd01.prod.outlook.com  

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

Improve exclude pattern file processing in pgindent

commit   : 1249371632db9d97786edfb3d58c3e89e75b9519    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 24 Jan 2023 16:04:21 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 24 Jan 2023 16:04:21 -0500    

Click here for diff

This makes two small changes that will improve pgindent's usefulness in  
a git hook. First, it looks for the exclude file relative to the current  
directory. And second, it applies the filters to filenames given on the  
command line as well as those found in a directory sweep.  
  
It might prove necessary to make further efforts to find the exclude  
file, and even to allow multiple exclude files, but for now this should  
be enough for most purposes.  
  
Reviewed by Jelte Fennema  

M src/tools/pgindent/pgindent

Adjust interaction of CREATEROLE with role properties.

commit   : f1358ca52dd7b8cedd29c6f2f8c163914f03ea2e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2023 10:57:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 Jan 2023 10:57:09 -0500    

Click here for diff

Previously, a CREATEROLE user without SUPERUSER could not alter  
REPLICATION users in any way, and could not set the BYPASSRLS  
attribute. However, they could manipulate the CREATEDB property  
even if they themselves did not possess it.  
  
With this change, a CREATEROLE user without SUPERUSER can set or  
clear the REPLICATION, BYPASSRLS, or CREATEDB property on a new  
role or a role that they have rights to manage if and only if  
that property is set for their own role.  
  
This implements the standard idea that you can't give permissions  
you don't have (but you can give the ones you do have). We might  
in the future want to provide more powerful ways to constrain  
what a CREATEROLE user can do - for example, to limit whether  
CONNECTION LIMIT can be set or the values to which it can be set -  
but that is left as future work.  
  
Patch by me, reviewed by Nathan Bossart, Tushar Ahuja, and Neha  
Sharma.  
  
Discussion: http://postgr.es/m/CA+TgmobX=LHg_J5aT=0pi9gJy=JdtrUVGAu0zhr-i5v5nNbJDg@mail.gmail.com  

M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/create_role.sgml
M src/backend/commands/dbcommands.c
M src/backend/commands/user.c
M src/include/commands/dbcommands.h
M src/test/regress/expected/create_role.out
M src/test/regress/sql/create_role.sql

Fix the Drop Database hang.

commit   : 6c6d6ba3ee2c160b53f727cf8e612014b316d6e4    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 24 Jan 2023 09:25:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 24 Jan 2023 09:25:36 +0530    

Click here for diff

The drop database command waits for the logical replication sync worker to  
accept ProcSignalBarrier and the worker's slot creation waits for the drop  
database to finish which leads to a deadlock. This happens because the  
tablesync worker holds interrupts while creating a slot.  
  
We prevent cancel/die interrupts while creating a slot in the table sync  
worker because it is possible that before the server finishes this  
command, a concurrent drop subscription happens which would complete  
without removing this slot and that leads to the slot existing until the  
end of walsender. However, the slot will eventually get dropped at the  
walsender exit time, so there is no danger of the dangling slot.  
  
This patch reallows cancel/die interrupts while creating a slot and  
modifies the test to wait for slots to become zero to prevent finding an  
ephemeral slot.  
  
The reported hang doesn't happen in PG14 as the drop database starts to  
wait for ProcSignalBarrier with PG15 (commits 4eb2176318 and e2f65f4255)  
but it is good to backpatch this till PG14 as it is not a good idea to  
prevent interrupts during a network call that could block indefinitely.  
  
Reported-by: Lakshmi Narayanan Sreethar  
Diagnosed-by: Andres Freund  
Author: Hou Zhijie  
Reviewed-by: Vignesh C, Amit Kapila  
Backpatch-through: 14, where it was introduced in commit 6b67d72b60  
Discussion: https://postgr.es/m/CA+kvmZELXQ4ZD3U=XCXuG3KvFgkuPoN1QrEj8c-rMRodrLOnsg@mail.gmail.com  

M src/backend/replication/logical/tablesync.c
M src/test/subscription/t/004_sync.pl

libpqwalreceiver: Convert to libpq-be-fe-helpers.h

commit   : 728f86fec65537eade8d9e751961782ddb527934    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Jan 2023 19:25:23 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Jan 2023 19:25:23 -0800    

Click here for diff

In contrast to the changes to dblink and postgres_fdw, this does not fix a  
bug, as libpqwalreceiver did already process interrupts.  
  
Besides reducing code duplication, the conversion leads to libpqwalreceiver  
now using reserving file descriptors for libpq connections. While not strictly  
required for the use in walreceiver, we are also using libpqwalreceiver for  
logical replication, where it does seem more important.  
  
Even if we eventually decide to backpatch the prior commits, there'd be no  
need to backpatch this commit, due to not fixing an active bug.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

commit   : e4602483e95bebd4da31e4ea95dc5c7f715c1e4f    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Jan 2023 19:25:23 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Jan 2023 19:25:23 -0800    

Click here for diff

Until now dblink and postgres_fdw did not process interrupts during connection  
establishment. Besides preventing query cancellations etc, this can lead to  
undetected deadlocks, as global barriers are not processed.  
  
These aforementioned undetected deadlocks are the reason for the spate of CI  
test failures in the FreeBSD 'test_running' step.  
  
Fix the bug by using the helper from libpq-be-fe-helpers.h, introduced in a  
prior commit. Besides fixing the bug, this also removes duplicated code  
around reserving file descriptors.  
  
As the change is relatively large and there are no field reports of the  
problem, don't backpatch for now.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch:  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c

Add helper library for use of libpq inside the server environment

commit   : 28a591711d505f1f64c4f2eff5873ca2de0abede    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Jan 2023 19:25:23 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Jan 2023 19:25:23 -0800    

Click here for diff

Currently dblink and postgres_fdw don't process interrupts during connection  
establishment. Besides preventing query cancellations etc, this can lead to  
undetected deadlocks, as global barriers are not processed.  
  
Libpqwalreceiver in contrast, processes interrupts during connection  
establishment. The required code is not trivial, so duplicating it into  
additional places does not seem like a good option.  
  
These aforementioned undetected deadlocks are the reason for the spate of CI  
test failures in the FreeBSD 'test_running' step.  
  
For now the helper library is just a header, as it needs to be linked into  
each extension using libpq, and it seems too small to be worth adding a  
dedicated static library for.  
  
The conversion to the helper are done in subsequent commits.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

A src/include/libpq/libpq-be-fe-helpers.h

Fix error handling in libpqrcv_connect()

commit   : bc54ef4ec25a3c642f1706a49f979b7750a2817e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Jan 2023 18:04:02 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Jan 2023 18:04:02 -0800    

Click here for diff

When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked the  
libpq connection. In most paths that's fairly harmless, as the calling process  
will exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhat  
longer lived leak.  
  
Fix by releasing resources, including the libpq connection, on error.  
  
Add a test exercising the error code path. To make it reliable and safe, the  
test tries to connect to port=-1, which happens to fail during connection  
establishment, rather than during connection string parsing.  
  
Reviewed-by: Noah Misch <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Use OFFSET 0 instead of ORDER BY to stop subquery pullup

commit   : 9567686ec834e50ab10ae872a8394c9a9e590b0d    
  
author   : David Rowley <[email protected]>    
date     : Tue, 24 Jan 2023 13:49:10 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 24 Jan 2023 13:49:10 +1300    

Click here for diff

b762fed64 recently changed this test to prevent subquery pullup to allow  
us to test Memoize with lateral_vars.  As pointed out by Tom Lane, OFFSET  
0 is our standard way of preventing subquery pullups, so do it that way  
instead.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, same as b762fed64  

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

Fix LATERAL join test in test memoize.sql

commit   : b762fed6481e722a022ac2bea02151e080c31fa6    
  
author   : David Rowley <[email protected]>    
date     : Tue, 24 Jan 2023 12:30:30 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 24 Jan 2023 12:30:30 +1300    

Click here for diff

The test in question was meant to be testing Memoize to ensure it worked  
correctly when the inner side of the join contained lateral vars, however,  
nothing in the lateral subquery stopped it from being pulled up into the  
main query, so the planner did that, and that meant no more lateral vars.  
  
Here we add a simple ORDER BY to stop the planner from being able to  
pullup the lateral subquery.  
  
Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4_LHJaN4L-tXpKMiPFnsCJWU1P8Xh59o0W7AA6UN99=cQ@mail.gmail.com  
Backpatch-through: 14, where Memoize was added.  

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

Fix XLogPageRead() comment

commit   : 8dd43894b1f5c0148dd36308fc607bfcc909e5bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2023 21:46:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Jan 2023 21:46:30 +0100    

Click here for diff

7fcbf6a and 2ff6555 changed the function signature of XLogPageRead()  
but did not update the comment.  
  
XLogReaderRoutine contains up to date information about the API, so no  
need to repeat all that at XLogPageRead(), but fix the mentions of the  
no longer existing function arguments.  

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

Add non-decimal integer support to type numeric.

commit   : 6dfacbf72b53b775e8442a7fd2fca7c24b139773    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 23 Jan 2023 19:21:22 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 23 Jan 2023 19:21:22 +0000    

Click here for diff

This enhances the numeric type input function, adding support for  
hexadecimal, octal, and binary integers of any size, up to the limits  
of the numeric type.  
  
Since 6fcda9aba8, such non-decimal integers have been accepted by the  
parser as integer literals and passed through to numeric_in(). This  
commit gives numeric_in() the ability to handle them.  
  
While at it, simplify the handling of NaN and infinities, reducing the  
number of calls to pg_strncasecmp(), and arrange for pg_strncasecmp()  
to not be called at all for regular numbers. This gives a significant  
performance improvement for decimal inputs, more than offsetting the  
small performance hit of checking for non-decimal input.  
  
Discussion: https://postgr.es/m/CAEZATCV8XShnmT9HZy25C%2Bo78CVOFmUN5EM9FRAZ5xvYTggPMg%40mail.gmail.com  

M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/expected/numerology.out
M src/test/regress/sql/numeric.sql

Fix pgindent --show-diff option.

commit   : 62e1e28bf76910ffe47ddbc5c1fade41e1a65dac    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Jan 2023 13:50:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Jan 2023 13:50:49 -0500    

Click here for diff

At least on my machine, the initial coding of this didn't actually  
work, because interpolation of "$post_fh->filename" doesn't act  
as intended.  
  
I threw in some double quotes too, just in case anybody tries  
to run this in a path containing spaces.  

M src/tools/pgindent/pgindent

Remove special outfuncs/readfuncs handling of RangeVar.catalogname.

commit   : 3cece34be842178a3c5697a58e03fb4a5d576378    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Jan 2023 13:33:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Jan 2023 13:33:19 -0500    

Click here for diff

Historically we skipped writing/reading this field, but that no  
longer works under WRITE_READ_PARSE_PLAN_TREES since we expanded  
the coverage of that option to include utility commands (787102b56).  
Remove the special case and just treat this field normally.  
  
Bump catversion out of an abundance of caution --- I do not think  
we currently ever store RangeVar nodes in the catalogs, but  
perhaps I'm wrong.  
  
Per report from Pavel Stehule.  
  
Discussion: https://postgr.es/m/CAFj8pRAYvYu-qU7-NieqRRyaQZk-yr3UjtHQ2LR62PS9M1dZMA@mail.gmail.com  

M src/include/catalog/catversion.h
M src/include/nodes/primnodes.h

Add a test using ldapbindpasswd in pg_hba.conf

commit   : a9dc7f9419e4f6cac419e195618dceac74846c83    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 23 Jan 2023 08:40:18 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 23 Jan 2023 08:40:18 -0500    

Click here for diff

This feature has not been covered in tests up to now.  
  
John Naylor and Andrew Dunstan  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ldap/meson.build
A src/test/ldap/t/002_bindpasswd.pl

Restructure Ldap TAP test

commit   : ee4613d2b7327512477bcf8967e28a93fd01807d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 23 Jan 2023 08:31:37 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 23 Jan 2023 08:31:37 -0500    

Click here for diff

The code for detecting the Ldap installation and setting up a test  
server is broken out into a reusable module that can be used  for  
additional tests to be added in later patches.  
  
Discussion: https://postgr.es/m/[email protected]  

A src/test/ldap/LdapServer.pm
M src/test/ldap/t/001_auth.pl

Add non-destructive modes to pgindent

commit   : b90f0b57474eac3980be8146f2e45f73a05c994f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 23 Jan 2023 07:00:06 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 23 Jan 2023 07:00:06 -0500    

Click here for diff

This adds two modes of running pgindent, neither of which results in  
any changes being made to the source code. The --show-diff option shows  
what changes would have been made, and the --silent-diff option just  
exits with a status of 2 if any changes would be made. The second of  
these is intended for scripting use in places such as git hooks.  
  
Along the way some code cleanup is done, and a --help option is also  
added.  
  
Reviewed by Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pgindent/pgindent
M src/tools/pgindent/pgindent.man

Optimise numeric division for 3 and 4 base-NBASE digit divisors.

commit   : 0aa38db56bf459d04ed58c22f7c689c0ae14e977    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 23 Jan 2023 11:56:00 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 23 Jan 2023 11:56:00 +0000    

Click here for diff

On platforms with 128-bit integer support, introduce a new function  
div_var_int64(), along the same lines as div_var_int() added in  
d1b307eef2 for divisors with 1 or 2 base-NBASE digits, and use it to  
speed up div_var() and div_var_fast() in a similar way when the  
divisor has 3 or 4 base-NBASE digits.  
  
This gives significant performance gains for divisors with 9-16  
decimal digits.  
  
Joel Jacobson.  
  
Discussion:  
  https://postgr.es/m/b7a5893d-af18-4c0b-8918-96de5f1bbf39%40app.fastmail.com  
  https://postgr.es/m/CAEZATCXGm%3DDyTq%3DFrcOqC0gPMVveKUYTaD5KRRoajrUTiWxVMw%40mail.gmail.com  

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

Run pgindent on heapam.c

commit   : 009dbdea02d74c72db2d1a57d5299f94f91fa975    
  
author   : David Rowley <[email protected]>    
date     : Mon, 23 Jan 2023 23:08:38 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 23 Jan 2023 23:08:38 +1300    

Click here for diff

An upcoming patch by Melanie Plageman does some refactoring work in this  
area.  Run pgindent on that file now before making any changes so that  
it's easier to maintain/evolve each of the individual patches doing the  
refactor work.  Additionally, add a few new required typedefs to the list  
to make it easier to do future pgindent runs on this file during the  
refactor work.  
  
Discussion: https://postgr.es/m/CAAKRu_YSOnhKsDyFcqJsKtBSrd32DP-jjXmv7hL0BPD-z0TGXQ@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/tools/pgindent/typedefs.list

Fix and clarify function comment on LogicalTapeSetCreate.

commit   : 236f1ea84c4ca6a29d790fac4b48eba12a74443c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Jan 2023 11:56:43 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 23 Jan 2023 11:56:43 +0200    

Click here for diff

Commit c4649cce39 removed the "shared" and "ntapes" arguments, but the  
comment still talked about "shared". It also talked about "a shared  
file handle", which was technically correct because even before commit  
c4649cce39, the "shared file handle" referred to the "fileset"  
argument, not "shared". But it was very confusing. Improve the  
comment.  
  
Also add a comment on what the "preallocate" argument does.  
  
Backpatch to v15, just to make backpatching other patches easier in  
the future.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Reviewed-by: Peter Eisentraut  

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

Harden new parallel string_agg/array_agg regression test

commit   : 67c5b8840fcad07eeecd9af517b9b1ff09a3cf8e    
  
author   : David Rowley <[email protected]>    
date     : Mon, 23 Jan 2023 21:31:46 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 23 Jan 2023 21:31:46 +1300    

Click here for diff

Per buildfarm member mandrill, it seems that  
max_parallel_workers_per_gather may not always be set to the default value  
of 2 when the new test added in 16fd03e95 is executed.  Here let's just  
explicitly set that to 2 so that the planner never opts to use more than  
that many parallel workers.  

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

pg_walinspect: Add pg_get_wal_fpi_info()

commit   : c31cf1c03d01ce86f20bef8c980fe56a257b3b4b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Jan 2023 13:55:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Jan 2023 13:55:18 +0900    

Click here for diff

This function is able to extract the full page images from a range of  
records, specified as of input arguments start_lsn and end_lsn.  Like  
the other functions of this module, an error is returned if using LSNs  
that do not reflect real system values.  All the FPIs stored in a single  
record are extracted.  
  
The module's version is bumped to 1.1.  
  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/CALj2ACVCcvzd7WiWvD=6_7NBvVB_r6G0EGSxL4F8vosAi6Se4g@mail.gmail.com  

M contrib/pg_walinspect/Makefile
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/meson.build
A contrib/pg_walinspect/pg_walinspect–1.0–1.1.sql
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pg_walinspect/pg_walinspect.control
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/pgwalinspect.sgml

Allow parallel aggregate on string_agg and array_agg

commit   : 16fd03e956540d1b47b743f6a84f37c54ac93dd4    
  
author   : David Rowley <[email protected]>    
date     : Mon, 23 Jan 2023 17:35:01 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 23 Jan 2023 17:35:01 +1300    

Click here for diff

This adds combine, serial and deserial functions for the array_agg() and  
string_agg() aggregate functions, thus allowing these aggregates to  
partake in partial aggregations.  This allows both parallel aggregation to  
take place when these aggregates are present and also allows additional  
partition-wise aggregation plan shapes to include plans that require  
additional aggregation once the partially aggregated results from the  
partitions have been combined.  
  
Author: David Rowley  
Reviewed-by: Andres Freund, Tomas Vondra, Stephen Frost, Tom Lane  
Discussion: https://postgr.es/m/CAKJS1f9sx_6GTcvd6TMuZnNtCh0VhBzhX6FZqw17TgVFH-ga_A@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/optimizer/prep/prepagg.c
M src/backend/parser/parse_agg.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/parser/parse_agg.h
M src/include/utils/array.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Track logrep apply workers' last start times to avoid useless waits.

commit   : 5a3a95385bd5a8f1a4fd50545b7efe9338581899    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Jan 2023 14:08:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Jan 2023 14:08:46 -0500    

Click here for diff

Enforce wal_retrieve_retry_interval on a per-subscription basis,  
rather than globally, and arrange to skip that delay in case of  
an intentional worker exit.  This probably makes little difference  
in the field, where apply workers wouldn't be restarted often;  
but it has a significant impact on the runtime of our logical  
replication regression tests (even though those tests use  
artificially-small wal_retrieve_retry_interval settings already).  
  
Nathan Bossart, with mostly-cosmetic editorialization by me  
  
Discussion: https://postgr.es/m/20221122004119.GA132961@nathanxps13  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/storage/lmgr/lwlock.c
M src/include/replication/logicallauncher.h
M src/include/storage/lwlock.h

Allow REPLICA IDENTITY to be set on an index that's not (yet) valid.

commit   : c9f7f926484d69e2806e35343af7e472fadfede7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Jan 2023 13:10:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Jan 2023 13:10:29 -0500    

Click here for diff

The motivation for this change is that when pg_dump dumps a  
partitioned index that's marked REPLICA IDENTITY, it generates a  
command sequence that applies REPLICA IDENTITY before the partitioned  
index has been marked valid, causing restore to fail.  We could  
perhaps change pg_dump to not do it like that, but that would be  
difficult and would not fix existing dump files with the problem.  
There seems to be very little reason for the backend to disallow  
this anyway --- the code ignores indisreplident when the index  
isn't valid --- so instead let's fix it by allowing the case.  
  
Commit 9511fb37a previously expressed a concern that allowing  
indisreplident to be set on invalid indexes might allow us to  
wind up in a situation where a table could have indisreplident  
set on multiple indexes.  I'm not sure I follow that concern  
exactly, but in any case the only way that could happen is because  
relation_mark_replica_identity is too trusting about the existing set  
of markings being valid.  Let's just rip out its early-exit code path  
(which sure looks like premature optimization anyway; what are we  
doing expending code to make redundant ALTER TABLE ... REPLICA  
IDENTITY commands marginally faster and not-redundant ones marginally  
slower?) and fix it to positively guarantee that no more than one  
index is marked indisreplident.  
  
The pg_dump failure can be demonstrated in all supported branches,  
so back-patch all the way.  I chose to back-patch 9511fb37a as well,  
just to keep indisreplident handling the same in all branches.  
  
Per bug #17756 from Sergey Belyashov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/replica_identity.out
M src/test/regress/sql/replica_identity.sql

Reject CancelRequestPacket having unexpected length.

commit   : e52daaabf8f1bf8096b0c105e2f719d9c68be3fa    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 21 Jan 2023 06:08:00 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 21 Jan 2023 06:08:00 -0800    

Click here for diff

When the length was too short, the server read outside the allocation.  
That yielded the same log noise as sending the correct length with  
(backendPID,cancelAuthCode) matching nothing.  Change to a message about  
the unexpected length.  Given the attacker's lack of control over the  
memory layout and the general lack of diversity in memory layouts at the  
code in question, we doubt a would-be attacker could cause a segfault.  
Hence, while the report arrived via [email protected], this is not  
a vulnerability.  Back-patch to v11 (all supported versions).  
  
Andrey Borodin, reviewed by Tom Lane.  Reported by Andrey Borodin.  

M src/backend/postmaster/postmaster.c

instr_time: Represent time as an int64 on all platforms

commit   : 03023a2664f8950ad522385ff75ce004bc932a7c    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 20 Jan 2023 21:16:47 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 20 Jan 2023 21:16:47 -0800    

Click here for diff

Until now we used struct timespec for instr_time on all platforms but  
windows. Using struct timespec causes a fair bit of memory (struct timeval is  
16 bytes) and runtime overhead (much more complicated additions). Instead we  
can convert the time to nanoseconds in INSTR_TIME_SET_CURRENT(), making the  
remaining operations cheaper.  
  
Representing time as int64 nanoseconds provides sufficient range, ~292 years  
relative to a starting point (depending on clock source, relative to the unix  
epoch or the system's boot time). That'd not be sufficient for calendar time  
stored on disk, but is plenty for runtime interval time measurement.  
  
On windows instr_time already is represented as cycles. It might make sense to  
represent time as cycles on other platforms as well, as using cycle  
acquisition instructions like rdtsc directly can reduce the overhead of time  
acquisition substantially. This could be done in a fairly localized manner as  
the code stands after this commit.  
  
Because the windows and non-windows paths are now more similar, use a common  
set of macros. To make that possible, most of the use of LARGE_INTEGER had to  
be removed, which looks nicer anyway.  
  
To avoid users of the API relying on the integer representation, we wrap the  
64bit integer inside struct struct instr_time.  
  
Author: Andres Freund <[email protected]>  
Author: Lukas Fittl <[email protected]>  
Author: David Geier <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/include/portability/instr_time.h

Zero initialize uses of instr_time about to trigger compiler warnings

commit   : 25b2aba0c3a501e2af9579f1b629f155544935db    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 20 Jan 2023 21:16:47 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 20 Jan 2023 21:16:47 -0800    

Click here for diff

These are all not necessary from a correctness POV. However, in the near  
future instr_time will be simplified to an int64, at which point gcc would  
otherwise start to warn about the changed places.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/buffile.c
M src/backend/storage/ipc/latch.c
M src/bin/psql/common.c

Rework format of comments in headers for nodes

commit   : 5d29d525ffe028fdf6b2d3ff7502243e56c6c79a    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 21 Jan 2023 12:17:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 21 Jan 2023 12:17:02 +0900    

Click here for diff

This is similar to 835d476, except that this one is to add node  
attributes related to query jumbling and avoid long lines in the headers  
and in the node structures changed by this commit.  
  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/Y5BHOUhX3zTH/[email protected]  

M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h

Move queryjumble.c code to src/backend/nodes/

commit   : 8eba3e3f020843a7641121e778e161b58ec2e490    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 21 Jan 2023 11:48:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 21 Jan 2023 11:48:37 +0900    

Click here for diff

This will ease a follow-up move that will generate automatically this  
code.  The C file is renamed, for consistency with the node-related  
files whose code are generated by gen_node_support.pl:  
- queryjumble.c -> queryjumblefuncs.c  
- utils/queryjumble.h -> nodes/queryjumble.h  
  
Per a suggestion from Peter Eisentraut.  
  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/Y5BHOUhX3zTH/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/nodes/Makefile
M src/backend/nodes/meson.build
R099 src/backend/utils/misc/queryjumble.c src/backend/nodes/queryjumblefuncs.c
M src/backend/parser/analyze.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/Makefile
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/meson.build
R098 src/include/utils/queryjumble.h src/include/nodes/queryjumble.h
M src/include/parser/analyze.h

Bump catversion for 6e2775e4d4e47775f0d933e4a93c148024a3bc63.

commit   : 557890920dd03b5a7839e81deeb6099bd43f3b29    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2023 16:37:26 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2023 16:37:26 -0500    

Click here for diff

It creates a new predefined role.  

M src/include/catalog/catversion.h

Add new GUC reserved_connections.

commit   : 6e2775e4d4e47775f0d933e4a93c148024a3bc63    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2023 15:36:36 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2023 15:36:36 -0500    

Click here for diff

This provides a way to reserve connection slots for non-superusers.  
The slots reserved via the new GUC are available only to users who  
have the new predefined role pg_use_reserved_connections.  
superuser_reserved_connections remains as a final reserve in case  
reserved_connections has been exhausted.  
  
Patch by Nathan Bossart. Reviewed by Tushar Ahuja and by me.  
  
Discussion: http://postgr.es/m/20230119194601.GA4105788@nathanxps13  

M doc/src/sgml/config.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/postmaster/postmaster.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/catalog/pg_authid.dat
M src/include/postmaster/postmaster.h
M src/include/storage/proc.h

Rename ReservedBackends variable to SuperuserReservedConnections.

commit   : fe00fec1f5d78a5cfe46ac72dc284ed4cc477be1    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2023 15:32:08 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2023 15:32:08 -0500    

Click here for diff

This is in preparation for adding a new reserved_connections GUC,  
but aligning the GUC name with the variable name is also a good  
idea on general principle.  
  
Patch by Nathan Bossart. Reviewed by Tushar Ahuja and by me.  
  
Discussion: http://postgr.es/m/20230119194601.GA4105788@nathanxps13  

M src/backend/postmaster/postmaster.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/include/postmaster/postmaster.h

Update docs and error message for superuser_reserved_connections.

commit   : 6c1d5ba4867828b387799a291cea9aaee2a8e3fc    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2023 15:23:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 20 Jan 2023 15:23:04 -0500    

Click here for diff

Commit ea92368cd1da1e290f9ab8efb7f60cb7598fc310 made max_wal_senders  
a separate pool of backends from max_connections, but the documentation  
and error message for superuser_reserved_connections weren't updated  
at the time, and as a result are somewhat misleading. Update.  
  
This is arguably a back-patchable bug fix, but because it seems quite  
minor, no back-patch.  
  
Patch by Nathan Bossart. Reviewed by Tushar Ahuja and by me.  
  
Discussion: http://postgr.es/m/20230119194601.GA4105788@nathanxps13  

M doc/src/sgml/config.sgml
M src/backend/utils/init/postinit.c

Describe each contrib module in its SGML section title

commit   : e86c8b728f3c905e5993211f6fd1d107d5a4614f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Jan 2023 20:01:59 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Jan 2023 20:01:59 +0100    

Click here for diff

The original titles only had the module name, which is not very useful  
when scanning the list.  By adding a very brief description to each  
title, the table of contents becomes friendlier.  
  
Also amend the introduction in the "additional modules" appendix, using  
the word "Extension" more extensively.  Nowadays, almost all contrib  
modules are extensions, so this is also helpful.  
  
Author: Karl O. Pinc <[email protected]>  
Reviewed-by: Brar Piening <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/amcheck.sgml
M doc/src/sgml/auth-delay.sgml
M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/basebackup-to-shell.sgml
M doc/src/sgml/basic-archive.sgml
M doc/src/sgml/bloom.sgml
M doc/src/sgml/btree-gin.sgml
M doc/src/sgml/btree-gist.sgml
M doc/src/sgml/citext.sgml
M doc/src/sgml/contrib-spi.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/cube.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/dict-int.sgml
M doc/src/sgml/dict-xsyn.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/file-fdw.sgml
M doc/src/sgml/fuzzystrmatch.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/intagg.sgml
M doc/src/sgml/intarray.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/lo.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/oldsnapshot.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/passwordcheck.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgprewarm.sgml
M doc/src/sgml/pgrowlocks.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/pgsurgery.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/pgvisibility.sgml
M doc/src/sgml/pgwalinspect.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/sslinfo.sgml
M doc/src/sgml/tablefunc.sgml
M doc/src/sgml/tcn.sgml
M doc/src/sgml/test-decoding.sgml
M doc/src/sgml/tsm-system-rows.sgml
M doc/src/sgml/tsm-system-time.sgml
M doc/src/sgml/unaccent.sgml
M doc/src/sgml/uuid-ossp.sgml
M doc/src/sgml/xml2.sgml

Remove SHM_QUEUE

commit   : d137cb52cb7fd44a3f24f3c750fbf7924a4e9532    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 19 Jan 2023 18:50:01 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 19 Jan 2023 18:50:01 -0800    

Click here for diff

Prior patches got rid of all the uses of SHM_QUEUE. ilist.h style lists are  
more widely used and have an easier to use interface. As there are no users  
left, remove SHM_QUEUE.  
  
Reviewed-by: Thomas Munro <[email protected]> (in an older version)  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/Makefile
M src/backend/storage/ipc/meson.build
D src/backend/storage/ipc/shmqueue.c
M src/include/storage/shmem.h
M src/tools/pgindent/typedefs.list

Use dlists instead of SHM_QUEUE for predicate locking

commit   : 9600371764583c80f3d94957e3d16daa2661154b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 19 Jan 2023 18:50:01 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 19 Jan 2023 18:50:01 -0800    

Click here for diff

Part of a series to remove SHM_QUEUE. ilist.h style lists are more widely used  
and have an easier to use interface.  
  
Reviewed-by: Thomas Munro <[email protected]> (in an older version)  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/predicate.c
M src/include/storage/predicate_internals.h

Improve the description of Output Plugin Callbacks.

commit   : 7670add9f43aeb291603c7052a2610675e1924f7    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 20 Jan 2023 08:12:19 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 20 Jan 2023 08:12:19 +0530    

Click here for diff

We were inconsistently specifying the required and optional marking for  
plugin callbacks. Additionally, this patch improves the description for  
stream_prepare callback.  
  
Author: Wang wei  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/OS3PR01MB627553DAFD39ECDADD08DC909EFC9@OS3PR01MB6275.jpnprd01.prod.outlook.com  

M doc/src/sgml/logicaldecoding.sgml

Support the same patterns for pg-user in pg_ident.conf as in pg_hba.conf

commit   : efb6f4a4f9b627b9447f5cd8e955d43a7066c30c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 20 Jan 2023 11:21:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 20 Jan 2023 11:21:55 +0900    

Click here for diff

While pg_hba.conf has support for non-literal username matches, and  
this commit extends the capabilities that are supported for the  
PostgreSQL user listed in an ident entry part of pg_ident.conf, with  
support for:  
1. The "all" keyword, where all the requested users are allowed.  
2. Membership checks using the + prefix.  
3. Using a regex to match against multiple roles.  
  
1. is a feature that has been requested by Jelte Fennema, 2. something  
that has been mentioned independently by Andrew Dunstan, and 3. is  
something I came up with while discussing how to extend the first one,  
whose implementation is facilitated by 8fea868.  
  
This allows matching certain system users against many different  
postgres users with a single line in pg_ident.conf.  Without this, one  
would need one line for each of the postgres users that a system user  
can log in as, which can be cumbersome to maintain.  
  
Tests are added to the TAP test of peer authentication to provide  
coverage for all that.  
  
Note that this introduces a set of backward-incompatible changes to be  
able to detect the new patterns, for the following cases:  
- A role named "all".  
- A role prefixed with '+' characters, which is something that would not  
have worked in HBA entries anyway.  
- A role prefixed by a slash character, similarly to 8fea868.  
Any of these can be still be handled by using quotes in the Postgres  
role defined in an ident entry.  
  
A huge advantage of this change is that the code applies the same checks  
for the Postgres roles in HBA and ident entries, via the common routine  
check_role().  
  
**This compatibility change should be mentioned in the release notes.**  
  
Author: Jelte Fennema  
Discussion: https://postgr.es/m/DBBPR83MB0507FEC2E8965012990A80D0F7FC9@DBBPR83MB0507.EURPRD83.prod.outlook.com  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/hba.c
M src/test/authentication/t/003_peer.pl

Avoid harmless warning from pg_dump --if-exists mode.

commit   : 74739d1d3ff6b408895a5908657ffb0648df3d70    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2023 19:32:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2023 19:32:46 -0500    

Click here for diff

If the public schema has a non-default owner (perhaps due to  
dropping and recreating it) then use of pg_dump's "--if-exists"  
option results in a warning message:  
  
warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it"  
  
This is harmless since the dump output is the same either way,  
but nonetheless it's undesirable.  It's the fault of commit  
a7a7be1f2, which created situations where a TOC entry's "defn"  
or "dropStmt" fields could be just comments.  Although that  
commit fixed up the kluges in pg_backup_archiver.c that munge defn  
strings, it missed doing so for the one that munges dropStmts.  
  
Per bug# 17753 from Justin Zhang.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup_archiver.c

Use appendStringInfoSpaces in more places

commit   : 9f1ca6ce6596f1f77adc323769f2f8303ddad14f    
  
author   : David Rowley <[email protected]>    
date     : Fri, 20 Jan 2023 13:07:24 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 20 Jan 2023 13:07:24 +1300    

Click here for diff

This adjusts a few places which were appending a string constant  
containing spaces onto a StringInfo.  We have appendStringInfoSpaces for  
that job, so let's use that instead.  
  
For the change to jsonb.c's add_indent() function, appendStringInfoString  
was being called inside a loop to append 4 spaces on each loop.  This  
meant that enlargeStringInfo would get called once per loop.  Here it  
should be much more efficient to get rid of the loop and just calculate  
the number of spaces with "level * 4" and just append all the spaces in  
one go.  
  
Here we additionally adjust the appendStringInfoSpaces function so it  
makes use of memset rather than a while loop to apply the required spaces  
to the StringInfo.  One of the problems with the while loop was that it  
was incrementing one variable and decrementing another variable once per  
loop.  That's more work than what's required to get the job done.  We may  
as well use memset for this rather than trying to optimize the existing  
loop.  Some testing has shown memset is faster even for very small sizes.  
  
Discussion: https://postgr.es/m/CAApHDvp_rKkvwudBKgBHniNRg67bzXVjyvVKfX0G2zS967K43A@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/utils/adt/jsonb.c
M src/common/stringinfo.c

Improve comment about GetWALAvailability's WALAVAIL_REMOVED code.

commit   : 1ca604c2018456f2da357d944e0f03c3efaeb00d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2023 18:41:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2023 18:41:08 -0500    

Click here for diff

Sirisha Chamarthi and Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/CAKrAKeXt-=bgm=d+EDmcC9kWoikp8kbVb3LH0K3K+AGGsykpHQ@mail.gmail.com  

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

Fix ts_headline() to handle ORs and phrase queries more honestly.

commit   : 5a617d75d3b31414f378dd764a11db1a08fa79bb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2023 16:21:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2023 16:21:44 -0500    

Click here for diff

This patch largely reverts what I did in commits c9b0c678d and  
78e73e875.  The maximum cover length limit that I added in 78e73e875  
(to band-aid over c9b0c678d's performance issues) creates too many  
user-visible behavior discrepancies, as complained of for example in  
bug #17691.  The real problem with hlCover() is not what I thought  
at the time, but more that it seems to have been designed with only  
AND tsquery semantics in mind.  It doesn't work quite right for OR,  
and even less so for NOT or phrase queries.  However, we can improve  
that situation by building a variant of TS_execute() that returns a  
list of match locations.  We already get an ExecPhraseData struct  
representing match locations for the primitive case of a simple match,  
as well as one for a phrase match; we just need to add some logic to  
combine these for AND and OR operators.  The result is a list of  
ExecPhraseDatas, which hlCover can regard as having simple AND  
semantics, so that its old algorithm works correctly.  
  
There's still a lot not to like about ts_headline's behavior, but  
I think the remaining issues have to do with the heuristics used  
in mark_hl_words and mark_hl_fragments (which, likewise, were not  
revisited when phrase search was added).  Improving those is a task  
for another day.  
  
Patch by me; thanks to Alvaro Herrera for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/tsvector_op.c
M src/include/tsearch/ts_utils.h
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/tsearch.sql

Log the correct ending timestamp in recovery_target_xid mode.

commit   : 44e9e34266efd42901bf7b12552f2033972d70b7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2023 12:23:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jan 2023 12:23:20 -0500    

Click here for diff

When ending recovery based on recovery_target_xid matching with  
recovery_target_inclusive = off, we printed an incorrect timestamp  
(always 2000-01-01) in the "recovery stopping before ... transaction"  
log message.  This is a consequence of sloppy refactoring in  
c945af80c: the code to fetch recordXtime out of the commit/abort  
record used to be executed unconditionally, but it was changed  
to get called only in the RECOVERY_TARGET_TIME case.  We need only  
flip the order of operations to restore the intended behavior.  
  
Per report from Torsten Förtsch.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CAKkG4_kUevPqbmyOfLajx7opAQk6Cvwkvx0HRcFjSPfRPTXanA@mail.gmail.com  

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

Remove some dead code in selfuncs.c

commit   : 438e6b7240905c8055f9e221187f2ac818876169    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jan 2023 12:54:15 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jan 2023 12:54:15 +0100    

Click here for diff

RelOptInfo.userid is the same for all relations in a given inheritance  
tree, so the code in examine_variable() and example_simple_variable()  
that repeats the ACL checks on the root parent rel instead of a given  
leaf child relations need not recompute userid too.  
  
Author: Amit Langote <[email protected]>  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/relnode.c
M src/backend/utils/adt/selfuncs.c

Constify proclist.h

commit   : 48880840f18cb75fcaecc77b5e7816b92c27157b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jan 2023 09:45:34 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jan 2023 09:45:34 +0100    

Click here for diff

This is a follow-up to c8ad4d81.  
  
Author: Aleksander Alekseev  
Discussion: https://www.postgresql.org/message-id/flat/CAJ7c6TM084Ai_8%3DfZaWtULJBLtT1bgzL%3Dk9vHMYom3eyZsekAA%40mail.gmail.com  

M src/include/storage/proclist.h

doc: Fix some issues in logical replication section

commit   : 4f74f5641d53559ec44e74d5bf552e167fdd5d20    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Jan 2023 14:00:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Jan 2023 14:00:23 +0900    

Click here for diff

wal_retrieve_retry_interval was mentioned under an incorrect name, and  
wal_sender_timeout was not listed as affecting WAL senders in logical  
replication mode.  
  
Author: Takamichi Osumi  
Discussion: https://postgr.es/m/TYCPR01MB8373D65E6B0A769ED12EADCBEDC79@TYCPR01MB8373.jpnprd01.prod.outlook.com  

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

Add missing assign hook for GUC checkpoint_completion_target

commit   : 7e8a80d1fefd1e96992652ed5a628c437971c82e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Jan 2023 13:13:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Jan 2023 13:13:05 +0900    

Click here for diff

This is wrong since 88e9823, that has switched the WAL sizing  
configuration from checkpoint_segments to min_wal_size and  
max_wal_size.  This missed the recalculation of the internal value of  
the internal "CheckPointSegments", that works as a mapping of the old  
GUC checkpoint_segments, on reload, for example, and it controls the  
timing of checkpoints depending on the volume of WAL generated.  
  
Most users tend to leave checkpoint_completion_target at 0.9 to smooth  
the I/O workload, which is why I guess this has gone unnoticed for so  
long, still it can be useful to tweak and reload the value dynamically  
in some cases to control the timing of checkpoints.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACXgPPAm28mruojSBno+F_=9cTOOxHAywu_dfZPeBdybQw@mail.gmail.com  
Backpatch-through: 11  

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

Fix failure with perlcritic in psql's create_help.pl

commit   : 6ba6306256a37524bbbc76402e69ef3d32d355fd    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Jan 2023 10:01:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Jan 2023 10:01:53 +0900    

Click here for diff

No buildfarm members have reported that yet, but a recently-refreshed  
Debian host did.  
  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/Y8ey5z4Nav62g4/[email protected]  
Backpatch-through: 11  

M src/bin/psql/create_help.pl

Fix AdjustUpgrade.pm's view conversion list for --with-lz4.

commit   : a3b65fb28238fe7f4a1ae9685d39ff0c11bdb9d3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2023 16:51:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2023 16:51:40 -0500    

Click here for diff

Turns out the compression.sql test creates a view that needs  
to be adjusted in the wake of 47bb9db75 --- except that without  
--with-lz4, it fails to create the view at all, so I'd not  
noticed this in testing.  
  
Per buildfarm member crake.  

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

Update expected/collate.windows.win1252.out for 47bb9db75.

commit   : 5ea2234670e58000c7ffde38df3bea91972bc2df    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2023 15:27:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2023 15:27:29 -0500    

Click here for diff

This delta in expected output wasn't spotted in any previous  
testing of the patch.  Reported by Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/collate.windows.win1252.out

Use dlists instead of SHM_QUEUE for syncrep queue

commit   : 12605414a7d63ccbe36de2b530847bdfc9cf7447    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2023 12:15:05 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2023 12:15:05 -0800    

Click here for diff

Part of a series to remove SHM_QUEUE. ilist.h style lists are more widely used  
and have an easier to use interface.  
  
Reviewed-by: Thomas Munro <[email protected]> (in an older version)  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/syncrep.c
M src/backend/replication/walsender.c
M src/backend/storage/lmgr/proc.c
M src/include/replication/walsender_private.h
M src/include/storage/proc.h

Use dlist/dclist instead of PROC_QUEUE / SHM_QUEUE for heavyweight locks

commit   : 5764f611e10b126e09e37fdffbe884c44643a6ce    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2023 11:41:14 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2023 11:41:14 -0800    

Click here for diff

Part of a series to remove SHM_QUEUE. ilist.h style lists are more widely used  
and have an easier to use interface.  
  
As PROC_QUEUE is now unused, remove it.  
  
Reviewed-by: Thomas Munro <[email protected]> (in an older version)  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/twophase.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lock.h
M src/include/storage/proc.h
M src/tools/pgindent/typedefs.list

Add detached node functions to ilist

commit   : 51384cc40c4a72c81d2475089ab8a1cf98ea56ff    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2023 11:41:14 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2023 11:41:14 -0800    

Click here for diff

These allow to test whether an element is in a list by checking whether  
prev/next are NULL. Needed to replace SHMQueueIsDetached() when converting  
from SHM_QUEUE to ilist.h style lists.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/include/lib/ilist.h

Fix ILIST_DEBUG build

commit   : 2b16208753770318085b1201a6d101cab2697132    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2023 10:22:37 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 18 Jan 2023 10:22:37 -0800    

Click here for diff

In c8ad4d8166a dlist_member_check()'s arguments were made const. Unfortunately  
the implementation of dlist_member_check() used dlist_foreach(), which  
currently doesn't work for const lists.  
  
As a workaround, open-code the list iteration. The other check functions  
already do so.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/lib/ilist.c

Get rid of the "new" and "old" entries in a view's rangetable.

commit   : 47bb9db75996232ea71fc1e1888ffb0e70579b54    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2023 13:23:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2023 13:23:57 -0500    

Click here for diff

The rule system needs "old" and/or "new" pseudo-RTEs in rule actions  
that are ON INSERT/UPDATE/DELETE.  Historically it's put such entries  
into the ON SELECT rules of views as well, but those are really quite  
vestigial.  The only thing we've used them for is to carry the  
view's relid forward to AcquireExecutorLocks (so that we can  
re-lock the view to verify it hasn't changed before re-using a plan)  
and to carry its relid and permissions data forward to execution-time  
permissions checks.  What we can do instead of that is to retain  
these fields of the RTE_RELATION RTE for the view even after we  
convert it to an RTE_SUBQUERY RTE.  This requires a tiny amount of  
extra complication in the planner and AcquireExecutorLocks, but on  
the other hand we can get rid of the logic that moves that data from  
one place to another.  
  
The principal immediate benefit of doing this, aside from a small  
saving in the pg_rewrite data for views, is that these pseudo-RTEs  
no longer trigger ruleutils.c's heuristic about qualifying variable  
names when the rangetable's length is more than 1.  That results  
in quite a number of small simplifications in regression test outputs,  
which are all to the good IMO.  
  
Bump catversion because we need to dump a few more fields of  
RTE_SUBQUERY RTEs.  While those will always be zeroes anyway in  
stored rules (because we'd never populate them until query rewrite)  
they are useful for debugging, and it seems like we'd better make  
sure to transmit such RTEs accurately in plans sent to parallel  
workers.  I don't think the executor actually examines these fields  
after startup, but someday it might.  
  
This is a second attempt at committing 1b4d280ea.  The difference  
from the first time is that now we can add some filtering rules to  
AdjustUpgrade.pm to allow cross-version upgrade testing to pass  
despite all the cosmetic changes in CREATE VIEW outputs.  
  
Amit Langote (filtering rules by me)  
  
Discussion: https://postgr.es/m/CA+HiwqEf7gPN4Hn+LoZ4tP2q_Qt7n3vw7-6fJKOf92tSEnX6Gg@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/lockcmds.c
M src/backend/commands/view.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/cache/plancache.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/compression.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/expressions.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/limit.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/tablesample.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/window.out
M src/test/regress/expected/with.out
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_2.out

Remove redundant grouping and DISTINCT columns.

commit   : 8d83a5d0a2673174dc478e707de1f502935391a5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2023 12:37:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jan 2023 12:37:57 -0500    

Click here for diff

Avoid explicitly grouping by columns that we know are redundant  
for sorting, for example we need group by only one of x and y in  
	SELECT ... WHERE x = y GROUP BY x, y  
This comes up more often than you might think, as shown by the  
changes in the regression tests.  It's nearly free to detect too,  
since we are just piggybacking on the existing logic that detects  
redundant pathkeys.  (In some of the existing plans that change,  
it's visible that a sort step preceding the grouping step already  
didn't bother to sort by the redundant column, making the old plan  
a bit silly-looking.)  
  
To do this, build processed_groupClause and processed_distinctClause  
lists that omit any provably-redundant sort items, and consult those  
not the originals where relevant.  This means that within the  
planner, one should usually consult root->processed_groupClause or  
root->processed_distinctClause if one wants to know which columns  
are to be grouped on; but to check whether grouping or distinct-ing  
is happening at all, check non-NIL-ness of parse->groupClause or  
parse->distinctClause.  This is comparable to longstanding rules  
about handling the HAVING clause, so I don't think it'll be a huge  
maintenance problem.  
  
nodeAgg.c also needs minor mods, because it's now possible to generate  
AGG_PLAIN and AGG_SORTED Agg nodes with zero grouping columns.  
  
Patch by me; thanks to Richard Guo and David Rowley for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_trgm/expected/pg_trgm.out
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/executor/nodeAgg.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/paths.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/select_distinct.out

Display the leader apply worker's PID for parallel apply workers.

commit   : d540a02a724b9643205abce8c5644a0f0908f6e3    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 18 Jan 2023 09:03:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 18 Jan 2023 09:03:12 +0530    

Click here for diff

Add leader_pid to pg_stat_subscription. leader_pid is the process ID of  
the leader apply worker if this process is a parallel apply worker. If  
this field is NULL, it indicates that the process is a leader apply  
worker or a synchronization worker. The new column makes it easier to  
distinguish parallel apply workers from other kinds of workers and helps  
to identify the leader for the parallel workers corresponding to a  
particular subscription.  
  
Additionally, update the leader_pid column in pg_stat_activity as well to  
display the PID of the leader apply worker for parallel apply workers.  
  
Author: Hou Zhijie  
Reviewed-by: Peter Smith, Sawada Masahiko, Amit Kapila, Shveta Mallik  
Discussion: https://postgr.es/m/CAA4eK1+wyN6zpaHUkCLorEWNx75MG0xhMwcFhvjqm2KURZEAGw@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/logicallauncher.h
M src/include/replication/worker_internal.h
M src/test/regress/expected/rules.out

Refactor code for restoring files via shell commands

commit   : 14bdb3f13de16523609d838b725540af5e23ddd3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Jan 2023 11:15:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Jan 2023 11:15:48 +0900    

Click here for diff

Presently, restore_command uses a different code path than  
archive_cleanup_command and recovery_end_command.  These code paths  
are similar and can be easily combined, as long as it is possible to  
identify if a command should:  
- Issue a FATAL on signal.  
- Exit immediately on SIGTERM.  
  
While on it, this removes src/common/archive.c and its associated  
header.  Since the introduction of c96de2c, BuildRestoreCommand() has  
become a simple wrapper of replace_percent_placeholders() able to call  
make_native_path().  This simplifies shell_restore.c as long as  
RestoreArchivedFile() includes a call to make_native_path().  
  
Author: Nathan Bossart  
Reviewed-by: Andres Freund, Michael Paquier  
Discussion: https://postgr.es/m/20221227192449.GA3672473@nathanxps13  

M src/backend/access/transam/shell_restore.c
M src/backend/access/transam/xlogarchive.c
M src/common/Makefile
D src/common/archive.c
M src/common/meson.build
M src/fe_utils/archive.c
D src/include/common/archive.h
M src/tools/msvc/Mkvcbuild.pm

Constify the arguments of copydir.h functions

commit   : 2f31f405e1fa561db27e8dc6f7f3cb3dbd8c0c4f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Jan 2023 08:55:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Jan 2023 08:55:26 +0900    

Click here for diff

This makes sure that the internal logic of these functions does not  
attempt to change the value of the arguments constified, and it removes  
one unconstify() in basic_archive.c.  
  
Author: Nathan Bossart  
Reviewed-by: Andrew Dunstan, Peter Eisentraut  
Discussion: https://postgr.es/m/20230114231126.GA2580330@nathanxps13  

M contrib/basic_archive/basic_archive.c
M src/backend/storage/file/copydir.c
M src/include/storage/copydir.h

Doc: fix a few oddly-spelled SGML ID attributes.

commit   : 09d465c397165f99c37e9002a4e7b281111d2580    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Jan 2023 17:13:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Jan 2023 17:13:18 -0500    

Click here for diff

Avoid use of "_" in SGML IDs.  Awhile back that was actually  
disallowed by the toolchain, as a consequence of which our convention  
has been to use "-" instead.  Fix a couple of stragglers that are  
particularly inconsistent with that convention and with related IDs.  
  
This is just neatnik-ism, so no need for back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/prepare.sgml

meson: Add two missing regress tests

commit   : 27da598961ce443e9010c19085d17dc2b6a04d56    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 17 Jan 2023 13:49:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 17 Jan 2023 13:49:09 -0800    

Click here for diff

It's likely worth adding some automated way of preventing further  
omissions. We're discussing how to best do that.  
  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/meson.build
M src/test/modules/unsafe_tests/meson.build

AdjustUpgrade.pm should zap test_ext_cine, too.

commit   : 3a36ca03e423ad1e2c9f19cd0da5e7dedb48734e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Jan 2023 16:00:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Jan 2023 16:00:39 -0500    

Click here for diff

test_extensions' test_ext_cine extension has the same upgrade hazard  
as test_ext7: the regression test leaves it in an updated state  
from which no downgrade path to default is provided.  This causes  
the update_extensions.sql script helpfully provided by pg_upgrade  
to fail.  So drop it in cross-version-upgrade testing.  
  
Not entirely sure how come I didn't hit this in testing yesterday;  
possibly I'd built the upgrade reference databases with  
testmodules-install-check disabled.  
  
Backpatch to v10 where this module was introduced.  

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

Refactor recordExtObjInitPriv()

commit   : 2a1d7071c4ed750abb8b39436bb89c7d152bddb8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jan 2023 20:03:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jan 2023 20:03:35 +0100    

Click here for diff

Instead of half a dozen of mostly-duplicate conditional branches,  
write one common one that can handle most catalogs.  We already have  
all the information we need, such as which system catalog corresponds  
to which catalog table and which column is the ACL column.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/aclchk.c

Remove AggregateRelationId from recordExtObjInitPriv()

commit   : 13b345df6438f222daf56eee86cb272628d1f1c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jan 2023 20:03:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jan 2023 20:03:35 +0100    

Click here for diff

This was erroneous, because AggregateRelationId has no OID, so it  
cannot be part of an extension directly.  (Aggregates are registered  
via pg_proc.)  No harm in practice, but better to make it correct.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/aclchk.c

Remove redundant relkind check

commit   : 15eb1228800a35042ef318f941173aa8b89002d1    
  
author   : John Naylor <[email protected]>    
date     : Tue, 17 Jan 2023 14:25:01 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 17 Jan 2023 14:25:01 +0700    

Click here for diff

Ranier Vilela  
  
Reviewed by Justin Pryzby  
Discussion: https://www.postgresql.org/message-id/CAEudQAp2R2fbbi0OHHhv_n4%3DCh0t1VtjObR9YMqtGKHJ%2BfaUFQ%40mail.gmail.com  

M src/bin/pg_dump/pg_dump.c

Remove dead code in formatting.c

commit   : e29c5653434ebf6a88d009746d21ca3a59ddb69b    
  
author   : John Naylor <[email protected]>    
date     : Tue, 17 Jan 2023 13:52:11 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 17 Jan 2023 13:52:11 +0700    

Click here for diff

Remove some code guarded by IS_MINUS() or IS_PLUS(), where the entire  
stanza is inside an else-block where both of these are false. This  
should slightly improve test coverage.  
  
While at it, remove coding that apparently assumes that unsetting a  
bit is so expensive that we have to first check if it's already set  
in the first place.  
  
Per Coverity report from Ranier Vilela  
Analysis and review by Justin Pryzby  
  
Discussion: https://www.postgresql.org/message-id/20221223010818.GP1153%40telsasoft.com  

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

Improve the code to decide and process the apply action.

commit   : c981d9145deae067bc67bc8f8bcd68b300ece3fe    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 17 Jan 2023 11:28:22 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 17 Jan 2023 11:28:22 +0530    

Click here for diff

The code that decides the apply action missed to handle non-transactional  
messages and we didn't catch it in our testing as currently such messages  
are simply ignored by the apply worker. This was introduced by changes in  
commit 216a784829.  
  
While testing this, I noticed that we forgot to reset stream_xid after  
processing the stream stop message which could also result in the wrong  
apply action after the fix for non-transactional messages.  
  
In passing, change assert to elog for unexpected apply action in some of  
the routines so as to catch the problems in the production environment, if  
any.  
  
Reported-by: Tomas Vondra  
Author: Amit Kapila  
Reviewed-by: Tomas Vondra, Sawada Masahiko, Hou Zhijie  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAA4eK1+wyN6zpaHUkCLorEWNx75MG0xhMwcFhvjqm2KURZEAGw@mail.gmail.com  

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

Fix typo in comment.

commit   : 4f985aba6963b8669325e1c58585d04257977fda    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 17 Jan 2023 10:39:11 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 17 Jan 2023 10:39:11 +0530    

Click here for diff

Author: Osumi Takamichi  
Discussion: https://postgr.es/m/TYCPR01MB83737EA140C79B7D099F65E8EDC69@TYCPR01MB8373.jpnprd01.prod.outlook.com  

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

Track behavior of \1 in pg_ident.conf when quoted

commit   : 0b717432ff13683f9d13f007dab1c3380cae2f0d    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 17 Jan 2023 13:41:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 17 Jan 2023 13:41:09 +0900    

Click here for diff

Entries of pg-user in pg_ident.conf that are quoted and include '\1'  
allow a replacement from a subexpression in a system user regexp.  This  
commit adds a test to track this behavior and a note in the  
documentation, as it could be affected by the use of an AuthToken for  
the pg-user in the IdentLines parsed.  
  
This subject has come up in the discussion aimed at extending the  
support of pg-user in ident entries for more patterns.  
  
Author: Jelte Fennema  
Discussion: https://postgr.es/m/CAGECzQRNow4MwkBjgPxywXdJU_K3a9+Pm78JB7De3yQwwkTDew@mail.gmail.com  

M doc/src/sgml/client-auth.sgml
M src/test/authentication/t/003_peer.pl

Don't presort ORDER BY/DISTINCT Aggrefs with volatile functions

commit   : da5800d5fa636c6e10c9c98402d872c76aa1c8d0    
  
author   : David Rowley <[email protected]>    
date     : Tue, 17 Jan 2023 16:37:06 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 17 Jan 2023 16:37:06 +1300    

Click here for diff

In 1349d2790, we gave the planner the ability to provide ORDER BY/DISTINCT  
Aggrefs with presorted input so that nodeAgg would not have to perform  
sorts during execution.  That commit failed to properly consider the  
implications of if the Aggref had a volatile function in its ORDER  
BY/DISTINCT clause.  As it happened, this resulted in an ERROR about the  
volatile function being missing from the targetlist.  
  
Here, instead of adding the volatile function to the targetlist, we just  
never consider an Aggref with a volatile function in its ORDER BY/DISTINCT  
clause when choosing which Aggrefs we should sort by.  We do this as if we  
were to choose a plan which provided these aggregates with presorted  
input, then if there were many such aggregates which could all share the  
same sort order, then it may be surprising if they all shared the same  
sort sometimes and didn't at other times when some other set of aggregates  
were given presorted results.  We can avoid this inconsistency by just  
never providing these volatile function aggregates with presorted input.  
  
Reported-by: Dean Rasheed  
Discussion: https://postgr.es/m/CAEZATCWETioXs5kY8vT6BVguY41_wD962VDk=u_Nvd7S1UXzuQ@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Create common infrastructure for cross-version upgrade testing.

commit   : 52585f8f072ac187380f7e02183e87dcf6789ff0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Jan 2023 20:35:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Jan 2023 20:35:53 -0500    

Click here for diff

To test pg_upgrade across major PG versions, we have to be able to  
modify or drop any old objects with no-longer-supported properties,  
and we have to be able to deal with cosmetic changes in pg_dump output.  
Up to now, the buildfarm and pg_upgrade's own test infrastructure had  
separate implementations of the former, and we had nothing but very  
ad-hoc rules for the latter (including an arbitrary threshold on how  
many lines of unchecked diff were okay!).  This patch creates a Perl  
module that can be shared by both those use-cases, and adds logic  
that deals with pg_dump output diffs in a much more tightly defined  
fashion.  
  
This largely supersedes previous efforts in commits 0df9641d3,  
9814ff550, and 62be9e4cd, which developed a SQL-script-based solution  
for the task of dropping old objects.  There was nothing fundamentally  
wrong with that work in itself, but it had no basis for solving the  
output-formatting problem.  The most plausible way to deal with  
formatting is to build a Perl module that can perform editing on the  
dump files; and once we commit to that, it makes more sense for the  
same module to also embed the knowledge of what has to be done for  
dropping old objects.  
  
Back-patch versions of the helper module as far as 9.2, to  
support buildfarm animals that still test that far back.  
It's also necessary to back-patch PostgreSQL/Version.pm,  
because the new code depends on that.  I fixed up pg_upgrade's  
002_pg_upgrade.pl in v15, but did not look into back-patching  
it further than that.  
  
Tom Lane and Andrew Dunstan  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/TESTING
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
D src/bin/pg_upgrade/upgrade_adapt.sql
A src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm

Tighten up VACUUM's approach to setting VM bits.

commit   : 980ae173108e353045e5ab4a842bb21e9dfe6715    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 16 Jan 2023 09:34:37 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 16 Jan 2023 09:34:37 -0800    

Click here for diff

Tighten up the way that visibilitymap_set() is called: request that both  
the all-visible and all-frozen bits get set whenever the all-frozen bit  
is set, regardless of what we think we know about the present state of  
the all-visible bit.  Also make sure that the page level PD_ALL_VISIBLE  
flag is set in the same code path.  
  
In practice there doesn't seem to be a concrete scenario in which the  
previous approach could lead to inconsistencies.  It was almost possible  
in scenarios involving concurrent HOT updates from transactions that  
abort, but (unlike pruning) freezing can never remove XIDs > VACUUM's  
OldestXmin, even those from transactions that are known to have aborted.  
That was protective here.  
  
These issues have been around since commit a892234f83, which added the  
all-frozen bit to the VM fork.  There is no known live bug here, so no  
backpatch.  
  
In passing, add some defensive assertions to catch the issue, and stop  
reading the existing state of the VM when setting the VM in VACUUM's  
final heap pass.  We already know that affected pages must have had at  
least one LP_DEAD item before we set it LP_UNUSED, so there is no point  
in reading the VM when it is set like this.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznuNGSzF8v6OsgjaC5aYsb3cZ6HW6MLm30X0d65cmSH6A@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c

Assorted improvements to SECURITY DEFINER functions documentation.

commit   : 6fa66ec88ff29f5449d89e9891a00fe64afae34e    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 16 Jan 2023 10:49:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 16 Jan 2023 10:49:59 -0500    

Click here for diff

Add a cross-reference from the part of the page that introdues SECURITY  
INVOKER and SECURITY DEFINER to the part of the page that talks about  
writing SECURITY DEFINER functions safely, so that users are less likely  
to miss it.  
  
Remove discussion of the pre-8.3 behavior on the theory that it's  
probably not very relevant any more, that release having gone out of  
support nearly a decade ago.  
  
Add a mention of the new createrole_self_grant GUC, which in  
certain cases might need to be set to a safe value to avoid  
unexpected consequences.  
  
Possibly this section needs major surgery rather than just these  
small tweaks, but hopefully this is at least a small step  
forward.  
  
Discussion: http://postgr.es/m/CA+Tgmoauqd1cHQjsNEoxL5O-kEO4iC9dAPyCudSvmNqPJGmy9g@mail.gmail.com  

M doc/src/sgml/ref/create_function.sgml

More documentation update for GRANT ... WITH SET OPTION.

commit   : 3cdf7502f85c9e61913e05519f88580f008b8453    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 16 Jan 2023 10:35:29 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 16 Jan 2023 10:35:29 -0500    

Click here for diff

Update the reference pages for various ALTER commands that  
mentioned that you must be a member of role that will be the  
new owner to instead say that you must be able to SET ROLE  
to the new owner. Update ddl.sgml's generate statement on this  
topic along similar lines.  
  
Likewise, update CREATE SCHEMA and CREATE DATABASE, which  
have options to specify who will own the new objects, to say  
that you must be able to SET ROLE to the role that will own  
them.  
  
Finally, update the documentation for the GRANT statement  
itself with some general principles about how the SET option  
works and how it can be used.  
  
Patch by me, reviewed (but not fully endorsed) by Noah Misch.  
  
Discussion: http://postgr.es/m/CA+TgmoZk6VB3DQ83+DO5P_HP=M9PQAh1yj-KgeV30uKefVaWDg@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_aggregate.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_conversion.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_domain.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_large_object.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_opclass.sgml
M doc/src/sgml/ref/alter_operator.sgml
M doc/src/sgml/ref/alter_procedure.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_schema.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_server.sgml
M doc/src/sgml/ref/alter_statistics.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/alter_tablespace.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_schema.sgml
M doc/src/sgml/ref/grant.sgml

Add BufFileRead variants with short read and EOF detection

commit   : 20428d344a2964de6aaef9984fcd472f3c65d115    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jan 2023 09:20:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jan 2023 09:20:44 +0100    

Click here for diff

Most callers of BufFileRead() want to check whether they read the full  
specified length.  Checking this at every call site is very tedious.  
This patch provides additional variants BufFileReadExact() and  
BufFileReadMaybeEOF() that include the length checks.  
  
I considered changing BufFileRead() itself, but this function is also  
used in extensions, and so changing the behavior like this would  
create a lot of problems there.  The new names are analogous to the  
existing LogicalTapeReadExact().  
  
Reviewed-by: Amit Kapila <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/gist/gistbuildbuffers.c
M src/backend/backup/backup_manifest.c
M src/backend/executor/nodeHashjoin.c
M src/backend/replication/logical/worker.c
M src/backend/storage/file/buffile.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/tuplestore.c
M src/include/storage/buffile.h

Fix some BufFileRead() error reporting

commit   : 1561612e3bf3264c31618b9455d0c1003b9271ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jan 2023 09:20:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jan 2023 09:20:44 +0100    

Click here for diff

Remove "%m" from error messages where errno would be bogus.  Add short  
read byte counts where appropriate.  
  
This is equivalent to what was done in  
7897e3bb902c557412645b82120f4d95f7474906, but some code was apparently  
developed concurrently to that and not updated accordingly.  
  
Reviewed-by: Amit Kapila <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Refactor code in charge of running shell-based recovery commands

commit   : 9a740f81eb02e04179d78f3df2ce671276c27b07    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 16 Jan 2023 16:31:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 16 Jan 2023 16:31:43 +0900    

Click here for diff

The code specific to the execution of archive_cleanup_command,  
recovery_end_command and restore_command is moved to a new file named  
shell_restore.c.  The code is split into three functions:  
- shell_restore(), that attempts the execution of a shell-based  
restore_command.  
- shell_archive_cleanup(), for archive_cleanup_command.  
- shell_recovery_end(), for recovery_end_command.  
  
This introduces no functional changes, with failure patterns and logs  
generated in consequence being the same as before (one case actually  
generates one less DEBUG2 message "could not restore" when a restore  
command succeeds but the follow-up stat() to check the size fails, but  
that only matters with a elevel high enough).  
  
This is preparatory work for allowing recovery modules, a facility  
similar to archive modules, with callbacks shaped similarly to the  
functions introduced here.  
  
Author: Nathan Bossart  
Reviewed-by: Andres Freund, Michael Paquier  
Discussion: https://postgr.es/m/20221227192449.GA3672473@nathanxps13  

M src/backend/access/transam/Makefile
M src/backend/access/transam/meson.build
A src/backend/access/transam/shell_restore.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/include/access/xlogarchive.h

Store IdentLine->pg_user as an AuthToken

commit   : 02d3448f4f792964995b8071fa07176606e1af85    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 16 Jan 2023 13:58:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 16 Jan 2023 13:58:07 +0900    

Click here for diff

While system_user was stored as an AuthToken in IdentLine, pg_user was  
stored as a plain string.  This commit changes the code as we start  
storing pg_user as an AuthToken too.  
  
This does not have any functional changes, as all the operations on  
pg_user only use the string from the AuthToken.  There is no regexp  
compiled and no check based on its quoting, yet.  This is in preparation  
of more features that intend to extend its capabilities, like support  
for regexps and group membership.  
  
Author: Jelte Fennema  
Discussion: https://postgr.es/m/CAGECzQRNow4MwkBjgPxywXdJU_K3a9+Pm78JB7De3yQwwkTDew@mail.gmail.com  

M src/backend/libpq/hba.c
M src/backend/utils/adt/hbafuncs.c
M src/include/libpq/hba.h

Remove arbitrary FUNC_MAX_ARGS limit in int2vectorin and oidvectorin.

commit   : 647fa500547fdf2a967412633a9f6f21ba69e144    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Jan 2023 17:32:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Jan 2023 17:32:09 -0500    

Click here for diff

int2vectorin limited the number of array elements it'd take to  
FUNC_MAX_ARGS, which is probably fine for the traditional use-cases.  
But now that pg_publication_rel.prattrs is an int2vector, it's not  
fine at all: it's easy to construct cases where that can have up to  
about MaxTupleAttributeNumber entries.  Trying to replicate such  
tables leads to logical-replication failures.  
  
As long as we have to touch this code anyway, let's just remove  
the a-priori limit altogether, and let it accept any size that'll  
be allowed by repalloc.  (Note that since int2vector isn't toastable,  
we cannot store arrays longer than about BLCKSZ/2; but there is no  
good excuse for letting int2vectorin depend on that.  Perhaps we  
will lift the no-toast restriction someday.)  
  
While at it, also improve the equivalent logic in oidvectorin.  
I don't know of any practical use-case for long oidvectors right  
now, but doing it right actually makes the code shorter.  
  
Per report from Erik Rijkers.  Back-patch to v15 where  
pg_publication_rel.prattrs was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/int.c
M src/backend/utils/adt/oid.c

Make new GENERATED-expressions code more bulletproof.

commit   : 3f244d020fbf0b4f01d71e1b7620930be4bf9dc5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Jan 2023 13:14:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Jan 2023 13:14:52 -0500    

Click here for diff

In commit 8bf6ec3ba I assumed that no code path could reach  
ExecGetExtraUpdatedCols without having gone through  
ExecInitStoredGenerated.  That turns out not to be the case in  
logical replication: if there's an ON UPDATE trigger on the target  
table, trigger.c will call this code before anybody has set up its  
generated columns.  Having seen that, I don't have a lot of faith in  
there not being other such paths.  ExecGetExtraUpdatedCols can call  
ExecInitStoredGenerated for itself, as long as we are willing to  
assume that it is only called in CMD_UPDATE operations, which on  
the whole seems like a safer leap of faith.  
  
Per report from Vitaly Davydov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/nodeModifyTable.h
M src/test/subscription/t/011_generated.pl

Doc: fix typo in backup.sgml.

commit   : 1334b79a359fb842d2d3cfe5b61ad4ccff8b82a4    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sat, 14 Jan 2023 18:05:09 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sat, 14 Jan 2023 18:05:09 +0900    

Click here for diff

<varname>archive_command</varname> was unnecessarily repeated.  
  
Author: Tatsuo Ishii  
Reviewed-by: Amit Kapila  
Backpatch-through: 15  
Discussion: https://postgr.es/m/flat/20230114.110234.666053507266410467.t-ishii%40sranhm.sra.co.jp  

M doc/src/sgml/backup.sgml

Fix MAINTAIN privileges for toast tables and partitions.

commit   : ff9618e82a466fc9c635f9f087776e57b21e4f14    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 13 Jan 2023 15:32:37 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 13 Jan 2023 15:32:37 -0800    

Click here for diff

Commit 60684dd8 left loose ends when it came to maintaining toast  
tables or partitions.  
  
For toast tables, simply skip the privilege check if the toast table  
is an indirect target of the maintenance command, because the main  
table privileges have already been checked.  
  
For partitions, allow the maintenance command if the user has the  
MAINTAIN privilege on the partition or any parent.  
  
Also make CLUSTER emit "skipping" messages when the user doesn't have  
privileges, similar to VACUUM.  
  
Author: Nathan Bossart  
Reported-by: Pavel Luzanov  
Reviewed-by: Pavel Luzanov, Ted Yu  
Discussion: https://postgr.es/m/20230113231339.GA2422750@nathanxps13  

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/vacuum.out
M src/test/regress/sql/cluster.sql

Add 250c8ee07ed to git-blame-ignore-revs

commit   : ff23b592ad6621563d3128b26860bcb41daf9542    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 13 Jan 2023 15:33:17 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 13 Jan 2023 15:33:17 -0800    

Click here for diff

M .git-blame-ignore-revs

commit   : 250c8ee07ede8a104ae1471f6ebca204d94267dd    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 13 Jan 2023 15:23:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 13 Jan 2023 15:23:09 -0800    

Click here for diff

This is in preparation for commiting a larger patch series in the area.  
  
Discussion: https://postgr.es/m/CAAKRu_bHwGEbzNxxy+MQDkrsgog6aO6iUvajJ4d6PD98gFU7+w@mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h

Clean up useless "skipping" messages for VACUUM/ANALYZE.

commit   : d46a9792a8ebbbed7792b26d6dc0222d2bbde223    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 13 Jan 2023 14:42:03 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 13 Jan 2023 14:42:03 -0800    

Click here for diff

When VACUUM/ANALYZE are run on an entire database, it warns of  
skipping relations for which the user doesn't have sufficient  
privileges. That only makes sense for tables, so skip such messages  
for indexes, etc.  
  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/c0a85c2e83158560314b576b6241c8ed0aea1745.camel%40j-davis.com  

M src/backend/commands/vacuum.c

Simplify permissions for LOCK TABLE.

commit   : c44f6334ca6ff6d242d9eb6742441bc4e1294067    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 13 Jan 2023 14:14:54 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 13 Jan 2023 14:14:54 -0800    

Click here for diff

The prior behavior was confusing and hard to document. For instance,  
if you had UPDATE privileges, you could lock a table in any lock mode  
except ACCESS SHARE mode.  
  
Now, if granted a privilege to lock at a given mode, one also has  
privileges to lock at a less-conflicting mode. MAINTAIN, UPDATE,  
DELETE, and TRUNCATE privileges allow any lock mode. INSERT privileges  
allow ROW EXCLUSIVE (or below). SELECT privileges allow ACCESS SHARE.  
  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/9550c76535404a83156252b25a11babb4792ea1e.camel%40j-davis.com  

M doc/src/sgml/ref/lock.sgml
M src/backend/commands/lockcmds.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Ignore dropped and generated columns from the column list.

commit   : b7ae03953690a1dee455ba3823cc8f71a72cbe1d    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 13 Jan 2023 14:49:23 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 13 Jan 2023 14:49:23 +0530    

Click here for diff

We don't allow different column lists for the same table in the different  
publications of the single subscription. A publication with a column list  
except for dropped and generated columns should be considered the same as  
a publication with no column list (which implicitly includes all columns  
as part of the columns list). However, as we were not excluding the  
dropped and generated columns from the column list combining such  
publications leads to an error "cannot use different column lists for  
table ...".  
  
We decided not to backpatch this fix as there is a risk of users seeing  
this as a behavior change and also we didn't see any field report of this  
case.  
  
Author: Shi yu  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/OSZPR01MB631091CCBC56F195B1B9ACB0FDFE9@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/catalog/pg_publication.c
M src/backend/catalog/system_views.sql
M src/backend/replication/pgoutput/pgoutput.c
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out
M src/test/subscription/t/031_column_list.pl

Avoid creating parallel apply state hash table unless required.

commit   : dca8b01f5f1f7c83c59a16393724fbd8a29ddecb    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 13 Jan 2023 08:28:05 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 13 Jan 2023 08:28:05 +0530    

Click here for diff

This hash table is used to cache the state of streaming transactions being  
applied by the parallel apply workers. So, this should be created only  
when we are successful in launching at least one worker. This avoids rare  
case memory leak when we are never able to launch any worker.  
  
Author: Ted Yu  
Discussion: https://postgr.es/m/CALte62wg0rBR3Vj2beV=HiWo2qG9L0hzKcX=yULNER0wmf4aEw@mail.gmail.com  

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

Add tests for regex replacement with \1 in pg_ident.conf to 0003_peer.pl

commit   : e753ae6397fe16db8e8e5b3e34ca6d53b4eded61    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 Jan 2023 10:35:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 Jan 2023 10:35:28 +0900    

Click here for diff

Regexp replacement with \1 in pg_ident.conf is tested in one check of  
the kerberos test suite, still it requires a dependency on  
--with-gssapi to be triggered.  This commit adds to the test suite of  
peer authentication two tests to check the replacement of \1 in a  
pg-username, coupled with a system-username regexp:  
- With a subexpression in system-username, similarly to the kerberos  
test suite.  
- Without a subexpression in system-username, checking for a failure.  
This had no coverage until now, and the error pattern is checked in the  
server logs.  
  
Author: Jelte Fennema  
Discussion: https://postgr.es/m/CAGECzQRNow4MwkBjgPxywXdJU_K3a9+Pm78JB7De3yQwwkTDew@mail.gmail.com  

M src/test/authentication/t/003_peer.pl

doc: Simplify description of functions for pg_walinspect

commit   : 58597edea102258b21d5f4b4f0d7796c0ebf100a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 Jan 2023 09:29:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 Jan 2023 09:29:44 +0900    

Click here for diff

As introduced in 2258e76, the docs were hard to parse:  
- The examples used listed a lot of long records, bloating the output.  
These are switched to show less records with the expanded format,  
similarly to pageinspect.  
- The function descriptions listed all the OUT parameters, producing  
long lines.  This is updated so as only the input parameters are  
documented, clarifying the whole.  
- Remove one example on pg_get_wal_stats() when per_record is set to  
true, which is not really necessary once we know the output produced,  
and the behavior of the parameter is documented.  
  
While on it, fix a few grammar mistakes and simplify a couple of  
sentences.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVGcUpziGgQrcT-1G3dHWQQfWjYBu1YQ2ypv9y86dgogg@mail.gmail.com  
Backpatch-through: 15  

M doc/src/sgml/pgwalinspect.sgml

Fix WaitEventSetWait() buffer overrun.

commit   : f1821b58fc8deee49fba8397bd5baa4b40185110    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 13 Jan 2023 10:40:52 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 13 Jan 2023 10:40:52 +1300    

Click here for diff

The WAIT_USE_EPOLL and WAIT_USE_KQUEUE implementations of  
WaitEventSetWaitBlock() confused the size of their internal buffer with  
the size of the caller's output buffer, and could ask the kernel for too  
many events.  In fact the set of events retrieved from the kernel needs  
to be able to fit in both buffers, so take the smaller of the two.  
  
The WAIT_USE_POLL and WAIT_USE WIN32 implementations didn't have this  
confusion.  
  
This probably didn't come up before because we always used the same  
number in both places, but commit 7389aad6 calculates a dynamic size at  
construction time, while using MAXLISTEN for its output event buffer on  
the stack.  That seems like a reasonable thing to want to do, so  
consider this to be a pre-existing bug worth fixing.  
  
As discovered by valgrind on skink.  
  
Back-patch to all supported releases for epoll, and to release 13 for  
the kqueue part, which copied the incorrect epoll code.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/901504.1673504836%40sss.pgh.pa.us  

M src/backend/storage/ipc/latch.c

Fix jsonpath existense checking of missing variables

commit   : 3161ae86ce3ced0a91c2d3cdbbdc602d6e19892d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 12 Jan 2023 18:16:34 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 12 Jan 2023 18:16:34 +0300    

Click here for diff

The current jsonpath code assumes that the referenced variable always exists.  
It could only throw an error at the value valuation time.  At the same time  
existence checking assumes variable is present without valuation, and error  
suppression doesn't work for missing variables.  
  
This commit makes existense checking trigger an error for missing variables.  
This makes the overall behavior consistent.  
  
Backpatch to 12 where jsonpath was introduced.  
  
Reported-by: David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwbeytffJkVnEqDyLZ%3DrQsznoTh1OgDoOF3VmOMkxcTMjA%40mail.gmail.com  
Author: Alexander Korotkov, David G. Johnston  
Backpatch-through: 12  

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

Constify the arguments of ilist.c/h functions

commit   : c8ad4d8166aabd6ed5124e7e432166637d0fe646    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jan 2023 08:00:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jan 2023 08:00:51 +0100    

Click here for diff

Const qualifiers ensure that we don't do something stupid in the  
function implementation.  Additionally they clarify the interface.  As  
an example:  
  
    void  
    slist_delete(slist_head *head, const slist_node *node)  
  
Here one can instantly tell that node->next is not going to be set to  
NULL.  Finally, const qualifiers potentially allow the compiler to do  
more optimizations.  This being said, no benchmarking was done for  
this patch.  
  
The functions that return non-const pointers like slist_next_node(),  
dclist_next_node() etc. are not affected by the patch intentionally.  
  
Author: Aleksander Alekseev  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CAJ7c6TM2%3D08mNKD9aJg8vEY9hd%2BG4L7%2BNvh30UiNT3kShgRgNg%40mail.gmail.com  

M src/backend/lib/ilist.c
M src/include/lib/ilist.h

Code cleanup

commit   : 881fa869c6b0c4e2f310d1c145141dd9d6f53774    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jan 2023 07:37:39 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jan 2023 07:37:39 +0100    

Click here for diff

for commit c96de2ce1782116bd0489b1cd69ba88189a495e8  
  
Author: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20230111185434.GA1912982@nathanxps13  

M src/backend/access/transam/xlogarchive.c
M src/common/archive.c

commit   : 8607630d74cd83f636a72eb9f2eb62f67e1fb955    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Jan 2023 14:23:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Jan 2023 14:23:20 +0900    

Click here for diff

The code that handles authentication for user maps was pretty confusing  
with its choice of variable names.  It involves two types of users: a  
system user and a Postgres user (well, role), and these were not named  
consistently throughout the code that processes the user maps loaded  
from pg_ident.conf at authentication.  
  
This commit changes the following things to improve the situation:  
- Rename "pg_role" to "pg_user" and "token" to "system_user" in  
IndetLine.  These choices are more consistent with the pg_ident.conf  
example in the docs, as well.  "token" has been introduced recently in  
fc579e1, and it is way worse than the choice before that, "ident_user".  
- Switch the order of the fields in IdentLine to map with the order of  
the items in the ident files, as of map name, system user and PG user.  
- In check_ident_usermap(), rename "regexp_pgrole" to "expanded_pg_user"  
when processing a regexp for the system user entry in a user map.  This  
variable does not store a regular expression at all: it would be either  
a string or a substitution to \1 if the Postgres role is specified as  
such.  
  
Author: Jelte Fennema  
Discussion: https://postgr.es/m/CAGECzQTkwELHUOAKhvdA+m3tWbUQySHHkExJV8GAZ1pwgbEgXg@mail.gmail.com  

M src/backend/libpq/hba.c
M src/backend/utils/adt/hbafuncs.c
M src/include/libpq/hba.h

Fix incorrect comment in hba.h

commit   : bfd2542001a4a792a82a09607524e9b78a02217c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Jan 2023 13:49:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Jan 2023 13:49:28 +0900    

Click here for diff

A comment in hba.h mentioned that AuthTokens are used when building the  
IdentLines from pg_ident.conf, but since 8fea868 that has added support  
of regexps for databases and roles in pg_hba.conf, it is also the case  
of HBA files.  This refreshes the comment to refer to both HBA and ident  
files.  
  
Issue spotted while going through a different patch.  

M src/include/libpq/hba.h

Acquire spinlock when updating 2PC slot data during logical decoding creation

commit   : 5ad165d2c024ae2fdc0a5ddd17522d5c92d7aa1a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Jan 2023 13:40:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Jan 2023 13:40:33 +0900    

Click here for diff

The creation of a logical decoding context in CreateDecodingContext()  
updates some data of its slot for two-phase transactions if enabled by  
the caller, but the code forgot to acquire a spinlock when updating  
these fields like any other code paths.  This could lead to the read of  
inconsistent data.  
  
Oversight in a8fd13c.  
  
Author: Sawada Masahiko  
Discussion: https://postgr.es/m/CAD21AoAD8_fp47191LKuecjDd3DYhoQ4TaucFco1_TEr_jQ-Zw@mail.gmail.com  
Backpatch-through: 15  

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

Revert "Get rid of the "new" and "old" entries in a view's rangetable."

commit   : f0e6d6d3c909e14eedd370dd77d7111c2ae24c02    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 22:56:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 22:56:34 -0500    

Click here for diff

This reverts commit 1b4d280ea1eb7ddb2e16654d5fa16960bb959566.  
It's broken the buildfarm members that run cross-version-upgrade tests,  
because they're not prepared to deal with cosmetic differences between  
CREATE VIEW commands emitted by older servers and HEAD.  Even if we had  
a solution to that, which we don't, it'd take some time to roll it out  
to the affected animals.  This improvement isn't valuable enough to  
justify addressing that problem on an emergency basis, so revert it  
for now.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/lockcmds.c
M src/backend/commands/view.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/cache/plancache.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/compression.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/expressions.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/limit.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/tablesample.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/window.out
M src/test/regress/expected/with.out
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_2.out

Refactor DetermineSleepTime() to use milliseconds.

commit   : 5a26c7b310b629f8893483cc3cce5bbfa7879115    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 12 Jan 2023 15:04:08 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 12 Jan 2023 15:04:08 +1300    

Click here for diff

Since we're not using select() anymore, we don't need to bother with  
struct timeval.  We can work directly in milliseconds, which the latch  
API wants.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%40mail.gmail.com  

M src/backend/postmaster/postmaster.c

Use WaitEventSet API for postmaster's event loop.

commit   : 7389aad63666a2cac18cd6d7496378d7f50ef37b    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 12 Jan 2023 12:34:23 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 12 Jan 2023 12:34:23 +1300    

Click here for diff

Switch to a design similar to regular backends, instead of the previous  
arrangement where signal handlers did non-trivial state management and  
called fork().  The main changes are:  
  
* The postmaster now has its own local latch to wait on.  (For now, we  
  don't want other backends setting its latch directly, but that could  
  probably be made to work with more research on robustness.)  
  
* The existing signal handlers are cut in two: a handle_pm_XXX() part  
  that just sets pending_pm_XXX flags and the latch, and a  
  process_pm_XXX() part that runs later when the latch is seen.  
  
* Signal handlers are now installed with the regular pqsignal()  
  function rather than the special pqsignal_pm() function; historical  
  portability concerns about the effect of SA_RESTART on select() are no  
  longer relevant, and we don't need to block signals anymore.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%40mail.gmail.com  

M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqsignal.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/miscinit.c
M src/include/libpq/pqsignal.h
M src/include/miscadmin.h

Doc: fix silly thinko in 8bf6ec3ba.

commit   : d93d68aeeaeeda0e871825b461fd9ab68c7c0de3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 22:19:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 22:19:49 -0500    

Click here for diff

Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqG2v-SnWyJuyVM-Z8DEFukY8+qe3XLMwSG4Xp7Yf=RioA@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Make lazy_vacuum_heap_rel match lazy_scan_heap.

commit   : d30b499997caa77805c112b3e0524d2bca8f3e48    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 11 Jan 2023 18:45:32 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 11 Jan 2023 18:45:32 -0800    

Click here for diff

Make lazy_vacuum_heap_rel variable names match those from lazy_scan_heap  
where that makes sense.  
  
Extracted from a larger patch to deal with issues with how vacuumlazy.c  
sets pages all-frozen.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznuNGSzF8v6OsgjaC5aYsb3cZ6HW6MLm30X0d65cmSH6A@mail.gmail.com  

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

vacuumlazy.c: Tweak local variable name.

commit   : 8c233cf86b6d77989a1a6bea96f9b2e31a9b6c7a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 11 Jan 2023 17:57:18 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 11 Jan 2023 17:57:18 -0800    

Click here for diff

Make a local variable name consistent with the name from its WAL record.  
  
Extracted from a larger patch to deal with issues with how vacuumlazy.c  
sets pages all-frozen.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznuNGSzF8v6OsgjaC5aYsb3cZ6HW6MLm30X0d65cmSH6A@mail.gmail.com  

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

Rename and relocate freeze plan dedup routines.

commit   : 50767705ed093eb4cf64f5980b3ffdfa2fc8ebc8    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 11 Jan 2023 17:30:42 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 11 Jan 2023 17:30:42 -0800    

Click here for diff

Rename the heapam.c freeze plan deduplication routines added by commit  
9e540599 to names that follow conventions for functions in heapam.c.  
Also relocate the functions so that they're next to their caller, which  
runs during original execution, when FREEZE_PAGE WAL records are built.  
  
The routines were initially placed next to (and followed the naming  
conventions of) conceptually related REDO routine code, but that scheme  
turned out to be kind of jarring when considered in a wider context.  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Get rid of the "new" and "old" entries in a view's rangetable.

commit   : 1b4d280ea1eb7ddb2e16654d5fa16960bb959566    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 19:41:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 19:41:02 -0500    

Click here for diff

The rule system needs "old" and/or "new" pseudo-RTEs in rule actions  
that are ON INSERT/UPDATE/DELETE.  Historically it's put such entries  
into the ON SELECT rules of views as well, but those are really quite  
vestigial.  The only thing we've used them for is to carry the  
view's relid forward to AcquireExecutorLocks (so that we can  
re-lock the view to verify it hasn't changed before re-using a plan)  
and to carry its relid and permissions data forward to execution-time  
permissions checks.  What we can do instead of that is to retain  
these fields of the RTE_RELATION RTE for the view even after we  
convert it to an RTE_SUBQUERY RTE.  This requires a tiny amount of  
extra complication in the planner and AcquireExecutorLocks, but on  
the other hand we can get rid of the logic that moves that data from  
one place to another.  
  
The principal immediate benefit of doing this, aside from a small  
saving in the pg_rewrite data for views, is that these pseudo-RTEs  
no longer trigger ruleutils.c's heuristic about qualifying variable  
names when the rangetable's length is more than 1.  That results  
in quite a number of small simplifications in regression test outputs,  
which are all to the good IMO.  
  
Bump catversion because we need to dump a few more fields of  
RTE_SUBQUERY RTEs.  While those will always be zeroes anyway in  
stored rules (because we'd never populate them until query rewrite)  
they are useful for debugging, and it seems like we'd better make  
sure to transmit such RTEs accurately in plans sent to parallel  
workers.  I don't think the executor actually examines these fields  
after startup, but someday it might.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqEf7gPN4Hn+LoZ4tP2q_Qt7n3vw7-6fJKOf92tSEnX6Gg@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/lockcmds.c
M src/backend/commands/view.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/parser/parse_relation.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/cache/plancache.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/compression.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/expressions.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/limit.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/tablesample.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/window.out
M src/test/regress/expected/with.out
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_2.out

Add support for tab completion after ALTER EXTENSION ADD|DROP in psql

commit   : 2ff5ca86e816846743b31279a9f6b819d4cf4b11    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Jan 2023 08:49:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Jan 2023 08:49:37 +0900    

Click here for diff

This appends the set of object types supported by these commands, and  
the objects defined in the cluster are completed after that.  Note that  
these may not be in the extension being working on when using DROP, to  
keep the code simple, but this is much more useful than the previous  
behavior of not knowing the objects that can be touched.  
  
Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm3LVM2QcUWqgOonKZH80TveT-tUthbw4ZhuE_6pD3yi-A@mail.gmail.com  

M src/bin/psql/tab-complete.c

Improve TransactionIdDidAbort() documentation.

commit   : af3855cb77b94a0321b77d7d9a9849700ea6a758    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 11 Jan 2023 15:31:42 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 11 Jan 2023 15:31:42 -0800    

Click here for diff

Document that TransactionIdDidAbort() won't indicate that transactions  
that were in-progress during a crash have aborted.  Tie this to existing  
discussion of the TransactionIdDidCommit() and TransactionIdDidCommit()  
protocol that code in heapam_visibility.c (and a few other places) must  
observe.  
  
Follow-up to bugfix commit eb5ad4ff.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzn4bEEqgmaUQL3aJ73yM9gAeK-wE4ngi7kjRjLztb+P0w@mail.gmail.com  

M src/backend/access/heap/heapam_visibility.c
M src/backend/access/transam/transam.c

Improve handling of inherited GENERATED expressions.

commit   : 8bf6ec3ba3a44448817af47a080587f3b71bee08    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 15:55:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 15:55:02 -0500    

Click here for diff

In both partitioning and traditional inheritance, require child  
columns to be GENERATED if and only if their parent(s) are.  
Formerly we allowed the case of an inherited column being  
GENERATED when its parent isn't, but that results in inconsistent  
behavior: the column can be directly updated through an UPDATE  
on the parent table, leading to it containing a user-supplied  
value that might not match the generation expression.  This also  
fixes an oversight that we enforced partition-key-columns-can't-  
be-GENERATED against parent tables, but not against child tables  
that were dynamically attached to them.  
  
Also, remove the restriction that the child's generation expression  
be equivalent to the parent's.  In the wake of commit 3f7836ff6,  
there doesn't seem to be any reason that we need that restriction,  
since generation expressions are always computed per-table anyway.  
By removing this, we can also allow a child to merge multiple  
inheritance parents with inconsistent generation expressions, by  
overriding them with its own expression, much as we've long allowed  
for DEFAULT expressions.  
  
Since we're rejecting a case that we used to accept, this doesn't  
seem like a back-patchable change.  Given the lack of field  
complaints about the inconsistent behavior, it's likely that no  
one is doing this anyway, but we won't change it in minor releases.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Don't leave roles behind after core regression tests.

commit   : d0d968328794a25c844dc57585d0289a08159bb5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 12:22:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jan 2023 12:22:47 -0500    

Click here for diff

Commits cf5eb37c5 and e5b8a4c09 each created a new role that they  
forgot to remove again.  This breaks the use-case of running "make  
installcheck" more than once, and it's also against project policy  
because it'd be quite unfriendly behavior if one were running  
"make installcheck" against a non-throwaway installation.  

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

Fix MSVC build

commit   : c971a5b27ac946e7c94f7f655d321279512c7ee7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Jan 2023 14:41:52 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Jan 2023 14:41:52 +0100    

Click here for diff

for commit c96de2ce1782116bd0489b1cd69ba88189a495e8  

M src/tools/msvc/Mkvcbuild.pm

Common function for percent placeholder replacement

commit   : c96de2ce1782116bd0489b1cd69ba88189a495e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Jan 2023 07:22:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Jan 2023 07:22:51 +0100    

Click here for diff

There are a number of places where a shell command is constructed with  
percent-placeholders (like %x).  It's cumbersome to have to open-code  
this several times.  This factors out this logic into a separate  
function.  This also allows us to ensure consistency for and document  
some subtle behaviors, such as what to do with unrecognized  
placeholders.  
  
The unified handling is now that incorrect and unknown placeholders  
are an error, where previously in most cases they were skipped or  
ignored.  This affects the following settings:  
  
- archive_cleanup_command  
- archive_command  
- recovery_end_command  
- restore_command  
- ssl_passphrase_command  
  
The following settings are part of this refactoring but already had  
stricter error handling and should be unchanged in their behavior:  
  
- basebackup_to_shell.command  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5238bbed-0b01-83a6-d4b2-7eb0562a054e%40enterprisedb.com  

M contrib/basebackup_to_shell/basebackup_to_shell.c
M src/backend/access/transam/xlogarchive.c
M src/backend/libpq/be-secure-common.c
M src/backend/postmaster/shell_archive.c
M src/common/Makefile
M src/common/archive.c
M src/common/meson.build
A src/common/percentrepl.c
M src/fe_utils/archive.c
A src/include/common/percentrepl.h

Fix typos in code and comments

commit   : 5f6401f81cb24bd3930e0dc589fc4aa8b5424cdc    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Jan 2023 15:16:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Jan 2023 15:16:38 +0900    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/system-views.sgml
M src/backend/access/transam/xlogrecovery.c
M src/backend/utils/mmgr/mcxt.c
M src/bin/psql/common.c
M src/test/modules/test_pg_db_role_setting/expected/test_pg_db_role_setting.out
M src/test/modules/test_pg_db_role_setting/sql/test_pg_db_role_setting.sql

Remove function declarations from headers for some undefined functions

commit   : 69fb29d1affb525d4c91b4dc5b104a551e61c28d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Jan 2023 11:54:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Jan 2023 11:54:55 +0900    

Click here for diff

The functions whose declarations are removed here have been removed in  
the past, but their respective headers forgot the call.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/compress_io.h
M src/include/access/gist_private.h
M src/include/access/xlogreader.h

Have the planner consider Incremental Sort for DISTINCT

commit   : 3c6fc58209f24b959ee18f5d19ef96403d08f15c    
  
author   : David Rowley <[email protected]>    
date     : Wed, 11 Jan 2023 10:25:43 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 11 Jan 2023 10:25:43 +1300    

Click here for diff

Prior to this, we only considered a full sort on the cheapest input path  
and uniquifying any path which was already sorted in the required sort  
order.  Here we adjust create_final_distinct_paths() so that it also  
adds an Incremental Sort path on any path which has presorted keys.  
  
Additionally, this adjusts the parallel distinct code so that we now  
consider sorting the cheapest partial path and incrementally sorting any  
partial paths with presorted keys.  Previously we didn't consider any  
sorting for parallel distinct and only added a unique path atop any path  
which had the required pathkeys already.  
  
Author: David Rowley  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/CAApHDvo8Lz2H=42urBbfP65LTcEUOh288MT7DsG2_EWtW1AXHQ@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/select_distinct.out
M src/test/regress/expected/window.out
M src/test/regress/sql/select_distinct.sql

Add new GUC createrole_self_grant.

commit   : e5b8a4c098ad6add39626a14475148872cd687e0    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 10 Jan 2023 12:44:49 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 10 Jan 2023 12:44:49 -0500    

Click here for diff

Can be set to the empty string, or to either or both of "set" or  
"inherit". If set to a non-empty value, a non-superuser who creates  
a role (necessarily by relying up the CREATEROLE privilege) will  
grant that role back to themselves with the specified options.  
  
This isn't a security feature, because the grant that this feature  
triggers can also be performed explicitly. Instead, it's a user experience  
feature. A superuser would necessarily inherit the privileges of any  
created role and be able to access all such roles via SET ROLE;  
with this patch, you can configure createrole_self_grant = 'set, inherit'  
to provide a similar experience for a user who has CREATEROLE but not  
SUPERUSER.  
  
Discussion: https://postgr.es/m/CA+TgmobN59ct+Emmz6ig1Nua2Q-_o=r6DSD98KfU53kctq_kQw@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/createuser.sgml
M src/backend/commands/user.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/commands/user.h
M src/test/regress/expected/create_role.out
M src/test/regress/sql/create_role.sql

Restrict the privileges of CREATEROLE users.

commit   : cf5eb37c5ee0cc54c80d95c1695d7fca1f7c68cb    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 10 Jan 2023 12:44:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 10 Jan 2023 12:44:30 -0500    

Click here for diff

Previously, CREATEROLE users were permitted to make nearly arbitrary  
changes to roles that they didn't create, with certain exceptions,  
particularly superuser roles.  Instead, allow CREATEROLE users to make such  
changes to roles for which they possess ADMIN OPTION, and to  
grant membership only in roles for which they possess ADMIN OPTION.  
  
When a CREATEROLE user who is not a superuser creates a role, grant  
ADMIN OPTION on the newly-created role to the creator, so that they  
can administer roles they create or for which they have been given  
privileges.  
  
With these changes, CREATEROLE users still have very significant  
powers that unprivileged users do not receive: they can alter, rename,  
drop, comment on, change the password for, and change security labels  
on roles.  However, they can now do these things only for roles for  
which they possess appropriate privileges, rather than all  
non-superuser roles; moreover, they cannot grant a role such as  
pg_execute_server_program unless they themselves possess it.  
  
Patch by me, reviewed by Mark Dilger.  
  
Discussion: https://postgr.es/m/CA+TgmobN59ct+Emmz6ig1Nua2Q-_o=r6DSD98KfU53kctq_kQw@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/drop_role.sgml
M doc/src/sgml/ref/dropuser.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/catalog/objectaddress.c
M src/backend/commands/user.c
M src/test/modules/dummy_seclabel/expected/dummy_seclabel.out
M src/test/modules/dummy_seclabel/sql/dummy_seclabel.sql
M src/test/regress/expected/create_role.out
M src/test/regress/sql/create_role.sql

Fix MERGE's test for unreachable WHEN clauses.

commit   : f026c16a2c5a3ee5d7aa6f85333ec80c905913ba    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 10 Jan 2023 14:17:47 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 10 Jan 2023 14:17:47 +0000    

Click here for diff

The former code would only detect an unreachable WHEN clause if it had  
an AND condition. Fix, so that unreachable unconditional WHEN clauses  
are also detected.  
  
Back-patch to v15, where MERGE was added.  
  
Discussion: https://postgr.es/m/CAEZATCVQ=7E2z4cSBB49jjeGGsB6WeoYQY32NDeSvcHiLUZ=ow@mail.gmail.com  

M src/backend/parser/parse_merge.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

New header varatt.h split off from postgres.h

commit   : d952373a987bad331c0e499463159dd142ced1ef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jan 2023 05:48:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jan 2023 05:48:59 +0100    

Click here for diff

This new header contains all the variable-length data types support  
(TOAST support) from postgres.h, which isn't needed by large parts of  
the backend code.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/ddcce239-0f29-6e62-4b47-1f8ca742addf%40enterprisedb.com  

M contrib/citext/citext.c
M contrib/cube/cubeparse.y
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/ltree/ltree_io.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgcrypto/pgcrypto.c
M contrib/uuid-ossp/uuid-ossp.c
M doc/src/sgml/xfunc.sgml
M src/backend/access/common/toast_compression.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/table/toast_helper.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/pqformat.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashfuncs.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/mb/mbutils.c
M src/include/access/htup_details.h
M src/include/meson.build
M src/include/postgres.h
M src/include/utils/expandeddatum.h
A src/include/varatt.h
M src/pl/plperl/Util.xs
M src/test/modules/spgist_name_ops/spgist_name_ops.c
M src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
M src/test/modules/test_shm_mq/test.c

Document the newly added wait events added by commit 216a784829.

commit   : cd06ccd78fcf59dd6486b83e4fbf6c73be179523    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 10 Jan 2023 09:38:08 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 10 Jan 2023 09:38:08 +0530    

Click here for diff

Author: Shinoda, Noriyoshi  
Reviewed-by: Hou Zhijie  
Discussion: https://postgr.es/m/DM4PR84MB173460530245F56364E1DAF7EEFE9@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/monitoring.sgml

Round off random_normal() test results one more decimal place.

commit   : 02d552c4f4229c3c1fb4ed5eadb93b6d551b7510    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 22:44:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 22:44:16 -0500    

Click here for diff

As I suspected, some machines have even more low-order-bit  
inaccuracy than the ones I tested.  Tweak new test so that  
(hopefully) it will pass everywhere.  Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix the display of lock information for specktoken.

commit   : f745739697e49a38a31a755d7d36d6c97008dd9f    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 10 Jan 2023 08:53:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 10 Jan 2023 08:53:12 +0530    

Click here for diff

A transaction id is now displayed in the transactionid field and  
speculative insertion token is displayed in the objid field.  
  
Author: Sawada Masahiko  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoCEKxZztULP1CDm45aSNNR1QO-Bh1q6LMTspQ78PBuJrw@mail.gmail.com  

M doc/src/sgml/system-views.sgml
M src/backend/utils/adt/lockfuncs.c

Remove pg_regress' never-documented "ignore" feature.

commit   : bd8d453e9b5f8b632a400a9e796fc041aed76d82    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 20:34:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 20:34:26 -0500    

Click here for diff

We aren't using this anymore in the wake of commit 09d517773,  
so delete it.  We can always revert this if some future use  
emerges, but I think our standards for test quality are now  
high enough that that will never happen.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Upgrade the random.sql regression test.

commit   : 09d517773f606baef7958aa5bad25d3b3c30303e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 20:30:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 20:30:25 -0500    

Click here for diff

We had some pretty ad-hoc and inefficient code here.  To make  
matters worse, it didn't test the properties of the random()  
function very thoroughly, and it had a test failure rate of  
one in every few tens of thousands of runs.  Replace the  
script altogether with new test cases that prove much more  
about random()'s output, run faster, and can be calculated  
to have test failure rates on the order of 1e-9.  
  
Having done that, the failure rate of this script should be  
negligible in comparison to other causes of test failures,  
so remove the "ignore" marker for it in parallel_schedule.  
(If it does fail, we'd like to know about that, so "ignore"  
was always pretty counterproductive.)  
  
Tom Lane and Dean Rasheed  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/random.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/random.sql

Doc: add XML ID attributes to <sectN> and <varlistentry> tags.

commit   : 78ee60ed84bb3a1cf0b6bd9a715dcbcf252a90f5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 15:08:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 15:08:24 -0500    

Click here for diff

This doesn't have any external effect at the moment, but it  
will allow adding useful link-discoverability features later.  
  
Brar Piening, reviewed by Karl Pinc.  
  
Discussion: https://postgr.es/m/CAB8KJ=jpuQU9QJe4+RgWENrK5g9jhoysMw2nvTN_esoOU0=a_w@mail.gmail.com  

M doc/src/sgml/amcheck.sgml
M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/auth-delay.sgml
M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/basebackup-to-shell.sgml
M doc/src/sgml/basic-archive.sgml
M doc/src/sgml/bloom.sgml
M doc/src/sgml/btree-gin.sgml
M doc/src/sgml/btree-gist.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/citext.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/contrib-spi.sgml
M doc/src/sgml/cube.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/dict-int.sgml
M doc/src/sgml/dict-xsyn.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/fuzzystrmatch.sgml
M doc/src/sgml/geqo.sgml
M doc/src/sgml/history.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/intagg.sgml
M doc/src/sgml/intarray.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/jit.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/lo.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/oldsnapshot.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgprewarm.sgml
M doc/src/sgml/pgrowlocks.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/pgsurgery.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/pgvisibility.sgml
M doc/src/sgml/pgwalinspect.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/problems.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/commit.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/rollback.sgml
M doc/src/sgml/regress.sgml
M doc/src/sgml/rowtypes.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/sslinfo.sgml
M doc/src/sgml/tablefunc.sgml
M doc/src/sgml/tsm-system-rows.sgml
M doc/src/sgml/tsm-system-time.sgml
M doc/src/sgml/unaccent.sgml
M doc/src/sgml/uuid-ossp.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xml2.sgml
M doc/src/sgml/xoper.sgml

Invent random_normal() to provide normally-distributed random numbers.

commit   : 38d81760c4d7e22b95252e3545596602c9e38806    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 12:44:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jan 2023 12:44:00 -0500    

Click here for diff

There is already a version of this in contrib/tablefunc, but it  
seems sufficiently widely useful to justify having it in core.  
  
Paul Ramsey  
  
Discussion: https://postgr.es/m/CACowWR0DqHAvOKUCNxTrASFkWsDLqKMd6WiXvVvaWg4pV1BMnQ@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_functions.sql
M src/backend/utils/adt/float.c
M src/bin/pgbench/pgbench.c
M src/common/pg_prng.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/common/pg_prng.h
M src/test/regress/expected/random.out
M src/test/regress/sql/random.sql

Remove redundant setting of tuplesort status

commit   : 2673ebf49acfd83b09c777ced8f21eacd27b51ce    
  
author   : John Naylor <[email protected]>    
date     : Mon, 9 Jan 2023 16:53:21 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 9 Jan 2023 16:53:21 +0700    

Click here for diff

Also add an explanatory comment to match other similar coding within  
tuplesort_performsort().  
  
Xing Guo  
  
Reviewed by Richard Guo and Cary Huang  
Discussion: https://www.postgresql.org/message-id/CACpMh%2BAQ4GXRKKi9ib2ioUH%2BqwNaSAVbetssJ0tMPfxAWuL2yg%40mail.gmail.com  

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

Fix the file mode of worker.c changed by the commit 216a784829.

commit   : c06caa0d622b21c617d10504d1c1a39dbd2d3f1e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 9 Jan 2023 14:02:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 9 Jan 2023 14:02:38 +0530    

Click here for diff

Reported-by: Japin Li  
Discussion: https://postgr.es/m/MEYP282MB166970D1559B7CC74D3E339BB6FE9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

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

Allow left join removals and unique joins on partitioned tables

commit   : 3c569049b7b502bb4952483d19ce622ff0af5fd6    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Jan 2023 17:15:08 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Jan 2023 17:15:08 +1300    

Click here for diff

This allows left join removals and unique joins to work with partitioned  
tables.  The planner just lacked sufficient proofs that a given join  
would not cause any row duplication.  Unique indexes currently serve as  
that proof, so have get_relation_info() populate the indexlist for  
partitioned tables too.  
  
Author: Arne Roland  
Reviewed-by: Alvaro Herrera, Zhihong Yu, Amit Langote, David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/partition_join.sql

Perform apply of large transactions by parallel workers.

commit   : 216a784829c2c5f03ab0c43e009126cbb819e9b2    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 9 Jan 2023 07:00:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 9 Jan 2023 07:00:39 +0530    

Click here for diff

Currently, for large transactions, the publisher sends the data in  
multiple streams (changes divided into chunks depending upon  
logical_decoding_work_mem), and then on the subscriber-side, the apply  
worker writes the changes into temporary files and once it receives the  
commit, it reads from those files and applies the entire transaction. To  
improve the performance of such transactions, we can instead allow them to  
be applied via parallel workers.  
  
In this approach, we assign a new parallel apply worker (if available) as  
soon as the xact's first stream is received and the leader apply worker  
will send changes to this new worker via shared memory. The parallel apply  
worker will directly apply the change instead of writing it to temporary  
files. However, if the leader apply worker times out while attempting to  
send a message to the parallel apply worker, it will switch to  
"partial serialize" mode -  in this mode, the leader serializes all  
remaining changes to a file and notifies the parallel apply workers to  
read and apply them at the end of the transaction. We use a non-blocking  
way to send the messages from the leader apply worker to the parallel  
apply to avoid deadlocks. We keep this parallel apply assigned till the  
transaction commit is received and also wait for the worker to finish at  
commit. This preserves commit ordering and avoid writing to and reading  
from files in most cases. We still need to spill if there is no worker  
available.  
  
This patch also extends the SUBSCRIPTION 'streaming' parameter so that the  
user can control whether to apply the streaming transaction in a parallel  
apply worker or spill the change to disk. The user can set the streaming  
parameter to 'on/off', or 'parallel'. The parameter value 'parallel' means  
the streaming will be applied via a parallel apply worker, if available.  
The parameter value 'on' means the streaming transaction will be spilled  
to disk. The default value is 'off' (same as current behaviour).  
  
In addition, the patch extends the logical replication STREAM_ABORT  
message so that abort_lsn and abort_time can also be sent which can be  
used to update the replication origin in parallel apply worker when the  
streaming transaction is aborted. Because this message extension is needed  
to support parallel streaming, parallel streaming is not supported for  
publications on servers < PG16.  
  
Author: Hou Zhijie, Wang wei, Amit Kapila with design inputs from Sawada Masahiko  
Reviewed-by: Sawada Masahiko, Peter Smith, Dilip Kumar, Shi yu, Kuroda Hayato, Shveta Mallik  
Discussion: https://postgr.es/m/CAA4eK1+wyN6zpaHUkCLorEWNx75MG0xhMwcFhvjqm2KURZEAGw@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/system-views.sgml
M src/backend/access/transam/xact.c
M src/backend/commands/subscriptioncmds.c
M src/backend/libpq/pqmq.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/interrupt.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/Makefile
A src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/meson.build
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.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/storage/ipc/procsignal.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/include/commands/subscriptioncmds.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalworker.h
M src/include/replication/origin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/walreceiver.h
M src/include/replication/worker_internal.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/procsignal.h
M src/include/utils/wait_event.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.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/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/tools/pgindent/typedefs.list

Doc: improve commentary about providing our own definitions of M_PI.

commit   : 5687e7810f1dd32ac1960e67b608c441d87bc229    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Jan 2023 16:25:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Jan 2023 16:25:25 -0500    

Click here for diff

M contrib/earthdistance/earthdistance.c
M src/bin/pgbench/pgbench.c
M src/include/utils/float.h

Improve GIN cost estimation

commit   : cd9479af2af25d7fa9bfd24dd4dcf976b360f077    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 8 Jan 2023 22:34:59 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 8 Jan 2023 22:34:59 +0300    

Click here for diff

GIN index scans were not taking any descent CPU-based cost into account.  That  
made them look cheaper than other types of indexes when they shouldn't be.  
  
We use the same heuristic as for btree indexes, but multiply it by the number  
of searched entries.  
  
Additionally, the CPU cost for the tree was based largely on a  
genericcostestimate.  For a GIN index, we should not charge index quals per  
tuple, but per entry. On top of this, charge cpu_index_tuple_cost per actual  
tuple.  
  
This should fix the cases where a GIN index is preferred over a btree and  
the ones where a memoize node is not added on top of the GIN index scan  
because it seemed too cheap.  
  
We don't packpatch this to evade unexpected plan changes in stable versions.  
  
Discussion: https://postgr.es/m/CABs3KGQnOkyQ42-zKQqiE7M0Ks9oWDSee%3D%2BJx3-TGq%3D68xqWYw%40mail.gmail.com  
Discussion: https://postgr.es/m/3188617.44csPzL39Z%40aivenronan  
Author: Ronan Dunklau  
Reported-By: Hung Nguyen  
Reviewed-by: Tom Lane, Alexander Korotkov  

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

Extract the multiplier for CPU process cost of index page into a macro

commit   : eb5c4e953bbd2fab07be74df93f4080bab60176c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 8 Jan 2023 22:37:33 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 8 Jan 2023 22:37:33 +0300    

Click here for diff

B-tree, GiST and SP-GiST all charge 50.0 * cpu_operator_cost for processing  
an index page.  Extract this to a macro to avoid repeated magic numbers.  
  
Discussion: https://mail.google.com/mail/u/0/?ik=a20b091faa&view=om&permmsgid=msg-f%3A1751459697261369543  
Author: Ronan Dunklau  

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

Check relkind before using TABLESAMPLE in postgres_fdw

commit   : 57d11ef028d126f95595c08c62ffb4c5147d0f86    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 7 Jan 2023 14:22:09 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 7 Jan 2023 14:22:09 +0100    

Click here for diff

Check the remote relkind before trying to use TABLESAMPLE to acquire  
sample from the remote relation. Even if the remote server version has  
TABLESAMPLE support, the foreign table may point to incompatible relkind  
(e.g. a view or a sequence).  
  
If the relkind does not support TABLESAMPLE, error out if TABLESAMPLE  
was requested specifically (as system/bernoulli), or fallback to random  
just like we do for old server versions.  
  
We currently end up disabling sampling for such relkind values anyway,  
due to reltuples being -1 or 1, but that seems rather accidental, and  
might get broken by improving reltuples estimates, etc.  So better to  
make the check explicit.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/951485.1672461744%40sss.pgh.pa.us  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h

psql: Add support for \dpS and \zS.

commit   : d913928c9c5e905d0062d1e7237b7fb5fbde61ed    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 7 Jan 2023 11:09:26 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 7 Jan 2023 11:09:26 +0000    

Click here for diff

This allows an optional "S" modifier to be added to \dp and \z, to  
have them include system objects in the list.  
  
Note that this also changes the behaviour of a bare \dp or \z without  
the "S" modifier to include temp objects in the list, and exclude  
information_schema objects, making them consistent with other psql  
meta-commands.  
  
Nathan Bossart, reviewed by Maxim Orlov.  
  
Discussion: https://postgr.es/m/20221206193606.GB3078082@nathanxps13  

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

Remove the streaming files for incomplete xacts after restart.

commit   : 2b6df05461cb540d8f103dfe55f38efc09b4189b    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 7 Jan 2023 12:17:14 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 7 Jan 2023 12:17:14 +0530    

Click here for diff

After restart, we try to stream the changes for large transactions that  
were not sent before server crash and restart. However, we forget to send  
the abort message for such transactions. This leads to spurious streaming  
files on the subscriber which won't be cleaned till the apply worker or  
the subscriber server restarts.  
  
Reported-by: Dilip Kumar  
Author: Hou Zhijie  
Reviewed-by: Dilip Kumar and Amit Kapila  
Backpatch-through: 14  
Discussion: https://postgr.es/m/OS0PR01MB5716A773F46768A1B75BE24394FB9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Add additional regression tests for select_active_windows

commit   : a14a5832923e10ef14a74864c94358d5bc8720e4    
  
author   : David Rowley <[email protected]>    
date     : Sat, 7 Jan 2023 15:24:35 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 7 Jan 2023 15:24:35 +1300    

Click here for diff

During the development of 728202b63, which was aimed at reducing the  
number of sorts required to evaluate multiple window functions with  
different WindowClause definitions, the code written sorted the  
WindowClauses in reverse tleSortGroupRef order.  There appears to be no  
discussion in the thread which was opened to discuss the development of  
this patch and no comments mentioning the fact that having the  
WindowClauses in reverse tleSortGroupRef order makes it more likely that  
the final WindowClause to be evaluated will provide presorted input to  
the query's DISTINCT or ORDER BY clause.  The reason for this is that the  
tleSortGroupRef indexes are assigned for the DISTINCT and ORDER BY clauses  
before they are for the WindowClauses PARTITION BY and ORDER BY clauses.  
Putting the WindowClause with the lowest tleSortGroupRef last means that  
it's more likely that no additional sorting is required for the query's  
DISTINCT or ORDER BY clause.  
  
All we're doing here is adding some tests and a comment to help ensure  
that remains true and that we don't accidentally forget to consider this  
again should we ever rewrite that code.  
  
Author: Ankit Kumar Pandey, David Rowley  
Discussion: https://postgr.es/m/CAApHDvq=g2=ny59f1bvwRVvupsgPHK-KjLPBsSL25fVuGZ4idQ@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Wake up a subscription's replication worker processes after DDL.

commit   : c6e1f62e2cee817cad58cccc1dd685e908678241    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2023 16:08:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2023 16:08:20 -0500    

Click here for diff

Waken related worker processes immediately at commit of a transaction  
that has performed ALTER SUBSCRIPTION (including the RENAME and  
OWNER variants).  This reduces the response time for such operations.  
In the real world that might not be worth much, but it shaves several  
seconds off the runtime for the subscription test suite.  
  
In the case of PREPARE, we just throw away this notification state;  
it doesn't seem worth the work to preserve it.  The workers will  
still react after the eventual COMMIT PREPARED, but not as quickly.  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/20221122004119.GA132961@nathanxps13  

M src/backend/access/transam/xact.c
M src/backend/commands/alter.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalworker.h

Check for two_phase change at end of process_syncing_tables_for_apply.

commit   : 4c032dd8046b145a25032643f536aab83deb19e3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2023 15:35:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2023 15:35:31 -0500    

Click here for diff

Previously this function checked to see if we were ready to switch  
to two_phase mode at its start, but that's silly: we should check  
at the end, after we've done the work that might make us ready.  
This simple change removes one sleep cycle from the time needed to  
switch to two_phase mode.  In the real world that might not be  
worth much, but it shaves a few seconds off the runtime for the  
subscription test suite.  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/20221122004119.GA132961@nathanxps13  

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

Allow hyphens in ltree labels

commit   : b1665bf01e5f4200d37addfc2ddc406ff7df14a5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 6 Jan 2023 16:03:19 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 6 Jan 2023 16:03:19 -0500    

Click here for diff

Also increase the allowed length of labels to 1000 characters  
  
Garen Torikian  
  
Discussion: https://postgr.es/m/CAGXsc+-mNg9Gc0rp-ER0sv+zkZSZp2wE9-LX6XcoWSLVz22tZA@mail.gmail.com  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree.h
M contrib/ltree/ltree_io.c
M contrib/ltree/ltxtquery_io.c
M contrib/ltree/sql/ltree.sql
M doc/src/sgml/ltree.sgml

Add options to control whether VACUUM runs vac_update_datfrozenxid.

commit   : a46a7011b27188af526047a111969f257aaf4db8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2023 14:17:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2023 14:17:25 -0500    

Click here for diff

VACUUM normally ends by running vac_update_datfrozenxid(), which  
requires a scan of pg_class.  Therefore, if one attempts to vacuum a  
database one table at a time --- as vacuumdb has done since v12 ---  
we will spend O(N^2) time in vac_update_datfrozenxid().  That causes  
serious performance problems in databases with tens of thousands of  
tables, and indeed the effect is measurable with only a few hundred.  
To add insult to injury, only one process can run  
vac_update_datfrozenxid at the same time per DB, so this behavior  
largely defeats vacuumdb's -j option.  
  
Hence, invent options SKIP_DATABASE_STATS and ONLY_DATABASE_STATS  
to allow applications to postpone vac_update_datfrozenxid() until the  
end of a series of VACUUM requests, and teach vacuumdb to use them.  
  
Per bug #17717 from Gunnar L.  Sadly, this answer doesn't seem  
like something we'd consider back-patching, so the performance  
problem will remain in v12-v15.  
  
Tom Lane and Nathan Bossart  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c
M src/fe_utils/parallel_slot.c
M src/include/commands/vacuum.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Invalidate pgoutput's replication-decisions cache upon schema rename.

commit   : cd4b2334db4980bbf86a8ba1d446db17e62ca342    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2023 11:11:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Jan 2023 11:11:51 -0500    

Click here for diff

A schema rename should cause reporting the new qualified names of  
tables to logical replication subscribers, but that wasn't happening.  
Flush the RelationSyncCache to make it happen.  
  
(If you ask me, the new test case shows that the behavior in this area  
is still pretty dubious, but apparently it's operating as designed.)  
  
Vignesh C  
  
Discussion: https://postgr.es/m/CALDaNm32vLRv5KdrDFeVC-CU+4Wg1daA55hMqOxDGJBzvd76-w@mail.gmail.com  

M src/backend/replication/pgoutput/pgoutput.c
M src/test/subscription/t/100_bugs.pl

Fix stale comment about sample_frac adjustment

commit   : 211d80c065626d1a9188188d78ede85d799b93b1    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 6 Jan 2023 14:47:02 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 6 Jan 2023 14:47:02 +0100    

Click here for diff

A comment was left behind referencing sample rate adjustment removed  
from 8ad51b5f44. So clean that up. While at it also remove the sample  
rate clamping which should not be necessary without the clamping, and  
just check that with an assert.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/951485.1672461744%40sss.pgh.pa.us  

M contrib/postgres_fdw/postgres_fdw.c

Fix typo

commit   : 4037c5e2fe9e2c7b083606435d29cdb25092f70f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Jan 2023 14:25:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Jan 2023 14:25:19 +0100    

Click here for diff

This doesn't affect the correctness of the code, but it was clearly  
inconsistent before this change.  

M src/backend/parser/parse_node.c

Fix tab completion of ALTER FUNCTION/PROCEDURE/ROUTINE ... SET SCHEMA.

commit   : e7a59094b36a49df057b040611314c9a0b726d05    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 6 Jan 2023 11:18:44 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 6 Jan 2023 11:18:44 +0000    

Click here for diff

The ALTER DATABASE|FUNCTION|PROCEDURE|ROLE|ROUTINE|USER ... SET <name>  
case in psql tab completion failed to exclude <name> = "SCHEMA", which  
caused ALTER FUNCTION|PROCEDURE|ROUTINE ... SET SCHEMA to complete  
with "FROM CURRENT" and "TO", which won't work.  
  
Fix that, so that those cases now complete with the list of schemas,  
like other ALTER ... SET SCHEMA commands.  
  
Noticed while testing the recent patch to improve tab completion for  
ALTER FUNCTION/PROCEDURE/ROUTINE, but this is not directly related to  
that patch. Rather, this is a long-standing bug, so back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/CALDaNm0s7GQmkLP_mx5Cvk=UzYMnjhPmXBxU8DsHEunFbC5sTg@mail.gmail.com  

M src/bin/psql/tab-complete.c

Improve tab completion for ALTER FUNCTION/PROCEDURE/ROUTINE.

commit   : a3bc631ea96a7c04962df3c97dbeac860be06c03    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 6 Jan 2023 09:57:41 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 6 Jan 2023 09:57:41 +0000    

Click here for diff

This adds psql tab completion for each of the actions supported by  
ALTER FUNCTION/PROCEDURE/ROUTINE.  
  
Vignesh C, reviewed by Dong Wook Lee, Michael Paquier, Melih Mutlu and  
me.  
  
Discussion: https://postgr.es/m/CALDaNm0s7GQmkLP_mx5Cvk=UzYMnjhPmXBxU8DsHEunFbC5sTg@mail.gmail.com  

M src/bin/psql/tab-complete.c

Fix pg_truncate() on Windows.

commit   : 72aea955d49712a17c08748aa9abcbcf98c32fc5    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 6 Jan 2023 16:38:46 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 6 Jan 2023 16:38:46 +1300    

Click here for diff

Commit 57faaf376 added pg_truncate(const char *path, off_t length), but  
"length" was ignored under WIN32 and the file was unconditionally  
truncated to 0.  
  
There was no live bug, since the only caller passes 0.  
  
Fix, and back-patch to 14 where the function arrived.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/20230106031652.GR3109%40telsasoft.com  

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

Use unnamed POSIX semaphores on Cygwin.

commit   : f2857af485a00ab5dbfa2c83af9d83afe4378239    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 6 Jan 2023 10:09:02 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 6 Jan 2023 10:09:02 +1300    

Click here for diff

Testing on CI showed that Cygwin's semctl() can fail with EAGAIN  
(possibly due to resource limits in cygserver that could be tuned, not  
examined).  Switch to so-called POSIX semaphores instead, which don't  
seem to fail in that way (possibly due to a more direct implementation  
using Windows semaphore primitives instead of talking to cygserver,  
based on a cursory glance at the source).  
  
Other known problems still prevent PostgreSQL from running on Cygwin  
without random crashes, but this rarer problem was noticed while  
testing.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BQ6DU4Ov9LrvUyDcF3oHS4KMRVSKmVGaeePq-kOyG9gA%40mail.gmail.com  

M meson.build
M src/template/cygwin

Pass down current user ID to AddRoleMems and DelRoleMems.

commit   : 39cffe95f2c5d77a268db9f04c2b2aaf2294ad76    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Jan 2023 14:33:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Jan 2023 14:33:35 -0500    

Click here for diff

This is just refactoring; there should be no functonal change. It  
might have the effect of slightly reducing the number of calls to  
GetUserId(), but the real point is to facilitate future work in  
this area.  
  
Patch by me, reviewed by Mark Dilger.  
  
Discussion: http://postgr.es/m/CA+TgmobFzTLkLwOquFrAcdsWBsOWDr-_H-jw+qBvfx-wSzMwDA@mail.gmail.com  

M src/backend/commands/user.c

Refactor permissions-checking for role grants.

commit   : 25bb03166b16db1faf18c677ed88f046fb08103f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Jan 2023 14:30:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Jan 2023 14:30:40 -0500    

Click here for diff

Instead of having checks in AddRoleMems() and DelRoleMems(), have  
the callers perform checks where it's required. In some cases it  
isn't, either because the caller has already performed a check for  
the same condition, or because the check couldn't possibly fail.  
  
The "Skip permission check if nothing to do" check in each of  
AddRoleMems() and DelRoleMems() is pointless. Some call sites  
can't pass an empty list. Others can, but in those cases, the role  
being modified is one that the current user has just created.  
Therefore, they must have permission to modify it, and so no  
permission check is required at all.  
  
This patch is intended to have no user-visible consequences. It is  
intended to simplify future work in this area.  
  
Patch by me, reviewed by Mark Dilger.  
  
Discussion: http://postgr.es/m/CA+TgmobFzTLkLwOquFrAcdsWBsOWDr-_H-jw+qBvfx-wSzMwDA@mail.gmail.com  

M src/backend/commands/user.c

Fix calculation of which GENERATED columns need to be updated.

commit   : 3f7836ff651ad710fef52fa87b248ecdfc6468dc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Jan 2023 14:12:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Jan 2023 14:12:17 -0500    

Click here for diff

We were identifying the updatable generated columns of inheritance  
children by transposing the calculation made for their parent.  
However, there's nothing that says a traditional-inheritance child  
can't have generated columns that aren't there in its parent, or that  
have different dependencies than are in the parent's expression.  
(At present it seems that we don't enforce that for partitioning  
either, which is likely wrong to some degree or other; but the case  
clearly needs to be handled with traditional inheritance.)  
  
Hence, drop the very-klugy-anyway "extraUpdatedCols" RTE field  
in favor of identifying which generated columns depend on updated  
columns during executor startup.  In HEAD we can remove  
extraUpdatedCols altogether; in back branches, it's still there but  
always empty.  Another difference between the HEAD and back-branch  
versions of this patch is that in HEAD we can add the new bitmap field  
to ResultRelInfo, but that would cause an ABI break in back branches.  
Like 4b3e37993, add a List field at the end of struct EState instead.  
  
Back-patch to v13.  The bogus calculation is also being made in v12,  
but it doesn't have the same visible effect because we don't use it  
to decide which generated columns to recalculate; as a consequence of  
which the patch doesn't apply easily.  I think that there might still  
be a demonstrable bug associated with trigger firing conditions, but  
that's such a weird corner-case usage that I'm content to leave it  
unfixed in v12.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/CA+HiwqFshLKNvQUd1DgwJ-7tsTp=dwv7KZqXC4j2wYBV1aCDUA@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteHandler.c
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/optimizer/plancat.h
M src/include/rewrite/rewriteHandler.h
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Remove extra regress check arguments from test_pg_db_role_setting

commit   : 529da086ba7ff8475e469290210ce944ad30975a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 5 Jan 2023 13:11:40 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 5 Jan 2023 13:11:40 +0300    

Click here for diff

They were accidentally copied from test_oat_hooks.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20230102154240.GL1153%40telsasoft.com  
Reviewed-by: Pavel Borisov  

M src/test/modules/test_pg_db_role_setting/Makefile
M src/test/modules/test_pg_db_role_setting/meson.build

meson: Add 'running' test setup, as a replacement for installcheck

commit   : afdd9f7f0e001f109472df513eb416cc967bc199    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 5 Jan 2023 13:11:28 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 5 Jan 2023 13:11:28 +0300    

Click here for diff

Do the same as 3f0e786ccbf5 for test_pg_db_role_setting.  
  
Discussion: https://postgr.es/m/[email protected]  
Author: Pavel Borisov  
Reviewed-by: Justin Pryzby, Tom Lane  

M src/test/modules/test_pg_db_role_setting/meson.build

Fix some compiler warnings in aset.c and generation.c

commit   : b82557ecc2ebbf649142740a1c5ce8d19089f620    
  
author   : David Rowley <[email protected]>    
date     : Thu, 5 Jan 2023 12:56:17 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 5 Jan 2023 12:56:17 +1300    

Click here for diff

This fixes a couple of unused variable warnings that could be seen when  
compiling with MEMORY_CONTEXT_CHECKING but not USE_ASSERT_CHECKING.  
Defining MEMORY_CONTEXT_CHECKING without asserts is a little unusual,  
however, we shouldn't be producing any warnings from such a build.  
  
Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4_D-vgLEh7eO47p=73u1jWO78NWf6Qfv1FndY1kG-Q-jA@mail.gmail.com  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c

Check that xmax didn't commit in freeze check.

commit   : eb5ad4ff05fd382ac98cab60b82f7fd6ce4cfeb8    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 21:48:27 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 21:48:27 -0800    

Click here for diff

We cannot rely on TransactionIdDidAbort here, since in general it may  
report transactions that were in-progress at the time of an earlier hard  
crash as not aborted, effectively behaving as if they were still in  
progress even after crash recovery completes.  Go back to defensively  
verifying that xmax didn't commit instead.  
  
Oversight in commit 79d4bf4e.  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Update obsolete multixact.c comments.

commit   : 5212d447fa53518458cbe609092b347803a667c5    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 16:54:35 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 16:54:35 -0800    

Click here for diff

Commit 4f627f89 switched SLRU truncation for multixacts back to being a  
task performed during VACUUM, but missed some comments that continued to  
reference truncation happening as part of checkpointing.  Update those  
comments now.  
  
Also update comments that became obsolete when commit c3ffa731 changed  
the way that vacuum_multixact_freeze_min_age is applied by VACUUM as it  
computes its MultiXactCutoff cutoff (which is used by VACUUM to decide  
what to freeze).  Explain the same issues by referencing how OldestMxact  
is the latest valid value that relminmxid can ever be advanced to at the  
end of a VACUUM (following the work in commit 0b018fab).  

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

During pg_dump startup, acquire table locks in batches.

commit   : 5f53b42cfd053a724fcbe0712a9d5716e576a3e6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Jan 2023 17:56:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Jan 2023 17:56:37 -0500    

Click here for diff

Combine multiple LOCK TABLE commands to reduce the number of  
round trips to the server.  This is particularly helpful when  
dumping from a remote server, but it seems useful even without  
that.  In particular, shortening the time from seeing a table  
in pg_class to acquiring lock on it reduces the window for  
trouble from concurrent DDL.  
  
Aleksander Alekseev, reviewed by Fabrízio de Royes Mello,  
Gilles Darold, and Andres Freund  
  
Discussion: https://postgr.es/m/CAJ7c6TO4z1+OBa-R+fC8FnaUgbEWJUf2Kq=nRngTW5EXtKru2g@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c

Fix typo in memutils_memorychunk.h

commit   : b23837dde48028f9e31983c765c32e3f42cb7ef2    
  
author   : David Rowley <[email protected]>    
date     : Wed, 4 Jan 2023 09:23:19 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 4 Jan 2023 09:23:19 +1300    

Click here for diff

Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs483CYjHoLH32_hd3Yq1NJfravNdL2zy7+e7pwvFPJF1RQ@mail.gmail.com  

M src/include/utils/memutils_memorychunk.h

Improve documentation of the CREATEROLE attibute.

commit   : 1c77873727dfd2e48ab2ece84d1fb1676e95f9a5    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 3 Jan 2023 14:50:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 3 Jan 2023 14:50:40 -0500    

Click here for diff

In user-manag.sgml, document precisely what privileges are conveyed  
by CREATEROLE. Make particular note of the fact that it allows  
changing passwords and granting access to high-privilege roles.  
Also remove the suggestion of using a user with CREATEROLE and  
CREATEDB instead of a superuser, as there is no real security  
advantage to this approach.  
  
Elsewhere in the documentation, adjust text that suggests that  
<literal>CREATEROLE</literal> only allows for role creation, and  
refer to the documentation in user-manag.sgml as appropriate.  
  
Patch by me, reviewed by Álvaro Herrera  
  
Discussion: http://postgr.es/m/CA+TgmoZBsPL8nPhvYecx7iGo5qpDRqa9k_AcaW1SbOjugAY1Ag@mail.gmail.com  

M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/user-manag.sgml

vacuumlazy.c: Save get_database_name() in vacrel.

commit   : 54afdcd6182af709cb0ab775c11b90decff166eb    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 11:48:47 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 11:48:47 -0800    

Click here for diff

This brings dbname strings in line with namespace and relation name  
strings.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkQ1TKU-DdNvnGeL870di3+CU1UTo-7nw7xFDpVE-XGjA@mail.gmail.com  

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

Delay commit status checks until freezing executes.

commit   : 79d4bf4eff14d8967b10ad4c60039c1b9b0cf66e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 11:22:36 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 11:22:36 -0800    

Click here for diff

pg_xact lookups are relatively expensive.  Move the xmin/xmax commit  
status checks from the point that freeze plans are prepared to the point  
that they're actually executed.  Otherwise we'll repeat many commit  
status checks whenever multiple successive VACUUM operations scan the  
same pages and decide against freezing each time, which is a waste of  
cycles.  
  
Oversight in commit 1de58df4, which added page-level freezing.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkZpe4K6qMfEt8H4qYJCKc2R7TPvKsBva7jc9w7iGXQSw@mail.gmail.com  

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

Refine the definition of page-level freezing.

commit   : b37a0832396414e8469d4ee4daea33396bde39b0    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 10:08:55 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 3 Jan 2023 10:08:55 -0800    

Click here for diff

Improve comments added by commit 1de58df4 which describe the  
lazy_scan_prune "freeze the page" path.  These newly revised comments  
are based on suggestions from Jeff Davis.  
  
In passing, remove nearby visibility_cutoff_xid comments left over from  
commit 6daeeb1f.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Jeff Davis <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Windows support in pg_import_system_collations

commit   : bf03cfd162176d543da79f9398131abc251ddbb9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jan 2023 14:21:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jan 2023 14:21:40 +0100    

Click here for diff

Windows can enumerate the locales that are either installed or  
supported by calling EnumSystemLocalesEx(), similar to what is already  
done in the READ_LOCALE_A_OUTPUT switch.  We can refactor some of the  
logic already used in that switch into a new function  
create_collation_from_locale().  
  
The enumerated locales have BCP 47 shape, that is with a hyphen  
between language and territory, instead of POSIX's underscore.  The  
created collations will retain the BCP 47 shape, but we will also  
create a POSIX alias, so xx-YY will have an xx_YY alias.  
  
A new test collate.windows.win1252 is added that is like  
collate.linux.utf8.  
  
Author: Juan Jose Santamaria Flecha <[email protected]>  
Reviewed-by: Dmitry Koval <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/collationcmds.c
A src/test/regress/expected/collate.windows.win1252.out
A src/test/regress/expected/collate.windows.win1252_1.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/collate.windows.win1252.sql
M src/tools/msvc/vcregress.pl

Fix typos in comments, code and documentation

commit   : 33ab0a2a527e3af5beee3a98fc07201e555d6e45    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Jan 2023 16:26:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Jan 2023 16:26:14 +0900    

Click here for diff

While on it, newlines are removed from the end of two elog() strings.  
The others are simple grammar mistakes.  One comment in pg_upgrade  
referred incorrectly to sequences since a7e5457.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M .cirrus.yml
M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/syntax.sgml
M meson.build
M src/backend/access/common/bufmask.c
M src/backend/access/spgist/spgutils.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/optimizer/util/tlist.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/guc_internal.h
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/info.c
M src/include/lib/ilist.h
M src/test/regress/expected/copy.out
M src/test/regress/expected/expressions.out
M src/test/regress/sql/copy.sql
M src/test/regress/sql/expressions.sql
M src/test/ssl/t/SSL/Server.pm

Avoid reference to nonexistent array element in ExecInitAgg().

commit   : 92957ed98c5c565362ce665266132a7f08f6b0c0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2023 16:17:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2023 16:17:00 -0500    

Click here for diff

When considering an empty grouping set, we fetched  
phasedata->eqfunctions[-1].  Because the eqfunctions array is  
palloc'd, that would always be an aset pointer in released versions,  
and thus the code accidentally failed to malfunction (since it would  
do nothing unless it found a null pointer).  Nonetheless this seems  
like trouble waiting to happen, so add a check for length == 0.  
  
It's depressing that our valgrind testing did not catch this.  
Maybe we should reconsider the choice to not mark that word NOACCESS?  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4-vZuuPOZsKOYnSAaPYGKhmacxhki+vpOKk0O7rymccXQ@mail.gmail.com  

M src/backend/executor/nodeAgg.c

commit   : c8e1ba736b2b9e8c98d37a5b77c4ed31baf94147    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 2 Jan 2023 15:00:37 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 2 Jan 2023 15:00:37 -0500    

Click here for diff

Backpatch-through: 11  

M COPYRIGHT
M configure
M configure.ac
M contrib/adminpack/adminpack.c
M contrib/adminpack/meson.build
M contrib/amcheck/meson.build
M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/amcheck/verify_heapam.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auth_delay/meson.build
M contrib/auto_explain/auto_explain.c
M contrib/auto_explain/meson.build
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/basebackup_to_shell/meson.build
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/basic_archive/basic_archive.c
M contrib/basic_archive/meson.build
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/bloom/meson.build
M contrib/bloom/t/001_wal.pl
M contrib/bool_plperl/meson.build
M contrib/btree_gin/meson.build
M contrib/btree_gist/meson.build
M contrib/citext/meson.build
M contrib/cube/meson.build
M contrib/dblink/dblink.c
M contrib/dblink/meson.build
M contrib/dict_int/dict_int.c
M contrib/dict_int/meson.build
M contrib/dict_xsyn/dict_xsyn.c
M contrib/dict_xsyn/meson.build
M contrib/earthdistance/meson.build
M contrib/file_fdw/file_fdw.c
M contrib/file_fdw/meson.build
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/fuzzystrmatch/meson.build
M contrib/hstore/hstore_subs.c
M contrib/hstore/meson.build
M contrib/hstore_plperl/meson.build
M contrib/hstore_plpython/meson.build
M contrib/intagg/meson.build
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/intarray/meson.build
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/isn/meson.build
M contrib/jsonb_plperl/meson.build
M contrib/jsonb_plpython/meson.build
M contrib/lo/meson.build
M contrib/ltree/meson.build
M contrib/ltree_plpython/meson.build
M contrib/meson.build
M contrib/oid2name/meson.build
M contrib/oid2name/t/001_basic.pl
M contrib/old_snapshot/meson.build
M contrib/old_snapshot/time_mapping.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/meson.build
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/meson.build
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_buffercache/meson.build
M contrib/pg_freespacemap/meson.build
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/meson.build
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_prewarm/t/001_basic.pl
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_surgery/meson.build
M contrib/pg_trgm/meson.build
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/meson.build
M contrib/pg_visibility/pg_visibility.c
M contrib/pg_walinspect/meson.build
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgcrypto/meson.build
M contrib/pgrowlocks/meson.build
M contrib/pgstattuple/meson.build
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/meson.build
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/seg/meson.build
M contrib/seg/seg-validate.pl
M contrib/seg/sort-segments.pl
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/meson.build
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/spi/meson.build
M contrib/sslinfo/meson.build
M contrib/tablefunc/meson.build
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/meson.build
M contrib/tcn/tcn.c
M contrib/test_decoding/meson.build
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/meson.build
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/meson.build
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/meson.build
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/meson.build
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/meson.build
M contrib/vacuumlo/t/001_basic.pl
M contrib/vacuumlo/vacuumlo.c
M contrib/xml2/meson.build
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/meson.build
M meson.build
M meson_options.txt
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/brin/meson.build
M src/backend/access/common/attmap.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/detoast.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/meson.build
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/syncscan.c
M src/backend/access/common/toast_compression.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gin/meson.build
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/gist/meson.build
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/hash/meson.build
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/meson.build
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/index/meson.build
M src/backend/access/meson.build
M src/backend/access/nbtree/meson.build
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtdedup.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/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/meson.build
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/meson.build
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/meson.build
M src/backend/access/table/table.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/access/table/toast_helper.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/meson.build
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/meson.build
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.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/access/transam/xlogstats.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/basebackup_progress.c
M src/backend/backup/basebackup_sink.c
M src/backend/backup/basebackup_target.c
M src/backend/backup/basebackup_throttle.c
M src/backend/backup/basebackup_zstd.c
M src/backend/backup/meson.build
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/bootstrap/meson.build
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/meson.build
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_attrdef.c
M src/backend/catalog/pg_cast.c
M src/backend/catalog/pg_class.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/meson.build
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execAsync.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/meson.build
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/foreign/meson.build
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/jit/llvm/meson.build
M src/backend/jit/meson.build
M src/backend/lib/binaryheap.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/integerset.c
M src/backend/lib/knapsack.c
M src/backend/lib/meson.build
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/meson.build
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/main/meson.build
M src/backend/meson.build
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/meson.build
M src/backend/nodes/multibitmapset.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/geqo/meson.build
M src/backend/optimizer/meson.build
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
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/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/meson.build
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/meson.build
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/meson.build
M src/backend/optimizer/prep/prepagg.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/meson.build
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/gramparse.h
M src/backend/parser/meson.build
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/partitioning/meson.build
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/po/meson.build
M src/backend/port/atomics.c
M src/backend/port/meson.build
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/meson.build
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/meson.build
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/shell_archive.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/meson.build
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/libpqwalreceiver/meson.build
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/meson.build
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.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/meson.build
M src/backend/replication/pgoutput/meson.build
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/meson.build
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/meson.build
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/meson.build
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/buffer/meson.build
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/fileset.c
M src/backend/storage/file/meson.build
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/freespace/meson.build
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/meson.build
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/large_object/meson.build
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/meson.build
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/meson.build
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/page/meson.build
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/meson.build
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/meson.build
M src/backend/storage/sync/sync.c
M src/backend/tcop/cmdtag.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/meson.build
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/meson.build
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_dummy_probes.pl.prolog
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/backend_progress.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonbsubs.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_gram.y
M src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/meson.build
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/meson.build
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/error/meson.build
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/fmgr/meson.build
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/meson.build
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/meson.build
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/Unicode/Makefile
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/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/meson.build
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/meson.build
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/meson.build
M src/backend/utils/misc/conffiles.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/guc_internal.h
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/meson.build
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/queryjumble.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/meson.build
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/postprocess_dtrace.sed
M src/backend/utils/probes.d
M src/backend/utils/resowner/meson.build
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/meson.build
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/meson.build
M src/backend/utils/time/snapmgr.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/initdb/meson.build
M src/bin/initdb/po/meson.build
M src/bin/initdb/t/001_initdb.pl
M src/bin/meson.build
M src/bin/pg_amcheck/Makefile
M src/bin/pg_amcheck/meson.build
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/po/meson.build
M src/bin/pg_amcheck/t/001_basic.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_amcheck/t/005_opclass_damage.pl
M src/bin/pg_archivecleanup/meson.build
M src/bin/pg_archivecleanup/po/meson.build
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_inject.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/meson.build
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/po/meson.build
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
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/Makefile
M src/bin/pg_checksums/meson.build
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/po/meson.build
M src/bin/pg_checksums/t/001_basic.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_config/Makefile
M src/bin/pg_config/meson.build
M src/bin/pg_config/pg_config.c
M src/bin/pg_config/po/meson.build
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/Makefile
M src/bin/pg_controldata/meson.build
M src/bin/pg_controldata/po/meson.build
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/meson.build
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/po/meson.build
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
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/pg_dumpall.c
M src/bin/pg_dump/po/meson.build
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/meson.build
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/po/meson.build
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/meson.build
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/po/meson.build
M src/bin/pg_rewind/rewind_source.h
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.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_rewind/timeline.c
M src/bin/pg_test_fsync/meson.build
M src/bin/pg_test_fsync/po/meson.build
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/meson.build
M src/bin/pg_test_timing/po/meson.build
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/meson.build
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/po/meson.build
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_verifybackup/meson.build
M src/bin/pg_verifybackup/parse_manifest.c
M src/bin/pg_verifybackup/parse_manifest.h
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/po/meson.build
M src/bin/pg_verifybackup/t/001_basic.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/005_bad_manifest.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/compat.c
M src/bin/pg_waldump/meson.build
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/po/meson.build
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pg_waldump/t/002_save_fullpage.pl
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/meson.build
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/pgevent/Makefile
M src/bin/pgevent/meson.build
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/meson.build
M src/bin/psql/po/meson.build
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.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/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/meson.build
M src/bin/scripts/pg_isready.c
M src/bin/scripts/po/meson.build
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/bin/scripts/vacuumdb.c
M src/common/archive.c
M src/common/base64.c
M src/common/checksum_helper.c
M src/common/compression.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/cryptohash.c
M src/common/cryptohash_openssl.c
M src/common/d2s.c
M src/common/d2s_full_table.h
M src/common/d2s_intrinsics.h
M src/common/encnames.c
M src/common/exec.c
M src/common/f2s.c
M src/common/fe_memutils.c
M src/common/file_perm.c
M src/common/file_utils.c
M src/common/hashfn.c
M src/common/hmac.c
M src/common/hmac_openssl.c
M src/common/ip.c
M src/common/jsonapi.c
M src/common/keywords.c
M src/common/kwlookup.c
M src/common/link-canary.c
M src/common/logging.c
M src/common/md5.c
M src/common/md5_common.c
M src/common/md5_int.h
M src/common/meson.build
M src/common/pg_get_line.c
M src/common/pg_lzcompress.c
M src/common/pg_prng.c
M src/common/pgfnames.c
M src/common/protocol_openssl.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/ryu_common.h
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha1.c
M src/common/sha1_int.h
M src/common/sha2.c
M src/common/sha2_int.h
M src/common/sprompt.c
M src/common/string.c
M src/common/stringinfo.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_east_asian_fw_table.pl
M src/common/unicode/generate-unicode_nonspacing_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/common/unicode/meson.build
M src/common/unicode/norm_test.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/common/wchar.c
M src/fe_utils/Makefile
M src/fe_utils/archive.c
M src/fe_utils/cancel.c
M src/fe_utils/conditional.c
M src/fe_utils/connect_utils.c
M src/fe_utils/mbprint.c
M src/fe_utils/meson.build
M src/fe_utils/option_utils.c
M src/fe_utils/parallel_slot.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/query_utils.c
M src/fe_utils/recovery_gen.c
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attmap.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/detoast.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/heaptoast.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/syncscan.h
M src/include/access/sysattr.h
M src/include/access/table.h
M src/include/access/tableam.h
M src/include/access/timeline.h
M src/include/access/toast_compression.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/access/tupmacs.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/visibilitymapdefs.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogarchive.h
M src/include/access/xlogbackup.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogprefetcher.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogstats.h
M src/include/access/xlogutils.h
M src/include/backup/backup_manifest.h
M src/include/backup/basebackup.h
M src/include/backup/basebackup_sink.h
M src/include/backup/basebackup_target.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/Makefile
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/meson.build
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/copyfrom_internal.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/proclang.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/view.h
M src/include/common/archive.h
M src/include/common/base64.h
M src/include/common/checksum_helper.h
M src/include/common/compression.h
M src/include/common/config_info.h
M src/include/common/connect.h
M src/include/common/controldata_utils.h
M src/include/common/cryptohash.h
M src/include/common/fe_memutils.h
M src/include/common/file_perm.h
M src/include/common/file_utils.h
M src/include/common/hashfn.h
M src/include/common/hmac.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/jsonapi.h
M src/include/common/keywords.h
M src/include/common/kwlookup.h
M src/include/common/link-canary.h
M src/include/common/logging.h
M src/include/common/md5.h
M src/include/common/openssl.h
M src/include/common/pg_prng.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha1.h
M src/include/common/sha2.h
M src/include/common/shortest_dec.h
M src/include/common/string.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execAsync.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIncrementalSort.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMemoize.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidrangescan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/archive.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/connect_utils.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/option_utils.h
M src/include/fe_utils/parallel_slot.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/query_utils.h
M src/include/fe_utils/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getopt_long.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/integerset.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/qunique.h
M src/include/lib/rbtree.h
M src/include/lib/simplehash.h
M src/include/lib/sort_template.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/sasl.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/mb/stringinfo_mb.h
M src/include/meson.build
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/meson.build
M src/include/nodes/miscnodes.h
M src/include/nodes/multibitmapset.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/replnodes.h
M src/include/nodes/subscripting.h
M src/include/nodes/supportnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/paramassign.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_merge.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pch/meson.build
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bitutils.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/pg_iovec.h
M src/include/port/pg_lfind.h
M src/include/port/simd.h
M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/auxprocess.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/interrupt.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSearchCycle.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/backendid.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/fileset.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/md.h
M src/include/storage/meson.build
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilelocator.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/tcop/cmdtag.h
M src/include/tcop/cmdtaglist.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/backend_progress.h
M src/include/utils/backend_status.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/conffiles.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_hooks.h
M src/include/utils/guc_tables.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/memutils_internal.h
M src/include/utils/memutils_memorychunk.h
M src/include/utils/meson.build
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/old_snapshot.h
M src/include/utils/palloc.h
M src/include/utils/partcache.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pgstat_internal.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/queryjumble.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenumbermap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/wait_event.h
M src/include/utils/xid8.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/ecpglib/po/meson.build
M src/interfaces/ecpg/include/meson.build
M src/interfaces/ecpg/meson.build
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/meson.build
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/po/meson.build
M src/interfaces/ecpg/test/compat_informix/meson.build
M src/interfaces/ecpg/test/compat_oracle/meson.build
M src/interfaces/ecpg/test/connect/meson.build
M src/interfaces/ecpg/test/meson.build
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/ecpg/test/pgtypeslib/meson.build
M src/interfaces/ecpg/test/preproc/meson.build
M src/interfaces/ecpg/test/sql/meson.build
M src/interfaces/ecpg/test/thread/meson.build
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-sasl.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
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-common.h
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/fe-trace.c
M src/interfaces/libpq/legacy-pqsignal.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/meson.build
M src/interfaces/libpq/po/meson.build
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/test/libpq_testclient.c
M src/interfaces/libpq/test/libpq_uri_regress.c
M src/interfaces/libpq/test/meson.build
M src/interfaces/libpq/win32.c
M src/interfaces/meson.build
M src/makefiles/meson.build
M src/meson.build
M src/pl/meson.build
M src/pl/plperl/meson.build
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plc_trusted.pl
M src/pl/plperl/plperl.h
M src/pl/plperl/plperl_opmask.pl
M src/pl/plperl/po/meson.build
M src/pl/plperl/text2macro.pl
M src/pl/plpgsql/meson.build
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/meson.build
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/po/meson.build
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/meson.build
M src/pl/plpython/plpython.h
M src/pl/plpython/po/meson.build
M src/pl/tcl/generate-pltclerrcodes.pl
M src/pl/tcl/meson.build
M src/pl/tcl/po/meson.build
M src/port/bsearch_arg.c
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/explicit_bzero.c
M src/port/getpeereid.c
M src/port/kill.c
M src/port/meson.build
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_bitutils.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_crc32c_sse42_choose.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pgstrsignal.c
M src/port/pqsignal.c
M src/port/preadv.c
M src/port/pthread_barrier_wait.c
M src/port/pwritev.c
M src/port/quotes.c
M src/port/snprintf.c
M src/port/strerror.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/strtof.c
M src/port/system.c
M src/port/thread.c
M src/port/win32dlopen.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32fdatasync.c
M src/port/win32getrusage.c
M src/port/win32link.c
M src/port/win32ntdll.c
M src/port/win32pread.c
M src/port/win32pwrite.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32stat.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/authentication/meson.build
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/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/icu/Makefile
M src/test/icu/meson.build
M src/test/icu/t/010_database.pl
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/meson.build
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/kerberos/Makefile
M src/test/kerberos/meson.build
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/Makefile
M src/test/ldap/meson.build
M src/test/ldap/t/001_auth.pl
M src/test/locale/sort-test.pl
M src/test/meson.build
M src/test/modules/brin/meson.build
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/brin/t/02_wal_consistency.pl
M src/test/modules/commit_ts/meson.build
M src/test/modules/commit_ts/t/001_base.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/delay_execution/delay_execution.c
M src/test/modules/delay_execution/meson.build
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_index_am/meson.build
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/dummy_seclabel/meson.build
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/meson.build
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/meson.build
M src/test/modules/plsample/meson.build
M src/test/modules/plsample/plsample.c
M src/test/modules/snapshot_too_old/meson.build
M src/test/modules/spgist_name_ops/meson.build
M src/test/modules/spgist_name_ops/spgist_name_ops.c
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_bloomfilter/meson.build
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_copy_callbacks/meson.build
M src/test/modules/test_copy_callbacks/test_copy_callbacks.c
M src/test/modules/test_custom_rmgrs/meson.build
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/meson.build
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_ginpostinglist/meson.build
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_integerset/meson.build
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_lfind/meson.build
M src/test/modules/test_lfind/test_lfind.c
M src/test/modules/test_misc/meson.build
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_oat_hooks/meson.build
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_parser/meson.build
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_pg_db_role_setting/meson.build
M src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting.c
M src/test/modules/test_pg_dump/meson.build
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_predtest/meson.build
M src/test/modules/test_predtest/test_predtest.c
M src/test/modules/test_rbtree/meson.build
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_regex/meson.build
M src/test/modules/test_regex/test_regex.c
M src/test/modules/test_rls_hooks/meson.build
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/meson.build
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/test_slru/meson.build
M src/test/modules/test_slru/test_slru.c
M src/test/modules/unsafe_tests/meson.build
M src/test/modules/worker_spi/meson.build
M src/test/modules/worker_spi/worker_spi.c
M src/test/perl/Makefile
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/perl/meson.build
M src/test/recovery/Makefile
M src/test/recovery/meson.build
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/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/011_crash_recovery.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/015_promotion_pages.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/021_row_visibility.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/026_overwrite_contrecord.pl
M src/test/recovery/t/028_pitr_timelines.pl
M src/test/recovery/t/029_stats_restart.pl
M src/test/recovery/t/030_stats_cleanup_replica.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/033_replay_tsp_drops.pl
M src/test/regress/GNUmakefile
M src/test/regress/meson.build
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/ssl/meson.build
M src/test/ssl/sslfiles.mk
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/Makefile
M src/test/subscription/meson.build
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.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/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.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/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/100_bugs.pl
M src/timezone/meson.build
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/timezone/tznames/meson.build
M src/tools/PerfectHash.pm
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/fix-old-flex-code.pl
M src/tools/gen_keywordlist.pl
M src/tools/git_changelog
M src/tools/ifaddrs/Makefile
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.pm
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/install.pl
M src/tools/msvc/mkvcbuild.pl
M src/tools/msvc/pgbison.pl
M src/tools/msvc/pgflex.pl
M src/tools/msvc/vcregress.pl
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent
M src/tools/testint128.c
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Adjust VACUUM hastup LP_REDIRECT comments.

commit   : 325bc54eed4ea0836a0bb715bb18342f0c1c668a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 2 Jan 2023 10:18:22 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 2 Jan 2023 10:18:22 -0800    

Click here for diff

The term "truncation" has been ambiguous since commit 10a8d13823 added  
line pointer array truncation during heap pruning.  Clear things up by  
specifying that we're talking about rel truncation here, to match nearby  
comments that apply to tuples with storage.  

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

Avoid special XID snapshotConflictHorizon values.

commit   : 6daeeb1f9196e5d59aa7d5c9ef7ed67b3f3ac4b5    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 2 Jan 2023 10:16:51 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 2 Jan 2023 10:16:51 -0800    

Click here for diff

Don't allow VACUUM to WAL-log the value FrozenTransactionId as the  
snapshotConflictHorizon of freezing or visibility map related WAL  
records.  
  
The only special XID value that's an allowable snapshotConflictHorizon  
is InvalidTransactionId, which is interpreted as "record definitely  
doesn't require a recovery conflict".  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznuNGSzF8v6OsgjaC5aYsb3cZ6HW6MLm30X0d65cmSH6A@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/storage/ipc/standby.c

Add bt_multi_page_stats() function to contrib/pageinspect.

commit   : 1fd3dd2048991a164c287dc29fdb78b1f7e6e14e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2023 13:02:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Jan 2023 13:02:29 -0500    

Click here for diff

This is like the existing bt_page_stats() function, but it can  
report on a range of pages rather than just one at a time.  
  
I don't have a huge amount of faith in the portability of the  
new test cases, but they do pass in a 32-bit FreeBSD VM here.  
Further adjustment may be needed depending on buildfarm results.  
  
Hamid Akhtar, reviewed by Naeem Akhter, Bertrand Drouvot,  
Bharath Rupireddy, and myself  
  
Discussion: https://postgr.es/m/CANugjht-=oGMRmNJKMqnBC69y7vr+wHDmm0ZK6-1pJsxoBKBbA@mail.gmail.com  

M contrib/pageinspect/Makefile
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/btree.out
M contrib/pageinspect/meson.build
A contrib/pageinspect/pageinspect–1.11–1.12.sql
M contrib/pageinspect/pageinspect.control
M contrib/pageinspect/sql/btree.sql
M doc/src/sgml/pageinspect.sgml

Push lpp variable closer to usage in heapgetpage()

commit   : e351f85418313e97c203c73181757a007dfda6d0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 2 Jan 2023 09:39:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 2 Jan 2023 09:39:04 +0100    

Click here for diff

Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_YSOnhKsDyFcqJsKtBSrd32DP-jjXmv7hL0BPD-z0TGXQ@mail.gmail.com  

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

doc: Re-order Table 28.2 "Collected Statistics Views"

commit   : 72e0ff2677c44ea9047cf515fade9742476e2508    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 2 Jan 2023 08:45:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 2 Jan 2023 08:45:17 +0100    

Click here for diff

Make the order more sensible and repeatable.  Comments have been added  
to guide future additions.  
  
Author: Peter Smith <[email protected]>  
Reviewed-by: David G. Johnston <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAHut+Pv8Oa7v06hJb3+HzCtM2u-3oHWMdvXVHhvi7ofB83pNbg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Accept "+infinity" in date and timestamp[tz] input.

commit   : 2ceea5adb02603ef52579b568ca2c5aebed87358    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Jan 2023 14:16:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Jan 2023 14:16:07 -0500    

Click here for diff

The float and numeric types accept this variant spelling of  
"infinity", so it seems like the datetime types should too.  
  
Vik Fearing, some cosmetic mods by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/datetime.c
M src/test/regress/expected/date.out
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/date.sql
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

In plpgsql, don't preassign portal names to bound cursor variables.

commit   : d747dc85aec536c471fd7c739695e155627b08fd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Jan 2023 13:22:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Jan 2023 13:22:34 -0500    

Click here for diff

A refcursor variable that is bound to a specific query (by declaring  
it with "CURSOR FOR") now chooses a portal name in the same way as an  
unbound, plain refcursor variable.  Its string value starts out as  
NULL, and unless that's overridden by manual assignment, it will be  
replaced by a unique-within-session portal name during OPEN.  
  
The previous behavior was to initialize such variables to contain  
their own name, resulting in that also being the portal name unless  
the user overwrote it before OPEN.  The trouble with this is that  
it causes failures due to conflicting portal names if the same  
cursor variable name is used in different functions.  It is pretty  
non-orthogonal to have bound and unbound refcursor variables behave  
differently on this point, too, so let's change it.  
  
This change can cause compatibility problems for applications that  
open a bound cursor in a plpgsql function and then use it in the  
calling code without explicitly passing back the refcursor value  
(portal name).  If the calling code simply assumes that the portal  
name matches the called function's variable name, it will now fail.  
That can be fixed by explicitly assigning a string value to the  
refcursor variable before OPEN, e.g.  
  
    DECLARE myc CURSOR FOR SELECT ...;  
    BEGIN  
      myc := 'myc';  -- add this  
      OPEN myc;  
  
We have no documentation examples showing the troublesome usage  
pattern, so we can hope it's rare in practice.  
  
Patch by me; thanks to Pavel Stehule and Jan Wieck for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/declare.sgml
M src/pl/plpgsql/src/pl_gram.y
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

ci: Change macOS builds from Intel to ARM.

commit   : 14d63dd2523c5292c4fcab4f45a7f534859c4518    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 1 Jan 2023 10:45:18 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 1 Jan 2023 10:45:18 +1300    

Click here for diff

Cirrus is about to shut down its macOS-on-Intel support, so it's time to  
move our CI testing over to ARM instances.  The Homebrew package manager  
changed its default installation prefix for the new architecture, so a  
couple of tests need tweaks to find binaries.  
  
Back-patch to 15, where in-tree CI began.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/20221122225744.GF11463%40telsasoft.com  

M .cirrus.yml
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl

Sample postgres_fdw tables remotely during ANALYZE

commit   : 8ad51b5f446b5c19ba2c0033a0f7b3180b3b6d95    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 30 Dec 2022 23:14:53 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 30 Dec 2022 23:14:53 +0100    

Click here for diff

When collecting ANALYZE sample on foreign tables, postgres_fdw fetched  
all rows and performed the sampling locally. For large tables this means  
transferring and immediately discarding large amounts of data.  
  
This commit allows the sampling to be performed on the remote server,  
transferring only the much smaller sample. The sampling is performed  
using the built-in TABLESAMPLE methods (system, bernoulli) or random()  
function, depending on the remote server version.  
  
Remote sampling can be enabled by analyze_sampling on the foreign server  
and/or foreign table, with supported values 'off', 'auto', 'system',  
'bernoulli' and 'random'. The default value is 'auto' which uses either  
'bernoulli' (TABLESAMPLE method) or 'random' (for remote servers without  
TABLESAMPLE support).  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Fix assert in BRIN build_distances

commit   : 02699bc1fd3b7fccba2e6b55189a148ef69b8a00    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 30 Dec 2022 19:44:48 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 30 Dec 2022 19:44:48 +0100    

Click here for diff

When brin_minmax_multi_union merges summaries, we may end up with just a  
single range after merge_overlapping_ranges. The summaries may contain  
just one range each, and they may overlap (or be exactly the same).  
  
With a single range there's no distance to calculate, but we happen to  
call build_distances anyway - which is fine, we don't calculate the  
distance in this case, except that with asserts this failed due to a  
check there are at least two ranges.  
  
The assert is unnecessarily strict, so relax it a bit and bail out if  
there's just a single range. The relaxed assert would be enough, but  
this way we don't allocate unnecessary memory for distance.  
  
Backpatch to 14, where minmax-multi opclasses were introduced.  
  
Reported-by: Jaime Casanova  
Backpatch-through: 14  
Discussion: https://postgr.es/m/YzVA55qS0hgz8P3r@ahch-to  

M src/backend/access/brin/brin_minmax_multi.c

Fix precision handling for some COERCE_SQL_SYNTAX functions

commit   : 7aa81c61ec8f68212570192f3088544dbfa43cb9    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Dec 2022 20:47:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Dec 2022 20:47:57 +0900    

Click here for diff

f193883 has been incorrectly setting up the precision used in the  
timestamp compilations returned by the following functions:  
- LOCALTIME  
- LOCALTIMESTAMP  
- CURRENT_TIME  
- CURRENT_TIMESTAMP  
  
Specifying an out-of-range precision for CURRENT_TIMESTAMP and  
LOCALTIMESTAMP was raising a WARNING without adjusting the precision,  
leading to a subsequent error.  LOCALTIME and CURRENT_TIME raised a  
WARNING without an error, still the precision given to the internal  
routines was not correct, so let's be clean.  
  
Ian has reported the problems in timestamp.c, while I have noticed the  
ones in date.c.  Regression tests are added for all of them with  
precisions high enough to provide coverage for the warnings, something  
that went missing up to this commit.  
  
Author: Ian Lawrence Barwick, Michael Paquier  
Discussion: https://postgr.es/m/CAB8KJ=jQEnn9sYG+N752spt68wMrhmT-ocHCh4oeNmHF82QMWA@mail.gmail.com  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/expressions.out
M src/test/regress/sql/expressions.sql

Change argument of appendBinaryStringInfo from char * to void *

commit   : 1f605b82ba66ece8b421b10d41094dd2e3c0c48b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Dec 2022 10:59:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Dec 2022 10:59:25 +0100    

Click here for diff

There is some code that uses this function to assemble some kind of  
packed binary layout, which requires a bunch of casts because of this.  
Functions taking binary data plus length should take void * instead,  
like memcpy() for example.  
  
Discussion: https://www.postgresql.org/message-id/flat/a0086cfc-ff0f-2827-20fe-52b591d2666c%40enterprisedb.com  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/xid8funcs.c
M src/common/stringinfo.c
M src/include/lib/stringinfo.h

Use appendStringInfoString instead of appendBinaryStringInfo where possible

commit   : 33a33f0ba4d70a704e2d6bb8ee85f29fe18cead9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Dec 2022 10:59:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Dec 2022 10:59:25 +0100    

Click here for diff

For the jsonpath output, we don't need to squeeze out every bit of  
performance, so instead use a more robust coding style.  There are  
similar calls in jsonb.c, which we leave alone here since there is  
indeed a performance impact for bulk exports.  
  
Discussion: https://www.postgresql.org/message-id/flat/a0086cfc-ff0f-2827-20fe-52b591d2666c%40enterprisedb.com  

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

Add const to BufFileWrite

commit   : faf3750657a8271e2a28c054fd83e47302ac1eb4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Dec 2022 10:02:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Dec 2022 10:02:59 +0100    

Click here for diff

Make data buffer argument to BufFileWrite a const pointer and bubble  
this up to various callers and related APIs.  This makes the APIs  
clearer and more consistent.  
  
Discussion: https://www.postgresql.org/message-id/flat/11dda853-bb5b-59ba-a746-e168b1ce4bdb%40enterprisedb.com  

M src/backend/access/gist/gistbuildbuffers.c
M src/backend/backup/backup_manifest.c
M src/backend/storage/file/buffile.c
M src/backend/utils/sort/logtape.c
M src/include/storage/buffile.h
M src/include/utils/logtape.h

Remove unnecessary casts

commit   : 5f2f99c9c62d754c19e090cb57fdd929438ea519    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 30 Dec 2022 10:02:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 30 Dec 2022 10:02:59 +0100    

Click here for diff

Some code carefully cast all data buffer arguments for data write and  
read function calls to void *, even though the respective arguments  
are already void *.  Remove this unnecessary clutter.  
  
Discussion: https://www.postgresql.org/message-id/flat/11dda853-bb5b-59ba-a746-e168b1ce4bdb%40enterprisedb.com  

M src/backend/executor/nodeAgg.c
M src/backend/storage/file/buffile.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c

perl: Hide warnings inside perl.h when using gcc compatible compiler

commit   : 388e80132c007a7528abc987e347e41432dc1542    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 29 Dec 2022 12:47:29 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 29 Dec 2022 12:47:29 -0800    

Click here for diff

New versions of perl trigger warnings within perl.h with our compiler  
flags. At least -Wdeclaration-after-statement, -Wshadow=compatible-local are  
known to be problematic.  
  
To avoid these warnings, conditionally use #pragma GCC system_header before  
including plperl.h.  
  
Alternatively, we could add the include paths for problematic headers with  
-isystem, but that is a larger hammer and is harder to search for.  
  
A more granular alternative would be to use #pragma GCC diagnostic  
push/ignored/pop, but gcc warns about unknown warnings being ignored, so every  
to-be-ignored-temporarily compiler warning would require its own pg_config.h  
symbol and #ifdef.  
  
As the warnings are voluminous, it makes sense to backpatch this change. But  
don't do so yet, we first want gather buildfarm coverage - it's e.g. possible  
that some compiler claiming to be gcc compatible has issues with the pragma.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h
M src/pl/plperl/plperl.h

Fix oversight in 7a05425d96

commit   : 203942243c2a2da188db962f3384f1c607a462b5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Dec 2022 07:16:41 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Dec 2022 07:16:41 -0500    

Click here for diff

This patch was changed as a result of review but one line didn't get the  
message. Mea Culpa.  

M contrib/ltree/ltree_io.c

Add page-level freezing to VACUUM.

commit   : 1de58df4fec7325d91f5a8345757314be7ac05da    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 28 Dec 2022 08:50:47 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 28 Dec 2022 08:50:47 -0800    

Click here for diff

Teach VACUUM to decide on whether or not to trigger freezing at the  
level of whole heap pages.  Individual XIDs and MXIDs fields from tuple  
headers now trigger freezing of whole pages, rather than independently  
triggering freezing of each individual tuple header field.  
  
Managing the cost of freezing over time now significantly influences  
when and how VACUUM freezes.  The overall amount of WAL written is the  
single most important freezing related cost, in general.  Freezing each  
page's tuples together in batch allows VACUUM to take full advantage of  
the freeze plan WAL deduplication optimization added by commit 9e540599.  
  
Also teach VACUUM to trigger page-level freezing whenever it detects  
that heap pruning generated an FPI.  We'll have already written a large  
amount of WAL just to do that much, so it's very likely a good idea to  
get freezing out of the way for the page early.  This only happens in  
cases where it will directly lead to marking the page all-frozen in the  
visibility map.  
  
In most cases "freezing a page" removes all XIDs < OldestXmin, and all  
MXIDs < OldestMxact.  It doesn't quite work that way in certain rare  
cases involving MultiXacts, though.  It is convenient to define "freeze  
the page" in a way that gives FreezeMultiXactId the leeway to put off  
the work of processing an individual tuple's xmax whenever it happens to  
be a MultiXactId that would require an expensive second pass to process  
aggressively (allocating a new multi is especially worth avoiding here).  
FreezeMultiXactId is eager when processing is cheap (as it usually is),  
and lazy in the event of an individual multi that happens to require  
expensive second pass processing.  This avoids regressions related to  
processing of multis that page-level freezing might otherwise cause.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Jeff Davis <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkFok_6EAHuK39GaW4FjEFQsY=3J0AAd6FXk93u-Xq3Fg@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

Convert contrib/ltree's input functions to report errors softly

commit   : 7a05425d96742acff5ebfacf307711385c88429b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 28 Dec 2022 09:58:04 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 28 Dec 2022 09:58:04 -0500    

Click here for diff

Reviewed by Tom Lane and Amul Sul  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree_io.c
M contrib/ltree/ltxtquery_io.c
M contrib/ltree/sql/ltree.sql

Convert contrib/intarray's bqarr_in() to report errors softly

commit   : 3b76622e04d8656fb44e7c932cb243e2d92fe40e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 28 Dec 2022 09:53:00 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 28 Dec 2022 09:53:00 -0500    

Click here for diff

Reviewed by Tom Lane and Amul Sul  
  
Discussion: https://postgr.es/m/[email protected]  

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

Reorder some object files in makefiles

commit   : 24b55cd949a11b712927acf2557683976ee149ac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2022 14:20:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Dec 2022 14:20:53 +0100    

Click here for diff

This restores some once-intended alphabetical orders and makes the  
lists consistent between the different build systems.  

M src/bin/pg_basebackup/Makefile
M src/common/Makefile
M src/tools/msvc/Mkvcbuild.pm

Suppress uninitialized-variable warning from a61b1f748.

commit   : adb5c32eb53e1ffdc5c954aafcc5bc9ed93f3de6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 18:07:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 18:07:48 -0500    

Click here for diff

Some compilers complain about sub_rteperminfos not being  
initialized, evidently because they don't detect that it  
is only used and set if isGeneralSelect is true.  
Make it follow the long-established pattern for its  
sibling variable sub_rtable.  
  
Per reports from Pavel Stehule and the buildfarm.  
  
Discussion: https://postgr.es/m/CAFj8pRDOvGOi-n616kM0Cc7qSbg_nGoS=-haB+D785sUXADqSg@mail.gmail.com  

M src/backend/parser/analyze.c

Convert hstore_in to report errors softly.

commit   : 197f98a848233f2d8d8e7f7fd7dde3e49adaaaa3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 14:50:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 14:50:56 -0500    

Click here for diff

The error reporting here was not only old and crufty, but untested.  
I took the opportunity to bring the messages into some sort of  
compliance with our message style guidelines.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/expected/hstore.out
M contrib/hstore/hstore_io.c
M contrib/hstore/sql/hstore.sql

Remove new locale dependency in regproc regression test.

commit   : a5434c52586f37db7f538d3dcc8aa6dd62dfe61e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 13:06:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 13:06:42 -0500    

Click here for diff

The modified error message for regcollationin failure includes  
the database encoding, which it should've occurred to me is a  
portability hazard for the regression tests.  Adjust the test  
so the expected output doesn't include that.  
  
In passing, fix a comment typo introduced in b8c0ffbd2.  
  
Per buildfarm.  

M src/backend/utils/adt/domains.c
M src/test/regress/expected/regproc.out
M src/test/regress/sql/regproc.sql

Simplify the implementations of the to_reg* functions.

commit   : 3ea7329c9a79ade27b5d3742d1a41ce6d0d9aca8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 12:33:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 12:33:04 -0500    

Click here for diff

Given the soft-input-error feature, we can reduce these functions  
to be just thin wrappers around a soft-error call of the  
corresponding datatype input function.  This means less code and  
more certainty that the to_reg* functions match the normal input  
behavior.  
  
Notably, it also means that they will accept numeric OID input,  
which they didn't before.  It's not clear to me if that omission  
had more than laziness behind it, but it doesn't seem like  
something we need to work hard to preserve.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/regproc.c

Convert the reg* input functions to report (most) errors softly.

commit   : 858e776c84f48841e7e16fba7b690b76e54f3675    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 12:26:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 12:26:01 -0500    

Click here for diff

This is not really complete, but it catches most cases of practical  
interest.  The main omissions are:  
  
* regtype, regprocedure, and regoperator parse type names by  
calling the main grammar, so any grammar-detected syntax error  
will still be a hard error.  Also, if one includes a type  
modifier in such a type specification, errors detected by the  
typmodin function will be hard errors.  
  
* Lookup errors are handled just by passing missing_ok = true  
to the relevant catalog lookup function.  Because we've used  
quite a restrictive definition of "missing_ok", this means that  
edge cases such as "the named schema exists, but you lack  
USAGE permission on it" are still hard errors.  
  
It would make sense to me to replace most/all missing_ok  
parameters with an escontext parameter and then allow these  
additional lookup failure cases to be trapped too.  But that's  
a job for some other day.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaddress.c
M src/backend/parser/parse_type.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/fmgr/funcapi.c
M src/include/parser/parse_type.h
M src/include/utils/regproc.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpython/plpy_spi.c
M src/pl/tcl/pltcl.c
M src/test/regress/expected/regproc.out
M src/test/regress/sql/regproc.sql

Convert tsqueryin and tsvectorin to report errors softly.

commit   : 78212f21011449f0374831323655baa7c00f3680    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 12:00:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 12:00:31 -0500    

Click here for diff

This is slightly tedious because the adjustments cascade through  
a couple of levels of subroutines, but it's not very hard.  
I chose to avoid changing function signatures more than absolutely  
necessary, by passing the escontext pointer in existing structs  
where possible.  
  
tsquery's nuisance NOTICEs about empty queries are suppressed in  
soft-error mode, since they're not errors and we surely don't want  
them to be shown to the user anyway.  Maybe that whole behavior  
should be reconsidered.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/to_tsany.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_parser.c
M src/include/tsearch/ts_utils.h
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tstypes.sql

Detect bad input for types xid, xid8, and cid.

commit   : eb8312a22a84c33fc405ae9b497113973f552f90    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 11:40:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Dec 2022 11:40:01 -0500    

Click here for diff

Historically these input functions just called strtoul or strtoull  
and returned the result, with no error detection whatever.  Upgrade  
them to reject garbage input and out-of-range values, similarly to  
our other numeric input routines.  
  
To share the code for this with type oid, adjust the existing  
"oidin_subr" to be agnostic about the SQL name of the type it is  
handling, and move it to numutils.c; then clone it for 64-bit types.  
  
Because the xid types previously accepted hex and octal input by  
reason of calling strtoul[l] with third argument zero, I made the  
common subroutine do that too, with the consequence that type oid  
now also accepts hex and octal input.  In view of 6fcda9aba, that  
seems like a good thing.  
  
While at it, simplify the existing over-complicated handling of  
syntax errors from strtoul: we only need one ereturn not three.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/xid.c
M src/include/utils/builtins.h
M src/test/regress/expected/xid.out
M src/test/regress/sql/xid.sql

Remove overzealous MultiXact freeze assertion.

commit   : 63c844a0a5d70cdbd6ae0470d582d39e75ad8d66    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 26 Dec 2022 23:36:02 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 26 Dec 2022 23:36:02 -0800    

Click here for diff

When VACUUM determines that an existing MultiXact should use a freeze  
plan that sets xmax to InvalidTransactionId, the original Multi may or  
may not be before OldestMxact.  Remove an incorrect assertion that  
expected it to always be from before OldestMxact.  
  
Oversight in commit 4ce3af.  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Hayato Kuroda <[email protected]>  
Discussion: https://postgr.es/m/TYAPR01MB5866B24104FD80B5D7E65C3EF5ED9@TYAPR01MB5866.jpnprd01.prod.outlook.com  

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

Add custom filtering rules to the TAP tests of pg_upgrade

commit   : 9814ff550046f825b751803191b29a2fbbc79283    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Dec 2022 14:35:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Dec 2022 14:35:56 +0900    

Click here for diff

002_pg_upgrade.pl gains support for a new environment variable called  
"filter_rules", that can be used to point to a file that includes a  
set of custom regular expressions that would be applied to the dumps of  
the origin and target clusters when doing a cross-version test (aka when  
defining olddump and oldinstall), to give the possibility to reshape  
dynamically the dumps in the same way as the internals of the buildfarm  
code so as the tests are able to pass in scenarios where one expects  
them to even if pg_dump generates slightly-different outputs depending  
on the versions involved.  
  
This option is not used when pg_upgrade runs with the same version for  
the origin and target clusters, and it is the last piece I see as  
required to be able to plug-in more efficiently the TAP tests of  
pg_upgrade with the buildfarm or just a CI.  
  
Author: Anton A. Melnikov  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/TESTING
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Fix incorrect copy-pasto in error message of pg_waldump.c

commit   : 2259c661dc4ecd88ac22b5358248f47ca5a5d4fc    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Dec 2022 12:16:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Dec 2022 12:16:24 +0900    

Click here for diff

The error message used on fclose() failure was incorrect, so fix it.  
Oversight in d497093, that I have somehow managed to miss.  

M src/bin/pg_waldump/pg_waldump.c

pg_waldump: Add --save-fullpage=PATH to save full page images from WAL records

commit   : d497093cbecccf6df26365e06a5f8f8614b591c8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Dec 2022 08:27:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Dec 2022 08:27:53 +0900    

Click here for diff

This option extracts (potentially decompressing) full-page images  
included in WAL records into a given target directory.  These images are  
subject to the same filtering rules as the normal display of the WAL  
records, hence with --relation one can for example extract only the FPIs  
issued on the relation defined.  By default, the records are printed or  
their stats computed (--stats), using --quiet would only save the images  
without any output generated.  
  
This is a tool aimed mostly for very experienced users, useful for  
fixing page-level corruption or just analyzing the past state of a page,  
and there were no easy way to do that with the in-core tools up to now  
when looking at WAL.  
  
Each block is saved in a separate file, to ease their manipulation, with  
the file respecting <lsn>.<ts>.<db>.<rel>.<blk>_<fork> with as format.  
  
For instance, 00000000-010000C0.1663.1.6117.123_main refers to:  
- WAL record LSN in hexa format (00000000-010000C0).  
- Tablespace OID (1663).  
- Database OID (1).  
- Relfilenode (6117).  
- Block number (123).  
- Fork name of the file this block came from (_main).  
  
Author: David Christensen  
Reviewed-by: Sho Kato, Justin Pryzby, Bharath Rupireddy, Matthias van de  
Meent  
Discussion: https://postgr.es/m/CAOxo6XKjQb2bMSBRpePf3ZpzfNTwjQUc4Tafh21=jzjX6bX8CA@mail.gmail.com  

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

Add 'logical_decoding_mode' GUC.

commit   : 5de94a041ed7a51b571db2030ba87600c7fc6262    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 26 Dec 2022 08:58:16 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 26 Dec 2022 08:58:16 +0530    

Click here for diff

This enables streaming or serializing changes immediately in logical  
decoding. This parameter is intended to be used to test logical decoding  
and replication of large transactions for which otherwise we need to  
generate the changes till logical_decoding_work_mem is reached.  
  
This helps in reducing the timing of existing tests related to logical  
replication of in-progress transactions and will help in writing tests for  
for the upcoming feature for parallelly applying large in-progress  
transactions.  
  
Author: Shi yu  
Reviewed-by: Sawada Masahiko, Shveta Mallik, Amit Kapila, Dilip Kumar, Kuroda Hayato, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/OSZPR01MB63104E7449DBE41932DB19F1FD1B9@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M doc/src/sgml/config.sgml
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/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
M src/tools/pgindent/typedefs.list

Switch query fixing aclitems in ~15 from O(N^2) to O(N) in upgrade_adapt.sql

commit   : d3c0cc4447307a2ffbcff8274573b544294e583c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Dec 2022 08:00:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Dec 2022 08:00:55 +0900    

Click here for diff

f4f2f2b was doing a sequential scan of pg_class before checking if a  
relation had attributes dependent on aclitem as data typewhen building  
the set of ALTER TABLE queries, but it would be costly on a regression  
database.  
  
While on it, make the query style more consistent with the rest.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/upgrade_adapt.sql

Convert enum_in() to report errors softly.

commit   : 442e25d2485b1ecf3357725acee995a1c349163d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Dec 2022 14:32:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Dec 2022 14:32:02 -0500    

Click here for diff

I missed this in my initial survey, probably because I examined  
the contents of pg_type in the postgres database, which lacks  
any enumerated types.  
  
Discussion: https://postgr.es/m/CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com  

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

Fix thinko in 720e0327bc

commit   : 361ec4368b1da252e031e2ee8bce366bce5f72b2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 25 Dec 2022 04:36:58 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 25 Dec 2022 04:36:58 -0500    

Click here for diff

M contrib/isn/isn.c

Convert contrib/isn's input functions to report errors softly

commit   : 720e0327bc98464b889801a65ae2358f86a0265a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 24 Dec 2022 15:28:13 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 24 Dec 2022 15:28:13 -0500    

Click here for diff

M contrib/isn/expected/isn.out
M contrib/isn/isn.c
M contrib/isn/sql/isn.sql

Convert jsonpath's input function to report errors softly

commit   : e37fe1db6ef930f657be28fe764f7e642b93464a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 24 Dec 2022 15:19:14 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 24 Dec 2022 15:19:14 -0500    

Click here for diff

Reviewed by Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/jsonpath_scan.l
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonpath.sql

Make the numeric-OID cases of regprocin and friends be non-throwing.

commit   : 780ec9f1b2a44c118d1246325404ad0ed2226cbf    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Dec 2022 15:01:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Dec 2022 15:01:21 -0500    

Click here for diff

While at it, use a common subroutine already.  
  
This doesn't move the needle very far in terms of making these  
functions non-throwing; the only case we're now able to trap is  
numeric-OID-is-out-of-range.  Still, it seems like a pretty  
non-controversial step in that direction.  

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

Fix recent accidental omission in pg_proc.dat

commit   : b5aff9255700b0b3155a4d2be865b6a776c2bda4    
  
author   : David Rowley <[email protected]>    
date     : Sat, 24 Dec 2022 13:18:35 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 24 Dec 2022 13:18:35 +1300    

Click here for diff

ed1a88dda added support functions for the ntile(), percent_rank() and  
cume_dist() window functions but neglected to actually add these support  
functions to the pg_proc entry for the corresponding window function.  
  
Also, take this opportunity to add these window functions to one of the  
regression tests added in ed1a88dda to give the support functions a little  
bit of exercise.  If I'd done that in the first place then the omission  
would have been more obvious.  
  
Bump the catversion, again.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Rework <warning> box about column list combining in logical replication

commit   : c6f21b2ac215ad870a95159ea22024f734429622    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Dec 2022 17:49:51 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Dec 2022 17:49:51 +0100    

Click here for diff

After some copy-edit I made in commit 3a06a79cd137, we have a <sect2>  
that only contains a warning box.  This doesn't look good.  Rework by  
moving the sect2 title to be the warning's title, and put the 'id' to it  
as well, so that the external reference continues to work.  
  
Backpatch to 15.  
  
In branch master, I also take the opportunity to add titles to a couple  
of other warning boxes elsewhere in the documentation.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/pg_rewind.sgml

Fix end LSN determination in recently added test

commit   : 6602599ce25665394112b944f3cdbd68a2587d97    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Dec 2022 17:27:05 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Dec 2022 17:27:05 +0100    

Click here for diff

The test added in commit e44dae07f931 has a thinko: it wants to read  
info about a few WAL records, but it obtains the LSN of the final record  
to read by asking for the WAL insert position; however,  
pg_get_wal_records_info only accepts to read up to the flush position  
(cf. IsFutureLSN()).  In normal conditions there is no difference, since  
the last record written by the preceding loop is known flushed and it's  
the one the test wants; but it's possible to have some other process  
insert another WAL record that isn't flushed, and that causes the whole  
test to explode.  
  
Fix by having pg_get_wal_records_info() read only up to the flushed  
position.  Backpatch to 15, which is where pg_walinspect appeared.  
  
Author: Karina Litskevich <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/brin/t/02_wal_consistency.pl

Convert contrib/seg's input function to report errors softly

commit   : 878ce16056c087e2dcd7cc31cd7e4700f407a770    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 23 Dec 2022 09:17:24 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 23 Dec 2022 09:17:24 -0500    

Click here for diff

Reviewed by Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/seg/expected/seg.out
M contrib/seg/seg.c
M contrib/seg/segdata.h
M contrib/seg/segparse.y
M contrib/seg/segscan.l
M contrib/seg/sql/seg.sql

Fix event trigger example

commit   : 7a310338f4dd3195376477d502e93fba5f165769    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Dec 2022 13:21:41 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Dec 2022 13:21:41 +0100    

Click here for diff

Commit 2f9661311b changed command tags from strings to numbers, but  
forgot to adjust the code in the event trigger example, which  
consequently failed to compile.  
  
While fixing that, improve the indentation to adhere to pgindent style.  
  
Backpatch to v13, where the change was introduced.  
  
Author: Laurenz Albe  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/event-trigger.sgml

Fix bug in translate_col_privs_multilevel

commit   : bbfdf7180de85f9e7e995ba00dddc58452b3ba4b    
  
author   : David Rowley <[email protected]>    
date     : Sat, 24 Dec 2022 00:58:34 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 24 Dec 2022 00:58:34 +1300    

Click here for diff

Fix incorrect code which was trying to convert a Bitmapset of columns at  
the attnums according to a parent table and transform them into the  
equivalent Bitmapset with same attnums according to the given child table.  
This code is new as of a61b1f748 and was failing to do the correct  
translation when there was an intermediate parent table between 'rel' and  
'top_parent_rel'.  
  
Reported-by: Ranier Vilela  
Author: Richard Guo, Amit Langote  
Discussion: https://postgr.es/m/CAEudQArohfB_Gy%2BhcH2-bANUkxgjJiP%3DABq01_LgTNTbcNijag%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/util/inherit.c

Allow parent's WaitEventSets to be freed after fork().

commit   : b5d0f8ec01c021452203b2fd3921c9b55f6c3cd3    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 23 Dec 2022 20:26:52 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 23 Dec 2022 20:26:52 +1300    

Click here for diff

An epoll fd belonging to the parent should be closed in the child.  A  
kqueue fd is automatically closed by fork(), but we should still adjust  
our counter.  For poll and Windows systems, nothing special is required.  
On all systems we free the memory.  
  
No caller yet, but we'll need this if we start using WaitEventSet in the  
postmaster as planned.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%40mail.gmail.com  

M src/backend/storage/ipc/latch.c
M src/include/storage/latch.h

Don't leak a signalfd when using latches in the postmaster.

commit   : 1f0019de2fe374fa54fca277f36c2e754894db30    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 23 Dec 2022 20:24:41 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 23 Dec 2022 20:24:41 +1300    

Click here for diff

At the time of commit 6a2a70a02 we didn't use latch infrastructure in  
the postmaster.  We're planning to start doing that, so we'd better make  
sure that the signalfd inherited from a postmaster is not duplicated and  
then leaked in the child.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%40mail.gmail.com  

M src/backend/storage/ipc/latch.c

Add WL_SOCKET_ACCEPT event to WaitEventSet API.

commit   : 30829e52ff1a026c0b6ad042e7e5f39ff6abf9bb    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 23 Dec 2022 20:21:47 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 23 Dec 2022 20:21:47 +1300    

Click here for diff

To be able to handle incoming connections on a server socket with  
the WaitEventSet API, we'll need a new kind of event to indicate that  
the the socket is ready to accept a connection.  
  
On Unix, it's just the same as WL_SOCKET_READABLE, but on Windows there  
is a different underlying kernel event that we need to map our  
abstraction to.  
  
No user yet, but a proposed patch would use this.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%40mail.gmail.com  

M src/backend/storage/ipc/latch.c
M src/include/storage/latch.h

Update upgrade_adapt.sql to handle tables using aclitem as data type

commit   : f4f2f2b84a0bbf9edbfc4a8684040a941cd6d085    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 23 Dec 2022 11:36:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 23 Dec 2022 11:36:57 +0900    

Click here for diff

The regression test suite includes a table called "tab_core_types" that  
has one attribute based on the type "aclitem".  Keeping this attribute  
as-is causes hard failures when running pg_upgrade with an origin on  
~15.  This commit updates upgrade_adapt.sql to automatically detect the  
tables with such attributes and switch them to text so as pg_upgrade  
is able to go through its run.  
  
This does not provide the same detection coverage as pg_upgrade, where  
we are able to find out aclitems used in arrays, domains or even  
composite types, but this is (I guess) enough for most things like an  
instance that had installcheck run on before the upgrade with a dump  
generated from it.  
  
Note that the buildfarm code has taken the simplest approach of just  
dropping "tab_core_types", so what we have here is more modular.  
  
Author: Anton A. Melnikov  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/upgrade_adapt.sql

Fix some incorrectness in upgrade_adapt.sql on query for WITH OIDS

commit   : 3022cb14339656be2afeee72150dcc5725838398    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 23 Dec 2022 11:26:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 23 Dec 2022 11:26:49 +0900    

Click here for diff

The query used to disable WITH OIDS in all the relations making use of  
it was checking for materialized views, but this is not a supported  
operation.  On the contrary, this needs to be done on foreign tables.  
  
While on it, use quote_ident() in the ALTER TABLE strings built on the  
relation name.  
  
Author: Anton A. Melnikov, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/bin/pg_upgrade/upgrade_adapt.sql

Fix come incorrect elog() messages in aclchk.c

commit   : 2fcf685f6daa4f872ca726e25cc504a544916dbb    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 23 Dec 2022 10:04:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 23 Dec 2022 10:04:18 +0900    

Click here for diff

Three error strings used with cache lookup failures were referring to  
incorrect object types for ACL checks:  
- Schemas  
- Types  
- Foreign Servers  
There errors should never be triggered, but if they do incorrect  
information would be reported.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/catalog/aclchk.c

Rename pg_dissect_walfile_name() to pg_split_walfile_name()

commit   : 13e0d7a603852b8b05c03b45228daabffa0cced2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 23 Dec 2022 09:15:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 23 Dec 2022 09:15:01 +0900    

Click here for diff

The former name was discussed as being confusing, so use "split", as per  
a suggestion from Magnus Hagander.  
  
While on it, one of the output arguments is renamed from "segno" to  
"segment_number", as per a suggestion from Kyotaro Horiguchi.  
  
The documentation is updated to reflect all these changes.  
  
Bump catalog version.  
  
Author: Bharath Rupireddy, Michael Paquier  
Discussion: https://postgr.es/m/CABUevEytQVaOOhGdoh0D7hGwe3fuKcRF6NthsSW7ww04EmtFgQ@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xlogfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Allow window functions to adjust their frameOptions

commit   : ed1a88ddaccfe883e4cf74d30319accfeae6cfe5    
  
author   : David Rowley <[email protected]>    
date     : Fri, 23 Dec 2022 12:43:52 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 23 Dec 2022 12:43:52 +1300    

Click here for diff

WindowFuncs such as row_number() don't care if it's called with ROWS  
UNBOUNDED PRECEDING AND CURRENT ROW or with RANGE UNBOUNDED PRECEDING AND  
CURRENT ROW.  The latter is less efficient as the RANGE option requires  
that the executor check for peer rows, so using the ROW option instead  
would cause less overhead.  Because RANGE is part of the default frame  
options for WindowClauses, it means WindowAgg is, by default, working much  
harder than it needs to for window functions where the ROWS / RANGE option  
has no effect on the window function's result.  
  
On a test query from the discussion thread, a performance improvement of  
344% was seen by using ROWS instead of RANGE.  
  
Here we add a new support function node type to allow support functions to  
be called for window functions so that the most optimal version of the  
frame options can be set.  The planner has been adjusted so that the frame  
options are changed only if all window functions sharing the same window  
clause agree on what the optimized frame options are.  
  
Here we give the ability for row_number(), rank(), dense_rank(),  
percent_rank(), cume_dist() and ntile() to alter their WindowClause's  
frameOptions.  
  
Reviewed-by: Vik Fearing, Erwin Brandstetter, Zhihong Yu  
Discussion: https://postgr.es/m/CAGHENJ7LBBszxS+SkWWFVnBmOT2oVsBhDMB1DFrgerCeYa_DyA@mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvohAKEtTXxq7Pc-ic2dKT8oZfbRKeEJP64M0B6+S88z+A@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/backend/parser/parse_agg.c
M src/backend/utils/adt/windowfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/nodes/supportnodes.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Improve notation of cacheinfo table in syscache.c.

commit   : cc150596341e2a7913519769a88a1537c2e94720    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 23 Dec 2022 10:40:18 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 23 Dec 2022 10:40:18 +1300    

Click here for diff

Use C99 designated initializer syntax for the array elements, instead of  
writing the enumerator name and position in a comment.  Replace nkeys  
and key with a local variadic macro, for a shorter notation.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKdpDjKL2jgC-GpoL4DGZU1YPqnOFHbDqFkfRQcPaR5DQ%40mail.gmail.com  

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

Use scanned_pages to decide when to failsafe check.

commit   : 07eef53955ea9885dd3e4701b7eaa34ccdf2ae02    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 22 Dec 2022 10:41:40 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 22 Dec 2022 10:41:40 -0800    

Click here for diff

Perform a failsafe check every time VACUUM's first heap scan scans a  
further FAILSAFE_EVERY_PAGES pages, rather than using an approach based  
on the number of physical blocks that our current blkno is from the  
blkno at the time of the previous failsafe check.  That way VACUUM will  
perform a failsafe check every time it has scanned a uniform number of  
pages, without it mattering when or how VACUUM skipped pages using the  
visibility map.  
  
Sami Imseih, with changes to FAILSAFE_EVERY_PAGES comments added by me.  
  
Author: Sami Imseih <[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/401CE010-4049-4B94-9961-0B610A5D254D%40amazon.com  

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

Refactor how VACUUM passes around its XID cutoffs.

commit   : 4ce3afb82ecfbf64d4f6247e725004e1da30f47c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 22 Dec 2022 09:37:59 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 22 Dec 2022 09:37:59 -0800    

Click here for diff

Use a dedicated struct for the XID/MXID cutoffs used by VACUUM, such as  
FreezeLimit and OldestXmin.  This state is initialized in vacuum.c, and  
then passed around by code from vacuumlazy.c to heapam.c freezing  
related routines.  The new convention is that everybody works off of the  
same cutoff state, which is passed around via pointers to const.  
  
Also simplify some of the logic for dealing with frozen xmin in  
heap_prepare_freeze_tuple: add dedicated "xmin_already_frozen" state to  
clearly distinguish xmin XIDs that we're going to freeze from those that  
were already frozen from before.  That way the routine's xmin handling  
code is symmetrical with the existing xmax handling code.  This is  
preparation for an upcoming commit that will add page level freezing.  
  
Also refactor the control flow within FreezeMultiXactId(), while adding  
stricter sanity checks.  We now test OldestXmin directly, instead of  
using FreezeLimit as an inexact proxy for OldestXmin.  This is further  
preparation for the page level freezing work, which will make the  
function's caller cede control of page level freezing to the function  
where appropriate (where heap_prepare_freeze_tuple sees a tuple that  
happens to contain a MultiXactId in its xmax).  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Jeff Davis <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznS9TxXmz2_=SY+SyJyDFbiOftKofM9=aDo68BbXNBUMA@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/multixact.c
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/commands/vacuum.h

Avoid O(N^2) cost when pulling up lots of UNION ALL subqueries.

commit   : e42e312430279dcd8947846fdfeb4885e3754eac    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2022 11:02:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2022 11:02:03 -0500    

Click here for diff

perform_pullup_replace_vars() knows how to scan the whole parent  
query tree when we are replacing Vars during a subquery flattening  
operation.  However, for the specific case of flattening a  
UNION ALL leaf query, that's mostly wasted work: the only place  
where relevant Vars could exist is in the AppendRelInfo that we  
just made for this leaf.  Teaching perform_pullup_replace_vars()  
to just deal with that and exit is worthwhile because, if we have  
N such subqueries to pull up, we were spending O(N^2) work uselessly  
mutating the AppendRelInfos for all the other subqueries.  
  
While we're at it, avoid calling substitute_phv_relids if there are no  
PlaceHolderVars, and remove an obsolete check of parse->hasSubLinks.  
  
Andrey Lepikhov and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepjointree.c

Add some recursion and looping defenses in prepjointree.c.

commit   : 5beb7881fb27d1830fa4c57ba263c8042449a599    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2022 10:35:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Dec 2022 10:35:02 -0500    

Click here for diff

Andrey Lepikhov demonstrated a case where we spend an unreasonable  
amount of time in pull_up_subqueries().  Not only is that recursing  
with no explicit check for stack overrun, but the code seems not  
interruptable by control-C.  Let's stick a CHECK_FOR_INTERRUPTS  
there, along with sprinkling some stack depth checks.  
  
An actual fix for the excessive time consumption seems a bit  
risky to back-patch; but this isn't, so let's do so.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepjointree.c

Remove dead code

commit   : 73bb72f0ca2833329b59ebaf9476be3be71e462f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Dec 2022 08:12:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Dec 2022 08:12:41 +0100    

Click here for diff

The second appearance of NamespaceRelationId in this if-else chain is  
in error and can be removed.  

M src/backend/catalog/aclchk.c

Add work-around for VA_ARGS_NARGS() on MSVC.

commit   : 3f28bd7337d7c01820283fee51027a9dc9d2295f    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 22 Dec 2022 17:14:23 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 22 Dec 2022 17:14:23 +1300    

Click here for diff

The previous coding of VA_ARGS_NARGS() always returned 1 on Visual  
Studio, because it treats __VA_ARGS__ as a single token unless you jump  
through extra hoops.  Newer compilers have an option to fix that.  Add a  
comment about that so that we can remember to clean this up in the  
future when our minimum MSVC version advances.  
  
Author: Victor Spirin <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/f450fc57-a147-19d0-e50c-33571c52cc13%40postgrespro.ru  

M src/include/c.h

Fix operator typo in tablecmds.c

commit   : 01be9d498fa4b836ec3dbf035b6743c8b8f34767    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Dec 2022 12:08:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Dec 2022 12:08:45 +0900    

Click here for diff

A bitwise operator was getting used on two bools in  
ATAddCheckConstraint() to track if constraints should be merged or not  
with the existing ones of a relation, though obviously this should use  
a boolean OR operator.  This led to the same result, but let's be  
clean.  
  
Oversight in 074c5cf.  
  
Author: Ranier Vilela  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAEudQAp2R2fbbi0OHHhv_n4=Ch0t1VtjObR9YMqtGKHJ+faUFQ@mail.gmail.com  

M src/backend/commands/tablecmds.c

Add palloc_aligned() to allow aligned memory allocations

commit   : 439f61757f054109f9ee5415530a2744f7e5cb7a    
  
author   : David Rowley <[email protected]>    
date     : Thu, 22 Dec 2022 13:32:05 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 22 Dec 2022 13:32:05 +1300    

Click here for diff

This introduces palloc_aligned() and MemoryContextAllocAligned() which  
allow callers to obtain memory which is allocated to the given size and  
also aligned to the specified alignment boundary.  The alignment  
boundaries may be any power-of-2 value.  Currently, the alignment is  
capped at 2^26, however, we don't expect values anything like that large.  
The primary expected use case is to align allocations to perhaps CPU  
cache line size or to maybe I/O page size.  Certain use cases can benefit  
from having aligned memory by either having better performance or more  
predictable performance.  
  
The alignment is achieved by requesting 'alignto' additional bytes from  
the underlying allocator function and then aligning the address that is  
returned to the requested alignment.  This obviously does waste some  
memory, so alignments should be kept as small as what is required.  
  
It's also important to note that these alignment bytes eat into the  
maximum allocation size.  So something like:  
  
palloc_aligned(MaxAllocSize, 64, 0);  
  
will not work as we cannot request MaxAllocSize + 64 bytes.  
  
Additionally, because we're just requesting the requested size plus the  
alignment requirements from the given MemoryContext, if that context is  
the Slab allocator, then since slab can only provide chunks of the size  
that's specified when the slab context is created, then this is not going  
to work.  Slab will generate an error to indicate that the requested size  
is not supported.  
  
The alignment that is requested in palloc_aligned() is stored along with  
the allocated memory.  This allows the alignment to remain intact through  
repalloc() calls.  
  
Author: Andres Freund, David Rowley  
Reviewed-by: Maxim Orlov, Andres Freund, John Naylor  
Discussion: https://postgr.es/m/CAApHDvpxLPUMV1mhxs6g7GNwCP6Cs6hfnYQL5ffJQTuFAuxt8A%40mail.gmail.com  

M src/backend/utils/cache/catcache.c
M src/backend/utils/mmgr/Makefile
A src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/meson.build
M src/include/utils/memutils_internal.h
M src/include/utils/memutils_memorychunk.h
M src/include/utils/palloc.h

Fix contrib/seg to be more wary of long input numbers.

commit   : 701c881f782b93ee29587112390bd3bfe035e78d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Dec 2022 17:51:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Dec 2022 17:51:50 -0500    

Click here for diff

seg stores the number of significant digits in an input number  
in a "char" field.  If char is signed, and the input is more than  
127 digits long, the count can read out as negative causing  
seg_out() to print garbage (or, if you're really unlucky,  
even crash).  
  
To fix, clamp the digit count to be not more than FLT_DIG.  
(In theory this loses some information about what the original  
input was, but it doesn't seem like useful information; it would  
not survive dump/restore in any case.)  
  
Also, in case there are stored values of the seg type containing  
bad data, add a clamp in seg_out's restore() subroutine.  
  
Per bug #17725 from Robins Tharakan.  It's been like this  
forever, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/seg/expected/seg.out
M contrib/seg/seg.c
M contrib/seg/segparse.y
M contrib/seg/sql/seg.sql

Introduce float4in_internal

commit   : 33dd895ef3316bd1896def6882e9075359d7e9af    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 21 Dec 2022 08:37:17 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 21 Dec 2022 08:37:17 -0500    

Click here for diff

This is the guts of float4in, callable as a routine to input floats,  
which will be useful in an upcoming patch for allowing soft errors in  
the seg module's input function.  
  
A similar operation was performed some years ago for float8in in  
commit 50861cd683e.  
  
Reviewed by Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/float.c
M src/include/utils/float.h

Fix newly introduced bug in slab.c

commit   : eb706fde8302c32267518663032905556db21f57    
  
author   : David Rowley <[email protected]>    
date     : Thu, 22 Dec 2022 09:57:49 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 22 Dec 2022 09:57:49 +1300    

Click here for diff

d21ded75f changed the way slab.c works but introduced a bug that meant we  
could end up with the slab's curBlocklistIndex pointing to the wrong list.  
The condition which was checking for this was failing to account for two  
things:  
  
1. The curBlocklistIndex could be 0 as we've currently got no non-full  
blocks to put chunks on.  In this case, the dlist_is_empty() check cannot  
be performed as there can be any number of completely full blocks at that  
index.  
  
2. The curBlocklistIndex may be greater than the index we just moved the  
block onto.  Since we need to ensure we fill up fuller blocks first, we  
must reset curBlocklistIndex when changing any blocklist element that's  
less than the curBlocklistIndex too.  
  
Reported-by: Takamichi Osumi  
Discussion: https://postgr.es/m/TYCPR01MB8373329C6329768D7E093D68EDEB9@TYCPR01MB8373.jpnprd01.prod.outlook.com  

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

commit   : f450695e8899fcaffd1da06b6ef1b7f39abcac89    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 21 Dec 2022 10:39:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 21 Dec 2022 10:39:06 +0900    

Click here for diff

This commit changes some of the bbstreamer files and pg_dump to use the  
same style as a few other places (like common/compression.c), where the  
name of the compression method is not part of the string, but an  
argument of it.  This reduces a bit the translation work with less  
string patterns.  
  
Discussion: https://postgr.es/m/Y5/[email protected]  

M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_dump/compress_io.c

Switch some system functions to use get_call_result_type()

commit   : 22e3b558052aa209cba2a8fec192d76b5faef19e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 21 Dec 2022 10:11:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 21 Dec 2022 10:11:22 +0900    

Click here for diff

This shaves some code by replacing the combinations of  
CreateTemplateTupleDesc()/TupleDescInitEntry() hardcoding a mapping of  
the attributes listed in pg_proc.dat by get_call_result_type() to build  
the TupleDesc needed for the rows generated.  
  
get_call_result_type() is more expensive than the former style, but this  
removes some duplication with the lists of OUT parameters (pg_proc.dat  
and the attributes hardcoded in these code paths).  This is applied to  
functions that are not considered as critical (aka that could be called  
repeatedly for monitoring purposes).  
  
Author: Bharath Rupireddy  
Reviewed-by: Robert Haas, Álvaro Herrera, Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACV23HW5HP5hFjd89FNS-z5X8r2jNXdMXcpN2BgTtKd87w@mail.gmail.com  

M contrib/old_snapshot/time_mapping.c
M contrib/pg_visibility/pg_visibility.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/sequence.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/misc/pg_controldata.c

Use existing SSL certs in LDAP tests instead of generating them

commit   : f03bd5717eaf31569ca797a2f7d65608f88ac2a2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 19 Dec 2022 05:58:08 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 19 Dec 2022 05:58:08 -0500    

Click here for diff

The SSL test suite has a bunch of pre-existing certificates, so it's  
better simply to use what we already have than generate new certificates  
each time the LDAP tests are run.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ldap/Makefile
M src/test/ldap/meson.build
M src/test/ldap/t/001_auth.pl
M src/test/ssl/README

commit   : 8284cf5f746f84303eda34d213e89c8439a83a42    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 20 Dec 2022 07:54:39 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 20 Dec 2022 07:54:39 -0500    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M contrib/adminpack/meson.build
M contrib/amcheck/meson.build
M contrib/auth_delay/meson.build
M contrib/auto_explain/meson.build
M contrib/basebackup_to_shell/meson.build
M contrib/basic_archive/meson.build
M contrib/bloom/meson.build
M contrib/bool_plperl/meson.build
M contrib/btree_gin/meson.build
M contrib/btree_gist/meson.build
M contrib/citext/meson.build
M contrib/cube/meson.build
M contrib/dblink/meson.build
M contrib/dict_int/meson.build
M contrib/dict_xsyn/meson.build
M contrib/earthdistance/meson.build
M contrib/file_fdw/meson.build
M contrib/fuzzystrmatch/meson.build
M contrib/hstore/meson.build
M contrib/hstore_plperl/meson.build
M contrib/hstore_plpython/meson.build
M contrib/intagg/meson.build
M contrib/intarray/meson.build
M contrib/isn/meson.build
M contrib/jsonb_plperl/meson.build
M contrib/jsonb_plpython/meson.build
M contrib/lo/meson.build
M contrib/ltree/meson.build
M contrib/ltree_plpython/meson.build
M contrib/meson.build
M contrib/oid2name/meson.build
M contrib/old_snapshot/meson.build
M contrib/pageinspect/meson.build
M contrib/passwordcheck/meson.build
M contrib/pg_buffercache/meson.build
M contrib/pg_freespacemap/meson.build
M contrib/pg_prewarm/meson.build
M contrib/pg_stat_statements/meson.build
M contrib/pg_surgery/meson.build
M contrib/pg_trgm/meson.build
M contrib/pg_visibility/meson.build
M contrib/pg_walinspect/meson.build
M contrib/pgcrypto/meson.build
M contrib/pgrowlocks/meson.build
M contrib/pgstattuple/meson.build
M contrib/postgres_fdw/meson.build
M contrib/seg/meson.build
M contrib/sepgsql/meson.build
M contrib/spi/meson.build
M contrib/sslinfo/meson.build
M contrib/tablefunc/meson.build
M contrib/tcn/meson.build
M contrib/test_decoding/meson.build
M contrib/tsm_system_rows/meson.build
M contrib/tsm_system_time/meson.build
M contrib/unaccent/meson.build
M contrib/uuid-ossp/meson.build
M contrib/vacuumlo/meson.build
M contrib/xml2/meson.build
M doc/src/sgml/meson.build
M meson.build
M meson_options.txt
M src/backend/access/brin/meson.build
M src/backend/access/common/meson.build
M src/backend/access/gin/meson.build
M src/backend/access/gist/meson.build
M src/backend/access/hash/meson.build
M src/backend/access/heap/meson.build
M src/backend/access/index/meson.build
M src/backend/access/meson.build
M src/backend/access/nbtree/meson.build
M src/backend/access/rmgrdesc/meson.build
M src/backend/access/spgist/meson.build
M src/backend/access/table/meson.build
M src/backend/access/tablesample/meson.build
M src/backend/access/transam/meson.build
M src/backend/backup/meson.build
M src/backend/bootstrap/meson.build
M src/backend/catalog/meson.build
M src/backend/commands/meson.build
M src/backend/executor/meson.build
M src/backend/foreign/meson.build
M src/backend/jit/llvm/meson.build
M src/backend/jit/meson.build
M src/backend/lib/meson.build
M src/backend/libpq/meson.build
M src/backend/main/meson.build
M src/backend/meson.build
M src/backend/nodes/meson.build
M src/backend/optimizer/geqo/meson.build
M src/backend/optimizer/meson.build
M src/backend/optimizer/path/meson.build
M src/backend/optimizer/plan/meson.build
M src/backend/optimizer/prep/meson.build
M src/backend/optimizer/util/meson.build
M src/backend/parser/meson.build
M src/backend/partitioning/meson.build
M src/backend/po/meson.build
M src/backend/port/meson.build
M src/backend/port/win32/meson.build
M src/backend/postmaster/meson.build
M src/backend/regex/meson.build
M src/backend/replication/libpqwalreceiver/meson.build
M src/backend/replication/logical/meson.build
M src/backend/replication/meson.build
M src/backend/replication/pgoutput/meson.build
M src/backend/rewrite/meson.build
M src/backend/snowball/meson.build
M src/backend/statistics/meson.build
M src/backend/storage/buffer/meson.build
M src/backend/storage/file/meson.build
M src/backend/storage/freespace/meson.build
M src/backend/storage/ipc/meson.build
M src/backend/storage/large_object/meson.build
M src/backend/storage/lmgr/meson.build
M src/backend/storage/meson.build
M src/backend/storage/page/meson.build
M src/backend/storage/smgr/meson.build
M src/backend/storage/sync/meson.build
M src/backend/tcop/meson.build
M src/backend/tsearch/meson.build
M src/backend/utils/activity/meson.build
M src/backend/utils/adt/meson.build
M src/backend/utils/cache/meson.build
M src/backend/utils/error/meson.build
M src/backend/utils/fmgr/meson.build
M src/backend/utils/hash/meson.build
M src/backend/utils/init/meson.build
M src/backend/utils/mb/conversion_procs/meson.build
M src/backend/utils/mb/meson.build
M src/backend/utils/meson.build
M src/backend/utils/misc/meson.build
M src/backend/utils/mmgr/meson.build
M src/backend/utils/resowner/meson.build
M src/backend/utils/sort/meson.build
M src/backend/utils/time/meson.build
M src/bin/initdb/meson.build
M src/bin/initdb/po/meson.build
M src/bin/meson.build
M src/bin/pg_amcheck/meson.build
M src/bin/pg_amcheck/po/meson.build
M src/bin/pg_archivecleanup/meson.build
M src/bin/pg_archivecleanup/po/meson.build
M src/bin/pg_basebackup/meson.build
M src/bin/pg_basebackup/po/meson.build
M src/bin/pg_checksums/meson.build
M src/bin/pg_checksums/po/meson.build
M src/bin/pg_config/meson.build
M src/bin/pg_config/po/meson.build
M src/bin/pg_controldata/meson.build
M src/bin/pg_controldata/po/meson.build
M src/bin/pg_ctl/meson.build
M src/bin/pg_ctl/po/meson.build
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/po/meson.build
M src/bin/pg_resetwal/meson.build
M src/bin/pg_resetwal/po/meson.build
M src/bin/pg_rewind/meson.build
M src/bin/pg_rewind/po/meson.build
M src/bin/pg_test_fsync/meson.build
M src/bin/pg_test_fsync/po/meson.build
M src/bin/pg_test_timing/meson.build
M src/bin/pg_test_timing/po/meson.build
M src/bin/pg_upgrade/meson.build
M src/bin/pg_upgrade/po/meson.build
M src/bin/pg_verifybackup/meson.build
M src/bin/pg_verifybackup/po/meson.build
M src/bin/pg_waldump/meson.build
M src/bin/pg_waldump/po/meson.build
M src/bin/pgbench/meson.build
M src/bin/pgevent/meson.build
M src/bin/psql/meson.build
M src/bin/psql/po/meson.build
M src/bin/scripts/meson.build
M src/bin/scripts/po/meson.build
M src/common/meson.build
M src/common/unicode/meson.build
M src/fe_utils/meson.build
M src/include/catalog/meson.build
M src/include/meson.build
M src/include/nodes/meson.build
M src/include/pch/meson.build
M src/include/storage/meson.build
M src/include/utils/meson.build
M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/ecpglib/po/meson.build
M src/interfaces/ecpg/include/meson.build
M src/interfaces/ecpg/meson.build
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/ecpg/preproc/meson.build
M src/interfaces/ecpg/preproc/po/meson.build
M src/interfaces/ecpg/test/compat_informix/meson.build
M src/interfaces/ecpg/test/compat_oracle/meson.build
M src/interfaces/ecpg/test/connect/meson.build
M src/interfaces/ecpg/test/meson.build
M src/interfaces/ecpg/test/pgtypeslib/meson.build
M src/interfaces/ecpg/test/preproc/meson.build
M src/interfaces/ecpg/test/sql/meson.build
M src/interfaces/ecpg/test/thread/meson.build
M src/interfaces/libpq/meson.build
M src/interfaces/libpq/po/meson.build
M src/interfaces/libpq/test/meson.build
M src/interfaces/meson.build
M src/makefiles/meson.build
M src/meson.build
M src/pl/meson.build
M src/pl/plperl/meson.build
M src/pl/plperl/po/meson.build
M src/pl/plpgsql/meson.build
M src/pl/plpgsql/src/meson.build
M src/pl/plpgsql/src/po/meson.build
M src/pl/plpython/meson.build
M src/pl/plpython/po/meson.build
M src/pl/tcl/meson.build
M src/pl/tcl/po/meson.build
M src/port/meson.build
M src/test/authentication/meson.build
M src/test/icu/meson.build
M src/test/isolation/meson.build
M src/test/kerberos/meson.build
M src/test/ldap/meson.build
M src/test/meson.build
M src/test/modules/brin/meson.build
M src/test/modules/commit_ts/meson.build
M src/test/modules/delay_execution/meson.build
M src/test/modules/dummy_index_am/meson.build
M src/test/modules/dummy_seclabel/meson.build
M src/test/modules/libpq_pipeline/meson.build
M src/test/modules/meson.build
M src/test/modules/plsample/meson.build
M src/test/modules/snapshot_too_old/meson.build
M src/test/modules/spgist_name_ops/meson.build
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/modules/test_bloomfilter/meson.build
M src/test/modules/test_copy_callbacks/meson.build
M src/test/modules/test_custom_rmgrs/meson.build
M src/test/modules/test_ddl_deparse/meson.build
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_ginpostinglist/meson.build
M src/test/modules/test_integerset/meson.build
M src/test/modules/test_lfind/meson.build
M src/test/modules/test_misc/meson.build
M src/test/modules/test_oat_hooks/meson.build
M src/test/modules/test_parser/meson.build
M src/test/modules/test_pg_db_role_setting/meson.build
M src/test/modules/test_pg_dump/meson.build
M src/test/modules/test_predtest/meson.build
M src/test/modules/test_rbtree/meson.build
M src/test/modules/test_regex/meson.build
M src/test/modules/test_rls_hooks/meson.build
M src/test/modules/test_shm_mq/meson.build
M src/test/modules/test_slru/meson.build
M src/test/modules/unsafe_tests/meson.build
M src/test/modules/worker_spi/meson.build
M src/test/perl/meson.build
M src/test/recovery/meson.build
M src/test/regress/meson.build
M src/test/ssl/meson.build
M src/test/subscription/meson.build
M src/timezone/meson.build
M src/timezone/tznames/meson.build

Allow batching of inserts during cross-partition updates.

commit   : 594f8d3776af4699c5c32443b9d6a486f44beabf    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 20 Dec 2022 19:05:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 20 Dec 2022 19:05:00 +0900    

Click here for diff

Commit 927f453a9 disallowed batching added by commit b663a4136 to be  
used for the inserts performed as part of cross-partition updates of  
partitioned tables, mainly because the previous code in  
nodeModifyTable.c couldn't handle pending inserts into foreign-table  
partitions that are also UPDATE target partitions.  But we don't have  
such a limitation anymore (cf. commit ffbb7e65a), so let's allow for  
this by removing from execPartition.c the restriction added by commit  
927f453a9 that batching is only allowed if the query command type is  
CMD_INSERT.  
  
In postgres_fdw, since commit 86dc90056 changed it to effectively  
disable cross-partition updates in the case where a foreign-table  
partition chosen to insert rows into is also an UPDATE target partition,  
allow batching in the case where a foreign-table partition chosen to  
do so is *not* also an UPDATE target partition.  This is enabled by the  
"batch_size" option added by commit b663a4136, which is disabled by  
default.  
  
This patch also adjusts the test case added by commit 927f453a9 to  
confirm that the inserts performed as part of a cross-partition update  
of a partitioned table indeed uses batching.  
  
Amit Langote, reviewed and/or tested by Georgios Kokolatos, Zhihong Yu,  
Bharath Rupireddy, Hou Zhijie, Vignesh C, and me.  
  
Discussion: http://postgr.es/m/CA%2BHiwqH1Lz1yJmPs%3DaD-pzd_HLLynLHvq5iYeT9mB0bBV7oJ6w%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/execPartition.c

Add enable_presorted_aggregate GUC

commit   : 3226f47282a05979483475d1e4a11aab8c1bfc39    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Dec 2022 22:28:58 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Dec 2022 22:28:58 +1300    

Click here for diff

1349d279 added query planner support to allow more efficient execution of  
aggregate functions which have an ORDER BY or a DISTINCT clause.  Prior to  
that commit, the planner would only request that the lower planner produce  
a plan with the order required for the GROUP BY clause and it would be  
left up to nodeAgg.c to perform the final sort of records within each  
group so that the aggregate transition functions were called in the  
correct order.  Now that the planner requests the lower planner produce a  
plan with the GROUP BY and the ORDER BY / DISTINCT aggregates in mind,  
there is the possibility that the planner chooses a plan which could be  
less efficient than what would have been produced before 1349d279.  
  
While developing 1349d279, I had in mind that Incremental Sort would help  
us in cases where an index exists only on the GROUP BY column(s).  
Incremental Sort would just replace the implicit tuplesorts which are  
being performed in nodeAgg.c.  However, because the planner has the  
flexibility to instead choose a plan which just performs a full sort on  
both the GROUP BY and ORDER BY / DISTINCT aggregate columns, there is  
potential for the planner to make a bad choice.  The costing for  
Incremental Sort is not perfect as it assumes an even distribution of rows  
to sort within each sort group.  
  
Here we add an escape hatch in the form of the enable_presorted_aggregate  
GUC.  This will allow users to get the pre-PG16 behavior in cases where  
they have no other means to convince the query planner to produce a plan  
which only sorts on the GROUP BY column(s).  
  
Discussion: https://postgr.es/m/CAApHDvr1Sm+g9hbv4REOVuvQKeDWXcKUAhmbK5K+dfun0s9CvA@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/optimizer/cost.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/aggregates.sql

Improve the performance of the slab memory allocator

commit   : d21ded75fdbc18d68be6e6c172f0f842c50e9263    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Dec 2022 21:48:51 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Dec 2022 21:48:51 +1300    

Click here for diff

Slab has traditionally been fairly slow when compared with the AllocSet or  
Generation memory allocators.  Part of this slowness came from having to  
write out an entire block when we allocate a new block in order to  
populate the free list indexes within the block's memory.  Additional  
slowness came from having to move a block onto another dlist each time we  
palloc or pfree a chunk from it.  
  
Here we optimize both of those cases and do a little bit extra to improve  
the performance of the slab allocator.  
  
Here, instead of writing out the free list indexes when allocating a new  
block, we introduce the concept of "unused" chunks.  When a block is first  
allocated all chunks are unused.  These chunks only make it onto the  
free list when they are pfree'd.  When allocating new chunks on an  
existing block, we have the choice of consuming a chunk from the free list  
or an unused chunk.  When both exist, we opt to use one from the free  
list, as these have been used already and the memory of them is more  
likely to be cached by the CPU.  
  
Here we also reduce the number of block lists from there being one for  
every possible value of free chunks on a block to just having a small  
fixed number of block lists.  We keep the 0th block list for completely  
full blocks and anything else stores blocks for some range of free chunks  
with fuller blocks appearing on lower block list array elements.  This  
reduces how often we must move a block to another list when we allocate or  
free chunks, but still allows us to prefer to put new chunks on fuller  
blocks and perhaps allow blocks with fewer chunks to be free'd later  
once all their remaining chunks have been pfree'd.  
  
Additionally, we now store a list of "emptyblocks", which are blocks that  
no longer contain any allocated chunks.  We now keep up to 10 of these  
around to avoid having to thrash malloc/free when allocation patterns  
continually cause blocks to become free of any allocated chunks only to  
allocate more chunks again.  Now only once we have 10 of these, we free  
the block.  This does raise the high water mark for the total memory that  
a slab context can consume.  It does not seem entirely unreasonable that  
we might one day want to make this a property of SlabContext rather than a  
compile-time constant.  Let's wait and see if there is any evidence to  
support that this is required before doing it.  
  
Author: Andres Freund, David Rowley  
Tested-by: Tomas Vondra, John Naylor  
Discussion: https://postgr.es/m/[email protected]  

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

Move variable increment to the end of the loop

commit   : 995a9fb14f6aa81ad8eedaf4e8dce1b3e51105c0    
  
author   : John Naylor <[email protected]>    
date     : Tue, 20 Dec 2022 14:13:14 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 20 Dec 2022 14:13:14 +0700    

Click here for diff

This is less error prone and matches the placement of other code  
in the file.  
  
Justin Pryzby  
  
Reviewed by Tom Lane  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/utils/activity/backend_status.c

Add pg_dissect_walfile_name()

commit   : cca186348929cd75f23ef1b25922386bf38cf99c    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Dec 2022 13:36:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Dec 2022 13:36:27 +0900    

Click here for diff

This function takes in input a WAL segment name and returns a tuple made  
of the segment sequence number (dependent on the WAL segment size of the  
cluster) and its timeline, as of a thin SQL wrapper around the existing  
XLogFromFileName().  
  
This function has multiple usages, like being able to compile a LSN from  
a file name and an offset, or finding the timeline of a segment without  
having to do to some maths based on the first eight characters of the  
segment.  
  
Bump catalog version.  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart, Kyotaro Horiguchi, Maxim Orlov, Michael  
Paquier  
Discussion: https://postgr.es/m/CALj2ACWV=FCddsxcGbVOA=cvPyMr75YCFbSQT6g4KDj=gcJK4g@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/access/transam/xlogfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Remove hardcoded dependency to cryptohash type in the internals of SCRAM

commit   : b3bb7d12af97f035c3aa3ad8dd41b44d01e2defa    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Dec 2022 08:53:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Dec 2022 08:53:22 +0900    

Click here for diff

SCRAM_KEY_LEN was a variable used in the internal routines of SCRAM to  
size a set of fixed-sized arrays used in the SHA and HMAC computations  
during the SASL exchange or when building a SCRAM password.  This had a  
hard dependency on SHA-256, reducing the flexibility of SCRAM when it  
comes to the addition of more hash methods.  A second issue was that  
SHA-256 is assumed as the cryptohash method to use all the time.  
  
This commit renames SCRAM_KEY_LEN to a more generic SCRAM_KEY_MAX_LEN,  
which is used as the size of the buffers used by the internal routines  
of SCRAM.  This is aimed at tracking centrally the maximum size  
necessary for all the hash methods supported by SCRAM.  A global  
variable has the advantage of keeping the code in its simplest form,  
reducing the need of more alloc/free logic for all the buffers used in  
the hash calculations.  
  
A second change is that the key length (SHA digest length) and hash  
types are now tracked by the state data in the backend and the frontend,  
the common portions being extended to handle these as arguments by the  
internal routines of SCRAM.  There are a few RFC proposals floating  
around to extend the SCRAM protocol, including some to use stronger  
cryptohash algorithms, so this lifts some of the existing restrictions  
in the code.  
  
The code in charge of parsing and building SCRAM secrets is extended to  
rely on the key length and on the cryptohash type used for the exchange,  
assuming currently that only SHA-256 is supported for the moment.  Note  
that the mock authentication simply enforces SHA-256.  
  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut, Jonathan Katz  
Discussion: https://postgr.es/m/Y5k3Qiweo/[email protected]  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/crypt.c
M src/common/scram-common.c
M src/include/common/scram-common.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c

Fix comment that was missing a word.

commit   : eb60eb08a95eb531f3f2a459c1b623c5ac37ecd3    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2022 15:56:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2022 15:56:17 -0500    

Click here for diff

Ted Yu  
  
Discussion: http://postgr.es/m/CALte62wkFB05=RTWf7BL_6MfWs2=DY=ai-K7LWn_+0TJUuPJ2w@mail.gmail.com  

M src/include/utils/backend_status.h

Fix typo in comment

commit   : af6284a666742d6932bae2e93f9eef156274a92e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Dec 2022 21:08:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Dec 2022 21:08:28 +0100    

Click here for diff

Author: Ted Yu <[email protected]>  

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

Expose some information about backend subxact status.

commit   : 10ea0f924a2788f9e701d6213745aaa5ca3efb8a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2022 14:43:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Dec 2022 14:43:09 -0500    

Click here for diff

A new function pg_stat_get_backend_subxact() can be used to get  
information about the number of subtransactions in the cache of  
a particular backend and whether that cache has overflowed. This  
can be useful for tracking down performance problems that can  
result from overflowed snapshots.  
  
Dilip Kumar, reviewed by Zhihong Yu, Nikolay Samokhvalov,  
Justin Pryzby, Nathan Bossart, Ashutosh Sharma, Julien  
Rouhaud. Additional design comments from Andres Freund,  
Tom Lane, Bruce Momjian, and David G. Johnston.  
  
Discussion: http://postgr.es/m/CAFiTN-ut0uwkRJDQJeDPXpVyTWD46m3gt3JDToE02hTfONEN=Q@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/ipc/sinvaladt.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/storage/sinvaladt.h
M src/include/utils/backend_status.h

Fix bit-rotted planner test case.

commit   : 7122f9d5437789312cb0a7e26e853bb8d2e57add    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Dec 2022 18:51:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Dec 2022 18:51:24 -0500    

Click here for diff

While fooling with my pet outer-join-variables patch, I discovered  
that the test case I added in commit 11086f2f2 no longer demonstrates  
what it's supposed to.  The idea is to tempt the planner to reverse  
the order of the two outer joins, which would leave noplace to  
correctly evaluate the WHERE clause that's inserted between them.  
Before the addition of the delay_upper_joins mechanism, it would  
have taken the bait.  
  
However, subsequent improvements broke the test in two different ways.  
First, we now recognize the IS NULL coding pattern as an antijoin, and  
we won't re-order antijoins; even if we did, the IS NULL test clauses  
get removed so there would be no opportunity for them to misbehave.  
Second, the planner now discovers that nested parameterized indexscans  
are a lot cheaper than the double hash join it used back in the day,  
and that approach doesn't want to re-order the joins anyway.  Thus,  
in HEAD the test passes even if one dikes out delay_upper_joins.  
  
To fix, change the IS NULL tests to COALESCE clauses, which produce  
the same results but the planner isn't smart enough to convert them  
to antijoins.  It'll still go for parameterized indexscans though,  
so drop the index enabling that (don't know why I added that in the  
first place), and disable nestloop joining just to be sure.  
  
This time around, add an EXPLAIN to make the choice of plan visible.  

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

Doc: update pg_list.h header comments to include XidLists.

commit   : 0efecb5518c914a45d9f294adebc2948f5882f2e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Dec 2022 10:31:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Dec 2022 10:31:25 -0500    

Click here for diff

I realize that the XidList infrastructure is rather incomplete,  
but failing to mention it in adjacent comments takes that a bit  
too far.  

M src/include/nodes/pg_list.h

Fix inability to reference CYCLE column from inside its CTE.

commit   : 935277b24172979e8244a5399906c358e4176b49    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Dec 2022 13:07:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Dec 2022 13:07:42 -0500    

Click here for diff

Such references failed with "cache lookup failed for type 0"  
because we didn't resolve the type of the CYCLE column until after  
analyzing the CTE's query.  We can just move that processing  
to before the recursive parse_sub_analyze call, though.  
  
While here, invent a couple of local variables to make this  
code less egregiously wider-than-80-columns.  
  
Per bug #17723 from Vik Fearing.  Back-patch to v14 where  
the CYCLE feature was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_cte.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

pg_upgrade: Make testing different transfer modes easier

commit   : b059a2409faf5833b3ba7792e247d6466c9e8090    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Dec 2022 17:49:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Dec 2022 17:49:59 +0100    

Click here for diff

The environment variable PG_TEST_PG_UPGRADE_MODE can be set to  
override the default transfer mode for the pg_upgrade tests.  
(Automatically running the pg_upgrade tests for all supported modes  
would be too slow.)  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/50a97009-8ff9-ca4d-a0f6-6086a6775a5b%40enterprisedb.com  

M src/bin/pg_upgrade/TESTING
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

pg_upgrade: Add --copy option

commit   : 746915c6866953506379e996ce5198bc9e9e5b94    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Dec 2022 17:49:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Dec 2022 17:49:59 +0100    

Click here for diff

This option selects the default transfer mode.  Having an explicit  
option is handy to make scripts and tests more explicit.  It also  
makes it easier to talk about a "copy" mode rather than "the default  
mode" or something like that, since until now the default mode didn't  
have an externally visible name.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/50a97009-8ff9-ca4d-a0f6-6086a6775a5b%40enterprisedb.com  

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/option.c

C comment: fix wording

commit   : 59346209a839dfc627dd7986af3a6a8349c7ea0f    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 16 Dec 2022 12:15:54 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 16 Dec 2022 12:15:54 -0500    

Click here for diff

Backpatch-through: master  

M contrib/postgres_fdw/postgres_fdw.c

Clean up dubious error handling in wellformed_xml().

commit   : c4939f121563f300b98b30837151753fc8255554    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Dec 2022 11:10:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Dec 2022 11:10:36 -0500    

Click here for diff

This ancient bit of code was summarily trapping any ereport longjmp  
whatsoever and assuming that it must represent an invalid-XML report.  
It's not really appropriate to handle OOM-like situations that way:  
maybe the input is valid or maybe not, but we couldn't find out.  
And it'd be a seriously bad idea to ignore, say, a query cancel  
error that way.  (Perhaps that can't happen because there is no  
CHECK_FOR_INTERRUPTS anywhere within xml_parse, but even if that's  
true today it's obviously a very fragile assumption.)  
  
But in the wake of the previous commit, we can drop the PG_TRY  
here altogether, and use the soft error mechanism to catch only  
the kinds of errors that are legitimate to treat as invalid-XML.  
  
(This is our first use of the soft error mechanism for something  
not directly related to a datatype input function.  It won't be  
the last.)  
  
xml_is_document can be converted in the same way.  That one is  
not actively broken, because it was checking specifically for  
ERRCODE_INVALID_XML_DOCUMENT rather than trapping everything;  
but the code is still shorter and probably faster this way.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Convert xml_in to report errors softly.

commit   : 37bef842f5530fc9f4a48daba9f4709ee5e36c9b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Dec 2022 10:58:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Dec 2022 10:58:49 -0500    

Click here for diff

The key idea here is that xml_parse must distinguish hard errors  
from soft errors.  We want to throw a hard error for libxml  
initialization failures: those might be out-of-memory, or something  
else, but in any case they are not the fault of the input string.  
If we get to the point of parsing the input, and something goes  
wrong, we can fairly consider that to mean bad input.  
  
One thing that arguably does mean bad input, but I didn't trouble  
to handle softly, is encoding conversion failure while converting  
the server encoding to UTF8.  This might be something to improve  
later, but it seems like a pretty low-probability scenario.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/xml.c
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Fix typo in reference to __FreeBSD__.

commit   : e52f8b301ed54aac5162b185b43f5f1e44b6b17e    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 16 Dec 2022 17:36:22 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 16 Dec 2022 17:36:22 +1300    

Click here for diff

Commit a2a8acd152 introduced a platform-dependent mechanism to prevent  
developers from referencing errno in the argument list of  
elog()/ereport(), but didn't use the right macro to detect FreeBSD, so  
it didn't actually work there.  
  
Reported-by: Japin Li <[email protected]>  
Discussion: https://postgr.es/m/MEYP282MB16693AAEEF84F47D8F7CA007B6E69%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/include/utils/elog.h

Remove pessimistic cost penalization from Incremental Sort

commit   : 4a29eabd1d91c5484426bc5836e0a7143b064f5a    
  
author   : David Rowley <[email protected]>    
date     : Fri, 16 Dec 2022 15:22:23 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 16 Dec 2022 15:22:23 +1300    

Click here for diff

When incremental sorts were added in v13 a 1.5x pessimism factor was added  
to the cost modal.  Seemingly this was done because the cost modal only  
has an estimate of the total number of input rows and the number of  
presorted groups.  It assumes that the input rows will be evenly  
distributed throughout the presorted groups.  The 1.5x pessimism factor  
was added to slightly reduce the likelihood of incremental sorts being  
used in the hope to avoid performance regressions where an incremental  
sort plan was picked and turned out slower due to a large skew in the  
number of rows in the presorted groups.  
  
An additional quirk with the path generation code meant that we could  
consider both a sort and an incremental sort on paths with presorted keys.  
This meant that with the pessimism factor, it was possible that we opted  
to perform a sort rather than an incremental sort when the given path had  
presorted keys.  
  
Here we remove the 1.5x pessimism factor to allow incremental sorts to  
have a fairer chance at being chosen against a full sort.  
  
Previously we would generally create a sort path on the cheapest input  
path (if that wasn't sorted already) and incremental sort paths on any  
path which had presorted keys.  This meant that if the cheapest input path  
wasn't completely sorted but happened to have presorted keys, we would  
create a full sort path *and* an incremental sort path on that input path.  
Here we change this logic so that if there are presorted keys, we only  
create an incremental sort path, and create sort paths only when a full  
sort is required.  
  
Both the removal of the cost pessimism factor and the changes made to the  
path generation make it more likely that incremental sorts will now be  
chosen.  That, of course, as with teaching the planner any new tricks,  
means an increased likelihood that the planner will perform an incremental  
sort when it's not the best method.  Our standard escape hatch for these  
cases is an enable_* GUC.  enable_incremental_sort already exists for  
this.  
  
This came out of a report by Pavel Luzanov where he mentioned that the  
master branch was choosing to perform a Seq Scan -> Sort -> Group  
Aggregate for his query with an ORDER BY aggregate function.  The v15 plan  
for his query performed an Index Scan -> Group Aggregate, of course, the  
aggregate performed the final sort internally in nodeAgg.c for the  
aggregate's ORDER BY.  The ideal plan would have been to use the index,  
which provided partially sorted input then use an incremental sort to  
provide the aggregate with the sorted input.  This was not being chosen  
due to the pessimism in the incremental sort cost modal, so here we remove  
that and rationalize the path generation so that sort and incremental sort  
plans don't have to needlessly compete.  We assume that it's senseless  
to ever use a full sort on a given input path where an incremental sort  
can be performed.  
  
Reported-by: Pavel Luzanov  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/9f61ddbf-2989-1536-b31e-6459370a6baa%40postgrespro.ru  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/incremental_sort.sql

Re-adjust drop-index-concurrently-1 isolation test

commit   : 8b6b043ceef29a0a7a462b748da398511832efcf    
  
author   : David Rowley <[email protected]>    
date     : Fri, 16 Dec 2022 11:39:40 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 16 Dec 2022 11:39:40 +1300    

Click here for diff

It seems that drop-index-concurrently-1 has started to forget what it was  
originally meant to be testing.  d2d8a229b, which added incremental sorts  
changed the expected plan to be an Index Scan plan instead of a Seq Scan  
plan.  This occurred as the primary key index of the table in question  
provided presorted input and, because that index happened to be the  
cheapest input path due to enable_seqscan being disabled, the incremental  
sort changes just added a Sort on top of that.  It seems based on the name  
of the PREPAREd statement that the intention here is that the query  
produces a seqscan plan.  
  
The reason this test has become broken seems to be due to how the test was  
originally coded.  The test was trying to force a seqscan plan by  
performing some casting to make it so the test_dc index couldn't be used  
to perform the required filtering.  Trying to coax the planner into using  
a plan which has costed in a disable_cost seems like it's always going to  
be flakey as small changes in costs are drowned out by the large  
disable_cost combined with add_path's STD_FUZZ_FACTOR.  Here we get rid of  
the casts that we're using to try to trick the planner into a seqscan and  
instead toggle enable_seqscan as and when required to get the desired  
plan.  
  
Additionally, rename a few things in the test and add some additional  
wording to the comments to try and make it more clear in the future what  
we expect this test to be doing.  
  
Discussion: https://postgr.es/m/CAApHDvrbDhObhLV+=U_K_-t+2Av2av1aL9d+2j_3AO-XndaviA@mail.gmail.com  
Backpatch-through: 13, where d2d8a229b changed the expected test output  

M src/test/isolation/expected/drop-index-concurrently-1.out
M src/test/isolation/expected/drop-index-concurrently-1_2.out
M src/test/isolation/specs/drop-index-concurrently-1.spec

Speed up creation of command completion tags

commit   : ac998020802b742303979a13692afa7b2084d0e9    
  
author   : David Rowley <[email protected]>    
date     : Fri, 16 Dec 2022 10:31:25 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 16 Dec 2022 10:31:25 +1300    

Click here for diff

The building of command completion tags could often be seen showing up in  
profiles when running high tps workloads.  
  
The query completion tags were being built with snprintf, which is slow at  
the best of times when compared with more manual ways of formatting  
strings.  Here we introduce BuildQueryCompletionString() to do this job  
for us.  We also now store the completion tag's strlen in the  
CommandTagBehavior struct so that we can quickly memcpy this number of  
bytes into the completion tag string.  Appending the rows affected is done  
via pg_ulltoa_n.  BuildQueryCompletionString returns the length of the  
built string.  This saves us having to call strlen to figure out how many  
bytes to pass to pq_putmessage().  
  
Author: David Rowley, Andres Freund  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CAHoyFK-Xwqc-iY52shj0G+8K9FJpse+FuZ36XBKy78wDVnd=Qg@mail.gmail.com  

M src/backend/tcop/cmdtag.c
M src/backend/tcop/dest.c
M src/include/tcop/cmdtag.h
M src/include/tcop/dest.h

Convert range_in and multirange_in to report errors softly.

commit   : d35a1af468162f510b6139bf81a7a41fd8ba8500    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Dec 2022 12:18:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Dec 2022 12:18:36 -0500    

Click here for diff

This is mostly straightforward, except that if the range type  
has a canonical function, that might throw an error during range  
input.  (Such errors probably only occur for edge cases: in the  
in-core canonical functions, it happens only if a bound has the  
maximum valid value for the underlying type.)  Hence, this patch  
extends the soft-error regime to allow canonical functions to  
return errors softly as well.  Extensions implementing range  
canonical functions will need modification anyway because of the  
API change for range_serialize(); while at it, they might want  
to do something similar to what's been done here in the in-core  
canonical functions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/include/utils/rangetypes.h
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/multirangetypes.sql
M src/test/regress/sql/rangetypes.sql

Static assertions cleanup

commit   : 75f49221c22286104f032827359783aa5f4e6646    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Dec 2022 14:30:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Dec 2022 14:30:01 +0100    

Click here for diff

Because we added StaticAssertStmt() first before StaticAssertDecl(),  
some uses as well as the instructions in c.h are now a bit backwards  
from the "native" way static assertions are meant to be used in C.  
This updates the guidance and moves some static assertions to better  
places.  
  
Specifically, since the addition of StaticAssertDecl(), we can put  
static assertions at the file level.  This moves a number of static  
assertions out of function bodies, where they might have been stuck  
out of necessity, to perhaps better places at the file level or in  
header files.  
  
Also, when the static assertion appears in a position where a  
declaration is allowed, then using StaticAssertDecl() is more native  
than StaticAssertStmt().  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/941a04e7-dd6f-c0e4-8cdf-a33b3338cbda%40enterprisedb.com  

M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/xlog.c
M src/backend/backup/basebackup.c
M src/backend/catalog/dependency.c
M src/backend/executor/execExprInterp.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/hba.c
M src/backend/port/atomics.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/page/itemptr.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/slab.c
M src/common/checksum_helper.c
M src/common/controldata_utils.c
M src/common/encnames.c
M src/include/access/gin.h
M src/include/access/htup_details.h
M src/include/access/nbtree.h
M src/include/c.h
M src/include/catalog/pg_control.h
M src/include/common/int128.h
M src/include/storage/lwlock.h

Move provariadic sanity check to a more appropriate place

commit   : 2613dec4ed67c4a963d987cbd29284e0634b65c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Dec 2022 07:49:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Dec 2022 07:49:30 +0100    

Click here for diff

35f059e9bdfb3b14ac9d22a9e159d36ec0ccf804 put the provariadic sanity  
check into type_sanity.sql, even though it's not about types, and  
moreover in the middle of some connected test group, which makes it  
all very confusing.  Move it to opr_sanity.sql, where it is in better  
company.  

M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/opr_sanity.sql
M src/test/regress/sql/type_sanity.sql

Convert a few more datatype input functions to report errors softly.

commit   : 3b9d2deb67a0d5ee681561fc0e07c2dca4e26e96    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 19:42:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 19:42:05 -0500    

Click here for diff

Convert the remaining string-category input functions  
(bpcharin, varcharin, byteain) to the new style.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/encode.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/include/utils/builtins.h
M src/test/regress/expected/char.out
M src/test/regress/expected/char_1.out
M src/test/regress/expected/char_2.out
M src/test/regress/expected/strings.out
M src/test/regress/expected/varchar.out
M src/test/regress/expected/varchar_1.out
M src/test/regress/expected/varchar_2.out
M src/test/regress/sql/char.sql
M src/test/regress/sql/strings.sql
M src/test/regress/sql/varchar.sql

Convert a few more datatype input functions to report errors softly.

commit   : 90161dad4dd719f44255474f4471af916f2a28f0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 18:03:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 18:03:11 -0500    

Click here for diff

Convert cash_in and uuid_in to the new style.  
  
Amul Sul, minor mods by me  
  
Discussion: https://postgr.es/m/CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com  

M src/backend/utils/adt/cash.c
M src/backend/utils/adt/uuid.c
M src/test/regress/expected/money.out
M src/test/regress/expected/uuid.out
M src/test/regress/sql/money.sql
M src/test/regress/sql/uuid.sql

Convert a few more datatype input functions to report errors softly.

commit   : 47f3f97fcdee28e3eb70cd2ebfd7b4899570b018    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 17:50:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 17:50:24 -0500    

Click here for diff

Convert assorted internal-ish datatypes, namely aclitemin,  
int2vectorin, oidin, oidvectorin, pg_lsn_in, pg_snapshot_in,  
and tidin to the new style.  
  
(Some others you might expect to find in this group, such as  
cidin and xidin, need no changes because they never throw  
errors at all.  That seems a little cheesy ... but it is not in  
the charter of this patch series to add new error conditions.)  
  
Amul Sul, minor mods by me  
  
Discussion: https://postgr.es/m/CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com  

M src/backend/utils/adt/acl.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/xid8funcs.c
M src/test/regress/expected/int2.out
M src/test/regress/expected/oid.out
M src/test/regress/expected/pg_lsn.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/tid.out
M src/test/regress/expected/xid.out
M src/test/regress/sql/int2.sql
M src/test/regress/sql/oid.sql
M src/test/regress/sql/pg_lsn.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/tid.sql
M src/test/regress/sql/xid.sql

Convert the geometric input functions to report errors softly.

commit   : 332741e73980401895e027eb697bb472860036fb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 16:10:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 16:10:20 -0500    

Click here for diff

Convert box_in, circle_in, line_in, lseg_in, path_in, point_in,  
and poly_in to the new style.  
  
line_in still throws hard errors for overflows/underflows that can occur  
when the input is specified as two points rather than in the canonical  
"Ax + By + C = 0" style.  I'm not too concerned about that: it won't be  
reached in normal dump/restore cases, and it's fairly debatable that  
such conversion should ever have been made part of a type input function  
in the first place.  But in any case, I don't want to extend the soft  
error conventions into float.h without more discussion than this patch  
has had.  
  
Amul Sul, minor mods by me  
  
Discussion: https://postgr.es/m/CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com  

M src/backend/utils/adt/geo_ops.c
M src/test/regress/expected/box.out
M src/test/regress/expected/geometry.out
M src/test/regress/expected/line.out
M src/test/regress/expected/lseg.out
M src/test/regress/expected/path.out
M src/test/regress/expected/point.out
M src/test/regress/expected/polygon.out
M src/test/regress/sql/box.sql
M src/test/regress/sql/geometry.sql
M src/test/regress/sql/line.sql
M src/test/regress/sql/lseg.sql
M src/test/regress/sql/path.sql
M src/test/regress/sql/point.sql
M src/test/regress/sql/polygon.sql

Convert a few more datatype input functions to report errors softly.

commit   : 17407a8eaa2afa8ac0de4b0a494f33d8eb7a98bd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 13:22:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Dec 2022 13:22:08 -0500    

Click here for diff

Convert bit_in, varbit_in, inet_in, cidr_in, macaddr_in, and  
macaddr8_in to the new style.  
  
Amul Sul, minor mods by me  
  
Discussion: https://postgr.es/m/CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com  

M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/varbit.c
M src/test/regress/expected/bit.out
M src/test/regress/expected/inet.out
M src/test/regress/expected/macaddr.out
M src/test/regress/expected/macaddr8.out
M src/test/regress/sql/bit.sql
M src/test/regress/sql/inet.sql
M src/test/regress/sql/macaddr.sql
M src/test/regress/sql/macaddr8.sql

Rearrange some static assertions for consistency

commit   : b18c2decd76eeffbd483c041c02bb0fb01b0f124    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Dec 2022 16:08:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Dec 2022 16:08:13 +0100    

Click here for diff

Put lengthof first.  
  
Reported-by: Peter Smith <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAHut+PsUDMySVRuRc=h+P5N3+=TGvj4W_mi32XXg9dt4o-BXbA@mail.gmail.com  

M src/backend/executor/execExprInterp.c
M src/backend/utils/cache/syscache.c

Non-decimal integer literals

commit   : 6fcda9aba83449082124825b6d375c0a61e21c42    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Dec 2022 05:40:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Dec 2022 05:40:38 +0100    

Click here for diff

Add support for hexadecimal, octal, and binary integer literals:  
  
    0x42F  
    0o273  
    0b100101  
  
per SQL:202x draft.  
  
This adds support in the lexer as well as in the integer type input  
functions.  
  
Reviewed-by: John Naylor <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Reviewed-by: David Rowley <[email protected]>  
Reviewed-by: Dean Rasheed <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/syntax.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/sql_features.txt
M src/backend/parser/parse_node.c
M src/backend/parser/scan.l
M src/backend/utils/adt/numutils.c
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/test/regress/expected/int2.out
M src/test/regress/expected/int4.out
M src/test/regress/expected/int8.out
M src/test/regress/expected/numerology.out
M src/test/regress/sql/int2.sql
M src/test/regress/sql/int4.sql
M src/test/regress/sql/int8.sql
M src/test/regress/sql/numerology.sql

Add grantable MAINTAIN privilege and pg_maintain role.

commit   : 60684dd834a222fefedd49b19d1f0a6189c1632e    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 13 Dec 2022 17:33:28 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 13 Dec 2022 17:33:28 -0800    

Click here for diff

Allows VACUUM, ANALYZE, REINDEX, REFRESH MATERIALIZED VIEW, CLUSTER,  
and LOCK TABLE.  
  
Effectively reverts 4441fc704d. Instead of creating separate  
privileges for VACUUM, ANALYZE, and other maintenance commands, group  
them together under a single MAINTAIN privilege.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/20221212210136.GA449764@nathanxps13  
Discussion: https://postgr.es/m/[email protected]  

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/parser/gram.y
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/nodes/parsenodes.h
M src/include/utils/acl.h
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/expected/vacuum.out
M src/test/regress/sql/dependency.sql
M src/test/regress/sql/privileges.sql

Remove SHA256_HMAC_B from scram-common.h

commit   : c6f6646bb0bef315c3836f3f6909c24a985a8621    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Dec 2022 09:51:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Dec 2022 09:51:19 +0900    

Click here for diff

This referred to the size of the buffers for k_ipad and k_opad in HMAC  
computations.  This is unused since e6bdfd9, where SCRAM has switched to  
the cryptohash routines for its HMAC calculations rather than its own  
maths.  
  
Reviewed-by: Jacob Champion  
Discussion: https://postgr.es/m/[email protected]  

M src/include/common/scram-common.h

Rethink handling of [Prevent|Is]InTransactionBlock in pipeline mode.

commit   : 20432f8731404d2cef2a155144aca5ab3ae98e95    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Dec 2022 14:23:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Dec 2022 14:23:58 -0500    

Click here for diff

Commits f92944137 et al. made IsInTransactionBlock() set the  
XACT_FLAGS_NEEDIMMEDIATECOMMIT flag before returning "false",  
on the grounds that that kept its API promises equivalent to those of  
PreventInTransactionBlock().  This turns out to be a bad idea though,  
because it allows an ANALYZE in a pipelined series of commands to  
cause an immediate commit, which is unexpected.  
  
Furthermore, if we return "false" then we have another issue,  
which is that ANALYZE will decide it's allowed to do internal  
commit-and-start-transaction sequences, thus possibly unexpectedly  
committing the effects of previous commands in the pipeline.  
  
To fix the latter situation, invent another transaction state flag  
XACT_FLAGS_PIPELINING, which explicitly records the fact that we  
have executed some extended-protocol command and not yet seen a  
commit for it.  Then, require that flag to not be set before allowing  
InTransactionBlock() to return "false".  
  
Having done that, we can remove its setting of NEEDIMMEDIATECOMMIT  
without fear of causing problems.  This means that the API guarantees  
of IsInTransactionBlock now diverge from PreventInTransactionBlock,  
which is mildly annoying, but it seems OK given the very limited usage  
of IsInTransactionBlock.  (In any case, a caller preferring the old  
behavior could always set NEEDIMMEDIATECOMMIT for itself.)  
  
For consistency also require XACT_FLAGS_PIPELINING to not be set  
in PreventInTransactionBlock.  This too is meant to prevent commands  
such as CREATE DATABASE from silently committing previous commands  
in a pipeline.  
  
Per report from Peter Eisentraut.  As before, back-patch to all  
supported branches (which sadly no longer includes v10).  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M src/backend/access/transam/xact.c
M src/backend/tcop/postgres.c
M src/include/access/xact.h

basebackup_to_shell: Add some const qualifiers for consistency

commit   : 4cb65e10722164fd12c6b8d010a39ce0f92e71f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Dec 2022 10:39:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Dec 2022 10:39:44 +0100    

Click here for diff

M contrib/basebackup_to_shell/basebackup_to_shell.c

Refactor ExecGrant_*() functions

commit   : 369f09e420efe27359b06b69c0265f4aec5c2134    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Dec 2022 07:43:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Dec 2022 07:43:42 +0100    

Click here for diff

Instead of half a dozen of mostly-duplicate ExecGrant_Foo() functions,  
write one common function ExecGrant_generic() that can handle most of  
them.  We already have all the information we need, such as which  
system catalog corresponds to which catalog table and which column is  
the ACL column.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Antonin Houska <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/22c7e802-4e7d-8d87-8b71-cba95e6f4bcf%40enterprisedb.com  

M src/backend/catalog/aclchk.c

Fix jsonb subscripting to cope with toasted subscript values.

commit   : b0feda79fdf02710a6039a324299525845a4a9d4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2022 16:17:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Dec 2022 16:17:49 -0500    

Click here for diff

jsonb_get_element() was incautious enough to use VARDATA() and  
VARSIZE() directly on an arbitrary text Datum.  That of course  
fails if the Datum is short-header, compressed, or out-of-line.  
The typical result would be failing to match any element of a  
jsonb object, though matching the wrong one seems possible as well.  
  
setPathObject() was slightly brighter, in that it used VARDATA_ANY  
and VARSIZE_ANY_EXHDR, but that only kept it out of trouble for  
short-header Datums.  push_path() had the same issue.  This could  
result in faulty subscripted insertions, though keys long enough to  
cause a problem are likely rare in the wild.  
  
Having seen these, I looked around for unsafe usages in the rest  
of the adt/json* files.  There are a couple of places where it's not  
immediately obvious that the Datum can't be compressed or out-of-line,  
so I added pg_detoast_datum_packed() to cope if it is.  Also, remove  
some other usages of VARDATA/VARSIZE on Datums we just extracted from  
a text array.  Those aren't actively broken, but they will become so  
if we ever start allowing short-header array elements, which does not  
seem like a terribly unreasonable thing to do.  In any case they are  
not great coding examples, and they could also do with comments  
pointing out that we're assuming we don't need pg_detoast_datum_packed.  
  
Per report from [email protected].  Patch by me, but thanks to  
David Johnston for initial investigation.  Back-patch to v14 where  
jsonb subscripting was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

Disable clang 16's -Wcast-function-type-strict.

commit   : 101c37cd342a3ae134bb3e5e0abb14ae46692b56    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 13 Dec 2022 10:03:28 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 13 Dec 2022 10:03:28 +1300    

Click here for diff

Clang 16 is still in development, but seawasp reveals that it has  
started warning about many of our casts of function pointers (those  
introduced by commit 1c27d16e, and some older ones).  Disable the new  
warning for now, since otherwise buildfarm animal seawasp fails, and we  
have no current plans to change our strategy for these callback function  
types.  
  
May be back-patched with other Clang/LLVM 16 changes around release  
time.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJvX%2BL3aMN84ksT-cGy08VHErRNip3nV-WmTx7f6Pqhyw%40mail.gmail.com  

M configure
M configure.ac
M meson.build

Better document logical replication parameters

commit   : a8500750ca0acf6bb95cf9d1ac7f421749b22db7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Dec 2022 20:18:56 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Dec 2022 20:18:56 +0100    

Click here for diff

Add some cross-links between chapter "20. Server Parameters" and  
"31. Logical Replication" regarding the available configuration  
parameters, for easier navigation; and some more explanatory text too.  
  
I (Álvaro) chose to duplicate max_replication_slots in Chapter 20,  
because it has completely different meanings at each side of the  
replication link.  
  
Author: Peter Smith <[email protected]>  
Reviewed-by: vignesh C <[email protected]>  
Reviewed-by: samay sharma <[email protected]>  
Discussion: https://postgr.es/m/CAHut+PsESqpy7w3Y6cX98c255ZuCjvipkhKjy6hZBjOv4E6iJA@mail.gmail.com  

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

Remove extra space from dumped ALTER DEFAULT PRIVILEGES.

commit   : 2af33369e7940770cb81c0a9b7d3ec874ee8cb22    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 12 Dec 2022 09:25:50 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 12 Dec 2022 09:25:50 -0800    

Click here for diff

Author: Nathan Bossart  
Discussion: https://postgr.es/m/20221206232744.GA3560301@nathanxps13  

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

Fix failure to advance content pointer in sendFileWithContent.

commit   : 45f5c81ad2bc2cd4e6a4fa0ba13b34f5c6048d44    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 12 Dec 2022 10:17:02 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 12 Dec 2022 10:17:02 -0500    

Click here for diff

If sendFileWithContent were used to send a file larger than the  
bbsink buffer size, this would result in corruption. The only  
files that are sent via sendFileWithContent are the backup label  
file, the tablespace map file, and .done files for WAL segments  
included in the backup. Of these, it seems that only the  
tablespace_map file can become large enough to cause a problem,  
and then only if you have a lot of tablespaces. If you do have  
that situation, you might end up with a corrupted  
tablespace_map file, which would be bad.  
  
My commit bef47ff85df18bf4a3a9b13bd2a54820e27f3614 introduced  
this problem.  
  
Report and patch by Antonin Houska.  
  
Discussion: http://postgr.es/m/15764.1670528645@antos  

M src/backend/backup/basebackup.c

Order getopt arguments

commit   : df8b8968d4095f44acd6de03b4add65f9709b79d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Dec 2022 14:33:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Dec 2022 14:33:41 +0100    

Click here for diff

Order the letters in the arguments of getopt() and getopt_long(), as  
well as in the subsequent switch statements.  In most cases, I used  
alphabetical with lower case first.  In a few cases, existing  
different orders (e.g., upper case first) was kept to reduce the diff  
size.  
  
Discussion: https://www.postgresql.org/message-id/flat/3efd0fe8-351b-f836-9122-886002602357%40enterprisedb.com  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_upgrade/option.c
M src/bin/pgbench/pgbench.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c

Get rid of recursion-marker values in enum AlterTableType

commit   : 840ff5f451cd9a391d237fc60894fea7ad82a189    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 12 Dec 2022 11:13:26 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 12 Dec 2022 11:13:26 +0100    

Click here for diff

During ALTER TABLE execution, when prep-time handling of subcommands of  
certain types determine that execution-time handling requires recursion,  
they signal this by changing the subcommand type to a special value.  
This can be done in a simpler way by using a separate flag introduced by  
commit ec0925c22a3d, so do that.  
  
Catversion bumped.  It's not clear to me that ALTER TABLE subcommands  
are stored anywhere in catalogs (CREATE FUNCTION rejects it in BEGIN  
ATOMIC function bodies), but we do have both write and read support for  
them, so be safe.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Add support for GRANT SET in psql tab completion

commit   : 9d0cf574920f1d5e6c260815d242b6691d37d5dc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Dec 2022 16:47:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Dec 2022 16:47:24 +0900    

Click here for diff

3d14e17 has added support for this query but psql was not able to  
complete it.  Spotted while working on a different patch in the same  
area.  
  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Remove direct call to GetNewObjectId() for pg_auth_members.oid

commit   : eae7fe485998ac493a3d9dadf254a89c9265891e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Dec 2022 09:01:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Dec 2022 09:01:39 +0900    

Click here for diff

This routine should not be called directly as mentioned at its top, so  
replace it by GetNewOidWithIndex().  Issue introduced by 6566133 when  
pg_auth_members.oid got added, so no backpatch is needed.  
  
Author: Maciek Sakrejda  
Discussion: https://postgr.es/m/CAOtHd0Ckbih7Ur7XeVyLAJ26VZOfTNcq9qV403bNF4uTGtAN+Q@mail.gmail.com  

M src/backend/commands/user.c

Convert domain_in to report errors softly.

commit   : b8c0ffbd2c8038fbebe76b48616860a7efec66ae    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2022 12:56:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2022 12:56:54 -0500    

Click here for diff

This is straightforward as far as it goes.  However, it does not  
attempt to trap errors occurring during the execution of domain  
CHECK constraints.  Since those are general user-defined  
expressions, the only way to do that would involve starting up a  
subtransaction for each check.  Of course the entire point of  
the soft-errors feature is to not need subtransactions, so that  
would be self-defeating.  For now, we'll rely on the assumption  
that domain checks are written to avoid throwing errors.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_domain.sgml
M src/backend/utils/adt/domains.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Convert json_in and jsonb_in to report errors softly.

commit   : c60c9badba9b4db3155eef081ae0b923f983168c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2022 11:28:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2022 11:28:15 -0500    

Click here for diff

This requires a bit of further infrastructure-extension to allow  
trapping errors reported by numeric_in and pg_unicode_to_server,  
but otherwise it's pretty straightforward.  
  
In the case of jsonb_in, we are only capturing errors reported  
during the initial "parse" phase.  The value-construction phase  
(JsonbValueToJsonb) can also throw errors if assorted implementation  
limits are exceeded.  We should improve that, but it seems like a  
separable project.  
  
Andrew Dunstan and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/mb/mbutils.c
M src/common/jsonapi.c
M src/include/common/jsonapi.h
M src/include/fmgr.h
M src/include/mb/pg_wchar.h
M src/include/utils/jsonfuncs.h
M src/test/regress/expected/json.out
M src/test/regress/expected/json_encoding.out
M src/test/regress/expected/json_encoding_1.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/json_encoding.sql
M src/test/regress/sql/jsonb.sql

Change JsonSemAction to allow non-throw error reporting.

commit   : 50428a301d5ad46316cac2192f2ca8d91898aa3c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2022 10:39:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Dec 2022 10:39:05 -0500    

Click here for diff

Formerly, semantic action functions for the JSON parser returned void,  
so that there was no way for them to affect the parser's behavior.  
That means in particular that they can't force an error exit except by  
longjmp'ing.  That won't do in the context of our project to make input  
functions return errors softly.  Hence, change them to return the same  
JsonParseErrorType enum value as the parser itself uses.  If an action  
function returns anything besides JSON_SUCCESS, the parse is abandoned  
and that error code is returned.  
  
Action functions can thus easily return the same error conditions that  
the parser already knows about.  As an escape hatch for expansion, also  
invent a code JSON_SEM_ACTION_FAILED that the core parser does not know  
the exact meaning of.  When returning this code, an action function  
must use some out-of-band mechanism for reporting the error details.  
  
This commit simply makes the API change and causes all the existing  
action functions to return JSON_SUCCESS, so that there is no actual  
change in behavior here.  This is long enough and boring enough that  
it seemed best to commit it separately from the changes that make  
real use of the new mechanism.  
  
In passing, remove a duplicate assignment of  
transform_string_values_scalar.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/bin/pg_verifybackup/parse_manifest.c
M src/common/jsonapi.c
M src/include/common/jsonapi.h

Standardize error reports in unimplemented I/O functions.

commit   : d02ef65bce6575e10ac0b4e7b8552ff67687c944    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Dec 2022 18:26:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Dec 2022 18:26:43 -0500    

Click here for diff

We chose a specific wording of the not-implemented errors for  
pseudotype I/O functions and other cases where there's little  
value in implementing input and/or output.  gtsvectorin never  
got that memo though, nor did most of contrib.  Make these all  
fall in line, mostly because I'm a neatnik but also to remove  
unnecessary translatable strings.  
  
gbtreekey_in needs a bit of extra love since it supports  
multiple SQL types.  Sadly, gbtreekey_out doesn't have the  
ability to do that, but I think it's unreachable anyway.  
  
Noted while surveying datatype input functions to see what we  
have left to fix.  

M contrib/btree_gist/btree_gist.c
M contrib/hstore/hstore_gist.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/ltree_gist.c
M contrib/pg_trgm/trgm_gist.c
M src/backend/utils/adt/tsgistidx.c

Use the macro, not handwritten code, to construct anymultirange_in().

commit   : e730718072bdc8379f3d099c64455c20d6a6d1ad    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Dec 2022 17:22:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Dec 2022 17:22:16 -0500    

Click here for diff

Apparently anymultirange_in was written before we converted all  
these pseudotype input functions to use a common macro, and it didn't  
get fixed before committing.  Sloppy merging probably explains its  
unintuitive ordering, too, so rearrange.  
  
Noted while surveying datatype input functions to see what we  
have left to fix.  I'm inclined to leave the pseudotypes as  
throwing hard errors, because it's difficult to see a reason why  
anyone would need something else.  But in any case, if we want  
to change that, we shouldn't have to change multiple copies of  
the code.  

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

Add subquery pullup handling for WindowClause runCondition

commit   : 94985c21020aa4a40d0dda1a26ac3e35a57e4681    
  
author   : David Rowley <[email protected]>    
date     : Sat, 10 Dec 2022 19:27:20 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 10 Dec 2022 19:27:20 +1300    

Click here for diff

9d9c02ccd added code to allow WindowAgg to take some shortcuts when a  
monotonic WindowFunc reached some value that it could never come back  
from due to the function's monotonic nature.  That commit added a  
runCondition field to WindowClause to store the condition which, when it  
becomes false we can start taking shortcuts in nodeWindowAgg.c.  
  
Here we fix an issue where subquery pullups didn't properly update the  
runCondition to update the Vars to properly reference the new query level.  
  
Here we also add a missing call to preprocess_expression() for the  
WindowClause's runCondtion.  The WindowFuncs in the targetlist will have  
had this process done, so we must also do it for the WindowFuncs in the  
runCondition so that they can be correctly found in the targetlist  
during setrefs.c  
  
Bug: #17709  
Reported-by: Alexey Makhmutov  
Author: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15, where 9d9c02ccd was introduced  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c

Fix macro definitions in pgstatfuncs.c

commit   : 66dcb09246b49b2cd0421251221e07c388de9c4f    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 10 Dec 2022 13:28:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 10 Dec 2022 13:28:02 +0900    

Click here for diff

Buildfarm member wrasse has been complaining about empty declarations  
as an effect of 8018ffb and 83a1a1b due to extra semicolons.  
  
While on it, remove also the last backslash of the macros definitions,  
causing more lines to be eaten in it than necessary, per comment from  
Tom Lane.  
  
Reported-by: Tom Lane, and buildfarm member wrasse  
Author: Nathan Bossart, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Restructure soft-error handling in formatting.c.

commit   : 4dd687502d9eb0b2984c36579c2fcf5283adfa7c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 20:15:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 20:15:56 -0500    

Click here for diff

Replace the error trapping scheme introduced in 5bc450629 with our  
shiny new errsave/ereturn mechanism.  This doesn't have any real  
functional impact (although I think that the new coding is able  
to report a few more errors softly than v15 did).  And I doubt  
there's any measurable performance difference either.  But this  
gets rid of an ad-hoc, one-of-a-kind design in favor of a mechanism  
that will be widely used going forward, so it should be a net win  
for code readability.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/utils/formatting.h

Convert datetime input functions to use "soft" error reporting.

commit   : c60488b4748b4316f1c92d62457671046e5c8994    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 16:07:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 16:07:49 -0500    

Click here for diff

This patch converts the input functions for date, time, timetz,  
timestamp, timestamptz, and interval to the new soft-error style.  
There's some related stuff in formatting.c that remains to be  
cleaned up, but that seems like a separable project.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/datetime.h
M src/test/regress/expected/date.out
M src/test/regress/expected/interval.out
M src/test/regress/expected/time.out
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/expected/timetz.out
M src/test/regress/sql/date.sql
M src/test/regress/sql/interval.sql
M src/test/regress/sql/time.sql
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql
M src/test/regress/sql/timetz.sql

Allow DateTimeParseError to handle bad-timezone error messages.

commit   : 2661469d862239ea8b9e3a1cf5352d833f6f0fec    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 13:30:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 13:30:43 -0500    

Click here for diff

Pay down some ancient technical debt (dating to commit 022fd9966):  
fix a couple of places in datetime parsing that were throwing  
ereport's immediately instead of returning a DTERR code that could be  
interpreted by DateTimeParseError.  The reason for that was that there  
was no mechanism for passing any auxiliary data (such as a zone name)  
to DateTimeParseError, and these errors seemed to really need it.  
Up to now it didn't matter that much just where the error got thrown,  
but now we'd like to have a hard policy that datetime parse errors  
get thrown from just the one place.  
  
Hence, invent a "DateTimeErrorExtra" struct that can be used to  
carry any extra values needed for specific DTERR codes.  Perhaps  
in the future somebody will be motivated to use this to improve  
the specificity of other DateTimeParseError messages, but for now  
just deal with the timezone-error cases.  
  
This is on the way to making the datetime input functions report  
parse errors softly; but it's really an independent change, so  
commit separately.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/adminpack/adminpack.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/datetime.h

meson: Improve PG_VERSION_STR generation

commit   : fc7852c6cb89a5384e0b4ad30874de92f63f88be    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 9 Dec 2022 08:53:23 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 9 Dec 2022 08:53:23 -0800    

Click here for diff

Previously the host operating system and 32/64 bit were not included and the  
build machine's cpu was used, which is potentially wrong for cross builds.  
  
Author: Juan José Santamaría Flecha <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAC+AXB16gwYhKCdS+t0pk3U7kKtpVj5L-ynmhK3Gbea330At3w@mail.gmail.com  

M meson.build

Const-ify a couple of datetime parsing subroutines.

commit   : bad5116957eea2dc360c6c233be08284bd3d5364    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 10:43:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 10:43:45 -0500    

Click here for diff

More could be done in this line, but I just grabbed some low-hanging  
fruit.  Principal objective was to remove the need for several ugly  
unconstify() usages in formatting.c.  

M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/include/utils/datetime.h

Convert a few datatype input functions to use "soft" error reporting.

commit   : ccff2d20ed9622815df2a7deffce8a7b14830965    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 10:14:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 10:14:53 -0500    

Click here for diff

This patch converts the input functions for bool, int2, int4, int8,  
float4, float8, numeric, and contrib/cube to the new soft-error style.  
array_in and record_in are also converted.  There's lots more to do,  
but this is enough to provide proof-of-concept that the soft-error  
API is usable, as well as reference examples for how to convert  
input functions.  
  
This patch is mostly by me, but it owes very substantial debt to  
earlier work by Nikita Glukhov, Andrew Dunstan, and Amul Sul.  
Thanks to Andres Freund for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/cube/cube.c
M contrib/cube/cubedata.h
M contrib/cube/cubeparse.y
M contrib/cube/cubescan.l
M contrib/cube/expected/cube.out
M contrib/cube/sql/cube.sql
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/rowtypes.c
M src/include/utils/array.h
M src/include/utils/builtins.h
M src/include/utils/float.h
M src/test/regress/expected/arrays.out
M src/test/regress/expected/boolean.out
M src/test/regress/expected/float4-misrounded-input.out
M src/test/regress/expected/float4.out
M src/test/regress/expected/float8.out
M src/test/regress/expected/int2.out
M src/test/regress/expected/int4.out
M src/test/regress/expected/int8.out
M src/test/regress/expected/numeric.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/arrays.sql
M src/test/regress/sql/boolean.sql
M src/test/regress/sql/float4.sql
M src/test/regress/sql/float8.sql
M src/test/regress/sql/int2.sql
M src/test/regress/sql/int4.sql
M src/test/regress/sql/int8.sql
M src/test/regress/sql/numeric.sql
M src/test/regress/sql/rowtypes.sql

Add test scaffolding for soft error reporting from input functions.

commit   : 1939d26282b27b4b264c6930830a7991ed83917a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 10:08:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 10:08:44 -0500    

Click here for diff

pg_input_is_valid() returns boolean, while pg_input_error_message()  
returns the primary error message if the input is bad, or NULL  
if the input is OK.  The main reason for having two functions is  
so that we can test both the details-wanted and the no-details-wanted  
code paths.  
  
Although these are primarily designed with testing in mind,  
it could well be that they'll be useful to end users as well.  
  
This patch is mostly by me, but it owes very substantial debt to  
earlier work by Nikita Glukhov, Andrew Dunstan, and Amul Sul.  
Thanks to Andres Freund for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/misc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/create_type.out
M src/test/regress/regress.c
M src/test/regress/sql/create_type.sql

Create infrastructure for "soft" error reporting.

commit   : d9f7f5d32f201bec61fef8104aafcb77cecb4dcb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 09:58:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Dec 2022 09:58:38 -0500    

Click here for diff

Postgres' standard mechanism for reporting errors (ereport() or elog())  
is used for all sorts of error conditions.  This means that throwing  
an exception via ereport(ERROR) requires an expensive transaction or  
subtransaction abort and cleanup, since the exception catcher dare not  
make many assumptions about what has gone wrong.  There are situations  
where we would rather have a lighter-weight mechanism for dealing  
with errors that are known to be safe to recover from without a full  
transaction cleanup.  This commit creates infrastructure to let us  
adapt existing error-reporting code for that purpose.  See the  
included documentation changes for details.  Follow-on commits will  
provide test code and usage examples.  
  
The near-term plan is to convert most if not all datatype input  
functions to report invalid input "softly".  This will enable  
implementing some SQL/JSON features cleanly and without the cost  
of subtransactions, and it will also allow creating COPY options  
to deal with bad input without cancelling the whole COPY.  
  
This patch is mostly by me, but it owes very substantial debt to  
earlier work by Nikita Glukhov, Andrew Dunstan, and Amul Sul.  
Thanks also to Andres Freund for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_type.sgml
M src/backend/nodes/Makefile
M src/backend/nodes/gen_node_support.pl
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/README
M src/backend/utils/fmgr/fmgr.c
M src/include/fmgr.h
M src/include/nodes/meson.build
A src/include/nodes/miscnodes.h
M src/include/utils/elog.h
M src/tools/pgindent/typedefs.list

Fix invalid role names introduced in 096dd80f3c

commit   : beecbe8e5001249f0ad51f828d66238dd5160072    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 9 Dec 2022 13:53:32 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 9 Dec 2022 13:53:32 +0300    

Click here for diff

096dd80f3c added new regression tests dealing with roles.  By oversight, role  
names didn't start with regress_ prefix.  This commit fixes that.  

M src/test/modules/test_pg_db_role_setting/expected/test_pg_db_role_setting.out
M src/test/modules/test_pg_db_role_setting/sql/test_pg_db_role_setting.sql

Add USER SET parameter values for pg_db_role_setting

commit   : 096dd80f3ccc103c8e078fca05e6ccfb2071aa91    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 9 Dec 2022 13:12:20 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 9 Dec 2022 13:12:20 +0300    

Click here for diff

The USER SET flag specifies that the variable should be set on behalf of an  
ordinary role.  That lets ordinary roles set placeholder variables, which  
permission requirements are not known yet.  Such a value wouldn't be used if  
the variable finally appear to require superuser privileges.  
  
The new flags are stored in the pg_db_role_setting.setuser array.  Catversion  
is bumped.  
  
This commit is inspired by the previous work by Steve Chavez.  
  
Discussion: https://postgr.es/m/CAPpHfdsLd6E--epnGqXENqLP6dLwuNZrPMcNYb3wJ87WR7UBOQ%40mail.gmail.com  
Author: Alexander Korotkov, Steve Chavez  
Reviewed-by: Pavel Borisov, Steve Chavez  

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
A src/test/modules/test_pg_db_role_setting/.gitignore
A src/test/modules/test_pg_db_role_setting/Makefile
A src/test/modules/test_pg_db_role_setting/expected/test_pg_db_role_setting.out
A src/test/modules/test_pg_db_role_setting/meson.build
A src/test/modules/test_pg_db_role_setting/sql/test_pg_db_role_setting.sql
A src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting–1.0.sql
A src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting.c
A src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting.control
M src/test/regress/expected/psql.out

Update MERGE docs to mention that ONLY is supported.

commit   : 5defdef8aa0535b8e9365ea9cceee60d5731395f    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 9 Dec 2022 10:00:01 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 9 Dec 2022 10:00:01 +0000    

Click here for diff

Commit 7103ebb7aa added support for MERGE, which included support for  
inheritance hierarchies, but didn't document the fact that ONLY could  
be specified before the source and/or target tables to exclude tables  
inheriting from the tables specified.  
  
Update merge.sgml to mention this, and while at it, add some  
regression tests to cover it.  
  
Dean Rasheed, reviewed by Nathan Bossart.  
  
Backpatch to 15, where MERGE was added.  
  
Discussion: https://postgr.es/m/CAEZATCU0XM-bJCvpJuVRU3UYNRqEBS6g4-zH%3Dj9Ye0caX8F6uQ%40mail.gmail.com  

M doc/src/sgml/ref/merge.sgml
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

Remove unnecessary casts

commit   : 07c29ca7fe30839a75d15b43c13b290a59a60ddf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Dec 2022 08:51:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Dec 2022 08:51:38 +0100    

Click here for diff

Some code carefully cast all data buffer arguments for BufFileWrite()  
and BufFileRead() to void *, even though the arguments are already  
void * (and AFAICT were never anything else).  Remove this unnecessary  
clutter.  
  
Discussion: https://www.postgresql.org/message-id/flat/11dda853-bb5b-59ba-a746-e168b1ce4bdb%40enterprisedb.com  

M src/backend/executor/nodeHashjoin.c
M src/backend/utils/sort/tuplestore.c

Update types in File API

commit   : 2d4f1ba6cfc2f0a977f1c30bda9848041343e248    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Dec 2022 08:51:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Dec 2022 08:51:38 +0100    

Click here for diff

Make the argument types of the File API match stdio better:  
  
- Change the data buffer to void *, from char *.  
- Change FileWrite() data buffer to const on top of that.  
- Change amounts to size_t, from int.  
  
In passing, change the FilePrefetch() amount argument from int to  
off_t, to match the underlying posix_fadvise().  
  
Discussion: https://www.postgresql.org/message-id/flat/11dda853-bb5b-59ba-a746-e168b1ce4bdb%40enterprisedb.com  

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

Remove new structure member from ResultRelInfo.

commit   : 4b3e37993254ed098219e62ceffb1b32fac388cb    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 8 Dec 2022 16:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 8 Dec 2022 16:15:00 +0900    

Click here for diff

In commit ffbb7e65a, I added a ModifyTableState member to ResultRelInfo  
to save the owning ModifyTableState for use by nodeModifyTable.c when  
performing batch inserts, but as pointed out by Tom Lane, that changed  
the array stride of es_result_relations, and that would break any  
previously-compiled extension code that accesses that array.  Fix by  
removing that member from ResultRelInfo and instead adding a List member  
at the end of EState to save such ModifyTableStates.  
  
Per report from Tom Lane.  Back-patch to v14, like the previous commit;  
I chose to apply the patch to HEAD as well, to make back-patching easy.  
  
Discussion: http://postgr.es/m/4065383.1669395453%40sss.pgh.pa.us  

M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/include/nodes/execnodes.h

Add option to specify segment size in blocks

commit   : d3b111e3205b6e681e16b4f8e6ed01f67142ce7b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 7 Dec 2022 19:32:59 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 7 Dec 2022 19:32:59 -0800    

Click here for diff

The tests don't have much coverage of segment related code, as we don't create  
large enough tables. To make it easier to test these paths, add a new option  
specifying the segment size in blocks.  
  
Set the new option to 6 blocks in one of the CI tasks. Smaller numbers  
currently fail one of the tests, for understandable reasons.  
  
While at it, fix some segment size related issues in the meson build.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml
M configure
M configure.ac
M doc/src/sgml/installation.sgml
M meson.build
M meson_options.txt

Avoid unnecessary streaming of transactions during logical replication.

commit   : bf07ab492c461460b4a69279abb2ef996b4f67ec    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 8 Dec 2022 06:05:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 8 Dec 2022 06:05:09 +0530    

Click here for diff

After restart, we don't perform streaming of an in-progress transaction if  
it was previously decoded and confirmed by the client. To achieve that we  
were comparing the END location of the WAL record being decoded with the  
WAL location we have already decoded and confirmed by the client. While  
decoding the commit record, to decide whether to process and send the  
complete transaction, we compare its START location with the WAL location  
we have already decoded and confirmed by the client. Now, if we need to  
queue some change in the transaction while decoding the commit record  
(e.g. snapshot), it is possible that we decide to stream the transaction  
but later commit processing decides to skip it. In such a case, we would  
needlessly send the changes and later when we decide to skip it, we will  
send stream abort.  
  
We also sometimes decide to stream the changes when we actually just need  
to process them locally like a change for invalidations. This will lead us  
to send empty streams. To avoid this, while queuing each change for  
decoding, we remember whether the transaction has any change that actually  
needs to be sent downstream and use that information later to decide  
whether to stream the transaction or not.  
  
Note, we can't avoid all cases where we have to send empty streams like  
the case where the plugin later decides that the change is not  
publishable. However, we will no longer need to send stream_abort when we  
skip sending a particular transaction.  
  
Author: Dilip Kumar  
Reviewed-by: Hou Zhijie, Ashutosh Bapat, Shi yu, Amit Kapila  
Discussion: https://postgr.es/m/CAFiTN-tHK=7LzfrPs8fbT2ksrOJGQbzywcgXst2bM9-rJJAAUg@mail.gmail.com  

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

meson: Add 'running' test setup, as a replacement for installcheck

commit   : 3f0e786ccbf50a2f819fbf72d51ba13221adaaa1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 7 Dec 2022 12:13:35 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 7 Dec 2022 12:13:35 -0800    

Click here for diff

To run all tests that support running against existing server:  
$ meson test --setup running  
  
To run just the main pg_regress tests against existing server:  
$ meson test --setup running regress-running/regress  
  
To ensure the 'running' setup continues to work, test it as part of the  
freebsd CI task.  
  
Discussion: https://postgr.es/m/CAH2-Wz=XDQcmLoo7RR_i6FKQdDmcyb9q5gStnfuuQXrOGhB2sQ@mail.gmail.com  

M .cirrus.yml
M contrib/basic_archive/meson.build
M contrib/pg_freespacemap/meson.build
M contrib/pg_stat_statements/meson.build
M contrib/pg_walinspect/meson.build
M contrib/test_decoding/meson.build
M doc/src/sgml/installation.sgml
M meson.build
M src/interfaces/ecpg/test/meson.build
M src/test/isolation/meson.build
M src/test/modules/commit_ts/meson.build
M src/test/modules/snapshot_too_old/meson.build
M src/test/modules/test_oat_hooks/meson.build
M src/test/modules/test_pg_dump/meson.build
M src/test/modules/test_slru/meson.build
M src/test/modules/worker_spi/meson.build
M src/test/regress/meson.build

Minor code refactoring in elog.c (no functional change).

commit   : 8305629afe64c9065369d022e91be9f16f3972fa    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Dec 2022 14:39:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Dec 2022 14:39:25 -0500    

Click here for diff

Combine some duplicated code stanzas by creating small functions.  
Most of these duplications arose at a time when I wouldn't have  
trusted C compilers to auto-inline small functions intelligently,  
but they're probably poor practice now.  Similarly split out some  
bits that aren't actually duplicative as the code stands, but would  
become so after an upcoming patch to add another error-handling  
code path.  
  
Take the opportunity to add some lengthier comments about what  
we're doing here, too.  Re-order one function that seemed not  
very well-placed.  
  
Patch by me, per suggestions from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/error/elog.c

Doc: subdivide System Information Functions and Operators.

commit   : 3b3182195304777430d16d7967f0adcd8dbfe2ed    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Dec 2022 13:56:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Dec 2022 13:56:48 -0500    

Click here for diff

Provide <sect2> subdivisions in 9.26 System Information Functions and  
Operators.  This is useful because it adds a mini-TOC at the top of  
the page to aid jumping to portions of what's become quite a long  
section.  Also, now that several of the subsections contain multiple  
tables, it's hard to see the overall structure without headings.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Fix FK comment think-o

commit   : 5e9b1220599946621984ec95f1cb80989f7c76d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Dec 2022 17:06:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Dec 2022 17:06:50 +0100    

Click here for diff

from commit d6f96ed94e7  
  
Author: Paul Jungwirth <[email protected]>  
Reviewed-by: Ian Lawrence Barwick <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/6a7c7338-1aa2-4689-d171-0b0b294fdd84%40illuminatedcomputing.com  

M src/backend/commands/tablecmds.c

Update outdated comment in ApplyRetrieveRule

commit   : 29861e228a47c3b6c292f1bd4da413662a246ca2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Dec 2022 12:35:59 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Dec 2022 12:35:59 +0100    

Click here for diff

After a61b1f74823c.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqGZm7hb2VAy8HGM22-fTDaQzqE6T=5GbAk=GkT9H0hJEg@mail.gmail.com  

M src/backend/rewrite/rewriteHandler.c

meson: Add basic PGXS compatibility

commit   : 5bdd0cfb91036b396935fad289c627602a00130c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 6 Dec 2022 18:56:46 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 6 Dec 2022 18:56:46 -0800    

Click here for diff

Generate a Makefile.global that's complete enough for PGXS to work for some  
extensions. It is likely that this compatibility layer will not suffice for  
every extension and not all platforms - we can expand it over time.  
  
This allows extensions to use a single buildsystem across all the supported  
postgres versions. Once all supported PG versions support meson, we can remove  
the compatibility layer.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M meson.build
M meson_options.txt
M src/common/meson.build
M src/include/meson.build
A src/makefiles/meson.build
M src/meson.build

autoconf: Move export_dynamic determination to configure

commit   : 9db49fc5bfdc0126be03f4b8986013e59d93b91d    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 6 Dec 2022 18:55:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 6 Dec 2022 18:55:28 -0800    

Click here for diff

Previously export_dynamic was set in src/makefiles/Makefile.$port. For solaris  
this required exporting with_gnu_ld. The determination of with_gnu_ld would be  
nontrivial to copy for meson PGXS compatibility.  It's also nice to delete  
libtool.m4.  
  
This uses -Wl,--export-dynamic on all platforms, previously all platforms but  
FreeBSD used -Wl,-E. The likelihood of a name conflict seems lower with the  
longer spelling.  
  
Discussion: https://postgr.es/m/[email protected]  

M aclocal.m4
M config/c-compiler.m4
D config/libtool.m4
M configure
M configure.ac
M src/Makefile.global.in
M src/backend/Makefile
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.linux
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd
M src/makefiles/Makefile.solaris

Generate pg_stat_get*() functions for databases using macros

commit   : 8018ffbf5895ee16a1fd7117c4526b47ac42332e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Dec 2022 09:11:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Dec 2022 09:11:48 +0900    

Click here for diff

The same code pattern is repeated 21 times for int64 counters (0 for  
missing entry) and 5 times for doubles (0 for missing entry) on database  
entries.  This code is switched to use macros for the basic code  
instead, shaving a few hundred lines of originally-duplicated code  
patterns.  The function names remain the same, but some fields of  
PgStat_StatDBEntry have to be renamed to cope with the new style.  
  
This is in the same spirit as 83a1a1b.  
  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart, Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h

meson: Basic cygwin support

commit   : 79f7c482f6745959f7aeea4f7386fceb02ad8889    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 6 Dec 2022 11:25:54 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 6 Dec 2022 11:25:54 -0800    

Click here for diff

There likely are further issues, but as evidenced by the CI task proposed by  
Justin in the referenced thread, this suffices to build and run basic tests in  
cygwin (some fixes for the test infrastructure are needed, but that's  
independent of the meson aspect).  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M meson.build
M src/port/meson.build
M src/test/regress/meson.build

Rework query relation permission checking

commit   : a61b1f74823c9c4f79c95226a461f1e7a367764b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Dec 2022 16:09:24 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Dec 2022 16:09:24 +0100    

Click here for diff

Currently, information about the permissions to be checked on relations  
mentioned in a query is stored in their range table entries.  So the  
executor must scan the entire range table looking for relations that  
need to have permissions checked.  This can make the permission checking  
part of the executor initialization needlessly expensive when many  
inheritance children are present in the range range.  While the  
permissions need not be checked on the individual child relations, the  
executor still must visit every range table entry to filter them out.  
  
This commit moves the permission checking information out of the range  
table entries into a new plan node called RTEPermissionInfo.  Every  
top-level (inheritance "root") RTE_RELATION entry in the range table  
gets one and a list of those is maintained alongside the range table.  
This new list is initialized by the parser when initializing the range  
table.  The rewriter can add more entries to it as rules/views are  
expanded.  Finally, the planner combines the lists of the individual  
subqueries into one flat list that is passed to the executor for  
checking.  
  
To make it quick to find the RTEPermissionInfo entry belonging to a  
given relation, RangeTblEntry gets a new Index field 'perminfoindex'  
that stores the corresponding RTEPermissionInfo's index in the query's  
list of the latter.  
  
ExecutorCheckPerms_hook has gained another List * argument; the  
signature is now:  
typedef bool (*ExecutorCheckPerms_hook_type) (List *rangeTable,  
					      List *rtePermInfos,  
					      bool ereport_on_violation);  
The first argument is no longer used by any in-core uses of the hook,  
but we leave it in place because there may be other implementations that  
do.  Implementations should likely scan the rtePermInfos list to  
determine which operations to allow or deny.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqGjJDmUhDSfv-U2qhKJjt9ST7Xh9JXC_irsAQ1TAUsJYg@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/sepgsql.h
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/view.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execUtils.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/catversion.h
M src/include/commands/copyfrom_internal.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/inherit.h
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql
M src/tools/pgindent/typedefs.list

Fix typo

commit   : b5bbaf08ed8bbc45d396c3383fc89331c914b857    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 5 Dec 2022 19:03:35 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 5 Dec 2022 19:03:35 +0100    

Click here for diff

M contrib/sepgsql/dml.c

Fix 32-bit build dangling pointer issue in WindowAgg

commit   : a8583272218ab6e97c7bdeb8a960d8d4de329b7e    
  
author   : David Rowley <[email protected]>    
date     : Wed, 7 Dec 2022 00:09:36 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 7 Dec 2022 00:09:36 +1300    

Click here for diff

9d9c02ccd added window "run conditions", which allows the evaluation of  
monotonic window functions to be skipped when the run condition is no  
longer true.  Prior to this commit, once the run condition was no longer  
true and we stopped evaluating the window functions, we simply just left  
the ecxt_aggvalues[] and ecxt_aggnulls[] arrays alone to store whatever  
value was stored there the last time the window function was evaluated.  
Leaving a stale value in there isn't really a problem on 64-bit builds as  
all of the window functions which we recognize as monotonic all return  
int8, which is passed by value on 64-bit builds.  However, on 32-bit  
builds, this was a problem as the value stored in the ecxt_values[]  
element would be a by-ref value and it would be pointing to some memory  
which would get reset once the tuple context is destroyed.  Since the  
WindowAgg node will output these values in the resulting tupleslot, this  
could be problematic for the top-level WindowAgg node which must look at  
these values to filter out the rows that don't meet its filter condition.  
  
Here we fix this by just zeroing the ecxt_aggvalues[] and setting the  
ecxt_aggnulls[] array to true when the run condition first becomes false.  
This results in the WindowAgg's output having NULLs for the WindowFunc's  
columns rather than the stale or pointer pointing to possibly freed  
memory.  These tuples with the NULLs can only make it as far as the  
top-level WindowAgg node before they're filtered out.  To ensure that  
these tuples *are* always filtered out, we now insist that OpExprs making  
up the run condition are strict OpExprs.  Currently, all the window  
functions which the planner recognizes as monotonic return INT8 and the  
operator which is used for the run condition must be a member of a btree  
opclass.  In reality, these restrictions exclude nothing that's built-in  
to Postgres and are unlikely to exclude anyone's custom operators due to  
the requirement that the operator is part of a btree opclass.  It would be  
unusual if those were not strict.  
  
Reported-by: Sergey Shinderuk, using valgrind  
Reviewed-by: Richard Guo, Sergey Shinderuk  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15, where 9d9c02ccd was added  

M src/backend/executor/nodeWindowAgg.c
M src/backend/optimizer/path/allpaths.c

Generate pg_stat_get*() functions for tables using macros

commit   : 83a1a1b56645b7a55ec00e44f8018116ee87c720    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Dec 2022 10:46:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Dec 2022 10:46:35 +0900    

Click here for diff

The same code pattern is repeated 17 times for int64 counters (0 for  
missing entry) and 5 times for timestamps (NULL for missing entry) on  
table entries.  This code is switched to use a macro for the basic code  
instead, shaving a few hundred lines of originally-duplicated code.  The  
function names remain the same, but some fields of PgStat_StatTabEntry  
have to be renamed to cope with the new style.  
  
Author: Bertrand Drouvot  
Reviewed-by: Nathan Bossart  
Discussion: https:/postgr.es/m/20221204173207.GA2669116@nathanxps13  

M src/backend/access/heap/README.HOT
M src/backend/postmaster/autovacuum.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h

Check the snapshot argument of index_beginscan and family

commit   : 941aa6a6268a6a66f6895401aad6b5329111d412    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 6 Dec 2022 03:29:18 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 6 Dec 2022 03:29:18 +0300    

Click here for diff

Passing a NULL snapshot (InvalidSnapshot) is going to work but only as long  
as the index can't find any matching rows.  This can be confusing for  
the extension authors, so add an explicit check for this argument.  The check  
is implemented with Assert() in order to avoid overhead in release builds.  
  
Reported-by: Sven Klemm  
Discussion: https://postgr.es/m/CAJ7c6TPxitD4vbKyP-mpmC1XwyHdPPqvjLzm%2BVpB88h8LGgneQ%40mail.gmail.com  
Author: Aleksander Alekseev  
Reviewed-by: Pavel Borisov  

M src/backend/access/index/indexam.c

Provide test coverage in pg_dump for default behaviors with compression

commit   : a7885c9bb22de3efcc0ba4e79bbde8a77e8b7036    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Dec 2022 09:20:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Dec 2022 09:20:13 +0900    

Click here for diff

By default, the contents generated by the custom and directory dump  
formats are compressed.  However, with the existing test facility, the  
restore program will succeed regardless of whether the dumped output was  
compressed or not without checking if anything has been compressed.  
  
This commit implements a portable way to check the contents of the  
custom and directory dump formats:  
- glob_patterns, that can be defined for each test as an array of  
glob()-compilable strings, tracking the contents that should or should  
not be compressed.  While this is useful to make sure that the table  
data is compressed, this also checks that blobs.toc and toc.dat are  
never compressed.  
- command_like, to execute a command on a dump and check its generated  
output.  This is used here in correlation with pg_restore -l to check if  
the dumps have been compressed or not, depending on if the build  
supports gzip, or not.  
  
This hole in the tests has come up when working on 5e73a60, where  
compression has to be applied by default, if available, for both dump  
formats.  
  
The idea of glob_patterns comes from me, and Georgios has come up with  
the design for command_like.  
  
Author: Georgios Kokolatos, Michael Paquier  
Discussion: https://postgr.es/m/DQn4czCWR1rcbGPLL7p3LfEr5-kGmlySm-H05VgroINdikvhtS5r9EdI6b8D8sjnbKdJ09k-cxs2AqijBeHAWk9Q8gvEAxPRHuLRhwONcGc=@pm.me  

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

initdb: Refactor PG_CMD_PUTS loops

commit   : 1bd47d0dca9f63dc26abc00d4912857440cd101c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Dec 2022 23:28:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Dec 2022 23:28:59 +0100    

Click here for diff

Keeping the SQL commands that initdb runs in string arrays before  
feeding them to PG_CMD_PUTS() seems unnecessarily verbose and  
inflexible.  In some cases, the array only has one member.  In other  
cases, one might want to use PG_CMD_PRINTF() instead, to parametrize a  
command, but that would require breaking up the loop or using  
workarounds like replace_token().  Unwind all that; it's much simpler  
that way.  
  
Reviewed-by: John Naylor <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/2c50823b-f453-bb97-e38b-34751c51dcdf%40enterprisedb.com  

M src/bin/initdb/initdb.c

Fix Memoize to work with partitionwise joining.

commit   : d69d01ba9d8d774487032459ebb83d2086715f01    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Dec 2022 12:36:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Dec 2022 12:36:40 -0500    

Click here for diff

A couple of places weren't up to speed for this.  By sheer good  
luck, we didn't fail but just selected a non-memoized join plan,  
at least in the test case we have.  Nonetheless, it's a bug,  
and I'm not quite sure that it couldn't have worse consequences  
in other examples.  So back-patch to v14 where Memoize came in.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs48GkNom272sfp0-WeD6_0HSR19BJ4H1c9ZKSfbVnJsvRg@mail.gmail.com  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql

pg_dump: Remove "blob" terminology

commit   : 35ce24c333cf6dee3c92bc5f67553c7720bd9988    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Dec 2022 08:52:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Dec 2022 08:52:11 +0100    

Click here for diff

For historical reasons, pg_dump refers to large objects as "BLOBs".  
This term is not used anywhere else in PostgreSQL, and it also means  
something different in the SQL standard and other SQL systems.  
  
This patch renames internal functions, code comments, documentation,  
etc. to use the "large object" or "LO" terminology instead.  There is  
no functionality change, so the archive format still uses the name  
"BLOB" for the archive entry.  Additional long command-line options  
are added with the new naming.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/868a381f-4650-9460-1726-1ffd39a270b4%40enterprisedb.com  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
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
M src/test/modules/test_pg_dump/t/001_base.pl

doc: Add missing <varlistentry> markups for developer GUCs

commit   : 8a476fda5e45f16d8c608c73d9e871bd4023d79a    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Dec 2022 11:23:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Dec 2022 11:23:08 +0900    

Click here for diff

Missing such markups makes it impossible to create links back to these  
GUCs, and all the other parameters have one already.  
  
Author: Ian Lawrence Barwick  
Discussion: https://postgr.es/m/CAB8KJ=jx=6dFB_EN3j0UkuvG3cPu5OmQiM-ZKRAz+fKvS+u8Ng@mail.gmail.com  
Backpatch-through: 11  

M doc/src/sgml/config.sgml

commit   : 71cb84ec69a38444c48bd8d3b5451b2da157848b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Dec 2022 09:28:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Dec 2022 09:28:29 +0900    

Click here for diff

The error messages reported during any failures while reading or  
validating the header of a WAL currently includes only the offset of the  
page but not the compiled LSN referring to the page, requiring an extra  
step to compile it if looking at the surroundings with pg_waldump or  
similar.  Adding this information costs a bit in translation, but also  
eases debugging.  
  
Author: Bharath Rupireddy  
Reviewed-by:  Álvaro Herrera, Kyotaro Horiguchi, Maxim Orlov, Michael  
Paquier  
Discussion: https://postgr.es/m/CALj2ACWV=FCddsxcGbVOA=cvPyMr75YCFbSQT6g4KDj=gcJK4g@mail.gmail.com  

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

Fix thinko introduced in 6b423ec67

commit   : 8692f6644e71f51db9a853a652f37909c9cb534d    
  
author   : David Rowley <[email protected]>    
date     : Mon, 5 Dec 2022 11:55:05 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 5 Dec 2022 11:55:05 +1300    

Click here for diff

As pointed out by Dean Rasheed, we really should be using tmp >  
-(PG_INTNN_MIN / 10) rather than tmp > (PG_INTNN_MAX / 10) for checking  
for overflows in the accumulation in the pg_strtointNN functions.  This  
does happen to be the same number when dividing by 10, but there is a  
pending patch which adds other bases and this is not the same number if we  
were to divide by 2 rather than 10, for example.  If the base 2 parsing  
was to follow this example then we could accidentally think a string  
containing the value of PG_INT32_MIN was an overflow in pg_strtoint32.  
Clearly that shouldn't overflow.  
  
This does not fix any actual live bugs, only some bad examples of overflow  
checks for future bases.  
  
Reported-by: Dean Rasheed  
Discussion: https://postgr.es/m/CAEZATCVEtwfhdm-K-etZYFB0=qsR0nT6qXta_W+GQx4RYph1dg@mail.gmail.com  

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

Update top-level .gitignore.

commit   : d94f32d49f620fb08c1fd0e8c9345844ccd9b7c0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 15:23:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 15:23:00 -0500    

Click here for diff

Add a comment explaining our policy that we don't put excludes  
for nonstandard tools into committed .gitignore files.  
  
Also, remove the entries about libraries with .sl extensions,  
since that convention was only used on now-desupported HP-UX.  
  
Discussion: https://postgr.es/m/CAHxW8BAiyPwfXbN813GhorQozwMBs4f3DTxLkKNxiGQuJuw4Vw@mail.gmail.com  

M .gitignore

Re-pgindent a few files.

commit   : 92c4dafe1eed511c5af92bcea5311cf627673377    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 14:25:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 14:25:53 -0500    

Click here for diff

Just because I'm a neatnik, and I'm currently working on  
code in this area.  It annoys me to not be able to pgindent  
my patches without working around unrelated changes.  

M src/backend/optimizer/plan/setrefs.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h

Fix broken MemoizePath support in reparameterize_path().

commit   : e76913802c5347831aadc1513b59196bde6ec116    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 13:48:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 13:48:12 -0500    

Click here for diff

It neglected to recurse to the subpath, meaning you'd get back  
a path identical to the input.  This could produce wrong query  
results if the omission meant that the subpath fails to enforce  
some join clause it should be enforcing.  We don't have a test  
case for this at the moment, but the code is obviously broken  
and the fix is equally obvious.  Back-patch to v14 where  
Memoize was introduced.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4_R=ORpz=Lkn2q3ebPC5EuWyfZF+tmfCPVLBVK5W39mHA@mail.gmail.com  

M src/backend/optimizer/util/pathnode.c

Add missing MaterialPath support in reparameterize_path[_by_child].

commit   : 6eb2f0ed4cd5c8668c3127024a8a58b10fa2e8dc    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 13:35:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 13:35:42 -0500    

Click here for diff

These two functions failed to cover MaterialPath.  That's not a  
fatal problem, but we can generate better plans in some cases  
if we support it.  
  
Tom Lane and Richard Guo  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/pathnode.c

Fix generate_partitionwise_join_paths() to tolerate failure.

commit   : fe12f2f8fa608156c2d3c027cdd6aa9af0788e3a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 13:17:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Dec 2022 13:17:18 -0500    

Click here for diff

We might fail to generate a partitionwise join, because  
reparameterize_path_by_child() does not support all path types.  
This should not be a hard failure condition: we should just fall back  
to a non-partitioned join.  However, generate_partitionwise_join_paths  
did not consider this possibility and would emit the (misleading)  
error "could not devise a query plan for the given query" if we'd  
failed to make any paths for a child join.  Fix it to give up on  
partitionwise joining if so.  (The accepted technique for giving up  
appears to be to set rel->nparts = 0, which I find pretty bizarre,  
but there you have it.)  
  
I have not added a test case because there'd be little point:  
any omissions of this sort that we identify would soon get fixed  
by extending reparameterize_path_by_child(), so the test would stop  
proving anything.  However, right now there is a known test case based  
on failure to cover MaterialPath, and with that I've found that this  
is broken in all supported versions.  Hence, patch all the way back.  
  
Original report and patch by me; thanks to Richard Guo for  
identifying a test case that works against committed versions.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve performance of pg_strtointNN functions

commit   : 6b423ec677d67c120d13a865fe3962985f0104c8    
  
author   : David Rowley <[email protected]>    
date     : Sun, 4 Dec 2022 16:18:18 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sun, 4 Dec 2022 16:18:18 +1300    

Click here for diff

Experiments have shown that modern versions of both gcc and clang are  
unable to fully optimize the multiplication by 10 that we're doing in the  
pg_strtointNN functions.  Both compilers seem to be making use of "imul",  
which is not the most efficient way to multiply by 10.  This seems to be  
due to the overflow checking that we're doing.  Without the overflow  
checks, both those compilers switch to a more efficient method of  
multiplying by 10.  In absence of overflow concern, integer multiplication  
by 10 can be done by bit-shifting left 3 places to multiply by 8 and then  
adding the original value twice.  
  
To allow compilers this flexibility, here we adjust the code so that we  
accumulate the number as an unsigned version of the type and remove the  
use of pg_mul_sNN_overflow() and pg_sub_sNN_overflow().  The overflow  
checking can be done simply by checking if the accumulated value has gone  
beyond a 10th of the maximum *signed* value for the given type.  If it has  
then the accumulation of the next digit will cause an overflow.  After  
this is done, we do a final overflow check before converting the unsigned  
version of the number back to its signed counterpart.  
  
Testing has shown about an 8% speedup of a COPY into a table containing 2  
INT columns.  
  
Author: David Rowley, Dean Rasheed  
Discussion: https://postgr.es/m/CAApHDvrL6_+wKgPqRHr7gH_6xy3hXM6a3QCsZ5ForurjDFfenA@mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvrdYByjfj-=WbmVNFgmVZg88-dE7heukw8p55aJ+W=qxQ@mail.gmail.com  

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

Doc: flesh out fmgr/README's description of context-node usage.

commit   : 29452de7341b0effbc275d7e139ade83cebda69f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Dec 2022 10:50:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Dec 2022 10:50:39 -0500    

Click here for diff

I wrote this to provide a home for a planned discussion of error  
return conventions for non-error-throwing functions.  But it seems  
useful as documentation of existing code no matter what becomes of  
that proposal, so commit separately.  

M src/backend/utils/fmgr/README

Fix DEFAULT handling for multi-row INSERT rules.

commit   : 2605643a3a9d789f3a5935810e874c00243d7576    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 3 Dec 2022 12:11:33 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 3 Dec 2022 12:11:33 +0000    

Click here for diff

When updating a relation with a rule whose action performed an INSERT  
from a multi-row VALUES list, the rewriter might skip processing the  
VALUES list, and therefore fail to replace any DEFAULTs in it. This  
would lead to an "unrecognized node type" error.  
  
The reason was that RewriteQuery() assumed that a query doing an  
INSERT from a multi-row VALUES list would necessarily only have one  
item in its fromlist, pointing to the VALUES RTE to read from. That  
assumption is correct for the original query, but not for product  
queries produced for rule actions. In such cases, there may be  
multiple items in the fromlist, possibly including multiple VALUES  
RTEs.  
  
What is required instead is for RewriteQuery() to skip any RTEs from  
the product query's originating query, which might include one or more  
already-processed VALUES RTEs. What's left should then include at most  
one VALUES RTE (from the rule action) to be processed.  
  
Patch by me. Thanks to Tom Lane for reviewing.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAEZATCV39OOW7LAR_Xq4i%2BLc1Byux%3DeK3Q%3DHD_pF1o9LBt%3DphA%40mail.gmail.com  

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

Add missing const qualifier

commit   : f73bd5fd081187a6515d0f0764730958ad6ba41a    
  
author   : David Rowley <[email protected]>    
date     : Sat, 3 Dec 2022 20:33:22 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 3 Dec 2022 20:33:22 +1300    

Click here for diff

This is present in the declaration for ReadDataFromArchive, so we'd better  
have it in the definition too in order to avoid compilers from complaining  
about the mismatch of function signatures.  

M src/bin/pg_dump/compress_io.c

Prevent pgstats from getting confused when relkind of a relation changes

commit   : cb2e7ddfe571e2a158725200a33f728232059c2e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 2 Dec 2022 18:09:55 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 2 Dec 2022 18:09:55 -0800    

Click here for diff

When the relkind of a relache entry changes, because a table is converted into  
a view, pgstats can get confused in 15+, leading to crashes or assertion  
failures.  
  
For HEAD, Tom fixed this in b23cd185fd5, by removing support for converting a  
table to a view, removing the source of the inconsistency. This commit just  
adds an assertion that a relcache entry's relkind does not change, just in  
case we end up with another case of that in the future. As there's no cases of  
changing relkind anymore, we can't add a test that that's handled correctly.  
  
For 15, fix the problem by not maintaining the association with the old pgstat  
entry when the relkind changes during a relcache invalidation processing. In  
that case the pgstat entry needs to be unlinked first, to avoid  
PgStat_TableStatus->relation getting out of sync. Also add a test reproducing  
the issues.  
  
No known problem exists in 11-14, so just add the test there.  
  
Reported-by: vignesh C <[email protected]>  
Author: Andres Freund <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CALDaNm2yXz+zOtv7y5zBd5WKT8O0Ld3YxikuU3dcyCvxF7gypA@mail.gmail.com  
Discussion: https://postgr.es/m/CALDaNm3oZA-8Wbps2Jd1g5_Gjrr-x3YWrJPek-mF5Asrrvz2Dg@mail.gmail.com  
Backpatch: 15-  

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

Fix broken hash function hashbpcharextended().

commit   : 7ac0f8d384a4633c6652ae1f6bba40d42d21ec18    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 1 Dec 2022 11:08:47 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 1 Dec 2022 11:08:47 -0800    

Click here for diff

Ignore trailing spaces for non-deterministic collations when  
hashing.  
  
The previous behavior could lead to tuples falling into the wrong  
partitions when hash partitioning is combined with the BPCHAR type and  
a non-deterministic collation. Fortunately, it did not affect hash  
indexes, because hash indexes do not use extended hash functions.  
  
Decline to backpatch, per discussion.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Richard Guo, Tom Lane  

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

Remove gen_node_support.pl's special treatment of EquivalenceClasses.

commit   : 4c689a69eef639caa881539ee546ff1a5b11f98f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2022 15:20:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2022 15:20:30 -0500    

Click here for diff

It seems better to deal with this by explicit annotations on the  
fields in question, instead of magic knowledge embedded in the  
script.  While that creates a risk-of-omission from failing to  
annotate fields, the preceding commit should catch any such  
oversights.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h

Add some error cross-checks to gen_node_support.pl.

commit   : b6bd5def3a6382995634d33f46d20e191a475914    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2022 15:09:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2022 15:09:51 -0500    

Click here for diff

Check that if we generate a call to copy, compare, write, or read  
a specific node type, that node type does have the appropriate  
support function.  (This doesn't protect against trying to invoke  
nonexistent code when considering generic field types such as  
"Node *", but it seems like a useful check anyway.)  
  
Check that array_size() refers to a field appearing earlier in  
the struct.  Aside from catching obvious errors like a misspelled  
field name, this protects against a more subtle mistake: if the  
size field appears later in the struct than the array field, then  
compare and read functions would misbehave.  There is actually  
exactly that situation in PlannerInfo, but it's okay since we  
do not need compare or read functionality for that (today anyway).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl

Fix psql's \sf and \ef for new-style SQL functions.

commit   : cabfb8241dea84206b90578a769e9cbd813ba477    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2022 14:24:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2022 14:24:44 -0500    

Click here for diff

Some options of these commands need to be able to identify the start  
of the function body within the output of pg_get_functiondef().  
It used to be that that always began with "AS", but since the  
introduction of new-style SQL functions, it might also start with  
"BEGIN" or "RETURN".  Fix that on the psql side, and add some  
regression tests.  
  
Noted by me awhile ago, but I didn't do anything about it.  
Thanks to David Johnston for a nag.  
  
Discussion: https://postgr.es/m/AM9PR01MB8268D5CDABDF044EE9F42173FE8C9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com  

M src/backend/utils/adt/ruleutils.c
M src/bin/psql/command.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Remove logic for converting a table to a view.

commit   : b23cd185fd5410e5204683933f848d4583e34b35    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2022 12:14:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Dec 2022 12:14:32 -0500    

Click here for diff

Up to now we have allowed manual creation of an ON SELECT rule on  
a table to convert it into a view.  That was never anything but a  
horrid, error-prone hack though.  pg_dump used to rely on that  
behavior to deal with cases involving circular dependencies,  
where a dependency loop could be broken by separating the creation  
of a view from installation of its ON SELECT rule.  However, we  
changed pg_dump to use CREATE OR REPLACE VIEW for that in commit  
d8c05aff5 (which was later back-patched as far as 9.4), so there's  
not a good argument anymore for continuing to support the behavior.  
  
The proximate reason for axing it now is that we found that the  
new statistics code has failure modes associated with the relkind  
change caused by this behavior.  We'll patch around that in v15,  
but going forward it seems like a better idea to get rid of the  
need to support relkind changes.  
  
Discussion: https://postgr.es/m/CALDaNm2yXz+zOtv7y5zBd5WKT8O0Ld3YxikuU3dcyCvxF7gypA@mail.gmail.com  

M doc/src/sgml/rules.sgml
M src/backend/rewrite/rewriteDefine.c
M src/test/modules/test_ddl_deparse/expected/create_rule.out
M src/test/modules/test_ddl_deparse/sql/create_rule.sql
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql

doc: Avoid writing in first-person form

commit   : 66456da1505b8347a6d2ddd23b34e62e904c4908    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 2 Dec 2022 13:49:54 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 2 Dec 2022 13:49:54 +0100    

Click here for diff

This rewrites the few places where first-person form was used, and  
replaces with wording more in line with the rest of the documentation.  
  
While there, the section on editing PO files is split between what  
to edit with, and how to edit, as well as add a missing colon.  
  
Author: Daniel Gustafsson <[email protected]>  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/cube.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/pgcrypto.sgml

Report incompatible roles in pg_upgrade checking

commit   : c76da690ba141160d23cae715922932b7efa5b23    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 2 Dec 2022 13:10:21 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 2 Dec 2022 13:10:21 +0100    

Click here for diff

When checking for roles with a pg_ prefix in <= 9.5 servers, report  
all found roles in a text file as how other checks are done instead  
of just reporting that they exist. Rolenames are printed with their  
Oids to match other reports.  
  
Author: Daniel Gustafsson <[email protected]>  
Reviewed-by: Bruce Momjian <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/check.c

doc: fix type alignment for CREATE TABLE in triggers

commit   : ab810062991295f63612a997e872232a6f1a3ef6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 2 Dec 2022 11:31:54 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 2 Dec 2022 11:31:54 +0100    

Click here for diff

Datatypes in CREATE TABLE statements in the examples were vertically  
aligned in most cases, a few examples were unaligned with a single  
space. This makes sure all examples on the same page are consistently  
aligned.  
  
Patch by Laurenz Albe with some additional fixups by me.  
  
Author: Laurenz Albe <[email protected]>  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml

Generalize ri_RootToPartitionMap to use for non-partition children

commit   : fb958b5da86da69651f6fb9f540c2cfb1346cdc5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 2 Dec 2022 10:35:55 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 2 Dec 2022 10:35:55 +0100    

Click here for diff

ri_RootToPartitionMap is currently only initialized for tuple routing  
target partitions, though a future commit will need the ability to use  
it even for the non-partition child tables, so make adjustments to the  
decouple it from the partitioning code.  
  
Also, make it lazily initialized via ExecGetRootToChildMap(), making  
that function its preferred access path.  Existing third-party code  
accessing it directly should no longer do so; consequently, it's been  
renamed to ri_RootToChildMap, which also makes it consistent with  
ri_ChildToRootMap.  
  
ExecGetRootToChildMap() houses the logic of setting the map appropriately  
depending on whether a given child relation is partition or not.  
  
To support this, also add a separate entry point for TupleConversionMap  
creation that receives an AttrMap.  No new code here, just split an  
existing function in two.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqEYUhDXSK5BTvG_xk=eaAEJCD4GS3C6uH7ybBvv+Z_Tmg@mail.gmail.com  

M src/backend/access/common/tupconvert.c
M src/backend/commands/copyfrom.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/backend/replication/logical/worker.c
M src/include/access/tupconvert.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h

Fix incorrect output from pgoutput when using column lists.

commit   : 40b1491357a4a092ea054176944cf76e2fe3eff8    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 2 Dec 2022 10:52:08 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 2 Dec 2022 10:52:08 +0530    

Click here for diff

For Updates and Deletes, we were not honoring the columns list for old  
tuple values while sending tuple data via pgoutput. This results in  
pgoutput emitting more columns than expected.  
  
This is not a problem for built-in logical replication as we simply ignore  
additional columns based on the relation information sent previously which  
didn't have those columns. However, some other users of pgoutput plugin  
may expect the columns as per the column list. Also, sending extra columns  
unnecessarily consumes network bandwidth defeating the purpose of the  
column list feature.  
  
Reported-by: Gunnar Morling  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Backpatch-through: 15  
Discussion: https://postgr.es/m/CADGJaX9kiRZ-OH0EpWF5Fkyh1ZZYofoNRCrhapBfdk02tj5EKg@mail.gmail.com  

M src/backend/replication/logical/proto.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/replication/logicalproto.h
M src/test/subscription/t/031_column_list.pl

autoconf: Don't AC_SUBST() LD in configure

commit   : 069de07eae7328f13be40f1f3988448639c04285    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Dec 2022 19:03:26 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Dec 2022 19:03:26 -0800    

Click here for diff

The only use of $(LD) in Makefiles is for AIX, to generate the export file for  
the backend. We only support the system linker on AIX and we already hardcode  
the path to a number of other binaries. Removing LD substitution will simplify  
the upcoming meson PGXS compatibility.  
  
While at it, add a comment why -r is used.  
  
A subsequent commit will remove the determination of LD from configure as  
well.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/Makefile.global.in
M src/backend/Makefile

autoconf: Unify CFLAGS_SSE42 and CFLAGS_ARMV8_CRC32C

commit   : e0f0e08e17a6186ce299ed8a4385a7a486f304ed    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Dec 2022 18:46:55 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Dec 2022 18:46:55 -0800    

Click here for diff

Until now we emitted the cflags to build the CRC objects into architecture  
specific variables. That doesn't make a whole lot of sense to me - we're never  
going to target x86 and arm at the same time, so they don't need to be  
separate variables.  
  
It might be better to instead continue to have CFLAGS_SSE42 /  
CFLAGS_ARMV8_CRC32C be computed by PGAC_ARMV8_CRC32C_INTRINSICS /  
PGAC_SSE42_CRC32_INTRINSICS and then set CFLAGS_CRC based on those. But it  
seems unlikely that we'd need other sets of CRC specific flags for those two  
architectures at the same time.  
  
This simplifies the upcoming meson PGXS compatibility.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.ac
M src/Makefile.global.in
M src/port/Makefile

Switch pg_dump to use compression specifications

commit   : 5e73a6048849bd7bda4947e39570b9011734114d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 2 Dec 2022 10:45:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 2 Dec 2022 10:45:02 +0900    

Click here for diff

Compression specifications are currently used by pg_basebackup and  
pg_receivewal, and are able to let the user control in an extended way  
the method and level of compression used.  As an effect of this commit,  
pg_dump's -Z/--compress is now able to use more than just an integer, as  
of the grammar "method[:detail]".  
  
The method can be either "none" or "gzip", and can optionally take a  
detail string.  If the detail string is only an integer, it defines the  
compression level.  A comma-separated list of keywords can also be used  
method allows for more options, the only keyword supported now is  
"level".  
  
The change is backward-compatible, hence specifying only an integer  
leads to no compression for a level of 0 and gzip compression when the  
level is greater than 0.  
  
Most of the code changes are straight-forward, as pg_dump was relying on  
an integer tracking the compression level to check for gzip or no  
compression.  These are changed to use a compression specification and  
the algorithm stored in it.  
  
As of this change, note that the dump format is not bumped because there  
is no need yet to track the compression algorithm in the TOC entries.  
Hence, we still rely on the compression level to make the difference  
when reading them.  This will be mandatory once a new compression method  
is added, though.  
  
In order to keep the code simpler when parsing the compression  
specification, the code is changed so as pg_dump now fails hard when  
using gzip on -Z/--compress without its support compiled, rather than  
enforcing no compression without the user knowing about it except  
through a warning.  Like before this commit, archive and custom formats  
are compressed by default when the code is compiled with gzip, and left  
uncompressed without gzip.  
  
Author: Georgios Kokolatos  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/O4mutIrCES8ZhlXJiMvzsivT7ztAMja2lkdL1LJx6O5f22I2W8PBIeLKz7mDLwxHoibcnRAYJXm1pH4tyUNC4a8eDzLn22a6Pb1S74Niexg=@pm.me  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/tools/pgindent/typedefs.list

Fix memory leak for hashing with nondeterministic collations.

commit   : edf12e7bbd0f5cf6b3c4f4d6b2dad8586b10dcc6    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 1 Dec 2022 11:26:32 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 1 Dec 2022 11:26:32 -0800    

Click here for diff

Backpatch through 12, where nondeterministic collations were  
introduced (5e1963fb76).  
  
Backpatch-through: 12  

M src/backend/access/hash/hashfunc.c
M src/backend/utils/adt/varchar.c

Doc: add example of round(v, s) with negative s.

commit   : a109a0bb50ad47812b8818e9c98e4f311672d659    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2022 12:26:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2022 12:26:12 -0500    

Click here for diff

This has always worked, but you'd be unlikely to guess it  
from the documentation.  Add an example showing it.  
  
Lack of docs noted by David Johnston.  Back-patch to v13;  
the documentation layout we used before that was not very  
amenable to squeezing in multiple examples.  
  
Discussion: https://postgr.es/m/CAKFQuwZ4Vy1Xty0G5Ok+ot=NDrU3C6hzF1JwUk-FEkwe3V9_RA@mail.gmail.com  

M doc/src/sgml/func.sgml

Doc: word-smith the discussion of secure schema usage patterns.

commit   : ef2d7c6f0ba9829090562434df9b308dc86a4042    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2022 12:10:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2022 12:10:25 -0500    

Click here for diff

Rearrange the discussion of user-private schemas so that details  
applying only to upgraded-from-pre-v15 databases are in a follow-on  
paragraph, not in the main description of how to set up this pattern.  
This seems a little clearer even today, and it'll get more so as  
pre-v15 systems fade into the sunset.  
  
Wording contributions from Robert Haas, Tom Lane, Noah Misch.  
  
Discussion: https://postgr.es/m/CA+TgmoYUHsfp90inEMAP0yNr7Y_L6EphPH1YOon1JKtBztXHyQ@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Fix under-parenthesized display of AT TIME ZONE constructs.

commit   : 1dd6700f44d2e14616d464a5f490552b7036ad3f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2022 11:38:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Dec 2022 11:38:06 -0500    

Click here for diff

In commit 40c24bfef, I forgot to use get_rule_expr_paren() for the  
arguments of AT TIME ZONE, resulting in possibly not printing parens  
for expressions that need it.  But get_rule_expr_paren() wouldn't have  
gotten it right anyway, because isSimpleNode() hadn't been taught that  
COERCE_SQL_SYNTAX parent nodes don't guarantee sufficient parentheses.  
Improve all that.  Also use this methodology for F_IS_NORMALIZED, so  
that we don't print useless parens for that.  
  
In passing, remove a comment that was obsoleted later.  
  
Per report from Duncan Sands.  Back-patch to v14 where this code  
came in.  (Before that, we didn't try to print AT TIME ZONE that way,  
so there was no bug just ugliness.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

revert: add transaction processing chapter with internals info

commit   : 4dd00b042fe88bfbf7ce6400c69ee232e9eb6e48    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 1 Dec 2022 10:45:08 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 1 Dec 2022 10:45:08 -0500    

Click here for diff

This doc patch (master hash 66bc9d2d3e) was decided to be too  
significant for backpatching, so reverted in all but master.  Also fix  
SGML file header comment in master.  
  
Reported-by:  	Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/xact.sgml

doc: Add installation instructions for building with meson

commit   : 4c72102e1d45f787db958204a6f7097c1e2a435e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Dec 2022 15:32:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Dec 2022 15:32:38 +0100    

Click here for diff

Author: samay sharma <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Nazir Bilal Yavuz <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAJxrbywFPcgC4nP_v+HHPhaYSWX2JL8FZXY2aFOZxXxTkTJJPw@mail.gmail.com  

M doc/src/sgml/installation.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/regress.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/standalone-install.xml

Move PartitioPruneInfo out of plan nodes into PlannedStmt

commit   : ec386948948c1708c0c28c48ef08b9c4dd9d47cc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 1 Dec 2022 12:56:21 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 1 Dec 2022 12:56:21 +0100    

Click here for diff

The planner will now add a given PartitioPruneInfo to  
PlannedStmt.partPruneInfos instead of directly to the  
Append/MergeAppend plan node.  What gets set instead in the  
latter is an index field which points to the list element  
of PlannedStmt.partPruneInfos containing the PartitioPruneInfo  
belonging to the plan node.  
  
A later commit will make AcquireExecutorLocks() do the initial  
partition pruning to determine a minimal set of partitions to be  
locked when validating a plan tree and it will need to consult the  
PartitioPruneInfos referenced therein to do so.  It would be better  
for the PartitioPruneInfos to be accessible directly than requiring  
a walk of the plan tree to find them, which is easier when it can be  
done by simply iterating over PlannedStmt.partPruneInfos.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqFGkMSge6TgC9KQzde0ohpAycLQuV7ooitEEpbKB0O_mg@mail.gmail.com  

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: Remove note about disk space from installation instructions

commit   : de867c9c5379216bbeb18875eaeae9539fd1534a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Dec 2022 11:44:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Dec 2022 11:44:50 +0100    

Click here for diff

Seems quite outdated and no longer relevant.  
  
Author: samay sharma <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAJxrbywFPcgC4nP_v+HHPhaYSWX2JL8FZXY2aFOZxXxTkTJJPw@mail.gmail.com  

M doc/src/sgml/installation.sgml

doc: Add missing comma

commit   : 148e0bd4d6177cdac0a2f3dd4a20190178333c0d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Dec 2022 11:42:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Dec 2022 11:42:19 +0100    

Click here for diff

Author: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20221020024312.GH16921%40telsasoft.com  

M doc/src/sgml/installation.sgml

Make materialized views participate in predicate locking

commit   : 43351557d0d2b9c5e20298b5fee2849abef86aff    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 1 Dec 2022 15:41:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 1 Dec 2022 15:41:13 +0900    

Click here for diff

Matviews have been discarded from needing predicate locks since 3bf3ab8  
and their introduction.  At this point, there was no concurrent flavor  
of REFRESH yet, hence there was no meaning in having materialized views  
look at read/write conflicts with concurrent transactions using  
themselves the serializable isolation level because they could only be  
refreshed with an access exclusive lock.  CONCURRENTLY, on the contrary,  
allows reads and writes during a refresh as it holds a share update  
exclusive lock.  
  
Some isolation tests are added to show the effect of the change, with a  
combination of one table and a matview based on it, using a mix of  
REFRESH CONCURRENTLY and read/write queries.  
  
This could arguably be considered as a bug, but as it is a subtle  
behavior change potentially impacting applications no backpatch is  
done.  
  
Author: Yugo Nagata  
Reviewed-by: Richard Guo, Dilip Kumar, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/predicate.c
A src/test/isolation/expected/matview-write-skew.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/matview-write-skew.spec

Reject missing database name in pg_regress and cohorts.

commit   : d5515ca7cf1b095fab65c93710c71fece5baf67e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2022 13:01:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Nov 2022 13:01:41 -0500    

Click here for diff

Writing "pg_regress --dbname= ..." led to a crash, because  
we weren't expecting there to be no database name supplied.  
It doesn't seem like a great idea to run regression tests  
in whatever is the user's default database; so rather than  
supporting this case let's explicitly reject it.  
  
Per report from Xing Guo.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CACpMh+A8cRvtvtOWVAZsCM1DU81GK4DL26R83y6ugZ1osV=ifA@mail.gmail.com  

M src/test/regress/pg_regress.c

Bump catalog version for previous commit

commit   : 8f2e74bf87e8c60c4984924caa67b723c51e0a6e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 30 Nov 2022 12:09:13 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 30 Nov 2022 12:09:13 +0100    

Click here for diff

M src/include/catalog/catversion.h

Stop accessing checkAsUser via RTE in some cases

commit   : 599b33b9492dfefd1219c1d31801f40b3ba90b0d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 30 Nov 2022 12:07:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 30 Nov 2022 12:07:03 +0100    

Click here for diff

A future commit will move the checkAsUser field from RangeTblEntry  
to a new node that, unlike RTEs, will only be created for tables  
mentioned in the query but not for the inheritance child relations  
added to the query by the planner.  So, checkAsUser value for a  
given child relation will have to be obtained by referring to that  
for its ancestor mentioned in the query.  
  
In preparation, it seems better to expand the use of RelOptInfo.userid  
during planning in place of rte->checkAsUser so that there will be  
fewer places to adjust for the above change.  
  
Given that the child-to-ancestor mapping is not available during the  
execution of a given "child" ForeignScan node, add a checkAsUser  
field to ForeignScan to carry the child relation's RelOptInfo.userid.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqGFCs2uq7VRKi7g+FFKbP6Ea_2_HkgZb2HPhUfaAKT3ng@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/executor/execMain.c
M src/backend/optimizer/plan/createplan.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/misc/rls.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h

Add regression tests for psql's \o and \g on files

commit   : d2a4490401f2ddc878134a1fd75ef4482e403e47    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Nov 2022 14:46:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Nov 2022 14:46:43 +0900    

Click here for diff

This adds coverage for a few scenarios not checked yet in psql, with  
multiple query combined across files defined by \o, \g or both at the  
same time.  The results are saved in the output files defined, then  
reloaded back to check what has been written to them.  
  
Author: Daniel Verite  
Discussion: https://postgr.es/m/[email protected]  

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

doc: add transaction processing chapter with internals info

commit   : 66bc9d2d3e57acca20bcb0b6deb225abb01384bf    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 29 Nov 2022 20:49:52 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 29 Nov 2022 20:49:52 -0500    

Click here for diff

This also adds references to this new chapter at relevant sections of  
our documentation.  Previously much of these internal details were  
exposed to users, but not explained.  This also updates RELEASE  
SAVEPOINT.  
  
Discussion: https://postgr.es/m/CANbhV-E_iy9fmrErxrCh8TZTyenpfo72Hf_XD2HLDppva4dUNA@mail.gmail.com  
  
Author: Simon Riggs, Laurenz Albe  
  
Reviewed-by: Bruce Momjian  
  
Backpatch-through: 11  

M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pgrowlocks.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/release_savepoint.sgml
M doc/src/sgml/ref/rollback.sgml
M doc/src/sgml/ref/rollback_to.sgml
M doc/src/sgml/system-views.sgml
M doc/src/sgml/wal.sgml
A doc/src/sgml/xact.sgml

Refactor code parsing compression option values (-Z/--compress)

commit   : d18655cc037a811b936971e99af4a2427a9739d6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Nov 2022 09:34:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Nov 2022 09:34:32 +0900    

Click here for diff

This commit moves the code in charge of deparsing the method and detail  
strings fed later to parse_compress_specification() to a common routine,  
where the backward-compatible case of only an integer being found (N  
= 0 => "none", N > 1 => gzip at level N) is handled.  
  
Note that this has a side-effect for pg_basebackup, as we now attempt to  
detect "server-" and "client-" before checking for the integer-only  
pre-14 grammar, where values like server-N and client-N (without the  
follow-up detail string) are now valid rather than failing because of an  
unsupported method name.  Past grammars are still handled the same way,  
but these flavors are now authorized, and would now switch to consider N  
= 0 as no compression and N > 1 as gzip with the compression level used  
as N, with the caller still controlling if the compression method should  
be done server-side, client-side or is unspecified.  The documentation  
of pg_basebackup is updated to reflect that.  
  
This benefits other code paths that would like to rely on the same logic  
as pg_basebackup and pg_receivewal with option values used for  
compression specifications, one area discussed lately being pg_dump.  
  
Author: Georgios Kokolatos, Michael Paquier  
Discussion: https://postgr.es/m/O4mutIrCES8ZhlXJiMvzsivT7ztAMja2lkdL1LJx6O5f22I2W8PBIeLKz7mDLwxHoibcnRAYJXm1pH4tyUNC4a8eDzLn22a6Pb1S74Niexg=@pm.me  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/common/compression.c
M src/include/common/compression.h

Fix comment in fe-auth-scram.c

commit   : d74a366aa2fa3f11fc4fbd1b2817ac252f6f9ba4    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Nov 2022 08:37:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Nov 2022 08:37:59 +0900    

Click here for diff

The frontend-side routine in charge of building a SCRAM verifier  
mentioned that the restrictions applying to SASLprep on the password  
with the encoding are described at the top of fe-auth-scram.c, but this  
information is in auth-scram.c.  
  
This is wrong since 8f8b9be, so backpatch all the way down as this is an  
important documentation bit.  
  
Spotted while reviewing a different patch.  
  
Backpatch-through: 11  

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

Improve heuristics for compressing the KnownAssignedXids array.

commit   : 8242752f9c104030085cb167e6e1dd5bed481360    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2022 15:43:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2022 15:43:17 -0500    

Click here for diff

Previously, we'd compress only when the active range of array entries  
reached Max(4 * PROCARRAY_MAXPROCS, 2 * pArray->numKnownAssignedXids).  
If max_connections is large, the first term could result in not  
compressing for a long time, resulting in much wastage of cycles in  
hot-standby backends scanning the array to take snapshots.  Get rid  
of that term, and just bound it to 2 * pArray->numKnownAssignedXids.  
  
That however creates the opposite risk, that we might spend too much  
effort compressing.  Hence, consider compressing only once every 128  
commit records.  (This frequency was chosen by benchmarking.  While  
we only tried one benchmark scenario, the results seem stable over  
a fairly wide range of frequencies.)  
  
Also, force compression when processing RecoveryInfo WAL records  
(which should be infrequent); the old code could perform compression  
then, but would do so only after the same array-range check as for  
the transaction-commit path.  
  
Also, opportunistically run compression if the startup process is about  
to wait for WAL, though not oftener than once a second.  This should  
prevent cases where we waste lots of time by leaving the array  
not-compressed for long intervals due to low WAL traffic.  
  
Lastly, add a simple check to keep us from uselessly compressing  
when the array storage is already compact.  
  
Back-patch, as the performance problem is worse in pre-v14 branches  
than in HEAD.  
  
Simon Riggs and Michail Nikolaev, with help from Tom Lane and  
Andres Freund.  
  
Discussion: https://postgr.es/m/CALdSSPgahNUD_=pB_j=1zSnDBaiOtqVfzo8Ejt5J_k7qZiU1Tw@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/storage/ipc/procarray.c
M src/include/storage/procarray.h

Prevent clobbering of utility statements in SQL function caches.

commit   : 8b47ccb624f8bffc1789fe11769a706c2050f171    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2022 11:46:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2022 11:46:33 -0500    

Click here for diff

This is an oversight in commit 7c337b6b5: I apparently didn't think  
about the possibility of a SQL function being executed multiple  
times within a query.  In that case, functions.c's primitive caching  
mechanism allows the same utility parse tree to be presented for  
execution more than once.  We have to tell ProcessUtility to make  
a working copy of the parse tree, or bad things happen.  
  
Normally I'd add a regression test, but I think the reported crasher  
is dependent on some rather random implementation choices that are  
nowhere near functions.c, so its usefulness as a long-lived test  
feels questionable.  In any case, this fix is clearly correct given  
the design choices of 7c337b6b5.  
  
Per bug #17702 from Xin Wen.  Thanks to Daniel Gustafsson for  
analysis.  Back-patch to v14 where the faulty commit came in  
(before that, the responsibility for copying scribble-able  
utility parse trees lay elsewhere).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/functions.c

Remove bogus Assert and dead code in remove_useless_results_recurse().

commit   : 51dfaa0b010c1efba8a4137cfccd5fbb7f5d4afd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2022 10:52:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Nov 2022 10:52:44 -0500    

Click here for diff

The JOIN_SEMI case Assert'ed that there are no PlaceHolderVars that  
need to be evaluated at the semijoin's RHS, which is wrong because  
there could be some in the semijoin's qual condition.  However, there  
could not be any references further up than that, and within the qual  
there is not any way that such a PHV could have gone to null yet, so  
we don't really need the PHV and there is no need to avoid making the  
RHS-removal optimization.  The upshot is that there's no actual bug  
in production code, and we ought to just remove this misguided Assert.  
  
While we're here, also drop the JOIN_RIGHT case, which is dead code  
because reduce_outer_joins() already got rid of JOIN_RIGHT.  
  
Per bug #17700 from Xin Wen.  Uselessness of the JOIN_RIGHT case  
pointed out by Richard Guo.  Back-patch to v12 where this code  
was added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add 'missing_ok' argument to build_attrmap_by_name

commit   : ad86d159b6ab90b195b06fb5c7b593900a7f9cd8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Nov 2022 09:39:36 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Nov 2022 09:39:36 +0100    

Click here for diff

When it's given as true, return a 0 in the position of the missing  
column rather than raising an error.  
  
This is currently unused, but it allows us to reimplement column  
permission checking in a subsequent commit.  It seems worth breaking  
into a separate commit because it affects unrelated code.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqFfiai=qBxPDTjaio_ZcaqUKh+FC=prESrB8ogZgFNNNQ@mail.gmail.com  

M src/backend/access/common/attmap.c
M src/backend/access/common/tupconvert.c
M src/backend/catalog/partition.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/access/attmap.h

meson: Add some missing env settings for tests of pg_dump and pg_verifybackup

commit   : 00ae5d6f588e9d21fa4f4d267811f3f602fe45af    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Nov 2022 13:33:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Nov 2022 13:33:31 +0900    

Click here for diff

The commands used for the compression tests were missing in a few  
places, causing the tests related to these to never run.  
  
Georgios has spotted GZIP_PROGRAM missing in pg_dump, while I have  
noticed the ones missing in pg_verifybackup while looking at the rest of  
the tree.  
  
Author: Georgios Kokolatos, Michael Paquier  
Discussion: https://postgr.es/m/O4mutIrCES8ZhlXJiMvzsivT7ztAMja2lkdL1LJx6O5f22I2W8PBIeLKz7mDLwxHoibcnRAYJXm1pH4tyUNC4a8eDzLn22a6Pb1S74Niexg=@pm.me  

M src/bin/pg_dump/meson.build
M src/bin/pg_verifybackup/meson.build

Fix comment in snapbuild.c

commit   : 8aa03f3caaed9dd438a20c3423daa43a44549d60    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Nov 2022 08:53:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Nov 2022 08:53:01 +0900    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoAmf-PkSnMGAJg2DtGhp7O7vpHoexCxfQLKZg8xrbRwsg@mail.gmail.com  

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

Remove promote_trigger_file.

commit   : cd4329d9393f84dce34f0bd2dd936adc8ffaa213    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 29 Nov 2022 11:28:08 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 29 Nov 2022 11:28:08 +1300    

Click here for diff

Previously, an idle startup (recovery) process would wake up every 5  
seconds to have a chance to poll for promote_trigger_file, even if that  
GUC was not configured.  That promotion triggering mechanism was  
effectively superseded by pg_ctl promote and pg_promote() a long time  
ago.  There probably aren't many users left and it's very easy to change  
to the modern mechanisms, so we agreed to remove the feature.  
  
This is part of a campaign to reduce wakeups on idle systems.  
  
Author: Simon Riggs <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Ian Lawrence Barwick <[email protected]>  
Discussion: https://postgr.es/m/CANbhV-FsjnzVOQGBpQ589%3DnWuL1Ex0Ykn74Nh1hEjp2usZSR5g%40mail.gmail.com  

M doc/src/sgml/appendix-obsolete-recovery-config.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/xlogrecovery.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlogrecovery.h

meson: Fix binary mismatch for MSVC plperl vs gcc built perl libs

commit   : f0cd57f852cb88a4252db175317ec4627ec1b1cd    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 28 Nov 2022 11:41:39 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 28 Nov 2022 11:41:39 -0800    

Click here for diff

This mirrors ccc59a83cd9.  

M meson.build

Provide non-superuser predefined roles for vacuum and analyze

commit   : 4441fc704d7048b2f1f039cc74b72bd23e7e36d0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Nov 2022 11:57:28 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Nov 2022 11:57:28 -0500    

Click here for diff

This provides two new predefined roles: pg_vacuum_all_tables and  
pg_analyze_all_tables. Roles which have been granted these roles can  
perform vacuum or analyse respectively on any or all tables as if they  
were a superuser. This removes the need to grant superuser privilege to  
roles just so they can perform vacuum and/or analyze.  
  
Nathan Bossart  
  
Reviewed by: Bharath Rupireddy, Kyotaro Horiguchi, Stephen Frost, Robert  
Haas, Mark Dilger, Tom Lane, Corey Huinker, David G. Johnston, Michael  
Paquier.  
  
Discussion: https://postgr.es/m/20220722203735.GB3996698@nathanxps13  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/catalog/aclchk.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Provide per-table permissions for vacuum and analyze.

commit   : b5d6382496f2b8fc31abd92c2654a9a67aca76c6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Nov 2022 10:08:42 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Nov 2022 10:08:42 -0500    

Click here for diff

Currently a table can only be vacuumed or analyzed by its owner or  
a superuser. This can now be extended to any user by means of an  
appropriate GRANT.  
  
Nathan Bossart  
  
Reviewed by: Bharath Rupireddy, Kyotaro Horiguchi, Stephen Frost, Robert  
Haas, Mark Dilger, Tom Lane, Corey Huinker, David G. Johnston, Michael  
Paquier.  
  
Discussion: https://postgr.es/m/20220722203735.GB3996698@nathanxps13  

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/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/catalog/aclchk.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/backend/parser/gram.y
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/commands/vacuum.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h
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/expected/vacuum.out
M src/test/regress/sql/dependency.sql
M src/test/regress/sql/privileges.sql

doc: Clarify unit of logging for log_temp_files

commit   : 1f059a440864021b23b0667e7c0cb664710b660d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 28 Nov 2022 11:10:01 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 28 Nov 2022 11:10:01 +0100    

Click here for diff

When the unit is omitted from log_temp_files the value is taken as kb,  
but the logged value is also without unit but specified in bytes. This  
could cause some confusion, so clarify in the documentation which unit  
is used when logging.  
  
Reported-by: [email protected]  
Reviewed-by: Bruce Momjian <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Add TAP tests for include directives in HBA end ident files

commit   : cbe6e482d7bf851c6e466697a21dcef7b05cbb59    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Nov 2022 15:19:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Nov 2022 15:19:06 +0900    

Click here for diff

This commit adds a basic set of authentication tests to check after the  
new keywords added by a54b658 for the HBA and ident files, aka  
"include", "include_if_exists" and "include_dir".  
  
This includes checks for all the positive cases originally proposed,  
where valid contents are generated for the HBA and ident files without  
any errors happening in the server, checking as well the contents of  
their respective system views.  The error handling will be evaluated  
separately (-DEXEC_BACKEND makes that trickier), and what we have here  
covers most of the ground I would like to see covered if one manipulates  
the tokenization logic of hba.c in the future.  
  
While on it, some coverage is added for files included with '@' for  
database or user name lists.  
  
Author: Julien Rouhaud  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M src/test/authentication/meson.build
A src/test/authentication/t/004_file_inclusion.pl

Doc: update queries.sgml for optional subquery aliases.

commit   : ec25ba624e9c0168d44c9f6e87872f1e3e6b308f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Nov 2022 12:26:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Nov 2022 12:26:04 -0500    

Click here for diff

Commit bcedd8f5f made subquery aliases optional in the FROM clause.  
It missed updating this part of the docs, though.  

M doc/src/sgml/queries.sgml

Fix binary mismatch for MSVC plperl vs gcc built perl libs

commit   : ccc59a83cd977608564a6f11ffcb2ec1773a9e94    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 27 Nov 2022 09:03:22 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 27 Nov 2022 09:03:22 -0500    

Click here for diff

When loading plperl built against Strawberry perl or the msys2 ucrt perl  
that have been built with gcc, a binary mismatch has been encountered  
which looks like this:  
  
loadable library and perl binaries are mismatched (got handshake key 0000000012800080, needed 0000000012900080)  
  
To cure this we bring the handshake keys into sync by adding  
NO_THREAD_SAFE_LOCALE to the defines used to build plperl.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to all live branches.  

M src/tools/msvc/Mkvcbuild.pm

Remove temporary portlock directory during make [dist]clean.

commit   : 3274ec05c86730ff577f463e4e7b0259fb2bf684    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Nov 2022 10:30:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Nov 2022 10:30:31 -0500    

Click here for diff

Another oversight in 9b4eafcaf.  

M GNUmakefile.in

Add portlock directory to .gitignore

commit   : 822e8836d5c895e454d8a22c674456cb9a9a2f44    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 26 Nov 2022 07:44:23 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 26 Nov 2022 07:44:23 -0500    

Click here for diff

Commit 9b4eafcaf4 added creattion of a directory to reserve TAP test  
ports at the top of the build tree. In a non-vpath build this means at  
the top of the source tree, so it needs to be added to .gitignore.  
  
As suggested by Michael Paquier  
  
Backpatch to all live branches.  

M .gitignore

Mark two signal flags as sig_atomic_t in pgbench and pg_test_fsync

commit   : 1e314847dd69c6b3b85d36e5873d80b9e4cf028a    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 26 Nov 2022 20:12:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 26 Nov 2022 20:12:33 +0900    

Click here for diff

Two booleans used for timeout tracking were used within some SIGALRM  
signal handlers, but they were not declared as sig_atomic_t, so mark  
them as such.  This has no consequence on WIN32 for both tools.  
  
Author: Ranier Vilela  
Reviewed-by: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/CAEudQArCDQQiPiFR16=yu9k5s2tp4tgEe1U1ZbkW4ofx81AWWQ@mail.gmail.com  

M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pgbench/pgbench.c

Fix typo in hba.c

commit   : 02ac05b4c0229bd662b3afa07f370df0a5cbdb54    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 26 Nov 2022 10:14:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 26 Nov 2022 10:14:18 +0900    

Click here for diff

Spotted while reading through the git history.  

M src/backend/libpq/hba.c

Allow building with MSVC and Strawberry perl

commit   : 341f4e002d461a3c5513cb864490cddae2b43a64    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 25 Nov 2022 15:28:38 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 25 Nov 2022 15:28:38 -0500    

Click here for diff

Strawberry uses __builtin_expect which Visual C doesn't have. For this  
case define it as a noop. Solution taken from vim sources.  
  
Backpatch to all live branches  

M src/pl/plperl/plperl.h

Correct some SQL feature names

commit   : d94f29cb8910a380caa795f56e69ed036fb8c5d0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Nov 2022 16:56:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Nov 2022 16:56:05 +0100    

Click here for diff

Maybe these were initially typos or they have been changed upstream  
since we first added them.  This brings it all in line with SQL:2016.  

M src/backend/catalog/sql_features.txt

Fix gen_node_support.pl for changed AclMode size

commit   : 50617a9aa37344c2dbc89dba0a2193723202e7aa    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 25 Nov 2022 08:55:56 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 25 Nov 2022 08:55:56 -0500    

Click here for diff

omitted from 7b378237aa, mea culpa.  
  
Complaint and fix from Amit Langote.  

M src/backend/nodes/gen_node_support.pl

Fix rule-detection code for MERGE.

commit   : 7b2ccc5e03bf16d1e1bbabca25298108c839ec52    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 25 Nov 2022 13:31:48 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 25 Nov 2022 13:31:48 +0000    

Click here for diff

Use the relation's rd_rules structure to test whether it has rules,  
rather than the relhasrules flag, which might be out of date.  
  
Reviewed by Tom Lane.  
  
Backpatch to 15, where MERGE was added.  
  
Discussion: https://postgr.es/m/CAEZATCVkBVZABfw71sYvkcPf6tarcOFST5Bc6AOi-LFT9YdccQ%40mail.gmail.com  

M src/backend/parser/parse_merge.c

doc: Re-order Table 28.35 "Per-Backend Statistics Functions"

commit   : b1d0158060f3128331766156798d16b2227fb451    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Nov 2022 13:00:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Nov 2022 13:00:35 +0100    

Click here for diff

The overall order is alphabetic, but there were a few additions that  
didn't observe this.  
  
Author: Peter Smith <[email protected]>  
Reviewed-by: David G. Johnston <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAHut+Pv8Oa7v06hJb3+HzCtM2u-3oHWMdvXVHhvi7ofB83pNbg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

doc: Re-order Table 28.12 "Wait Events of type LWLock"

commit   : 9c558b94f0cab351658acdbe7bb0ce7e20007965    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Nov 2022 12:13:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Nov 2022 12:13:43 +0100    

Click here for diff

The overall order is alphabetic, but there were a few additions that  
didn't observe this.  
  
Author: Peter Smith <[email protected]>  
Reviewed-by: David G. Johnston <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAHut+Pv8Oa7v06hJb3+HzCtM2u-3oHWMdvXVHhvi7ofB83pNbg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

doc: Re-order sections of "28.4. Progress Reporting"

commit   : 6573643501e982b85f893f45a0cdc237cdb3c653    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Nov 2022 11:50:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Nov 2022 11:50:36 +0100    

Click here for diff

BEFORE  
28.4.1. ANALYZE Progress Reporting  
28.4.2. CREATE INDEX Progress Reporting  
28.4.3. VACUUM Progress Reporting  
28.4.4. CLUSTER Progress Reporting  
28.4.5. Base Backup Progress Reporting  
28.4.6. COPY Progress Reporting  
  
AFTER  
28.4.1. ANALYZE Progress Reporting  
28.4.2. CLUSTER Progress Reporting  
28.4.3. COPY Progress Reporting  
28.4.4. CREATE INDEX Progress Reporting  
28.4.5. VACUUM Progress Reporting  
28.4.6. Base Backup Progress Reporting  
  
Author: Peter Smith <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAHut+Pv8Oa7v06hJb3+HzCtM2u-3oHWMdvXVHhvi7ofB83pNbg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Fix handling of pending inserts in nodeModifyTable.c.

commit   : ffbb7e65a873e8f1584d2e593416fbe3adc130b6    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 25 Nov 2022 17:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 25 Nov 2022 17:45:00 +0900    

Click here for diff

Commit b663a4136, which allowed FDWs to INSERT rows in bulk, added to  
nodeModifyTable.c code to flush pending inserts to the foreign-table  
result relation(s) before completing processing of the ModifyTable node,  
but the code failed to take into account the case where the INSERT query  
has modifying CTEs, leading to incorrect results.  
  
Also, that commit failed to flush pending inserts before firing BEFORE  
ROW triggers so that rows are visible to such triggers.  
  
In that commit we scanned through EState's  
es_tuple_routing_result_relations or es_opened_result_relations list to  
find the foreign-table result relations to which pending inserts are  
flushed, but that would be inefficient in some cases.  So to fix, 1) add  
a List member to EState to record the insert-pending result relations,  
and 2) modify nodeModifyTable.c so that it adds the foreign-table result  
relation to the list in ExecInsert() if appropriate, and flushes pending  
inserts properly using the list where needed.  
  
While here, fix a copy-and-pasteo in a comment in ExecBatchInsert(),  
which was added by that commit.  
  
Back-patch to v14 where that commit appeared.  
  
Discussion: https://postgr.es/m/CAPmGK16qutyCmyJJzgQOhfBq%3DNoGDqTB6O0QBZTihrbqre%2BoxA%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/include/nodes/execnodes.h

Skip TAP test for peer authentication if there are no unix-domain sockets

commit   : 9e492d6b693a60d53a5d3d8fbd40ae253b7d22f5    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Nov 2022 16:37:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Nov 2022 16:37:49 +0900    

Click here for diff

Peer connections require support for local connections to work, but the  
test missed the same check as the other ones in this suite.  The  
buildfarm does not run the authentication tests on Windows, and, more  
surprisingly, the CI with meson was already able to skip it.  
  
Author: Anton A. Melnikov  
Discussion: https://postgr.es/m/[email protected]  

M src/test/authentication/t/003_peer.pl

Introduce variables for initial and max nesting depth on configuration files

commit   : d13b684117bdf136f97db5bcba2be524ed038b6d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Nov 2022 07:40:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Nov 2022 07:40:12 +0900    

Click here for diff

The code has been assuming already in a few places that the initial  
recursion nesting depth is 0, and the recent changes in hba.c (mainly  
783e8c6) have relies on this assumption in more places.  The maximum  
recursion nesting level is assumed to be 10 for hba.c and GUCs.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20221124090724.n7amf5kpdhx6vb76@jrouhaud  

M src/backend/commands/extension.c
M src/backend/libpq/hba.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/include/utils/conffiles.h

Fix some 32-bit shift warnings in MSVC

commit   : 2d1f3bce97a9f4ac3ec4acbf337ffef598522216    
  
author   : David Rowley <[email protected]>    
date     : Fri, 25 Nov 2022 11:05:22 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 25 Nov 2022 11:05:22 +1300    

Click here for diff

7b378237a widened AclMode to 64 bits which resulted in 3 new additional  
warnings on MSVC.  Here we make use of UINT64CONST to reassure the  
compiler that we do intend the bit shift expression to yield a 64-bit  
result.  
  
Discussion: https://postgr.es/m/CAApHDvo=pn01Y_3zASZZqn+cotF1c4QFCwWgk6MiF0VscaE5ug@mail.gmail.com  

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

Improve indenting in _hash_pgaddtup

commit   : ec5affdbc283252327e217f99c45574eb63de051    
  
author   : David Rowley <[email protected]>    
date     : Fri, 25 Nov 2022 10:10:44 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 25 Nov 2022 10:10:44 +1300    

Click here for diff

The Assert added in d09dbeb9b came out rather ugly after having run  
pgindent on that code.  Here we adjust things to use some local variables  
so that the Assert remains within the 80-character margin.  
  
Author: Ted Yu  
Discussion: https://postgr.es/m/CALte62wLSir1=x93Jf0xZvHaO009FEJfhVMFwnaR8q=csPP8kQ@mail.gmail.com  

M src/backend/access/hash/hashinsert.c

Make multixact error message more explicit

commit   : 2cf41cd30997f6a79fb962007a3cd11edcf9d013    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 24 Nov 2022 10:45:10 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 24 Nov 2022 10:45:10 +0100    

Click here for diff

There are recent reports involving a very old error message that we have  
no history of hitting -- perhaps a recently introduced bug.  Improve the  
error message in an attempt to improve our chances of investigating the  
bug.  
  
Per reports from Dimos Stamatakis and Bob Krier.  
  
Backpatch to 11.  
  
Discussion: https://postgr.es/m/CO2PR0801MB2310579F65529380A4E5EDC0E20A9@CO2PR0801MB2310.namprd08.prod.outlook.com  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Fix description of how the default user name is chosen

commit   : 385da7306c7fce210bd059ad97ebb3e19699e161    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Nov 2022 09:04:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Nov 2022 09:04:50 +0100    

Click here for diff

This makes the distinction between operating-system user name and  
database user name a bit clearer.  It also clarifies that the user  
name is determined first, and then the default database name.  
  
Author: David G. Johnston <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAKFQuwZUhgz=sUi+wGQV-PBTNjMovuA-BOV88RV-Vw0m0drCAg@mail.gmail.com  

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

Add the database name to the ps display of logical WAL senders

commit   : af205152ef57cf54730c38342878cb6b9f8ce7a1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 16:07:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 16:07:59 +0900    

Click here for diff

Logical WAL senders display now as follows, gaining a database name:  
postgres: walsender USER DATABASE HOST(PORT) STATE  
  
Physical WAL senders show up the same, as of:  
postgres: walsender USER HOST(PORT) STATE  
  
This information was missing, hence it was not possible to know from ps  
if a WAL sender was a logical or a physical one, and on which database  
it is connected when it is logical.  
  
Author: Tatsuhiro Nakamori  
Reviewed-by: Fujii Masao, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Add support for file inclusions in HBA and ident configuration files

commit   : a54b658ce77b6705eb1f997b416c2e820a77946c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 13:51:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 13:51:34 +0900    

Click here for diff

pg_hba.conf and pg_ident.conf gain support for three record keywords:  
- "include", to include a file.  
- "include_if_exists", to include a file, ignoring it if missing.  
- "include_dir", to include a directory of files.  These are classified  
by name (C locale, mostly) and need to be prefixed by ".conf", hence  
following the same rules as GUCs.  
  
This commit relies on the refactoring pieces done in efc9816, ad6c528,  
783e8c6 and 1b73d0b, adding a small wrapper to build a list of  
TokenizedAuthLines (tokenize_include_file), and the code is shaped to  
offer some symmetry with what is done for GUCs with the same options.  
  
pg_hba_file_rules and pg_ident_file_mappings gain a new field called  
file_name, to track from which file a record is located, taking  
advantage of the addition of rule_number in c591300 to offer an  
organized view of the HBA or ident records loaded.  
  
Bump catalog version.  
  
Author: Julien Rouhaud  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/system-views.sgml
M src/backend/libpq/hba.c
M src/backend/libpq/pg_hba.conf.sample
M src/backend/libpq/pg_ident.conf.sample
M src/backend/utils/adt/hbafuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out

Speedup hash index builds by skipping needless binary searches

commit   : d09dbeb9bde6b9faabd30e887eff4493331d6424    
  
author   : David Rowley <[email protected]>    
date     : Thu, 24 Nov 2022 17:21:44 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 24 Nov 2022 17:21:44 +1300    

Click here for diff

When building hash indexes using the spool method, tuples are added to the  
index page in hashkey order.  Because of this, we can safely skip  
performing the binary search on the existing tuples on the page to find  
the location to insert the tuple based on its hashkey value.  For this  
case, we can just always put the tuple at the end of the item array as the  
tuples will always arrive in hashkey order.  
  
Testing has shown that this can improve hash index build speeds by 5-15%  
with a unique set of integer values.  
  
Author: Simon Riggs  
Reviewed-by: David Rowley  
Tested-by: David Zhang, Tomas Vondra  
Discussion: https://postgr.es/m/CANbhV-GBc5JoG0AneUGPZZW3o4OK5LjBGeKe_icpC3R1McrZWQ@mail.gmail.com  

M src/backend/access/hash/hash.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashsort.c
M src/include/access/hash.h

Create memory context for tokenization after opening top-level file in hba.c

commit   : d46ad72f464beafa6d92d60d214412374559e280    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 10:27:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 10:27:38 +0900    

Click here for diff

The memory context was created before attempting to open the first HBA  
or ident file, which would cause it to leak.  This had no consequences  
for the system views for HBA and ident files, but this would cause  
memory leaks in the postmaster on reload if the initial HBA and/or ident  
files are missing, which is a valid behavior while the backend is  
running.  
  
Oversight in efc9816.  
  
Author: Ted Yu  
Discussion: https://postgr.es/m/CALte62xH6ivgiKKzPRJgfekPZC6FKLB3xbnf3=tZmc_gKj78dw@mail.gmail.com  

M src/backend/libpq/hba.c

Add missing initialization in tokenize_expand_file() for output list

commit   : d5566fbfeb6a1e05151a1cdc409465e2a3d3a6c6    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 10:03:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 10:03:11 +0900    

Click here for diff

This should have been added in efc9816, but it looks like I have found a  
way to mess up a bit a patch split.  This should have no consequence in  
practice, but let's be clean.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c

Rework memory contexts in charge of HBA/ident tokenization

commit   : efc981627a723d91e86865fb363d793282e473d1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 08:21:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Nov 2022 08:21:55 +0900    

Click here for diff

The list of TokenizedAuthLines generated at parsing for the HBA and  
ident files is now stored in a static context called tokenize_context,  
where only all the parsed tokens are stored.  This context is created  
when opening the first authentication file of a HBA/ident set (hba_file  
or ident_file), and is cleaned up once we are done all the work around  
it through a new routine called free_auth_file().  One call of  
open_auth_file() should have one matching call of free_auth_file(), the  
creation and deletion of the tokenization context is controlled by the  
recursion depth of the tokenization.  
  
Rather than having tokenize_auth_file() return a memory context that  
includes all the records, the tokenization logic now creates and deletes  
one memory context each time this function is called.  This will  
simplify recursive calls to this routine for the upcoming inclusion  
record logic.  
  
While on it, rename tokenize_inc_file() to tokenize_expand_file() as  
this would conflict with the upcoming patch that will add inclusion  
records for HBA/ident files.  An '@' file has its tokens added to an  
existing list.  
  
Reloading HBA/indent configuration in a tight loop shows no leaks, as of  
one type of test done (with and without -DEXEC_BACKEND).  
  
Author: Michael Paquier  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c
M src/backend/utils/adt/hbafuncs.c
M src/include/libpq/hba.h

Support for custom slots in the custom executor nodes

commit   : cee120951427fe39a54ab800abfa2834d85b8771    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 24 Nov 2022 00:36:11 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 24 Nov 2022 00:36:11 +0300    

Click here for diff

Some custom table access method may have their tuple format and use custom  
executor nodes for their custom scan types. The ability to set a custom slot  
would save them from tuple format conversion. Other users of custom executor  
nodes may also benefit.  
  
Discussion: https://postgr.es/m/CAPpHfduJUU6ToecvTyRE_yjxTS80FyPpct4OHaLFk3OEheMTNA@mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Pavel Borisov  

M src/backend/executor/nodeCustom.c
M src/include/nodes/execnodes.h

Simplify WARNING messages from skipped vacuum/analyze on a table

commit   : b7a5ef17cf75c712b0fe5c5a20133a88da897aab    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 23 Nov 2022 14:41:30 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 23 Nov 2022 14:41:30 -0500    

Click here for diff

This will more easily accomodate adding new permissions for vacuum and  
analyze.  
  
Nathan Bossart following a suggestion from Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuum.c
M src/test/isolation/expected/vacuum-conflict.out
M src/test/regress/expected/vacuum.out

Expand AclMode to 64 bits

commit   : 7b378237aa805711353075de142021b1d40ff3b0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 23 Nov 2022 14:41:30 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 23 Nov 2022 14:41:30 -0500    

Click here for diff

We're running out of bits for new permissions. This change doubles the  
number of permissions we can accomodate from 16 to 32, so the  
forthcoming new ones for vacuum/analyze don't exhaust the pool.  
  
Nathan Bossart  
  
Reviewed by: Bharath Rupireddy, Kyotaro Horiguchi, Stephen Frost, Robert  
Haas, Mark Dilger, Tom Lane, Corey Huinker, David G. Johnston, Michael  
Paquier.  
  
Discussion: https://postgr.es/m/20220722203735.GB3996698@nathanxps13  

M src/backend/nodes/outfuncs.c
M src/bin/pg_upgrade/check.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_type.dat
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h

Simplify vacuum_set_xid_limits() signature.

commit   : b6074846cebc33d752f1d9a66e5a9932f21ad177    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 23 Nov 2022 11:10:06 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 23 Nov 2022 11:10:06 -0800    

Click here for diff

Pass VACUUM parameters (VacuumParams state) to vacuum_set_xid_limits()  
directly, rather than passing most individual VacuumParams fields as  
separate arguments.  
  
Also make vacuum_set_xid_limits() output parameter symbol names match  
those used by its vacuumlazy.c caller.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=TE7gW5DgSahDkf0UEZigFGAoHNNN6EvSrdzC=Kn+hrA@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Don't test HEAP_XMAX_INVALID when freezing xmax.

commit   : 02d647bbf0576ebb87f9dc24e1db4dd034f04048    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 23 Nov 2022 10:49:39 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 23 Nov 2022 10:49:39 -0800    

Click here for diff

We shouldn't ever need to rely on whether HEAP_XMAX_INVALID is set in  
t_infomask when considering whether or not an xmax should be deemed  
already frozen, since that status flag is just a hint.  The only  
acceptable representation for an "xmax_already_frozen" raw xmax field is  
the transaction ID value zero (also known as InvalidTransactionId).  
  
Adjust code that superficially appeared to rely on HEAP_XMAX_INVALID to  
make the rule about xmax_already_frozen clear.  Also avoid needlessly  
rereading the tuple's raw xmax.  
  
Oversight in bugfix commit d2599ecf.  There is no evidence that this  
ever led to incorrect behavior, so no backpatch.  The worst consequence  
of this bug was that VACUUM could hypothetically fail to notice and  
report on certain kinds of corruption, which seems fairly benign.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzkh3DMCDRPfhZxj9xCq9v3WmzvmbiCpf1dNKUBPadhCbQ@mail.gmail.com  

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

Fix perl warning from commit 9b4eafcaf4

commit   : b425bf0081386a544e1faf872a75da69a971e173    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 23 Nov 2022 07:03:06 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 23 Nov 2022 07:03:06 -0500    

Click here for diff

per gripe from Andres Freund and Tom Lane  
  
Backpatch to all live branches.  

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

Give better hints for ambiguous or unreferenceable columns.

commit   : 56d0ed3b756b2e3799a7bbc0ac89bc7657ca2c33    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2022 18:46:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2022 18:46:31 -0500    

Click here for diff

Examine ParseNamespaceItem flags to detect whether a column name  
is unreferenceable for lack of LATERAL, or could be referenced if  
a qualified name were used, and give better hints for such cases.  
Also, don't phrase the message to imply that there's only one  
matching column when there is really more than one.  
  
Many of the regression test output changes are not very interesting,  
but just reflect reclassifying the "There is a column ... but it  
cannot be referenced from this part of the query" messages as DETAIL  
rather than HINT.  They are details per our style guide, in the sense  
of being factual rather than offering advice; and this change provides  
room to offer actual HINTs about what to do.  
  
While here, adjust the fuzzy-name-matching code to be a shade less  
impenetrable.  It was overloading the meanings of FuzzyAttrMatchState  
fields way too much IMO, so splitting them into multiple fields seems  
to make it clearer.  It's not like we need to shave bytes in that  
struct.  
  
Per discussion of bug #17233 from Alexander Korolev.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_relation.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/join.out
M src/test/regress/expected/merge.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/union.out
M src/test/regress/sql/join.sql

YA attempt at taming worst-case behavior of get_actual_variable_range.

commit   : 9c6ad5eaa957bdc2132b900a96e0d2ec9264d39c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2022 14:40:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Nov 2022 14:40:20 -0500    

Click here for diff

We've made multiple attempts at preventing get_actual_variable_range  
from taking an unreasonable amount of time (3ca930fc3, fccebe421).  
But there's still an issue for the very first planning attempt after  
deletion of a large number of extremal-valued tuples.  While that  
planning attempt will set "killed" bits on the tuples it visits and  
thereby reduce effort for next time, there's still a lot of work it  
has to do to visit the heap and then set those bits.  It's (usually?)  
not worth it to do that much work at plan time to have a slightly  
better estimate, especially in a context like this where the table  
contents are known to be mutating rapidly.  
  
Therefore, let's bound the amount of work to be done by giving up  
after we've visited 100 heap pages.  Giving up just means we'll  
fall back on the extremal value recorded in pg_statistic, so it  
shouldn't mean that planner estimates suddenly become worthless.  
  
Note that this means we'll still gradually whittle down the problem  
by setting a few more index "killed" bits in each planning attempt;  
so eventually we'll reach a good state (barring further deletions),  
even in the absence of VACUUM.  
  
Simon Riggs, per a complaint from Jakub Wartak (with cosmetic  
adjustments by me).  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAKZiRmznOwi0oaV=4PHOCM4ygcH4MgSvt8=5cu_vNCfc8FSUug@mail.gmail.com  

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

Remove useless MERGE test

commit   : 0538d4c0c33551029f408fdc29ee51b817632e11    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 22 Nov 2022 11:26:47 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 22 Nov 2022 11:26:47 +0100    

Click here for diff

This was trying to exercise an ERROR we don't actually have.  
  
Backpatch to 15.  
  
Reported by Teja Mupparti <[email protected]>  
Discussion: https://postgr.es/m/SN6PR2101MB1040BDAF740EA4389484E92BF0079@SN6PR2101MB1040.namprd21.prod.outlook.com  

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

Improve comments atop pg_get_replication_slots.

commit   : a1efcda7c33d10658dac214514ca8359a1da4e42    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 22 Nov 2022 15:22:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 22 Nov 2022 15:22:00 +0530    

Click here for diff

Update comments atop pg_get_replication_slots to make it clear that it  
shows all replication slots that currently exist on the database cluster.  
  
Author: sirisha chamarthi  
Discussion: https://postgr.es/m/CAKrAKeXRuFpeiWS+STGFm-RFfW19sUDxju66JkyRi13kdQf94Q@mail.gmail.com  

M src/backend/replication/slotfuncs.c

Ignore invalidated slots while computing oldest catalog Xmin

commit   : 0557e1770230fe5ca855fdf45bb297bd38a9ec1b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 22 Nov 2022 10:56:07 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 22 Nov 2022 10:56:07 +0100    

Click here for diff

Once a logical slot has acquired a catalog_xmin, it doesn't let go of  
it, even when invalidated by exceeding the max_slot_wal_keep_size, which  
means that dead catalog tuples are not removed by vacuum anymore since  
the point is invalidated, until the slot is dropped.  This could be  
catastrophic if catalog churn is high.  
  
Change the computation of Xmin to ignore invalidated slots,  
to prevent dead rows from accumulating.  
  
Backpatch to 13, where slot invalidation appeared.  
  
Author: Sirisha Chamarthi <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Discussion: https://postgr.es/m/CAKrAKeUEDeqquN9vwzNeG-CN8wuVsfRYbeOUV9qKO_RHok=j+g@mail.gmail.com  

M src/backend/replication/slot.c
M src/backend/storage/ipc/procarray.c

Add wait event for pg_usleep() in perform_spin_delay()

commit   : 92daeca45df6551dd85f92f7369eaa57a35fb8a9    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 20:34:17 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 20:34:17 -0800    

Click here for diff

The lwlock wait queue scalability issue fixed in a4adc31f690 was quite hard to  
find because of the exponential backoff and because we adjust spins_per_delay  
over time within a backend.  
  
To make it easier to find similar issues in the future, add a wait event for  
the pg_usleep() in perform_spin_delay(). Showing a wait event while spinning  
without sleeping would increase the overhead of spinlocks, which we do not  
want.  
  
We may at some later point want to have more granular wait events, but that'd  
be a substantial amount of work. This provides at least some insights into  
something currently hard to observe.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Alexander Korotkov <[email protected]>  
https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/lmgr/s_lock.c
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h

ci: Use -fsanitize=undefined,alignment,address in linux tasks

commit   : bd82928625e7ebe40eaaa57f3b4d03bae19491de    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 15:13:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 15:13:09 -0800    

Click here for diff

We have coverage of the various sanitizers in the buildfarm. The sanitizers  
however particularly interesting during the development of patches, where the  
likelihood of bugs is even higher. There also have been complaints about only  
seeing such failures on the buildfarm, rather than before commit.  
  
This commit enables a reasonable set of sanitizers in CI. Use the linux task  
for that, as it currently is one of the fastests tasks. Also several of the  
sanitizers work best on linux.  
  
The overhead of alignment sanitizer is low, undefined behaviour has moderate  
overhead. Test alignment sanitizer in the meson task, as it does both 32 and  
64 bit builds and is thus more likely to expose alignment bugs.  
  
Address sanitizer in contrast somewhat expensive. Enable it in the autoconf  
task, as the meson task tests both 32 and 64bit which would exacerbate the  
cost.  
  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

ci: Introduce SanityCheck task that other tasks depend on

commit   : 94a3e026cc4da4c5a3f82d02ae2c62c9f060788a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 15:13:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 15:13:09 -0800    

Click here for diff

To avoid unnecessarily spinning up a lot of VMs / containers for entirely  
broken commits, have a minimal task that all others depend on.  
  
The concrete motivation for the change is to use sanitizers in the linux  
tasks. As that makes the tests slower, the start of the CompilerWarnings would  
be delayed even more. With this change the CompilerWarnings only depends on  
the SanityCheck task.  
  
This has the added advantage that now the CompilerWarnings task is not  
prevented from running by (most) test failures (particularly annoying when  
caused by a test that is flappy in HEAD).  
  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

ci: Clean up pre-meson cruft in windows task

commit   : ec267fd5a5e85223979a90c814e1a98053ca7f3b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 14:15:30 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 14:15:30 -0800    

Click here for diff

We don't need CIRRUS_ESCAPING_PROCESSES anymore as the whole tests now run  
within a single script: block. We don't need NO_TEMP_INSTALL anymore it was  
addressing an issue specific to vcregress.pl.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

commit   : f1d042b21dfdac069601fe97b7b7ba572dd0abe2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 21 Nov 2022 23:25:48 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 21 Nov 2022 23:25:48 +0100    

Click here for diff

The Hunspell project moved from Sourceforge to Github sometime  
in 2016, so update our links to match the new URL.  Backpatch  
the doc changes to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v11  

M doc/src/sgml/textsearch.sgml
M src/include/tsearch/dicts/spell.h

Add comments and a missing CHECK_FOR_INTERRUPTS in ts_headline.

commit   : 5644d6f909b1bc92155741064275cda82d9b9b70    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2022 17:07:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2022 17:07:07 -0500    

Click here for diff

I just spent an annoying amount of time reverse-engineering the  
100%-undocumented API between ts_headline and the text search  
parser's prsheadline function.  Add some commentary about that  
while it's fresh in mind.  Also remove some unused macros in  
wparser_def.c.  
  
While at it, I noticed that when commit 78e73e875 added a  
CHECK_FOR_INTERRUPTS call in TS_execute_recurse, it missed  
doing so in the parallel function TS_phrase_execute, which  
surely needs one just as much.  
  
Back-patch because of the missing CHECK_FOR_INTERRUPTS.  
Might as well back-patch the rest of this too.  

M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/tsvector_op.c
M src/include/tsearch/ts_public.h

Add workaround to make ubsan and ps_status.c compatible

commit   : f686ae82f2d7e29facde8300209deef7abe13605    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 13:54:54 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Nov 2022 13:54:54 -0800    

Click here for diff

At least on linux, set_ps_display() breaks /proc/$pid/environ. The sanitizer's  
helper library uses /proc/$pid/environ to implement getenv(), as it wants to  
work independent of libc. When just using undefined and alignment sanitizers,  
the sanitizer library is only initialized when the first error occurs, by  
which time we've often already called set_ps_display(), preventing the  
sanitizer libraries from seeing the options.  
  
We can work around that by defining __ubsan_default_options, a weak symbol  
libsanitizer uses to get defaults from the application, and return  
getenv("UBSAN_OPTIONS"). But only if main already was reached, so that we  
don't end up relying on a not-yet-working getenv().  
  
As it's just a function that won't get called when not running a sanitizer, it  
doesn't seem necessary to make compilation of the function conditional.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/main/main.c

Mark pageinspect's disk-accessing functions as parallel restricted.

commit   : aeaaf520f409cf314f97c811d2713c99858f035d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2022 15:37:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2022 15:37:10 -0500    

Click here for diff

These functions have been marked parallel safe, but the buildfarm's  
response to commit e2933a6e1 exposed the flaw in that thinking:  
if you try to use them on a temporary table, and they run inside  
a parallel worker, they'll fail with "cannot access temporary tables  
during a parallel operation".  
  
Fix that by marking them parallel restricted instead.  Maybe someday  
we'll have a better answer and can reverse this decision.  
  
Back-patch to v15.  To go back further, we'd have to devise variant  
versions of pre-1.10 pageinspect versions.  Given the lack of field  
complaints, it doesn't seem worth the trouble.  We'll just deem  
this case unsupported pre-v15.  (If anyone does complain, it might  
be good enough to update the markings manually in their DBs.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/Makefile
M contrib/pageinspect/meson.build
A contrib/pageinspect/pageinspect–1.10–1.11.sql
M contrib/pageinspect/pageinspect.control

Provide options for postmaster to kill child processes with SIGABRT.

commit   : 51b5834cd53f0bd068729043b55f7da3ca6bb15f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2022 11:59:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2022 11:59:29 -0500    

Click here for diff

The postmaster normally sends SIGQUIT to force-terminate its  
child processes after a child crash or immediate-stop request.  
If that doesn't result in child exit within a few seconds,  
we follow it up with SIGKILL.  This patch provides GUC flags  
that allow either of these signals to be replaced with SIGABRT.  
On typically-configured Unix systems, that will result in a  
core dump being produced for each such child.  This can be  
useful for debugging problems, although it's not something you'd  
want to have on in production due to the risk of disk space  
bloat from lots of core files.  
  
The old postmaster -T switch, which sent SIGSTOP in place of  
SIGQUIT, is changed to be the same as send_abort_for_crash.  
As far as I can tell from the code comments, the intent of  
that switch was just to block things for long enough to force  
core dumps manually, which seems like an unnecessary extra step.  
(Maybe at the time, there was no way to get most kernels to  
produce core files with per-PID names, requiring manual core  
file renaming after each one.  But now it's surely the hard way.)  
  
I also took the opportunity to remove the old postmaster -n  
(skip shmem reinit) switch, which hasn't actually done anything  
in decades, though the documentation still claimed it did.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M src/backend/main/main.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/guc_tables.c
M src/include/postmaster/postmaster.h

Prevent instability in contrib/pageinspect's regression test.

commit   : e2933a6e11791191050cd925d52d34e785eece77    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2022 10:50:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Nov 2022 10:50:50 -0500    

Click here for diff

pageinspect has occasionally failed on slow buildfarm members,  
with symptoms indicating that the expected effects of VACUUM  
FREEZE didn't happen.  This is presumably because a background  
transaction such as auto-analyze was holding back global xmin.  
  
We can work around that by using a temp table in the test.  
Since commit a7212be8b, that will use an up-to-date cutoff xmin  
regardless of other processes.  And pageinspect itself shouldn't  
really care whether the table is temp.  
  
Back-patch to v14.  There would be no point in older branches  
without back-patching a7212be8b, which seems like more trouble  
than the problem is worth.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql

Replace SQLValueFunction by COERCE_SQL_SYNTAX

commit   : f193883fc9cebe8fa20359b0797832837a788112    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 21 Nov 2022 18:31:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 21 Nov 2022 18:31:59 +0900    

Click here for diff

This switch impacts 9 patterns related to a SQL-mandated special syntax  
for function calls:  
- LOCALTIME [ ( typmod ) ]  
- LOCALTIMESTAMP [ ( typmod ) ]  
- CURRENT_TIME [ ( typmod ) ]  
- CURRENT_TIMESTAMP [ ( typmod ) ]  
- CURRENT_DATE  
  
Five new entries are added to pg_proc to compensate the removal of  
SQLValueFunction to provide backward-compatibility and making this  
change transparent for the end-user (for example for the attribute  
generated when a keyword is specified in a SELECT or in a FROM clause  
without an alias, or when specifying something else than an Iconst to  
the parser).  
  
The parser included a set of checks coming from the files in charge of  
holding the C functions used for the SQLValueFunction calls (as of  
transformSQLValueFunction()), which are now moved within each function's  
execution path, so this reduces the dependencies between the execution  
and the parsing steps.  As of this change, all the SQL keywords use the  
same paths for their work, relying only on COERCE_SQL_SYNTAX.  Like  
fb32748, no performance difference has been noticed, while the perf  
profiles get reduced with ExecEvalSQLValueFunction() gone.  
  
Bump catalog version.  
  
Reviewed-by: Corey Huinker, Ted Yu  
Discussion: https://postgr.es/m/[email protected]  

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/backend/utils/misc/queryjumble.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

Add additional checks while creating the initial decoding snapshot.

commit   : 240e0dbacd390a8465552e27c5af11f67d747adb    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 21 Nov 2022 08:54:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 21 Nov 2022 08:54:43 +0530    

Click here for diff

As per one of the CI reports, there is an assertion failure which  
indicates that we were trying to use an unenforced xmin horizon for  
decoding snapshots. Though, we couldn't figure out the reason for  
assertion failure these checks would help us in finding the reason if the  
problem happens again in the future.  
  
Author: Amit Kapila based on suggestions by Andres Freund  
Reviewd by: Andres Freund  
Discussion: https://postgr.es/m/CAA4eK1L8wYcyTPxNzPGkhuO52WBGoOZbT0A73Le=ZUWYAYmdfw@mail.gmail.com  

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

lwlock: Fix quadratic behavior with very long wait lists

commit   : a4adc31f6902f6fc29d74868e8969412fc590da9    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 20 Nov 2022 11:56:32 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 20 Nov 2022 11:56:32 -0800    

Click here for diff

Until now LWLockDequeueSelf() sequentially searched the list of waiters to see  
if the current proc is still is on the list of waiters, or has already been  
removed. In extreme workloads, where the wait lists are very long, this leads  
to a quadratic behavior. #backends iterating over a list #backends  
long. Additionally, the likelihood of needing to call LWLockDequeueSelf() in  
the first place also increases with the increased length of the wait queue, as  
it becomes more likely that a lock is released while waiting for the wait list  
lock, which is held for longer during lock release.  
  
Due to the exponential back-off in perform_spin_delay() this is surprisingly  
hard to detect. We should make that easier, e.g. by adding a wait event around  
the pg_usleep() - but that's a separate patch.  
  
The fix is simple - track whether a proc is currently waiting in the wait list  
or already removed but waiting to be woken up in PGPROC->lwWaiting.  
  
In some workloads with a lot of clients contending for a small number of  
lwlocks (e.g. WALWriteLock), the fix can substantially increase throughput.  
  
As the quadratic behavior arguably is a bug, we might want to decide to  
backpatch this fix in the future.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CALj2ACXktNbG=K8Xi7PSqbofTZozavhaxjatVc14iYaLu4Maag@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lwlock.h
M src/include/storage/proc.h

pgstat: replace double lookup with IsSharedRelation()

commit   : 061bf98fb8f468b9a8c9fb617bb30136db1cc812    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 20 Nov 2022 10:53:31 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 20 Nov 2022 10:53:31 -0800    

Click here for diff

As the list of shared relations is fixed, we can just dispatch based  
IsSharedRelation(), instead of first trying to look up stats for a non-shared  
rel and falling back to shared stats.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Andres Freund <[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat_relation.c

Fix sloppy cleanup of roles in privileges.sql.

commit   : b62303794efd97f2afb55f1e1b82fffae2cf8a2d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Nov 2022 11:30:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Nov 2022 11:30:50 -0500    

Click here for diff

Commit 3d14e171e dropped regress_roleoption_donor twice and  
regress_roleoption_protagonist not at all.  Leaving roles behind  
after "make installcheck" is unfriendly in its own right, plus  
it causes repeated runs of "make installcheck" to fail.  

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

Fix long-obsolete comment.

commit   : 75b8d3de989eb88a5960c93cddd88caf5d245024    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Nov 2022 11:22:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Nov 2022 11:22:22 -0500    

Click here for diff

Commit c94959d41 fixed DROP OPERATOR to reset oprcom/oprnegate links  
to the dropped operator; but it missed updating this old comment that  
claimed we allow such links to dangle.  

M src/backend/catalog/pg_operator.c

Prevent port collisions between concurrent TAP tests

commit   : 9b4eafcaf41d1192a34b574c21262b755aa455ee    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 20 Nov 2022 09:51:50 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 20 Nov 2022 09:51:50 -0500    

Click here for diff

Currently there is a race condition where if concurrent TAP tests both  
test that they can open a port they will assume that it is free and use  
it, causing one of them to fail. To prevent this we record a reservation  
using an exclusive lock, and any TAP test that discovers a reservation  
checks to see if the reserving process is still alive, and looks for  
another free port if it is.  
  
Ports are reserved in a directory set by the environment setting  
PG_TEST_PORT_DIR, or if that doesn't exist a subdirectory of the top  
build directory as set by meson or Makefile.global, or its own  
tmp_check directory.  
  
The prove_check recipe in Makefile.global.in is extended to export  
top_builddir to the TAP tests. This was already exported by the  
prove_installcheck recipes.  
  
Per complaint from Andres Freund  
  
This will be backpatched in due course after some testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/test/perl/PostgreSQL/Test/Cluster.pm

Switch SQLValueFunction on "name" to use COERCE_SQL_SYNTAX

commit   : fb32748e32e2b6b2fcb32220980b93d5436f855e    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 20 Nov 2022 10:58:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 20 Nov 2022 10:58:28 +0900    

Click here for diff

This commit changes six SQL keywords to use COERCE_SQL_SYNTAX rather  
than relying on SQLValueFunction:  
- CURRENT_ROLE  
- CURRENT_USER  
- USER  
- SESSION_USER  
- CURRENT_CATALOG  
- CURRENT_SCHEMA  
  
Among the six, "user", "current_role" and "current_catalog" require  
specific SQL functions to allow ruleutils.c to map them to the SQL  
keywords these require when using COERCE_SQL_SYNTAX.  Having  
pg_proc.proname match with the keyword ensures that the compatibility  
remains the same when projecting any of these keywords in a FROM clause  
to an attribute name when an alias is not specified.  This is covered by  
the tests added in 2e0d80c, making sure that a correct mapping happens  
with each SQL keyword.  The three others (current_schema, session_user  
and current_user) already have pg_proc entries for this job, so this  
brings more consistency between the way such keywords are treated in the  
parser, the executor and ruleutils.c.  
  
SQLValueFunction is reduced to half its contents after this change,  
simplifying its logic a bit as there is no need to enforce a C collation  
anymore for the entries returning a name as a result.  I have made a few  
performance tests, with a million-ish calls to these keywords without  
seeing a difference in run-time or in perf profiles  
(ExecEvalSQLValueFunction() is removed from the profiles).  The  
remaining SQLValueFunctions are now related to timestamps and dates.  
  
Bump catalog version.  
  
Reviewed-by: Corey Huinker  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/nodes/nodeFuncs.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/ruleutils.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/nodes/primnodes.h

Fix catversion

commit   : ed1d3132d27503cbae0198b2da172b17c0d4f86b    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 19 Nov 2022 17:55:52 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 19 Nov 2022 17:55:52 -0500    

Click here for diff

Commit 2fb6154fc didn't quite get the catversion correct per usual  
norms. Fix it. Reported by Rishu Bagga.  

M src/include/catalog/catversion.h

commit   : 8c954168cff4630ae94df649b458f4a3aad6d9a7    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 16 Nov 2022 20:00:59 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 16 Nov 2022 20:00:59 -0800    

Click here for diff

ProcSleep() used a PGPROC* variable to point to PROC_QUEUE->links.next,  
because that does "the right thing" with SHMQueueInsertBefore(). While that  
largely works, it's certainly not correct and unnecessary - we can just use  
SHM_QUEUE* to point to the insertion point.  
  
Noticed when testing a 32bit of postgres with undefined behavior  
sanitizer. UBSan noticed that sometimes the supposed PGPROC wasn't  
sufficiently aligned (required since 46d6e5f5679, ensured indirectly, via  
ShmemAllocRaw() guaranteeing cacheline alignment).  
  
For now fix this by using a SHM_QUEUE* for the insertion point. Subsequently  
we should replace all the use of PROC_QUEUE and SHM_QUEUE with ilist.h, but  
that's a larger change that we don't want to backpatch.  
  
Backpatch to all supported versions - it's useful to be able to run postgres  
under UBSan.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-  

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

Disable debug_discard_caches in test_oat_hooks test.

commit   : 3efc82e28951c6eee24aead056b8478cb424af2e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2022 13:42:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2022 13:42:53 -0500    

Click here for diff

The test output varies when debug_discard_caches is enabled,  
because that causes extra executions of recomputeNamespacePath.  
Maybe putting a hook in that was a bad idea, but as a stopgap,  
just turn off debug_discard_caches in this test.  
  
Per buildfarm (now that we have debug_discard_caches coverage  
again).  Back-patch to v15 where this module was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql

Doc: sync src/tutorial/basics.source with SGML documentation.

commit   : 3b8ad00853cc07456258386c08e683883cd705b3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2022 13:09:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Nov 2022 13:09:14 -0500    

Click here for diff

basics.source is supposed to be pretty closely in step with  
the examples in chapter 2 of the tutorial, but I forgot to  
update it in commit f05a5e000.  Fix that, and adjust a couple  
of other discrepancies that had crept in over time.  
  
(I notice that advanced.source is nowhere near being in sync  
with chapter 3, but I lack the ambition to do something  
about that right now.)  

M src/tutorial/basics.source

Fix typos and bump catversion.

commit   : 2fb6154fcd769b2d4ea1226788e0ec2fc3522cb8    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Nov 2022 16:16:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Nov 2022 16:16:21 -0500    

Click here for diff

Typos reported by Álvaro Herrera and Erik Rijkers.  
  
Catversion bump for 3d14e171e9e2236139e8976f3309a588bcc8683b was  
inadvertently omitted.  

M doc/src/sgml/ref/grant.sgml
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/catversion.h

Add a SET option to the GRANT command.

commit   : 3d14e171e9e2236139e8976f3309a588bcc8683b    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Nov 2022 12:32:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Nov 2022 12:32:50 -0500    

Click here for diff

Similar to how the INHERIT option controls whether or not the  
permissions of the granted role are automatically available to the  
grantee, the new SET permission controls whether or not the grantee  
may use the SET ROLE command to assume the privileges of the granted  
role.  
  
In addition, the new SET permission controls whether or not it  
is possible to transfer ownership of objects to the target role  
or to create new objects owned by the target role using commands  
such as CREATE DATABASE .. OWNER. We could alternatively have made  
this controlled by the INHERIT option, or allow it when either  
option is given. An advantage of this approach is that if you  
are granted a predefined role with INHERIT TRUE, SET FALSE, you  
can't go and create objects owned by that role.  
  
The underlying theory here is that the ability to create objects  
as a target role is not a privilege per se, and thus does not  
depend on whether you inherit the target role's privileges. However,  
it's surely something you could do anyway if you could SET ROLE  
to the target role, and thus making it contingent on whether you  
have that ability is reasonable.  
  
Design review by Nathan Bossat, Wolfgang Walther, Jeff Davis,  
Peter Eisentraut, and Stephen Frost.  
  
Discussion: http://postgr.es/m/CA+Tgmob+zDSRS6JXYrgq0NWdzCXuTNzT5eK54Dn2hhgt17nm8A@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/commands/alter.c
M src/backend/commands/dbcommands.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/variable.c
M src/backend/utils/adt/acl.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/pg_auth_members.h
M src/include/utils/acl.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Don't read MCV stats needlessly in eqjoinsel().

commit   : f84ff0c6d4eb4e470e55f48103a7edd269d13c49    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Nov 2022 11:01:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Nov 2022 11:01:03 -0500    

Click here for diff

eqjoinsel() currently makes use of MCV stats only when we have such  
stats for both sides of the clause.  As coded, though, it would  
fetch those stats even when they're present for just one side.  
This can be a bit expensive with high statistics targets, leading  
to wasted effort in common cases such as joining a unique column  
to a non-unique column.  So it seems worth the trouble to do a quick  
pre-check to confirm that both sides have MCVs before fetching either.  
  
Also, tweak the API spec for get_attstatsslot() to document the  
method we're using here.  
  
David Geier, Tomas Vondra, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/lsyscache.c

Make object_address test output easier to update

commit   : d8678aba2ee5969e6d2351c5361d488fc51c975f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Nov 2022 16:00:52 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Nov 2022 16:00:52 +0100    

Click here for diff

The object_address test file turns to psql unaligned output for some  
tests to avoid huge diffs for changes.  But this is useful also to the  
other large test in that file, so apply it there as well.  This also  
makes verifying the null and whitespace behavior easier.  

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

Clean up SQL code indentation in test file

commit   : d0ca708540064aa4a18b226f75ad44dcdd64b383    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Nov 2022 15:31:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Nov 2022 15:31:55 +0100    

Click here for diff

This makes the code layout more consistent inside the same file.  

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

Fix version comparison in Version.pm

commit   : 97ee956416e9d7906cde49cae5f65763ea943e77    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 18 Nov 2022 08:38:26 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 18 Nov 2022 08:38:26 -0500    

Click here for diff

Version strings with unequal numbers of parts were being compared  
incorrectly. We cure this by treating a missing part in the shorter  
version as 0.  
  
per complaint from Jehan-Guillaume de Rorthais, but the fix is mine, not  
his.  
  
Discussion: https://postgr.es/m/20220628225325.53d97b8d@karst  
  
Backpatch to release 14 where this code was introduced.  

M src/test/perl/PostgreSQL/Version.pm

Fix typo

commit   : 83eccb85625fce8f63ee2cd4fc60d72de4008d90    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 18 Nov 2022 12:52:44 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 18 Nov 2022 12:52:44 +0100    

Click here for diff

Erik Rijkers  

M doc/src/sgml/ref/initdb.sgml

doc: Small wording improvement

commit   : 28d233c8e6e599dc4377dda75d97fce55a26fbc3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Nov 2022 12:46:07 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Nov 2022 12:46:07 +0100    

Click here for diff

M doc/src/sgml/libpq.sgml

commit   : 910cab820d0f1255f5be531986e08832b2fa897c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 18 Nov 2022 11:59:26 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 18 Nov 2022 11:59:26 +0100    

Click here for diff

Extracted from a more ambitious patch.  
  
Author: David G. Johnston <[email protected]>  
Discussion: https://postgr.es/m/CAKFQuwZC4K0XYBm0bwBMDOZySBqhOSekDhLuaw4vPi+ozi8gqQ@mail.gmail.com  

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/ref/initdb.sgml

psql: Improve tab completion for GRANT/REVOKE

commit   : 07f7237c2a3bcc2eebb554f812378188b07571bb    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Nov 2022 11:26:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Nov 2022 11:26:49 +0900    

Click here for diff

This commit improves the handling of the following clauses:  
- Addition of "CREATE" for ALTER DEFAULT PRIVILEGES .. GRANT/REVOKE.  
- Addition of GRANT|ADMIN|INHERIT OPTION FOR for REVOKE, with some  
completion for roles, INHERIT being added recently by e3ce2de.  
- Addition of GRANT WITH ADMIN|INHERIT.  
  
The list of privilege options common to GRANT and REVOKE is refactored  
to avoid its duplication.  
  
Author: Shi Yu  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier, Peter Smith  
Discussion: https://postgr.es/m/OSZPR01MB6310FCE8609185A56344EED2FD559@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/bin/psql/tab-complete.c

ci: Add task testing windows with mingw

commit   : 967db242c2aa7d50300e20bd8a403bd905feec38    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 17 Nov 2022 16:22:25 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 17 Nov 2022 16:22:25 -0800    

Click here for diff

For now the task has been set to be manually triggered, as we are already  
limited by the amount of CI time available for windows, particularly on cfbot.  
  
Author: Melih Mutlu <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/CAGPVpCSKS9E0An4=e7ZDnme+y=WOcQFJYJegKO8kE9=gh8NJKQ@mail.gmail.com  

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

Standardize rmgrdesc recovery conflict XID output.

commit   : 1489b1ce728248e04da72aa32f87e9a634ebf9b8    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 17 Nov 2022 14:55:08 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 17 Nov 2022 14:55:08 -0800    

Click here for diff

Standardize on the name snapshotConflictHorizon for all XID fields from  
WAL records that generate recovery conflicts when in hot standby mode.  
This supersedes the previous latestRemovedXid naming convention.  
  
The new naming convention places emphasis on how the values are actually  
used by REDO routines.  How the values are generated during original  
execution (details of which vary by record type) is deemphasized.  Users  
of tools like pg_waldump can now grep for snapshotConflictHorizon to see  
all potential sources of recovery conflicts in a standardized way,  
without necessarily having to consider which specific record types might  
be involved.  
  
Also bring a couple of WAL record types that didn't follow any kind of  
naming convention into line.  These are heapam's VISIBLE record type and  
SP-GiST's VACUUM_REDIRECT record type.  Now every WAL record whose REDO  
routine calls ResolveRecoveryConflictWithSnapshot() passes through the  
snapshotConflictHorizon field from its WAL record.  This is follow-up  
work to the refactoring from commit 9e540599 that made FREEZE_PAGE WAL  
records use a standard snapshotConflictHorizon style XID cutoff.  
  
No bump in XLOG_PAGE_MAGIC, since the underlying format of affected WAL  
records doesn't change.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzm2CQUmViUq7Opgk=McVREHSOorYaAjR1ZpLYkRN7_dPw@mail.gmail.com  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/access/hash_xlog.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtxlog.h
M src/include/access/spgxlog.h
M src/include/access/tableam.h
M src/include/storage/standby.h

Fix MERGE tuple count with DO NOTHING

commit   : 6ff5aa129933fbde034c0d21c28cf05e052511f9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Nov 2022 18:56:11 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Nov 2022 18:56:11 +0100    

Click here for diff

Reporting tuples for which nothing is done is useless and goes against  
the documented behavior, so don't do it.  
  
Backpatch to 15.  
  
Reported by: Luca Ferrari  
Discussion: https://postgr.es/m/CAKoxK+42MmACUh6s8XzASQKizbzrtOGA6G1UjzCP75NcXHsiNw@mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Use correct type name in comments about freezing.

commit   : 813492dacceecb752725b7e370ac7f5748b1edf9    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 17 Nov 2022 09:34:12 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 17 Nov 2022 09:34:12 -0800    

Click here for diff

Oversight in commit 9e540599, which added freeze plan deduplication.  

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

Account for IPC::Run::result() Windows behavior change.

commit   : aca93b5f189abe3b862761bf96811b2facf35555    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 17 Nov 2022 07:35:06 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 17 Nov 2022 07:35:06 -0800    

Click here for diff

This restores compatibility with the not-yet-released successor of  
version 20220807.0.  Back-patch to 9.4, which introduced this code.  
  
Reviewed by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

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

libpq: Handle NegotiateProtocolVersion message

commit   : bbf9c282ce92272ed7bf6771daf0f9efa209e61b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 15:14:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 15:14:44 +0100    

Click here for diff

Before, receiving a NegotiateProtocolVersion message would result in a  
confusing error message like  
  
    expected authentication request from server, but received v  
  
This adds proper handling of this protocol message and produces an  
on-topic error message from it.  
  
Reviewed-by: Jacob Champion <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f9c7862f-b864-8ef7-a861-c4638c83e209%40enterprisedb.com  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h

libpq: Correct processing of startup response messages

commit   : dce92e59b1a9ff8401a660a1ac448ea37d498284    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 14:12:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 14:12:04 +0100    

Click here for diff

After sending a startup message, libpq expects either an error  
response ('E') or an authentication request ('R').  Before processing  
the message, it ensures it has read enough bytes to correspond to the  
length specified in the message.  However, when processing the 'R'  
message, if an EOF status is returned it loops back waiting for more  
input, even though we already checked that we have enough input.  In  
this particular case, this is probably not reachable anyway, because  
other code ensures we have enough bytes for an authentication request  
message, but the code is wrong and misleading.  In the more general  
case, processing a faulty message could result in an EOF status, which  
would then result in an infinite loop waiting for the end of a message  
that will never come.  The correction is to make this an error.  
  
Reported-by: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Fix wording in comment

commit   : 3d0c95bc8920f51f7d7685c622c9a75f59cf322f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 17 Nov 2022 13:17:19 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 17 Nov 2022 13:17:19 +0100    

Click here for diff

Author: vignesh C <[email protected]>  
Discussion: https://postgr.es/m/CALDaNm0jKY__83tUsem79+YqfjTWTAkDfiPS0T_Z4y0AYGd_HQ@mail.gmail.com  

M src/include/lib/simplehash.h

Fix outdated comment in ExecDelete

commit   : 01755490cfa196ddc415308ab5aed8cc45fbaaad    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Nov 2022 12:52:20 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Nov 2022 12:52:20 +0100    

Click here for diff

This commend references a struct that disappeared before MERGE was  
merged ... and ExecDelete is not called by the committed MERGE anyway.  
Revert to the original wording.  
  
Backpatch to 15  

M src/backend/executor/nodeModifyTable.c

Allow initdb to complete on systems without "locale" command

commit   : af3abca029b39ae6bdb683a758b11375e9839631    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 12:12:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 12:12:11 +0100    

Click here for diff

This partially reverts 2fe3bdbd691a5d11626308e7d660440be6c210c8, which  
added an error check on the "locale -a" execution.  This is removed  
again, adding a comment explaining why.  We already had code that  
shows a warning if no system locales could be found, which should be  
sufficient for feedback to the user.  
  
Discussion: https://www.postgresql.org/message-id/flat/b2b491d1-3b36-15b9-6910-5b5540b27f5c%40enterprisedb.com  

M src/backend/commands/collationcmds.c

doc: Fix wording of MERGE actions in README

commit   : 3b304547a9dfef7101889d35a4c5da7866d66c8e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 17 Nov 2022 10:07:06 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 17 Nov 2022 10:07:06 +0100    

Click here for diff

UPDATE was listed twice and DELETE was omitted, replace one UPDATE  
with DELETE instead.  
  
Backpatch through v15 where MERGE was added.  
  
Author: Myo Wai Thant <[email protected]>  
Reviewed-by: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/OSAPR01MB43247E46931E9E9CFC4AA0F29A079@OSAPR01MB4324.jpnprd01.prod.outlook.com  
Backpatch-through: 15  

M src/backend/executor/README

Fix typos in comments

commit   : aba2dbb3cf6283348a5f467b11820448fb4eaeb6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 17 Nov 2022 09:12:51 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 17 Nov 2022 09:12:51 +0100    

Click here for diff

Fix various misspellings of xl_running_xacts.  
  
Author: Japin Li <[email protected]>  
Discussion: https://postgr.es/m/MEYP282MB1669CA2A39ACF0172774ED27B6069@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

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

Remove unneeded include in test_slru.c

commit   : 3894d21d22eba8438743eaf453b2f2c85e479125    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 17 Nov 2022 16:00:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 17 Nov 2022 16:00:09 +0900    

Click here for diff

As introduced in 006b69f, the order of the headers was incorrect.  
However, it happens that lwlock.h can just be dropped from the list, so  
let's be clean and remove it, fixing the order of the listed headers.  

M src/test/modules/test_slru/test_slru.c

Export with_icu when running src/bin/scripts tests with meson

commit   : 1d87037ac84606a5bd0c2cd95e5f28b83545c6cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 07:43:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 07:43:50 +0100    

Click here for diff

Author: Marina Polyakova <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/scripts/meson.build

Update some more ObjectType switch statements to not have default

commit   : aca992040951c7665f1701cd25d48808eda7a809    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 07:08:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Nov 2022 07:08:44 +0100    

Click here for diff

This allows the compiler to complain if a case has been missed.  In  
these instances, the tradeoff of having to list a few unneeded cases  
to silence the compiler seems better than the risk of actually missing  
one.  
  
Discussion: https://www.postgresql.org/message-id/flat/fce5c98a-45da-19e7-dad0-21096bccd66e%40enterprisedb.com  

M src/backend/catalog/objectaddress.c
M src/backend/commands/dropcmds.c

Improve ruleutils' printout of LATERAL references within subplans.

commit   : adaf34241acd83afaa45a8b614b6484a285da847    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Nov 2022 20:06:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Nov 2022 20:06:09 -0500    

Click here for diff

Commit 1cc29fe7c, which taught EXPLAIN to print PARAM_EXEC Params as  
the referenced expressions, included some checks to prevent matching  
Params found in SubPlans or InitPlans to NestLoopParams of upper query  
levels.  At the time, this seemed possibly necessary to avoid false  
matches because of the planner's habit of re-using the same PARAM_EXEC  
slot in multiple places in a plan.  Furthermore, in the absence of  
LATERAL no such reference could be valid anyway.  But it's possible  
now that we have LATERAL, and in the wake of 46c508fbc and 1db5667ba  
I believe the false-match hazard is gone.  Hence, remove the  
in_same_plan_level checks.  As shown in the regression test changes,  
this provides a useful improvement in readability for EXPLAIN of  
LATERAL-using subplans.  
  
Richard Guo, reviewed by Greg Stark and myself  
  
Discussion: https://postgr.es/m/CAMbWs4-YSOcQXAagJetP95cAeZPqzOy5kM5yijG0PVW5ztRb4w@mail.gmail.com  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/join.out
M src/test/regress/expected/subselect.out

Fix slowdown in TAP tests due to recent walreceiver change.

commit   : 5db195f76f279a120edee448ad74d43578f56edd    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 17 Nov 2022 11:30:14 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 17 Nov 2022 11:30:14 +1300    

Click here for diff

Commit 05a7be93 changed the timing of the first reply sent by a  
walreceiver, which caused a few TAP tests that call wait_for_catchup()  
when they haven't actually streamed anything yet to wait ~10 seconds  
(wal_receiver_status_interval).  
  
Before commit 05a7be93 the initial reply was sent after 100ms, but  
there's no reason not to send it immediately as a slight improvement.  
Do the same for HS feedback for consistency.  
  
Author: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/742545.1668377284%40sss.pgh.pa.us  

M src/backend/replication/walreceiver.c

Invent "multibitmapsets", and use them to speed up antijoin detection.

commit   : e9e26b5e7166e6f1873efd58f3d5a4ba22cc3d8f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Nov 2022 13:58:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Nov 2022 13:58:42 -0500    

Click here for diff

Implement a data structure that is a List of Bitmapsets, which is  
essentially a 2-D boolean array except that the rows need not all  
be the same width.  Operations such as union and intersection are  
meaningful for these, just as they are for Bitmapsets.  Eventually  
we might build many of the same operations that we have written for  
Bitmapsets, but for the first use-case we just need a few.  
  
That first use-case is for antijoin detection: reduce_outer_joins  
needs to find the set of Vars that are certain to be non-null in a  
successfully joined (not null-extended) left join row, and also  
find the set of Vars subject to higher-level IS NULL constraints,  
and intersect them.  We had been doing this by making Lists of  
the Var nodes and then using list_intersect, which works but is  
pretty inefficient compared to a bitmapset-like intersection.  
Potentially it's O(N^2) if there are a lot of Vars involved,  
which fortunately there generally aren't; still it's not great.  
Moreover, that method requires the Vars of interest to be exactly  
equal() in the join condition and the upper IS NULL condition,  
which is problematic for my WIP patch that labels Vars according  
to which outer joins have possibly nulled them.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAMbWs4-mvPPCJ1W6iK6dD5HiNwoJdi6mZp=-7mE8N9Sh+cd0tQ@mail.gmail.com  

M src/backend/nodes/Makefile
M src/backend/nodes/README
M src/backend/nodes/meson.build
A src/backend/nodes/multibitmapset.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
A src/include/nodes/multibitmapset.h

Add missing object classes to object_address test

commit   : 90e4f308b42b12bd66262c52fc4845bd0443c6e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 19:44:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 19:44:38 +0100    

Click here for diff

Per the comment, fill in classes mentioned in getObjectIdentityParts()  
but not in the test.  

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

Shave some cycles off subscription/t/100_bugs.pl tests.

commit   : fccaf259f22f4aedc02033516c561ca86903077d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Nov 2022 12:35:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Nov 2022 12:35:25 -0500    

Click here for diff

We can re-use the clusters set up for this test script's first test,  
instead of generating new ones.  On my machine this is good for  
about a 20% reduction in this script's runtime, from ~6.5 sec to  
~5.2 sec.  
  
This idea could be taken further, but it'd require a much more invasive  
patch.  These cases are easy because the Perl variable names were  
already being re-used.  
  
Anton A. Melnikov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/100_bugs.pl

Variable renaming in preparation for refactoring

commit   : 8e1db29cdbbd218ab6ba53eea56624553c3bef8c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 16:17:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 16:17:18 +0100    

Click here for diff

Rename page -> block and dp -> page where appropriate.  The old naming  
mixed up block and page in confusing ways.  
  
Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_YSOnhKsDyFcqJsKtBSrd32DP-jjXmv7hL0BPD-z0TGXQ@mail.gmail.com  

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

Remove useless casts

commit   : d1cb4e9f92c3db5c8fb52ccd1d502c73ffcc47e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 16:01:06 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 16:01:06 +0100    

Click here for diff

Maybe these are left from when PageGetItem() was a macro, but now they  
are clearly useless.  

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

Turn HeapKeyTest macro into inline function

commit   : 4eb3b11200010bf1342e51ff0f2622bba0e05c0c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 13:25:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 13:25:59 +0100    

Click here for diff

It is easier to read as a function.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_YSOnhKsDyFcqJsKtBSrd32DP-jjXmv7hL0BPD-z0TGXQ@mail.gmail.com  

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

Remove unused include

commit   : c0f1e51ac79efd4d8c07374405d9035356b30621    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 11:28:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Nov 2022 11:28:44 +0100    

Click here for diff

Author: Melanie Plageman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_YSOnhKsDyFcqJsKtBSrd32DP-jjXmv7hL0BPD-z0TGXQ@mail.gmail.com  

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

doc: document the TAP test environment variables

commit   : c4421550fb57ee12369938197aeb1cd189142453    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 16 Nov 2022 10:25:21 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 16 Nov 2022 10:25:21 +0100    

Click here for diff

The TAP tests can, to some degree, be controlled by a set of environment  
variables. These were however only documented in a README and not in the  
main documentation.  This adds documentation of these variables, as well  
as changes one CPAN reference to a ulink for consistency.  While there,  
also tag CPAN as an acronym as it's listed in the acronyms section.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/install-windows.sgml
M doc/src/sgml/regress.sgml

commit   : 5f80cd287c29b88fd364634b16c6c155d5617e8c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 16 Nov 2022 10:24:37 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 16 Nov 2022 10:24:37 +0100    

Click here for diff

The /release/ links are redirected to /dist/ and /pod/release/ to  
/release/../view/, so update our links accordingly to avoid 301  
redirects.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/external-projects.sgml
M doc/src/sgml/install-windows.sgml
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/tools/perlcheck/perlcriticrc

Use multi-inserts for pg_ts_config_map

commit   : 63c833f4bdca3251347dd622102de0908a934330    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Nov 2022 14:32:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Nov 2022 14:32:09 +0900    

Click here for diff

Two locations working on pg_ts_config_map are switched from  
CatalogTupleInsert() to a multi-insert approach with tuple slots:  
- ALTER TEXT SEARCH CONFIGURATION ADD/ALTER MAPPING when inserting new  
entries.  The number of entries to insert is known in advance, so is the  
number of slots needed.  Note that CatalogTupleInsertWithInfo() is now  
used for the entry updates.  
- CREATE TEXT SEARCH CONFIGURATION, where up to ~20-ish records could be  
inserted at once.  The number of slots is not known in advance, hence  
a slot initialization is delayed until a tuple is stored in it.  
  
Like all the changes of this kind (1ff4161, 63110c6 or e3931d01), an  
insert batch is capped at 64kB.  
  
Author: Michael Paquier, Ranier Vilela  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tsearchcmds.c

Fix test in ae168c794f, per buildfarm.

commit   : 36e0358e70498b5bf5e3e83d91ac964fc24c249e    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 15 Nov 2022 19:35:12 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 15 Nov 2022 19:35:12 -0800    

Click here for diff

Reported-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_custom_rmgrs/t/001_basic.pl

Use multi-inserts for pg_enum

commit   : 1ff416121884884a167f0974cea9f86a1d6a577f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Nov 2022 12:41:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Nov 2022 12:41:29 +0900    

Click here for diff

This allows to insert at once all the enum values defined with a given  
type into pg_enum, reducing the WAL produced by roughly 10%~.  pg_enum's  
indexes are opened and closed now once rather than N times.  The number  
of items to insert is known in advance, making this change  
straight-forward, and would happen on a CREATE TYPE .. AS ENUM.  
  
The amount of data inserted is capped at 64kB for each insert batch.  
This is similar to commits 63110c6 and e3931d01, that worked on  
different catalogs.  
  
Reported-by: Ranier Vilela  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, Ranier Vilela  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_enum.c

Avoid some overhead with open and close of catalog indexes

commit   : 09a72188cd5cdd179dc814c6729f8a3785b23c36    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Nov 2022 10:49:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Nov 2022 10:49:05 +0900    

Click here for diff

This commit improves two code paths to open and close indexes a  
minimum amount of times when doing a series of catalog updates or  
inserts.  CatalogTupleInsert() is costly when using it for multiple  
inserts or updates compared to CatalogTupleInsertWithInfo(), as it would  
need to open and close the indexes of the catalog worked each time an  
operation is done.  
  
This commit updates the following places:  
- REINDEX CONCURRENTLY when copying statistics from one index relation  
to the other.  Multi-INSERTs are avoided here, as this would begin to  
show benefits only for indexes with multiple expressions, for example,  
which may not be the most common pattern.  This change is noticeable in  
profiles with indexes having many expressions, for example, and it would  
improve any callers of CopyStatistics().  
- Update of statistics on ANALYZE, that mixes inserts and updates.  
In each case, the catalog indexes are opened only if at least one  
insertion and/or update is required, to minimize the cost of the  
operation.  Like the previous coding, no indexes are opened as long as  
at least one insert or update of pg_statistic has happened.  
  
Author: Ranier Vilela  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/CAEudQAqh0F9y6Di_Wc8xW4zkWm_5SDd-nRfVsCn=h0Nm1C_mrg@mail.gmail.com  

M src/backend/catalog/heap.c
M src/backend/commands/analyze.c

Add test module for SLRUs

commit   : 006b69fd912b8fa0e9d80df3f61829a5c976c3d3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Nov 2022 09:52:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Nov 2022 09:52:21 +0900    

Click here for diff

This commit introduces a basic facility to test SLRUs, in terms of  
initialization, page reads, writes, flushes, truncation and deletions,  
using SQL wrappers around the APIs of slru.c.  This should be easily  
extensible at will, and it can be used as a starting point for someone  
willing to implement an external module that makes use of SLRUs (LWLock  
tranche registering and SLRU initialization particularly).  
  
As this requires a loaded library, the tests use a custom configuration  
file and are disabled under installcheck.  
  
Author: Aleksander Alekseev, Michael Paquier  
Reviewed-by: Pavel Borisov, Daniel Gustafsson, Noah Misch, Maxim Orlov  
Discussion: https://postgr.es/m/CAJ7c6TOFoWcHOW4BVe3BG_uikCrO9B91ayx9d6rh5JZr_tPESg@mail.gmail.com  

M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_slru/.gitignore
A src/test/modules/test_slru/Makefile
A src/test/modules/test_slru/expected/test_slru.out
A src/test/modules/test_slru/meson.build
A src/test/modules/test_slru/sql/test_slru.sql
A src/test/modules/test_slru/test_slru–1.0.sql
A src/test/modules/test_slru/test_slru.c
A src/test/modules/test_slru/test_slru.conf
A src/test/modules/test_slru/test_slru.control

Mark argument of RegisterCustomRmgr() as const.

commit   : 1eda3ce80287f985f8165640d4bf663fe4649b41    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 15 Nov 2022 15:58:12 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 15 Nov 2022 15:58:12 -0800    

Click here for diff

M doc/src/sgml/custom-rmgr.sgml
M src/backend/access/transam/rmgr.c
M src/include/access/xlog_internal.h
M src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c

Add test module for Custom WAL Resource Manager feature.

commit   : ae168c794f09984d8fe44e7da2ca6ad3eeb570f1    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 15 Nov 2022 13:10:27 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 15 Nov 2022 13:10:27 -0800    

Click here for diff

Author: Bharath Rupireddy, Jeff Davis  
Discussion: https://postgr.es/m/CALj2ACVTBNA1wfVCsikfhygAbZe6kFY8Oz6PhOyhHyA4vAGouA%40mail.gmail.com  

M doc/src/sgml/custom-rmgr.sgml
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_custom_rmgrs/.gitignore
A src/test/modules/test_custom_rmgrs/Makefile
A src/test/modules/test_custom_rmgrs/meson.build
A src/test/modules/test_custom_rmgrs/t/001_basic.pl
A src/test/modules/test_custom_rmgrs/test_custom_rmgrs–1.0.sql
A src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
A src/test/modules/test_custom_rmgrs/test_custom_rmgrs.control

Deduplicate freeze plans in freeze WAL records.

commit   : 9e5405993c1e242ae6fb7561353e437241244ac1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 15 Nov 2022 07:48:41 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 15 Nov 2022 07:48:41 -0800    

Click here for diff

Make heapam WAL records that describe freezing performed by VACUUM more  
space efficient by storing each distinct "freeze plan" once, alongside  
an array of associated page offset numbers (one per freeze plan).  The  
freeze plans required for most heap pages tend to naturally have a great  
deal of redundancy, so this technique is very effective in practice.  It  
often leads to freeze WAL records that are less than 20% of the size of  
equivalent WAL records generated using the previous approach.  
  
The freeze plan concept was introduced by commit 3b97e6823b, which fixed  
bugs in VACUUM's handling of MultiXacts.  We retain the concept of  
freeze plans, but go back to using page offset number arrays.  There is  
no loss of generality here because deduplication is an additive process  
that gets applied mechanically when FREEZE_PAGE WAL records are built.  
  
More than anything else, freeze plan deduplication is an optimization  
that reduces the marginal cost of freezing additional tuples on pages  
that will need to have at least one or two tuples frozen in any case.  
Ongoing work that adds page-level freezing to VACUUM will take full  
advantage of the improved cost profile through batching.  
  
Also refactor some of the details surrounding recovery conflicts needed  
to REDO freeze records in passing: make original execution responsible  
for generating a standard latestRemovedXid cutoff, rather than working  
backwards to get the same cutoff in the REDO routine.  Bugfix commit  
66fbcb0d2e did it the other way around, which is equivalent but obscures  
what's going on.  
  
Also rename the cutoff field from the WAL record/struct (rename the  
field cutoff_xid to latestRemovedXid to match similar WAL records).  
Processing of conflicts by REDO routines is already completely uniform,  
so tools like pg_waldump should present the information driving the  
process uniformly.  There are two remaining WAL record types that still  
don't quite follow this convention (heapam's VISIBLE record type and  
SP-GiST's VACUUM_REDIRECT record type).  They can be brought into line  
by later work that totally standardizes how the cutoffs are presented.  
  
Bump XLOG_PAGE_MAGIC.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Masahiko Sawada <[email protected]>  
Reviewed-By: Nathan Bossart <[email protected]>  
Reviewed-By: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=XytErMnb8FAyFd+OQEbiipB0Q2FmFdXrggPL4VBnRYQ@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/xlog_internal.h

Check return value of pclose() correctly

commit   : 2fe3bdbd691a5d11626308e7d660440be6c210c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 15:35:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 15:35:37 +0100    

Click here for diff

Some callers didn't check the return value of pclose() or  
ClosePipeStream() correctly.  Either they didn't check it at all or  
they treated it like the return of fclose().  
  
The correct way is to first check whether the return value is -1, and  
then report errno, and then check the return value like a result from  
system(), for which we already have wait_result_to_str() to make it  
simpler.  To make this more compact, expand wait_result_to_str() to  
also handle -1 explicitly.  
  
Reviewed-by: Ankit Kumar Pandey <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/collationcmds.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/option.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/common/wait_error.c

doc: Use more concise wording for pl/pgSQL TG_ variables

commit   : b7f3981756d314d32cca27b5c3d31bdd58b6ff06    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 15 Nov 2022 14:51:02 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 15 Nov 2022 14:51:02 +0100    

Click here for diff

To improve readability of the TG_ variables definition lists, this moves  
the datatypes up to the defined term to avoid having each entry start  
with "Data type". This also removes redundant wording that that didn't  
carry any information from the descriptions.  
  
Author: Christoph Berg <[email protected]>  
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml

psql: Add command to use extended query protocol

commit   : 5b66de3433e2110b38a2b32aaaa0b9cdac8aacdb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 13:50:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 13:50:27 +0100    

Click here for diff

This adds a new psql command \bind that sets query parameters and  
causes the next query to be sent using the extended query protocol.  
Example:  
  
    SELECT $1, $2 \bind 'foo' 'bar' \g  
  
This may be useful for psql scripting, but one of the main purposes is  
also to be able to test various aspects of the extended query protocol  
from psql and to write tests more easily.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

libpq error message refactoring, part 2

commit   : a9e9a9f32b35edf129c88e8b929ef223f8511f59    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 11:50:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 11:50:04 +0100    

Click here for diff

This applies the new APIs to the code.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.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

libpq error message refactoring

commit   : 0873b2d354b9c73a69067c0afb92e35994adc47e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 11:50:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 11:50:04 +0100    

Click here for diff

libpq now contains a mix of error message strings that end with  
newlines and don't end with newlines, due to some newer code paths  
with new ways of passing errors around.  This leads to confusion and  
mistakes both during development and translation.  
  
This adds new functions libpq_append_error() and  
libpq_append_conn_error() that encapsulate common code paths for  
producing error message strings.  Notably, these functions append the  
newline, so that the string appearing in the code does not end with a  
newline.  This makes (almost) all error message strings in libpq  
uniform in this regard (and also consistent with how we handle it  
outside of libpq code).  (There are a few exceptions that are  
difficult to fit into this scheme, but they are only a few.)  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/nls.mk
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h

Disallow setting archive_library and archive_command at the same time

commit   : d627ce3b706de16279d8eb683bfeda34ad7197fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 10:03:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Nov 2022 10:03:12 +0100    

Click here for diff

Setting archive_library and archive_command at the same time is now an  
error.  Before, archive_library would take precedence over  
archive_command.  
  
Author: Nathan Bossart <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20220914222736.GA3042279%40nathanxps13  

M doc/src/sgml/config.sgml
M src/backend/postmaster/pgarch.c

Improve comments referring snapshot's subxip array.

commit   : 8b5262fa0efdd515a05e533c2a1198e7b666f7d8    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 15 Nov 2022 09:37:19 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 15 Nov 2022 09:37:19 +0530    

Click here for diff

It was referred to as subxact array in a few places and subxip array in  
others. By changing it to subxip array, we make it consistent with similar  
references to xip array.  
  
Author: Japin Li  
Reviewd by: Julien Rouhaud, Richard Guo  
Discussion: https://postgr.es/m/MEYP282MB1669DCE7AC193A947CED2A95B6009@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/storage/ipc/procarray.c
M src/backend/utils/time/snapmgr.c

Fix cleanup lock acquisition in SPLIT_ALLOCATE_PAGE replay.

commit   : e848be60b5cf9a883765ea8e98c411e7fef0c1c6    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 14 Nov 2022 10:43:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 14 Nov 2022 10:43:33 +0530    

Click here for diff

During XLOG_HASH_SPLIT_ALLOCATE_PAGE replay, we were checking for a  
cleanup lock on the new bucket page after acquiring an exclusive lock on  
it and raising a PANIC error on failure. However, it is quite possible  
that checkpointer can acquire the pin on the same page before acquiring a  
lock on it, and then the replay will lead to an error. So instead, directly  
acquire the cleanup lock on the new bucket page during  
XLOG_HASH_SPLIT_ALLOCATE_PAGE replay operation.  
  
Reported-by: Andres Freund  
Author: Robert Haas  
Reviewed-By: Amit Kapila, Andres Freund, Vignesh C  
Backpatch-through: 11  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashpage.c

Add error context callback when tokenizing authentication files

commit   : ad6c52846f13e4e86daa247c1369ed85558830e7    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 14 Nov 2022 11:58:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 14 Nov 2022 11:58:10 +0900    

Click here for diff

The parsing of the authentication files for HBA and ident entries  
happens in two phases:  
- Tokenization of the files, creating a list of TokenizedAuthLines.  
- Validation of the HBA and ident entries, building a set of HbaLines or  
IdentLines.  
  
The second phase doing the validation provides already some error  
context about the configuration file and the line where a problem  
happens, but there is no such information in the first phase when  
tokenizing the files.  This commit adds an ErrorContextCallback in  
tokenize_auth_file(), with a context made of the line number and the  
configuration file name involved in a problem.  This is useful for files  
included in an HBA file for user and database lists, and it will become  
much more handy to track problems for files included via a potential  
@include[_dir,_if_exists].  
  
The error context is registered so as the full chain of events is  
reported when using cascaded inclusions when for example  
tokenize_auth_file() recurses over itself on new files, displaying one  
context line for each file gone through when tokenizing things.  
  
Author: Michael Paquier  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c
M src/tools/pgindent/typedefs.list

Invent open_auth_file() in hba.c to refactor authentication file opening

commit   : 783e8c69cbcd2b7d6fce1f0c5b568b1c8b686d54    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 14 Nov 2022 10:21:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 14 Nov 2022 10:21:42 +0900    

Click here for diff

This adds a check on the recursion depth when including authentication  
configuration files, something that has never been done when processing  
'@' files for database and user name lists in pg_hba.conf.  On HEAD,  
this was leading to a rather confusing error, as of:  
FATAL:  exceeded maxAllocatedDescs (NN) while trying to open file "/path/blah.conf"  
  
This refactors the code so as the error reported is now the following,  
which is the same as for GUCs:  
FATAL: could not open file "/path/blah.conf": maximum nesting depth exceeded  
  
This reduces a bit the verbosity of the error message used for files  
included in user and database lists, reporting only the file name of  
what's failing to load, without mentioning the relative or absolute path  
specified after '@' in a HBA file.  The absolute path is built upon what  
'@' defines anyway, so there is no actual loss of information.  This  
makes the future inclusion logic much simpler.  A follow-up patch will  
add an error context to be able to track on which line of which file the  
inclusion is failing, to close the loop, providing all the information  
needed to know the full chain of events.  
  
This logic has been extracted from a larger patch written by Julien,  
rewritten by me to have a unique code path calling AllocateFile() on  
authentication files, and is useful on its own.  This new interface  
will be used later for authentication files included with  
@include[_dir,_if_exists], in a follow-up patch.  
  
Author: Michael Paquier, Julien Rouhaud  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/hba.c
M src/backend/utils/adt/hbafuncs.c
M src/include/libpq/hba.h

libpq: Add missing newlines to error messages

commit   : 45d5ecab49f6c0df607d3ca2ce1995229f416d1a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2022 21:09:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2022 21:09:09 +0100    

Click here for diff

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

libpq: Remove unneeded cast and adjust format placeholder

commit   : 062e133f6d579f50e6e90642defca725d47add1d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2022 21:09:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2022 21:09:05 +0100    

Click here for diff

M src/interfaces/libpq/fe-secure-common.c

Make Bitmapsets be valid Nodes.

commit   : 5e1f3b9ebf6e51f2c60abe9aba969c28a3b0f6c6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Nov 2022 10:22:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Nov 2022 10:22:45 -0500    

Click here for diff

Add a NodeTag field to struct Bitmapset.  This is free because of  
alignment considerations on 64-bit hardware.  While it adds some  
space on 32-bit machines, we aren't optimizing for that case anymore.  
The advantage is that data structures such as Lists of Bitmapsets  
are now first-class objects to the Node infrastructure, and don't  
require special-case code to handle.  
  
This patch includes removal of one such special case, in indxpath.c:  
bms_equal_any() can now be replaced by list_member().  There may be  
more existing code that could be simplified, but I didn't look very  
hard.  We also get to drop the read_write_ignore annotations on a  
couple of RelOptInfo fields.  
  
The outfuncs/readfuncs support is arranged so that nothing changes  
in the string representation of a Bitmapset field; therefore, this  
doesn't need a catversion bump.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/Makefile
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/outfuncs.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/indxpath.c
M src/include/nodes/bitmapset.h
M src/include/nodes/meson.build
M src/include/nodes/pathnodes.h

Use installed postgresql.conf.sample for GUC sanity TAP test

commit   : 9c7eb9d85a5687d4f9624c40ee3a508d8c7de35a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 13 Nov 2022 09:07:53 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 13 Nov 2022 09:07:53 -0500    

Click here for diff

The current code looks for the sample file in the source directory, but  
it seems better to test against the installed sample file.  
  
Backpatch to release 15 where the test was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Reviewed by Tom Lane, Alvaro Herrera, Michael Paquier.  

M src/test/modules/test_misc/t/003_check_guc.pl

Make PostgreSQL::Test::Cluster::config_data more flexible

commit   : a688c39e1dca56490527ccac13ea4ac752c7116a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 13 Nov 2022 08:45:14 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 13 Nov 2022 08:45:14 -0500    

Click here for diff

Currently this only allows for one argument, which must be present, and  
always returns a single string. With this change the following now all  
work:  
  
  $all_config = $node->config_data;  
  %config_map = ($node->config_data);  
  $incdir = $node->config_data('--include-dir');  
  ($incdir, $sharedir) = $node->config_data(  
      qw(--include-dir --share-dir));  
  
Backpatch to release 15 where this was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Reviewed by Tom Lane, Alvaro Herrera, Michael Paquier.  

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

Refactor aclcheck functions

commit   : c727f511bd7bf3c58063737bcf7a8f331346f253    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2022 08:11:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2022 08:11:17 +0100    

Click here for diff

Instead of dozens of mostly-duplicate pg_foo_aclcheck() functions,  
write one common function object_aclcheck() that can handle almost all  
of them.  We already have all the information we need, such as which  
system catalog corresponds to which catalog table and which column is  
the ACL column.  
  
There are a few pg_foo_aclcheck() that don't work via the generic  
function and have special APIs, so those stay as is.  
  
I also changed most pg_foo_aclmask() functions to static functions,  
since they are not used outside of aclchk.c.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Reviewed-by: Antonin Houska <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/dblink/dblink.c
M src/backend/access/common/tupdesc.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_operator.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/collationcmds.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/dbcommands.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execExpr.c
M src/backend/executor/execSRF.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/fastpath.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/init/postinit.c
M src/include/utils/acl.h
M src/pl/tcl/pltcl.c

Refactor ownercheck functions

commit   : afbfc02983f86c4d71825efa6befd547fe81a926    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2022 08:11:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Nov 2022 08:11:17 +0100    

Click here for diff

Instead of dozens of mostly-duplicate pg_foo_ownercheck() functions,  
write one common function object_ownercheck() that can handle almost  
all of them.  We already have all the information we need, such as  
which system catalog corresponds to which catalog table and which  
column is the owner column.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Reviewed-by: Antonin Houska <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/pg_surgery/heap_surgery.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginfast.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/libpq/be-fsstubs.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/misc/rls.c
M src/include/utils/acl.h

Add repalloc0 and repalloc0_array

commit   : b4b7ce8061d34cea2b4915c41403b2a74d5fde0e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 12 Nov 2022 20:31:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 12 Nov 2022 20:31:27 +0100    

Click here for diff

These zero out the space added by repalloc.  This is a common pattern  
that is quite hairy to code by hand.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/executor/nodeHash.c
M src/backend/libpq/be-fsstubs.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/parse_param.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/mmgr/mcxt.c
M src/include/utils/palloc.h

If wait_for_catchup fails under has_wal_read_bug, skip balance of test.

commit   : 30d98e14a88930c6d9658525fd5e6722e70a02e6    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 12 Nov 2022 11:19:50 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 12 Nov 2022 11:19:50 -0800    

Click here for diff

Test files should now ignore has_wal_read_bug() so long as  
wait_for_catchup() is their only known way of reaching the bug.  That's  
at least five files today, a number expected to grow over time.  This  
commit removes skip logic from three.  By doing so, systems having the  
bug regain the ability to catch other kinds of defects via those three  
tests.  The other two, 002_databases.pl and 031_recovery_conflict.pl,  
have been unprotected.  Back-patch to v15, where done_testing() first  
became our standard.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/t/001_wal.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/032_relfilenode_reuse.pl

Fix volatility marking of timestamptz_trunc_zone.

commit   : 533e02e927c6e7fcc1a7b3121093d8f05b728279    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Nov 2022 13:29:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Nov 2022 13:29:41 -0500    

Click here for diff

It's safe to mark this as immutable, because it does not depend  
on the timezone GUC setting.  Oversight in commit 600b04d6b.  
  
(There's an argument that timezone definitions do change from  
time to time, but we have not worried about that in marking  
other timestamp-related functions; for example AT TIME ZONE  
has always been considered immutable.  The situation is no  
worse than our problems with time-varying locales, surely.)  
  
Przemysław Sztoch  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

commit   : 97c61f70d1b97bdfd20dcb1f2b1be42862ec88c2    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 12 Nov 2022 08:37:50 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 12 Nov 2022 08:37:50 -0800    

Click here for diff

Also improve comments.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Geoghegan  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/transam/README

Fix theoretical torn page hazard.

commit   : d6a3dbe14f98d867b2fc3faeb99d2d3c2a48ca67    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 10 Nov 2022 14:46:30 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 10 Nov 2022 14:46:30 -0800    

Click here for diff

The original report was concerned with a possible inconsistency  
between the heap and the visibility map, which I was unable to  
confirm. The concern has been retracted.  
  
However, there did seem to be a torn page hazard when using  
checksums. By not setting the heap page LSN during redo, the  
protections of minRecoveryPoint were bypassed. Fixed, along with a  
misleading comment.  
  
It may have been impossible to hit this problem in practice, because  
it would require a page tear between the checksum and the flags, so I  
am marking this as a theoretical risk. But, as discussed, it did  
violate expectations about the page LSN, so it may have other  
consequences.  
  
Backpatch to all supported versions.  
  
Reported-by: Konstantin Knizhnik  
Reviewed-by: Konstantin Knizhnik  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

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

Remove obsolete comments and code from prior to f8f4227976.

commit   : 3eb8eeccbee31597c5962de10dcb3930d780cb19    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 11 Nov 2022 08:40:01 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 11 Nov 2022 08:40:01 -0800    

Click here for diff

XLogReadBufferForRedo() and XLogReadBufferForRedoExtended() only return  
BLK_NEEDS_REDO if the record LSN is greater than the page LSN, so  
the redo routine doesn't need to do the LSN check again.  
  
Discussion: https://postgr.es/m/[email protected]  

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

meson: Define HAVE_LOCALE_T for msvc

commit   : 373679c4a82f04e6c16198cdffab1a6c56852956    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Nov 2022 16:00:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Nov 2022 16:00:48 +0100    

Click here for diff

Meson doesn't see the redefinition of locale_t done in  
src/include/port/win32_port.h, so it is not defining HAVE_LOCALE_T,  
HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the current  
src/tools/msvc/build.pl script does.  Add manual overrides to fix.  
  
Author: Author: Juan Jose Santamaria Flecha <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAC%2BAXB1wJEqfKCuVcNpoH%3Dgxd61N%3D7c2fR3Ew6YRPpSfEUA%3DyQ%40mail.gmail.com  

M meson.build

Support writing "CREATE/ALTER TABLE ... SET STORAGE DEFAULT".

commit   : b9424d014e195386a83b0f1fe9f5a8e5727e46ea    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2022 18:20:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2022 18:20:49 -0500    

Click here for diff

We already allow explicitly writing DEFAULT for SET COMPRESSION,  
so it seems a bit inflexible and non-orthogonal to not have it  
for STORAGE.  
  
Aleksander Alekseev  
  
Discussion: https://postgr.es/m/CAJ7c6TMX9ui+6y3TQFaXJYVpZyBukvqhQbVDJ8OUokeLRhtnpA@mail.gmail.com  

M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Fix alter_table.sql test case to test what it claims to.

commit   : b158e0b1b1bfd2dfce6d66d67dba3c94449f9cac    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2022 17:24:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Nov 2022 17:24:26 -0500    

Click here for diff

The stanza "SET STORAGE may need to add a TOAST table" does not  
test what it's supposed to, and hasn't done so since we added  
the ability to store constant column default values as metadata.  
We need to use a non-constant default to get the expected table  
rewrite to actually happen.  
  
Fix that, and add the missing checks that would have exposed the  
problem to begin with.  
  
Noted while reviewing a patch that made changes in this test case.  
Back-patch to v11 where the problem came in.  

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

Fix comments atop ReorderBufferAddInvalidations.

commit   : 36e545cd051ffe58064c1f38faeb64f4feef4aec    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 10 Nov 2022 16:56:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 10 Nov 2022 16:56:49 +0530    

Click here for diff

The comments atop seem to indicate that we always accumulate invalidation  
messages in a top-level transaction which is neither required nor matches  
with the code.  
  
Author: Amit Kapila  
Reviewd by: Masahiko Sawada  
Backpatch-through: 14, where it was introduced in commit c55040ccd0  
Discussion: https://postgr.es/m/CAA4eK1LxGgnUroPz8STb6OfjVU1yaHoSA+T63URwmGCLdMJ0LA@mail.gmail.com  

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

Fix comment of SimpleLruInit() in slru.c

commit   : 5ca3645cb3fb4b8b359ea560f6a1a230ea59c8bc    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 10 Nov 2022 16:32:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 10 Nov 2022 16:32:29 +0900    

Click here for diff

sync_handler was not mentioned in the comment block of the function.  
  
Oversight in dee663f.  
  
Author: Aleksander Alekseev  
Discussion: https://postgr.es/m/CAJ7c6TPUd9BwNY47TtMxaijLHSbyHNdhu=kvbGnvO_bi+oC6_Q@mail.gmail.com  
Backpatch-through: 14  

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

Apply a better fix to mdunlinkfork().

commit   : 85d8b30724c0fd117a683cc72706f71b28463a05    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Nov 2022 14:15:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Nov 2022 14:15:38 -0500    

Click here for diff

Replace the stopgap fix I made in 0e758ae89 with a cleaner one.  
  
The real problem with 4ab5dae94 is that it contorted this function's  
logic substantially, by introducing a third code path that required  
different behavior in the function's main loop.  That seems quite  
unnecessary on closer inspection: the new IsBinaryUpgrade case can  
just share the behavior of the other immediate-unlink cases.  Hence,  
revert 4ab5dae94 and most of 0e758ae89 (keeping the latter's  
save/restore errno fix), and add IsBinaryUpgrade to the set of  
conditions tested to choose immediate unlink.  
  
Also fix some additional places with sloppy handling of errno,  
to ensure we have an invariant that we always continue processing  
after any non-ENOENT failure of do_truncate.  I doubt that that's  
fixing any bug of field importance, so I don't feel it necessary to  
back-patch; but we might as well get it right while we're here.  
  
Also improve the comments, which had drifted a bit from what the  
code actually does, and neglected to mention some important  
considerations.  
  
Back-patch to v15, not because this is fixing any bug but because  
it doesn't seem like a good idea for v15's mdunlinkfork logic to be  
significantly different from both v14 and v16.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove redundant declaration for XidInMVCCSnapshot

commit   : ff0d8f27f4d97c8e34ac5df19d0f232fb2f53744    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 9 Nov 2022 18:27:31 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 9 Nov 2022 18:27:31 +0100    

Click here for diff

This was added for no good reason by c91560defc57, after b7eda3e0e334  
had just moved the prototype from utils/tqual.h to utils/snapmgr.h.  
  
Author: Japin Li <[email protected]>  
Discussion: https://postgr.es/m/MEYP282MB16693A409F3282A9DB287BADB63E9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/include/access/heapam.h

Report a more useful error for reloptions on a partitioned table.

commit   : 4f981df8e0b7bc00d22ab0db65579589c9d4bb8c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Nov 2022 12:28:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Nov 2022 12:28:34 -0500    

Click here for diff

Previously, trying to set storage parameters on a partitioned table  
always led to "unrecognized parameter foo", because the code expected  
there might be some valid parameters; but there aren't any.  The docs  
make clear that it's intended that there never will be any, so let's  
replace this useless search with a more to-the-point message.  
  
Simon Riggs and Karina Litskevich  
  
Discussion: https://postgr.es/m/CANbhV-H=eZ9kTR9mUgKGK0Qv9uXP=U+dQg3rinQHfTdFMhBA2A@mail.gmail.com  

M src/backend/access/common/reloptions.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql

Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.

commit   : e613ace1f0d5734b62b133e9700300166ece1599    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Nov 2022 11:08:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Nov 2022 11:08:52 -0500    

Click here for diff

Add a little to the header comments for these functions to make it  
clearer what guarantees about commit behavior are provided to callers.  
(See commit f92944137 for context.)  
  
Although this is only a comment change, it's really documentation  
aimed at authors of extensions, so it seems appropriate to back-patch.  
  
Yugo Nagata and Tom Lane, per further discussion of bug #17434.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Provide sigaction() for Windows.

commit   : b28ac1d24db44ae763a57688e7a559352002badc    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 9 Nov 2022 13:05:16 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 9 Nov 2022 13:05:16 +1300    

Click here for diff

Commit 9abb2bfc left behind code to block signals inside signal  
handlers on Windows, because our signal porting layer didn't have  
sigaction().  Provide a minimal implementation that is capable of  
blocking signals, to get rid of platform differences.  See also related  
commit c94ae9d8.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKKKfcgx6jzok9AYenp2TNti_tfs8FMoJpL8%2B0Gsy%3D%3D_A%40mail.gmail.com  

M src/backend/libpq/pqsignal.c
M src/backend/port/win32/signal.c
M src/backend/postmaster/postmaster.c
M src/include/libpq/pqsignal.h
M src/port/pqsignal.c

Use AbsoluteConfigLocation() when building an included path in hba.c

commit   : 6bbd8b73857a337e3aba2f6cdcaca6355b4c2b51    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 9 Nov 2022 08:47:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 9 Nov 2022 08:47:02 +0900    

Click here for diff

The code building an absolute path to a file included, as prefixed by  
'@' in authentication files, for user and database lists uses the same  
logic as for GUCs, except that it has no need to know about DataDir as  
there is always a calling file to rely to build the base directory path.  
The refactoring done in a1a7bb8 makes this move straight-forward, and  
unifies the code used for GUCs and authentication files, and the  
intention is to rely also on that for the upcoming patch to be able to  
include full files from HBA or ident files.  
  
Note that this gets rid of an inconsistency introduced in 370f909, that  
copied the logic coming from GUCs but applied it for files included in  
authentication files, where the result buffer given to  
join_path_components() must have a size of MAXPGPATH.  Based on a  
double-check of the existing code, all the other callers of  
join_path_components() already do that, except the code path changed  
here.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c
M src/backend/utils/misc/conffiles.c

Doc: improve tutorial section about grouped aggregates.

commit   : f05a5e0003edfec027ee10d09082667036862e1c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2022 18:25:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2022 18:25:03 -0500    

Click here for diff

Commit fede15417 introduced FILTER by jamming it into the existing  
example introducing HAVING, which seems pedagogically poor to me;  
and it added no information about what the keyword actually does.  
Not to mention that the claimed output didn't match the sample  
data being used in this running example.  
  
Revert that and instead make an independent example using FILTER.  
To help drive home the point that it's a per-aggregate filter,  
we need to use two aggregates not just one; for consistency  
expand all the examples in this segment to do that.  
  
Also adjust the example using WHERE ... LIKE so that it'd produce  
nonempty output with this sample data, and show that output.  
  
Back-patch, as the previous patch was.  (Sadly, v10 is now out  
of scope.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/query.sgml

Unify some internal error message wordings

commit   : b5621b66e778112c78d381414dff8917320f71d2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Nov 2022 18:45:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Nov 2022 18:45:29 +0100    

Click here for diff

M src/backend/catalog/aclchk.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/utils/adt/acl.c

Produce more-optimal plans for bitmap scans on boolean columns.

commit   : 042c9091f0fc131d001516bafc9ce334fe20d711    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2022 10:36:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Nov 2022 10:36:04 -0500    

Click here for diff

The planner simplifies boolean comparisons such as "x = true" and  
"x = false" down to "x" and "NOT x" respectively, to have a canonical  
form to ease comparisons.  However, if we want to use an index on x,  
the index AM APIs require us to reconstitute the comparison-operator  
form of the indexqual.  While that works, in bitmap indexscans the  
canonical form of the qual was emitted as a "filter" condition  
although it really only needs to be a "recheck" condition, because  
create_bitmap_scan_plan didn't recognize the equivalence of that  
form with the generated indexqual.  booleq() is pretty cheap so that  
likely doesn't make very much difference, but it's unsightly so  
let's clean it up.  
  
To fix, add a case to predicate_implied_by() to recognize the  
equivalence of such clauses.  This is a relatively low-cost place to  
add a check, and perhaps it will have additional use cases in future.  
  
Richard Guo and Tom Lane, per discussion of bug #17618 from Sindy  
Senorita.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/expected/bool.out
M contrib/btree_gin/sql/bool.sql
M src/backend/optimizer/util/predtest.c

Suppress useless wakeups in walreceiver.

commit   : 05a7be93558c614ab89c794cb1d301ea9ff33199    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 8 Nov 2022 20:36:36 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 8 Nov 2022 20:36:36 +1300    

Click here for diff

Instead of waking up 10 times per second to check for various timeout  
conditions, keep track of when we next have periodic work to do.  
  
Author: Thomas Munro <[email protected]>  
Author: Nathan Bossart <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJGhX4r2LPUE3Oy9BX71Eum6PBcS8L3sJpScR9oKaTVaA%40mail.gmail.com  

M src/backend/replication/walreceiver.c
M src/tools/pgindent/typedefs.list

psql: Add information in \d+ about foreign partitions and child tables

commit   : bd95816f74ad4cad3d2a3c160be426358d6cea51    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Nov 2022 14:19:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Nov 2022 14:19:09 +0900    

Click here for diff

\d+ is already able to show if a partition or a child table is  
"PARTITIONED" via its relkind, hence the addition of a keyword for  
"FOREIGN" in the relation description is basically free.  
  
Author: Ian Lawrence Barwick  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CAB8KJ=iwzbEz2HR9EhNxQLVhMk2G_OYtQPJ9V=jWLadseggrOA@mail.gmail.com  

M src/bin/psql/describe.c
M src/test/regress/expected/foreign_data.out

Use pg_pwrite_zeros() in walmethods.c

commit   : 28cc2976a9cf0ed661dbc55f49f669192cce1c89    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Nov 2022 12:37:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Nov 2022 12:37:11 +0900    

Click here for diff

This change impacts pg_receivewal and pg_basebackup, for the pre-padding  
with zeros of all the new non-compressed WAL segments, so as the code is  
more robust on partial writes.  This makes the code consistent with the  
backend (XLogFileInitInternal) when wal_init_zeros is enabled for the  
WAL segment initialization.  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart, Andres Freund, Thomas Munro, Michael  
Paquier  
Discussion: https://postgr.es/m/CALj2ACUq7nAb7=bJNbK3yYmp-SZhJcXFR_pLk8un6XgDzDF3OA@mail.gmail.com  

M src/bin/pg_basebackup/walmethods.c

Introduce pg_pwrite_zeros() in fileutils.c

commit   : 3bdbdf5d06f2179d4c17926d77ff734ea9e7d525    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Nov 2022 12:23:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Nov 2022 12:23:46 +0900    

Click here for diff

This routine is designed to write zeros to a file using vectored I/O,  
for a size given by its caller, being useful when it comes to  
initializing a file with a final size already known.  
  
XLogFileInitInternal() in xlog.c is changed to use this new routine when  
initializing WAL segments with zeros (wal_init_zero enabled).  Note that  
the aligned buffers used for the vectored I/O writes have a size of  
XLOG_BLCKSZ, and not BLCKSZ anymore, as pg_pwrite_zeros() relies on  
PGAlignedBlock while xlog.c originally used PGAlignedXLogBlock.  
  
This routine will be used in a follow-up patch to do the pre-padding of  
WAL segments for pg_receivewal and pg_basebackup when these are not  
compressed.  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart, Andres Freund, Thomas Munro, Michael  
Paquier  
Discussion: https://www.postgresql.org/message-id/CALj2ACUq7nAb7%3DbJNbK3yYmp-SZhJcXFR_pLk8un6XgDzDF3OA%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/common/file_utils.c
M src/include/common/file_utils.h

Fix initialization of pg_stat_get_lastscan()

commit   : d7744d50a5394db8d973d1cfa034ed6640aec13c    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Nov 2022 10:50:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Nov 2022 10:50:09 +0900    

Click here for diff

A NULL result should be reported when a stats timestamp is set to 0, but  
c037471 missed that, leading to a confusing timestamp value after for  
example a DML on a freshly-created relation with no scans done on it  
yet.  
  
This impacted the following attributes for two system views:  
- pg_stat_all_tables.last_idx_scan  
- pg_stat_all_tables.last_seq_scan  
- pg_stat_all_indexes.last_idx_scan  
  
Reported-by: Robert Treat  
Analyzed-by: Peter Eisentraut  
Author: Dave Page  
Discussion: https://postgr.es/m/CABV9wwPzMfSaz3EfKXXDxKmMprbxwF5r6WPuxqA=5mzRUqfTGg@mail.gmail.com  

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

Fix compiler warning on MSVC

commit   : 1613de8bc34b4977d0186b56ef5a00ef8058a74a    
  
author   : David Rowley <[email protected]>    
date     : Tue, 8 Nov 2022 10:54:04 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 8 Nov 2022 10:54:04 +1300    

Click here for diff

MSVC does not understand that ereport(ERROR) does not return, so just  
return the first enum PartitionStrategy value to keep the compiler from  
complaining about the missing return.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/gram.y

Fix failure to remove non-first segments of temporary tables.

commit   : 0e758ae89a20f233bb1c20a0f52ac7c81b2ef1b8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2022 11:36:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Nov 2022 11:36:45 -0500    

Click here for diff

Commit 4ab5dae94 broke mdunlinkfork's logic for removing additional  
segments of a multi-gigabyte table, because it neglected to advance  
"segno" after unlinking the first segment, in the code path where it  
chooses to unlink that one immediately.  Then the main remove loop  
gets ENOENT at segment zero and figures it's done, so we never remove  
whatever additional segments might exist.  
  
The main problem here is with large temporary tables, but WAL replay  
of a drop of a large regular table would also fail to remove extra  
segments.  The third case where this path is taken is for non-main  
forks; but I doubt it matters for those since they probably never  
exceed 1GB.  
  
The simplest fix is just to increment segno after that unlink().  
(Probably this logic could do with a more thorough rethink, but not  
with mere hours to go before 15.1 wraps.)  
  
While here, also fix an incautious assumption that  
register_forget_request cannot change errno.  I don't think that  
that has any really bad consequences, as we'd end up trying to unlink  
the zero'th segment either way, but it greatly complicates reasoning  
about what could happen here.  Also make a couple of other cosmetic  
fixes.  
  
Per bug #17679 from Balazs Szilfai.  Back-patch into v15, as the  
faulty patch was.  
  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : a1a7bb8f16cd5529d76850c85625039ad7aa348a    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 7 Nov 2022 12:31:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 7 Nov 2022 12:31:38 +0900    

Click here for diff

The code in charge of listing and classifying a set of configuration  
files in a directory was located in guc-file.l, being used currently for  
GUCs under "include_dir".  This code is planned to be used for an  
upcoming feature able to include configuration files for ident and HBA  
files from a directory, similarly to GUCs.  In both cases, the file  
names, suffixed by ".conf", have to be ordered alphabetically.  This  
logic is moved to a new file, called conffiles.c, so as it is easier to  
share this facility between GUCs and the HBA/ident parsing logic.  
  
Author: Julien Rouhaud, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/Makefile
A src/backend/utils/misc/conffiles.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/meson.build
A src/include/utils/conffiles.h

Don't pass down nonnullable_vars while reducing outer joins.

commit   : b0b72c64a0ce7bf5dd78a80b33d85c89c943ad0d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2022 15:58:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2022 15:58:51 -0400    

Click here for diff

We weren't actually using the passed-down list for anything, other  
than computing the new value to be passed down further.  I (tgl)  
probably had the idea that we'd need this data eventually; but  
no use-case has emerged in a good long while, so let's just stop  
expending useless cycles here.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs48KLy9aBb=sZ5MoNmnqAcGHaW_JTGWLCgoE_uMW7S6C-A@mail.gmail.com  

M src/backend/optimizer/prep/prepjointree.c

Handle SubPlan cases in find_nonnullable_rels/vars.

commit   : ff8fa0bf7eb9001f321c2af4bbe9c0f2bd5c1bf8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2022 15:24:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Nov 2022 15:24:36 -0400    

Click here for diff

We can use some variants of SubPlan to deduce that Vars appearing  
in the testexpr must be non-null.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4-jV=199A2Y_6==99dYnpnmaO_Wz_RGkRTTaCB=Pihw2w@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Remove redundant breaks in HeapTupleSatisfiesVisibility

commit   : c3652cd84ac8aa60dd09a9743d4db6f20e985a2f    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 4 Nov 2022 21:56:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 4 Nov 2022 21:56:34 -0700    

Click here for diff

Author: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_ZJg_N7zHtWP+JoSY_hrce4+GKioL137Y2c2En-kuXQ7g@mail.gmail.com  

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

Remove unneeded includes of <sys/stat.h>

commit   : 2a71de8915b41cb1a927fc7870efb138bbcd0b77    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 5 Nov 2022 12:31:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 5 Nov 2022 12:31:28 +0900    

Click here for diff

Since bfb9dfd, none of the files updated in this commit have any stat()  
calls, so these inclusions are not necessary, for the same reasons as  
233cf6e.  
  
Per discussion with John Naylor.  
  
Discussion: https://postgr.es/m/CAFBsxsGGGX7KD6RxbNoSJzuSc8Gz3hOxcfhTOMLB_hJcm68dKQ@mail.gmail.com  

M src/backend/access/heap/rewriteheap.c
M src/backend/storage/file/copydir.c
M src/timezone/pgtz.c

meson: Split 'main' suite into 'regress' and 'isolation'

commit   : a5ac3e76fe96035db44e8e254f55f333c7a11634    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 4 Nov 2022 18:08:44 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 4 Nov 2022 18:08:44 -0700    

Click here for diff

Several people didn't like the 'main' name and found it confusing that the  
main regression and isolation tests were in one suite.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/meson.build
M src/test/regress/meson.build

meson: Mark PROVE as not required

commit   : ab72a31f6cc58ceda97009a5bfae27bd566a3752    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 4 Nov 2022 18:08:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 4 Nov 2022 18:08:05 -0700    

Click here for diff

In the meson build the prove binary is currently not even used. It will soon  
be, for PGXS compatibility, but even then we should build without it around.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M meson.build

Fix CREATE DATABASE so we can pg_upgrade DBs with OIDs above 2^31.

commit   : 34fa0ddae5cf27dd93a5855b30083185d4bb5a5b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2022 10:39:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Nov 2022 10:39:52 -0400    

Click here for diff

Commit aa0105141 repeated one of the oldest mistakes in our book:  
thinking that OID is the same as int32.  It isn't of course, and  
unsurprisingly the first person who came along with a database  
OID above 2 billion broke it.  Repair.  
  
Per bug #17677 from Sergey Pankov.  Back-patch to v15.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/parser/gram.y
M src/include/commands/defrem.h

Correct error message for row-level triggers with transition tables on partitioned tables.

commit   : 8c7146790811ac4eee23fab2226db14b636e1ac5    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 4 Nov 2022 19:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 4 Nov 2022 19:15:00 +0900    

Click here for diff

"Triggers on partitioned tables cannot have transition tables." is  
incorrect as we allow statement-level triggers on partitioned tables to  
have transition tables.  
  
This has been wrong since commit 86f575948; back-patch to v11 where that  
commit came in.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CAPmGK17gk4vXLzz2iG%2BG4LWRWCoVyam70nZ3OuGm1hMJwDrhcg%40mail.gmail.com  

M src/backend/commands/trigger.c
M src/test/regress/expected/triggers.out

Doc: Improve the description of confirmed_flush_lsn in pg_replication_slots.

commit   : 3e77b2eb3466aff9fe19e209ebc0d899ea869494    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 4 Nov 2022 09:00:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 4 Nov 2022 09:00:46 +0530    

Click here for diff

Make it clear that the data corresponding to the transactions committed  
before confirmed_flush_lsn is not available anymore.  
  
Author: Ashutosh Sharma  
Reviewd by: Ashutosh Bapat  
Discussion: https://postgr.es/m/CAE9k0P=hiqRXUonnmtS-5Pu8SbO=yF6vcrVBcfEf2+93ng_f5Q@mail.gmail.com  

M doc/src/sgml/system-views.sgml

Remove outdated include

commit   : 233cf6e8adfc61c6987d4fa22ded551a8246f8fc    
  
author   : John Naylor <[email protected]>    
date     : Fri, 4 Nov 2022 07:50:57 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 4 Nov 2022 07:50:57 +0700    

Click here for diff

In the wake of bfb9dfd93, there are no longer any stat() calls in  
guc-file.l, but the work leading to dac048f71 did not get the memo.  
  
Noted by Michael Paquier  
  
Discussion: https://www.postgresql.org/message-id/Y2OosGi1Xh9x/lEn%40paquier.xyz  

M src/backend/utils/misc/guc-file.l

Create FKs properly when attaching table as partition

commit   : b0284bfb1db5f71778f123754f2eab362b198993    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Nov 2022 20:40:21 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Nov 2022 20:40:21 +0100    

Click here for diff

Commit f56f8f8da6af added some code in CloneFkReferencing that's way too  
lax about a Constraint node it manufactures, not initializing enough  
struct members -- initially_valid in particular was forgotten.  This  
causes some FKs in partitions added by ALTER TABLE ATTACH PARTITION to  
be marked as not validated.  Set initially_valid true, which fixes the  
bug.  
  
While at it, make the struct initialization more complete.  Very similar  
code was added in two other places by the same commit; make them all  
follow the same pattern for consistency, though no bugs are apparent  
there.  
  
This bug has never been reported: I only happened to notice while  
working on commit 614a406b4ff1.  The test case that was added there with  
the improper result is repaired.  
  
Backpatch to 12.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Make AssertPointerAlignment available to frontend code

commit   : 2fe4c7384f469e077928cd40fa1da4bd05598f1f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Nov 2022 11:53:46 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Nov 2022 11:53:46 -0400    

Click here for diff

We don't need separate definitions for frontend and backend, since the  
contained Assert() will take care of the difference.  So this also  
makes it simpler overall.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/c.h

Avoid crash after function syntax error in a replication worker.

commit   : dea83493800563d9f78b68bf9717988dd272c7c9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2022 12:01:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2022 12:01:57 -0400    

Click here for diff

If a syntax error occurred in a SQL-language or PL/pgSQL-language  
CREATE FUNCTION or DO command executed in a logical replication worker,  
we'd suffer a null pointer dereference or assertion failure.  That  
seems like a rather contrived case, but nonetheless worth fixing.  
  
The cause is that function_parse_error_transpose assumes it must be  
executing within the context of a Portal, but logical/worker.c  
doesn't create a Portal since it's not running the standard executor.  
We can just back off the hard Assert check and make it fail gracefully  
if there's not an ActivePortal.  (I have a feeling that the aggressive  
check here was my fault originally, probably because I wasn't sure if  
the case would always hold and wanted to find out.  Well, now we know.)  
  
The hazard seems to exist in all branches that have logical replication,  
so back-patch to v10.  
  
Maxim Orlov, Anton Melnikov, Masahiko Sawada, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_proc.c

Resolve partition strategy during early parsing

commit   : 5fca91025e05f803140831953c09a36f08efcef5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 3 Nov 2022 16:25:54 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 3 Nov 2022 16:25:54 +0100    

Click here for diff

This has little practical value, but there's no reason to let the  
partition strategy names travel through DDL as strings.  
  
Reviewed-by: Japin Li <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c
M src/include/nodes/parsenodes.h
M src/include/partitioning/partbounds.h
M src/include/utils/partcache.h

Add casts to simplehash.h to silence C++ warnings.

commit   : cf8b7d374ae10c8de389229ff924addc69e6f7df    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2022 10:47:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Nov 2022 10:47:31 -0400    

Click here for diff

Casting the result of palloc etc. to the intended type is more per  
project style anyway.  
  
(The fact that cpluspluscheck doesn't notice these problems is  
because it doesn't expand any macros, which seems like a troubling  
shortcoming.  Don't have a good idea about improving that.)  
  
Back-patch to v13, which is as far as the patch applies cleanly;  
doesn't seem worth working harder.  
  
David Geier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/lib/simplehash.h

Straighten include order in guc-file.l

commit   : 062eef3a9bbd5da9c26c93127ee6272193cb06e6    
  
author   : John Naylor <[email protected]>    
date     : Thu, 3 Nov 2022 12:38:44 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 3 Nov 2022 12:38:44 +0700    

Click here for diff

Oversight in dac048f71eb  
  
Michael Paquier  
  
Reviewed by Julien Rouhaud  
Discussion: https://www.postgresql.org/message-id/Y2IATvRGo347Lvd1%40paquier.xyz  

M src/backend/utils/misc/guc-file.l

Allow use of __sync_lock_test_and_set for spinlocks on any machine.

commit   : 1c72d82c25849307416db140007674c674bdee10    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2022 17:37:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2022 17:37:26 -0400    

Click here for diff

If we have no special-case code in s_lock.h for the current platform,  
but the compiler has __sync_lock_test_and_set, use that instead of  
failing.  It's unlikely that anybody's __sync_lock_test_and_set  
would be so awful as to be worse than our semaphore-based fallback,  
but if it is, they can (continue to) use --disable-spinlocks.  
  
This allows removal of the RISC-V special case installed by commit  
c32fcac56, which generated exactly the same code but only on that  
platform.  Usefully, the RISC-V buildfarm animals should now test  
at least the int variant of this patch.  
  
I've manually tested both variants on ARM by dint of removing the  
ARM-specific stanza.  We don't want to drop that, because it already  
has some special knowledge and is likely to grow more over time.  
Likewise, this is not meant to preclude installing special cases  
for other arches if that proves worthwhile.  
  
Per discussion of a request to install the same code for loongarch64.  
Like the previous patch, we might as well back-patch to supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/s_lock.h

pg_dump: Refactor code that constructs ALTER ... OWNER TO commands

commit   : 3655b46aa0b8156aced0b9ee3d10875632f84407    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Nov 2022 17:17:27 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Nov 2022 17:17:27 -0400    

Click here for diff

Avoid having to list all the possible object types twice.  Instead,  
only _getObjectDescription() needs to know about specific object  
types.  It communicates back to _printTocEntry() whether an owner is  
to be set.  
  
In passing, remove the logic to use ALTER TABLE to set the owner of  
views and sequences.  This is no longer necessary.  Furthermore, if  
pg_dump doesn't recognize the object type, this is now a fatal error,  
not a warning.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_dump/pg_backup_archiver.c

Defend against unsupported partition relkind in logical replication worker.

commit   : be541efbfd11c4339222935899989d9c65737ac6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2022 12:29:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2022 12:29:39 -0400    

Click here for diff

Since partitions can be foreign tables not only plain tables, but  
logical replication only supports plain tables, we'd better check the  
relkind of a partition after we find it.  (There was some discussion  
of checking this when adding a partitioned table to a subscription;  
but that would be inadequate since the troublesome partition could be  
added later.)  Without this, the situation leads to a segfault or  
assertion failure.  
  
In passing, add a separate variable for the target Relation of  
a cross-partition UPDATE; reusing partrel seemed mighty confusing  
and error-prone.  
  
Shi Yu and Tom Lane, per report from Ilya Gladyshev.  Back-patch  
to v13 where logical replication into partitioned tables became  
a thing.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_dump: fix failure to dump comments on constraints in some cases.

commit   : 26ee7fb3684e5809d663f74847fb405f5a84d1af    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2022 11:30:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Nov 2022 11:30:04 -0400    

Click here for diff

Thinko in commit 5209c0ba0: I checked the wrong object's  
DUMP_COMPONENT_COMMENT bit in two places.  
  
Per bug #17675 from Franz-Josef Färber.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix copy-and-pasteo in comment.

commit   : d54e79ba282c6a86d0c63e990e716b2c07a8656d    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 2 Nov 2022 18:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 2 Nov 2022 18:15:00 +0900    

Click here for diff

M src/backend/executor/nodeModifyTable.c

Doc: Update information about manually creating slots.

commit   : 155601de7fdb71e1e11193aed52673be145872d4    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 2 Nov 2022 11:40:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 2 Nov 2022 11:40:37 +0530    

Click here for diff

There are some cases (e.g. when the subscription is created using the  
connect = false option) where the remote replication slot was not created  
automatically and the user must create it manually before the subscription  
can be activated. There was not enough information in the docs for users  
to do this easily.  
  
Author: Peter Smith  
Reviewd by: Shi yu, Amit Kapila  
Discussion: https://postgr.es/m/CAHut+PvqdqOanheWSHDyhQiF+Z-7w=-+k4U+bwbT=b6YQ_hrXQ@mail.gmail.com  

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

Improve the description of XLOG_RUNNING_XACTS.

commit   : 568546f7e46a48c065c631338c0eba1de9264ff1    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 2 Nov 2022 10:06:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 2 Nov 2022 10:06:55 +0530    

Click here for diff

Previously, the description of XLOG_RUNNING_XACTS showed only  
top-transaction XIDs and whether subtransactions overflowed. This commit  
improves it to show individual subtransaction XIDs. This also improves the  
description of overflowed subtransactions.  
  
This additional information can be helpful for testing and debugging  
purposes.  
  
Author: Masahiko Sawada  
Reviewd by: Fujii Masao, Kyotaro Horiguchi, Ashutosh Bapat, Bharath Rupireddy  
Discussion: https://postgr.es/m/CAD21AoAqvaE+XEeXHHPdAGQPcCoGXxuoeutq_nWhUSQvTt5+tA@mail.gmail.com  

M src/backend/access/rmgrdesc/standbydesc.c

commit   : e76502871ee36932bbd4d684262d77c0e8aecf08    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 2 Nov 2022 11:56:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 2 Nov 2022 11:56:06 +0900    

Click here for diff

pg_ident_file_mappings.line_number was described as a line number in  
pg_ident.conf for a "rule" number, but this should refer to a "map".  
The same inconsistent term was used in the main paragraph describing the  
view.  
  
Extracted from a patch by the same author.  Issue introduced by  
a2c8499 where this view has been added.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20221026031948.cbrnzgy5e7glsq2d@jrouhaud  
Backpatch-through: 15  

M doc/src/sgml/system-views.sgml

Fix outdated comment in tuplesort.h

commit   : 3712e0ed47d126e9aa656a34dd56d52770b672b7    
  
author   : David Rowley <[email protected]>    
date     : Wed, 2 Nov 2022 15:29:31 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 2 Nov 2022 15:29:31 +1300    

Click here for diff

This was outdated by 77bae396d.  
  
Backpatch-through: 15, where 77bae396d was added  

M src/include/utils/tuplesort.h

Remove code handling FORCE_NULL and FORCE_NOT_NULL for COPY TO

commit   : 8e621c10c73a93e1078ad85fe70fb4478537a798    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 2 Nov 2022 10:15:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 2 Nov 2022 10:15:19 +0900    

Click here for diff

These two options are only available with COPY FROM, so the extra logic  
in charge of checking the validity of the attributes given has no  
purpose.  
  
Author: Zhang Mingli  
Reviewed-by: Richard Guo, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Add doubly linked count list implementation

commit   : 7c335b7a20278079e796d62122ef4b821c7fcdf5    
  
author   : David Rowley <[email protected]>    
date     : Wed, 2 Nov 2022 14:06:05 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 2 Nov 2022 14:06:05 +1300    

Click here for diff

We have various requirements when using a dlist_head to keep track of the  
number of items in the list.  This, traditionally, has been done by  
maintaining a counter variable in the calling code.  Here we tidy this up  
by adding "dclist", which is very similar to dlist but also keeps track of  
the number of items stored in the list.  
  
Callers may use the new dclist_count() function when they need to know how  
many items are stored. Obtaining the count is an O(1) operation.  
  
For simplicity reasons, dclist and dlist both use dlist_node as their node  
type and dlist_iter/dlist_mutable_iter as their iterator type. dclists  
have all of the same functionality as dlists except there is no function  
named dclist_delete().  To remove an item from a list dclist_delete_from()  
must be used.  This requires knowing which dclist the given item is stored  
in.  
  
Additionally, here we also convert some dlists where additional code  
exists to keep track of the number of items stored and to make these use  
dclists instead.  
  
Author: David Rowley  
Reviewed-by: Bharath Rupireddy, Aleksander Alekseev  
Discussion: https://postgr.es/m/CAApHDvrtVxr+FXEX0VbViCFKDGxA3tWDgw9oFewNXCJMmwLjLg@mail.gmail.com  

M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/multixact.c
M src/backend/lib/ilist.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/adt/ri_triggers.c
M src/include/lib/ilist.h
M src/include/replication/reorderbuffer.h
M src/include/utils/pgstat_internal.h
M src/tools/pgindent/typedefs.list

Add more tests for COPY with incorrect option combinations

commit   : 451d1164b9d0cce6acd0b3d0790f09db4c56be0a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 2 Nov 2022 09:57:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 2 Nov 2022 09:57:54 +0900    

Click here for diff

Based on the existing coverage report, some combinations were not  
checked at all, so add some tests to do so.  Spotted while looking at  
the area.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update time zone data files to tzdata release 2022f.

commit   : e7c7605a760bf4422654ae842281d53e2d7b9e88    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Nov 2022 17:08:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Nov 2022 17:08:28 -0400    

Click here for diff

DST law changes in Chile, Fiji, Iran, Jordan, Mexico, Palestine,  
and Syria.  Historical corrections for Chile, Crimea, Iran, and  
Mexico.  
  
Also, the Europe/Kiev zone has been renamed to Europe/Kyiv  
(retaining the old name as a link).  
  
The following zones have been merged into nearby, more-populous zones  
whose clocks have agreed since 1970: Antarctica/Vostok, Asia/Brunei,  
Asia/Kuala_Lumpur, Atlantic/Reykjavik, Europe/Amsterdam,  
Europe/Copenhagen, Europe/Luxembourg, Europe/Monaco, Europe/Oslo,  
Europe/Stockholm, Indian/Christmas, Indian/Cocos, Indian/Kerguelen,  
Indian/Mahe, Indian/Reunion, Pacific/Chuuk, Pacific/Funafuti,  
Pacific/Majuro, Pacific/Pohnpei, Pacific/Wake and Pacific/Wallis.  
(This indirectly affects zones that were already links to one of  
these: Arctic/Longyearbyen, Atlantic/Jan_Mayen, Iceland,  
Pacific/Ponape, Pacific/Truk, and Pacific/Yap.)  America/Nipigon,  
America/Rainy_River, America/Thunder_Bay, Europe/Uzhgorod, and  
Europe/Zaporozhye were also merged into nearby zones after discovering  
that their claimed post-1970 differences from those zones seem to have  
been errors.  
  
While the IANA crew have been working on merging zones that have no  
post-1970 differences for some time, this batch of changes affects  
some zones that are significantly more populous than those merged  
in the past, notably parts of Europe.  The loss of pre-1970 timezone  
history for those zones may be troublesome for applications  
expecting consistency of timestamptz display.  As an example, the  
stored value '1944-06-01 12:00 UTC' would previously display as  
'1944-06-01 13:00:00+01' if the Europe/Stockholm zone is selected,  
but now it will read out as '1944-06-01 14:00:00+02'.  
  
There exists a "packrat" option that will build the timezone data  
files with this old data preserved, but the problem is that it also  
resurrects a bunch of other, far less well-attested data; so much so  
that actually more zones' contents change from 2022a with that option  
than without it.  I have chosen not to do that here, for that reason  
and because it appears that no major OS distributions are using the  
"packrat" option, so that doing so would cause Postgres' behavior  
to diverge significantly depending on whether it was built with  
--with-system-tzdata.  However, for anyone for whom these changes pose  
significant problems, there is a solution: build a set of timezone  
files with the "packrat" option and use those with Postgres.  

M src/timezone/data/tzdata.zi

Fix planner failure with extended statistics on partitioned tables.

commit   : f4857082bc16f36a5cdc6f8328cdc8071bb1715e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Nov 2022 14:34:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Nov 2022 14:34:44 -0400    

Click here for diff

Some cases would result in "cache lookup failed for statistics object",  
due to trying to fetch inherited statistics when only non-inherited  
ones are available or vice versa.  
  
Richard Guo and Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

pg_stat_statements: fetch stmt location/length before it disappears.

commit   : 495e73c2079eb53fcfbafbe18b7dce81aeb271ec    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Nov 2022 12:48:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Nov 2022 12:48:01 -0400    

Click here for diff

When executing a utility statement, we must fetch everything  
we need out of the PlannedStmt data structure before calling  
standard_ProcessUtility.  In certain cases (possibly only ROLLBACK  
in extended query protocol), that data structure will get freed  
during command execution.  The situation is probably often harmless  
in production builds, but in debug builds we intentionally overwrite  
the freed memory with garbage, leading to picking up garbage values  
of statement location and length, typically causing an assertion  
failure later in pg_stat_statements.  In non-debug builds, if  
something did go wrong it would likely lead to storing garbage  
for the query string.  
  
Report and fix by zhaoqigui (with cosmetic adjustments by me).  
It's an old problem, so back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c

doc: Add note about lack of publication privileges

commit   : 84387fc889442bd92b5969aa314b85cff360c7fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2022 14:18:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2022 14:18:37 +0100    

Click here for diff

This gives some additional advice on using row filters and column  
lists on publications securely.  
  
Author: Antonin Houska <[email protected]>  
Reviewed-by: Euler Taveira <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20330.1652105397@antos  

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

psql: Improve tab completion for ALTER TABLE on identity columns

commit   : 2ea5de296ef29d808e8cbc41f6053e33b7e7cf18    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2022 12:07:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 Nov 2022 12:07:40 +0100    

Click here for diff

- Add tab completion for ALTER SEQUENCE … START …  
- Add tab completion for ALTER COLUMN … SET GENERATED …  
- Add tab completion for ALTER COLUMN … SET <sequence option>  
- Add tab completion for ALTER COLUMN … ADD GENERATED … AS IDENTITY  
  
Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Matheus Alcantara <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/psql/tab-complete.c

Add basic regression tests for semi/antijoin recognition.

commit   : 0043aa6b8597809b19c420cb5e635b4d832adccc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Oct 2022 19:52:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Oct 2022 19:52:33 -0400    

Click here for diff

Add some simple tests that the planner recognizes all the  
standard idioms for SEMI and ANTI joins.  Failure to optimize  
in this way won't necessarily cause any visible change in  
query results, so check the plans.  We had no similar coverage  
before, at least for some variants of antijoin, as noted by  
Richard Guo.  
  
Discussion: https://postgr.es/m/CAMbWs4-mvPPCJ1W6iK6dD5HiNwoJdi6mZp=-7mE8N9Sh+cd0tQ@mail.gmail.com  

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

Fix ALTER COLLATION "default" REFRESH VERSION.

commit   : 0717f2fedb2400e4f5bf89bcd463c8b32916ca26    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 29 Oct 2022 14:13:23 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 29 Oct 2022 14:13:23 -0700    

Click here for diff

Issue a helpful error message rather than an internal error.  
  
Discussion: https://postgr.es/m/51fb77507cafd43fc1a2e733c23045873d93ae60.camel%40j-davis.com  
Reviewed-by: Thomas Munro  

M src/backend/commands/collationcmds.c

Enable pg_collation_actual_version() to work on the default collation.

commit   : 10932ed5e57b75e5e9aaa22aa0527ceeee55b6ca    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 29 Oct 2022 13:30:15 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 29 Oct 2022 13:30:15 -0700    

Click here for diff

Previously, it would simply return NULL, which was less useful.  
  
Discussion: https://postgr.es/m/51fb77507cafd43fc1a2e733c23045873d93ae60.camel%40j-davis.com  
Reviewed-by: Thomas Munro  

M src/backend/commands/collationcmds.c

pg_dump test: Make concatenated create_sql commands more readable

commit   : 6e10631d1e6e350ba3f82b0bd3a29678f9f5badd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 31 Oct 2022 13:59:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 31 Oct 2022 13:59:57 +0100    

Click here for diff

When the pg_dump 002_pg_dump.pl test generates the command to load the  
schema, it does  
  
    # Add terminating semicolon  
    $create_sql{$test_db} .= $tests{$test}->{create_sql} . ";";  
  
In some cases, this creates a duplicate semicolon, but more  
importantly, this doesn't add any newline.  So if you look at the  
result in either the server log or in  
tmp_check/log/regress_log_002_pg_dump, it looks like a complete mess.  
This patch makes the output look cleaner for manual inspection: add  
semicolon only if necessary, and add two newlines.  
  
Discussion: https://www.postgresql.org/message-id/flat/d6aec95a-8729-43cc-2578-f2a5e46640e0%40enterprisedb.com  

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

Add check on initial and boot values when loading GUCs

commit   : a73952b795632b2cf5acada8476e7cf75857e9be    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 31 Oct 2022 13:54:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 31 Oct 2022 13:54:23 +0900    

Click here for diff

This commit adds a function to perform a cross-check between the initial  
value of the C declaration associated to a GUC and its actual boot  
value in assert-enabled builds.  The purpose of this is to prevent  
anybody reading these C declarations from being fooled by mismatched  
values before they are loaded at program startup.  
  
The following rules apply depending on the GUC type:  
* bool - can be false, or same as boot_val.  
* int - can be 0, or same as the boot_val.  
* real - can be 0.0, or same as the boot_val.  
* string - can be NULL, or strcmp'd equal to the boot_val.  
* enum - equal to the boot_val.  
  
This is done for the system as well custom GUCs loaded by external  
modules, which may require extension developers to adapt the C  
declaration of the variables used by these GUCs (testing this change  
with some of my own modules has allowed me to catch some stupid typos,  
FWIW).  This may finish by being a bad experiment depending on the  
feedbcak received, but let's see how it goes.  
  
Author: Peter Smith  
Reviewed-by: Nathan Bossart, Tom Lane, Michael Paquier, Justin Pryzby  
Discussion: https://postgr.es/m/CAHut+PtHE0XSfjjRQ6D4v7+dqzCw=d+1a64ujra4EX8aoc_Z+w@mail.gmail.com  

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

Clean up some inconsistencies with GUC declarations

commit   : d9d873bac67047cfacc9f5ef96ee488f2cb0f1c3    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 31 Oct 2022 12:44:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 31 Oct 2022 12:44:48 +0900    

Click here for diff

This is similar to 7d25958, and this commit takes care of all the  
remaining inconsistencies between the initial value used in the C  
variable associated to a GUC and its default value stored in the GUC  
tables (as of pg_settings.boot_val).  
  
Some of the initial values of the GUCs updated rely on a compile-time  
default.  These are refactored so as the GUC table and its C declaration  
use the same values.  This makes everything consistent with other  
places, backend_flush_after, bgwriter_flush_after, port,  
checkpoint_flush_after doing so already, for example.  
  
Extracted from a larger patch by Peter Smith.  The spots updated in the  
modules are from me.  
  
Author: Peter Smith, Michael Paquier  
Reviewed-by: Nathan Bossart, Tom Lane, Justin Pryzby  
Discussion: https://postgr.es/m/CAHut+PtHE0XSfjjRQ6D4v7+dqzCw=d+1a64ujra4EX8aoc_Z+w@mail.gmail.com  

M contrib/auth_delay/auth_delay.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M contrib/sepgsql/hooks.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/libpq/be-secure.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/error/elog.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/ps_status.c
M src/include/storage/bufmgr.h
M src/include/utils/ps_status.h

Under has_wal_read_bug, skip recovery/t/032_relfilenode_reuse.pl.

commit   : a9f8ca6005f1441b4e28272f744fb01fbc14b29f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 29 Oct 2022 10:42:16 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 29 Oct 2022 10:42:16 -0700    

Click here for diff

Per buildfarm member kittiwake.  Back-patch to v15, where this test  
first appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/032_relfilenode_reuse.pl

Use Limit instead of Unique to implement DISTINCT, when possible

commit   : 5543677ec90a15c73dab5ed4f0902b3b920f0b87    
  
author   : David Rowley <[email protected]>    
date     : Fri, 28 Oct 2022 23:04:38 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 28 Oct 2022 23:04:38 +1300    

Click here for diff

When all of the query's DISTINCT pathkeys have been marked as redundant  
due to EquivalenceClasses existing which contain constants, we can just  
implement the DISTINCT operation on a query by just limiting the number of  
returned rows to 1 instead of performing a Unique on all of the matching  
(duplicate) rows.  
  
This applies in cases such as:  
  
SELECT DISTINCT col,col2 FROM tab WHERE col = 1 AND col2 = 10;  
  
If there are any matching rows, then they must all be {1,10}.  There's no  
point in fetching all of those and running a Unique operator on them to  
leave only a single row.  Here we effectively just find the first row and  
then stop.  We are obviously unable to apply this optimization if either  
the col = 1 or col2 = 10 were missing from the WHERE clause or if there  
were any additional columns in the SELECT clause.  
  
Such queries are probably not all that common, but detecting when we can  
apply this optimization amounts to checking if the distinct_pathkeys are  
NULL, which is very cheap indeed.  
  
Nothing is done here to check if the query already has a LIMIT clause.  If  
it does then the plan may end up with 2 Limits nodes.  There's no harm in  
that and it's probably not worth the complexity to unify them into a  
single Limit node.  
  
Author: David Rowley  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/CAApHDvqS0j8RUWRUSgCAXxOqnYjHUXmKwspRj4GzVfOO25ByHA@mail.gmail.com  
Discussion: https://postgr.es/m/MEYPR01MB7101CD5DA0A07C9DE2B74850A4239@MEYPR01MB7101.ausprd01.prod.outlook.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/select_distinct.out
M src/test/regress/expected/select_distinct_on.out
M src/test/regress/sql/select_distinct.sql
M src/test/regress/sql/select_distinct_on.sql

Remove AssertArg and AssertState

commit   : b1099eca8f38ff5cfaf0901bb91cb6a22f909bc6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Oct 2022 09:19:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Oct 2022 09:19:06 +0200    

Click here for diff

These don't offer anything over plain Assert, and their usage had  
already been declared obsolescent.  
  
Author: Nathan Bossart <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20221009210148.GA900071@nathanxps13  

M contrib/fuzzystrmatch/fuzzystrmatch.c
M src/backend/access/common/tupdesc.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/xact.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_collation.c
M src/backend/commands/dbcommands.c
M src/backend/commands/indexcmds.c
M src/backend/commands/portalcmds.c
M src/backend/commands/tablecmds.c
M src/backend/jit/jit.c
M src/backend/parser/parse_utilcmd.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/slot.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/sort/tuplesortvariants.c
M src/common/controldata_utils.c
M src/common/protocol_openssl.c
M src/include/c.h
M src/include/executor/tuptable.h
M src/include/miscadmin.h
M src/include/utils/pgstat_internal.h

Allow nodeSort to perform Datum sorts for byref types

commit   : d37aa3d35832afde94e100c4d2a9618b3eb76472    
  
author   : David Rowley <[email protected]>    
date     : Fri, 28 Oct 2022 09:25:12 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 28 Oct 2022 09:25:12 +1300    

Click here for diff

Here we add a new 'copy' parameter to tuplesort_getdatum so that we can  
instruct the function not to datumCopy() byref Datums before returning.  
  
Similar to 91e9e89dc, this can provide significant performance  
improvements in nodeSort when sorting by a single byref column and the  
sort's targetlist contains only that column.  
  
This allows us to re-enable Datum sorts for byref types which was disabled  
in 3a5817695 due to a reported memory leak.  
  
Additionally, here we slightly optimize DISTINCT aggregates so that we no  
longer perform any datumCopy() when we find the current value not to be  
distinct from the previous value.  Previously the code would always take a  
copy of the most recent Datum and pfree the previous value, even when the  
values were the same.  Testing shows a small but noticeable performance  
increase when aggregate transitions are skipped due to the current  
transition value being the same as the prior one.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvqS6wC5U==k9Hd26E4EQXH3QR67-T4=Q1rQ36NGvjfVSg@mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvqHonfe9G1cVaKeHbDx70R_zCrM3qP2AGXpGrieSKGnhA@mail.gmail.com  

M src/backend/access/heap/heapam_handler.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeSort.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/utils/tuplesort.h

Avoid making commutatively-duplicate clauses in EquivalenceClasses.

commit   : a5fc46414deb7cbcd4cec1275efac69b9ac10500    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Oct 2022 14:42:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Oct 2022 14:42:18 -0400    

Click here for diff

When we decide we need to make a derived clause equating a.x and  
b.y, we already will re-use a previously-made clause "a.x = b.y".  
But we might instead have "b.y = a.x", which is perfectly usable  
because equivclass.c has never promised anything about the  
operand order in clauses it builds.  Saving construction of a  
new RestrictInfo doesn't matter all that much in itself --- but  
because we cache selectivity estimates and so on per-RestrictInfo,  
there's a possibility of saving a fair amount of duplicative  
effort downstream.  
  
Hence, check for commutative matches as well as direct ones when  
seeing if we have a pre-existing clause.  This changes the visible  
clause order in several regression test cases, but they're all  
clearly-insignificant changes.  
  
Checking for the reverse operand order is simple enough, but  
if we wanted to check for operator OID match we'd need to call  
get_commutator here, which is not so cheap.  I concluded that  
we don't really need the operator check anyway, so I just  
removed it.  It's unlikely that an opfamily contains more than  
one applicable operator for a given pair of operand datatypes;  
and if it does they had better give the same answers, so there  
seems little need to insist that we use exactly the one  
select_equality_operator chose.  
  
Using the current core regression suite as a test case, I see  
this change reducing the number of new join clauses built by  
create_join_clause from 9673 to 5142 (out of 26652 calls).  
So not quite 50% savings, but pretty close to it.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/path/equivclass.c
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/tidscan.out

Move pg_pwritev_with_retry() to src/common/file_utils.c

commit   : 4ab8c81bd90ae442dbd092df04a12dbb7e68f562    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Oct 2022 14:39:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Oct 2022 14:39:42 +0900    

Click here for diff

This commit moves pg_pwritev_with_retry(), a convenience wrapper of  
pg_writev() able to handle partial writes, to common/file_utils.c so  
that the frontend code is able to use it.  A first use-case targetted  
for this routine is pg_basebackup and pg_receivewal, for the  
zero-padding of a newly-initialized WAL segment.  This is used currently  
in the backend when the GUC wal_init_zero is enabled (default).  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart, Thomas Munro  
Discussion: https://postgr.es/m/CALj2ACUq7nAb7=bJNbK3yYmp-SZhJcXFR_pLk8un6XgDzDF3OA@mail.gmail.com  

M src/backend/storage/file/fd.c
M src/common/file_utils.c
M src/include/common/file_utils.h
M src/include/storage/fd.h

Add some tests to check the SQL functions of control file

commit   : 1b9cd69c5bdd1a331891f282106125e6f2524991    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Oct 2022 09:58:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Oct 2022 09:58:44 +0900    

Click here for diff

As the recent commit 05d4cbf (reverted after as a448e49) has proved,  
there is zero coverage for the four SQL functions that can scan the  
control file data:  
- pg_control_checkpoint()  
- pg_control_init()  
- pg_control_recovery()  
- pg_control_system()  
  
This commit adds a minimal coverage for these functions, checking that  
their execution is able to complete.  This would have been enough to  
catch the problems introduced in the commit mentioned above.  More  
checks could be done for each individual fields, but it is unclear  
whether this would be better than the other checks in place in the  
backend code.  
  
Per discussion with Bharath Rupireddy.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add rule_number to pg_hba_file_rules and map_number to pg_ident_file_mappings

commit   : c591300a8f54d9711157d9a8866f022a257ec4ee    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Oct 2022 15:22:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Oct 2022 15:22:15 +0900    

Click here for diff

These numbers are strictly-monotone identifiers assigned to each rule  
of pg_hba_file_rules and each map of pg_ident_file_mappings when loading  
the HBA and ident configuration files, indicating the order in which  
they are checked at authentication time, until a match is found.  
  
With only one file loaded currently, this is equivalent to the line  
numbers assigned to the entries loaded if one wants to know their order,  
but this becomes mandatory once the inclusion of external files is  
added to the HBA and ident files to be able to know in which order the  
rules and/or maps are applied at authentication.  Note that NULL is used  
when a HBA or ident entry cannot be parsed or validated, aka when an  
error exists, contrary to the line number.  
  
Bump catalog version.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M doc/src/sgml/system-views.sgml
M src/backend/utils/adt/hbafuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out

Fix variable assignment thinko in hba.c

commit   : 37d264478ab47e8fa03751c39ba2c5dd447b89c8    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Oct 2022 12:57:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Oct 2022 12:57:40 +0900    

Click here for diff

The intention behind 1b73d0b was to limit the use of TokenizedAuthLine,  
but I have fat-fingered one location in parse_hba_line() when creating  
the HbaLine, where this should use the local variable and not the value  
coming from TokenizedAuthLine.  This logic is the exactly the same, but  
let's be clean about all that on consistency grounds.  
  
Reported-by: Julien Rouhaud  
Discussion: https://postgr.es/m/20221026032730.k3sib5krgm7l6njk@jrouhaud  

M src/backend/libpq/hba.c

Refactor code handling the names of files loaded in hba.c

commit   : 1b73d0b1c3934f703d68031957d37c2a9765e798    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Oct 2022 11:36:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Oct 2022 11:36:21 +0900    

Click here for diff

This has the advantage to limit the presence of the GUC values  
hba_file and ident_file to the code paths where these files are loaded,  
easing the introduction of an upcoming feature aimed at adding inclusion  
logic for files and directories in HBA and ident files.  
  
Note that this needs the addition of the source file name to HbaLine, in  
addition to the line number, which is something needed by the backend in  
two places of auth.c (authentication failure details and auth_id log  
when log_connections is enabled).  
  
While on it, adjust a log generated on authentication failure to report  
the name of the actual HBA file on which the connection attempt matched,  
where the line number and the raw line written in the HBA file were  
already included.  This was previously hardcoded as pg_hba.conf, which  
would be incorrect when a custom value is used at postmaster startup for  
the GUC hba_file.  
  
Extracted from a larger patch by the same author.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h

Doc/improve confusing, inefficient tests to locate CTID variable.

commit   : 13d53aa7a83383c9d1343e7d725e615f8678aea8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Oct 2022 17:35:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Oct 2022 17:35:19 -0400    

Click here for diff

The IsCTIDVar() tests in nodeTidscan.c and nodeTidrangescan.c  
look buggy at first sight: they aren't checking that the varno  
matches the table to be scanned.  Actually they're safe because  
any Var in a scan-level qual must be for the correct table ...  
but if we're depending on that, it's pretty pointless to verify  
varlevelsup.  (Besides which, varlevelsup is *always* zero at  
execution, since we've flattened the rangetable long since.)  
  
Remove the useless varlevelsup check, and instead add some  
commentary explaining why we don't need to check varno.  
  
Noted while fooling with a planner change that causes the order  
of "t1.ctid = t2.ctid" to change in some tidscan.sql tests;  
I was briefly fooled into thinking there was a live bug here.  

M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c

Update outdated comment for TransactionIdSetTreeStatus

commit   : 0e972f50fdc9f33b01d02bbcc2f26aa32f1c58ab    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Oct 2022 21:43:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 25 Oct 2022 21:43:52 +0200    

Click here for diff

Commit 06da3c570f changed the way subtransactions are marked as  
SUBCOMMITTED, but the example it included actually documented the old  
way. Update it.  
  
Author: Japin Li  
Discussion: https://www.postgresql.org/message-id/MEYP282MB16690BC96DFBE08CC857E1E3B6319%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

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

Clean up some GUC declarations and comments

commit   : 7d25958453a60337bcb7bcc986e270792c007ea4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Oct 2022 14:06:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Oct 2022 14:06:07 +0900    

Click here for diff

This adjusts a few things for GUCs related to logical replication,  
replication slots and WAL senders, in the shape of incorrect comments  
and values inconsistent with their initial default value.  
  
Author: Peter Smith  
Reviewed-by: Nathan Bossart, Tom Lane, Justin Pryzby  
Discussion: https://postgr.es/m/CAHut+PtHE0XSfjjRQ6D4v7+dqzCw=d+1a64ujra4EX8aoc_Z+w@mail.gmail.com  

M src/backend/replication/logical/launcher.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c

commit   : e109e43921d21d069c03f18d7c9d8f4e5cb6a0c3    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:26:03 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:26:03 +1300    

Click here for diff

Commit f357233c assumed that it was OK to return ENOENT directly if  
lstat() failed that way.  If we got STATUS_DELETE_PENDING while trying  
to unlink a file that we had already unlinked successfully once before  
but someone else still had open (on a kernel version that has "pending"  
unlinks by default), then we would no longer reach the retry loop in  
pgunlink().  That loop claims to be only for handling sharing violations  
(a different phenomenon), but the errno is the same.  
  
Restore that behavior with an explicit check, to see if it fixes the  
occasional 'directory not empty' failures seen in the pg_upgrade tests  
on CI.  Further improvements are possible with proposed upgrades to  
modern Windows APIs that would replace this convoluted code.  
  
Reported-by: Justin Pryzby <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/20220920013122.GA31833%40telsasoft.com  
Discussion: https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com  

M src/port/dirmod.c

Fix stat() for recursive junction points on Windows.

commit   : 4517358ee78213cd2ca18270ab4d32cd69b0b19d    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:24:41 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:24:41 +1300    

Click here for diff

Commit c5cb8f3b supposed that we'd only ever have to follow one junction  
point in stat(), because we don't construct longer chains of them ourselves.  
When examining a parent directory supplied by the user, we should really be  
able to cope with longer chains, just in case someone has their system  
set up that way.  Choose an arbitrary cap of 8, to match the minimum  
acceptable value of SYMLOOP_MAX in POSIX.  
  
Previously I'd avoided reporting ELOOP thinking Windows didn't have it,  
but it turns out that it does, so we can use the proper error number.  
  
Reviewed-by: Roman Zharkov <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ7JDGWYFt9%3D-TyJiRRy5q9TtPfqeKkneWDr1XPU1%2Biqw%40mail.gmail.com  
Discussion: https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com  

M src/port/win32stat.c

commit   : f71007fbb3b83fba21daae9144cc07e205f2365c    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:21:42 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:21:42 +1300    

Click here for diff

Since commit c5cb8f3b taught stat() to follow symlinks, and since initdb  
uses pg_mkdir_p(), and that examines parent directories, our humble  
readlink() implementation can now be exposed to junction points not of  
PostgreSQL origin.  Those might be corrupted by our naive path mangling,  
which doesn't really understand NT paths in general.  
  
Simply decline to transform paths that don't look like a drive absolute  
path.  That means that readlink() returns the NT path directly when  
checking a parent directory of PGDATA that happen to point to a drive  
using "rooted" format.  That  works for the purposes of our stat()  
emulation.  
  
Reported-by: Roman Zharkov <[email protected]>  
Reviewed-by: Roman Zharkov <[email protected]>  
Discussion: https://postgr.es/m/4590c37927d7b8ee84f9855d83229018%40postgrespro.ru  
Discussion: https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com  

M src/port/dirmod.c

Fix lstat() for broken junction points on Windows.

commit   : 387803d81d6256fcb60b9192bb5b00042442b4e3    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:20:00 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:20:00 +1300    

Click here for diff

When using junction points to emulate symlinks on Windows, one edge case  
was not handled correctly by commit c5cb8f3b: if a junction point is  
broken (pointing to a non-existent path), we'd report ENOENT.  This  
doesn't break any known use case, but was noticed while developing a  
test suite for these functions and is fixed here for completeness.  
  
Also add translation ERROR_CANT_RESOLVE_FILENAME -> ENOENT, as that is  
one of the errors Windows can report for some kinds of broken paths.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com  

M src/port/win32error.c
M src/port/win32stat.c

commit   : 4650036f5ab81c93e3b6ed549ef672a325b79705    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:13:52 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:13:52 +1300    

Click here for diff

Ancient bug noticed while working on a test suite for these functions.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com  

M src/port/dirmod.c

commit   : 359d601095ce2361bad50f9f8b0bcfe4da1eb886    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:10:49 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Oct 2022 15:10:49 +1300    

Click here for diff

Ancient bug noticed while working on a test suite for these functions.  
  
https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com  

M src/port/dirmod.c

doc: Fix type of cursor_position in jsonlog table

commit   : f186c7c88522c2c25b31566b4a5e00749ca7820c    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Oct 2022 09:29:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Oct 2022 09:29:21 +0900    

Click here for diff

This entry was listed as a "string", but it is a "number.  The other  
fields are correctly described, on a second look.  
  
Reported-by: Nuko Yokohama  
Author: Tatsuo Ishii  
Discussion: https://postgr.es/m/CAF3Gu1awoVoDP5d0_eN=cR=QkGVwH+OtFvwJkkc5cB_ZMWjyeA@mail.gmail.com  
Backpatch-through: 15  

M doc/src/sgml/config.sgml

Update some comments that should've covered MERGE

commit   : 3b2db22fe287d17ecb0ba4cd828dc7900dddd03f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 24 Oct 2022 12:52:43 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 24 Oct 2022 12:52:43 +0200    

Click here for diff

Oversight in 7103ebb7aae8.  Backpatch to 15.  
  
Author: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/CAMbWs48gnDjZXq3-b56dVpQCNUJ5hD9kdtWN4QFwKCEapspNsA@mail.gmail.com  

M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_merge.c
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h

Fix recently added incorrect assertion

commit   : 8328a15f8f95cad3fa99bbab551cade0a8403708    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 24 Oct 2022 12:02:33 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 24 Oct 2022 12:02:33 +0200    

Click here for diff

Commit df3737a651f4 added an incorrect assertion about the preconditions  
for invoking the backup cleanup callback: it misfires at session end in  
case a backup completes successfully.  Fix it, using coding from Michaël  
Paquier.  Also add some tests for the various cases.  
  
Reported by Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/test/recovery/t/020_archive_status.pl

Improve coverage of ruleutils.c for SQLValueFunctions

commit   : 2e0d80c5bb722fb49a4cdc44b0c715ec77c83f79    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 24 Oct 2022 16:53:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 24 Oct 2022 16:53:54 +0900    

Click here for diff

While looking at how these are handled in the parser and the executor, I  
have noticed that there is no test coverage for most of these when  
reverse-engineering an expression for a SQLValueFunction node in  
ruleutils.c, including how these are reparsed when included in a FROM  
clause.  Some hacking in this area has showed me that these could break  
easily, so add some coverage to track the existing compatibility.  
  
Extracted from a much larger patch by me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve tab completion for ALTER STATISTICS <name> SET in psql

commit   : 3cf2f7af7f9b6198f3d518aaffb0ff4de340c5bc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 24 Oct 2022 15:46:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 24 Oct 2022 15:46:42 +0900    

Click here for diff

The code was completing this pattern with a list of settable characters,  
and it was possible to reach this state after completing a "ALTER  
STATISTICS <name>" with SET.  
  
Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm2HHF_371o+EeSjxDDS17Cx7d-ko2h1fLU94=ob=4_ktg@mail.gmail.com  

M src/bin/psql/tab-complete.c

Fix and improve TAP tests for pg_hba.conf and regexps

commit   : 14a737bfdbe4f2328d7f333b207f52f9ed4ee722    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 24 Oct 2022 13:48:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 24 Oct 2022 13:48:34 +0900    

Click here for diff

The new tests have been reporting a warning hidden in the logs, as of  
"Odd number of elements in hash assignment" (perlcritic or similar did  
not report an issue, actually).  This comes down to a typo in the test  
"matching regexp for username" for a double-quoted regexp using commas,  
where we passed an extra argument.  The test is intended to pass, but  
this was causing the test to fail.  This also pointed out that the  
newly-added role "md5,role" lacks an entry in the password file used to  
provide the password, so add one.  
  
While on it, make the tests pickier by checking the contents of the logs  
generated on successful authentication.  
  
Oversights in 8fea868.  

M src/test/authentication/t/001_password.pl

Add support for regexps on database and user entries in pg_hba.conf

commit   : 8fea86830e1d40961fd3cba59a73fca178417c78    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 24 Oct 2022 11:45:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 24 Oct 2022 11:45:31 +0900    

Click here for diff

As of this commit, any database or user entry beginning with a slash (/)  
is considered as a regular expression.  This is particularly useful for  
users, as now there is no clean way to match pattern on multiple HBA  
lines.  For example, a user name mapping with a regular expression needs  
first to match with a HBA line, and we would skip the follow-up HBA  
entries if the ident regexp does *not* match with what has matched in  
the HBA line.  
  
pg_hba.conf is able to handle multiple databases and roles with a  
comma-separated list of these, hence individual regular expressions that  
include commas need to be double-quoted.  
  
At authentication time, user and database names are now checked in the  
following order:  
- Arbitrary keywords (like "all", the ones beginning by '+' for  
membership check), that we know will never have a regexp.  A fancy case  
is for physical WAL senders, we *have* to only match "replication" for  
the database.  
- Regular expression matching.  
- Exact match.  
The previous logic did the same, but without the regexp step.  
  
We have discussed as well the possibility to support regexp pattern  
matching for host names, but these happen to lead to tricky issues based  
on what I understand, particularly with host entries that have CIDRs.  
  
This commit relies heavily on the refactoring done in a903971 and  
fc579e1, so as the amount of code required to compile and execute  
regular expressions is now minimal.  When parsing pg_hba.conf, all the  
computed regexps needs to explicitely free()'d, same as pg_ident.conf.  
  
Documentation and TAP tests are added to cover this feature, including  
cases where the regexps use commas (for clarity in the docs, coverage  
for the parsing logic in the tests).  
  
Note that this introduces a breakage with older versions, where a  
database or user name beginning with a slash are treated as something to  
check for an equal match.  Per discussion, we have discarded this as  
being much of an issue in practice as it would require a cluster to  
have database and/or role names that begin with a slash, as well as HBA  
entries using these.  Hence, the consistency gained with regexps in  
pg_ident.conf is more appealing in the long term.  
  
**This compatibility change should be mentioned in the release notes.**  
  
Author: Bertrand Drouvot  
Reviewed-by: Jacob Champion, Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/hba.c
M src/test/authentication/t/001_password.pl

Remove pgpid_t type, use pid_t instead

commit   : 5035c93c8a5ac6804da79c67403460348b381924    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 22 Oct 2022 10:10:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 22 Oct 2022 10:10:31 +0200    

Click here for diff

It's unclear why a separate type would be needed here.  We use plain  
pid_t (or int) everywhere else.  
  
(The only relevant platform where pid_t is not int is 64-bit MinGW,  
where it is long long int.  So defining pid_t as long (which is 32-bit  
on Windows), as was done here, doesn't even accommodate that one.)  
  
Reverts 66fa6eba5a61be740a6c07de92c42221fae79e9c.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/pg_ctl/pg_ctl.c
M src/tools/pgindent/typedefs.list

psql: Fix exit status when query is canceled

commit   : 2598b76bf2bc78af4c65ffab4736c7b49205fc7a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 22 Oct 2022 09:41:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 22 Oct 2022 09:41:38 +0200    

Click here for diff

Because of a small thinko in 7844c9918a43b494adde3575891d217a37062378,  
psql -c would exit successfully when a query is canceled.  Fix this so  
that it exits with a nonzero status, just like for all other errors.  

M src/bin/psql/common.c

Improve memory handling across SQL-callable backup functions

commit   : 6cc66197ff9aa34cc47486d7bf719f376f6f5ff8    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 22 Oct 2022 11:54:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 22 Oct 2022 11:54:02 +0900    

Click here for diff

Since pg_backup_start() and pg_backup_stop() exist, the tablespace map  
data and the backup state data (backup_label string until 7d70809) have  
been allocated in the TopMemoryContext.  This approach would cause  
memory leaks in the session calling these functions if failures happen  
before pg_backup_stop() ends, leaking more memory on repeated failures.  
Both things need little memory so that would not be really noticeable  
for most users, except perhaps connection poolers with long-lived  
connections able to trigger backup failures with these functions.  
  
This commit improves the logic in this area by not allocating anymore  
the backup-related data that needs to travel across the SQL-callable  
backup functions in TopMemoryContext, by using instead a dedicated  
memory context child of TopMemoryContext.  The memory context is created  
in pg_backup_start() and deleted when finishing pg_backup_stop().  In  
the event of an in-flight failure, this memory context gets reset in the  
follow-up pg_backup_start() call, so as we are sure that only one run  
worth of data is leaked at any time.  Some cleanup was already done for  
the backup data on a follow-up call of pg_backup_start(), but using a  
memory context makes the whole simpler.  
  
BASE_BACKUP commands are executed in isolation, relying on the memory  
context created for replication commands, hence these do not need such  
an extra logic.  
  
Author: Bharath Rupireddy  
Reviewed-by: Robert Haas, Alvaro Herrera, Cary Huang, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACXqvfKF2B0beQ=aJMdWnpNohmBPsRg=EDQj_6y1t2O8mQ@mail.gmail.com  

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

pg_basebackup: Fix cross-platform tablespace relocation.

commit   : 1f0c4fa255253d223447c2383ad2b384a6f05854    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 21 Oct 2022 08:21:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 21 Oct 2022 08:21:55 -0400    

Click here for diff

Specifically, when pg_basebackup is invoked with -Tx=y, don't error  
out if x could plausibly be an absolute path either on Windows or on  
non-Windows systems. We don't know whether the remote system is  
running the same OS as the local system, so it's not appropriate to  
assume that our local rule about absolute pathnames is the same as  
the rule on the remote system.  
  
Patch by me, reviewed by Tom Lane, Andrew Dunstan, and  
Davinder Singh.  
  
Discussion: http://postgr.es/m/CA+TgmoY+jC3YiskomvYKDPK3FbrmsDU7_8+wMHt02HOdJeRb0g@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c
M src/include/port.h

Add CHECK_FOR_INTERRUPTS while restoring changes during decoding.

commit   : ce20f8b9f4354b46b40fd6ebf7ce5c37d08747e0    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 21 Oct 2022 12:57:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 21 Oct 2022 12:57:18 +0530    

Click here for diff

Previously in commit 42681dffaf, we added CFI during decoding changes but  
missed another similar case that can happen while restoring changes  
spilled to disk back into memory in a loop.  
  
Reported-by: Robert Haas  
Author: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CA+TgmoaLObg0QbstbC8ykDwOdD1bDkr4AbPpB=0DPgA2JW0mFg@mail.gmail.com  

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

Refactor more logic for compilation of regular expressions in hba.c

commit   : a903971351023bf08b3d6165220d0c8ab8ddada3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Oct 2022 09:55:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Oct 2022 09:55:56 +0900    

Click here for diff

It happens that the parts of hba.conf that are planned to be extended  
to support regular expressions would finish by using the same error  
message as the one used currently for pg_ident.conf when a regular  
expression cannot be compiled, as long as the routine centralizing the  
logic, regcomp_auth_token(), knows from which file the regexp comes from  
and its line location in the so-said file.  
  
This change makes the follow-up patches slightly simpler, and the logic  
remains the same.  I suspect that this makes the proposal to add support  
for file inclusions in pg_ident.conf and pg_hba.conf slightly simpler,  
as well.  
  
Extracted from a larger patch by the same author.  This is similar to  
the refactoring done in fc579e1.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c

Doc: fix outdated wording about parallel seq scans

commit   : 42d01f59c741038626d819046f4abf494c338c12    
  
author   : David Rowley <[email protected]>    
date     : Fri, 21 Oct 2022 09:29:08 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 21 Oct 2022 09:29:08 +1300    

Click here for diff

56788d215 adjusted the parallel seq scan code so that instead of handing  
out a single block at a time to parallel workers, it now hands out ranges  
of blocks.  
  
Here we update the documentation which still claimed that workers received  
just 1 block at a time.  
  
Reported-by: Zhang Mingli  
Discussion: https://postgr.es/m/17c99615-2c3b-4e4e-9d0b-424a66a7bccd@Spark  
Backpatch-through: 14, where 56788d215 was added.  

M doc/src/sgml/parallel.sgml

Make finding openssl program a configure or meson option

commit   : c8e4030d1bddc1120fd1c3f17db5b86a729df4b6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Oct 2022 21:01:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Oct 2022 21:01:05 +0200    

Click here for diff

Various test suites use the "openssl" program as part of their setup.  
There isn't a way to override which openssl program is to be used,  
other than by fiddling with the path, perhaps.  This has gotten  
increasingly problematic because different versions of openssl have  
different capabilities and do different things by default.  
  
This patch checks for an openssl binary in configure and meson setup,  
with appropriate ways to override it.  This is similar to how "lz4"  
and "zstd" are handled, for example.  The meson build system actually  
already did this, but the result was only used in some places.  This  
is now applied more uniformly.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/dc638b75-a16a-007d-9e1c-d16ed6cf0ad2%40enterprisedb.com  

M configure
M configure.ac
M doc/src/sgml/install-windows.sgml
M meson.build
M meson_options.txt
M src/Makefile.global.in
M src/test/ldap/Makefile
M src/test/ldap/meson.build
M src/test/ldap/t/001_auth.pl
M src/test/modules/ssl_passphrase_callback/Makefile
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/ssl/Makefile
M src/test/ssl/meson.build
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/tools/msvc/vcregress.pl

Improve the accuracy of numeric power() for integer exponents.

commit   : 40c7fcbbed5d922e905f8032c5035826d0406980    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 20 Oct 2022 10:10:17 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 20 Oct 2022 10:10:17 +0100    

Click here for diff

This makes the choice of result scale of numeric power() for integer  
exponents consistent with the choice for non-integer exponents, and  
with the result scale of other numeric functions. Specifically, the  
result scale will be at least as large as the scale of either input,  
and sufficient to ensure that the result has at least 16 significant  
digits.  
  
Formerly, the result scale was based only on the scale of the first  
input, without taking into account the weight of the result. For  
results with negative weight, that could lead to results with very few  
or even no non-zero significant digits (e.g., 10.0 ^ (-18) produced  
0.0000000000000000).  
  
Fix this by moving responsibility for the choice of result scale into  
power_var_int(), which already has code to estimate the result weight.  
  
Per report by Adrian Klaver and suggested fix by Tom Lane.  
  
No back-patch -- arguably this is a bug fix, but one which is easy to  
work around, so it doesn't seem worth the risk of changing query  
results in stable branches.  
  
Discussion: https://postgr.es/m/12a40226-70ac-3a3b-3d3a-fdaf9e32d312%40aklaver.com  

M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/expected/numeric_big.out
M src/test/regress/sql/numeric.sql
M src/test/regress/sql/numeric_big.sql

Use proper macro to access TransactionId

commit   : 7fd1ae987a5dc6d0b28dcc1dcd01f455049d9782    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 20 Oct 2022 09:37:06 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 20 Oct 2022 09:37:06 +0200    

Click here for diff

In commit f10a025cfe97 I mistakenly used list_member_oid in a place  
where list_member_xid is called for.  (Currently innocuous as both  
typedefs are pretty much identical, but if we change either, it'll  
become broken.)  Repair.  
  
Author: Hou Zhijie <[email protected]>  
Discussion: https://postgr.es/m/OS0PR01MB5716E2399494D4CB1A28A091942A9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/nodes/list.c

Fix assertion failures while processing NEW_CID record in logical decoding.

commit   : 16b1fe0037dc5a23dc7e2eb2ab62949800797b91    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 20 Oct 2022 08:49:48 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 20 Oct 2022 08:49:48 +0530    

Click here for diff

When the logical decoding restarts from NEW_CID, since there is no  
association between the top transaction and its subtransaction, both are  
created as top transactions and have the same LSN. This caused the  
assertion failure in AssertTXNLsnOrder().  
  
This patch skips the assertion check until we reach the LSN at which we  
start decoding the contents of the transaction, specifically  
start_decoding_at LSN in SnapBuild. This is okay because we don't  
guarantee to make the association between top transaction and  
subtransaction until we try to decode the actual contents of transaction.  
The ordering of the records prior to the start_decoding_at LSN should have  
been checked before the restart.  
  
The other assertion failure is due to the reason that we forgot to track  
that we have considered top-level transaction id in the list of catalog  
changing transactions that were committed when one of its subtransactions  
is marked as containing catalog change.  
  
Reported-by: Tomas Vondra, Osumi Takamichi  
Author: Masahiko Sawada, Kuroda Hayato  
Reviewed-by: Amit Kapila, Dilip Kumar, Kuroda Hayato, Kyotaro Horiguchi, Masahiko Sawada  
Backpatch-through: 10  
Discussion: https://postgr.es/m/a89b46b6-0239-2fd5-71a9-b19b1f7a7145%40enterprisedb.com  
Discussion: https://postgr.es/m/TYCPR01MB83733C6CEAE47D0280814D5AED7A9%40TYCPR01MB8373.jpnprd01.prod.outlook.com  

M contrib/test_decoding/expected/catalog_change_snapshot.out
M contrib/test_decoding/specs/catalog_change_snapshot.spec
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c

Better handle interrupting TAP tests

commit   : 460c0076e8de6233eee53f4d6c175b04d8d41de9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 19 Oct 2022 17:09:51 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 19 Oct 2022 17:09:51 +0200    

Click here for diff

Set up a signal handler for INT/TERM so that we run our END block if we  
get them.  In END, if the exit status indicates a problem, call  
_update_pid(-1) to improve chances of the stop working in case start()  
hasn't returned yet.  
  
Also, change END's teardown_node() so that it passes fail_ok=>1, so that  
if a node fails to stop, we still stop the other nodes in the same test.  
  
Per complaint from Andres Freund.  
  
This doesn't seem important enough to backpatch, at least for now.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Get rid of XLogCtlInsert->forcePageWrites

commit   : 342bb38bfeb099c5f8aa8f44a7e18f2dc21f1ecd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 19 Oct 2022 12:35:00 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 19 Oct 2022 12:35:00 +0200    

Click here for diff

After commit 39969e2a1e4d, ->forcePageWrites is no longer very  
interesting: we can just test whether runningBackups is different from 0.  
This simplifies some code, so do away with it.  
  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/39969e2a1e4d7f5a37f3ef37d53bbfe171e7d77a  

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

Track LLVM 15 changes.

commit   : c2ae01f695b1605bc5e3908ff52b24fce6636caa    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 19 Oct 2022 22:18:26 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 19 Oct 2022 22:18:26 +1300    

Click here for diff

Per https://llvm.org/docs/OpaquePointers.html, support for non-opaque  
pointers still exists and we can request that on our context.  We have  
until LLVM 16 to move to opaque pointers, a much larger change.  
  
Back-patch to 11, where LLVM support arrived.  
  
Author: Thomas Munro <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAMHz58Sf_xncdyqsekoVsNeKcruKootLtVH6cYXVhhUR1oKPCg%40mail.gmail.com  

M configure
M configure.ac
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/meson.build

Remove pg_backup_start_callback and reuse similar code

commit   : df3737a651f40a398c14348b0482e97031e7a7d4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 19 Oct 2022 10:35:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 19 Oct 2022 10:35:53 +0200    

Click here for diff

We had two copies of almost identical logic to revert shared memory  
state when a running backup aborts; we can remove  
pg_backup_start_callback if we adapt do_pg_abort_backup so that it can  
be used for this purpose too.  
  
However, in order for this to work, we have to repurpose the flag passed  
to do_pg_abort_backup.  It used to indicate whether to throw a warning  
(and the only caller always passed true).  It now indicates whether the  
callback is being called at start time (in which case the session backup  
state is known not to have been set to RUNNING yet, so action is always  
taken) or shmem time (in which case action is only taken if the session  
backup state is RUNNING).  Thus the meaning of the flag is no longer  
superfluous, but it's actually quite critical to get right.  I (Álvaro)  
chose to change the polarity and the code flow re. the flag from what  
Bharath submitted, for coding clarity.  
  
Co-authored-by: Bharath Rupireddy <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20221013111330.564fk5tkwe3ha77l%40alvherre.pgsql  

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

Rework shutdown callback of archiver modules

commit   : 9668c4a6618cc4a7a94f4bc0ad5685dd596bab63    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Oct 2022 14:06:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Oct 2022 14:06:56 +0900    

Click here for diff

As currently designed, with a callback registered in a ERROR_CLEANUP  
block, the shutdown callback would get called twice when updating  
archive_library on SIGHUP, which is something that we want to avoid to  
ease the life of extension writers.  
  
Anyway, an ERROR in the archiver process is treated as a FATAL, stopping  
it immediately, hence there is no need for a ERROR_CLEANUP block.  
Instead of that, the shutdown callback is not called upon  
before_shmem_exit(), giving to the modules the opportunity to do any  
cleanup actions before the server shuts down its subsystems.  
  
While on it, this commit adds some testing coverage for the shutdown  
callback.  Neither shell_archive nor basic_archive have been using it,  
and one is added to shell_archive, whose trigger is checked in a TAP  
test through a shutdown sequence.  
  
Author: Nathan Bossart, Bharath Rupireddy  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/20221015221328.GB1821022@nathanxps13  
Backpatch-through: 15  

M doc/src/sgml/config.sgml
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/shell_archive.c
M src/test/recovery/t/020_archive_status.pl

Enhance make_ctags and make_etags.

commit   : d1e2a380cb911f6f0840a8eb54dbf6e39e9c3f98    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 19 Oct 2022 12:59:29 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 19 Oct 2022 12:59:29 +0900    

Click here for diff

make_ctags did not include field members of structs since the commit  
964d01ae90c314eb31132c2e7712d5d9fc237331.  
  
For example, in the following field of RestrictInfo:  
  
   Selectivity norm_selec pg_node_attr(equal_ignore);  
  
pg_node_attr was mistakenly interpreted to be the name of the field.  
To fix this, add -I option to ctags command if the command is  
Exuberant ctags or Universal ctags (for plain old ctags, struct  
members are not included in the tags file anyway).  
  
Also add "-e" and "-n" options to make_ctags. The -e option invokes  
ctags command with -e option, which produces TAGS file for emacs. This  
allows to eliminate duplicate codes in make_etags so that make_etags  
just exec make_ctags with -e option.  
  
The -n option allows not to produce symbolic links in each  
sub directory (the default is producing symbolic links).  
  
Author: Yugo Nagata  
Reviewers: Alvaro Herrera, Tatsuo Ishii  
Discussion: https://postgr.es/m/flat/20221007154442.76233afc7c5b255c4de6528a%40sraoss.co.jp  

M src/tools/make_ctags
M src/tools/make_etags

Fix typos in logical/launcher.c

commit   : c68ec1b027a9941ef4dc56e0d239f29e8a26fc5d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Oct 2022 10:27:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Oct 2022 10:27:23 +0900    

Click here for diff

Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pvbma5HCc7==-B1ycyLQVyu7Fqq-qV=jhC5Zx4pWqk3uw@mail.gmail.com  

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

Refactor regular expression handling in hba.c

commit   : fc579e11c6b8400f8d4ea2438c72bde006774370    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Oct 2022 10:08:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Oct 2022 10:08:49 +0900    

Click here for diff

AuthToken gains a regular expression, and IdentLine is changed so as it  
uses an AuthToken rather than tracking separately the ident user string  
used for the regex compilation and its generated regex_t.  In the case  
of pg_ident.conf, a set of AuthTokens is built in the pre-parsing phase  
of the file, and an extra regular expression is compiled when building  
the list of IdentLines, after checking the sanity of the fields in a  
pre-parsed entry.  
  
The logic in charge of computing and executing regular expressions is  
now done in a new set of routines called respectively  
regcomp_auth_token() and regexec_auth_token() that are wrappers around  
pg_regcomp() and pg_regexec(), working on AuthTokens.  While on it, this  
patch adds a routine able to free an AuthToken, free_auth_token(), to  
simplify a bit the logic around the requirement of using a specific free  
routine for computed regular expressions.  Note that there are no  
functional or behavior changes introduced by this commit.  
  
The goal of this patch is to ease the use of regular expressions with  
more items of pg_hba.conf (user list, database list, potentially  
hostnames) where AuthTokens are used extensively.  This will be tackled  
later in a separate patch.  
  
Author: Bertrand Drouvot, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c
M src/backend/utils/adt/hbafuncs.c
M src/include/libpq/hba.h

Fix confusion about havingQual vs hasHavingQual in planner.

commit   : 8bf66dedd88673f94122c3f3337e7d58e561ef4f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Oct 2022 10:44:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Oct 2022 10:44:34 -0400    

Click here for diff

Preprocessing of the HAVING clause will reduce havingQual to NIL  
if the clause is constant-TRUE.  This is one case where that  
convention is rather unfortunate, because "HAVING TRUE" is not at all  
the same as not having any HAVING clause at all.  (Per the SQL spec,  
it still forces the query to be grouped.)  The planner deals with this  
by having a boolean hasHavingQual that records whether havingQual was  
originally nonempty; places that just want to check whether HAVING  
was specified are supposed to consult that.  
  
I found three places that got that wrong.  Fortunately, these could  
only affect cost estimates not correctness.  It'd be hard even  
to demonstrate the errors; for example, the one in allpaths.c would  
only matter in a query that has HAVING TRUE but no GROUP BY and no  
aggregates, which would require a completely variable-free SELECT  
list, making the case probably of only academic interest.  Hence,  
while these are worth fixing before someone copies the incorrect  
coding somewhere more critical, they don't seem worth back-patching.  
I didn't bother trying to devise regression tests, either.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/path/allpaths.c

Remove no-longer-needed compatibility hack

commit   : 997cd15c7c1629c3d8545aa2ef1afc2e8a6bacfa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 18 Oct 2022 11:51:50 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 18 Oct 2022 11:51:50 +0200    

Click here for diff

Our Perl version requirement was raised to 5.14 by commit 4c1532763a00  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve errhint for ALTER SUBSCRIPTION ADD/DROP PUBLICATION

commit   : 915a6c4e22ecc4775b9ed18312bf12d896cd2b11    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 18 Oct 2022 11:46:58 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 18 Oct 2022 11:46:58 +0200    

Click here for diff

The original hint says to use SET PUBLICATION when really ADD/DROP  
PUBLICATION is called for, so this is arguably a bug fix.  
  
Also, a very similar message elsewhere was using an inconsistent  
SQLSTATE.  
  
While at it, unwrap some strings.  
  
Backpatch to 15.  
  
Author: Hou zj <[email protected]>  
Discussion: https://postgr.es/m/OS0PR01MB57160AD0E7386547BA978EB394299@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/commands/subscriptioncmds.c

Remove compatibility declarations for InitMaterializedSRF()

commit   : eddc128beac0f6e7b87e003888b0e947f7548e8a    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Oct 2022 10:44:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Oct 2022 10:44:02 +0900    

Click here for diff

These routines have been renamed in a19e5ce.  There is no need to keep  
the compatibility declarations on HEAD, as once an extension moves to  
the new routine name when compiling with v16~ the code would work the  
same way when recompiled on v15.  No backpatch to v15 for this one,  
because ABI compatibility has to be maintained there.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/fmgr/funcapi.c
M src/include/funcapi.h

Rename SetSingleFuncCall() to InitMaterializedSRF()

commit   : a19e5cee635dc94c9c6e44c8863b4b770920a04b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Oct 2022 10:22:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Oct 2022 10:22:35 +0900    

Click here for diff

Per discussion, the existing routine name able to initialize a SRF  
function with materialize mode is unpopular, so rename it.  Equally, the  
flags of this function are renamed, as of:  
- SRF_SINGLE_USE_EXPECTED -> MAT_SRF_USE_EXPECTED_DESC  
- SRF_SINGLE_BLESS -> MAT_SRF_BLESS  
The previous function and flags introduced in 9e98583 are kept around  
for compatibility purposes, so as any extension code already compiled  
with v15 continues to work as-is.  The declarations introduced here for  
compatibility will be removed from HEAD in a follow-up commit.  
  
The new names have been suggested by Andres Freund and Melanie  
Plageman.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M contrib/amcheck/verify_heapam.c
M contrib/dblink/dblink.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/postgres_fdw/connection.c
M contrib/xml2/xpath.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/prepare.c
M src/backend/foreign/foreign.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/shmem.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/fmgr/README
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/mmgr/portalmem.c
M src/include/funcapi.h
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

doc: move the mention of aggregate JSON functions up in section

commit   : 77dd153d39663461b32f3d5efce397af678ba083    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 17 Oct 2022 15:21:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 17 Oct 2022 15:21:29 -0400    

Click here for diff

It was previously easily overlooked at the end of several tables.  
  
Reported-by: Alex Denman  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/func.sgml

doc: warn pg_stat_reset() can cause vacuum/analyze problems

commit   : 4d070469c19f85043293789c570dbe8fb41ab1bb    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 17 Oct 2022 15:07:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 17 Oct 2022 15:07:03 -0400    

Click here for diff

The fix is to run ANALYZE.  
  
Discussion: https://postgr.es/m/[email protected],  
   https://postgr.es/m/flat/CAKJS1f8DTbCHf9gedU0He6ARsd58E6qOhEHM1caomqj_r9MOiQ%40mail.gmail.com,  
   https://postgr.es/m/CAKJS1f80o98hcfSk8j%3DfdN09S7Sjz%2BvuzhEwbyQqvHJb_sZw0g%40mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/monitoring.sgml

Record dependencies of a cast on other casts that it requires.

commit   : 8272749e8ca1dbbcb5f8cf5632ec26a573ac3111    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Oct 2022 14:02:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Oct 2022 14:02:05 -0400    

Click here for diff

When creating a cast that uses a conversion function, we've  
historically allowed the input and result types to be  
binary-compatible with the function's input and result types,  
rather than necessarily being identical.  This means that the new  
cast is logically dependent on the binary-compatible cast or casts  
that it references: if those are defined by pg_cast entries, and you  
try to restore the new cast without having defined them, it'll fail.  
Hence, we should make pg_depend entries to record these dependencies  
so that pg_dump knows that there is an ordering requirement.  
  
This is not the only place where we allow such shortcuts; aggregate  
functions for example are similarly lax, and in principle should gain  
similar dependencies.  However, for now it seems sufficient to fix  
the cast-versus-cast case, as pg_dump's other ordering heuristics  
should keep it out of trouble for other object types.  
  
Per report from David Turoň; thanks also to Robert Haas for  
preliminary investigation.  I considered back-patching, but  
seeing that this issue has existed for many years without  
previous reports, it's not clear it's worth the trouble.  
Moreover, back-patching wouldn't be enough to ensure that the  
new pg_depend entries exist in existing databases anyway.  
  
Discussion: https://postgr.es/m/OF0A160F3E.578B15D1-ONC12588DA.003E4857-C12588DA.0045A428@notes.linuxbox.cz  

M src/backend/catalog/pg_cast.c
M src/backend/commands/functioncmds.c
M src/backend/commands/typecmds.c
M src/backend/parser/parse_coerce.c
M src/include/catalog/pg_cast.h
M src/include/parser/parse_coerce.h
M src/test/regress/expected/create_cast.out
M src/test/regress/sql/create_cast.sql
M src/tools/valgrind.supp

Reject non-ON-SELECT rules that are named "_RETURN".

commit   : 797e313dc9aed83e28e9f1d08a281ea48c560cd2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Oct 2022 12:14:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Oct 2022 12:14:39 -0400    

Click here for diff

DefineQueryRewrite() has long required that ON SELECT rules be named  
"_RETURN".  But we overlooked the converse case: we should forbid  
non-ON-SELECT rules that are named "_RETURN".  In particular this  
prevents using CREATE OR REPLACE RULE to overwrite a view's _RETURN  
rule with some other kind of rule, thereby breaking the view.  
  
Per bug #17646 from Kui Liu.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/rewrite/rewriteDefine.c

Guard against table-AM-less relations in planner.

commit   : eec34661182db7b79a6b56c551ac1d79ef3e1f89    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Oct 2022 11:35:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Oct 2022 11:35:23 -0400    

Click here for diff

The executor will dump core if it's asked to execute a seqscan on  
a relation having no table AM, such as a view.  While that shouldn't  
really happen, it's possible to get there via catalog corruption,  
such as a missing ON SELECT rule.  It seems worth installing a defense  
against that.  There are multiple plausible places for such a defense,  
but I picked the planner's get_relation_info().  
  
Per discussion of bug #17646 from Kui Liu.  Back-patch to v12 where  
the tableam APIs were introduced; in older versions you won't get a  
SIGSEGV, so it seems less pressing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/plancat.c

commit   : c68a1839902daeb42cf1ebc89edfdd91c00e5091    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Oct 2022 11:40:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Oct 2022 11:40:14 +0900    

Click here for diff

The file name used for its temporary destination, before renaming it to  
the real deal, has been using a microseconds in a timestamp aimed to be  
originally in milli-seconds.  This is harmless as this is aimed at being  
a safeguard against name collisions (note MyProcPid in the name), but  
let's be correct with the maths.  
  
While on it, add a note in the module's makefile to document why  
installcheck is not supported.  
  
Author: Nathan Bossart  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/20221014044106.GA1673343@nathanxps13  
Backpatch-through: 15  

M contrib/basic_archive/Makefile
M contrib/basic_archive/basic_archive.c

Add checks for regexes with user name map in test for peer authentication

commit   : 7622422b725eb4b7403c33a9e4986e0ed9826cbd    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Oct 2022 11:06:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Oct 2022 11:06:00 +0900    

Click here for diff

There is already some coverage for that in the kerberos test suite,  
though it requires PG_TEST_EXTRA to be set as per its insecure nature.  
This provides coverage in a default setup, as long as peer is supported  
on the platform where its test is run.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/test/authentication/t/003_peer.pl

Fix EXPLAIN of SEARCH BREADTH FIRST with a constant initial value.

commit   : d57534740b7682c2816ce6c54318521787fcfacf    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Oct 2022 19:18:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Oct 2022 19:18:08 -0400    

Click here for diff

If the non-recursive term of a SEARCH BREADTH FIRST recursive  
query has only constants in its target list, the planner will  
fold the starting RowExpr added by rewrite into a simple Const  
of type RECORD.  The executor doesn't have any problem with  
that --- but EXPLAIN VERBOSE will encounter the Const as the  
ultimate source of truth about what the field names of the  
SET column are, and it didn't know what to do with that.  
Fortunately, we can pull the identifying typmod out of the  
Const, in much the same way that record_out would.  
  
For reasons that remain a bit obscure to me, this only fails  
with SEARCH BREADTH FIRST, not SEARCH DEPTH FIRST or CYCLE.  
But I added regression test cases for both of those options  
too, just to make sure we don't break it in future.  
  
Per bug #17644 from Matthijs van der Vleuten.  Back-patch  
to v14 where these constructs were added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/backend/utils/fmgr/funcapi.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Rename parser token REF to REF_P to avoid a symbol conflict.

commit   : 717ec1aae90b91466809b1f6b0aa779dbf7a270b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Oct 2022 15:27:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Oct 2022 15:27:04 -0400    

Click here for diff

In the latest version of Apple's macOS SDK, <sys/socket.h>  
fails to compile if "REF" is #define'd as something.  
Apple may or may not agree that this is a bug, and even if  
they do accept the bug report I filed, they probably won't  
fix it very quickly.  In the meantime, our back branches will all  
fail to compile gram.y.  v15 and HEAD currently escape the problem  
thanks to the refactoring done in 98e93a1fc, but that's purely  
accidental.  Moreover, since that patch removed a widely-visible  
inclusion of <netdb.h>, back-patching it seems too likely to break  
third-party code.  
  
Instead, change the token's code name to REF_P, following our usual  
convention for naming parser tokens that are likely to have symbol  
conflicts.  The effects of that should be localized to the grammar  
and immediately surrounding files, so it seems like a safer answer.  
  
Per project policy that we want to keep recently-out-of-support  
branches buildable on modern systems, back-patch all the way to 9.2.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/gram.y
M src/include/parser/kwlist.h

Use libc's snprintf, not sprintf, for special cases in snprintf.c.

commit   : 450ee701261a7ff5fe35842b91384eea46e81c2e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Oct 2022 11:47:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Oct 2022 11:47:44 -0400    

Click here for diff

snprintf.c has always fallen back on libc's *printf implementation  
when printing pointers (%p) and floats.  When this code originated,  
we were still supporting some platforms that lacked native snprintf,  
so we used sprintf for that.  That's not actually unsafe in our usage,  
but nonetheless builds on macOS are starting to complain about sprintf  
being unconditionally deprecated; and I wouldn't be surprised if other  
platforms follow suit.  There seems little reason to believe that any  
platform supporting C99 wouldn't have standards-compliant snprintf,  
so let's just use that instead to suppress such warnings.  
  
Back-patch to v12, which is where we started to require C99.  It's  
also where we started to use our snprintf.c everywhere, so this  
wouldn't be enough to suppress the warning in older branches anyway  
--- that is, in older branches these aren't necessarily all our  
usages of libc's sprintf.  It is enough in v12+ because any  
deprecation annotation attached to libc's sprintf won't apply to  
pg_sprintf.  (Whether all our usages of pg_sprintf are adequately  
safe is not a matter I intend to address here, but perhaps it could  
do with some review.)  
  
Per report from Andres Freund and local testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

meson: macos: Use -Wl,-undefined,error for modules

commit   : 9a95a510adf37fa73076647ac13286c8100dd1aa    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 15 Oct 2022 17:00:27 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 15 Oct 2022 17:00:27 -0700    

Click here for diff

meson defaults to -Wl,-undefined,dynamic_lookup for modules, which we don't  
want because a) it's different from what we do for autoconf, b) it causes  
warnings starting in macOS Ventura.  
  
Discussion: https://postgr.es/m/[email protected]  

M meson.build

meson: catch up to a few configure changes

commit   : 57bab33302d4cdd8d48f91382aac912d7f07de59    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 15 Oct 2022 12:00:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 15 Oct 2022 12:00:16 -0700    

Click here for diff

I (Andres) missed a few recent changes to configure when merging  
e6927270cd1 "meson: Add initial version of meson based build system". Mirror  
the changes in  
- ec3c9cc202f "Add definition pg_attribute_aligned() for MSVC"  
- b086a47a270 "Bump minimum version of Bison to 2.3"  
- 8b878bffa8d "Bump minimum version of Flex to 2.5.35"  
  
As MSVC does not implement 128 bit integers, the oversight of not using  
pg_attribute_aligned() should not have current practical consequences. But of  
course the code from c.h should still be correctly mirrored.  
  
I (Andres) also hadn't implemented the minimum perl version check. Added that  
now.  
  
Reported-by: Junwang Zhao <[email protected]>  
Author: Junwang Zhao <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAEG8a3K9c87EwAwmdOgmS0Li1J6P_7r-Uc0-zN6cJtrMr7VvPg@mail.gmail.com  

M meson.build

Disallow MERGE cleanly for foreign partitions

commit   : cba4e78f3599f7edc3fb53d1b094f037fbb8158a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 15 Oct 2022 19:24:26 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 15 Oct 2022 19:24:26 +0200    

Click here for diff

While directly targetting a foreign table with MERGE was already  
expressly forbidden, we failed to catch the case of a partitioned table  
that has a foreign table as a partition; and the result if you try is an  
incomprehensible error.  Fix that by adding a specific check.  
  
Backpatch to 15.  
  
Reported-by: Tatsuhiro Nakamori <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/createplan.c

Fix some comments in proc.h

commit   : 1054c604bcdbae5de42beab2f60da7b0067cd4bb    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 15 Oct 2022 12:22:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 15 Oct 2022 12:22:29 +0900    

Click here for diff

There was a typo and two places where delayChkpt was still mentioned,  
but it is called delayChkptFlags these days.  
  
Author: David Christensen  
Discussion: https://postgr.es/m/CAOxo6XLB=ab_Y9jRw4iKyMZDns0wo=EGSRvijhhaL67RzqbtMg@mail.gmail.com  

M src/include/storage/proc.h

pgstat: Track time of the last scan of a relation

commit   : c037471832e1ec3327f81eebbd8892e5c1042fe0    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2022 11:11:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2022 11:11:34 -0700    

Click here for diff

It can be useful to know when a relation has last been used, e.g., when  
evaluating whether an index is still required. It was already possible to  
infer the time of the last usage by tracking, e.g.,  
pg_stat_all_indexes.idx_scan over time. But far from everybody does so.  
  
To make it easier to detect the last time a relation has been scanned, track  
that time in each relation's pgstat entry. To minimize overhead a) the  
timestamp is updated only when the backend pending stats entry is flushed to  
shared stats b) the last transaction's stop timestamp is used as the  
timestamp.  
  
Bumps catalog and stats format versions.  
  
Author: Dave Page <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Bruce Momjian <[email protected]>  
Reviewed-by: Vik Fearing <[email protected]>  
Discussion: https://postgr.es/m/CA+OCxozrVHNFVEPkweUHMZje+t1tfY816d9MZYc6eZwOOusOaQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/activity/pgstat_relation.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/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Have GetCurrentTransactionStopTimestamp() set xactStopTimestamp if unset

commit   : 309b2cf2433d1b1454636595600f160b41871ff5    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2022 11:11:33 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 14 Oct 2022 11:11:33 -0700    

Click here for diff

Previously GetCurrentTransactionStopTimestamp() computed a new timestamp  
whenever xactStopTimestamp was unset and xactStopTimestamp was only set when a  
commit or abort record was written.  
  
An upcoming patch will add additional calls to  
GetCurrentTransactionStopTimestamp() from pgstats. To avoid computing  
timestamps multiple times, set xactStopTimestamp in  
GetCurrentTransactionStopTimestamp() if not already set.  
  
Author: Dave Page <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Vik Fearing <[email protected]>  
Discussion: https://postgr.es/m/20220906155325.an3xesq5o3fq36gt%40awork3.anarazel.de  

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

libpq: Reset singlerow flag correctly in pipeline mode

commit   : db1b931a4ee885ebd27bb5b335c1e461ccc34bbe    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Oct 2022 19:06:26 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Oct 2022 19:06:26 +0200    

Click here for diff

When a query whose results were requested in single-row mode is the last  
in the queue by the time those results are being read, the single-row  
flag was not being reset, because we were returning early from  
pqPipelineProcessQueue.  Move that stanza up so that the flag is always  
reset at the end of sending that query's results.  
  
Add a test for the situation.  
  
Backpatch to 14.  
  
Author: Denis Laxalde <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-exec.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/traces/singlerow.trace

Add auxiliary lists to GUC data structures for better performance.

commit   : f13b2088fa2d4455936e65459b77698a4452f932    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2022 12:36:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2022 12:36:14 -0400    

Click here for diff

The previous patch made addition of new GUCs cheap, but other GUC  
operations aren't improved and indeed get a bit slower, because  
hash_seq_search() is slower than just scanning a pointer array.  
  
However, most performance-critical GUC operations only need  
to touch a relatively small fraction of the GUCs; especially  
so for AtEOXact_GUC().  We can improve matters at the cost  
of a bit more space by adding dlist or slist links to the  
GUC data structures.  This patch invents lists that track  
  
(1) all GUCs with non-default "source";  
  
(2) all GUCs with nonempty state stack (implying they've  
been changed in the current transaction);  
  
(3) all GUCs due for reporting to the client.  
  
All of guc.c's performance-critical cases can make use of one or  
another of these lists to avoid searching the whole hash table.  
In particular, the stack list means that transaction end  
doesn't take time proportional to the number of GUCs, but  
only to the number changed in the current transaction.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/include/utils/guc_tables.h

Replace the sorted array of GUC variables with a hash table.

commit   : 3057465acfbea2f3dd7a914a1478064022c6eecd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2022 12:26:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2022 12:26:39 -0400    

Click here for diff

This gets rid of bsearch() in favor of hashed lookup.  The main  
advantage is that it becomes far cheaper to add new GUCs, since  
we needn't re-sort the pointer array.  Adding N new GUCs had  
been O(N^2 log N), but now it's closer to O(N).  We need to  
sort only in SHOW ALL and equivalent functions, which are  
hopefully not performance-critical to anybody.  
  
Also, merge GetNumConfigOptions() into get_guc_variables(),  
because in a world where the set of GUCs isn't fairly static  
you really want to consider those two results as tied together  
not independent.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/help_config.c
M src/include/utils/guc.h
M src/include/utils/guc_tables.h

Store GUC data in a memory context, instead of using malloc().

commit   : 407b50f2d421bca5b134a0033176ea8f8c68dc6b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2022 12:10:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2022 12:10:48 -0400    

Click here for diff

The only real argument for using malloc directly was that we needed  
the ability to not throw error on OOM; but mcxt.c grew that feature  
awhile ago.  
  
Keeping the data in a memory context improves accountability and  
debuggability --- for example, without this it's almost impossible  
to detect memory leaks in the GUC code with anything less costly  
than valgrind.  Moreover, the next patch in this series will add a  
hash table for GUC lookup, and it'd be pretty silly to be using  
palloc-dependent hash facilities alongside malloc'd storage of the  
underlying data.  
  
This is a bit invasive though, in particular causing an API break  
for GUC check hooks that want to modify the GUC's value or use an  
"extra" data structure.  They must now use guc_malloc() and  
guc_free() instead of malloc() and free().  Failure to change  
affected code will result in assertion failures or worse; but  
thanks to recent effort in the mcxt infrastructure, it shouldn't  
be too hard to diagnose such oversights (at least in assert-enabled  
builds).  
  
One note is that this changes ParseLongOption() to return short-lived  
palloc'd not malloc'd data.  There wasn't any caller for which the  
previous definition was better.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/backend/commands/tablespace.c
M src/backend/commands/variable.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/syncrep.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/misc/README
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/tzparser.c
M src/include/utils/guc.h
M src/pl/plpgsql/src/pl_handler.c

Make some minor improvements in memory-context infrastructure.

commit   : 9c911ec065df0f660e3add65d986f95928914375    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2022 11:55:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Oct 2022 11:55:56 -0400    

Click here for diff

We lack a version of repalloc() that supports MCXT_ALLOC_NO_OOM  
semantics, so invent repalloc_extended() with the usual set of  
flags.  repalloc_huge() becomes a legacy wrapper for that.  
  
Also, fix dynahash.c so that it can support HASH_ENTER_NULL  
requests when using the default palloc-based allocator.  
The only reason it didn't do that already was the lack of the  
MCXT_ALLOC_NO_OOM option when that code was written, ages ago.  
  
While here, simplify a few overcomplicated tests in mcxt.c.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/hash/dynahash.c
M src/backend/utils/mmgr/mcxt.c
M src/include/utils/palloc.h

Standardize format for printing PIDs

commit   : 1b11561cc1de7596f6f7cb750743af94b9d168f7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2022 08:37:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2022 08:37:12 +0200    

Click here for diff

Most code prints PIDs as %d, but some code tried to print them as long  
or unsigned long.  While this is in theory allowed, the fact that PIDs  
fit into int is deeply baked into all PostgreSQL code, so these random  
deviations don't accomplish anything except confusion.  
  
Note that we still need casts from pid_t to int, because on 64-bit  
MinGW, pid_t is long long int.  (But per above, actually supporting  
that range in PostgreSQL code would be major surgery and probably not  
useful.)  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/postmaster/bgworker.c
M src/backend/storage/ipc/procsignal.c

doc: Correct type of bgw_notify_pid

commit   : 34df7b9dfdeee442cf43060b6499bedc5f619f7f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2022 08:37:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Oct 2022 08:37:12 +0200    

Click here for diff

This has apparently been wrong since the beginning  
(090d0f2050647958865cb495dff74af7257d2bb4).  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/bgworker.sgml

Fix incorrect comment regarding command completion tags

commit   : 39b8c293fcde1d845da4d7127a25d41df53faab5    
  
author   : David Rowley <[email protected]>    
date     : Fri, 14 Oct 2022 14:32:00 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 14 Oct 2022 14:32:00 +1300    

Click here for diff

The comment talked about some Asserts which did not exist and also a  
variable name which seems to have long since disappeared.  
  
Rewrite the comment in a way that will hopefully stand the test of  
time and inform people why we always write "INSERT 0 <nrows>" instead of  
"INSERT <nrows>" in the command completion tag for INSERT.  
  
Reviewed-by: Mark Dilger  
Discussion: https://postgr.es/m/CAApHDvpiUg09AvvGAVopNAKemA9z-kCmt7Fi6HKauc32bKzx4w@mail.gmail.com  

M src/backend/tcop/dest.c

Remove redundant memset call following palloc0

commit   : ba185d318dd34ed3e860b3a19869fbc15007db8f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 13 Oct 2022 23:18:00 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 13 Oct 2022 23:18:00 +0200    

Click here for diff

This is a follow-up commit to ca7f8e2 which removed the allocation  
abstraction from pgcrypto and replaced px_alloc + memset calls with  
palloc0 calls. The particular memset in this commit was missed in  
that work though.  
  
Author: Zhihong Yu <[email protected]>  
Reviewed-by: Bruce Momjian <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/CALNJ-vT5qRucrFMPSzQyAWods1b4MnNPG-M=_ZUzh1SoTh0vNw@mail.gmail.com  

M contrib/pgcrypto/px.c

pg_buffercache: Add pg_buffercache_summary()

commit   : 2589434ae0fbfe08e46b6a4ffba400140b636074    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Oct 2022 09:55:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Oct 2022 09:55:46 -0700    

Click here for diff

Using pg_buffercache_summary() is significantly cheaper than querying  
pg_buffercache and summarizing in SQL.  
  
Author: Melih Mutlu <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: Zhang Mingli <[email protected]>  
Discussion: https://postgr.es/m/CAGPVpCQAXYo54Q%3D8gqBsS%3Du0uk9qhnnq4%2B710BtUhUisX1XGEg%40mail.gmail.com  

M contrib/pg_buffercache/Makefile
M contrib/pg_buffercache/expected/pg_buffercache.out
M contrib/pg_buffercache/meson.build
A contrib/pg_buffercache/pg_buffercache–1.3–1.4.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_buffercache/sql/pg_buffercache.sql
M doc/src/sgml/pgbuffercache.sgml

Fix typo in CREATE PUBLICATION reference page

commit   : 7f8d9cedb374c9a23f0730f92a0b88d479325ba9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Oct 2022 13:36:14 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Oct 2022 13:36:14 +0200    

Click here for diff

While at it, simplify wording a bit.  
  
Author: Takamichi Osumi <[email protected]>  
Reviewed-by: Peter Smith <[email protected]>  
Discussion: https://postgr.es/m/TYCPR01MB8373F93F5D094A2BE648990DED259@TYCPR01MB8373.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_publication.sgml

Put tests of md5() function into separate test file

commit   : 9786b89bd1b4c298ed900d118cbb5eb997c34905    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Oct 2022 11:46:18 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Oct 2022 11:46:18 +0200    

Click here for diff

In FIPS mode, these calls will fail.  By having them in a separate  
file, it would make it easier to have an alternative output file or  
selectively disable these tests.  This isn't done here; this is just  
some preparation.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

A src/test/regress/expected/md5.out
M src/test/regress/expected/strings.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/md5.sql
M src/test/regress/sql/strings.sql

Allow batch insertion during COPY into a foreign table.

commit   : 97da48246d34807196b404626f019c767b7af0df    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 13 Oct 2022 18:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 13 Oct 2022 18:45:00 +0900    

Click here for diff

Commit 3d956d956 allowed the COPY, but it's done by inserting individual  
rows to the foreign table, so it can be inefficient due to the overhead  
caused by each round-trip to the foreign server.  To improve performance  
of the COPY in such a case, this patch allows batch insertion, by  
extending the multi-insert machinery in CopyFrom() to the foreign-table  
case so that we insert multiple rows to the foreign table at once using  
the FDW callback routine added by commit b663a4136.  This patch also  
allows this for postgres_fdw.  It is enabled by the "batch_size" option  
added by commit b663a4136, which is disabled by default.  
  
When doing batch insertion, we update progress of the COPY command after  
performing the FDW callback routine, to count rows not suppressed by the  
FDW as well as a BEFORE ROW INSERT trigger.  For consistency, this patch  
changes the timing of updating it for plain tables: previously, we  
updated it immediately after adding each row to the multi-insert buffer,  
but we do so only after writing the rows stored in the buffer out to the  
table using table_multi_insert(), which I think would be consistent even  
with non-batching mode, because in that mode we update it after writing  
each row out to the table using table_tuple_insert().  
  
Andrey Lepikhov, heavily revised by me, with review from Ian Barwick,  
Andrey Lepikhov, and Zhihong Yu.  
  
Discussion: https://postgr.es/m/bc489202-9855-7550-d64c-ad2d83c24867%40postgrespro.ru  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/commands/copyfrom.c
M src/include/commands/copyfrom_internal.h

Add missing isolation test for test_decoding in meson build

commit   : 56c19fee2db43f236eb8f4cbef5235701873fceb    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 13 Oct 2022 16:03:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 13 Oct 2022 16:03:01 +0900    

Click here for diff

Oversight in 7f13ac8, where catalog_change_snapshot was missing from the  
list in meson.build.  
  
Author: Hayato Kuroda  
Discussion: https://postgr.es/m/TYAPR01MB58662C932F45A13C6F9BE352F5259@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M contrib/test_decoding/meson.build

Improve the WARNING message for CREATE SUBSCRIPTION.

commit   : 5263c6b095c9bac2a4a744b72425e6690121c79d    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 13 Oct 2022 06:09:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 13 Oct 2022 06:09:43 +0530    

Click here for diff

Author: Peter Smith  
Reviewed-By: Alvaro Herrera, Tom Lane, Amit Kapila  
Discussion: https://postgr.es/m/CAHut+PvqdqOanheWSHDyhQiF+Z-7w=-+k4U+bwbT=b6YQ_hrXQ@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c
M src/test/regress/expected/object_address.out
M src/test/regress/expected/subscription.out

Fix ordering issue with WAL operations in GIN fast insert path

commit   : 56b662523fd49f75abe89d5bad54d377b2f36c24    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 13 Oct 2022 09:31:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 13 Oct 2022 09:31:57 +0900    

Click here for diff

Contrary to what is documented in src/backend/access/transam/README,  
ginHeapTupleFastInsert() had a few ordering issues with the way it does  
its WAL operations when inserting items in its fast path.  
  
First, when using a separate list, XLogBeginInsert() was being always  
called before START_CRIT_SECTION(), and in this case a second thing was  
wrong when merging lists, as an exclusive lock was taken on the tail  
page *before* calling XLogBeginInsert().  Finally, when inserting items  
into a tail page, the order of XLogBeginInsert() and  
START_CRIT_SECTION() was reversed.  This commit addresses all these  
issues by moving the calls of XLogBeginInsert() after all the pages  
logged are locked and pinned, within a critical section.  
  
Author:  Matthias van de Meent, Zhang Mingli  
Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com  

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

doc: Fix description of replication command CREATE_REPLICATION_SLOT

commit   : 63585b1ebd0d5ee66ff8f801202656d40ff9bb63    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 13 Oct 2022 08:53:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 13 Oct 2022 08:53:42 +0900    

Click here for diff

The output plugin name is a mandatory option when creating a logical  
slot, but the grammar documented was not described as such.  While on  
it, fix two comments in repl_gram.y to show that TEMPORARY is an  
optional grammar choice.  
  
Author: Ayaki Tachikake  
Discussion: https://postgr.es/m/OSAPR01MB2852607B2329FFA27834105AF1229@OSAPR01MB2852.jpnprd01.prod.outlook.com  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml
M src/backend/replication/repl_gram.y

commit   : 2d27e13b35e9a932006006eb084cf9a1d90a8cb8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2022 10:51:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Oct 2022 10:51:11 -0400    

Click here for diff

Add  
    After=network-online.target  
    Wants=network-online.target  
to the suggested unit file for starting a Postgres server.  
This delays startup until the network interfaces have been  
configured; without that, any attempt to bind to a specific  
IP address will fail.  
  
If listen_addresses is set to "localhost" or "*", it might be  
possible to get away with the less restrictive "network.target",  
but I don't think we need to get into such detail here.  
  
Per suggestion from Pablo Federico.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml

Fix outdated code reference

commit   : 8a927e3cfc8f42141072b0a677678d76cec8a1db    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Oct 2022 09:53:00 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Oct 2022 09:53:00 +0200    

Click here for diff

ExecCreatePartitionPruneState was renamed by commit 297daa9d4353, but  
this test file didn't get the memo.  Repair.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqFLw=oLX0tP9kcKBmoOExNjDaoAe99dRcxo-GdB9abP9A@mail.gmail.com  

M src/test/modules/delay_execution/specs/partition-addition.spec

Reduce xlog.h inclusion footprint

commit   : 9c0de04242a160aa1d4afeefab7d2e40efd8255d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Oct 2022 09:44:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Oct 2022 09:44:40 +0200    

Click here for diff

This file needs xlogreader.h only for the XLogReaderState typedef; but  
we can dodge that by forward-declaring it.  Many files use xlog.h for  
reasons other than reading WAL, and it's not good to force all those  
files to include xlogreader.h, so take it out.  
  
Surprisingly, there is no fallout in core code from making this change.  
Perhaps external code will have to start including xlogreader.h.  

M src/include/access/xlog.h

Reduce basebackup_sink.h inclusion footprint

commit   : c929b2745f8cc48c0ce7dbf1fd01a8cc94d54b75    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Oct 2022 09:42:20 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Oct 2022 09:42:20 +0200    

Click here for diff

This file doesn't need xlog_internal.h, only xlogdefs.h.  

M src/include/backup/basebackup_sink.h

Add meson.build to version_stamp.pl

commit   : 38409787dc071d6af947a5eb4819ba97a24431f7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Oct 2022 07:03:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Oct 2022 07:03:51 +0200    

Click here for diff

Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/7567dd2d-5e28-c135-79ff-270d7ed83490%40enterprisedb.com  

M src/tools/version_stamp.pl

Remove Abs()

commit   : a699b7a7aa9f34c19aa7632b3f037f24c8ee7720    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Oct 2022 06:36:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Oct 2022 06:36:12 +0200    

Click here for diff

All callers have been replaced by standard C library functions.  
  
Reviewed-by: Zhang Mingli <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/4beb42b5-216b-bce8-d452-d924d5794c63%40enterprisedb.com  

M src/include/c.h

Fix shadow variable in postgres.c

commit   : 4574eb9d38c69f4c90b5468f740ff22519752066    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Oct 2022 13:42:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Oct 2022 13:42:30 +0900    

Click here for diff

-Wshadow=compatible-local is added by default since 0fe954c, and this  
warning was detected under -DWRITE_READ_PARSE_PLAN_TREES.  
  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c

Simplify some maths in xlogreader.c

commit   : a1176c67c42cf687675be762ebb6075e092d3d0a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Oct 2022 09:59:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Oct 2022 09:59:36 +0900    

Click here for diff

An LSN was calculated from a segment number, a segment size and a  
position offset, matching exactly the LSN given by the caller of  
XLogReaderValidatePageHeader().  This change removes the extra LSN  
calculation, relying only on the LSN given by the function caller  
instead.  
  
Author: Bharath Rupireddy  
Reviewed-by: Richard Guo, Álvaro Herrera, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CALj2ACXuh4Ms9j9sxMYdtHEe=5sFcyrs-GAHyADu_A_G71kZTg@mail.gmail.com  

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

Fix compilation warning in test_copy_callbacks

commit   : 94fd253d561bcc1db067d04f75fc1f34c3b9962f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Oct 2022 08:45:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Oct 2022 08:45:01 +0900    

Click here for diff

A passed-in parameter value was incorrect, for a warning coming from  
MSVC.  
  
Oversight in 9fcdf2c.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_copy_callbacks/test_copy_callbacks.c

Harden pmsignal.c against clobbered shared memory.

commit   : 18a4a620e2de0e25a15303a8f78ff415950a14ef    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2022 18:54:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2022 18:54:31 -0400    

Click here for diff

The postmaster is not supposed to do anything that depends  
fundamentally on shared memory contents, because that creates  
the risk that a backend crash that trashes shared memory will  
take the postmaster down with it, preventing automatic recovery.  
In commit 969d7cd43 I lost sight of this principle and coded  
AssignPostmasterChildSlot() in such a way that it could fail  
or even crash if the shared PMSignalState structure became  
corrupted.  Remarkably, we've not seen field reports of such  
crashes; but I managed to induce one while testing the recent  
changes around palloc chunk headers.  
  
To fix, make a semi-duplicative state array inside the postmaster  
so that we need consult only local state while choosing a "child  
slot" for a new backend.  Ensure that other postmaster-executed  
routines in pmsignal.c don't have critical dependencies on the  
shared state, either.  Corruption of PMSignalState might now  
lead ReleasePostmasterChildSlot() to conclude that backend X  
failed, when actually backend Y was the one that trashed things.  
But that doesn't matter, because we'll force a cluster-wide reset  
regardless.  
  
Back-patch to all supported branches, since this is an old bug.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/pmsignal.c

Yet further fixes for multi-row VALUES lists for updatable views.

commit   : b8f2687fdc410371bbfa579ab7c4fd4b7a5ed1cb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2022 18:24:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2022 18:24:14 -0400    

Click here for diff

DEFAULT markers appearing in an INSERT on an updatable view  
could be mis-processed if they were in a multi-row VALUES clause.  
This would lead to strange errors such as "cache lookup failed  
for type NNNN", or in older branches even to crashes.  
  
The cause is that commit 41531e42d tried to re-use rewriteValuesRTE()  
to remove any SetToDefault nodes (that hadn't previously been replaced  
by the view's own default values) appearing in "product" queries,  
that is DO ALSO queries.  That's fundamentally wrong because the  
DO ALSO queries might not even be INSERTs; and even if they are,  
their targetlists don't necessarily match the view's column list,  
so that almost all the logic in rewriteValuesRTE() is inapplicable.  
  
What we want is a narrow focus on replacing any such nodes with NULL  
constants.  (That is, in this context we are interpreting the defaults  
as being strictly those of the view itself; and we already replaced  
any that aren't NULL.)  We could add still more !force_nulls tests  
to further lobotomize rewriteValuesRTE(); but it seems cleaner to  
split out this case to a new function, restoring rewriteValuesRTE()  
to the charter it had before.  
  
Per bug #17633 from jiye_sw.  Patch by me, but thanks to  
Richard Guo and Japin Li for initial investigation.  
Back-patch to all supported branches, as the previous fix was.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: add entry for pg_get_partkeydef().

commit   : 422f86a82edcc53076d120cbc9a584e40be30013    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2022 14:28:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Oct 2022 14:28:38 -0400    

Click here for diff

Other pg_get_XXXdef() functions are documented, so it seems reasonable  
to include this as well.  
  
Ian Barwick  
  
Discussion: https://postgr.es/m/CAB8KJ=hb2QZXdgyrrRjPCw++DsrRcui4fKArWabQ+oij+2x=_w@mail.gmail.com  

M doc/src/sgml/func.sgml

C comment: explain procArray->pgprocnos[]

commit   : 434c6cdf0cc9b4ee0d3c7fd2351d751fecdef8dc    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 11 Oct 2022 13:08:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 11 Oct 2022 13:08:17 -0400    

Click here for diff

Reported-by: Aleksander Alekseev  
  
Discussion: https://postgr.es/m/CAJ7c6TOs9Dh3KNR2kiQJ3Ow0=TBucL_57DAbm--2p8w5x_8YXQ@mail.gmail.com  
  
Author: Aleksander Alekseev  
  
Backpatch-through: master  

M src/include/storage/proc.h

Add a common function to generate the origin name.

commit   : 776e1c8a5d1494e345e5e1b16a5eba5e98aaddca    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 11 Oct 2022 10:37:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 11 Oct 2022 10:37:52 +0530    

Click here for diff

Make a common replication origin name formatting function to replace  
multiple snprintf() expressions. This also includes logic previously done  
by ReplicationOriginNameForTablesync().  
  
This makes the code to generate the origin name consistent among apply  
worker and tablesync worker.  
  
Author: Peter Smith  
Reviewed-By: Aleksander Alekseev  
Discussion: https://postgr.es/m/CAHut%2BPsa8hhfSE6ozUK-ih7GkQziAVAf4f3bqiXEj2nQiu-43g%40mail.gmail.com  

M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/replication/worker_internal.h

Add TAP tests for role membership in pg_hba.conf

commit   : 8432a815feb8897aabe0c6ed59f32bc47a6b2d50    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 11 Oct 2022 13:57:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 11 Oct 2022 13:57:07 +0900    

Click here for diff

This commit expands the coverage of pg_hba.conf with checks specific to  
role memberships (one "root" role combined with a member and a  
non-member).  Coverage is added for the database keywords "samegroup"  
and "samerole", where the specified role has to be be a member of the  
role with the same name as the requested database, and '+' on the user  
entry, where members are allowed.  These tests are plugged in the  
authentication test 001_password.pl as of extra connection attempts  
combined with resets of pg_hba.conf, making them rather cheap.  
  
Author: Nathan Bossart  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/20221009211348.GB900071@nathanxps13  

M src/test/authentication/t/001_password.pl

Add support for COPY TO callback functions

commit   : 9fcdf2c787ac6da330165ea3cd50ec5155943a2b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 11 Oct 2022 11:45:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 11 Oct 2022 11:45:52 +0900    

Click here for diff

This is useful as a way for extensions to process COPY TO rows in the  
way they see fit (say auditing, analytics, backend, etc.) without the  
need to invoke an external process running as the OS user running the  
backend through PROGRAM that requires superuser rights.  COPY FROM  
already provides a similar callback for logical replication.  For COPY  
TO, the callback is triggered when we are ready to send a row in  
CopySendEndOfRow(), which is the same code path as when sending a row  
to a frontend or a pipe/file.  
  
A small test module, test_copy_callbacks, is added to provide some  
coverage for this facility.  
  
Author: Bilva Sanaba, Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/commands/copyto.c
M src/include/commands/copy.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_copy_callbacks/.gitignore
A src/test/modules/test_copy_callbacks/Makefile
A src/test/modules/test_copy_callbacks/expected/test_copy_callbacks.out
A src/test/modules/test_copy_callbacks/meson.build
A src/test/modules/test_copy_callbacks/sql/test_copy_callbacks.sql
A src/test/modules/test_copy_callbacks/test_copy_callbacks–1.0.sql
A src/test/modules/test_copy_callbacks/test_copy_callbacks.c
A src/test/modules/test_copy_callbacks/test_copy_callbacks.control
M src/tools/pgindent/typedefs.list

Harden memory context allocators against bogus chunk pointers.

commit   : 0e87dfe46443286e630e9bcbc0c39a39c2c2cbb2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2022 18:45:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2022 18:45:34 -0400    

Click here for diff

Before commit c6e0fe1f2, functions such as AllocSetFree could pretty  
safely presume that they were given a valid chunk pointer for their  
own type of context, because the indirect call through a memory  
context object and method struct would be very unlikely to work  
otherwise.  But now, if pfree() is mistakenly invoked on a pointer  
to garbage, we have three chances in eight of ending up at one of  
these functions.  That means we need to take extra measures to  
verify that we are looking at what we're supposed to be looking at,  
especially in debug builds.  
  
Hence, add code to verify that the chunk's back-link to a block header  
leads to a memory context object that satisfies the right sort of  
IsA() check.  This is still a bit weaker than what we did before,  
but for the moment assume that an IsA() check is sufficient.  
  
As a compromise between speed and safety, implement these checks  
as Asserts when dealing with small chunks but plain test-and-elogs  
when dealing with large (external) chunks.  The latter case should  
not be too performance-critical, but the former case probably is.  
In slab.c, all chunks are small; but nonetheless use a plain test  
in SlabRealloc, because that is certainly not performance-critical,  
indeed we should be suspicious that it's being called in error.  
  
In aset.c, additionally add some assertions that the "value" field  
of the chunk header is within the small range allowed for freelist  
indexes.  Without that, we might find ourselves trying to wipe  
most of memory when CLOBBER_FREED_MEMORY is enabled, or scribbling  
on a "freelist header" that's far away from the context object.  
  
Eventually, field experience might show us that it's smarter for  
these tests to be active always, but for now we'll try to get  
away with just having them as assertions.  
  
While at it, also be more uniform about asserting that context  
objects passed as parameters are of the type we expect.  Some  
places missed that altogether, and slab.c was for no very good  
reason doing it differently from the other allocators.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/slab.c

Simplify our Assert infrastructure a little.

commit   : 235eb4db9879397acb57a5dfd25c18291052068a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2022 15:16:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2022 15:16:56 -0400    

Click here for diff

Remove the Trap and TrapMacro macros, which were nearly unused  
and confusingly had the opposite condition polarity from the  
otherwise-functionally-equivalent Assert macros.  
  
Having done that, it's very hard to justify carrying the errorType  
argument of ExceptionalCondition, so drop that too, and just  
let it assume everything's an Assert.  This saves about 64K  
of code space as of current HEAD.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_heapam.c
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/include/c.h
M src/include/postgres.h

Remove unnecessary semicolons after goto labels

commit   : 6291b2546ce729aa912fd070628c6b9eb1f84947    
  
author   : John Naylor <[email protected]>    
date     : Mon, 10 Oct 2022 15:08:38 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 10 Oct 2022 15:08:38 +0700    

Click here for diff

According to the C standard, a label must followed by a statement.  
If there was ever a time we needed an empty statement here, it was  
a long time ago.  
  
Japin Li  
  
Reviewed by Julien Rouhaud  
Discussion: https://www.postgresql.org/message-id/MEYP282MB16690F40189A4F060B41D56DB65E9%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/access/transam/slru.c
M src/backend/executor/nodeModifyTable.c

Use C library functions instead of Abs() for int64

commit   : 357cfefb09115292cfb98d504199e6df8201c957    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Oct 2022 08:51:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Oct 2022 08:51:07 +0200    

Click here for diff

Instead of Abs() for int64, use the C standard functions labs() or  
llabs() as appropriate.  Define a small wrapper around them that  
matches our definition of int64.  (labs() is C90, llabs() is C99.)  
  
Reviewed-by: Zhang Mingli <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/4beb42b5-216b-bce8-d452-d924d5794c63%40enterprisedb.com  

M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_int8.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/dbsize.c
M src/include/c.h

pgstat: Prevent stats reset from corrupting slotname by removing slotname

commit   : 06dbd619bfbfe03fefa7223838690d4012f874ad    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 8 Oct 2022 09:33:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 8 Oct 2022 09:33:23 -0700    

Click here for diff

Previously PgStat_StatReplSlotEntry contained the slotname, which was mainly  
used when writing out the stats during shutdown, to identify the slot in the  
serialized data (at runtime the index in ReplicationSlotCtl->replication_slots  
is used, but that can change during a restart). Unfortunately the slotname was  
overwritten when the slot's stats were reset.  
  
That turned out to only cause "real" problems if the slot was active during  
the reset, triggering an assertion failure at the next  
pgstat_report_replslot(). In other paths the stats were re-initialized during  
pgstat_acquire_replslot().  
  
Fix this by removing slotname from PgStat_StatReplSlotEntry. Instead we can  
get the slot's name from the slot itself. Besides fixing a bug, this also is  
architecturally cleaner (a name is not really statistics). This is safe  
because stats, for a slot removed while shut down, will not be restored at  
startup.  
  
In 15 the slotname is not removed, but renamed, to avoid changing the stats  
format. In master, bump PGSTAT_FILE_FORMAT_ID.  
  
This commit does not contain a test for the fix. I think this can only be  
tested by a tap test starting pg_recvlogical in the background and checking  
pg_recvlogical's output. That type of test is notoriously hard to be reliable,  
so committing it shortly before the release is wrapped seems like a bad idea.  
  
Reported-by: Jaime Casanova <[email protected]>  
Author: Andres Freund <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/YxfagaTXUNa9ggLb@ahch-to  
Backpatch: 15-, where the bug was introduced in 5891c7a8ed8f  

M src/backend/replication/slot.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_replslot.c
M src/include/pgstat.h
M src/include/replication/slot.h
M src/include/utils/pgstat_internal.h

Use fabsf() instead of Abs() or fabs() where appropriate

commit   : e4c61bedcb791fe79fdc4e96a3a7ab59b0dbacaf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 8 Oct 2022 13:41:18 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 8 Oct 2022 13:41:18 +0200    

Click here for diff

This function is new in C99.  
  
Reviewed-by: Zhang Mingli <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/4beb42b5-216b-bce8-d452-d924d5794c63%40enterprisedb.com  

M contrib/btree_gist/btree_float4.c
M contrib/intarray/_int_gist.c
M contrib/seg/seg.c
M src/backend/utils/adt/float.c

autoconf: Rely on ar supporting index creation

commit   : 2473cb9ff374dff99437138c144fab6d9f7dfd26    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 7 Oct 2022 11:53:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 7 Oct 2022 11:53:39 -0700    

Click here for diff

This way we don't need RANLIB anymore, making it a bit simpler for the meson  
build to generate Makefile.global for PGXS compatibility.  
  
FreeBSD, NetBSD, OpenBSD, the only platforms where we didn't use AROPT=crs,  
all have supported the 's' option for a long time.  
  
On macOS we ran ranlib after installing a static library. This was added a  
long time ago, in 58ad65ec2def. I cannot reproduce an issue in more recent  
macOS versions. This is removed now.  
  
Based on discussion with Tom, I left the 'touch' at the end of static  
libraries generation, added in 826eff57c4c, in place. While it looks like  
current versions of Apple's ar/ranlib don't need it, it was needed not too  
long ago.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/Makefile.global.in
M src/Makefile.shlib
M src/makefiles/Makefile.aix
M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.darwin
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.linux
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd
M src/makefiles/Makefile.solaris
M src/makefiles/Makefile.win32

Fix self-referencing foreign keys with partitioned tables

commit   : 614a406b4ff1b6f0f84b89fb56dca5175978177d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Oct 2022 19:37:48 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Oct 2022 19:37:48 +0200    

Click here for diff

There are a number of bugs in this area.  Two of them are fixed here,  
namely:  
1. get_relation_idx_constraint_oid does not restrict the type of  
   constraint that's returned, so with sufficient bad luck it can  
   return the OID of a foreign key constraint.  This has the effect that  
   a primary key in a partition can end up as a child of a foreign key,  
   which makes no sense (it needs to be the child of the equivalent  
   primary key.)  
   Change the API contract so that only index-backed constraints are  
   returned, mimicking get_constraint_index().  
  
2. Both CloneFkReferenced and CloneFkReferencing clone a  
   self-referencing foreign key, so the partition ends up with  
   a duplicate foreign key.  Change the former function to ignore such  
   constraints.  
  
Add some tests to verify that things are better now.  (However, these  
new tests show some additional misbehavior that will be fixed later --  
namely that there's a constraint marked NOT VALID.)  
  
Backpatch to 12, where these constraints are possible at all.  
  
Author: Jehan-Guillaume de Rorthais <[email protected]>  
Discussion: https://postgr.es/m/20220603154232.1715b14c@karst  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Convert macros to static inline functions (rel.h)

commit   : 3edc71ec043865c735cc7cd67df1c0e211fa97dd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Oct 2022 16:06:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Oct 2022 16:06:59 +0200    

Click here for diff

Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com  

M src/include/utils/rel.h

Remove unnecessary uses of Abs()

commit   : f14aad5169baa5e2ac25d49f1d18f9d5cb3bc7f2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Oct 2022 13:28:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Oct 2022 13:28:38 +0200    

Click here for diff

Use C standard abs() or fabs() instead.  
  
Reviewed-by: Zhang Mingli <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/4beb42b5-216b-bce8-d452-d924d5794c63%40enterprisedb.com  

M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.c
M contrib/cube/cube.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M contrib/seg/seg.c
M src/backend/access/gist/gistproc.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/misc/guc.c
M src/interfaces/ecpg/pgtypeslib/interval.c

Add -Wshadow=compatible-local to the standard compilation flags

commit   : 0fe954c28584169938e5c0738cfaa9930ce77577    
  
author   : David Rowley <[email protected]>    
date     : Fri, 7 Oct 2022 16:50:31 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 7 Oct 2022 16:50:31 +1300    

Click here for diff

Since cd4e8caaa, we've been able to build the source tree with  
-Wshadow=compatible-local without any warnings.  Lots of work was done by  
Justin Pryzby and I (David) to get all our code to compile warning free  
with that flag.  In that process, 2 bugs (16d69ec29 and af7d270dd) were  
discovered and fixed.  Additionally, "git log --grep=shadow" shows that  
there is no shortage of other bugs that have been fixed over the years  
which were caused by variable shadowing.  
  
In light of the above, it seems very much worthwhile to add at least  
-Wshadow=compatible-local to our standard compilation flags.  We *may*  
want to go further and take this to -Wshadow=local in the future, but  
we're not ready for that today, so let's add -Wshadow=compatible-local now  
to help make sure we don't introduce further local variable shadowing.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M meson.build

Improve our ability to detect bogus pointers passed to pfree et al.

commit   : 80ef92675823f14b0dd15a50b31372e27773a1f5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 21:23:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 21:23:52 -0400    

Click here for diff

Commit c6e0fe1f2 was a shade too trusting that any pointer passed  
to pfree, repalloc, etc will point at a valid chunk.  Notably,  
passing a pointer that was actually obtained from malloc tended  
to result in obscure assertion failures, if not worse.  (On FreeBSD  
I've seen such mistakes take down the entire cluster, seemingly as  
a result of clobbering shared memory.)  
  
To improve matters, extend the mcxt_methods[] array so that it  
has entries for every possible MemoryContextMethodID bit-pattern,  
with the currently unassigned ID codes pointing to error-reporting  
functions.  Then, fiddle with the ID assignments so that patterns  
likely to be associated with bad pointers aren't valid ID codes.  
In particular, we should avoid assigning bit patterns 000 (zeroed  
memory) and 111 (wipe_mem'd memory).  
  
It turns out that on glibc (Linux), malloc uses chunk headers that  
have flag bits in the same place we keep MemoryContextMethodID,  
and that the bit patterns 000, 001, 010 are the only ones we'll  
see as long as the backend isn't threaded.  So we can have very  
robust detection of pfree'ing a malloc-assigned block on that  
platform, at least so long as we can refrain from using up those  
ID codes.  On other platforms, we don't have such a good guarantee,  
but keeping 000 reserved will be enough to catch many such cases.  
  
While here, make GetMemoryChunkMethodID() local to mcxt.c, as there  
seems no need for it to be exposed even in memutils_internal.h.  
  
Patch by me, with suggestions from Andres Freund and David Rowley.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils_internal.h

meson: Add support for building with precompiled headers

commit   : e5555657ba860f2ac25fb7ef9c921a32c6e70c75    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Oct 2022 17:19:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Oct 2022 17:19:30 -0700    

Click here for diff

This substantially speeds up building for windows, due to the vast amount of  
headers included via windows.h. A cross build from linux targetting mingw goes  
from  
  
994.11user 136.43system 0:31.58elapsed 3579%CPU  
to  
422.41user 89.05system 0:14.35elapsed 3562%CPU  
  
The wins on windows are similar-ish (but I don't have a system at hand just  
now for actual numbers). Targetting other operating systems the wins are far  
smaller (tested linux, macOS, FreeBSD).  
  
For now precompiled headers are disabled by default, it's not clear how well  
they work on all platforms. E.g. on FreeBSD gcc doesn't seem to have working  
support, but clang does.  
  
When doing a full build precompiled headers are only beneficial for targets  
with multiple .c files, as meson builds a separate precompiled header for each  
target (so that different compilation options take effect). This commit  
therefore only changes target with at least two .c files to use precompiled  
headers.  
  
Because this commit adds b_pch=false to the default_options new build  
directories will have precompiled headers disabled by default, however  
existing build directories will continue use the default value of b_pch, which  
is true.  
  
Note that using precompiled headers with ccache requires setting  
CCACHE_SLOPPINESS=pch_defines,time_macros to get hits.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKG+50eOUbN++ocDc0Qnp9Pvmou23DSXu=ZA6fepOcftKqA@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/20190826054000.GE7005%40paquier.xyz  

M .cirrus.yml
M contrib/bloom/meson.build
M contrib/btree_gist/meson.build
M contrib/hstore/meson.build
M contrib/pg_trgm/meson.build
M contrib/pgcrypto/meson.build
M contrib/pgstattuple/meson.build
M contrib/sepgsql/meson.build
M contrib/xml2/meson.build
M meson.build
M src/backend/meson.build
M src/backend/snowball/meson.build
M src/bin/pg_dump/meson.build
M src/bin/pg_upgrade/meson.build
M src/bin/pgbench/meson.build
M src/bin/psql/meson.build
M src/common/meson.build
M src/fe_utils/meson.build
M src/include/meson.build
A src/include/pch/c_pch.h
A src/include/pch/meson.build
A src/include/pch/postgres_fe_pch.h
A src/include/pch/postgres_pch.h
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/ecpg/preproc/meson.build
M src/interfaces/libpq/meson.build
M src/pl/plperl/meson.build
M src/pl/plpgsql/src/meson.build
M src/pl/plpython/meson.build
M src/pl/tcl/meson.build
M src/port/meson.build

Create subscription stats entry at CREATE SUBSCRIPTION time

commit   : e0b0142959066f3a9de1c6867f4ec8d41d104f33    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Oct 2022 16:45:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Oct 2022 16:45:20 -0700    

Click here for diff

Previously, the subscription stats entry was created when the first  
stats, i.e., an error on apply worker or tablesync worker,  were  
reported. Therefore, the stats_reset field was not updated by  
pg_stat_reset_subscription_stats() if the stats entry was not  
populated yet, which was different behavior than other statistics.  
  
This change creates the subscription stats entry and initializes it at  
CREATE SUBSCRIPTION time.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Author: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_Zqd-e5imT_3-ZiQv1cfsWuy16OJTiUaCvqpq4V7GVdSg@mail.gmail.com  

M src/backend/utils/activity/pgstat_subscription.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Fix final warnings produced by -Wshadow=compatible-local

commit   : cd4e8caaa0eb5c3d3b12a45b29035e7a4bdfa4a8    
  
author   : David Rowley <[email protected]>    
date     : Fri, 7 Oct 2022 13:13:27 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 7 Oct 2022 13:13:27 +1300    

Click here for diff

I thought I had these in d8df67bb1, but per report from Andres Freund, I  
missed some.  
  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blinsert.c
M contrib/file_fdw/file_fdw.c
M contrib/hstore/hstore.h
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_spi.c
M src/test/modules/test_integerset/test_integerset.c

windows: Adjust FD_SETSIZE via commandline define

commit   : 4289263cf263ba36e474728f4a02ceb086903f81    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Oct 2022 13:03:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Oct 2022 13:03:31 -0700    

Click here for diff

When using precompiled headers, we cannot pre-define macros for the system  
headers from within .c files, as headers are already processed before  
the #define in the C file is reached. But we can pre-define using  
-DFD_SETSIZE, as long as that's also used when building the precompiled header.  
  
A few files #define FD_SETSIZE 1024 on windows, as the default is only 64. I  
am hesitant to change FD_SETSIZE globally on windows, due to  
src/backend/port/win32/socket.c using it to size on-stack arrays. Instead add  
-DFD_SETSIZE=1024 when building the specific targets needing it.  
  
We likely should move away from using select() in those places, but that's a  
larger change.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CA+hUKG+50eOUbN++ocDc0Qnp9Pvmou23DSXu=ZA6fepOcftKqA@mail.gmail.com  
Discussion: https://postgr.es/m/20190826054000.GE7005%40paquier.xyz  

M src/bin/pgbench/Makefile
M src/bin/pgbench/meson.build
M src/bin/pgbench/pgbench.c
M src/fe_utils/Makefile
M src/fe_utils/meson.build
M src/fe_utils/parallel_slot.c
M src/tools/msvc/Mkvcbuild.pm

meson: Fix two comments

commit   : 0fa41648d77f04d5ad3ed69ff3e3903bd1abf121    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Oct 2022 12:22:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Oct 2022 12:22:36 -0700    

Click here for diff

Author: Junwang Zhao <[email protected]>  
Discussion: https://postgr.es/m/CAEG8a3KxObc9g8NTzx1kX0Auf=J7FNiubYZXSK6G5wv5ShmP6A@mail.gmail.com  

M src/backend/meson.build

Remove MemoryContextContains().

commit   : 9543eff5e015b6f6f832da2d95d659629a2022f3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 13:35:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 13:35:31 -0400    

Click here for diff

MemoryContextContains is no longer reliable in the wake of c6e0fe1f2,  
because there's no longer very much redundancy in chunk headers.  
(It wasn't *completely* reliable even before that, as there was a  
chance of a false positive if you passed it something that didn't  
point to an mcxt chunk at all.  But it was generally good enough.)  
  
Hence, remove it.  There is no remaining core code that requires it.  
Extensions that have been using it might be able to substitute a  
test like "GetMemoryChunkContext(ptr) == context", recognizing that  
this explicitly requires that the pointer point to some chunk.  
  
Tom Lane and David Rowley  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils.h

Remove uses of MemoryContextContains in nodeAgg.c and nodeWindowAgg.c.

commit   : 42b746d4c982257bf3f924176632b04dc288174b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 13:27:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 13:27:34 -0400    

Click here for diff

MemoryContextContains is no longer reliable in the wake of c6e0fe1f2,  
so we need to get rid of these uses.  
  
It appears that there's no really good reason to force the result of  
an aggregate's finalfn or serialfn to be allocated in the per-tuple  
context.  The only other plausible case is that the result points to  
or into the aggregate's transition value, and that's fine because it  
will last as long as we need it to.  (This conclusion depends on the  
assumption that finalfns are not allowed to scribble on the transition  
value, but we've long required that.)  So we can just drop the  
MemoryContextContains plus datumCopy business, although we do need  
to take care to not return a read-write pointer when the transition  
value is an expanded datum.  
  
Likewise, we don't really need to force the result of a window  
function to be in the output context.  In this case, the plausible  
alternative is that it's pointing into the temporary tuple slot used  
by WinGetFuncArgInPartition or WinGetFuncArgInFrame (since those  
functions could return such a pointer, which might become the window  
function's result).  That will hold still for long enough, unless  
there is another window function using the same WindowObject.  
I'm content to always perform a datumCopy when there's more than one  
such function.  
  
On net, these changes should provide small speed improvements as well  
as removing problematic code.  
  
Tom Lane and David Rowley  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Take care to de-duplicate entries in standby.c's table of locks.

commit   : 66c2922e76baef07e05763759d2912c0701a5593    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 12:27:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 12:27:36 -0400    

Click here for diff

The RecoveryLockLists data structure, which tracks all exclusive  
locks that the startup process is holding on behalf of transactions  
being replayed, did not have any provision for avoiding duplicate  
entries for the same lock.  Maybe that was okay when the code was  
first written.  However, modern practice is for checkpoints to  
write fresh lists of all active exclusive locks into the WAL.  
Thus, an exclusive lock that survives across multiple checkpoints  
causes bloat in standbys' startup processes.  If there are a lot  
of such locks this can look like a memory leak, and it's even  
possible to drive the startup process into a palloc failure from  
an over-length List.  
  
To fix, use a hash table instead of simple lists to track the  
locks being held.  Allowing for dynahash overhead, this requires  
a little more space per lock than the old way (although it's the  
same size as what we were allocating prior to c6e0fe1f2).  It's  
probably a shade slower too.  However, testing indicates that the  
penalty is negligible on ordinary workloads, so let's make this  
change to improve robustness in extreme cases.  
  
Patch by me, per report from Dmitriy Kuzmin.  No back-patch  
(for now anyway), since it seems that a significant improvement  
would only occur in corner cases.  
  
Discussion: https://postgr.es/m/CAHLDt=_ts0A7Agn=hCpUh+RCFkxd+G6uuT=kcTfqFtGur0dp=A@mail.gmail.com  

M src/backend/storage/ipc/standby.c

Remove useless character-length checks in contrib/ltree.

commit   : 58640f37d9acf632a4dd60d140f36f2e6815f716    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 11:18:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 11:18:32 -0400    

Click here for diff

The t_iseq() macro does not need to be guarded by a character  
length check (at least when the comparison value is an ASCII  
character, as its documentation requires).  Some portions of  
contrib/ltree hadn't read that memo, so simplify them.  
  
The last change in gettoken_query,  
  
-                else if (charlen == 1 && !t_iseq(state->buf, ' '))  
+                else if (!t_iseq(state->buf, ' '))  
  
looks like it's actually a bug fix: I doubt that the intention  
was to silently ignore multibyte characters as if they were  
whitespace.  I'm not tempted to back-patch though, because this  
will have the effect of tightening what is allowed in ltxtquery  
strings.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltxtquery_io.c

Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests.

commit   : ca71131eebba63809ceb86be033a264a5f0a1d79    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 11:08:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Oct 2022 11:08:56 -0400    

Click here for diff

ts_locale.c omitted support for "isalnum" tests, perhaps on the  
grounds that there were initially no use-cases for that.  However,  
both ltree and pg_trgm need such tests, and we do also have one  
use-case now in the core backend.  The workaround of testing  
isalpha and isdigit separately seems quite inefficient, especially  
when dealing with multibyte characters; so let's fill in the  
missing support.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/ltree/ltree.h
M contrib/pg_trgm/trgm.h
M src/backend/tsearch/ts_locale.c
M src/backend/utils/adt/tsquery.c
M src/include/tsearch/ts_locale.h

Fix comment in xlogprefetcher.c

commit   : 5757141caeaff4af0c206ab672d542cbd608542c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Oct 2022 20:25:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Oct 2022 20:25:02 +0900    

Click here for diff

Author: Sho Kato  
Discussion: https://postgr.es/m/TYCPR01MB684954052EC534A3261B29249F5C9@TYCPR01MB6849.jpnprd01.prod.outlook.com  

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

Refactor TAP test authentication/001_password.pl

commit   : 051b096b8dd3b65f8e4528a8cd24a8702646e8b2    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Oct 2022 09:40:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Oct 2022 09:40:16 +0900    

Click here for diff

The test is changed to test for connection strings rather than specific  
roles, and the reset logic of pg_hba.conf is extended so as the database  
and user name entries can be directly specified.  This is aimed at being  
used as a base for more test scenarios of pg_hba.conf and authentication  
paths.  
  
Author: Bertrand Drouvot, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/test/authentication/t/001_password.pl

Fix final compiler warning produced by -Wshadow=compatible-local

commit   : d8df67bb1ad9cb80963f3592be281656857a5efc    
  
author   : David Rowley <[email protected]>    
date     : Thu, 6 Oct 2022 10:19:36 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 6 Oct 2022 10:19:36 +1300    

Click here for diff

We're now able to compile the entire tree with -Wshadow=compatible-local  
without any compiler warnings.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvqWGMdB_pATeUqE=JCtNqNxObPOJ00jFEa2_sZ20j_Wvg@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Add optional parameter to PG_TRY() macros

commit   : 112f0225dbfe8af217294bfa0bd227f3302a1658    
  
author   : David Rowley <[email protected]>    
date     : Thu, 6 Oct 2022 10:08:31 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 6 Oct 2022 10:08:31 +1300    

Click here for diff

This optional parameter can be specified in cases where there are nested  
PG_TRY() statements within a function in order to stop the compiler from  
issuing warnings about shadowed local variables when compiling with  
-Wshadow.  The optional parameter is used as a suffix on the variable  
names declared within the PG_TRY(), PG_CATCH(), PG_FINALLY() and  
PG_END_TRY() macros.  The parameter, if specified, must be the same in  
each component macro of the given PG_TRY() block.  
  
This also adjusts the single case where we have nested PG_TRY() statements  
to add a parameter to the inner-most PG_TRY().  
  
This reduces the number of compiler warnings when compiling with  
-Wshadow=compatible-local from 5 down to 1.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvqWGMdB_pATeUqE=JCtNqNxObPOJ00jFEa2_sZ20j_Wvg@mail.gmail.com  

M src/backend/tcop/utility.c
M src/include/utils/elog.h

doc: clarify description for log_startup_progress_interval

commit   : 23f3989d929e9301a29ee3a25ecf8040d8de20c2    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 5 Oct 2022 15:53:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 5 Oct 2022 15:53:40 -0400    

Click here for diff

Reported-by: Elena Indrupskaya  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Elena Indrupskaya  
  
Backpatch-through: 15  

M doc/src/sgml/config.sgml

tests: Restrict pg_locks queries in advisory_locks.sql to current database

commit   : c3315a7da57be720222b119385ed0f7ad7c15268    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 10:44:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 10:44:38 -0700    

Click here for diff

Otherwise testing an existing installation can fail, if there are other locks,  
e.g. from one of the isolation tests.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

tests: Rename conflicting role names

commit   : 6a20b04f0408fb61da610543d4608a08f86d1aeb    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 10:43:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 10:43:13 -0700    

Click here for diff

These cause problems when running installcheck-world USE_MODULE_DB=1 with -j.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/adminpack/expected/adminpack.out
M contrib/adminpack/sql/adminpack.sql
M contrib/passwordcheck/expected/passwordcheck.out
M contrib/passwordcheck/sql/passwordcheck.sql
M src/pl/plperl/expected/plperl_setup.out
M src/pl/plperl/sql/plperl_setup.sql

meson: Add windows resource files

commit   : 902ab2fcef33b1e7c290af8d280e67d9f9212bcf    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 09:56:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 09:56:05 -0700    

Click here for diff

The generated resource files aren't exactly the same ones as the old  
buildsystems generate. Previously "InternalName" and "OriginalFileName" were  
mostly wrong / not set (despite being required), but that was hard to fix in  
at least the make build. Additionally, the meson build falls back to a  
"auto-generated" description when not set, and doesn't set it in a few cases -  
unlikely that anybody looks at these descriptions in detail.  
  
Author: Andres Freund <[email protected]>  
Author: Nazir Bilal Yavuz <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  

M contrib/adminpack/meson.build
M contrib/amcheck/meson.build
M contrib/auth_delay/meson.build
M contrib/auto_explain/meson.build
M contrib/basebackup_to_shell/meson.build
M contrib/basic_archive/meson.build
M contrib/bloom/meson.build
M contrib/bool_plperl/meson.build
M contrib/btree_gin/meson.build
M contrib/btree_gist/meson.build
M contrib/citext/meson.build
M contrib/cube/meson.build
M contrib/dblink/meson.build
M contrib/dict_int/meson.build
M contrib/dict_xsyn/meson.build
M contrib/earthdistance/meson.build
M contrib/file_fdw/meson.build
M contrib/fuzzystrmatch/meson.build
M contrib/hstore/meson.build
M contrib/hstore_plperl/meson.build
M contrib/hstore_plpython/meson.build
M contrib/intarray/meson.build
M contrib/isn/meson.build
M contrib/jsonb_plperl/meson.build
M contrib/jsonb_plpython/meson.build
M contrib/lo/meson.build
M contrib/ltree/meson.build
M contrib/ltree_plpython/meson.build
M contrib/oid2name/meson.build
M contrib/old_snapshot/meson.build
M contrib/pageinspect/meson.build
M contrib/passwordcheck/meson.build
M contrib/pg_buffercache/meson.build
M contrib/pg_freespacemap/meson.build
M contrib/pg_prewarm/meson.build
M contrib/pg_stat_statements/meson.build
M contrib/pg_surgery/meson.build
M contrib/pg_trgm/meson.build
M contrib/pg_visibility/meson.build
M contrib/pg_walinspect/meson.build
M contrib/pgcrypto/meson.build
M contrib/pgrowlocks/meson.build
M contrib/pgstattuple/meson.build
M contrib/postgres_fdw/meson.build
M contrib/seg/meson.build
M contrib/sepgsql/meson.build
M contrib/spi/meson.build
M contrib/sslinfo/meson.build
M contrib/tablefunc/meson.build
M contrib/tcn/meson.build
M contrib/test_decoding/meson.build
M contrib/tsm_system_rows/meson.build
M contrib/tsm_system_time/meson.build
M contrib/unaccent/meson.build
M contrib/uuid-ossp/meson.build
M contrib/vacuumlo/meson.build
M contrib/xml2/meson.build
M meson.build
M src/backend/jit/llvm/meson.build
M src/backend/replication/libpqwalreceiver/meson.build
M src/backend/replication/pgoutput/meson.build
M src/backend/snowball/meson.build
M src/backend/utils/mb/conversion_procs/meson.build
M src/bin/initdb/meson.build
M src/bin/pg_amcheck/meson.build
M src/bin/pg_archivecleanup/meson.build
M src/bin/pg_basebackup/meson.build
M src/bin/pg_checksums/meson.build
M src/bin/pg_config/meson.build
M src/bin/pg_controldata/meson.build
M src/bin/pg_ctl/meson.build
M src/bin/pg_dump/meson.build
M src/bin/pg_resetwal/meson.build
M src/bin/pg_rewind/meson.build
M src/bin/pg_test_fsync/meson.build
M src/bin/pg_test_timing/meson.build
M src/bin/pg_upgrade/meson.build
M src/bin/pg_verifybackup/meson.build
M src/bin/pg_waldump/meson.build
M src/bin/pgbench/meson.build
M src/bin/pgevent/meson.build
M src/bin/psql/meson.build
M src/bin/scripts/meson.build
M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/ecpg/preproc/meson.build
M src/interfaces/ecpg/test/meson.build
M src/interfaces/libpq/meson.build
M src/interfaces/libpq/test/meson.build
M src/pl/plperl/meson.build
M src/pl/plpgsql/src/meson.build
M src/pl/plpython/meson.build
M src/pl/tcl/meson.build
M src/test/isolation/meson.build
M src/test/modules/delay_execution/meson.build
M src/test/modules/dummy_index_am/meson.build
M src/test/modules/dummy_seclabel/meson.build
M src/test/modules/libpq_pipeline/meson.build
M src/test/modules/plsample/meson.build
M src/test/modules/spgist_name_ops/meson.build
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/modules/test_bloomfilter/meson.build
M src/test/modules/test_ddl_deparse/meson.build
M src/test/modules/test_ginpostinglist/meson.build
M src/test/modules/test_integerset/meson.build
M src/test/modules/test_lfind/meson.build
M src/test/modules/test_oat_hooks/meson.build
M src/test/modules/test_parser/meson.build
M src/test/modules/test_predtest/meson.build
M src/test/modules/test_rbtree/meson.build
M src/test/modules/test_regex/meson.build
M src/test/modules/test_rls_hooks/meson.build
M src/test/modules/test_shm_mq/meson.build
M src/test/modules/worker_spi/meson.build
M src/test/regress/meson.build
M src/timezone/meson.build
A src/tools/rcgen

meson: ecpg: Split definition of static and shared libraries

commit   : a1261cd16f07f6db12a54b94d9e36175198951b4    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 09:56:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 09:56:05 -0700    

Click here for diff

Required for correct resource file generation, as the resource files should  
only be added to the shared library.  
  
This also fixes a bunch of issues in the .pc files.  
  
Previously I tried to avoid building sources twice, once for the static and  
once for the shared libraries. We could still do so, but it's not clear that  
it's worth the complication.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/ecpg/test/meson.build

meson: libpq: Revise static / shared library setup

commit   : 089c0bc7a760ea8f654a054dc8363e7f0baf79a2    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 09:56:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 09:56:05 -0700    

Click here for diff

Improvements:  
- we don't need -DFRONTEND for libpq anymore since 1d77afefbd1  
- the .pc file contents for a static libpq were wrong (referencing  
  {pgport, common}_shlib)  
- incidentally fixes meson not supporting link_whole on AIX yet  
- added explanatory comments  
  
Previously I tried to avoid building libpq's sources twice, once for the  
static and once for the shared library. We could still do so, but it's not  
clear that it's worth the complication.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  

M meson.build
M src/interfaces/libpq/meson.build

meson: docs: Add xml{lint,proc} wrapper to collect dependencies

commit   : 29668e31865aa0442cd181ec7ee514295ef3578b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 09:56:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 5 Oct 2022 09:56:05 -0700    

Click here for diff

meson/ninja do not support specifying dependencies via globs (as those make it  
significantly more expensive to check the current build state). Instead  
targets should emit dependency information when running that then can be  
cheaply re-checked during future builds.  
  
To handle xmllint and xsltproc invocations in the docs, add and use a wrapper  
that uses --load-trace to collect dependency information.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Author: Nazir Bilal Yavuz <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/meson.build
A doc/src/sgml/xmltools_dep_wrapper

Fix whitespace

commit   : db0e5bf2b2da17c7e1c0beec04011d53388458bc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Oct 2022 15:06:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Oct 2022 15:06:43 +0200    

Click here for diff

M contrib/amcheck/meson.build

Rename shadowed local variables

commit   : 2d0bbedda7c4fbf7092c39b0c06b56cb238e15d7    
  
author   : David Rowley <[email protected]>    
date     : Wed, 5 Oct 2022 21:01:41 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 5 Oct 2022 21:01:41 +1300    

Click here for diff

In a similar effort to f01592f91, here we mostly rename shadowed local  
variables to remove the warnings produced when compiling with  
-Wshadow=compatible-local.  
  
This fixes 63 warnings and leaves just 5.  
  
Author: Justin Pryzby, David Rowley  
Reviewed-by: Justin Pryzby  
Discussion https://postgr.es/m/20220817145434.GC26426%40telsasoft.com  

M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/gin/ginget.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/clog.c
M src/backend/backup/basebackup.c
M src/backend/catalog/heap.c
M src/backend/catalog/namespace.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/spi.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/parser/parse_clause.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walreceiver.c
M src/backend/statistics/dependencies.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/command.c
M src/include/lib/simplehash.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/pl/plpgsql/src/pl_funcs.c

Remove definition of JUMBLE_SIZE from queryjumble.h

commit   : 839c2520a7937b8895ff84fc8fc718dbfab5e72e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Oct 2022 14:27:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Oct 2022 14:27:50 +0900    

Click here for diff

The same exists in queryjumble.c, and it is used only locally in this  
file so let's remove the definition in the header.  
  
Author: Tatsu Nakamori  
Reviewed-by: Tom Lane, Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M src/include/utils/queryjumble.h

Use macros from xlog_internal.h for WAL segment logic in pg_resetwal

commit   : 9a30e154b35e5bab9df7964785bca707ef74aec8    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Oct 2022 14:10:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Oct 2022 14:10:13 +0900    

Click here for diff

When scanning for the end of WAL, pg_resetwal has been maintaining its  
own internal logic to calculate segment numbers and to parse a WAL  
segment name for its timeline and segment number.  The code claimed for  
example that XLogFromFileName() cannot be used because it lacks the  
possibility of specifying a WAL segment size, which is not the case  
since fc49e24, that has made the WAL segment size configurable at  
initialization time, extending this routine to do so.  
  
Similarly, this switches one segment number calculation to use  
XLByteToSeg() rather than the same logic present in xlog_internal.h.  
While on it, switch to TimeLineID in pg_resetwal.c for TLI numbers  
parsed from segment names, to be more consistent with  
XLogFromFileName().  The maths are exactly the same, but the code gets  
simplified.  
  
Author: Bharath Rupireddy  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CALj2ACX+E_jnwqH_jmjhNG8BczJTNRTOLpw8K1CB1OcB48MJ8w@mail.gmail.com  

M src/bin/pg_resetwal/pg_resetwal.c

Add a few new patterns to the tab completion of psql

commit   : 9aa58d48f30a0cadfc0f40aad22be91ae7f8c4a8    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Oct 2022 11:46:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Oct 2022 11:46:10 +0900    

Click here for diff

This improves the tab completion of psql on a few points:  
- Provide a list of subscriptions on \dRs.  
- Provide a list of publications on \dRp.  
- Add CURRENT_ROLE, CURRENT_USER, SESSION_USER when OWNER TO is provided  
at the end of a query (as defined by RoleSpec in gram.y).  
  
Author: Vignesh C  
Reviewed-by: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/CALDaNm3toRBt6c6saY3174f7CsGztXRvVvfWbikkJEXY7x5WAA@mail.gmail.com  

M src/bin/psql/tab-complete.c

Fix comment in guc_tables.c

commit   : bdf9b60085bca2dbb0af920d50f1a0917dda0cbb    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Oct 2022 15:39:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Oct 2022 15:39:41 +0900    

Click here for diff

s/ERROR_HANDLING/ERROR_HANDLING_OPTIONS/.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PtDj3CV+f0pVisc0XYMi2LHGBpQxQWtF0FjiSVN_nV17Q@mail.gmail.com  

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

Cleanup useless assignments and checks

commit   : c42cd05c586235fa9e84fb4a3682286cf551df0e    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Oct 2022 13:16:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Oct 2022 13:16:23 +0900    

Click here for diff

This cleans up a couple of areas:  
- Remove XLogSegNo calculation for the last WAL segment in backup in  
xlog.c (7d70809 has moved this logic entirely to xlogbackup.c when  
building the contents of the backup history file).  
- Remove check on log_min_duration in analyze.c, as it is already true  
where this code path is reached.  
- Simplify call to find_option() in guc.c.  
  
Author: Ranier Vilela  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAEudQArCDQQiPiFR16=yu9k5s2tp4tgEe1U1ZbkW4ofx81AWWQ@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/commands/analyze.c
M src/backend/utils/misc/guc.c

Add filtering capability for cross-version pg_upgrade tests

commit   : 62be9e4cdc1d59dd6c9c268c7419d7d4f1016124    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Oct 2022 10:11:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Oct 2022 10:11:08 +0900    

Click here for diff

This commit expands the TAP tests of pg_upgrade when running these with  
different major versions for the "old" cluster (to-be-upgraded) and the  
"new" cluster (upgraded-to), by backporting some of the buildfarm  
facilities directory into the script:  
- Remove comments from the dump files, avoiding version-dependent  
information.  
- Remove empty lines from the dump files.  
- Use --extra-float-digits=0 in the pg_dump command, when using an "old"  
cluster with version equal to or lower than v11.  
- Use --wal-segsize and --allow-group-access in initdb only when the  
"old" cluster is equal to or higher than v11.  
  
This allows the tests to pass down to v14 with the main regression test  
suite, while v9.5~13 still generate some diffs, but these are minimal  
compared to what happened before this commit.  Much more could be done,  
especially around dump differences with function and procedures (these  
can also be avoided with direct manipulation of the dumps loaded, for  
example, in a way similar to the buildfarm), but at least the basics are  
in place now.  
  
Reviewed-by: Justin Pryzby, Anton A. Melnikov  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

meson: llvm: Use llvm-config's --cxxflags when building llvmjit

commit   : 908e17151b4834bd4bbfb703e206b68f5db341f9    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 3 Oct 2022 14:52:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 3 Oct 2022 14:52:51 -0700    

Click here for diff

Otherwise we don't use LLVM's flags when building llvmjit_wrap.cpp and  
llvmjit_inline.cpp. That can cause compile time failures if the C++ compiler  
doesn't default to a new enough C++ standards version and link time failures  
due to ABI influencing flags like -fno-rtti.  

M src/backend/jit/llvm/meson.build

Fix psql's behavior with \g for a multiple-command string.

commit   : 4a79fd1a754edcc85f9b94f17a2fb4576becf0a3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 15:07:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 15:07:10 -0400    

Click here for diff

The pre-v15 behavior was to discard all but the last result,  
but with the new behavior of printing all results by default,  
we will send each such result to the \g file.  However,  
we're still opening and closing the \g file for each result,  
so you lose all but the last result anyway.  Move the output-file  
state up to ExecQueryAndProcessResults so that we open/close the  
\g file only once per command string.  
  
To support this without changing other behavior, we must  
adjust PrintQueryResult to have separate FILE * arguments  
for query and status output (since status output has never  
gone to the \g file).  That in turn makes it a good idea  
to push the responsibility for fflush'ing output down to  
PrintQueryTuples and PrintQueryStatus.  
  
Also fix an infinite loop if COPY IN/OUT is attempted in \watch.  
We used to reject that, but that error exit path got broken  
somewhere along the line in v15.  There seems no real reason  
to reject it anyway as the code now stands, so just remove  
the error exit and make sure that COPY OUT data goes to the  
right place.  
  
Also remove PrintQueryResult's unused is_watch parameter,  
and make some other cosmetic cleanups (adjust obsolete  
comments, break some overly-long lines).  
  
Daniel Vérité and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/common.c

meson: respect -Dldap=disabled

commit   : 0ae5db28d06939d1a2ac52813629be0dfc77010e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 3 Oct 2022 10:13:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 3 Oct 2022 10:13:12 -0700    

Click here for diff

I noticed during some manual testing that -Dldap=disabled (or  
--auto-features=disabled) doesn't disable ldap if available - that's obviously  
wrong.  

M meson.build

Revert "Optimize order of GROUP BY keys".

commit   : f4c7c410ee4a7baa06f51ebb8d5333c169691dd3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 10:56:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 10:56:16 -0400    

Click here for diff

This reverts commit db0d67db2401eb6238ccc04c6407a4fd4f985832 and  
several follow-on fixes.  The idea of making a cost-based choice  
of the order of the sorting columns is not fundamentally unsound,  
but it requires cost information and data statistics that we don't  
really have.  For example, relying on procost to distinguish the  
relative costs of different sort comparators is pretty pointless  
so long as most such comparator functions are labeled with cost 1.0.  
Moreover, estimating the number of comparisons done by Quicksort  
requires more than just an estimate of the number of distinct values  
in the input: you also need some idea of the sizes of the larger  
groups, if you want an estimate that's good to better than a factor of  
three or so.  That's data that's often unknown or not very reliable.  
Worse, to arrive at estimates of the number of calls made to the  
lower-order-column comparison functions, the code needs to make  
estimates of the numbers of distinct values of multiple columns,  
which are necessarily even less trustworthy than per-column stats.  
Even if all the inputs are perfectly reliable, the cost algorithm  
as-implemented cannot offer useful information about how to order  
sorting columns beyond the point at which the average group size  
is estimated to drop to 1.  
  
Close inspection of the code added by db0d67db2 shows that there  
are also multiple small bugs.  These could have been fixed, but  
there's not much point if we don't trust the estimates to be  
accurate in-principle.  
  
Finally, the changes in cost_sort's behavior made for very large  
changes (often a factor of 2 or so) in the cost estimates for all  
sorting operations, not only those for multi-column GROUP BY.  
That naturally changes plan choices in many situations, and there's  
precious little evidence to show that the changes are for the better.  
Given the above doubts about whether the new estimates are really  
trustworthy, it's hard to summon much confidence that these changes  
are better on the average.  
  
Since we're hard up against the release deadline for v15, let's  
revert these changes for now.  We can always try again later.  
  
Note: in v15, I left T_PathKeyInfo in place in nodes.h even though  
it's unreferenced.  Removing it would be an ABI break, and it seems  
a bit late in the release cycle for that.  
  
Discussion: https://postgr.es/m/TYAPR01MB586665EB5FB2C3807E893941F5579@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/pathnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/join.out
M src/test/regress/expected/merge.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/sysviews.out
M src/test/regress/expected/union.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/incremental_sort.sql

Add authentication TAP test for peer authentication

commit   : f60eb3f2827db292edf71bb7296fbdf5958ace3d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Oct 2022 16:42:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Oct 2022 16:42:25 +0900    

Click here for diff

This commit introduces an authentication test for the peer method, as of  
a set of scenarios with and without a user name map.  The script is  
automatically skipped if peer is not supported in the environment where  
this test is run, checking this behavior by attempting a connection  
first on a cluster up and running.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/test/authentication/meson.build
A src/test/authentication/t/003_peer.pl

ci: enable various runtime checks on FreeBSD and macOS

commit   : 89d16b63527d078ae611b0af1241258ffa1f460b    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 17:04:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 17:04:13 -0700    

Click here for diff

Increase likelihood of discovering problems during CI rather the buildfarm by  
defining -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES  
-DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST on FreeBSD, and  
-DRANDOMIZE_ALLOCATED_MEMORY on macOS.  
  
FreeBSD and macoS are currently not CI bottlenecks, so we can afford to  
increase their test times a bit.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

ci: macos: Reduce test concurrency

commit   : 2d2f08310490d63c4cc097243ba63a1601316c17    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 16:55:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 16:55:16 -0700    

Click here for diff

Test performance regresses noticably when using all cores. This is more  
pronounced with meson than with autoconf, presumably because meson will  
schedule the "full number" of tests more consistently.  8 seems to work  
OK.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI was introduced  

M .cirrus.yml

meson: Add prefix=/usr/local/pgsql to default_options

commit   : 1360943d1ac03240fc719a459aed4ad4f9f9b5d4    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 12:39:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 12:39:12 -0700    

Click here for diff

autoconf set PREFIX to /usr/local/pgsql, so using the same default for meson  
makes sense. The effect on windows is that installation defaults to installing  
to C:/usr/local/pgsql rather than meson's default of C:/, which doesn't seem  
perfect, but OK enough.  
  
Signed-off-by: Junwang Zhao <[email protected]>  
Author: Junwang Zhao <[email protected]>  
Discussion: https://postgr.es/CAEG8a3LGWE-gG6vuddmH91RORhi8gWs0mMB-hcTmP3_NVgM7dg@mail.gmail.com  

M meson.build

meson: windows: Determine path to tmp_install + prefix using meson

commit   : d0366bfb3b211b26a997a4220757392a0c153d8d    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 12:39:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 12:39:12 -0700    

Click here for diff

Previously some paths (like c:\ or d:/) worked, but plenty others (like  
/path/to or //computer/share/path) didn't. As we'd like to change the default  
prefix to /usr/local/pgsql, that's a problem.  
  
Instead of trying to do this in meson.build, call out to the implementation  
meson install uses. This isn't pretty, but it's more reliable than what we had  
before.  
  
Discussion: https://postgr.es/CAEG8a3LGWE-gG6vuddmH91RORhi8gWs0mMB-hcTmP3_NVgM7dg@mail.gmail.com  

M meson.build

Fix tiny memory leaks

commit   : a9d58bfe8a3ae2254e1553ab76974feeaafa0133    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 1 Oct 2022 12:48:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 1 Oct 2022 12:48:24 +0200    

Click here for diff

Both check_application_name() and check_cluster_name() use  
pg_clean_ascii() but didn't release the memory.  Depending on when the  
GUC is set, this might be cleaned up at some later time or it would  
leak postmaster memory once.  In any case, it seems better not to have  
to rely on such analysis and make the code locally robust.  Also, this  
makes Valgrind happier.  
  
Author: Masahiko Sawada <[email protected]>  
Reviewed-by: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAD21AoBmFNy9MPfA0UUbMubQqH3AaK5U3mrv6pSeWrwCk3LJ8g@mail.gmail.com  

M src/backend/commands/variable.c

doc: Fix some grammar and typos

commit   : 83e42a0035718914efad2fe04080fd6c579e9ef2    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 1 Oct 2022 15:28:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 1 Oct 2022 15:28:02 +0900    

Click here for diff

This fixes some areas related to logical replication and custom RMGRs.  
  
Author: Ekaterina Kiryanova  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logical-replication.sgml
M src/backend/access/transam/rmgr.c

meson: mingw: Add -Wl,--disable-auto-import, enable when linking with readline

commit   : 24ef127b6d1f268ca09f4c501b4655e914329c5a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 10:19:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 10:19:00 -0700    

Click here for diff

I hadn't ported -Wl,--disable-auto-import over from the win32 template as I  
had focused on msvc for windows. The flag is desirable as it makes it easier  
to find problems one would have with msvc, particularly useful during cross  
compilation.  
  
This turned out to be a somewhat happy accident, as it allowed me to realize  
that readline actually works on windows these days, as long as auto imports to  
enable. Therefore enable auto-import again as part of linking to readline.  
  
We perhaps can come up with a better solution for the readline issue, but this  
seems good enough for now.  
  
Discussion: http://postgr.es/m/[email protected]  

M meson.build

Avoid improbable PANIC during heap_update, redux.

commit   : 2dc2e4e31adb71502074c8c2bf9e0766347aa6e5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2022 19:36:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2022 19:36:46 -0400    

Click here for diff

Commit 34f581c39 intended to ensure that RelationGetBufferForTuple  
would acquire a visibility-map page pin in case the otherBuffer's  
all-visible bit had become set since we last had lock on that page.  
But I missed a case: when we're extending the relation, VM concerns  
were dealt with only in the relatively-less-likely case that we  
fail to conditionally lock the otherBuffer.  I think I'd believed  
that we couldn't need to worry about it if the conditional lock  
succeeds, which is true for the target buffer; but the otherBuffer  
was unlocked for awhile so its bit might be set anyway.  So we need  
to do the GetVisibilityMapPins dance, and then also recheck the  
page's free space, in both cases.  
  
Per report from Jaime Casanova.  Back-patch to v12 as the previous  
patch was (although there's still no evidence that the bug is  
reachable pre-v14).  
  
Discussion: https://postgr.es/m/[email protected]  

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

mingw: Define PGDLLEXPORT as __declspec (dllexport) as done for msvc

commit   : 0e497eadb1f4028b147b5c58dc08cea7e73675e1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 10:16:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 10:16:49 -0700    

Click here for diff

While mingw would otherwise fall back to  
__attribute__((visibility("default"))), that appears to only work as long as  
no symbols are declared with __declspec(dllexport). But we can end up with  
some, e.g. plpython's Py_Init.  
  
It's quite possible we should do the same for cygwin, but I don't have a test  
environment for that...  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/[email protected]  

M src/include/port/win32.h

Adjust PQsslAttributeNames() to match PQsslAttribute().

commit   : 4e4f7b9fcc9ad0b023b6e698e978882d022b94c4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2022 10:26:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2022 10:26:47 -0400    

Click here for diff

Currently, PQsslAttributeNames() returns the same list of attribute  
names regardless of its conn parameter.  This patch changes it to  
have behavior parallel to what 80a05679d installed for PQsslAttribute:  
you get OpenSSL's attributes if conn is NULL or is an SSL-encrypted  
connection, or an empty list if conn is a non-encrypted connection.  
The point of this is to have sensible connection-dependent behavior  
in case we ever support multiple SSL libraries.  The behavior for  
NULL can be defined as "the attributes for the default SSL library",  
parallel to what PQsslAttribute(NULL, "library") does.  
  
Since this is mostly just future-proofing, no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-secure-openssl.c

Fix tab-completion after commit 790bf615ddba

commit   : 69298db8e1a5a7afcfeea32daf71e713a109ef93    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 30 Sep 2022 12:53:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 30 Sep 2022 12:53:31 +0200    

Click here for diff

I (Álvaro) broke tab-completion for GRANT .. ALL TABLES IN SCHEMA while  
removing ALL from the publication syntax for schemas in the  
aforementioned commit.  I also missed to update a bunch of  
tab-completion rules for ALTER/CREATE PUBLICATION that match each  
individual piece of ALL TABLES IN SCHEMA.  Repair those bugs.  
  
While fixing up that commit, update a couple of outdated comments  
related to the same change.  
  
Backpatch to 15.  
  
Author: Shi yu <[email protected]>  
Reviewed-by: Peter Smith <[email protected]>  
Discussion: https://postgr.es/m/OSZPR01MB6310FCE8609185A56344EED2FD559@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/tablesync.c
M src/bin/psql/tab-complete.c
M src/test/subscription/t/031_column_list.pl

doc: Fix PQsslAttribute docs for compression

commit   : 51fd7cdfd07d49223c82f8bbdf37866c81c62908    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 30 Sep 2022 12:03:48 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 30 Sep 2022 12:03:48 +0200    

Click here for diff

The compression parameter to PQsslAttribute has never returned the  
compression method used, it has always returned "on" or "off since  
it was added in commit 91fa7b4719ac. Backpatch through v10.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v10  

M doc/src/sgml/libpq.sgml

Remove useless argument from UnpinBuffer()

commit   : 65b158ae4e892c2da7a5e31e2d2645e5e79a0bfd    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Sep 2022 15:57:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Sep 2022 15:57:47 +0900    

Click here for diff

The last caller of UnpinBuffer() that did not want to adjust  
CurrentResourceOwner was removed in 2d115e4, and nothing has been  
introduced in bufmgr.c to do the same thing since.  This simplifies 10  
code paths.  
  
Author: Aleksander Alekseev  
Reviewed-by: Nathan Bossart, Zhang Mingli, Bharath Rupireddy  
Discussion: https://postgr.es/m/CAJ7c6TOmmFpb6ohurLhTC7hKNJWGzdwf8s4EAtAZxD48g-e6Jw@mail.gmail.com  

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

ci: Add 32bit build and test

commit   : ccf36ea2580f66abbc37f27d8c296861ffaad9bf    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 29 Sep 2022 16:09:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 29 Sep 2022 16:09:09 -0700    

Click here for diff

It's easy enough to make changes that break on 32bit platforms and few people  
test that locally. Add a test for that to CI. LLVM is disabled on 32bit  
because installing it would bloat the image size further.  
  
The debian w/ meson task is fast enough that we can afford to test both.  
  
Use the occasion of a separate run of the tests to run them under LANG=C,  
we've recently discovered there's not a lot of testing in the buildfarm for  
the case.  
  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

Fix bogus behavior of PQsslAttribute(conn, "library").

commit   : 80a05679d5a400b8f995740c175f8bdb060bb05c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2022 17:28:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2022 17:28:09 -0400    

Click here for diff

Commit ebc8b7d44 intended to change the behavior of  
PQsslAttribute(NULL, "library"), but accidentally also changed  
what happens with a non-NULL conn pointer.  Undo that so that  
only the intended behavior change happens.  Clarify some  
associated documentation.  
  
Per bug #17625 from Heath Lord.  Back-patch to v15.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-secure-openssl.c

Improve wording of log messages triggered by max_slot_wal_keep_size.

commit   : 551aa6b7b9f3b78e7b6cbab1fea70947fa7f4966    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2022 13:27:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2022 13:27:48 -0400    

Click here for diff

The one about "terminating process to release replication slot" told  
you nothing about why that was happening.  The one about "invalidating  
slot because its restart_lsn exceeds max_slot_wal_keep_size" told you  
what was happening, but violated our message style guideline about  
keeping the primary message short.  Add DETAIL/HINT lines to carry  
the appropriate detail and make the two cases more uniform.  
  
While here, fix bogus test logic in 019_replslot_limit.pl: if it timed  
out without seeing the expected log message, no test failure would be  
reported.  This is flat broken since commit 549ec201d removed the test  
counts; even before that it was horribly bad style, since you'd only  
get told that not all tests had been run.  
  
Kyotaro Horiguchi, reviewed by Bertrand Drouvot; test fixes by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c
M src/test/recovery/t/019_replslot_limit.pl

Use actual backend IDs in pg_stat_get_backend_idset() and friends.

commit   : d7e39d72ca1c6f188b400d7d58813ff5b5b79064    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2022 12:14:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2022 12:14:39 -0400    

Click here for diff

Up to now, the ID values returned by pg_stat_get_backend_idset() and  
used by pg_stat_get_backend_activity() and allied functions were just  
indexes into a local array of sessions seen by the last stats refresh.  
This is problematic for a few reasons.  The "ID" of a session can vary  
over its existence, which is surprising.  Also, while these numbers  
often match the "backend ID" used for purposes like temp schema  
assignment, that isn't reliably true.  We can fairly cheaply switch  
things around to make these numbers actually be the sessions' backend  
IDs.  The added test case illustrates that with this definition, the  
temp schema used by a given session can be obtained given its PID.  
  
While here, delete some dead code that guarded against getting  
a NULL return from pgstat_fetch_stat_local_beentry().  That can't  
happen as long as the caller is careful to pass an in-range array  
index, as all the callers are.  (This code may not have been dead  
when written, but it surely is now.)  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/20220815205811.GA250990@nathanxps13  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/utils/backend_status.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Update comment in ExecInsert() regarding batch insertion.

commit   : d5e3fe682ac327ae2c0682a931f95e946ae13487    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 29 Sep 2022 16:55:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 29 Sep 2022 16:55:00 +0900    

Click here for diff

Remove the stale text that is a leftover from an earlier version of the  
patch to add support for batch insertion, and adjust the wording in the  
remaining text.  
  
Back-patch to v14 where batch insertion came in.  
  
Review and wording adjustment by Tom Lane.  
  
Discussion: https://postgr.es/m/CAPmGK14goatHPHQv2Aeu_UTKqZ%2BBO%2BP%2Bzd3HKv5D%2BdyyfWKDSw%40mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Introduce SYSTEM_USER

commit   : 0823d061b0b7f1e20fbfd48bef3c2e093493dbd4    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Sep 2022 15:05:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Sep 2022 15:05:40 +0900    

Click here for diff

SYSTEM_USER is a reserved keyword of the SQL specification that,  
roughly described, is aimed at reporting some information about the  
system user who has connected to the database server.  It may include  
implementation-specific information about the means by the user  
connected, like an authentication method.  
  
This commit implements SYSTEM_USER as of auth_method:identity, where  
"auth_method" is a keyword about the authentication method used to log  
into the server (like peer, md5, scram-sha-256, gss, etc.) and  
"identity" is the authentication identity as introduced by 9afffcb (peer  
sets authn to the OS user name, gss to the user principal, etc.).  This  
format has been suggested by Tom Lane.  
  
Note that thanks to d951052, SYSTEM_USER is available to parallel  
workers.  
  
Bump catalog version.  
  
Author: Bertrand Drouvot  
Reviewed-by: Jacob Champion, Joe Conway, Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/access/transam/parallel.c
M src/backend/parser/gram.y
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/miscadmin.h
M src/include/parser/kwlist.h
M src/test/authentication/t/001_password.pl
M src/test/kerberos/t/001_auth.pl
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

Mark sigint_interrupt_enabled as sig_atomic_t

commit   : 5ac9e869191148741539e626b84ba7e77dc71670    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Sep 2022 14:28:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Sep 2022 14:28:13 +0900    

Click here for diff

This is a continuation of 78fdb1e, where this flag is set in the psql  
callback handler used for SIGINT.  This was previously a boolean but the  
C standard recommends the use of sig_atomic_t.  Note that this  
influences PromptInterruptContext in string.h, where the same flag is  
tracked.  
  
Author: Hayato Kuroda  
Discussion: https://postgr.es/m/TYAPR01MB58669A9EC96AA3078C2CD938F5549@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/bin/psql/common.c
M src/bin/psql/common.h
M src/include/common/string.h

windows: Set UMDF_USING_NTSTATUS globally, include ntstatus.h

commit   : b8d8a4593a3a2daa5e16e4a3634d9284fe14667f    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 21:59:15 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 21:59:15 -0700    

Click here for diff

We'd like to use precompiled headers on windows to reduce compile times. Right  
now we rely on defining UMDF_USING_NTSTATUS before including postgres.h in a few  
select places - which doesn't work with precompiled headers.  Instead define  
it globally.  
  
When UMDF_USING_NTSTATUS is defined we need to explicitly include ntstatus.h,  
winternl.h to get a comparable set of symbols. Right now these includes would  
be required in a number of non-platform-specific .c files - to avoid that,  
include them in win32_port.h. Based on my measurements that doesn't increase  
compile times measurably.  
  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/port/open.c
M src/port/win32fdatasync.c
M src/port/win32ntdll.c
M src/port/win32stat.c

meson: Implement getopt logic from autoconf

commit   : a1b3bca1c8e32c31ba1a8d1125b2eb97f750a7f0    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 14:21:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 14:21:43 -0700    

Click here for diff

Not replacing getopt/getopt_long definitely causes issues on mingw. It's not  
as clear whether the solaris & openbsd aspect is still needed, but if not, we  
should remove it from both autoconf and meson.  
  
Discussion: http://postgr.es/m/[email protected]  

M meson.build

meson: mingw: Allow multiple definitions

commit   : caeeabd11066a360c8a9986581da320dd5aa09b9    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 09:48:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 28 Sep 2022 09:48:09 -0700    

Click here for diff

I didn't carry this forward from the win32 template. It's not needed anymore  
for the reason stated therein, but it turns out to be required to  
e.g. override getopt. Possibly a better solution exists, but that's for later.  
  
Discussion: http://postgr.es/m/[email protected]  

M meson.build

meson: pg_regress: Define a HOST_TUPLE sufficient to make resultmap work

commit   : dfefa0e46433a2c798281826f8501895f3fa2a71    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 27 Sep 2022 12:01:35 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 27 Sep 2022 12:01:35 -0700    

Click here for diff

This doesn't end up with a triple that's exactly the same as config.guess -  
it'd be hard to achieve that and it doesn't seem required. We can't rely on  
config.guess as we don't necessarily have a /bin/sh on windows, e.g., when  
building on windows with msvc.  
  
This isn't perfect, e.g., clang works on windows as well.  But I suspect we'd  
need a bunch of other changes to make clang on windows work, and we haven't  
supported it historically.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/test/regress/meson.build

meson: windows: Normalize slashes in prefix

commit   : e3a892539b2baabc1963c31605728bbbc8f8b89a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 27 Sep 2022 11:55:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 27 Sep 2022 11:55:00 -0700    

Click here for diff

This fixes a build issue on windows, when the prefix is set to a path with  
forward slashes. Windows python defaults to a path with a backslash, but mingw  
ucrt python defaults to a forward slash. This in turn lead to a wrong PATH set  
during tests, causing tests to fail.  
  
Reported-by: Melih Mutlu <[email protected]>  
Discussion: http://postgr.es/m/[email protected]  

M meson.build

Map ERROR_INVALID_NAME to ENOENT in mapping table of win32error.c

commit   : 2beae72746e6b762cb335ec4fff87e5407b3096c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Sep 2022 10:14:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Sep 2022 10:14:47 +0900    

Click here for diff

This error can be reached when sending an incorrect file name to open()  
on Windows, resulting in a confusing errno reported.  This has been seen  
in the development of a different patch by the same author.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACWet-b8Juba0DiXwfGCyyOcohzwksahE5ebB9rcbLZKCQ@mail.gmail.com  

M src/port/win32error.c

Restore pg_pread and friends.

commit   : b6d8a60aba322678585ebe11dab072a37ac32905    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 29 Sep 2022 13:12:11 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 29 Sep 2022 13:12:11 +1300    

Click here for diff

Commits cf112c12 and a0dc8271 were a little too hasty in getting rid of  
the pg_ prefixes where we use pread(), pwrite() and vectored variants.  
  
We dropped support for ancient Unixes where we needed to use lseek() to  
implement replacements for those, but it turns out that Windows also  
changes the current position even when you pass in an offset to  
ReadFile() and WriteFile() if the file handle is synchronous, despite  
its documentation saying otherwise.  
  
Switching to asynchronous file handles would fix that, but have other  
complications.  For now let's just put back the pg_ prefix and add some  
comments to highlight the non-standard side-effect, which we can now  
describe as Windows-only.  
  
Reported-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/20220923202439.GA1156054%40nathanxps13  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup.c
M src/backend/replication/walreceiver.c
M src/backend/storage/file/fd.c
M src/backend/utils/init/miscinit.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/include/access/xlogreader.h
M src/include/port.h
M src/include/port/pg_iovec.h
M src/include/port/win32_port.h
M src/port/preadv.c
M src/port/pwritev.c
M src/port/win32pread.c
M src/port/win32pwrite.c

Restrict Datum sort optimization to byval types only

commit   : 3a5817695a8360011864c1834f8a90ffdfc7f840    
  
author   : David Rowley <[email protected]>    
date     : Thu, 29 Sep 2022 11:43:00 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 29 Sep 2022 11:43:00 +1300    

Click here for diff

91e9e89dc modified nodeSort.c so that it used datum sorts when the  
targetlist of the outer node contained only a single column.  That commit  
failed to recognise that the Datum returned by tuplesort_getdatum() must  
be pfree'd when the type is a byref type.  Ronan Dunklau did originally  
propose the patch with that restriction, but that, probably through my own  
fault, got lost during further development work.  
  
Due to the timing of this report (PG15 RC1 is almost out the door), let's  
just restrict the datum sort optimization to apply for byval types only.  
We might want to look harder into making this work for byref types in  
PG16.  
  
Reported-by: Önder Kalacı  
Diagnosis-by: Tom Lane  
Discussion: https://postgr.es/m/CACawEhVxe0ufR26UcqtU7GYGRuubq3p6ZWPGXL4cxy_uexpAAQ@mail.gmail.com  
Backpatch-through: 15, where 91e9e89dc was introduced.  

M src/backend/executor/nodeSort.c

doc: clarify internal behavior of RECURSIVE CTE queries

commit   : 2a66b9bfb74e522d64c066dabe4fddde0fe7425c    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 28 Sep 2022 13:14:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 28 Sep 2022 13:14:38 -0400    

Click here for diff

Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/queries.sgml

revert "warn of SECURITY DEFINER schemas for non-sql_body funcs"

commit   : f77becbe5a99c9853b1ae7f22aa15babd01368b7    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 28 Sep 2022 13:05:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 28 Sep 2022 13:05:21 -0400    

Click here for diff

doc revert of commit 1703726488.  Change was applied to irrelevant  
branches, and was not detailed enough to be helpful in relevant  
branches.  
  
Reported-by: Peter Eisentraut, Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_function.sgml

Doc: document bpchar, clarify relationship of text and varchar.

commit   : 0937f6d172921202e1b432e206e4c30775d564d8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Sep 2022 12:31:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Sep 2022 12:31:36 -0400    

Click here for diff

For some reason the "bpchar" type name was defined nowhere in  
our SGML docs, although several places refer to it in passing.  
Give it a proper mention under Character Types.  
  
While here, also provide an explanation of how the text and varchar  
types relate.  The previous wording seemed to be doing its best  
to sweep text under the rug, which doesn't seem very appropriate  
given its prominence in other parts of the docs.  
  
Minor rearrangements and word-smithing for clarity, too.  
  
Laurenz Albe and Tom Lane, per gripe from Yanliang Lei  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Allow callback functions to deregister themselves during a call.

commit   : 4d2a844242dcfb34e05dd0d880b1a283a514b16b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Sep 2022 11:23:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Sep 2022 11:23:14 -0400    

Click here for diff

Fetch the next-item pointer before the call not after, so that  
we aren't dereferencing a dangling pointer if the callback  
deregistered itself during the call.  The risky coding pattern  
appears in CallXactCallbacks, CallSubXactCallbacks, and  
ResourceOwnerReleaseInternal.  (There are some other places that  
might be at hazard if they offered deregistration functionality,  
but they don't.)  
  
I (tgl) considered back-patching this, but desisted because it  
wouldn't be very safe for extensions to rely on this working in  
pre-v16 branches.  
  
Hao Wu  
  
Discussion: https://postgr.es/m/CAH+9SWXTiERkmhRke+QCcc+jRH8d5fFHTxh8ZK0-Yn4BSpyaAg@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/utils/resowner/resowner.c

Change some errdetail() to errdetail_internal()

commit   : d84a7b290f866b3f16cbefb0fca31b69ebace98a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2022 17:14:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2022 17:14:53 +0200    

Click here for diff

This prevents marking the argument string for translation for gettext,  
and it also prevents the given string (which is already translated) from  
being translated at runtime.  
  
Also, mark the strings used as arguments to check_rolespec_name for  
translation.  
  
Backpatch all the way back as appropriate.  None of this is caught by  
any tests (necessarily so), so I verified it manually.  

M src/backend/catalog/dependency.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/user.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/jsonfuncs.c
M src/common/jsonapi.c

Fix bug in DROP OWNED BY.

commit   : 7188b9b0fdbb4dd99915626f171d820a56b98514    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2022 10:42:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2022 10:42:07 -0400    

Click here for diff

Commit 6566133c5f52771198aca07ed18f84519fac1be7 broke the case where  
the role passed to DROP OWNED BY owns a database.  
  
Report by Rushabh Lathia, who also provided a patch, but this patch  
takes a slightly different approach to fixing the problem.  
  
Discussion: http://postgr.es/m/CAGPqQf2vO+nbo=3yAdZ8v26Rbug7bY4YjPaPLZx=L1NZ9-CC3w@mail.gmail.com  

M src/backend/catalog/pg_shdepend.c
M src/bin/scripts/t/020_createdb.pl

Revert 56-bit relfilenode change and follow-up commits.

commit   : a448e49bcbe40fb72e1ed85af910dd216d45bad8    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2022 09:45:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2022 09:45:27 -0400    

Click here for diff

There are still some alignment-related failures in the buildfarm,  
which might or might not be able to be fixed quickly, but I've also  
just realized that it increased the size of many WAL records by 4 bytes  
because a block reference contains a RelFileLocator. The effect of that  
hasn't been studied or discussed, so revert for now.  

M contrib/pg_buffercache/Makefile
M contrib/pg_buffercache/meson.build
D contrib/pg_buffercache/pg_buffercache–1.3–1.4.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/gin/ginxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/README
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/basebackup.c
M src/backend/catalog/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/storage.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/nodes/gen_node_support.pl
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/file/reinit.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/scripts/t/090_reindexdb.pl
M src/common/relpath.c
M src/fe_utils/option_utils.c
M src/include/access/transam.h
M src/include/access/xlog.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/common/relpath.h
M src/include/fe_utils/option_utils.h
M src/include/storage/buf_internals.h
M src/include/storage/relfilelocator.h
M src/include/storage/sinval.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/fast_default.out
M src/test/regress/expected/oidjoins.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/fast_default.sql

Fix InitializeRelfilenumberMap for 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c

commit   : 6af082723277eeca74f2da65e7759666bf7c7f9c    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2022 08:02:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2022 08:02:30 -0400    

Click here for diff

Since relfilenodes are now 56-bits, we use bigint as the SQL type  
to represent them, which means F_INT8EQ must be used here rather  
than F_OIDEQ. On 64-bit machines this doesn't matter, but 32-bit  
machines are unhappy.  
  
Dilip Kumar  
  
Discussion: http://postgr.es/m/CAFiTN-t71ciSckMzixAhrF9py7oRO6xszKi4mTRwjuucXr5tpw@mail.gmail.com  

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

Fix alignment problems with SharedInvalSmgrMsg.

commit   : 0222be137188ac3912d244d832a328be0944f3e9    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2022 07:51:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 28 Sep 2022 07:51:48 -0400    

Click here for diff

SharedInvalSmgrMsg can't require 8-byte alignment, because then  
SharedInvalidationMessage will require 8-byte alignment, which will  
then cause ParseCommitRecord to fail on machines that are picky  
about alignment, because it assumes that everything that gets  
packed into a commit record requires only 4-byte alignment.  
  
Another problem with 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/utils/cache/inval.c
M src/include/storage/sinval.h

Remove publicationcmds.c's expr_allowed_in_node as a function

commit   : d0b1dbcb98454a353919d789c71c6d9a89e961eb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2022 13:47:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2022 13:47:25 +0200    

Click here for diff

Its API is quite strange, and since there's only one caller, there's no  
reason for it to be a separate function in the first place.  Inline it  
instead.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/publicationcmds.c

Fix some comments of do_pg_backup_start() and do_pg_backup_stop()

commit   : 2e560b974ec7f7e8fe47e765e7c276422015ff3b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Sep 2022 09:58:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Sep 2022 09:58:44 +0900    

Click here for diff

Both functions referred to an incorrect variable name, so make the whole  
more consistent.  
  
Oversight in 7d70809.  
  
Author: Kyotaro Horiguchi, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

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

In BufTagGetForkNum, cast to the correct type.

commit   : 0aaa7cf6989ef6709f2bade96c4c43c7195afe17    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 16:12:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 16:12:43 -0400    

Click here for diff

Another defect in 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c.  
  
Per CI, via Justin Pryzby.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/storage/buf_internals.h

Update pg_buffercache's meson.build.

commit   : 99164b7ea6bb396f4df569eb7c07664b74b66f19    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 15:31:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 15:31:36 -0400    

Click here for diff

Commit 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c needed to do this,  
but didn't.  
  
Per Justin Pryzby.  
  
Discussion: [email protected]  

M contrib/pg_buffercache/meson.build

Fix typos in commit 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c.

commit   : 4667d97ca624b257f690e8d369b242b380f53a09    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 15:13:34 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 15:13:34 -0400    

Click here for diff

Reported by Justin Pryzby.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/varsup.c
M src/backend/catalog/storage.c
M src/fe_utils/option_utils.c

Convert *GetDatum() and DatumGet*() macros to inline functions

commit   : c8b2ef05f481ef06326d7b9f3eb14b303f215c7e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 27 Sep 2022 20:47:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 27 Sep 2022 20:47:07 +0200    

Click here for diff

The previous macro implementations just cast the argument to a target  
type but did not check whether the input type was appropriate.  The  
function implementation can do better type checking of the input type.  
  
For the *GetDatumFast() macros, converting to an inline function  
doesn't work in the !USE_FLOAT8_BYVAL case, but we can use  
AssertVariableIsOfTypeMacro() to get a similar level of type checking.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com  

M contrib/intarray/_int_gist.c
M doc/src/sgml/xfunc.sgml
M src/backend/access/gist/gistutil.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/mb/mbutils.c
M src/include/access/gin.h
M src/include/funcapi.h
M src/include/postgres.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/cash.h
M src/include/utils/date.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/geo_decls.h
M src/include/utils/inet.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/pg_lsn.h
M src/include/utils/rangetypes.h
M src/include/utils/timestamp.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/xid8.h
M src/include/utils/xml.h

Include common/relpath.h in utils/relfilenumbermap.h

commit   : 8caf96de0b7b4ad5beb02b36a158196520c035a7    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 13:34:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 13:34:23 -0400    

Click here for diff

Buildfarm member crake ran headerscheck, which complained about  
a missing include here.  
  
Defect introduced by commit 2f47715cc8649f854b1df28dfc338af9801db217.  

M src/include/utils/relfilenumbermap.h

Increase width of RelFileNumbers from 32 bits to 56 bits.

commit   : 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 13:25:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 13:25:21 -0400    

Click here for diff

RelFileNumbers are now assigned using a separate counter, instead of  
being assigned from the OID counter. This counter never wraps around:  
if all 2^56 possible RelFileNumbers are used, an internal error  
occurs. As the cluster is limited to 2^64 total bytes of WAL, this  
limitation should not cause a problem in practice.  
  
If the counter were 64 bits wide rather than 56 bits wide, we would  
need to increase the width of the BufferTag, which might adversely  
impact buffer lookup performance. Also, this lets us use bigint for  
pg_class.relfilenode and other places where these values are exposed  
at the SQL level without worrying about overflow.  
  
This should remove the need to keep "tombstone" files around until  
the next checkpoint when relations are removed. We do that to keep  
RelFileNumbers from being recycled, but now that won't happen  
anyway. However, this patch doesn't actually change anything in  
this area; it just makes it possible for a future patch to do so.  
  
Dilip Kumar, based on an idea from Andres Freund, who also reviewed  
some earlier versions of the patch. Further review and some  
wordsmithing by me. Also reviewed at various points by Ashutosh  
Sharma, Vignesh C, Amul Sul, Álvaro Herrera, and Tom Lane.  
  
Discussion: http://postgr.es/m/CA+Tgmobp7+7kmi4gkq7Y+4AM9fTvL+O1oQ4-5gFTT+6Ng-dQ=g@mail.gmail.com  

M contrib/pg_buffercache/Makefile
A contrib/pg_buffercache/pg_buffercache–1.3–1.4.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/gin/ginxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/README
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/basebackup.c
M src/backend/catalog/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/storage.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/nodes/gen_node_support.pl
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/file/reinit.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/scripts/t/090_reindexdb.pl
M src/common/relpath.c
M src/fe_utils/option_utils.c
M src/include/access/transam.h
M src/include/access/xlog.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/common/relpath.h
M src/include/fe_utils/option_utils.h
M src/include/storage/buf_internals.h
M src/include/storage/relfilelocator.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/fast_default.out
M src/test/regress/expected/oidjoins.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/fast_default.sql

Move RelFileNumber declarations to common/relpath.h.

commit   : 2f47715cc8649f854b1df28dfc338af9801db217    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 12:01:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 27 Sep 2022 12:01:57 -0400    

Click here for diff

Previously, these were declared in postgres_ext.h, but they are not  
needed nearly so widely as the OID declarations, so that doesn't  
necessarily make sense. Also, because postgres_ext.h is included  
before most of c.h has been processed, the previous location creates  
some problems for a pending patch.  
  
Patch by me, reviewed by Dilip Kumar.  
  
Discussion: http://postgr.es/m/CA+TgmoYc8oevMqRokZQ4y_6aRn-7XQny1JBr5DyWR_jiFtONHw@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/include/catalog/binary_upgrade.h
M src/include/common/relpath.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/postgres_ext.h
M src/include/utils/relcache.h

Renumber GUC flags for a bit more sanity.

commit   : 7ac918ada0037fc1101456271b3e7d0982d6a375    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2022 11:51:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2022 11:51:06 -0400    

Click here for diff

Push the units fields over to the left so that all the single-bit  
flags can be together.  I considered rearranging the single-bit  
flags to try to group flags with similar purposes, but eventually  
decided that that involved too many judgment calls.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/utils/guc.h

Introduce GUC_NO_RESET flag.

commit   : 385366426511399a91da327c0f04765bbcfd5322    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2022 11:47:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Sep 2022 11:47:12 -0400    

Click here for diff

Previously, the transaction-property GUCs such as transaction_isolation  
could be reset after starting a transaction, because we marked them  
as GUC_NO_RESET_ALL but still allowed a targeted RESET.  That leads to  
assertion failures or worse, because those properties aren't supposed  
to change after we've acquired a transaction snapshot.  
  
There are some NO_RESET_ALL variables for which RESET is okay, so  
we can't just redefine the semantics of that flag.  Instead introduce  
a separate GUC_NO_RESET flag.  Mark "seed", as well as the transaction  
property GUCs, as GUC_NO_RESET.  
  
We have to disallow GUC_ACTION_SAVE as well as straight RESET, because  
otherwise a function having a "SET transaction_isolation" clause can  
still break things: the end-of-function restore action is equivalent  
to a RESET.  
  
No back-patch, as it's conceivable that someone is doing something  
this patch will forbid (like resetting one of these GUCs at transaction  
start, or "CREATE FUNCTION ... SET transaction_read_only = 1") and not  
running into problems with it today.  Given how long we've had this  
issue and not noticed, the side effects in non-assert builds can't be  
too serious.  
  
Per bug #17385 from Andrew Bille.  
  
Masahiko Sawada  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc.h
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql
M src/test/regress/expected/guc.out
M src/test/regress/expected/transactions.out
M src/test/regress/sql/guc.sql
M src/test/regress/sql/transactions.sql

commit   : 4148c8b3daf95ca308f055e103f6ee82e25b8f99    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2022 14:11:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2022 14:11:31 +0200    

Click here for diff

While at it, remove an unused queryString parameter from  
CheckPubRelationColumnList() and make other minor stylistic changes.  
  
Backpatch to 15.  
  
Reported by Kyotaro Horiguchi <[email protected]>  
Co-authored-by: Hou zj <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/publicationcmds.c
M src/test/regress/expected/publication.out

Fix pg_stat_statements for MERGE

commit   : 249b0409b181311bb1c375311e43eb767b5c3bdd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2022 10:44:42 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2022 10:44:42 +0200    

Click here for diff

We weren't jumbling the merge action list, so wildly different commands  
would be considered to use the same query ID.  Add that, mention it in  
the docs, and some test lines.  
  
Backpatch to 15.  
  
Author: Tatsu <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
M doc/src/sgml/pgstatstatements.sgml
M src/backend/nodes/nodeFuncs.c
M src/backend/utils/misc/queryjumble.c

ci: Add hint about downloadable logs to README

commit   : bed0927aeb0c61bd8649b56e5b84a6d551d5f416    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 20:02:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 20:02:26 -0700    

Click here for diff

I (Andres) chose to backpatch this to 15, as it seems better to keep the  
README the same.  
  
Author: James Coleman <[email protected]>  
Discussion: https://postgr.es/m/CAAaqYe_7BXDjpk0Ks_eqf1r6LZpC_rfB7kjhb_T3+eC4t6yiGQ@mail.gmail.com  
Backpatch: 15-, where CI came in  

M src/tools/ci/README

meson: Set up absolute rpaths to libdir

commit   : a1860071b3fc6b9475a09f0c306e432249bb8314    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 19:44:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 19:44:05 -0700    

Click here for diff

While I (Andres) had planned to use relative rpaths, it looks like agreeing on  
the precise path might take a bit. So set up absolute rpaths for now.  
  
I'm pushing this fairly quickly after posting the patch as several hackers  
fought with this issue.  
  
Discussion: https://postgr.es/m/[email protected]  

M meson.build

meson: Include CFLAGS/c_args in summary and pg_config output

commit   : 1330dcdec0f22fb2b7a621f9a0e6e729e21d50a4    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 19:36:24 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 19:36:24 -0700    

Click here for diff

Previously arguments passed in via CFLAGS/-Dc_args were neither displayed in  
meson's summary, nor in pg_config's output.  
  
Reported-by: "[email protected]" <[email protected]>  
Discussion: https://postgr.es/m/OS3PR01MB62751847BC9CD2DB7B29AC129E529@OS3PR01MB6275.jpnprd01.prod.outlook.com  

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

Mark ParallelMessagePending as sig_atomic_t

commit   : 78fdb1e50f7fd394505a400b507f70ecffa6d7bf    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Sep 2022 09:29:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Sep 2022 09:29:56 +0900    

Click here for diff

ParallelMessagePending was previously marked as a boolean which should  
be fine on modern platforms, but the C standard recommends the use of  
sig_atomic_t for variables manipulated in signal handlers.  
  
Author: Hayato Kuroda  
Discussion: https://postgr.es/m/TYAPR01MB58667C15A95A234720F4F876F5529@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/backend/access/transam/parallel.c
M src/include/access/parallel.h

Remove dependency to StringInfo in xlogbackup.{c.h}

commit   : e1e6f8f3dfe141839220875270a81ad3a719e0b6    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Sep 2022 09:15:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Sep 2022 09:15:07 +0900    

Click here for diff

This was used as the returned result type of the generated contents for  
the backup_label and backup history files.  This is replaced by a simple  
string, reducing the cleanup burden of all the callers of  
build_backup_content().  
  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/backup/basebackup.c
M src/include/access/xlogbackup.h

windows: remove date from version number in win32ver.rc

commit   : 31d2c4716e6b429353bb81cebaa0f2b1267823d6    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 11:38:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 11:38:02 -0700    

Click here for diff

This may have served a purpose at some point, but these days it just  
contributes to a non-reproducible build.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/makefiles/Makefile.win32
M src/tools/msvc/Project.pm

Doc: further adjust notes about pg_upgrade_output.d.

commit   : fbd2bd15b0114bb900aa6986add2b359fec1b740    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 14:19:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 14:19:21 -0400    

Click here for diff

I'd misunderstood how it worked in 5f1048881.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgupgrade.sgml

Enable WRITE_READ_PARSE_PLAN_TREES of rewritten utility statements

commit   : 787102b5637389b10c220b08992a6a064ac319c6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 16:32:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 16:32:16 +0200    

Click here for diff

This was previously disabled because we lacked outfuncs/readfuncs  
support for most utility statement types.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/tcop/postgres.c

Implement WRITE_READ_PARSE_PLAN_TREES for raw parse trees

commit   : 40ad8f9deed21f02b23eb034bfca87f7acc7562b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 16:32:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 16:32:16 +0200    

Click here for diff

Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/tcop/postgres.c

Don't lose precision for float fields of Nodes.

commit   : acd624644bc4f957824abcd00f6af27861b03a29    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 16:02:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 16:02:09 +0200    

Click here for diff

Historically we've been more worried about making the output of  
float fields look pretty than whether they'd be read back exactly.  
That won't work if we're to compare the read-back nodes for  
equality, so switch to using the Ryu code for float output.  
  
Author: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

catversion bump

commit   : c07785d458c1ca69ad7cd3ebb8f4a1d953c3779b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 15:56:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 15:56:47 +0200    

Click here for diff

for 8999f5ed3cd7d26be1121d912086d04d134d398b  

M src/include/catalog/catversion.h

Fix write/read of empty string fields in Nodes.

commit   : 8999f5ed3cd7d26be1121d912086d04d134d398b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 15:25:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 15:25:59 +0200    

Click here for diff

Historically, outToken has represented both NULL and empty-string  
strings as "<>", which readfuncs.c then read as NULL, thus failing  
to preserve empty-string fields accurately.  Remarkably, this has  
not caused any serious problems yet, but let's fix it.  
  
We'll keep the "<>" notation for NULL, and use """" for empty string,  
because that matches other notational choices already in use.  
An actual input string of """" is converted to "\""" (this was true  
already, apparently as a hangover from an ancient time when string  
quoting was handled directly by pg_strtok).  
  
CHAR fields also use "<>", but for '\0'.  
  
Author: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

Remove unused xid parameter.

commit   : af51b2f042a0808943125b82c0d6e785259069f2    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 26 Sep 2022 08:47:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 26 Sep 2022 08:47:00 +0530    

Click here for diff

Commit 6c2003f8a1 removes the use of transaction id's for exporting  
snapshots. This commit removes one unused xid parameter left behind in  
SnapBuildGetOrBuildSnapshot.  
  
Author: Melih Mutlu  
Reviewed-By: Zhang Mingli  
Discussion: https://postgr.es/m/CAGPVpCTqZRoDKgCycw+eYi+Gq41rN9pU-gntgTd7wfsNDpPL3Q@mail.gmail.com  

M src/backend/replication/logical/decode.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/snapbuild.h

Refactor creation of backup_label and backup history files

commit   : 7d708093b7400327658a30d1aa1d5e284d37622c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Sep 2022 11:15:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Sep 2022 11:15:47 +0900    

Click here for diff

This change simplifies some of the logic related to the generation and  
creation of the backup_label and backup history files, which has become  
unnecessarily complicated since the removal of the exclusive backup mode  
in commit 39969e2.  The code was previously generating the contents of  
these files as a string (start phase for the backup_label and stop phase  
for the backup history file), one problem being that the contents of the  
backup_label string were scanned to grab some of its internal contents  
at the stop phase.  
  
This commit changes the logic so as we store the data required to build  
these files in an intermediate structure named BackupState.  The  
backup_label file and backup history file strings are generated when  
they are ready to be sent back to the client.  Both files are now  
generated with the same code path.  While on it, this commit renames  
some variables for clarity.  
  
Two new files named xlogbackup.{c,h} are introduced in this commit, to  
remove from xlog.c some of the logic around base backups.  Note that  
more could be moved to this new set of files.  
  
Author: Bharath Rupireddy, Michael Paquier  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CALj2ACXWwTDgJqCjdaPyfR7djwm6SrybGcrZyrvojzcsmt4FFw@mail.gmail.com  

M src/backend/access/transam/Makefile
M src/backend/access/transam/meson.build
M src/backend/access/transam/xlog.c
A src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/backup/basebackup.c
M src/include/access/xlog.h
A src/include/access/xlogbackup.h
M src/tools/pgindent/typedefs.list

Fix tupdesc lifespan bug with AfterTriggersTableData.storeslot.

commit   : 216f9c1ab3a4f333632ce576e1dc1e3643427eb8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2022 17:10:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2022 17:10:58 -0400    

Click here for diff

Commit 25936fd46 adjusted things so that the "storeslot" we use  
for remapping trigger tuples would have adequate lifespan, but it  
neglected to consider the lifespan of the tuple descriptor that  
the slot depends on.  It turns out that in at least some cases, the  
tupdesc we are passing is a refcounted tupdesc, and the refcount for  
the slot's reference can get assigned to a resource owner having  
different lifespan than the slot does.  That leads to an error like  
"tupdesc reference 0x7fdef236a1b8 is not owned by resource owner  
SubTransaction".  Worse, because of a second oversight in the same  
commit, we'd try to free the same tupdesc refcount again while  
cleaning up after that error, leading to recursive errors and an  
"ERRORDATA_STACK_SIZE exceeded" PANIC.  
  
To fix the initial problem, let's just make a non-refcounted copy  
of the tupdesc we're supposed to use.  That seems likely to guard  
against additional problems, since there's no strong reason for  
this code to assume that what it's given is a refcounted tupdesc;  
in which case there's an independent hazard of the tupdesc having  
shorter lifespan than the slot does.  (I didn't bother trying to  
free said copy, since it should go away anyway when the (sub)  
transaction context is cleaned up.)  
  
The other issue can be fixed by making the code added to  
AfterTriggerFreeQuery work like the rest of that function, ie be  
sure that it doesn't try to free the same slot twice in the event  
of recursive error cleanup.  
  
While here, also clean up minor stylistic issues in the test case  
added by 25936fd46: don't use "create or replace function", as any  
name collision within the tests is likely to have ill effects  
that that won't mask; and don't use function names as generic as  
trigger_function1, especially if you're not going to drop them  
at the end of the test stanza.  
  
Per bug #17607 from Thomas Mc Kay.  Back-patch to v12, as the  
previous fix was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Avoid loss of code coverage with unlogged-index test cases.

commit   : 1d2fec990c4dd6da8ffe5ca6b3c2aed2553197fb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2022 13:10:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2022 13:10:10 -0400    

Click here for diff

Commit 4fb5c794e intended to add coverage of some ambuildempty  
methods that were not getting reached, without removing any  
test coverage.  However, by changing a temp table to unlogged  
it managed to negate the intent of 4c51a2d1e, which means that  
we didn't have reliable test coverage of ginvacuum.c anymore.  
As things stand, much of that file might or might not get reached  
depending on timing, which seems pretty undesirable.  
  
Although this is only clearly broken for the GIN test, it seems  
best to revert 4fb5c794e altogether and instead add bespoke test  
cases covering unlogged indexes for these four AMs.  We don't  
need to do very much with them, so the extra tests are cheap.  
(Note that btree, hash, and bloom already have similar test cases,  
so they need no additional work.)  
  
We can also undo dec8ad367.  Since the testing deficiency that that  
hacked around was later fixed by 2f2e24d90, let's intentionally leave  
an unlogged table behind to improve test coverage in the modules that  
use the regression database for other test purposes.  (The case I used  
also leaves an unlogged sequence behind.)  
  
Per report from Alex Kozhemyakin.  Back-patch to v15 where the  
faulty test came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/brin.out
M src/test/regress/expected/gin.out
M src/test/regress/expected/gist.out
M src/test/regress/expected/spgist.out
M src/test/regress/sql/brin.sql
M src/test/regress/sql/gin.sql
M src/test/regress/sql/gist.sql
M src/test/regress/sql/spgist.sql

Add missing source files to pg_waldump/nls.mk

commit   : dda101315ad93e9b39c48eeb53b131d171d1fd0b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 25 Sep 2022 17:48:03 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 25 Sep 2022 17:48:03 +0200    

Click here for diff

M src/bin/pg_waldump/nls.mk

Message style improvements

commit   : 26f7802beb2a4aafa0903f5bedeb7f1fa6f4f358    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:38:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:38:35 -0400    

Click here for diff

M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_server.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/dbcommands.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeModifyTable.c
M src/backend/postmaster/pgarch.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walsender.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_xact.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/scripts/t/020_createdb.pl
M src/common/compression.c
M src/test/recovery/t/006_logical_decoding.pl
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/triggers.out
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/029_on_error.pl

Add read support for some missing raw parse nodes

commit   : a6bc3301925e1a8ad1f58da629b9dd55bc4b8d9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:18:33 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:18:33 -0400    

Click here for diff

The node types A_Const, Constraint, and A_Expr had custom output  
functions, but no read functions were implemented so far.  
  
The A_Expr output format had to be tweaked a bit to make it easier to  
parse.  
  
Be a bit more cautious about applying strncmp to unterminated strings.  
  
Also error out if an unrecognized enum value is found in each case,  
instead of just printing a placeholder value.  That was maybe ok for  
debugging but won't work if we want to have robust round-tripping.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/nodes/parsenodes.h

Fix reading of BitString nodes

commit   : 2cb1a5a8d4aeb63da2d6a2d22169f05c60bb5828    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:10:52 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:10:52 -0400    

Click here for diff

The node tokenizer went out of its way to store BitString node values  
without the leading 'b'.  But everything else in the system stores the  
leading 'b'.  This would break if a BitString node is  
read-printed-read.  
  
Also, the node tokenizer didn't know that BitString node tokens could  
also start with 'x'.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/read.c

Fix reading of most-negative integer value nodes

commit   : 43f4b349152d972c711592b8e8a4645aea9625f4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:10:11 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:10:11 -0400    

Click here for diff

The main parser checks whether a literal fits into an int when  
deciding whether it should be put into an Integer or Float node.  The  
parser processes integer literals without signs.  So a most-negative  
integer literal will not fit into Integer and will end up as a Float  
node.  
  
The node tokenizer did this differently.  It included the sign when  
checking whether the literal fit into int.  So a most-negative integer  
would indeed fit that way and end up as an Integer node.  
  
In order to preserve the node structure correctly, we need the node  
tokenizer to also analyze integer literals without sign.  
  
There are a number of test cases in the regression tests that have a  
most-negative integer argument of some utility statement, so this  
issue is easily reproduced under WRITE_READ_PARSE_PLAN_TREES.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/read.c

Remove uses of register due to incompatibility with C++17 and up

commit   : 03bf971d2dc701d473705fd00891028d140dd5ae    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 24 Sep 2022 12:01:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 24 Sep 2022 12:01:06 -0700    

Click here for diff

The use in regexec.c could remain, since we only try to keep headers C++  
clean. But there really doesn't seem to be a good reason to use register in  
that spot.  
  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml
M src/backend/regex/regexec.c
M src/include/port/atomics/arch-x86.h
M src/include/storage/s_lock.h

De-special-case pgevent's rc file handling

commit   : eef63941c127bcfbc278445b85cf3d9dd9e323b0    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 24 Sep 2022 12:04:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 24 Sep 2022 12:04:56 -0700    

Click here for diff

There's really no need to build win32ver.rc as part of building  
pgmsgevent.rc. This will make it sligthly easier to add rc file generation to  
the meson build.  

M src/bin/pgevent/Makefile
M src/bin/pgevent/pgmsgevent.rc
M src/tools/msvc/Mkvcbuild.pm

meson: Remove non-binary targets accidentally added to bin_targets

commit   : a075c616d22921fd90eafa852f140df9cd832209    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 24 Sep 2022 11:29:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 24 Sep 2022 11:29:29 -0700    

Click here for diff

M src/bin/psql/meson.build

Improve terminology

commit   : 6d6e1368722c664eef547d59ab23a29e555778c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Sep 2022 21:16:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Sep 2022 21:16:08 -0400    

Click here for diff

Use "prepared transaction" instead of "two-phrase transaction".  This  
is in line with 0e60a50e0bf158bead247731e00cee95bcf64daf.  

M doc/src/sgml/ref/pg_recvlogical.sgml
M src/bin/pg_basebackup/pg_recvlogical.c

Doc: minor cleanups.

commit   : 5f1048881d5f16475b76e168bfe962682c741fb5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 18:20:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 18:20:11 -0400    

Click here for diff

Improve a couple of things I noticed while working on v15  
release notes.  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/pgupgrade.sgml

pgstat: Fix transactional stats dropping for indexes

commit   : d811ce6ea343fa8a0b6b9cd7e9cddcbdaa27962b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 23 Sep 2022 13:00:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 23 Sep 2022 13:00:55 -0700    

Click here for diff

Because index creation does not go through heap_create_with_catalog() we  
didn't call pgstat_create_relation(), leading to index stats of a newly  
created realtion not getting dropped during rollback. To fix, move the  
pgstat_create_relation() to heap_create(), which indexes do use.  
  
Similarly, because dropping an index does not go through  
heap_drop_with_catalog(), we didn't drop index stats when the transaction  
dropping an index committed. Here there's no convenient common path for  
indexes and relations, so index_drop() now calls pgstat_drop_relation().  
  
Add tests for transactional index stats handling.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, like 8b1dccd37c71, which introduced the bug  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Remove PQsendQuery support in pipeline mode

commit   : 0032a5456708811ca95bd80a538f4fb72ad0dd20    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Sep 2022 18:21:22 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Sep 2022 18:21:22 +0200    

Click here for diff

The extended query protocol implementation I added in commit  
acb7e4eb6b1c has bugs when used in pipeline mode.  Rather than spend  
more time trying to fix it, remove that code and make the function rely  
on simple query protocol only, meaning it can no longer be used in  
pipeline mode.  
  
Users can easily change their applications to use PQsendQueryParams  
instead.  We leave PQsendQuery in place for Postgres 14, just in case  
somebody is using it and has not hit the mentioned bugs; but we should  
recommend that it not be used.  
  
Backpatch to 15.  
  
Per bug report from Gabriele Varrazzo.  
Discussion: https://postgr.es/m/CA+mi_8ZGSQNmW6-mk_iSR4JZB_LJ4ww3suOF+1vGNs3MrLsv4g@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c

Stop using PQsendQuery in libpq_pipeline

commit   : d11a41a4ce79660d1a1c5f81b051061717099a9f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Sep 2022 18:11:48 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Sep 2022 18:11:48 +0200    

Click here for diff

The "emulation" I wrote for PQsendQuery in pipeline mode to use extended  
query protocol, in commit acb7e4eb6b1c, is problematic.  Due to numerous  
bugs we'll soon remove it.  As a first step and for all branches back to  
14, stop using PQsendQuery in libpq_pipeline.  Also remove a few test  
lines that will no longer be relevant.  
  
Backpatch to 14.  
  
Discussion: https://postgr.es/m/CA+mi_8ZGSQNmW6-mk_iSR4JZB_LJ4ww3suOF+1vGNs3MrLsv4g@mail.gmail.com  

M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/traces/pipeline_abort.trace
M src/test/modules/libpq_pipeline/traces/pipeline_idle.trace

ci: freebsd: Set extra_{lib,include}_dirs to /usr/local/...

commit   : e3e6ee69641b8ea1e24f05ee64393a52e495bf86    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 22 Sep 2022 20:36:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 22 Sep 2022 20:36:28 -0700    

Click here for diff

Ommitted in e6b6ea025cc, but necessary for libintl to be found. All other  
dependencies can be found via pkg-config (which searches in /usr/local/...)  
and thus worked even without adding the directories.  

M .cirrus.yml

Allow publications with schema and table of the same schema.

commit   : 13a185f54ba594a5fb42bac3e1ecbdfd62b9041f    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 23 Sep 2022 08:21:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 23 Sep 2022 08:21:26 +0530    

Click here for diff

We previously thought that allowing such cases can confuse users when they  
specify DROP TABLES IN SCHEMA but that doesn't seem to be the case based  
on discussion. This helps to uplift the restriction during  
ALTER TABLE ... SET SCHEMA which used to ensure that we couldn't end up  
with a publication having both a schema and the same schema's table.  
  
To allow this, we need to forbid having any schema on a publication if  
column lists on a table are specified (and vice versa). This is because  
otherwise we still need a restriction during ALTER TABLE ... SET SCHEMA to  
forbid cases where it could lead to a publication having both a schema and  
the same schema's table with column list.  
  
Based on suggestions by Peter Eisentraut.  
  
Author: Hou Zhijie and Vignesh C  
Reviewed-By: Peter Smith, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/publication.sql
M src/test/subscription/t/028_row_filter.pl

Doc: adjust misleading phrasing of a few cross-references.

commit   : d89755dac6153518a601ca0fa9e489f2bc209fdc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Sep 2022 22:05:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Sep 2022 22:05:09 -0400    

Click here for diff

The pg_dump and pg_dumpall man pages referred to app-psql-patterns  
as appearing "below", which I suspect was copied-and-pasted from  
equivalent text in psql-ref.sgml rather than being actually thought  
through.  At least to me, that phrasing means "later in this same  
web page/section", which this link target is not.  Drop the  
misleading and unnecessary-in-any-case adjective.  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml

Harmonize parameter names in pg_dump/pg_dumpall.

commit   : 20e69daa1348f6899fffe3c260bf44293551ee87    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 22 Sep 2022 16:41:23 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 22 Sep 2022 16:41:23 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in pg_dump/pg_dumpall  
related code.  
  
Affected code happens to be inconsistent in how it applies conventions  
around how Archive and Archive Handle variables are named.  Significant  
code churn is required to fully fix those inconsistencies, so take the  
least invasive approach possible: treat function definition names as  
authoritative, and mechanically adjust corresponding names from function  
definitions to match.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzmma+vzcO6gr5NYDZ+sx0G14aU-UrzFutT2FoRaisVCUQ@mail.gmail.com  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c

Harmonize parameter names in contrib code.

commit   : 0faf7d933f625eb1668dcaa518b472f722b53a55    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 22 Sep 2022 13:59:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 22 Sep 2022 13:59:20 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in contrib code.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/intarray/_int.h
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/_int_tool.c
M contrib/ltree/ltree.h
M contrib/oid2name/oid2name.c
M contrib/pgcrypto/mbuf.h
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/pgp.h
M contrib/pgcrypto/px-crypt.h
M contrib/pgcrypto/px.h
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/seg/seg.c
M contrib/seg/segdata.h
M contrib/tablefunc/tablefunc.c
M contrib/test_decoding/test_decoding.c

Harmonize more lexer function parameter names.

commit   : 8fb4e001e9c185250a95b2b13880a2a04d626b75    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 22 Sep 2022 13:27:16 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 22 Sep 2022 13:27:16 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions for several "lexer  
adjacent" backend functions.  These were missed by commit aab06442.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/utils/adt/jsonpath_scan.l
M src/bin/pgbench/pgbench.h
M src/include/bootstrap/bootstrap.h
M src/include/parser/scanner.h
M src/include/replication/walsender_private.h
M src/test/isolation/isolationtester.h

Harmonize parameter names in ecpg code.

commit   : 3535ebce5dc542b90f14d6e81cce80fe7226bda5    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 22 Sep 2022 12:53:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 22 Sep 2022 12:53:20 -0700    

Click here for diff

Make ecpg function declarations consistently use named parameters.  Also  
make sure that the declarations use names that match corresponding names  
from function definitions.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/include/ecpg_informix.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/pgtypes_date.h
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/include/pgtypes_numeric.h
M src/interfaces/ecpg/include/pgtypes_timestamp.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/pgtypeslib_extern.h
M src/interfaces/ecpg/preproc/c_keywords.c
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c

Fix race condition where heap_delete() fails to pin VM page.

commit   : 163b0993a162ebae00fe5de8f593a5da28821a1b    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 22 Sep 2022 10:58:49 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 22 Sep 2022 10:58:49 -0700    

Click here for diff

Similar to 5f12bc94dc, the code must re-check PageIsAllVisible() after  
buffer lock is re-acquired. Backpatching to the same version, 12.  
  
Discussion: https://postgr.es/m/CAEP4nAw9jYQDKd_5Y+-s2E4YiUJq1vqiikFjYGpLShtp-K3gag@mail.gmail.com  
Reported-by: Robins Tharakan  
Reviewed-by: Robins Tharakan  
Backpatch-through: 12  

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

Remove ALL keyword from TABLES IN SCHEMA for publication

commit   : 790bf615ddba8a0ba3b870915d03438ce9cb7860    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Sep 2022 19:02:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Sep 2022 19:02:25 +0200    

Click here for diff

This may be a bit too subtle, but removing that word from there makes  
this clause no longer a perfect parallel of the GRANT variant "ALL  
TABLES IN SCHEMA": indeed, for publications what we record is the schema  
itself, not the tables therein, which means that any tables added to the  
schema in the future are also published.  This is completely different  
to what GRANT does, which is affect only the tables that exist when the  
command is executed.  
  
There isn't resounding support for this change, but there are a few  
positive votes and no opposition.  Because the time to 15 RC1 is very  
short, let's get this out now.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/2729c9e2-9aac-8cda-f2f4-34f2bcc18f4e  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/parser/gram.y
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/tab-complete.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/031_column_list.pl

Restore archive_command documentation

commit   : ba50834551f936719450a287c0d7f1d0d769e9c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Sep 2022 11:34:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Sep 2022 11:34:20 +0200    

Click here for diff

Commit 5ef1eefd76f404ddc59b885d50340e602b70f05f, which added  
archive_library, purged most mentions of archive_command from the  
documentation.  This is inappropriate, since archive_command is still  
a feature in use and users will want to see information about it.  
  
This restores all the removed mentions and rephrases things so that  
archive_command and archive_library are presented as alternatives of  
each other.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/wal.sgml

Use min/max bounds defined by Zstd for compression level

commit   : 18ac08f0b42de3cf35f07199c9f482746c8b12c0    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 20:02:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 20:02:40 +0900    

Click here for diff

The bounds hardcoded in compression.c since ffd5365 (minimum at 1 and  
maximum at 22) do not match the reality of what zstd is able to  
handle, these values being available via ZSTD_maxCLevel() and  
ZSTD_minCLevel() at run-time.  The maximum of 22 is actually correct  
in recent versions, but the minimum was not as the library can go down  
to -131720 by design.  This commit changes the code to use the run-time  
values in the code instead of some hardcoded ones.  
  
Zstd seems to assume that these bounds could change in the future, and  
Postgres will be able to adapt automatically to such changes thanks to  
what's being done in this commit.  
  
Reported-by: Justin Prysby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml
M src/common/compression.c

Fix thinko in comment.

commit   : cbe6dd17ac453fece214b2a430b354d4f7d5a15d    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 22 Sep 2022 15:55:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 22 Sep 2022 15:55:00 +0900    

Click here for diff

This comment has been wrong since its introduction in commit 0d5f05cde;  
backpatch to v12 where that came in.  
  
Discussion: https://postgr.es/m/CAPmGK14VGf-xQjGQN4o1QyAbXAaxugU5%3DqfcmTDh1iufUDnV_w%40mail.gmail.com  

M src/backend/commands/copyfrom.c

meson: ci: Convert some tasks to use meson

commit   : e6b6ea025cc0b6e5cdb7a3bf6d9275afdd861e51    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Sep 2022 21:53:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Sep 2022 21:53:18 -0700    

Click here for diff

The Windows task is changed to use meson as there currently is no way to run  
all tests in the old MSVC build system (only ninja is covered for now, we  
don't have enough CI resources to test msbuild as well).  
  
To maintain autoconf coverage, the Linux task is duplicated to test both meson  
and autoconf builds (linux is currently the fastest task). FreeBSD and macOS  
are also converted to meson, as it seems more important to have coverage for  
meson than autoconf.  
  
Author: Andres Freund <[email protected]>  
Author: Nazir Bilal Yavuz <[email protected]>  
Author: Justin Pryzby <[email protected]>  

M .cirrus.yml

meson: Add initial version of meson based build system

commit   : e6927270cd18d535b77cbe79c55c6584351524be    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Sep 2022 21:53:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Sep 2022 21:53:12 -0700    

Click here for diff

Autoconf is showing its age, fewer and fewer contributors know how to wrangle  
it. Recursive make has a lot of hard to resolve dependency issues and slow  
incremental rebuilds. Our home-grown MSVC build system is hard to maintain for  
developers not using Windows and runs tests serially. While these and other  
issues could individually be addressed with incremental improvements, together  
they seem best addressed by moving to a more modern build system.  
  
After evaluating different build system choices, we chose to use meson, to a  
good degree based on the adoption by other open source projects.  
  
We decided that it's more realistic to commit a relatively early version of  
the new build system and mature it in tree.  
  
This commit adds an initial version of a meson based build system. It supports  
building postgres on at least AIX, FreeBSD, Linux, macOS, NetBSD, OpenBSD,  
Solaris and Windows (however only gcc is supported on aix, solaris). For  
Windows/MSVC postgres can now be built with ninja (faster, particularly for  
incremental builds) and msbuild (supporting the visual studio GUI, but  
building slower).  
  
Several aspects (e.g. Windows rc file generation, PGXS compatibility, LLVM  
bitcode generation, documentation adjustments) are done in subsequent commits  
requiring further review. Other aspects (e.g. not installing test-only  
extensions) are not yet addressed.  
  
When building on Windows with msbuild, builds are slower when using a visual  
studio version older than 2019, because those versions do not support  
MultiToolTask, required by meson for intra-target parallelism.  
  
The plan is to remove the MSVC specific build system in src/tools/msvc soon  
after reaching feature parity. However, we're not planning to remove the  
autoconf/make build system in the near future. Likely we're going to keep at  
least the parts required for PGXS to keep working around until all supported  
versions build with meson.  
  
Some initial help for postgres developers is at  
https://wiki.postgresql.org/wiki/Meson  
  
With contributions from Thomas Munro, John Naylor, Stone Tickle and others.  
  
Author: Andres Freund <[email protected]>  
Author: Nazir Bilal Yavuz <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Reviewed-By: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

A config/meson.build
M configure
M configure.ac
A contrib/adminpack/meson.build
A contrib/amcheck/meson.build
A contrib/auth_delay/meson.build
A contrib/auto_explain/meson.build
A contrib/basebackup_to_shell/meson.build
A contrib/basic_archive/meson.build
A contrib/bloom/meson.build
A contrib/bool_plperl/meson.build
A contrib/btree_gin/meson.build
A contrib/btree_gist/meson.build
A contrib/citext/meson.build
A contrib/cube/meson.build
A contrib/dblink/meson.build
A contrib/dict_int/meson.build
A contrib/dict_xsyn/meson.build
A contrib/earthdistance/meson.build
A contrib/file_fdw/meson.build
A contrib/fuzzystrmatch/meson.build
A contrib/hstore/meson.build
A contrib/hstore_plperl/meson.build
A contrib/hstore_plpython/meson.build
A contrib/intagg/meson.build
A contrib/intarray/meson.build
A contrib/isn/meson.build
A contrib/jsonb_plperl/meson.build
A contrib/jsonb_plpython/meson.build
A contrib/lo/meson.build
A contrib/ltree/meson.build
A contrib/ltree_plpython/meson.build
A contrib/meson.build
A contrib/oid2name/meson.build
A contrib/old_snapshot/meson.build
A contrib/pageinspect/meson.build
A contrib/passwordcheck/meson.build
A contrib/pg_buffercache/meson.build
A contrib/pg_freespacemap/meson.build
A contrib/pg_prewarm/meson.build
A contrib/pg_stat_statements/meson.build
A contrib/pg_surgery/meson.build
A contrib/pg_trgm/meson.build
A contrib/pg_visibility/meson.build
A contrib/pg_walinspect/meson.build
A contrib/pgcrypto/meson.build
A contrib/pgrowlocks/meson.build
A contrib/pgstattuple/meson.build
A contrib/postgres_fdw/meson.build
A contrib/seg/meson.build
A contrib/sepgsql/meson.build
A contrib/spi/meson.build
A contrib/sslinfo/meson.build
A contrib/tablefunc/meson.build
A contrib/tcn/meson.build
A contrib/test_decoding/meson.build
A contrib/tsm_system_rows/meson.build
A contrib/tsm_system_time/meson.build
A contrib/unaccent/meson.build
A contrib/uuid-ossp/meson.build
A contrib/vacuumlo/meson.build
A contrib/xml2/meson.build
A doc/src/sgml/meson.build
A doc/src/sgml/version.sgml.in
A meson.build
A meson_options.txt
A src/backend/access/brin/meson.build
A src/backend/access/common/meson.build
A src/backend/access/gin/meson.build
A src/backend/access/gist/meson.build
A src/backend/access/hash/meson.build
A src/backend/access/heap/meson.build
A src/backend/access/index/meson.build
A src/backend/access/meson.build
A src/backend/access/nbtree/meson.build
A src/backend/access/rmgrdesc/meson.build
A src/backend/access/spgist/meson.build
A src/backend/access/table/meson.build
A src/backend/access/tablesample/meson.build
A src/backend/access/transam/meson.build
A src/backend/backup/meson.build
A src/backend/bootstrap/meson.build
A src/backend/catalog/meson.build
A src/backend/commands/meson.build
A src/backend/executor/meson.build
A src/backend/foreign/meson.build
A src/backend/jit/llvm/meson.build
A src/backend/jit/meson.build
A src/backend/lib/meson.build
A src/backend/libpq/meson.build
A src/backend/main/meson.build
A src/backend/meson.build
A src/backend/nodes/meson.build
A src/backend/optimizer/geqo/meson.build
A src/backend/optimizer/meson.build
A src/backend/optimizer/path/meson.build
A src/backend/optimizer/plan/meson.build
A src/backend/optimizer/prep/meson.build
A src/backend/optimizer/util/meson.build
A src/backend/parser/meson.build
A src/backend/partitioning/meson.build
A src/backend/po/meson.build
A src/backend/port/meson.build
A src/backend/port/win32/meson.build
A src/backend/postmaster/meson.build
A src/backend/regex/meson.build
A src/backend/replication/libpqwalreceiver/meson.build
A src/backend/replication/logical/meson.build
A src/backend/replication/meson.build
A src/backend/replication/pgoutput/meson.build
A src/backend/rewrite/meson.build
A src/backend/snowball/meson.build
A src/backend/statistics/meson.build
A src/backend/storage/buffer/meson.build
A src/backend/storage/file/meson.build
A src/backend/storage/freespace/meson.build
A src/backend/storage/ipc/meson.build
A src/backend/storage/large_object/meson.build
A src/backend/storage/lmgr/meson.build
A src/backend/storage/meson.build
A src/backend/storage/page/meson.build
A src/backend/storage/smgr/meson.build
A src/backend/storage/sync/meson.build
A src/backend/tcop/meson.build
A src/backend/tsearch/meson.build
A src/backend/utils/activity/meson.build
A src/backend/utils/adt/meson.build
A src/backend/utils/cache/meson.build
A src/backend/utils/error/meson.build
A src/backend/utils/fmgr/meson.build
A src/backend/utils/hash/meson.build
A src/backend/utils/init/meson.build
A src/backend/utils/mb/conversion_procs/meson.build
A src/backend/utils/mb/meson.build
A src/backend/utils/meson.build
A src/backend/utils/misc/meson.build
A src/backend/utils/mmgr/meson.build
A src/backend/utils/resowner/meson.build
A src/backend/utils/sort/meson.build
A src/backend/utils/time/meson.build
A src/bin/initdb/meson.build
A src/bin/initdb/po/meson.build
A src/bin/meson.build
A src/bin/pg_amcheck/meson.build
A src/bin/pg_amcheck/po/meson.build
A src/bin/pg_archivecleanup/meson.build
A src/bin/pg_archivecleanup/po/meson.build
A src/bin/pg_basebackup/meson.build
A src/bin/pg_basebackup/po/meson.build
A src/bin/pg_checksums/meson.build
A src/bin/pg_checksums/po/meson.build
A src/bin/pg_config/meson.build
A src/bin/pg_config/po/meson.build
A src/bin/pg_controldata/meson.build
A src/bin/pg_controldata/po/meson.build
A src/bin/pg_ctl/meson.build
A src/bin/pg_ctl/po/meson.build
A src/bin/pg_dump/meson.build
A src/bin/pg_dump/po/meson.build
A src/bin/pg_resetwal/meson.build
A src/bin/pg_resetwal/po/meson.build
A src/bin/pg_rewind/meson.build
A src/bin/pg_rewind/po/meson.build
A src/bin/pg_test_fsync/meson.build
A src/bin/pg_test_fsync/po/meson.build
A src/bin/pg_test_timing/meson.build
A src/bin/pg_test_timing/po/meson.build
A src/bin/pg_upgrade/meson.build
A src/bin/pg_upgrade/po/meson.build
A src/bin/pg_verifybackup/meson.build
A src/bin/pg_verifybackup/po/meson.build
A src/bin/pg_waldump/meson.build
A src/bin/pg_waldump/po/meson.build
A src/bin/pgbench/meson.build
A src/bin/pgevent/meson.build
A src/bin/psql/meson.build
A src/bin/psql/po/meson.build
A src/bin/scripts/meson.build
A src/bin/scripts/po/meson.build
A src/common/meson.build
A src/common/unicode/meson.build
A src/fe_utils/meson.build
A src/include/catalog/meson.build
A src/include/meson.build
A src/include/nodes/meson.build
A src/include/pg_config_ext.h.meson
A src/include/storage/meson.build
A src/include/utils/meson.build
A src/interfaces/ecpg/compatlib/meson.build
A src/interfaces/ecpg/ecpglib/meson.build
A src/interfaces/ecpg/ecpglib/po/meson.build
A src/interfaces/ecpg/include/meson.build
A src/interfaces/ecpg/meson.build
A src/interfaces/ecpg/pgtypeslib/meson.build
A src/interfaces/ecpg/preproc/meson.build
A src/interfaces/ecpg/preproc/po/meson.build
A src/interfaces/ecpg/test/compat_informix/meson.build
A src/interfaces/ecpg/test/compat_oracle/meson.build
A src/interfaces/ecpg/test/connect/meson.build
A src/interfaces/ecpg/test/meson.build
A src/interfaces/ecpg/test/pgtypeslib/meson.build
A src/interfaces/ecpg/test/preproc/meson.build
A src/interfaces/ecpg/test/sql/meson.build
A src/interfaces/ecpg/test/thread/meson.build
A src/interfaces/libpq/meson.build
A src/interfaces/libpq/po/meson.build
A src/interfaces/libpq/test/meson.build
A src/interfaces/meson.build
A src/meson.build
A src/pl/meson.build
A src/pl/plperl/meson.build
A src/pl/plperl/po/meson.build
A src/pl/plpgsql/meson.build
A src/pl/plpgsql/src/meson.build
A src/pl/plpgsql/src/po/meson.build
A src/pl/plpython/meson.build
A src/pl/plpython/po/meson.build
A src/pl/tcl/meson.build
A src/pl/tcl/po/meson.build
A src/port/meson.build
A src/test/authentication/meson.build
A src/test/icu/meson.build
A src/test/isolation/meson.build
A src/test/kerberos/meson.build
A src/test/ldap/meson.build
A src/test/meson.build
A src/test/modules/brin/meson.build
A src/test/modules/commit_ts/meson.build
A src/test/modules/delay_execution/meson.build
A src/test/modules/dummy_index_am/meson.build
A src/test/modules/dummy_seclabel/meson.build
A src/test/modules/libpq_pipeline/meson.build
A src/test/modules/meson.build
A src/test/modules/plsample/meson.build
A src/test/modules/snapshot_too_old/meson.build
A src/test/modules/spgist_name_ops/meson.build
A src/test/modules/ssl_passphrase_callback/meson.build
A src/test/modules/test_bloomfilter/meson.build
A src/test/modules/test_ddl_deparse/meson.build
A src/test/modules/test_extensions/meson.build
A src/test/modules/test_ginpostinglist/meson.build
A src/test/modules/test_integerset/meson.build
A src/test/modules/test_lfind/meson.build
A src/test/modules/test_misc/meson.build
A src/test/modules/test_oat_hooks/meson.build
A src/test/modules/test_parser/meson.build
A src/test/modules/test_pg_dump/meson.build
A src/test/modules/test_predtest/meson.build
A src/test/modules/test_rbtree/meson.build
A src/test/modules/test_regex/meson.build
A src/test/modules/test_rls_hooks/meson.build
A src/test/modules/test_shm_mq/meson.build
A src/test/modules/unsafe_tests/meson.build
A src/test/modules/worker_spi/meson.build
A src/test/perl/meson.build
A src/test/recovery/meson.build
A src/test/regress/meson.build
A src/test/ssl/meson.build
A src/test/subscription/meson.build
A src/timezone/meson.build
A src/timezone/tznames/meson.build
A src/tools/find_meson
A src/tools/gen_export.pl
A src/tools/pgflex
A src/tools/testwrap

Clear ps display of startup process at the end of recovery

commit   : fbb5f54b67c2f35c885d07daa26bce7e2eb6b0be    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 14:25:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 14:25:09 +0900    

Click here for diff

If the ps display is not cleared at this point, the process could  
continue displaying "recovering NNN" even if handling end-of-recovery  
steps.  df9274a has tackled that by providing some information with the  
end-of-recovery checkpoint but 7ff23c6 has nullified the effect of the  
first commit.  
  
Per a suggestion from Justin, just clear the ps display when we are done  
with recovery, so as no incorrect information is displayed.  This may  
get extended in the future, but for now restore the pre-7ff23c6  
behavior.  
  
Author: Justin Prysby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

docs: Fix snapshot name in SET TRANSACTION docs.

commit   : 2f636daac85b7bad608b24b475feceb7e3076ec6    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 22 Sep 2022 12:54:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 22 Sep 2022 12:54:26 +0900    

Click here for diff

Commit 6c2003f8a1 changed the snapshot names mentioned in  
SET TRANSACTION docs, however, there was one place that  
the commit missed updating the name.  
  
Back-patch to all supported versions.  
  
Author: Japin Li  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/MEYP282MB1669BD4280044501165F8B07B64F9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/set_transaction.sgml

Used optimized linear search in more code paths

commit   : 14ff44f80c09718d43d853363941457f5468cc03    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 09:47:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 09:47:28 +0900    

Click here for diff

This commit updates two code paths to use pg_lfind32() introduced by  
b6ef167 with TransactionId arrays:  
- At the end of TransactionIdIsInProgress(), when checking for the case  
of still running but overflowed subxids.  
- XidIsConcurrent(), when checking for a serializable conflict.  
  
These cases are less impactful than 37a6e5d, but a bit of  
micro-benchmarking of this API shows that linear search speeds up by  
~20% depending on the number of items involved (x86_64 and amd64 looked  
at here).  
  
Author: Nathan Bossart  
Reviewed-by: Richard Guo, Michael Paquier  
Discussion: https://postgr.es/m/20220901185153.GA783106@nathanxps13  

M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/predicate.c

psql: Improve tab-completion for MERGE.

commit   : 9a6915257d1d804ddba05331030b74d7426a4005    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 22 Sep 2022 09:25:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 22 Sep 2022 09:25:29 +0900    

Click here for diff

Commit 7103ebb7aa added the tab-completion for MERGE accidentally  
in the middle of that for LOCK TABLE. This commit fixes this issue.  
  
This also adds some tab-completion for MERGE.  
  
Back-patch to v15 where MERGE was introduced.  
  
Author: Kotaro Kawamoto, Fujii Masao  
Reviewed-by: Shinya Kato, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

ci: windows: set error mode to not include SEM_NOGPFAULTERRORBOX

commit   : 661ee7bfc661a4ba52ed57cff46e414b2add75b1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Sep 2022 17:15:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Sep 2022 17:15:54 -0700    

Click here for diff

Cirrus defaults to SetErrorMode(SEM_NOGPFAULTERRORBOX | ...). That prevents  
crash reporting from working unless binaries do SetErrorMode()  
themselves. Furthermore, it appears that either python or, more likely, the C  
runtime has a bug where SEM_NOGPFAULTERRORBOX can very occasionally *trigger*  
a crash on process exit - which is hard to debug, given that it explicitly  
prevents crash dumps from working...  
  
Discussion: https://postgr.es/m/20220909235836.lz3igxtkcjb5w7zb%40awork3.anarazel.de  
Backpatch: 15-, where CI was added  

M .cirrus.yml

ci: Increase requested memory size.

commit   : a3a3c1ea87804c9efddf53fc2e7793993630a034    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 22 Sep 2022 11:35:46 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 22 Sep 2022 11:35:46 +1200    

Click here for diff

CI builds recently started failing with:  
  
"Memory size for 4.0 vCPU instance should be between 3840MiB and  
26624MiB, while 2048MiB is requested."  
  
Ok then, let's ask for 4G instead of 2G.  
  
This may be due to a change in the type of instance used to work around  
an outage, per:  
  
https://twitter.com/cirrus_labs/status/1572657320093712384  

M .cirrus.yml

Harmonize lexer adjacent function parameter names.

commit   : aab06442d488364f8861219cb8864a16b6d0d4e4    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 21 Sep 2022 13:21:36 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 21 Sep 2022 13:21:36 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions for several "lexer  
adjacent" backend functions.  
  
These functions were missed by recent commits because they were obscured  
by clang-tidy warnings about functions whose signature is directly under  
the control of the lexer (flex seems to always generate function  
declarations with unnamed parameters).  We probably can't fix most of  
the warnings it generates for translation units that get built from .l  
and .y files, but we can at least do this much.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/bin/pgbench/exprparse.y
M src/include/replication/syncrep.h
M src/include/replication/walsender_private.h

Improve ICU option handling in CREATE DATABASE

commit   : e59a67fb8fe1ac1408dc1858038f525a860d772b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2022 10:28:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2022 10:28:40 -0400    

Click here for diff

We check that the ICU locale is only specified if the ICU locale  
provider is selected.  But we did that too early.  We need to wait  
until we load the settings of the template database, since that could  
also set what the locale provider is.  
  
Reported-by: Marina Polyakova <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/dbcommands.c
M src/bin/scripts/t/020_createdb.pl

Tighten pg_get_object_address argument checking

commit   : 2da8c4cff39328897aa716a0ba57bdada5aeaf6e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2022 09:34:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2022 09:34:22 -0400    

Click here for diff

For publication schemas (OBJECT_PUBLICATION_NAMESPACE) and user  
mappings (OBJECT_USER_MAPPING), pg_get_object_address() checked the  
array length of the second argument, but not of the first argument.  
If the first argument was too long, it would just silently ignore  
everything but the first argument.  Fix that by checking the length of  
the first argument as well.  
  
Reviewed-by: Amit Kapila <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/caaef70b-a874-1088-92ef-5ac38269c33b%40enterprisedb.com  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Improve some GUC description strings

commit   : 3d4e841a076379663ae714d1d1c7eee11c638063    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Sep 2022 12:29:38 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Sep 2022 12:29:38 +0200    

Click here for diff

It is not our usual style to use "we" in messages.  Also, remove some  
noise words.  Backpatch to 15.  
  
Noted by Kyotaro Horiguchi.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Pass Size as a 2nd argument for snprintf() in tablesync.c.

commit   : a932824dfe068f563e9abb9264f6e071f23e67ae    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 21 Sep 2022 10:20:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 21 Sep 2022 10:20:37 +0530    

Click here for diff

Previously the following snprintf() wrappers:  
  
* ReplicationSlotNameForTablesync()  
* ReplicationOriginNameForTablesync()  
  
... used int as a second argument of snprintf() while the actual type of it  
is size_t. Although it doesn't fail at present better replace it with Size  
for consistency with the rest of the system.  
  
Author: Aleksander Alekseev  
Reviewed-By: Peter Smith  
Discussion: https://postgr.es/m/CAHut%2BPsa8hhfSE6ozUK-ih7GkQziAVAf4f3bqiXEj2nQiu-43g%40mail.gmail.com  

M src/backend/replication/logical/tablesync.c
M src/include/replication/slot.h
M src/include/replication/worker_internal.h

Improve some error messages.

commit   : 6971a839ccdf1131ddf1fa2fa405cba43cd68608    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 21 Sep 2022 09:43:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 21 Sep 2022 09:43:59 +0530    

Click here for diff

It is not our usual style to use "we" in the error messages.  
  
Author: Kyotaro Horiguchi  
Reviewed-By: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

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

Use \b in one more PG_TEST_EXTRA check, oversight in c3382a3c3cc

commit   : 3f0c901e744c87f6e00744e63afe0242d5fe45e9    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Sep 2022 18:11:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Sep 2022 18:11:10 -0700    

Click here for diff

Per off-list report from Thomas Munro.  

M src/test/ssl/t/001_ssltests.pl

Add definition pg_attribute_aligned() for MSVC

commit   : ec3c9cc202fb2749fce82483e6dc247cfe286cab    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 21 Sep 2022 10:11:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 21 Sep 2022 10:11:23 +0900    

Click here for diff

Visual Studio 2015+ has support for a macro to control the alignement of  
structures as of __declspec(align(#)), and this commit adds a definition  
of pg_attribute_aligned() based on that.  It happens that this was  
already used in the implementation of atomics for MSVC.  Note that there  
is still no definition fo pg_attribute_packed(), so this does not impact  
itemptr.h.  
  
Author: James Coleman  
Discussion: https://postgr.es/m/CAAaqYe-HbtZvR3msoMtk+hYW2S0e0OapzMW8icSMYTMA+mN8Aw@mail.gmail.com  

M config/c-compiler.m4
M configure
M src/include/c.h
M src/include/port/atomics/generic-msvc.h

Revise tree-walk APIs to improve spec compliance & silence warnings.

commit   : 1c27d16e6e5c1f463bbe1e9ece88dda811235165    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Sep 2022 18:03:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Sep 2022 18:03:22 -0400    

Click here for diff

expression_tree_walker and allied functions have traditionally  
declared their callback functions as, say, "bool (*walker) ()"  
to allow for variation in the declared types of the callback  
functions' context argument.  This is apparently going to be  
forbidden by the next version of the C standard, and the latest  
version of clang warns about that.  In any case it's always  
been pretty poor for error-detection purposes, so fixing it is  
a good thing to do.  
  
What we want to do is change the callback argument declarations to  
be like "bool (*walker) (Node *node, void *context)", which is  
correct so far as expression_tree_walker and friends are concerned,  
but not change the actual callback functions.  Strict compliance with  
the C standard would require changing them to declare their arguments  
as "void *context" and then cast to the appropriate context struct  
type internally.  That'd be very invasive and it would also introduce  
a bunch of opportunities for future bugs, since we'd no longer have  
any check that the correct sort of context object is passed by outside  
callers or internal recursion cases.  Therefore, we're just going  
to ignore the standard's position that "void *" isn't necessarily  
compatible with struct pointers.  No machine built in the last forty  
or so years actually behaves that way, so it's not worth introducing  
bug hazards for compatibility with long-dead hardware.  
  
Therefore, to silence these compiler warnings, introduce a layer of  
macro wrappers that cast the supplied function name to the official  
argument type.  Thanks to our use of -Wcast-function-type, this will  
still produce a warning if the supplied function is seriously  
incompatible with the required signature, without going as far as  
the official spec restriction does.  
  
This method fixes the problem without any need for source code changes  
outside nodeFuncs.h/.c.  However, it is an ABI break because the  
physically called functions now have names ending in "_impl".  Hence  
we can only fix it this way in HEAD.  In the back branches, we'll have  
to settle for disabling -Wdeprecated-non-prototype.  
  
Discussion: https://postgr.es/m/CA+hUKGKpHPDTv67Y+s6yiC8KH5OXeDg6a-twWo_xznKTcG0kSA@mail.gmail.com  

M src/backend/nodes/nodeFuncs.c
M src/include/nodes/nodeFuncs.h

Fix recent cpluspluscheck issue in selfuncs.h.

commit   : eccb607e19993483e25966abae895277599f77a2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 20 Sep 2022 14:08:57 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 20 Sep 2022 14:08:57 -0700    

Click here for diff

Fix selfuncs.h cpluspluscheck complaint, without reintroducing a  
parameter name inconsistency (restore the original declaration names,  
and then make corresponding function definitions consistent with that).  
  
Oversight in commit a601366a.  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Andres Freund <[email protected]>  

M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Harmonize more parameter names in bulk.

commit   : a601366a460f68472bf70c4d94c57baa0a3ed1b2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 20 Sep 2022 13:09:30 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 20 Sep 2022 13:09:30 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in optimizer, parser,  
utility, libpq, and "commands" code, as well as in remaining library  
code.  Do the same for all code related to frontend programs (with the  
exception of pg_dump/pg_dumpall related code).  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  Later commits will handle  
ecpg and pg_dump/pg_dumpall.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/backup/basebackup.c
M src/backend/bootstrap/bootstrap.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/lib/dshash.c
M src/backend/lib/integerset.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/postmaster/postmaster.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/queryjumble.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/initdb.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_waldump/compat.c
M src/bin/pgbench/pgbench.h
M src/bin/psql/describe.h
M src/bin/scripts/common.h
M src/fe_utils/cancel.c
M src/include/bootstrap/bootstrap.h
M src/include/commands/alter.h
M src/include/commands/conversioncmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/common/fe_memutils.h
M src/include/common/kwlookup.h
M src/include/common/scram-common.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/parallel_slot.h
M src/include/fe_utils/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/libpq/pqmq.h
M src/include/nodes/extensible.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/pg_list.h
M src/include/nodes/value.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h
M src/include/optimizer/prep.h
M src/include/parser/analyze.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_relation.h
M src/include/partitioning/partbounds.h
M src/include/pgstat.h
M src/include/pgtime.h
M src/include/port.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/syslogger.h
M src/include/rewrite/rewriteManip.h
M src/include/snowball/libstemmer/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/tcop/cmdtag.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/attoptcache.h
M src/include/utils/builtins.h
M src/include/utils/datetime.h
M src/include/utils/jsonb.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/pgstat_internal.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/relcache.h
M src/include/utils/relmapper.h
M src/include/utils/selfuncs.h
M src/include/utils/snapmgr.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/xml.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
M src/pl/plpgsql/src/pl_exec.c

Refactor PG_TEST_EXTRA logic in autoconf build

commit   : c3382a3c3ccda6df126c95bf37dcc762480c5202    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Sep 2022 11:09:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Sep 2022 11:09:30 -0700    

Click here for diff

To avoid duplicating the PG_TEST_EXTRA logic in Makefiles into the upcoming  
meson based build definition, move the checks into the the tests  
themselves. That also has the advantage of making skipped tests visible.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Author: Nazir Bilal Yavuz <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl

Improve comment for OAT_POST_CREATE.

commit   : bb44a6ba48edfe1ac8bca87b1f2cfdcd9f86c930    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 20 Sep 2022 10:41:34 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 20 Sep 2022 10:41:34 -0700    

Click here for diff

Clarify that the command counter may or may not have been incremented.  
  
We may want to change the behavior to be more consistent, but until  
that time, at least improve the comment.  
  
Discussion: https://postgr.es/m/CAHoZxqvN2eoic_CvjsAvpryyLyA2xG8JmsyMtKFFJz_1oFhfOg%40mail.gmail.com  
Reported-by: Mary Xu  

M src/include/catalog/objectaccess.h

Fix `trap` in a few shell scripts

commit   : 3d53b9ef1a4cda7b6303a0496f8531eceeef0e77    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Sep 2022 18:50:16 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Sep 2022 18:50:16 +0200    

Click here for diff

The original `trap` lines in these scripts are incomplete: in case of  
any signal, they delete the working directory but let the script run to  
completion, which is useless because it will only proceed to complain  
about the working directory being removed.  Add `exit` there, with the  
original exit value (not rm's).  
  
Since this is mostly just cosmetic, no backpatch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/find_static
M src/tools/make_ctags
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck
M src/tools/pgtest

Suppress variable-set-but-not-used warnings from clang 15.

commit   : 152c9f7b8f01437780d9f87bfe945bba47efdd0a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Sep 2022 12:04:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Sep 2022 12:04:37 -0400    

Click here for diff

clang 15+ will issue a set-but-not-used warning when the only  
use of a variable is in autoincrements (e.g., "foo++;").  
That's perfectly sensible, but it detects a few more cases that  
we'd not noticed before.  Silence the warnings with our usual  
methods, such as PG_USED_FOR_ASSERTS_ONLY, or in one case by  
actually removing a useless variable.  
  
One thing that we can't nicely get rid of is that with %pure-parser,  
Bison emits "yynerrs" as a local variable that falls foul of this  
warning.  To silence those, I inserted "(void) yynerrs;" in the  
top-level productions of affected grammars.  
  
Per recently-established project policy, this is a candidate  
for back-patching into out-of-support branches: it suppresses  
annoying compiler warnings but changes no behavior.  Hence,  
back-patch to 9.5, which is as far as these patches go without  
issues.  (A preliminary check shows that the prior branches  
need some other set-but-not-used cleanups too, so I'll leave  
them for another day.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gist/gistxlog.c
M src/backend/access/transam/xlog.c
M src/backend/parser/gram.y
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/jsonpath_gram.y
M src/bin/pgbench/exprparse.y

Disable autovacuum in MERGE test script

commit   : c9a21fea44ca5722dbfcced0dfdc84db063aff71    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Sep 2022 12:38:48 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Sep 2022 12:38:48 +0200    

Click here for diff

Otherwise, it can fail given sufficient bad luck.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Fix parameter name for pg_create_logical_replication_slot()

commit   : 6f0dad88b2eff56e1ddada983f27427250b8a3c3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Sep 2022 19:28:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Sep 2022 19:28:37 +0900    

Click here for diff

The parameter controlling if two-phase transactions can be decoded was  
named "two_phase" in the documentation while its procedure defines  
"twophase".  
  
Author: Florin Irion  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M doc/src/sgml/func.sgml

Fix incorrect variable types for origin IDs in decode.c

commit   : e9123197c844a3a7fe20d723477fcdbef5b89f93    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Sep 2022 18:13:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Sep 2022 18:13:00 +0900    

Click here for diff

These variables used XLogRecPtr instead of RepOriginId.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoBm-vNyBSXGp4bmJGvhr=S-EGc5q1dtV70cFTcJvLhC=Q@mail.gmail.com  
Backpatch-through: 14  

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

Harmonize parameter names in storage and AM code.

commit   : bfcf1b34805f70df48eedeec237230d0cc1154a6    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 19:18:36 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 19:18:36 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in storage, catalog,  
access method, executor, and logical replication code, as well as in  
miscellaneous utility/library code.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  Later commits will do the  
same for other parts of the codebase.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/transam/generic_xlog.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/xlogreader.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/commands/dbcommands.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeMemoize.c
M src/backend/lib/bloomfilter.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/buffile.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/reloptions.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/twophase.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogutils.h
M src/include/catalog/dependency.h
M src/include/catalog/index.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_publication.h
M src/include/commands/copy.h
M src/include/commands/dbcommands_xlog.h
M src/include/executor/execParallel.h
M src/include/executor/executor.h
M src/include/executor/nodeIncrementalSort.h
M src/include/executor/spi.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/replication/logical.h
M src/include/replication/logicalproto.h
M src/include/replication/origin.h
M src/include/replication/slot.h
M src/include/replication/walsender.h
M src/include/storage/barrier.h
M src/include/storage/bufpage.h
M src/include/storage/dsm.h
M src/include/storage/fd.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/lwlock.h
M src/include/storage/predicate.h
M src/include/storage/procarray.h
M src/include/storage/standby.h

Split TESTDIR into TESTLOGDIR and TESTDATADIR

commit   : c47885bd8b6997ccb0cc1997f61f6f98a79ce32a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 19 Sep 2022 18:03:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 19 Sep 2022 18:03:17 -0700    

Click here for diff

The motivation for this is twofold. For one the meson patchset would like to  
have more control over the logfiles. For another, the log file location for  
tap tests (tmp_check/log) is not symmetric to the log location for  
pg_regress/isolation tests (log/).  
  
This commit does not change the default location for log files for tap tests,  
as that'd break the buildfarm log collection, it just provides the  
infrastructure for doing so.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/bin/psql/t/010_tab_completion.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/tools/msvc/vcregress.pl

Don't hardcode tmp_check/ as test directory for tap tests

commit   : bb54bf22900f76dab6899594d47f55d62e912143    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 19 Sep 2022 18:00:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 19 Sep 2022 18:00:50 -0700    

Click here for diff

This is motivated by the meson patchset, which wants to put the log / data for  
tests in a different place than the autoconf build. Right now log files for  
tap tests have to be inside $TESTDIR/tmp_check, whereas log files for  
pg_regress/isolationtester are outside of tmp_check. This change doesn't fix  
the latter, but is a prerequisite.  
  
The only test that needs adjustment is 010_tab_completion.pl, as it hardcoded  
the tmp_check/ directory. Instead create a dedicated directory for the test  
files.  It's also a bit cleaner independently, because it doesn't intermingle  
the test files with more important things like the log/ directory.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/bin/psql/t/010_tab_completion.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/tools/msvc/vcregress.pl

Harmonize heapam and tableam parameter names.

commit   : 4bac9600f09a9b9ba7daa3ba69495a877f51e6c3    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 16:46:23 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 16:46:23 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions.  Having parameter names  
that are reliably consistent in this way will make it easier to reason  
about groups of related C functions from the same translation unit as a  
module.  It will also make certain refactoring tasks easier.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  Later commits will do the  
same for other parts of the codebase.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/access/common/heaptuple.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/multixact.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/htup_details.h
M src/include/access/multixact.h
M src/include/access/rewriteheap.h
M src/include/access/tableam.h
M src/include/commands/cluster.h
M src/include/replication/snapbuild.h

Consistently use named parameters in regex code consistently.

commit   : cb8ff7ed5ac907a4a574413f3e46a3522d7b164c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 15:47:04 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 15:47:04 -0700    

Click here for diff

Adjust a handful of remaining function prototypes that were overlooked  
by recent commit bc2187ed.  This oversight wasn't caught by clang-tidy  
because the functions in question are only built in custom REG_DEBUG  
builds.  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Tom Lane <[email protected]>  

M src/backend/regex/regcomp.c

Extend gendef.pl in preparation for meson

commit   : 70df2df1cc89e69e31b31b6aa0d65fd72935af38    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 19 Sep 2022 15:34:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 19 Sep 2022 15:34:50 -0700    

Click here for diff

The main issue with using gendef.pl as-is for meson is that with meson the  
filenames are a bit longer, exceeding the max commandline length when calling  
dumpbin with all objects. As it's easier to pass in a library anyway, do so.  
  
The .def file location, input and temporary file location need to be tunable  
as well.  
  
This also fixes a bug in gendef.pl: The logic when to regenerate was broken  
and never avoid regenerating.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/gendef.pl

Update Unicode data to Unicode 15.0.0

commit   : 1091b48cd761abc7f697fa9c4e018c46763b46fb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 18:30:05 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 18:30:05 -0400    

Click here for diff

M src/Makefile.global.in
M src/include/common/unicode_east_asian_fw_table.h
M src/include/common/unicode_nonspacing_table.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/unicode_normprops_table.h

Consistently use named parameters in timezone code.

commit   : c4f8e89fef3d4cd8b0791637667fd984d6f38fb2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 15:13:42 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 15:13:42 -0700    

Click here for diff

Make our copy of the IANA timezone library use named parameters in  
function declarations.  Also make sure that parameter names from each  
function's declaration match corresponding definition parameter names.  
  
This makes the timezone code follow Postgres coding standards.  The  
value of having a consistent standard everywhere seems to outweigh the  
cost of keeping the function declarations in sync with future IANA  
releases.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/timezone/localtime.c
M src/timezone/pgtz.c
M src/timezone/strftime.c
M src/timezone/zic.c

Consistently use named parameters in regex code.

commit   : bc2187ed63c56bb9cd99f6613f3e2ba56afb22fe    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 15:10:24 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Sep 2022 15:10:24 -0700    

Click here for diff

Make regex code consistently use named parameters in function  
declarations.  Also make sure that parameter names from each function's  
declaration match corresponding definition parameter names.  
  
This makes Henry Spencer's regex code follow Postgres coding standards.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/regex/regcomp.c
M src/backend/regex/regexec.c
M src/backend/utils/adt/regexp.c
M src/include/regex/regex.h
M src/test/modules/test_regex/test_regex.c

Fix misleading comment for get_cheapest_group_keys_order

commit   : 55b4966365fa76bda275c409f3aefad43243f12c    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 10:03:26 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 10:03:26 +1200    

Click here for diff

The header comment for get_cheapest_group_keys_order() claimed that the  
output arguments were set to a newly allocated list which may be freed by  
the calling function, however, this was not always true as the function  
would simply leave these arguments untouched in some cases.  
  
This tripped me up when working on 1349d2790 as I mistakenly assumed I  
could perform a list_concat with the output parameters.  That turned out  
bad due to list_concat modifying the original input lists.  
  
In passing, make it more clear that the number of distinct values is  
important to reduce tiebreaks during sorts.  Also, explain what the  
n_preordered parameter means.  
  
Backpatch-through: 15, where get_cheapest_group_keys_order was introduced.  

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

Fix out-dated comment in preprocess_groupclause()

commit   : 78a9af1a27641ad983354bbaaaa4b7c00ea390f6    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 09:13:49 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 09:13:49 +1200    

Click here for diff

The comment claimed we don't consider other orders of the GROUP BY clause,  
but this is no longer true as of db0d67db2.  
  
Discussion: https://postgr.es/m/CAApHDvq65=9Ro+hLX1i9ugWEiNDvHrBibAO7ARcTnf38_JE+UQ@mail.gmail.com  
Backpatch-through: 15, where db0d67db2 was introduced.  

M src/backend/optimizer/plan/planner.c

Remove various duplicated words

commit   : 66fa8ff637982b51257d80626dd00dccf3ad9fa6    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 08:37:02 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 08:37:02 +1200    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_replslot.c
M src/test/ssl/t/SSL/Server.pm

Fix icu tests with C locale

commit   : cab3ce7a065b8ec04303d680a64bd9aa9bdd29db    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 15:22:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 15:22:43 -0400    

Click here for diff

Similar to 1e08576691bf1a25c0e28745e5e800c44f2a1c76, but for the icu  
test suite.  
  
Reported-by: Christoph Berg <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/icu/t/010_database.pl

Make ALTER DEFAULT PRIVILEGES require privileges, not membership.

commit   : 48a257d444a787941ba3da24d65e6cbe31461d0a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2022 14:21:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2022 14:21:59 -0400    

Click here for diff

If role A is a direct or indirect member of role B but does not inherit  
B's privileges (because at least one relevant grant was created WITH  
INHERIT FALSE) then A should not be permitted to bypass privilege  
checks that require the privileges of B. For example, A can't change  
the privileges of objects owned by B, nor can A drop those objects.  
  
However, up until now, it's been possible for A to change default  
privileges for role B. That doesn't seem to be correct, because a  
non-inherited role grant is only supposed to permit you to assume  
the identity of the granted role via SET ROLE, and should not  
otherwise permit you to exercise the privileges of that role. Most  
places followed that rule, but this case was an exception.  
  
This could be construed as a security vulnerability, but it does not  
seem entirely clear cut, since older branches were fuzzy about the  
distinction between is_member_of_role() and has_privs_of_role() in  
a number of other ways as well. Because of this, and because  
user-visible behavior changes in minor releases are to be avoided  
whenever possible, no back-patch.  
  
Discussion: http://postgr.es/m/CA+TgmobG_YUP06R_PM_2Z7wR0qv_52gQPHD8CYXbJva0cf0E+A@mail.gmail.com  

M src/backend/catalog/aclchk.c

walmethods.c/h: Make WalWriteMethod more object-oriented.

commit   : ebfb814f7ce0d5ab6f47f0b86db51a1b8f3342f4    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2022 12:53:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2022 12:53:46 -0400    

Click here for diff

Normally when we use object-oriented programming techniques, we  
provide a pointer to an object and then some way of looking up the  
associated table of callbacks, but walmethods.c/h took the alternative  
approach of providing only a pointer to the table of callbacks and  
thus imposed the artificial restriction that there could only ever be  
one object of each type, so that the callbacks could find it via a  
global variable. That doesn't seem like the right idea, so revise the  
approach.  
  
Each callback which does not already have an argument of type  
Walfile * now takes a pointer to the relevant WalWriteMethod *  
so that these callbacks need not rely on there being only one  
object of each type.  
  
Freeing a WalWriteMethod is now performed via a callback provided  
for that purpose rather than requiring the caller to know which  
WAL method they want to free.  
  
Discussion: http://postgr.es/m/CA+TgmoZS0Kw98fOoAcGz8B9iDhdqB4Be4e=vDZaJZ5A-xMYBqA@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Future-proof the recursion inside ExecShutdownNode().

commit   : c35ba141de1fa04373671ba24c73eb0fe4862415    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Sep 2022 12:16:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Sep 2022 12:16:02 -0400    

Click here for diff

The API contract for planstate_tree_walker() callbacks is that they  
take a PlanState pointer and a context pointer.  Somebody figured  
they could save a couple lines of code by ignoring that, and passing  
ExecShutdownNode itself as the walker even though it has but one  
argument.  Somewhat remarkably, we've gotten away with that so far.  
However, it seems clear that the upcoming C2x standard means to  
forbid such cases, and compilers that actively break such code  
likely won't be far behind.  So spend the extra few lines of code  
to do it honestly with a separate walker function.  
  
In HEAD, we might as well go further and remove ExecShutdownNode's  
useless return value.  I left that as-is in back branches though,  
to forestall complaints about ABI breakage.  
  
Back-patch, with the thought that this might become of practical  
importance before our stable branches are all out of service.  
It doesn't seem to be fixing any live bug on any currently known  
platform, however.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/execProcnode.c
M src/include/executor/executor.h

walmethods.c/h: Make Walfile a struct, rather than a void *

commit   : 4fd14794945e60c4aedad84b06ff1e2a7a6236f0    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2022 11:20:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Sep 2022 11:20:18 -0400    

Click here for diff

This makes the curent file position and pathname visible in a generic  
way, so we no longer need current_walfile_name global variable or the  
get_current_pos() method. Since that purported to be able to fail but  
never actually did, this also lets us get rid of some unnecessary  
error-handling code.  
  
One risk of this change is that the get_current_pos() method  
previously cleared the error indicator, and that will no longer happen  
with the new approach. I looked for a way that this could cause problems  
and did not find one.  
  
The previous code was confused about whether "Walfile" was the  
implementation-dependent structure representing a WAL file or  
whether it was a pointer to that stucture. Some of the code used it  
one way, and some in the other. The compiler tolerated that because  
void * is interchangeable with void **, but now that Walfile is a  
struct, it's necessary to be consistent. Hence, some references to  
"Walfile" have been converted to "Walfile *".  
  
Discussion: http://postgr.es/m/CA+TgmoZS0Kw98fOoAcGz8B9iDhdqB4Be4e=vDZaJZ5A-xMYBqA@mail.gmail.com  

M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Add missing serial commas

commit   : 1fe1d09652d796392785922bef54e0ffda6e1f05    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 06:35:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 06:35:01 -0400    

Click here for diff

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c

Fix typos.

commit   : a23417790631e50f54bdcf5e40bf84e2dbd1c34b    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 19 Sep 2022 14:21:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 19 Sep 2022 14:21:39 +0530    

Click here for diff

Author: Hou Zhijie and Zhang Mingli  
Discussion: https://postgr.es/m/OS0PR01MB57162559C01FE2848C12E8F7944D9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/runtime.sgml
M src/backend/catalog/pg_attrdef.c
M src/backend/replication/logical/decode.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Fix typos referring to PGPROC

commit   : 08f8af983a8bd8ef78e48bab624071998a26cbb7    
  
author   : John Naylor <[email protected]>    
date     : Mon, 19 Sep 2022 11:36:51 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 19 Sep 2022 11:36:51 +0700    

Click here for diff

Japin Li  
  
Reviewed by Kyotaro Horiguchi  
Discussion: https://www.postgresql.org/message-id/MEYP282MB1669459813B36FB5EAA38434B6499@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/access/transam/README
M src/backend/access/transam/xact.c

Harmonize missed reorderbuffer parameter names.

commit   : f66d997fd024223a78ebf64bf42f98f639b0b942    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 18 Sep 2022 12:05:07 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 18 Sep 2022 12:05:07 -0700    

Click here for diff

The function ReorderBufferCommitChild() was overlooked by initial work  
from commit 035ce1fe.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkhzFESnRo+VaGqyEZuzc33Dw09BdZBVmW896Sa22ci_A@mail.gmail.com  

M src/include/replication/reorderbuffer.h

Remove unused argument "isSlice" from transformAssignmentSubscripts()

commit   : 9f65aaa408f60081a057f559b717100b55511698    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 18 Sep 2022 15:33:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 18 Sep 2022 15:33:16 +0900    

Click here for diff

Since c7aba7c, the transform method used during parse analysis of a  
subcripting construct has moved from transformAssignmentSubscripts() to  
the per-type transform method (arrays or arbitrary types) the step that  
checks for slicing support, but transformAssignmentSubscripts() has kept  
traces of it.  Removing it simplifies the code, so let's clean up all  
that.  
  
Author: Zhang Mingli  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/0d7041ac-c704-48ad-86fd-e05feddf08ed@Spark  

M src/backend/parser/parse_target.c

Harmonize reorderbuffer parameter names.

commit   : 035ce1feb2ed27680558ebc5cd1455041c8ec3cf    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 17 Sep 2022 17:20:17 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 17 Sep 2022 17:20:17 -0700    

Click here for diff

Make reorderbuffer.h function declarations consistently use named  
parameters.  Also make sure that the declarations use names that match  
corresponding names from function definitions in reorderbuffer.c.  This  
makes the definitions easier to follow, especially in the case of  
functions that happen to have adjoining arguments of the same type.  
  
This patch was written with help from clang-tidy.  Specifically, its  
"readability-inconsistent-declaration-parameter-name" check and its  
"readability-named-parameter" check were used.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Make check_usermap() parameter names consistent.

commit   : 4274dc223ce75b2adf7b7cde5e00df7bbdd2a061    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 17 Sep 2022 16:54:17 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 17 Sep 2022 16:54:17 -0700    

Click here for diff

The function has a bool argument named "case_insensitive", but that was  
spelled "case_sensitive" in the declaration.  Make them consistent now  
to avoid confusion in the future.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Michael Paquiër <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  
Backpatch: 10-  

M src/include/libpq/hba.h

Include c.h instead of postgres.h in src/port/*p{read,write}*.c

commit   : 43fcaa345d5af45101c5d96dd164f1ebed686b2c    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 17 Sep 2022 09:21:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 17 Sep 2022 09:21:59 -0700    

Click here for diff

Frontend code shouldn't include postgres.h. Some files in src/port/ need to  
include postgres.h/postgres_fe.h, but these files don't.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where 3fd2a7932ef introduced (some) of these files  

M src/port/preadv.c
M src/port/pwritev.c
M src/port/win32pread.c
M src/port/win32pwrite.c

Remove DLLTOOL, DLLWRAP from configure / Makefile.global.in

commit   : 8d513a6b71b7ad94331a485adaf00adce8ee74ec    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 17 Sep 2022 09:15:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 17 Sep 2022 09:15:12 -0700    

Click here for diff

We got rid of the need for them in 4f5f485d10c and 846e91e0223.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/Makefile.global.in

pgstat: Create memory contexts below TopMemoryContext

commit   : 9d3ebba729ebaf5882a92f0f5f662a3312037605    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Sep 2022 14:08:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Sep 2022 14:08:40 -0700    

Click here for diff

So far they were created below CacheMemoryContext. However, that's not  
guaranteed to exist in all situations, leading to memory contexts created as  
top-level contexts. There isn't actually a good reason anymore to create them  
below CacheMemoryContext, so just creating them below TopMemoryContext seems  
the best approach.  
  
Reported-by: Reid Thompson <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Author: "Drouvot, Bertrand" <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-  

M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c

Fix huge_pages on Windows

commit   : fdd8937c071e85e2b7606939fb28284f008e15d1    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 17 Sep 2022 15:39:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 17 Sep 2022 15:39:55 +0900    

Click here for diff

Since Windows 10 1703, it is additionally necessary to pass a flag  
called FILE_MAP_LARGE_PAGES to MapViewOfFile() to enable large pages at  
map time.  This flag is ignored on older versions of Windows, where  
large pages should still be able to work properly without setting it.  
Note that the flag would be set only for binaries that knew about it at  
compile-time, which should be more or less all the Windows environments  
these days.  
  
Since 495ed0e, Windows 10 is the minimum version of Windows supported by  
Postgres, making this change easy to reason about on HEAD.  Per  
discussion, no backpatch is done for the moment.  
  
Reported-by: Okano Naoki  
Author: Thomas Munro  
Reviewed-by: Tom Lane, Michael Paquier, Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c

Message style improvements

commit   : a0b65155d04e3d78e1ee92d5e3c6c340c7c6b286    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Sep 2022 08:10:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Sep 2022 08:10:59 +0200    

Click here for diff

M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_target.c

Fix race condition in stats.sql added in 5264add7847

commit   : 32914d900f90f7f5238a3856e67f6bc5bf05e1d9    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Sep 2022 10:07:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Sep 2022 10:07:12 -0700    

Click here for diff

Very occasionally the stats test failed due to the number of sessions not  
being updated yet. Likely this requires that there is contention on the  
database's stats entry. Solve this by forcing pending stats to be flushed  
before fetching the stats.  
  
I verified that there are no other test failures after making  
pgstat_report_stat() only flush stats when force = true.  
  
Per message from Tom Lane and buildfarm member crake.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where 5264add7847 added the test  

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

Improve plpgsql's ability to handle arguments declared as RECORD.

commit   : bfd6b3bc4e19db19289ae92a17799edae2cdd5f3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Sep 2022 13:23:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Sep 2022 13:23:01 -0400    

Click here for diff

Treat arguments declared as RECORD as if that were a polymorphic type  
(which it is, sort of), in that we substitute the actual argument type  
while forming the function cache lookup key.  This allows the specific  
composite type to be known in some cases where it was not before,  
at the cost of making a separate function cache entry for each named  
composite type that's passed to the function during a session.  The  
particular symptom discussed in bug #17610 could be solved in other  
more-efficient ways, but only at the cost of considerable development  
work, and there are other cases where we'd still fail without this.  
  
Per bug #17610 from Martin Jurča.  Back-patch to v11 where we first  
allowed plpgsql functions to be declared as taking type RECORD.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/sql/plpgsql_record.sql

aix: xlc: Use -Wl,-b,expfull for old compiler versions

commit   : d08a049db9b47c32f3e7b6985a3105cae0da3681    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 13 Sep 2022 10:55:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 13 Sep 2022 10:55:03 -0700    

Click here for diff

Unfortunately xlc 12.1 and earlier don't support -qvisibility. Therefore  
be7c15b194a doesn't suffice to make extension libraries work without the  
explicit mkldexport step removed in fe6a64a58ab. While 12.1 is EOL, there is  
some desire to leave buildfarm animals using it run a bit longer. But instead  
of adding back the complicated mkldexport step, we can use -Wl,-b,expfull to  
force all symbols to be exported.  
  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

Clean up minor inconsistencies in pg_attribute_printf() usage.

commit   : eacbe94ab1f46d94a8532f9b9ac83ccd98cc1287    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Sep 2022 11:10:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Sep 2022 11:10:48 -0400    

Click here for diff

For some reason we'd never decorated pg_v*printf() with  
pg_attribute_printf() annotations.  There is a convention for  
how to label va_list-using printf functions (write zero for the  
second argument), and we use that liberally elsewhere in the  
code, but these core functions lacked it.  It's not clear how  
much useful checking the compiler can do for calls of these,  
but we might as well add the annotations.  
  
Also, sync win32security.c's log_error() with our normal convention  
that pg_attribute_printf must be attached to a function's declaration  
not definition.  Apparently this file is only compiled with compilers  
that aren't picky about that, but still it'd be better to be  
consistent.  
  
No back-patch since there's little reason to think we would catch  
anything.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port.h
M src/port/win32security.c

Message wording improvements

commit   : b2451385cbb40f930838f6cd86c244912590a7d2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 16:37:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 16:37:53 +0200    

Click here for diff

M doc/src/sgml/logical-replication.sgml
M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/030_origin.pl

postgres_fdw: Remove useless DO block in test

commit   : 32b507378fac179717f093c78a0e70371fbdf514    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 15:57:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 15:57:34 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Adjust assorted hint messages that list all valid options.

commit   : 5ac51c8c9e4434140f4ba45b7bdb38896b48cc64    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 14:51:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 14:51:47 +0200    

Click here for diff

Instead of listing all valid options, we now try to provide one  
that looks similar.  Since this may be useful elsewhere, this  
change introduces a new set of functions that can be reused for  
similar purposes.  
  
Author: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M src/backend/foreign/foreign.c
M src/backend/utils/adt/varlena.c
M src/include/utils/varlena.h
M src/test/regress/expected/foreign_data.out

Fix createdb tests for C locale

commit   : 1e08576691bf1a25c0e28745e5e800c44f2a1c76    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 11:10:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 11:10:41 +0200    

Click here for diff

If the createdb tests run under the C locale, the database cluster  
will be initialized with encoding SQL_ASCII.  With the checks added in  
c7db01e325a530ec38ec7ba57cd3ed32e123e33c, this will cause several  
ICU-related tests to fail because SQL_ASCII is not supported by ICU.  
To work around that, use initdb option -E UTF8 for those tests to get  
past that check.  

M src/bin/scripts/t/020_createdb.pl

Don't allow creation of database with ICU locale with unsupported encoding

commit   : c7db01e325a530ec38ec7ba57cd3ed32e123e33c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 09:37:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 09:37:54 +0200    

Click here for diff

Check in CREATE DATABASE and initdb that the selected encoding is  
supported by ICU.  Before, they would pass but users would later get  
an error from the server when they tried to use the database.  
  
Also document that initdb sets the encoding to UTF8 by default if the  
ICU locale provider is chosen.  
  
Author: Marina Polyakova <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/ref/initdb.sgml
M src/backend/commands/dbcommands.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/scripts/t/020_createdb.pl

Detect format-string mistakes in the libpq_pipeline test module.

commit   : cf2c7a736e4939ff0d6cf2acd29b17eea3bca7c2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Sep 2022 17:17:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Sep 2022 17:17:53 -0400    

Click here for diff

I happened to notice that libpq_pipeline's private implementation  
of pg_fatal lacked any pg_attribute_printf decoration.  Indeed,  
adding that turned up a mistake!  We'd likely never have noticed  
because the error exits in this code are unlikely to get hit,  
but still, it's a bug.  
  
We're so used to having the compiler check this stuff for us that  
a printf-like function without pg_attribute_printf is a land mine.  
I wonder if there is a way to detect such omissions.  
  
Back-patch to v14 where this code came in.  

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

Copy-edit docs for logical replication column lists

commit   : 3a06a79cd137d294bc82d931769d778c8c9aec91    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Sep 2022 18:04:00 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Sep 2022 18:04:00 +0200    

Click here for diff

There was a excessive structure, leading to somewhat disorganized  
presentation of the information. Remove a few tags and reorder  
paragraphs to make the text flow more easily.  Also, reword some of it  
to be more concise.  
  
The bit about column list combination is not modified, other than to  
remove an uninteresting (and IMO confusing and wrong) paragraph; I  
intend to deal with it differently afterwards.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert ill-considered change in pg_resetwal output.

commit   : 918de37652138da7f7e54c79351178367d60f501    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Sep 2022 10:58:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Sep 2022 10:58:03 -0400    

Click here for diff

Commit 31dcfae83 changed one pg_resetwal output string, and a  
corresponding test in pg_upgrade, without sufficient thought for  
the consequences.  We can't change that output without creating  
hazards for cross-version upgrades, since pg_upgrade needs to be able  
to read the output of several different versions of pg_resetwal.  
There may well be external tools with the same requirement.  
  
For the moment, just revert those two changes.  What we really  
ought to do here is have a separate, stable, easily machine-readable  
output format for pg_resetwal and pg_controldata, as proposed  
years ago by Alvaro.  Once that's in place and tools no longer  
need to depend on the exact spelling of the human-readable output,  
we can put back this change.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/controldata.c

Reset InstallXLogFileSegmentActive after walreceiver self-initiated exit.

commit   : b4f584f9d2a1b50d1f5ce88408a54bb11f1c8353    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 15 Sep 2022 06:45:23 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 15 Sep 2022 06:45:23 -0700    

Click here for diff

After commit cc2c7d65fc27e877c9f407587b0b92d46cd6dd16 added this flag,  
failure to reset it caused assertion failures.  In non-assert builds, it  
made the system fail to achieve the objectives listed in that commit;  
chiefly, we might emit a spurious log message.  Back-patch to v15, where  
that commit first appeared.  
  
Bharath Rupireddy and Kyotaro Horiguchi.  Reviewed by Dilip Kumar,  
Nathan Bossart and Michael Paquier.  Reported by Dilip Kumar.  
  
Discussion: https://postgr.es/m/CAFiTN-sE3ry=ycMPVtC+Djw4Fd7gbUGVv_qqw6qfzp=JLvqT3g@mail.gmail.com  

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

Fix grammar in error message

commit   : 7beda87b6a4e5eae66f06df313581f7f53cab813    
  
author   : John Naylor <[email protected]>    
date     : Thu, 15 Sep 2022 11:40:17 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 15 Sep 2022 11:40:17 +0700    

Click here for diff

While at it, make ellipses formatting consistent when describing SQL statements.  
  
Ekaterina Kiryanova and Alexander Lakhin  
  
Reviewed by myself and Álvaro Herrera  
Discussion: https://www.postgresql.org/message-id/eed5cec0-a542-53da-6a5e-7789c6ed9817%40postgrespro.ru  
Backpatch only the grammar fix to v15  

M src/backend/commands/subscriptioncmds.c
M src/backend/postmaster/bgworker.c
M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Blind attempt to fix LLVM dependency in the backend

commit   : 16492df70bb25bc99ca3c340a75ba84ca64171b8    
  
author   : John Naylor <[email protected]>    
date     : Thu, 15 Sep 2022 10:24:55 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 15 Sep 2022 10:24:55 +0700    

Click here for diff

Commit ecaf7c5df5 removed gram.h from the backend's generated-headers  
target. In LLVM builds, this leads to loss of dependency information  
when generating .bc files. To fix, add a rule that mirrors ad-hoc .o  
dependencies for .bc files as well.  
  
Per cfbot (no buildfarm failures reported)  
Analysis by Tom Lane and Andres Freund  
Proposed fix by Andres Freund  
Discussion: https://www.postgresql.org/message-id/20220914210427.y26tkagmxo5wwbvp%40awork3.anarazel.de  

M src/backend/common.mk

Use the terminology "WAL file" not "log file" more consistently.

commit   : 31dcfae83c001c6cdfd1e67c11adb9149f564da0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2022 18:40:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2022 18:40:58 -0400    

Click here for diff

Referring to the WAL as just "log" invites confusion with the  
postmaster log, so avoid doing that in docs and error messages.  
Also shorten "WAL segment file" to just "WAL file" in various  
places.  
  
Bharath Rupireddy, reviewed by Nathan Bossart and Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/CALj2ACUeXa8tDPaiTLexBDMZ7hgvaN+RTb957-cn5qwv9zf-MQ@mail.gmail.com  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/walreceiver.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_waldump/pg_waldump.c

Fix outdated convert_saop_to_hashed_saop comment

commit   : 63840526b05c5c12c92cb16be8748e4d20e6eab6    
  
author   : David Rowley <[email protected]>    
date     : Thu, 15 Sep 2022 09:40:34 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 15 Sep 2022 09:40:34 +1200    

Click here for diff

In 29f45e299, we added support for optimizing the execution of NOT  
IN(values) by using a hash table instead of a linear search over the  
array.  That commit neglected to update the header comment for  
convert_saop_to_hashed_saop() to mention this fact.  Here we fix that.  
  
Author: James Coleman  
Discussion: https://postgr.es/m/CAAaqYe99NUpAPcxgchGstgM23fmiGjqQPot8627YgkBgNt=BfA@mail.gmail.com  
Backpatch-through: 15, where 29f45e299 was added.  

M src/backend/optimizer/util/clauses.c

Small wording improvements

commit   : 111d954024c8f4e6d8d273d8e7c1d64d14435bf5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 22:30:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 22:30:51 +0200    

Click here for diff

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc_tables.c

Doc: add some doco about using the libpq_pipeline test module.

commit   : f40346ff0bae6ac9d00f3ae80d3a214e64662a2d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2022 16:43:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2022 16:43:19 -0400    

Click here for diff

The README file here was barely a stub.  Try to make it useful.  
  
Jelte Fennema, with some further work by me  
  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M src/test/modules/libpq_pipeline/README

pgcrypto: Remove unused code

commit   : 1d3566f1b2a8cf518ec26322023d243b288a90aa    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 14 Sep 2022 21:58:30 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 14 Sep 2022 21:58:30 +0200    

Click here for diff

The mbuf_tell, mbuf_rewind and pgp_get_cipher_name functions were  
introduced in commit e94dd6ab91, but were never used, so remove.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/mbuf.h
M contrib/pgcrypto/pgp.c
M contrib/pgcrypto/pgp.h

Update .gitignore

commit   : 5f84647ee1b25532cf5ea06801a4f36706a0cb96    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 21:55:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 21:55:28 +0200    

Click here for diff

Add entry for ab393528fa4b2486237ee7aa51fac67f82fee824.  Remove one  
obsolete entry.  

M doc/src/sgml/.gitignore

Use SIGNAL_ARGS consistently to declare signal handlers.

commit   : b66fbd8afe6eb80e3e48495e002fda9aa92df583    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2022 14:44:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Sep 2022 14:44:45 -0400    

Click here for diff

Various bits of code were declaring signal handlers manually,  
using "int signum" or variants of that.  We evidently have no  
platforms where that's actually wrong, but let's use our  
SIGNAL_ARGS macro everywhere anyway.  If nothing else, it's  
good for finding signal handlers easily.  
  
No need for back-patch, since this is just cosmetic AFAICS.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/pmsignal.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/port.h
M src/test/regress/pg_regress.c

Run xmllint validation only once

commit   : ab393528fa4b2486237ee7aa51fac67f82fee824    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 17:55:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 17:55:22 +0200    

Click here for diff

Before, each documentation target that built something from  
postgres.sgml ran xmllint first to validate the input.  Here, we  
change it so that the validation only runs once and produces an output  
file, and all the other targets build from that output file.  This  
avoids redundant work when building multiple documentation targets  
(such as html and man).  
  
Also, when we run xmllint, we can resolve entities (included files).  
This helps with tools that don't support vpath builds, such as  
dbtoepub.  
  
All this also organizes the make targets a bit better for implementing  
equivalent steps in meson.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/Makefile
M doc/src/sgml/standalone-install.xml

Handle SIGTERM in pg_receivewal and pg_recvlogical

commit   : 8b60db774356117fab2eb53fb37160fa3e173cdb    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 14 Sep 2022 16:32:24 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 14 Sep 2022 16:32:24 +0200    

Click here for diff

In pg_receivewal, compressed output is only flushed on clean exits.  The  
reason to support SIGTERM as well as SIGINT (which is currently handled)  
is that pg_receivewal might well be running as a daemon, and systemd's  
default KillSignal is SIGTERM.  
  
Since pg_recvlogical is also supposed to run as a daemon, teach it about  
SIGTERM as well and update the documentation to match.  While in there,  
change pg_receivewal's time_to_stop to be sig_atomic_t like it is in  
pg_recvlogical.  
  
Author: Christoph Berg <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/Yvo/[email protected]  

M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c

Add subxid-overflow "isolation" test

commit   : 0e733278e346f19df93843bce9a81c8183df6e1d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 14 Sep 2022 15:17:23 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 14 Sep 2022 15:17:23 +0200    

Click here for diff

This test covers a few lines of subxid-overflow-handling code in various  
part of the backend, which are otherwise uncovered.  
  
Author: Simon Riggs <[email protected]>  
Reviewed-by: Dilip Kumar <[email protected]>  
Discussion: https://postgr.es/m/CANbhV-H8ov5+nCMBYQFKhO+UZJjrFgY_ORiMWr3RhS4+x44PzA@mail.gmail.com  

M src/include/storage/proc.h
A src/test/isolation/expected/subxid-overflow.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/subxid-overflow.spec

Remove duplicate initialization

commit   : 3fd1f4b9cd1e374e76e23dd37dfd6ab03b6ef935    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 14 Sep 2022 15:36:21 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 14 Sep 2022 15:36:21 +0200    

Click here for diff

This appears to be a merge mistake in 96ef3237bf74.  We could put it  
back the way it was before JSON_TABLE and it'd be two lines shorter, but  
it's likely that JSON_TABLE will be back and will prefer things this  
way.  It makes no other difference in practice.  
  
Backpatch to 15.  
  
Reported by Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAr4nOcNQskC4oBEZN4S+4heJ=1ch_ZKOxU+_Ef-FQSf-g@mail.gmail.com  

M src/backend/parser/parse_relation.c

postgres_fdw: Avoid 'variable not found in subplan target list' error.

commit   : 9320cfdd06e5975b7bf60ab4c3d03195bf3fb5ff    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 14 Sep 2022 18:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 14 Sep 2022 18:45:00 +0900    

Click here for diff

The tlist of the EvalPlanQual outer plan for a ForeignScan node is  
adjusted to produce a tuple whose descriptor matches the scan tuple slot  
for the ForeignScan node.  But in the case where the outer plan contains  
an extra Sort node, if the new tlist contained columns required only for  
evaluating PlaceHolderVars or columns required only for evaluating local  
conditions, this would cause setrefs.c to fail with the error.  
  
The cause of this is that when creating the outer plan by injecting the  
Sort node into an alternative local join plan that could emit such extra  
columns as well, we fail to arrange for the outer plan to propagate them  
up through the Sort node, causing setrefs.c to fail to match up them in  
the new tlist to what is available from the outer plan.  Repair.  
  
Per report from Alexander Pyhalov.  
  
Richard Guo and Etsuro Fujita, reviewed by Alexander Pyhalov and Tom Lane.  
Backpatch to all supported versions.  
  
Discussion: http://postgr.es/m/cfb17bf6dfdf876467bd5ef533852d18%40postgrespro.ru  

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

Fix failure to build gramparse.h standalone in vpath builds

commit   : b0526d271d16d54064666d30bbfa53d4f335c66d    
  
author   : John Naylor <[email protected]>    
date     : Wed, 14 Sep 2022 14:33:35 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 14 Sep 2022 14:33:35 +0700    

Click here for diff

Add include directory in a similar fashion as 829906fb6c.  
  
Per buildfarm animal crake  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Fix incorrect value for "strategy" with deflateParams() in walmethods.c

commit   : b447d6075db8041b870ac526525f6873df222db4    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Sep 2022 14:52:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Sep 2022 14:52:20 +0900    

Click here for diff

The zlib documentation mentions the values supported for the compression  
strategy, but this code has been using a hardcoded value of 0 rather  
than Z_DEFAULT_STRATEGY.  This commit adjusts the code to use  
Z_DEFAULT_STRATEGY.  
  
Backpatch down to where this code has been added to ease the backport of  
any future patch touching this area.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/bin/pg_basebackup/walmethods.c

Fix typo in pgbench.c.

commit   : d583036d68d6fe2fa7facd63eb6548583094fa96    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 14 Sep 2022 11:09:48 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 14 Sep 2022 11:09:48 +0530    

Click here for diff

Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Bump minimum Perl version to 5.14

commit   : 4c1532763a00c21cbb737bc3855e9a31374b119d    
  
author   : John Naylor <[email protected]>    
date     : Wed, 14 Sep 2022 09:58:13 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 14 Sep 2022 09:58:13 +0700    

Click here for diff

The oldest vendor-shipped Perl in the buildfarm is 5.14.2, which is  
the last version that Debian Wheezy shipped. That OS is EOL, but we  
keep it running because there is no other convenient way to test certain  
non-mainstream 32-bit platforms. There is no bugfix in the 5.14.2 release  
that is required, and yet it's also not the latest minor release --  
that would be 5.14.4. To clarify the situation, we have thus arranged the  
buildfarm to test 5.14.0. That allows configure scripts and documentation  
to state 5.14 without fine print.  
  
The MSVC build didn't check the version, since our previous minimum 5.8.3  
was considered too old to check for on Windows. We will need a check for  
Windows sometime during the v16 cycle, but that could be rendered moot  
by the impending Meson conversion, so it seems safe to just document  
the requirement for now.  
  
Reviewed by Tom Lane  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M config/perl.m4
M configure
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/pl/plperl/plc_perlboot.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/README
M src/tools/msvc/gendef.pl
M src/tools/pgindent/pgindent

Move gramparse.h to src/backend/parser

commit   : ecaf7c5df54f7fa9df2fdc7225d2bb4e283f0081    
  
author   : John Naylor <[email protected]>    
date     : Wed, 14 Sep 2022 10:41:44 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 14 Sep 2022 10:41:44 +0700    

Click here for diff

This header is semi-private, being used only in files related to  
raw parsing, so move to the backend directory where those files  
live. This allows removal of Makefile rules that symlink gram.h to  
src/include/parser, since gramparse.h can now include gram.h from  
within the same directory. This has the side-effect of no longer  
installing gram.h and gramparse.h, but there doesn't seem to be a  
good reason to continue doing so.  
  
Per suggestion from Andres Freund and Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/20220904181759.px6uosll6zbxcum5%40awork3.anarazel.de  

M src/backend/Makefile
M src/backend/parser/gram.y
R097 src/include/parser/gramparse.h src/backend/parser/gramparse.h
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/include/Makefile
D src/include/parser/.gitignore
M src/tools/msvc/Install.pm
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Simplify handling of compression level with compression specifications

commit   : f352e2d08ac048d7407dd6098fc6b344ff85c2dd    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Sep 2022 12:16:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Sep 2022 12:16:57 +0900    

Click here for diff

PG_COMPRESSION_OPTION_LEVEL is removed from the compression  
specification logic, and instead the compression level is always  
assigned with each library's default if nothing is directly given.  This  
centralizes the checks on the compression methods supported by a given  
build, and always assigns a default compression level when parsing a  
compression specification.  This results in complaining at an earlier  
stage than previously if a build supports a compression method or not,  
aka when parsing a specification in the backend or the frontend, and not  
when processing it.  zstd, lz4 and zlib are able to handle in their  
respective routines setting up the compression level the case of a  
default value, hence the backend or frontend code (pg_receivewal or  
pg_basebackup) has now no need to know what the default compression  
level should be if nothing is specified: the logic is now done so as the  
specification parsing assigns it.  It can also be enforced by passing  
down a "level" set to the default value, that the backend will accept  
(the replication protocol is for example able to handle a command like  
BASE_BACKUP (COMPRESSION_DETAIL 'gzip:level=-1')).  
  
This code simplification fixes an issue with pg_basebackup --gzip  
introduced by ffd5365, where the tarball of the streamed WAL segments  
would be created as of pg_wal.tar.gz with uncompressed contents, while  
the intention is to compress the segments with gzip at a default level.  
The origin of the confusion comes from the handling of the default  
compression level of gzip (-1 or Z_DEFAULT_COMPRESSION) and the value of  
0 was getting assigned, which is what walmethods.c would consider  
as equivalent to no compression when streaming WAL segments with its tar  
methods.  Assigning always the compression level removes the confusion  
of some code paths considering a value of 0 set in a specification as  
either no compression or a default compression level.  
  
Note that 010_pg_basebackup.pl has to be adjusted to skip a few tests  
where the shape of the compression detail string for client and  
server-side compression was checked using gzip.  This is a result of the  
code simplification, as gzip specifications cannot be used if a build  
does not support it.  
  
Reported-by: Tom Lane  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
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/common/compression.c
M src/include/common/compression.h

Split up guc.c for better build speed and ease of maintenance.

commit   : 0a20ff54f5e66158930d5328f89f087d4e9ab400    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Sep 2022 11:05:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Sep 2022 11:05:07 -0400    

Click here for diff

guc.c has grown to be one of our largest .c files, making it  
a bottleneck for compilation.  It's also acquired a bunch of  
knowledge that'd be better kept elsewhere, because of our not  
very good habit of putting variable-specific check hooks here.  
Hence, split it up along these lines:  
  
* guc.c itself retains just the core GUC housekeeping mechanisms.  
* New file guc_funcs.c contains the SET/SHOW interfaces and some  
  SQL-accessible functions for GUC manipulation.  
* New file guc_tables.c contains the data arrays that define the  
  built-in GUC variables, along with some already-exported constant  
  tables.  
* GUC check/assign/show hook functions are moved to the variable's  
  home module, whenever that's clearly identifiable.  A few hard-  
  to-classify hooks ended up in commands/variable.c, which was  
  already a home for miscellaneous GUC hook functions.  
  
To avoid cluttering a lot more header files with #include "guc.h",  
I also invented a new header file utils/guc_hooks.h and put all  
the GUC hook functions' declarations there, regardless of their  
originating module.  That allowed removal of #include "guc.h"  
from some existing headers.  The fallout from that (hopefully  
all caught here) demonstrates clearly why such inclusions are  
best minimized: there are a lot of files that, for example,  
were getting array.h at two or more levels of remove, despite  
not having any connection at all to GUCs in themselves.  
  
There is some very minor code beautification here, such as  
renaming a couple of inconsistently-named hook functions  
and improving some comments.  But mostly this just moves  
code from point A to point B and deals with the ensuing  
needs for #include adjustments and exporting a few functions  
that previously weren't exported.  
  
Patch by me, per a suggestion from Andres Freund; thanks also  
to Michael Paquier for the idea to invent guc_funcs.c.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/_ltree_op.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree_gist.c
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/brin/brin.c
M src/backend/access/table/tableamapi.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/variable.c
M src/backend/libpq/pqcomm.c
M src/backend/partitioning/partbounds.c
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/predicate.c
M src/backend/tcop/postgres.c
M src/backend/tsearch/dict.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/error/elog.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/Makefile
M src/backend/utils/misc/guc.c
A src/backend/utils/misc/guc_funcs.c
A src/backend/utils/misc/guc_tables.c
M src/include/access/tableam.h
M src/include/access/xlog.h
D src/include/commands/variable.h
M src/include/replication/syncrep.h
M src/include/tcop/tcopprot.h
M src/include/tsearch/ts_cache.h
M src/include/utils/elog.h
M src/include/utils/guc.h
A src/include/utils/guc_hooks.h
M src/include/utils/guc_tables.h
M src/include/utils/pg_locale.h
M src/test/regress/regress.c

Don't reflect unescaped cert data to the logs

commit   : 257eb57b50f7c65467bfc2f4d579622fa13f3370    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Sep 2022 16:10:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Sep 2022 16:10:50 +0200    

Click here for diff

Commit 3a0e385048 introduced a new path for unauthenticated bytes from  
the client certificate to be printed unescaped to the logs. There are a  
handful of these already, but it doesn't make sense to keep making the  
problem worse. \x-escape any unprintable bytes.  
  
The test case introduces a revoked UTF-8 certificate. This requires the  
addition of the `-utf8` flag to `openssl req`. Since the existing  
certificates all use an ASCII subset, this won't modify the existing  
certificates' subjects if/when they get regenerated; this was verified  
experimentally with  
  
    $ make sslfiles-clean  
    $ make sslfiles  
  
Unfortunately the test can't be run in the CI yet due to a test timing  
issue; see 55828a6b60.  
  
Author: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAAWbhmgsvHrH9wLU2kYc3pOi1KSenHSLAHBbCVmmddW6-mc_=w@mail.gmail.com  

M src/backend/libpq/be-secure-openssl.c
A src/test/ssl/conf/client-revoked-utf8.config
M src/test/ssl/ssl/client-crldir/9bb9e3c3.r0
A src/test/ssl/ssl/client-revoked-utf8.crt
A src/test/ssl/ssl/client-revoked-utf8.key
M src/test/ssl/ssl/client.crl
M src/test/ssl/ssl/root+client-crldir/9bb9e3c3.r0
M src/test/ssl/ssl/root+client.crl
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm

pg_clean_ascii(): escape bytes rather than lose them

commit   : 45b1a67a0fcb3f1588df596431871de4c93cb76f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Sep 2022 16:10:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Sep 2022 16:10:44 +0200    

Click here for diff

Rather than replace each unprintable byte with a '?' character, replace  
it with a hex escape instead. The API now allocates a copy rather than  
modifying the input in place.  
  
Author: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAAWbhmgsvHrH9wLU2kYc3pOi1KSenHSLAHBbCVmmddW6-mc_=w@mail.gmail.com  

M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/guc.c
M src/common/string.c
M src/include/common/string.h

Make locale option behavior more consistent

commit   : da5d4ea5aaac4fc02f2e2aec272efe438dd4e171    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Sep 2022 14:18:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Sep 2022 14:18:45 +0200    

Click here for diff

Locale options can be specified for initdb, createdb, and CREATE  
DATABASE.  In initdb, it has always been possible to specify --locale  
and then some --lc-* option to override a category.  CREATE DATABASE  
and createdb didn't allow that, requiring either the all-categories  
option or only per-category options.  In  
f2553d43060edb210b36c63187d52a632448e1d2, this was changed in CREATE  
DATABASE (perhaps by accident?) to be more like the initdb behavior,  
but createdb still had the old behavior.  
  
Now we change createdb to match the behavior of CREATE DATABASE and  
initdb, and also update the documentation of CREATE DATABASE to match  
the new behavior, which was not done in the above commit.  
  
Author: Marina Polyakova <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/ref/create_database.sgml
M src/bin/scripts/createdb.c

Improve wal_decode_buffer_size description some more

commit   : 8e7a0b4a36741934d1350de5646efd2f3a10951e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 13 Sep 2022 12:02:56 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 13 Sep 2022 12:02:56 +0200    

Click here for diff

Per Thomas Munro  
  
Discussion: https://postgr.es/m/CA+hUKGJ9wP9kpvgoxHvqA=4g1d9-y_w3LhhdhFVU=mFiqjwHww@mail.gmail.com  

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

Remove useless pstrdups in untransformRelOptions

commit   : 6710e83a675eda798544fea4cdcb89eef7f39403    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 13 Sep 2022 11:59:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 13 Sep 2022 11:59:31 +0200    

Click here for diff

The two strings are already a single palloc'd chunk, not freed; there's  
no reason to allocate separate copies that have the same lifetime.  
  
This code is only called in short-lived memory contexts (except in some  
cases in TopTransactionContext, which is still short-lived enough not to  
really matter), and typically only for short arrays, so the memory or  
computation saved is likely negligible.  However, let's fix it to avoid  
leaving a bad example of code to copy.  This is the only place I could  
find where we're doing this with makeDefElem().  
  
Reported-by: Junwang Zhao <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/reloptions.c

Adjust header exceptions for 0bd9c6297

commit   : fcf7b3a9d42c3cf778dab0fc644f11f12684d184    
  
author   : John Naylor <[email protected]>    
date     : Tue, 13 Sep 2022 16:57:15 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 13 Sep 2022 16:57:15 +0700    

Click here for diff

Per buildfarm animal crake  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Treat Unicode codepoints of category "Format" as non-spacing

commit   : 0bd9c629732375e21d3ca6fba16c4a6a2808411a    
  
author   : John Naylor <[email protected]>    
date     : Tue, 13 Sep 2022 16:13:33 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 13 Sep 2022 16:13:33 +0700    

Click here for diff

Commit d8594d123 updated the list of non-spacing codepoints used  
for calculating display width, but in doing so inadvertently removed  
some, since the script used for that commit only considered combining  
characters.  
  
For complete coverage for zero-width characters, include codepoints in  
the category Cf (Format). To reflect the wider purpose, also rename files  
and update comments that referred specifically to combining characters.  
  
Some of these ranges have been missing since v12, but due to lack of  
field complaints it was determined not important enough to justify adding  
special-case logic the backbranches.  
  
Kyotaro Horiguchi  
  
Report by Pavel Stehule  
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRBE8yvpQ0FSkPCoe0Ny1jAAsAQ6j3qMgVwWvkqAoaaNmQ%40mail.gmail.com  

M src/common/unicode/Makefile
R064 src/common/unicode/generate-unicode_combining_table.pl src/common/unicode/generate-unicode_nonspacing_table.pl
M src/common/wchar.c
R091 src/include/common/unicode_combining_table.h src/include/common/unicode_nonspacing_table.h

commit   : bb629c294bea533884a379eee5f8ed6307c17bf2    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 13 Sep 2022 10:45:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 13 Sep 2022 10:45:43 +0900    

Click here for diff

This should have been part of 39969e2 that has renamed pg_stop_backup()  
to pg_backup_stop(), and this one is the last reference to  
pg_stop/start_backup() I could find in the tree.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACXjvC28ppeDTCrfaSyHga0ggP5nRLJbsjx=7N-74UT4QA@mail.gmail.com  

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

Move any remaining files generated by pg_upgrade into an internal subdir

commit   : ee5353abb6124de5ffd24ef1cedbc2a7196d4fd5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 13 Sep 2022 10:38:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 13 Sep 2022 10:38:56 +0900    

Click here for diff

This change concerns a couple of .txt files (for internal state checks)  
that were still written in the path where the binary is executed, and  
not in the subdirectory located in the target cluster.  Like the other  
.txt files doing already so (like loadable_libraries.txt), these are  
saved in the base output directory.  Note that on failure, the logs  
report the full path to the .txt file generated, so these are easy to  
find.  
  
Oversight in 38bfae3.  
  
Author: Daniel Gustafsson  
Reviewed-by: Michael Paquier, Justin Prysby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/version.c

Don't reference out-of-bounds array elements in brin_minmax_multi.c

commit   : 6b89ce1a21f909f616db165dcc6d8d2918fbc185    
  
author   : David Rowley <[email protected]>    
date     : Tue, 13 Sep 2022 11:02:56 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 13 Sep 2022 11:02:56 +1200    

Click here for diff

The primary fix here is to fix has_matching_range() so it does not  
reference ranges->values[-1] when nranges == 0.  Similar problems existed  
in AssertCheckRanges() too.  It does not look like any of these problems  
could lead to a crash as the array in question is at the end of the Ranges  
struct, and values[-1] is memory that belongs to other fields in the  
struct.  However, let's get rid of these rather unsafe coding practices.  
  
In passing, I (David) adjusted some comments to try to make it more clear  
what some of the fields are for in the Ranges struct.  I had to study the  
code to find out what nsorted was for as I couldn't tell from the  
comments.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAqJQzPitufX-jR=YUbJafpCDAKUnwgdbX_MzSc93wuvdw@mail.gmail.com  
Backpatch-through: 14, where multi-range brin was added.  

M src/backend/access/brin/brin_minmax_multi.c

commit   : 346990ae2e9f50030831a27aba78653fbde8c7ca    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 12 Sep 2022 22:17:17 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 12 Sep 2022 22:17:17 +0200    

Click here for diff

The FreeBSD site was changed with a redirect, which in turn seems to  
lead to a 404. Replace with the working link.  
  
Author: James Coleman <[email protected]>  
Discussion: https://postgr.es/m/CAAaqYe_JZRj+KPn=hACtwsg1iLRYs=jYvxG1NW4AnDeUL1GD-Q@mail.gmail.com  

M doc/src/sgml/docguide.sgml

Use normal install program to install server headers.

commit   : c0a1d7621b0a6086630919d91dc031eea72ab0b6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Sep 2022 22:33:59 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Sep 2022 22:33:59 +0300    

Click here for diff

Commit a7032690f9 replaced $(INSTALL) with plain "cp" for installing the  
server header files. It sped up "make install" significantly, because  
the old logic called $(INSTALL) separately for every header file,  
whereas plain "cp" could copy all the files in one command. However, we  
have long since made it a requirement that $(INSTALL) can also install  
multiple files in one command, see commit f1c5247563. Switch back to  
$(INSTALL).  
  
Discussion: https://www.postgresql.org/message-id/200503252305.j2PN52m23610%40candle.pha.pa.us  
Discussion: https://www.postgresql.org/message-id/2415283.1641852217%40sss.pgh.pa.us  

M src/include/Makefile

Revert "Convert *GetDatum() and DatumGet*() macros to inline functions"

commit   : e8d78581bb864369035c736a82ecfb57482a1a09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 19:57:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 19:57:07 +0200    

Click here for diff

This reverts commit 595836e99bf1ee6d43405b885fb69bb8c6d3ee23.  
  
It has problems when USE_FLOAT8_BYVAL is off.  

M contrib/intarray/_int_gist.c
M doc/src/sgml/xfunc.sgml
M src/backend/access/gist/gistutil.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/mb/mbutils.c
M src/include/access/gin.h
M src/include/funcapi.h
M src/include/postgres.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/cash.h
M src/include/utils/date.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/geo_decls.h
M src/include/utils/inet.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/pg_lsn.h
M src/include/utils/rangetypes.h
M src/include/utils/timestamp.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/xid8.h
M src/include/utils/xml.h

Convert *GetDatum() and DatumGet*() macros to inline functions

commit   : 595836e99bf1ee6d43405b885fb69bb8c6d3ee23    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 17:35:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 17:35:55 +0200    

Click here for diff

The previous macro implementations just cast the argument to a target  
type but did not check whether the input type was appropriate.  The  
function implementation can do better type checking of the input type.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com  

M contrib/intarray/_int_gist.c
M doc/src/sgml/xfunc.sgml
M src/backend/access/gist/gistutil.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/mb/mbutils.c
M src/include/access/gin.h
M src/include/funcapi.h
M src/include/postgres.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/cash.h
M src/include/utils/date.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/geo_decls.h
M src/include/utils/inet.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/pg_lsn.h
M src/include/utils/rangetypes.h
M src/include/utils/timestamp.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/xid8.h
M src/include/utils/xml.h

Fix NaN comparison in circle_same test

commit   : 8cb2a22bbb2cf4212482ac15021ceaa2e9c52209    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 12 Sep 2022 12:59:06 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 12 Sep 2022 12:59:06 +0200    

Click here for diff

Commit c4c340088 changed geometric operators to use float4 and float8  
functions, and handle NaN's in a better way. The circle sameness test  
had a typo in the code which resulted in all comparisons with the left  
circle having a NaN radius considered same.  
  
  postgres=# select '<(0,0),NaN>'::circle ~= '<(0,0),1>'::circle;  
  ?column?  
  ----------  
  t  
  (1 row)  
  
This fixes the sameness test to consider the radius of both the left  
and right circle.  
  
Backpatch to v12 where this was introduced.  
  
Author: Ranier Vilela <[email protected]>  
Discussion: https://postgr.es/m/CAEudQAo8dK=yctg2ZzjJuzV4zgOPBxRU5+Kb+yatFiddtQk6Rw@mail.gmail.com  
Backpatch-through: v12  

M src/backend/utils/adt/geo_ops.c
M src/test/regress/expected/geometry.out

pgstattuple: Use double consistently for percentages

commit   : 07d8af5e5e0cf5d5187353809920f344a5d20684    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 10:19:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 10:19:17 +0200    

Click here for diff

pgstattuple uses data type double for other percentage calculations  
and exposes those values to the users via the float8 data type.  
However, scanned_percent in struct output_type is of type uint64, even  
though it is later returned via Float8GetDatum().  Change it to use  
double to be inline with other percentages.  
  
Author: Bharath Rupireddy  
Reviewed-by: Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/36ee692b-232f-0484-ce94-dc39d82021ad%40enterprisedb.com  

M contrib/pgstattuple/pgstatapprox.c

Use float8 datatype for percentiles in pg_walinspect stat functions

commit   : 57796a0f15f8fd3c908aa885a7ebb8ae47ce9880    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 09:38:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 09:38:07 +0200    

Click here for diff

pg_walinspect uses datatype double (double precision floating point  
number) for WAL stats percentile calculations and expose them via  
float4 (single precision floating point number), which an unnecessary  
loss of precision and confusing. Even though, it's harmless that way,  
let's use float8 (double precision floating-point number) to be in  
sync with what pg_walinspect does internally and what it exposes to  
the users. This seems to be the pattern used elsewhere in the code.  
  
Reported-by: Peter Eisentraut  
Author: Bharath Rupireddy  
Reviewed-by: Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/36ee692b-232f-0484-ce94-dc39d82021ad%40enterprisedb.com  

M contrib/pg_walinspect/pg_walinspect–1.0.sql
M contrib/pg_walinspect/pg_walinspect.c
M doc/src/sgml/pgwalinspect.sgml

Make the tablesync worker's replication origin drop logic robust.

commit   : 88f488319bac051b874bcec87941217e25e0e126    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 12 Sep 2022 12:40:57 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 12 Sep 2022 12:40:57 +0530    

Click here for diff

In commit f6c5edb8ab, we started to drop the replication origin slots  
before tablesync worker exits to avoid consuming more slots than required.  
We were dropping the replication origin in the same transaction where we  
were marking the tablesync state as SYNCDONE. Now, if there is any error  
after we have dropped the origin but before we commit the containing  
transaction, the in-memory state of replication progress won't be rolled  
back. Due to this, after the restart, tablesync worker can start streaming  
from the wrong location and can apply the already processed transaction.  
  
To fix this, we need to opportunistically drop the origin after marking  
the tablesync state as SYNCDONE. Even, if the tablesync worker fails to  
remove the replication origin before exit, the apply worker ensures to  
clean it up afterward.  
  
Reported by Tom Lane as per buildfarm.  
Diagnosed-by: Masahiko Sawada  
Author: Hou Zhijie  
Reviewed-By: Masahiko Sawada, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAD21AoAw0Oofi4kiDpJBOwpYyBBBkJj=sLUOn4Gd2GjUAKG-fw@mail.gmail.com  

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

Assorted examples of expanded type-safer palloc/pg_malloc API

commit   : 5015e1e1b58f81a036e4ad16291ef4b3bb7a596c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 08:31:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 08:31:56 +0200    

Click here for diff

This adds some uses of the new palloc/pg_malloc variants here and  
there as a demonstration and test.  This is kept separate from the  
actual API patch, since the latter might be backpatched at some point.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/dblink/dblink.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginfast.c
M src/backend/commands/indexcmds.c
M src/backend/commands/prepare.c
M src/backend/executor/nodeHash.c
M src/backend/tcop/postgres.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/psql/startup.c
M src/common/config_info.c
M src/common/controldata_utils.c

Expand palloc/pg_malloc API for more type safety

commit   : 2016055a92f26d648aba9f66d26cc0bcd1619eff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 08:31:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 08:31:56 +0200    

Click here for diff

This adds additional variants of palloc, pg_malloc, etc. that  
encapsulate common usage patterns and provide more type safety.  
  
Specifically, this adds palloc_object(), palloc_array(), and  
repalloc_array(), which take the type name of the object to be  
allocated as its first argument and cast the return as a pointer to  
that type.  There are also palloc0_object() and palloc0_array()  
variants for initializing with zero, and pg_malloc_*() variants of all  
of the above.  
  
Inspired by the talloc library.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/common/fe_memutils.h
M src/include/utils/palloc.h

Make eval statement naturally proof against perltidy

commit   : b060f57791cfd84ec7c7eb84eb1d1d38b39aa0a5    
  
author   : John Naylor <[email protected]>    
date     : Mon, 12 Sep 2022 11:59:43 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 12 Sep 2022 11:59:43 +0700    

Click here for diff

This is a bit less verbose than adding an exception. Rewrite  
the other eval statement in Catalog.pm as well, just for  
the sake of consistency.  
  
Idea from Andrew Dunstan  
Discussion: https://www.postgresql.org/message-id/CAD5tBc%2BzRhuWn_S4ayH2sWKe60FQu1guTTokDFS3YMOeSrsozA%40mail.gmail.com  

M src/backend/catalog/Catalog.pm

Replace loading of ldap_start_tls_sA() by direct function call

commit   : c3fb5809eae3bb6f448ebc562462b39d6b1f6f22    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Sep 2022 09:07:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Sep 2022 09:07:10 +0900    

Click here for diff

This change impacts the backend-side code in charge of starting a LDAP  
TLS session.  It is a bit sad that it is not possible to unify the WIN32  
and non-WIN32 code paths, but the different number of arguments for both  
discard this possibility.  
  
This is similar to 47bd0b3, where this replaces the last function  
loading that seems worth it, any others being either environment or  
version-dependent.  
  
Reported-by: Thomas Munro  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth.c

Doc: improve explanation of when custom GUCs appear in pg_settings.

commit   : 857808a4116b231822746d6e70ded27bff0ec612    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Sep 2022 16:42:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Sep 2022 16:42:24 -0400    

Click here for diff

Be more clear about when and how an extension-defined GUC comes to be  
visible in pg_settings.  (Move the para to the bottom of the page, too;  
whoever thought this point was more important than the para about the  
view being updatable had odd priorities IMNSHO.)  
  
Back-patch to v15 where archive modules were added, since that seems  
to have made this more of a sore spot than it was before.  
  
Benoit Lobréau, Nathan Bossart  
  
Discussion: https://postgr.es/m/CAPE8EZ7KHaXMHKwT=HOim23tDVKYA1PruRuTfeYdCrYWwPGhag@mail.gmail.com  

M doc/src/sgml/system-views.sgml

Add psql tab compression for ALTER TABLE .. { OF | NOT OF }

commit   : 6afcab6ac1e03975dc59d62c3ccaf98ed2831669    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 10 Sep 2022 17:22:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 10 Sep 2022 17:22:29 +0900    

Click here for diff

ALTER TABLE .. OF is now able to complete with the list of available  
composite types that can be used with the query.  
  
Author: Aleksander Alekseev  
Reviewed-by: Shinya Kato  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Free correctly LDAPMessage returned by ldap_search_s() in auth.c

commit   : 799437e0bd3259c90d26e195894b6e22eb0b325c    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 10 Sep 2022 16:56:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 10 Sep 2022 16:56:07 +0900    

Click here for diff

The LDAP wiki states that the search message should be freed regardless  
of the return value of ldap_search_s(), but we failed to do so in one  
backend code path when searching LDAP with a filter.  This is not  
critical in an authentication code path failing in the backend as this  
causes such the process to exit promptly, but let's be clean and free  
the search message appropriately, as documented by upstream.  
  
All the other code paths failing a LDAP operation do that already, and  
somebody looking at this code in the future may miss what LDAP expects  
with the search message.  
  
Author: Zhihong Yu  
Discussion: https://postgr.es/m/CALNJ-vTf5Y+8RtzZ4GjOGE9qWVHZ8awfhnFYc_qGm8fMLUNRAg@mail.gmail.com  

M src/backend/libpq/auth.c

configure: Expand -fvisibility checks to more compilers, test for -qvisibility

commit   : be7c15b194ab91d28904a0e656f3f6600883ab68    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 9 Sep 2022 22:53:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 9 Sep 2022 22:53:02 -0700    

Click here for diff

It looks like icc and sunpro both support -fvisibility=hidden and xlc supports  
-qvisibility=hidden. I tested this on AIX and solaris with their proprietary  
compilers as well as gcc, and with gcc or clang on freebsd, linux, macos,  
netbsd and openbsd.  
  
Apparently my prior commit fe6a64a58ab only works in combination with this  
patch. While I tried to test them separately, an unknown caching issue  
prevented me from noticing the problem.  
  
Per discussion with Tom Lane and buildfarm member hoverfly.  
  
Discussion: https://postgr.es/m/20220910052741.t7w7csyrggwus2ze%40awork3.anarazel.de  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

aix: No need to use mkldexport when we want to export all symbols

commit   : fe6a64a58ab3e5bda3aceee2f1ee3e8efdb03865    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 9 Sep 2022 19:11:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 9 Sep 2022 19:11:49 -0700    

Click here for diff

When building a shared library with exports.txt there's no need to build an  
intermediary static library, we can just pass -Wl,-bE:... when generating the  
.so.  
  
When building a shared library without exports.txt, there's no need to call  
mkldexport.sh to export all symbols, because all symbols are exported anyway,  
and we don't need the export file on the import side (like we do for  
postgres.imp).  
  
This makes building .so's on aix a lot more similar to building on other  
platforms. In particular, we don't create and remove a .a of the same name but  
different contents anymore.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib
M src/makefiles/Makefile.aix

Fix possible omission of variable storage markers in ECPG.

commit   : b7050e2584803a6abe71fb0b94a63b63e59cff9c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 15:34:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 15:34:04 -0400    

Click here for diff

The ECPG preprocessor converted code such as  
  
static varchar str1[10], str2[20], str3[30];  
  
into  
  
static  struct varchar_1  { int len; char arr[ 10 ]; }  str1 ;  
        struct varchar_2  { int len; char arr[ 20 ]; }  str2 ;  
        struct varchar_3  { int len; char arr[ 30 ]; }  str3 ;  
  
thus losing the storage attribute for the later variables.  
Repeat the declaration for each such variable.  
  
(Note that this occurred only for variables declared "varchar"  
or "bytea", which may help explain how it escaped detection  
for so long.)  
  
Andrey Sokolov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/preproc-variable.stderr
M src/interfaces/ecpg/test/expected/preproc-variable.stdout
M src/interfaces/ecpg/test/preproc/variable.pgc

Doc: improve documentation about where the psqlrc files are.

commit   : f734857a9211afcd4fc068dfa322642b6be99b87    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 13:50:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 13:50:42 -0400    

Click here for diff

Remove no-longer-accurate claim that Windows lacks home directories.  
Clarify the text by more clearly distinguishing which statements  
reflect hard-wired choices versus which ones reflect overridable  
defaults.  Update the examples of version-specific file names,  
and make them track future version changes by using "&majorversion;"  
and "&version;".  (BTW, in devel and beta releases this method  
correctly says that you can use strings like "16devel" and "15beta4"  
as minor version identifiers.)  
  
Back-patch to v15, but not further, with the thought that in older  
releases the examples with three-part version numbers still had  
some historical relevance.  v15 will be the first major release after  
the last 9.x branch went out of support.  
  
Robert Treat and Tom Lane, reviewed by Julien Rouhaud  
  
Discussion: https://postgr.es/m/CAJSLCQ07F-WCYYYOY8+dWhHcVeJ1Pb01cWc-c0Hu=M3EjKT2Eg@mail.gmail.com  

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

Reject bogus output from uuid_create(3).

commit   : c4b6d218e369b69c20ca40d4ccefc02350f38c24    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 12:41:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 12:41:36 -0400    

Click here for diff

When using the BSD UUID functions, contrib/uuid-ossp expects  
uuid_create() to produce a version-1 UUID.  FreeBSD still does so,  
but in recent NetBSD releases that function produces a version-4  
(random) UUID instead.  That's not acceptable for our purposes:  
if the user wanted v4 she would have asked for v4, not v1.  
Hence, check the version digit and complain if it's not '1'.  
  
Also drop the documentation's claim that the NetBSD implementation  
is usable.  It might be, depending on which OS version you're using,  
but we're not going to get into that kind of detail.  
  
(Maybe someday we should ditch all these external libraries  
and just write our own UUID code, but today is not that day.)  
  
Nazir Bilal Yavuz, with cosmetic adjustments and docs by me.  
Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/uuid-ossp/uuid-ossp.c
M doc/src/sgml/installation.sgml
M doc/src/sgml/uuid-ossp.sgml

Doc fixes for MERGE statement

commit   : 5dcebd10baa8ec14a97029ca0bacaf2a9a0f8652    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2022 13:51:45 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2022 13:51:45 +0200    

Click here for diff

In commit 3d895bc846f2 I introduced a bogus semicolon mid-statement by  
careless cut-n-paste; move it.  This had already been reported by Justin  
Pryzby.  
  
Also, change the styling a bit by avoiding names in CamelCase.  This is  
more consistent with the style we use elsewhere.  
  
Backpatch to 15.  
  
Author: Vitaly Burovoy <[email protected]>  
Reviewed-by: Vik Fearing <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/merge.sgml

Fix GetForeignKey*Triggers for self-referential FKs

commit   : 8c848cd4b8e9e0fee33eaad33cb44376b9e5b480    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2022 12:22:20 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2022 12:22:20 +0200    

Click here for diff

Because of inadequate filtering, the check triggers were confusing the  
search for action triggers in GetForeignKeyActionTriggers and vice-versa  
in GetForeignKeyCheckTriggers; this confusion results in seemingly  
random assertion failures, and can have real impact in non-asserting  
builds depending on catalog order.  Change these functions so that they  
correctly ignore triggers that are not relevant to each side.  
  
To reduce the odds of further problems, do not break out of the  
searching loop in assertion builds.  This break is likely to hide bugs;  
without it, we would have detected this bug immediately.  
  
This problem was introduced by f4566345cf40, so backpatch to 15 where  
that commit first appeared.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Bump minimum version of Flex to 2.5.35

commit   : 8b878bffa8d8ac7e13508025c3ca5e6101e3a5e8    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 11:41:58 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 11:41:58 +0700    

Click here for diff

Since the retirement of some older buildfarm members, the oldest Flex  
that gets regular testing is 2.5.35.  
  
Reviewed by Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M config/programs.m4
M configure
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/backend/utils/misc/guc-file.l
M src/tools/msvc/pgflex.pl

Bump minimum version of Bison to 2.3

commit   : b086a47a270fba133969e78f1fb9e264725d97ae    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 11:41:58 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 11:41:58 +0700    

Click here for diff

Since the retirement of some older buildfarm members, the oldest Bison  
that gets regular testing is 2.3. MacOS ships that version, and will  
continue doing so for the forseeable future because of Apple's policy  
regarding GPLv3. While Mac users could use a package manager to install  
a newer version, there is no compelling reason to force them do so at  
this time.  
  
Reviewed by Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M config/programs.m4
M configure
M contrib/cube/cubeparse.y
M contrib/seg/segparse.y
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/backend/bootstrap/bootparse.y
M src/backend/parser/gram.y
M src/backend/replication/repl_gram.y
M src/backend/replication/syncrep_gram.y
M src/backend/utils/adt/jsonpath_gram.y
M src/pl/plpgsql/src/pl_gram.y
M src/tools/msvc/pgbison.pl

Add jsonpath_gram.h to list of distprep targets

commit   : 96683db880cab7791006fcc13416d67f6230a2f7    
  
author   : John Naylor <[email protected]>    
date     : Fri, 9 Sep 2022 11:34:09 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 9 Sep 2022 11:34:09 +0700    

Click here for diff

Oversight in dac048f71e  

M src/backend/Makefile

Replace load of functions by direct calls for some WIN32

commit   : 47bd0b3fa601642b6cfbe79ad956d4a9fc835ba1    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Sep 2022 10:52:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Sep 2022 10:52:17 +0900    

Click here for diff

This commit changes the following code paths to do direct system calls  
to some WIN32 functions rather than loading them from an external  
library, shaving some code in the process:  
- Creation of restricted tokens in pg_ctl.c, introduced by a25cd81.  
- QuerySecurityContextToken() in auth.c for SSPI authentication in the  
backend, introduced in d602592.  
- CreateRestrictedToken() in src/common/.  This change is similar to the  
case of pg_ctl.c.  
  
Most of these functions were loaded rather than directly called because,  
as mentioned in the code comments, MinGW headers were not declaring  
them.  I have double-checked the recent MinGW code, and all the  
functions changed here are declared in its headers, so this change  
should be safe.  Note that I do not have a MinGW environment at hand so  
I have not tested it directly, but that MSVC was fine with the change.  
The buildfarm will tell soon enough if this change is appropriate or not  
for a much broader set of environments.  
  
A few code paths still use GetProcAddress() to load some functions:  
- LDAP authentication for ldap_start_tls_sA(), where I am not confident  
that this change would work.  
- win32env.c and win32ntdll.c where we have a per-MSVC version  
dependency for the name of the library loaded.  
- crashdump.c for MiniDumpWriteDump() and EnumDirTree(), where direct  
calls were not able to work after testing.  
  
Reported-by: Thomas Munro  
Reviewed-by: Justin Prysby  
Discussion: https://postgr.es/m/CA+hUKG+BMdcaCe=P-EjMoLTCr3zrrzqbcVE=8h5LyNsSVHKXZA@mail.gmail.com  

M src/backend/libpq/auth.c
M src/bin/pg_ctl/pg_ctl.c
M src/common/restricted_token.c

Add more error context to RestoreBlockImage() and consume it

commit   : df4a056619a7e9868ec43a15e2088ff8ccf94471    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Sep 2022 10:00:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Sep 2022 10:00:40 +0900    

Click here for diff

On failure in restoring a block image, no details were provided, while  
it is possible to see failure with an inconsistent record state, a  
failure in processing decompression or a failure in decompression  
because a build does not support this option.  
  
RestoreBlockImage() is used in two code paths in the backend code,  
during recovery and when checking a page consistency after applying  
masking, and both places are changed to consume the error message  
produced by the internal routine when it returns a false status.  All  
the error messages are reported under ERRCODE_INTERNAL_ERROR, that gets  
used also when attempting to access a page compressed by a method  
not supported by the build attempting the decompression.  This is  
something that can happen in core when doing physical replication with  
primary and standby using inconsistent build options, for example.  
  
This routine is available since 2c03216d and it has never provided any  
context about the error happening when it failed.  This change is  
justified even more after 57aa5b2, that introduced compression of FPWs  
in WAL.  
  
Reported-by: Justin Prysby  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

Instrument freezing in autovacuum log reports.

commit   : d977ffd923d207164eef78ed107d5293aee6c660    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 8 Sep 2022 10:29:39 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 8 Sep 2022 10:29:39 -0700    

Click here for diff

Add a new line to log reports from autovacuum (as well as VACUUM VERBOSE  
output) that shows information about freezing.  Emphasis is placed on  
the total number of heap pages that had one or more tuples frozen by  
VACUUM.  The total number of tuples frozen is also shown.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Jeff Janes <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznTY6D0zyE8VLrC6Gd4kh_HGAXxnTPtcOQOOsxzLx9zog@mail.gmail.com  

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

Temporarily make MemoryContextContains return false

commit   : b76fb6c2a99eb7d49f96e56599fef1ffc1c134c9    
  
author   : David Rowley <[email protected]>    
date     : Fri, 9 Sep 2022 00:28:38 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 9 Sep 2022 00:28:38 +1200    

Click here for diff

5265e91fd changed MemoryContextContains to update it so that it works  
correctly with the new MemoryChunk code added in c6e0fe1f2.  However,  
5265e91fd was done with the assumption that MemoryContextContains would  
only ever be given pointers to memory that had been returned by one of our  
MemoryContext allocators.  It seems that's not true and many of our 32-bit  
buildfarm animals are clearly showing that.  
  
There are some code paths that call MemoryContextContains with a pointer  
pointing part way into an allocated chunk.  The example of this found by  
the 32-bit buildfarm animals is the int2int4_sum() function.  This  
function returns transdata->sum, which is not a pointer to memory that was  
allocated directly.  This return value is then subsequently passed to  
MemoryContextContains which causes it to crash due to it thinking the  
memory directly prior to that pointer is a MemoryChunk.  What's actually  
in that memory is the field in the struct that comes prior to the "sum"  
field.  This problem didn't occur in 64-bit world because BIGINT is a  
byval type and the code which was calling MemoryContextContains with the  
bad pointer only does so with non-byval types.  
  
Here, instead of reverting 5265e91fd and making MemoryContextContains  
completely broken again, let's just make it always return false for now.  
Effectively prior to 5265e91fd it was doing that anyway, this at least  
makes that more explicit.  The only repercussions of this with the current  
MemoryContextContains calls are that we perform a datumCopy() when we  
might not need to.  This should make the 32-bit buildfarm animals happy  
again and give us more time to consider a long-term fix.  
  
Discussion: https://postgr.es/m/20220907130552.sfjri7jublfxyyi4%40jrouhaud  

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

Choose FK name correctly during partition attachment

commit   : e7936f8b3e57046c0e178ccefa04ac7e6fbae79c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 8 Sep 2022 13:17:02 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 8 Sep 2022 13:17:02 +0200    

Click here for diff

During ALTER TABLE ATTACH PARTITION, if the name of a parent's foreign  
key constraint is already used on the partition, the code tries to  
choose another one before the FK attributes list has been populated,  
so the resulting constraint name was "<relname>__fkey" instead of  
"<relname>_<attrs>_fkey".  Repair, and add a test case.  
  
Backpatch to 12.  In 11, the code to attach a partition was not smart  
enough to cope with conflicting constraint names, so the problem doesn't  
exist there.  
  
Author: Jehan-Guillaume de Rorthais <[email protected]>  
Discussion: https://postgr.es/m/20220901184156.738ebee5@karst  

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

Fix recovery_prefetch with low maintenance_io_concurrency.

commit   : adb466150b44d1eaf43a2d22f58ff4c545a0ed3f    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 8 Sep 2022 20:25:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 8 Sep 2022 20:25:20 +1200    

Click here for diff

We should process completed IOs *before* trying to start more, so that  
it is always possible to decode one more record when the decoded record  
queue is empty, even if maintenance_io_concurrency is set so low that a  
single earlier WAL record might have saturated the IO queue.  
  
That bug was hidden because the effect of maintenance_io_concurrency was  
arbitrarily clamped to be at least 2.  Fix the ordering, and also remove  
that clamp.  We need a special case for 0, which is now treated the same  
as recovery_prefetch=off, but otherwise the number is used directly.  
This allows for testing with 1, which would have made the problem  
obvious in simple test scenarios.  
  
Also add an explicit error message for missing contrecords.  It was a  
bit strange that we didn't report an error already, and became a latent  
bug with prefetching, since the internal state that tracks aborted  
contrecords would not survive retrying, as revealed by  
026_overwrite_contrecord.pl with this adjustment.  Reporting an error  
prevents that.  
  
Back-patch to 15.  
  
Reported-by: Justin Pryzby <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/20220831140128.GS31833%40telsasoft.com  

M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/include/access/xlogreader.h

Fix perltidy breaking perlcritic

commit   : 12d40d4a8d0495cf2c7b564daa8aaa7f107a6c56    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 8 Sep 2022 11:16:09 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 8 Sep 2022 11:16:09 +0200    

Click here for diff

perltidying a "##no critic" line moves the marker to where it becomes  
useless.  Put the line back to how it was, and protect it from further  
malfeasance.  
  
Per buildfarm member crake.  

M src/backend/catalog/Catalog.pm

doc: Fix PL/pgSQL casing to be consistent

commit   : cb62d0b3c372350b997733f41283cc35a6814024    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 8 Sep 2022 09:56:50 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 8 Sep 2022 09:56:50 +0200    

Click here for diff

Ensure that all mentions of PL/pgSQL is cased equally, a few instances  
of PL/PgSQL had snuck in.  
  
Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml

Add b2e6e7682 to .git-blame-ignore-revs

commit   : b289b86231ad10fb317231ff85596d6272203916    
  
author   : John Naylor <[email protected]>    
date     : Thu, 8 Sep 2022 14:05:40 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 8 Sep 2022 14:05:40 +0700    

Click here for diff

M .git-blame-ignore-revs

Run perltidy over Catalog.pm

commit   : b2e6e768230be334b12dae536ba4c147fba4e9c9    
  
author   : John Naylor <[email protected]>    
date     : Thu, 8 Sep 2022 13:54:14 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 8 Sep 2022 13:54:14 +0700    

Click here for diff

Commit 69eb643b2 deliberately left indentation unchanged to make the changes  
more legible. Rather than waiting until next year's perltidy run, do it now  
to avoid confusion  
  
Per suggestion from Álvaro Herrera  
Discussion: https://www.postgresql.org/message-id/20220907083558.vfvb5hcauaictgum%40alvherre.pgsql  

M src/backend/catalog/Catalog.pm

Parse catalog .dat files as a whole when compiling the backend

commit   : 69eb643b2582f180c91b2d14c896402e54040231    
  
author   : John Naylor <[email protected]>    
date     : Thu, 8 Sep 2022 13:23:13 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 8 Sep 2022 13:23:13 +0700    

Click here for diff

Previously Catalog.pm eval'd each individual hash reference  
so that comments and whitespace can be preserved when running  
reformat-dat-files. This is unnecessary when building, and we can save  
~15% off the run time of genbki.pl by simply slurping and eval'-ing  
the whole file at once. This saves a bit of time, especially in highly  
parallel builds, since most build targets depend on this script's outputs.  
  
Report and review by Andres Freund  
Discussion: https://www.postgresql.org/message-id/CAFBsxsGW%3DWRbnxXrc8UqqR479XuxtukSFWV-hnmtgsbuNAUO6w%40mail.gmail.com  

M src/backend/catalog/Catalog.pm

Fix the test case introduced by commit 8756930190.

commit   : 0324651573479f4e782f76c0d06f2ebd02e6160a    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 8 Sep 2022 09:47:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 8 Sep 2022 09:47:43 +0530    

Click here for diff

Before dropping a relation, ensure that it has reached a 'ready' state  
after initial synchronization.  
  
Author: Vignesh C  
Reviewed-By: Amit Kapila  
Discussion: https://www.postgresql.org/message-id/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9=9orqubhjcQ@mail.gmail.com  

M src/test/subscription/t/030_origin.pl

Raise a warning if there is a possibility of data from multiple origins.

commit   : 875693019053b8897ec3983e292acbb439b088c3    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 8 Sep 2022 06:54:13 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 8 Sep 2022 06:54:13 +0530    

Click here for diff

This commit raises a warning message for a combination of options  
('copy_data = true' and 'origin = none') during CREATE/ALTER subscription  
operations if the publication tables were also replicated from other  
publishers.  
  
During replication, we can skip the data from other origins as we have that  
information in WAL but that is not possible during initial sync so we raise  
a warning if there is such a possibility.  
  
Author: Vignesh C  
Reviewed-By: Peter Smith, Amit Kapila, Jonathan Katz, Shi yu, Wang wei  
Discussion: https://www.postgresql.org/message-id/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9=9orqubhjcQ@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/030_origin.pl

Message style fixes

commit   : 4b4663fb4a704b7a145ed6ec018b1f0c116eeb6b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Sep 2022 17:33:49 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Sep 2022 17:33:49 +0200    

Click here for diff

M src/backend/replication/logical/worker.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/test/subscription/t/029_on_error.pl

Make MemoryContextContains work correctly again

commit   : 5265e91fd10ddbc47921126571ed64914fd3cb72    
  
author   : David Rowley <[email protected]>    
date     : Thu, 8 Sep 2022 00:20:20 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 8 Sep 2022 00:20:20 +1200    

Click here for diff

c6e0fe1f2 recently changed the way we store headers for allocated chunks  
of memory.  Prior to that commit, we stored a pointer to the owning  
MemoryContext directly prior to the pointer to the allocated memory.  
That's no longer true and c6e0fe1f2 neglected to update  
MemoryContextContains() so that it correctly obtains the owning context  
with the new method.  
  
A side effect of this change and c6e0fe1f2, in general, is that it's even  
less safe than it was previously to pass MemoryContextContains() an  
arbitrary pointer which was not allocated by one of our MemoryContexts.  
Previously some comments in MemoryContextContains() seemed to indicate  
that the worst that could happen by passing an arbitrary pointer would be  
a false positive return value.  It seems to me that this was a rather  
wishful outlook as we subsequently proceeded to subtract sizeof(void *)  
from the given pointer and then dereferenced that memory.  So it seems  
quite likely that we could have segfaulted instead of returning a false  
positive.  However, it's not impossible that the memory sizeof(void *)  
bytes before the pointer could have been owned by the process, but it's  
far less likely to work now as obtaining a pointer to the owning  
MemoryContext is less direct than before c6e0fe1f2 and will access memory  
that's possibly much further away to obtain the owning MemoryContext.  
Because of this, I took the liberty of updating the comment to warn  
against any future usages of the function and checked the existing core  
usages to ensure that we only ever pass in a pointer to memory allocated  
by a MemoryContext.  
  
Extension authors updating their code for PG16 who are using  
MemoryContextContains should check to ensure that only NULL pointers and  
pointers to chunks allocated with a MemoryContext will ever be passed to  
MemoryContextContains.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Renumber confusing value for GUC_UNIT_BYTE

commit   : 3fe76ab9722c2891855dd2b34261f7c23a2e5b2b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Sep 2022 11:03:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Sep 2022 11:03:53 +0200    

Click here for diff

It had a power-of-two value, which looks right, and causes the other  
values which aren't powers-of-two to look wrong.  But this is tested  
for equality and not a bitwise test.  
  
See also:  
6e7baa322773ff8c79d4d8883c99fdeff5bfa679  
https://www.postgresql.org/message-id/CAOG9ApEu8bXVwBxkOO9J7ZpM76TASK_vFMEEiCEjwhMmSLiaqQ%40mail.gmail.com  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/utils/guc.h

Make more effort to put a sentinel at the end of allocated memory

commit   : 0e480385ec59aa7f769366eb24462acc2b7a40d7    
  
author   : David Rowley <[email protected]>    
date     : Wed, 7 Sep 2022 15:46:57 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 7 Sep 2022 15:46:57 +1200    

Click here for diff

Traditionally, in MEMORY_CONTEXT_CHECKING builds, we only ever marked a  
sentinel byte just beyond the requested size if there happened to be  
enough space on the chunk to do so.  For Slab and Generation context  
types, we only rounded the size of the chunk up to the next maxalign  
boundary, so it was often not that likely that those would ever have space  
for the sentinel given that the majority of allocation requests are going  
to be for sizes which are maxaligned.  For AllocSet, it was a little  
different as smaller allocations are rounded up to the next power-of-2  
value rather than the next maxalign boundary, so we're a bit more likely  
to have space for the sentinel byte, especially when we get away from tiny  
sized allocations such as 8 or 16 bytes.  
  
Here we make more of an effort to allow space so that there is enough room  
for the sentinel byte in more cases.  This makes it more likely that we'll  
detect when buggy code accidentally writes beyond the end of any of its  
memory allocations.  
  
Each of the 3 MemoryContext types has been changed as follows:  
  
The Slab allocator will now always set a sentinel byte.  Both the current  
usages of this MemoryContext type happen to use chunk sizes which were on  
the maxalign boundary, so these never used sentinel bytes previously.  
  
For the Generation allocator, we now always ensure there's enough space in  
the allocation for a sentinel byte.  
  
For AllocSet, this commit makes an adjustment for allocation sizes which  
are greater than allocChunkLimit.  We now ensure there is always space for  
a sentinel byte.  We don't alter the sentinel behavior for request sizes  
<= allocChunkLimit.  Making way for the sentinel byte for power-of-2  
request sizes would require doubling up to the next power of 2.  Some  
analysis done on the request sizes made during installcheck shows that a  
fairly large portion of allocation requests are for power-of-2 sizes.  The  
amount of additional memory for the sentinel there seems prohibitive, so  
we do nothing for those here.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/slab.c

Doc: Explain about Column List feature.

commit   : f98d07424523ab5fefa6c6483dbf60d0d2fe1df3    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 7 Sep 2022 08:58:31 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 7 Sep 2022 08:58:31 +0530    

Click here for diff

Add a new logical replication section for "Column Lists" (analogous to the  
Row Filters page). This explains how the feature can be used and the  
caveats in it.  
  
Author: Peter Smith  
Reviewed-by: Shi yu, Vignesh C, Erik Rijkers, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAHut+PvOuc9=_4TbASc5=VUqh16UWtFO3GzcKQK_5m1hrW3vqg@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml

Fix new pg_publication_tables query.

commit   : 20b6847176976da9cae6103475b967e6c2971898    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2022 18:00:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2022 18:00:32 -0400    

Click here for diff

The addition of published column names forgot to filter on attisdropped,  
leading to cases where you could see "........pg.dropped.1........"  
or the like as a reportedly-published column.  
  
While we're here, rewrite the new subquery to get a more efficient plan  
for it.  
  
Hou Zhijie, per report from Jaime Casanova.  Back-patch to v15 where  
the bug was introduced.  (Sadly, this means we need a post-beta4  
catversion bump before beta4 has even hit the streets.  I see no  
good alternative though.)  
  
Discussion: https://postgr.es/m/Yxa1SU4nH2HfN3/i@ahch-to  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

Fix cplusplusscheck in vpath builds

commit   : cec2754fbebee0a40aaf905947deb823cca4fe39    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 12:46:41 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 12:46:41 +0700    

Click here for diff

Same solution as 829906fb6.  

M src/tools/pginclude/cpluspluscheck

Add psql tab compression for SET COMPRESSION with ALTER TABLE

commit   : 4cbe579746ea05898f2b0c7ba88e4015b781ff71    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Sep 2022 15:36:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Sep 2022 15:36:42 +0900    

Click here for diff

Author: Aleksander Alekseev  
Reviewed-by: Shinya Kato  
Discussion: https://postgr.es/m/CAJ7c6TMuT+=P7uDepjVpdqSEp2xOmXET3Y2K-xWAO=sCz-28gg@mail.gmail.com  

M src/bin/psql/tab-complete.c

Fix headerscheck in vpath builds

commit   : 829906fb6c21e39e732f340600f461f3d8db24c2    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 12:46:41 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 12:46:41 +0700    

Click here for diff

Oversight in dac048f71e per buildfarm animal crake.  
Fix per suggestion from Andrew Dunstan.  
  
Discussion: https://www.postgresql.org/message-id/e3f4a3d0-dfcc-41cc-1ed2-acc15700ddef%40dunslane.net  

M src/tools/pginclude/headerscheck

Fix failure to maintainer-clean jsonpath_gram.h

commit   : eac76cc012aa4888e882287baae791429396b403    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 12:30:56 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 12:30:56 +0700    

Click here for diff

Oversight in dac048f71e  

M src/backend/Makefile

Fix typo in 16d69ec29

commit   : c89b44a68d918e24335f2d132684c53dd16d0d2b    
  
author   : David Rowley <[email protected]>    
date     : Tue, 6 Sep 2022 15:59:15 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 6 Sep 2022 15:59:15 +1200    

Click here for diff

As noted by Justin Pryzby, just I forgot to commit locally before creating  
a patch file.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

Remove buggy and dead code from CreateTriggerFiringOn

commit   : 16d69ec29b1199831c74504845f5d6117dbfc738    
  
author   : David Rowley <[email protected]>    
date     : Tue, 6 Sep 2022 15:51:44 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 6 Sep 2022 15:51:44 +1200    

Click here for diff

Here we remove some dead code from CreateTriggerFiringOn() which was  
attempting to find the relevant child partition index corresponding to the  
given indexOid.  As it turned out, thanks to -Wshadow=compatible-local,  
this code was buggy as the code which was finding the child indexes  
assigned those to a shadowed variable that directly went out of scope.  
The code which thought it was looking at the List of child indexes was  
always referencing an empty List.  
  
On further investigation, this code is dead.  We never call  
CreateTriggerFiringOn() passing a valid indexOid in a way that the  
function would actually ever execute the code in question.  So, for lack  
of a way to test if a fix actually works, let's just remove the dead code  
instead.  
  
As a reminder, if there is ever a need to resurrect this code, an Assert()  
has been added to remind future feature developers that they might need to  
write some code to find the corresponding child index.  
  
Reported-by: Justin Pryzby  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

Add missing exceptions to cpluspluscheck

commit   : 8c06a282fe35a02338116a7ad4df9ea309b3deb4    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 10:27:05 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Sep 2022 10:27:05 +0700    

Click here for diff

dac048f71 added exceptions to headerscheck but failed to do the  
same for cpluspluscheck  
  
Per report from Andres Freund regarding CI  
Discussion:https://www.postgresql.org/message-id/20220904205743.y3ntq6ij3aibmxvy%40awork3.anarazel.de  

M src/tools/pginclude/cpluspluscheck

Fix an assortment of improper usages of string functions

commit   : 8b26769bc441fffa8aad31dddc484c2f4043d2c9    
  
author   : David Rowley <[email protected]>    
date     : Tue, 6 Sep 2022 13:19:44 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 6 Sep 2022 13:19:44 +1200    

Click here for diff

In a similar effort to f736e188c and 110d81728, fixup various usages of  
string functions where a more appropriate function is available and more  
fit for purpose.  
  
These changes include:  
  
1. Use cstring_to_text_with_len() instead of cstring_to_text() when  
   working with a StringInfoData and the length can easily be obtained.  
2. Use appendStringInfoString() instead of appendStringInfo() when no  
   formatting is required.  
3. Use pstrdup(...) instead of psprintf("%s", ...)  
4. Use pstrdup(...) instead of psprintf(...) (with no formatting)  
5. Use appendPQExpBufferChar() instead of appendPQExpBufferStr() when the  
   length of the string being appended is 1.  
6. appendStringInfoChar() instead of appendStringInfo() when no formatting  
   is required and string is 1 char long.  
7. Use appendPQExpBufferStr(b, .) instead of appendPQExpBuffer(b, "%s", .)  
8. Don't use pstrdup when it's fine to just point to the string constant.  
  
I (David) did find other cases of #8 but opted to use #4 instead as I  
wasn't certain enough that applying #8 was ok (e.g in hba.c)  
  
Author: Ranier Vilela, David Rowley  
Discussion: https://postgr.es/m/CAApHDvo2j2+RJBGhNtUz6BxabWWh2Jx16wMUMWKUjv70Ver1vg@mail.gmail.com  

M contrib/hstore/hstore_io.c
M contrib/sepgsql/schema.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/libpq/hba.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/tablesync.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/describe.c

Fix incorrect uses of Datum conversion macros

commit   : 6bcda4a72123c3aa29fa3f03d952095675ad4468    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 28 Aug 2022 10:47:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 28 Aug 2022 10:47:10 +0200    

Click here for diff

Since these macros just cast whatever you give them to the designated  
output type, and many normal uses also cast the output type further, a  
number of incorrect uses go undiscovered.  The fixes in this patch  
have been discovered by changing these macros to inline functions,  
which is the subject of a future patch.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com  

M contrib/btree_gist/btree_utils_num.c
M contrib/dblink/dblink.c
M contrib/hstore/hstore_op.c
M contrib/pageinspect/heapfuncs.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/toast_compression.c
M src/backend/access/table/toast_helper.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/statistics/mcv.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/resowner/resowner.c
M src/pl/plperl/plperl.c

Update out of date comments in pg_trgm

commit   : 6dc0738812c3fdbd733d917267a0543ab5fdf997    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 5 Sep 2022 11:11:18 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 5 Sep 2022 11:11:18 +0200    

Click here for diff

Commit be8a7a68662 changed the check_only parameter to a flag array  
but missed updating all comments. Update, and fix a related typo.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_trgm/trgm_op.c

Check for interrupts in pg_trgm word similarity

commit   : ae4fc52ae24785f51e3dc5a4c7e5b4d206356bdc    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 5 Sep 2022 11:10:57 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 5 Sep 2022 11:10:57 +0200    

Click here for diff

Calculating similarity between large strings can be timesconsuming  
and overrun configured statement timeouts. Check for interrupts in  
the main loop to ensure query cancellation can be performed.  
  
Author: Robins Tharakan <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAEP4nAxvmfc_XWTz73bqXRhgjONi=1HaX4_NhsopA3L6UvnN1g@mail.gmail.com  

M contrib/pg_trgm/trgm_op.c

Doc: clarify partitioned table limitations

commit   : 519be095f2bf7150fe7a36c4f5cd0c1825126427    
  
author   : David Rowley <[email protected]>    
date     : Mon, 5 Sep 2022 18:43:03 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 5 Sep 2022 18:43:03 +1200    

Click here for diff

Improve documentation regarding the limitations of unique and primary key  
constraints on partitioned tables.  The existing documentation didn't make  
it clear that the constraint columns had to be present in the partition  
key as bare columns.  The reader could be led to believe that it was ok to  
include the constraint columns as part of a function call's parameters or  
as part of an expression.  Additionally, the documentation didn't mention  
anything about the fact that we disallow unique and primary key  
constraints if the partition keys contain *any* function calls or  
expressions, regardless of if the constraint columns appear as columns  
elsewhere in the partition key.  
  
The confusion here was highlighted by a report on the general mailing list  
by James Vanns.  
  
Discussion: https://postgr.es/m/CAH7vdhNF0EdYZz3GLpgE3RSJLwWLhEk7A_fiKS9dPBT3Dz_3eA@mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvoU-u9iTqKjteYRFfi+UNEk7dbSAcyxEQD==vZt9B1KnA@mail.gmail.com  
Reviewed-by: Erik Rijkers  
Backpatch-through: 11  

M doc/src/sgml/ddl.sgml

Force parallelism in partition_aggregate

commit   : 2fe6b2a806f20f2dbf02c6e79783dbc2777a1840    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 5 Sep 2022 00:09:17 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 5 Sep 2022 00:09:17 +0200    

Click here for diff

Commit db0d67db2 tweaked sort costing, which however resulted in a  
couple plan changes in our regression tests. Most of the new plans were  
fine, but partition_aggregate were meant to test parallel plans and the  
new plans were serial.  
  
Fix that by lowering parallel_setup_cost to 0, which is enough to switch  
to the parallel plan again.  
  
Commit 1349d2790 already made the plans parallel again, but do this  
anyway to keep the tests in sync with 15, to make backpatching simpler.  
  
Report and patch by David Rowley.  
  
Author: David Rowley  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/CAApHDvpVFgWzXdtUQkjyOPhNrNvumRi_=ftgS79KeAZ92tnHKQ@mail.gmail.com  

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

Fix MSVC linker error for specparse.obj

commit   : 92e7b7722da98eb4d54df7d4f850eee6a5fe9eef    
  
author   : John Naylor <[email protected]>    
date     : Sun, 4 Sep 2022 16:49:00 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 4 Sep 2022 16:49:00 +0700    

Click here for diff

Per buildfarm animals drongo  

M src/tools/msvc/Mkvcbuild.pm

Build all Flex files standalone

commit   : dac048f71ebbcf2f980d280711f8ff8001331c5d    
  
author   : John Naylor <[email protected]>    
date     : Sun, 4 Sep 2022 11:33:31 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 4 Sep 2022 11:33:31 +0700    

Click here for diff

The proposed Meson build system will need a way to ignore certain  
generated files in order to coexist with the autoconf build system,  
and C files generated by Flex which are #include'd into .y files make  
this more difficult. In similar vein to 72b1e3a21, arrange for all Flex  
C files to compile to their own .o targets.  
  
Reviewed by Andres Freund  
  
Discussion: https://www.postgresql.org/message-id/20220810171935.7k5zgnjwqzalzmtm%40awork3.anarazel.de  
Discussion: https://www.postgresql.org/message-id/CAFBsxsF8Gc2StS3haXofshHCzqNMRXiSxvQEYGwnFsTmsdwNeg@mail.gmail.com  

M contrib/cube/.gitignore
M contrib/cube/Makefile
M contrib/cube/cube.c
M contrib/cube/cubedata.h
M contrib/cube/cubeparse.y
M contrib/cube/cubescan.l
M contrib/seg/.gitignore
M contrib/seg/Makefile
M contrib/seg/segparse.y
M contrib/seg/segscan.l
M src/backend/Makefile
M src/backend/bootstrap/.gitignore
M src/backend/bootstrap/Makefile
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/replication/.gitignore
M src/backend/replication/Makefile
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/utils/adt/.gitignore
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/jsonpath_gram.y
A src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/misc/Makefile
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/bin/pgbench/.gitignore
M src/bin/pgbench/Makefile
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/test/isolation/.gitignore
M src/test/isolation/Makefile
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/tools/pginclude/headerscheck

Move private declarations shared between guc.c and guc-file.l to new header

commit   : 80e8450a744b1f6fa75663f37f1db3388995dc67    
  
author   : John Naylor <[email protected]>    
date     : Tue, 16 Aug 2022 12:01:41 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 16 Aug 2022 12:01:41 +0700    

Click here for diff

Further preparatory refactoring for compiling guc-file.c standalone.  
  
Reviewed by Andres Freund  
Discussion: https://www.postgresql.org/message-id/20220810171935.7k5zgnjwqzalzmtm%40awork3.anarazel.de  
Discussion: https://www.postgresql.org/message-id/CAFBsxsF8Gc2StS3haXofshHCzqNMRXiSxvQEYGwnFsTmsdwNeg@mail.gmail.com  

M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
A src/backend/utils/misc/guc_internal.h
M src/include/utils/guc.h

Preparatory refactoring for compiling guc-file.c standalone

commit   : 1b188ea7921a7d4f6cc569541e32c980d2221f9d    
  
author   : John Naylor <[email protected]>    
date     : Tue, 16 Aug 2022 10:42:19 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 16 Aug 2022 10:42:19 +0700    

Click here for diff

Mostly this involves moving ProcessConfigFileInternal() to guc.c  
and fixing the shared API to match.  
  
Reviewed by Andres Freund  
Discussion: https://www.postgresql.org/message-id/20220810171935.7k5zgnjwqzalzmtm%40awork3.anarazel.de  
Discussion: https://www.postgresql.org/message-id/CAFBsxsF8Gc2StS3haXofshHCzqNMRXiSxvQEYGwnFsTmsdwNeg@mail.gmail.com  

M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h

Fix sign-compare warnings arising from port/simd.h

commit   : 73b9d051c6076cf1cf1b90af505c8b379147c8b1    
  
author   : John Naylor <[email protected]>    
date     : Sun, 4 Sep 2022 09:23:57 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 4 Sep 2022 09:23:57 +0700    

Click here for diff

Noted while building an extension using -Wsign-compare.  
  
Per gripe from Pavel Stehule  
Discussion: https://www.postgresql.org/message-id/CAFj8pRAagKQHfw71aQbL8PbL0S_360M61V0_vPqJXbpUFvqnRA%40mail.gmail.com  

M src/include/port/simd.h

commit   : e062328ff11502b279186a286222f59fb9b4d15f    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 3 Sep 2022 20:57:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 3 Sep 2022 20:57:16 +0900    

Click here for diff

These have been updated by the revert done in 2f2b18b, but the  
pre-revert state was correct.  Note that the result was incorrectly  
formatted in the first case.  
  
Author: Erik Rijkers  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M doc/src/sgml/func.sgml

doc: simplify docs about analyze and inheritance/partitions

commit   : 75d5712452ee887e938535001f9efef337c644d9    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 23:32:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 23:32:19 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/analyze.sgml

doc: clarify recursion internal behavior

commit   : 8ec6a4ef3c3a6aa08f2cc235fab8c691a8b2f341    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 21:57:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 21:57:41 -0400    

Click here for diff

Reported-by: Drew DeVault  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/queries.sgml

Fix cache invalidation bug in recovery_prefetch.

commit   : 932b01630095a08797e05ba1dae279731b862c95    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 3 Sep 2022 12:58:16 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 3 Sep 2022 12:58:16 +1200    

Click here for diff

XLogPageRead() can retry internally after a pread() system call has  
succeeded, in the case of short reads, and page validation failures  
while in standby mode (see commit 0668719801).  Due to an oversight in  
commit 3f1ce973, these cases could leave stale data in the internal  
cache of xlogreader.c without marking it invalid.  The main defense  
against stale cached data on failure to read a page was in the error  
handling path of the calling function ReadPageInternal(), but that  
wasn't quite enough for errors handled internally by XLogPageRead()'s  
retry loop if we then exited with XLREAD_WOULDBLOCK.  
  
1.  ReadPageInternal() now marks the cache invalid before calling the  
    page_read callback, by setting state->readLen to 0.  It'll be set to  
    a non-zero value only after a successful read.  It'll stay valid as  
    long as the caller requests data in the cached range.  
  
2.  XLogPageRead() no long performs internal retries while reading  
    ahead.  While such retries should work, the general philosophy is  
    that we should give up prefetching if anything unusual happens so we  
    can handle it when recovery catches up, to reduce the complexity of  
    the system.  Let's do that here too.  
  
3.  While here, a new function XLogReaderResetError() improves the  
    separation between xlogrecovery.c and xlogreader.c, where the former  
    previously clobbered the latter's internal error buffer directly.  
    The new function makes this more explicit, and also clears a related  
    flag, without which a standby would needlessly retry in the outer  
    function.  
  
Thanks to Noah Misch for tracking down the conditions required for a  
rare build farm failure in src/bin/pg_ctl/t/003_promote.pl, and  
providing a reproducer.  
  
Back-patch to 15.  
  
Reported-by: Noah Misch <[email protected]>  
Discussion: https://postgr.es/m/20220807003627.GA4168930%40rfd.leadboat.com  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/include/access/xlogreader.h

Fix planner to consider matches to boolean columns in extension indexes.

commit   : ff720a597c0a53a8fcdf2cf4e45248dc5c37f9ab    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Sep 2022 17:01:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Sep 2022 17:01:51 -0400    

Click here for diff

The planner has to special-case indexes on boolean columns, because  
what we need for an indexscan on such a column is a qual of the shape  
of "boolvar = pseudoconstant".  For plain bool constants, previous  
simplification will have reduced this to "boolvar" or "NOT boolvar",  
and we have to reverse that if we want to make an indexqual.  There is  
existing code to do so, but it only fires when the index's opfamily  
is BOOL_BTREE_FAM_OID or BOOL_HASH_FAM_OID.  Thus extension AMs, or  
extension opclasses such as contrib/btree_gin, are out in the cold.  
  
The reason for hard-wiring the set of relevant opfamilies was mostly  
to avoid a catalog lookup in a hot code path.  We can improve matters  
while not taking much of a performance hit by relying on the  
hard-wired set when the opfamily OID is visibly built-in, and only  
checking the catalogs when dealing with an extension opfamily.  
  
While here, rename IsBooleanOpfamily to IsBuiltinBooleanOpfamily  
to remind future users of that macro of its limitations.  At some  
point we might want to make indxpath.c's improved version of the  
test globally accessible, but it's not presently needed elsewhere.  
  
Zongliang Quan and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/expected/bool.out
M contrib/btree_gist/expected/bool.out
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/partitioning/partprune.c
M src/include/catalog/pg_opfamily.h

Remove unused code from sepgsql

commit   : d885a6b612cf10a3013ba206a2607c88ccea42bc    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 2 Sep 2022 20:38:34 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 2 Sep 2022 20:38:34 +0200    

Click here for diff

Commit 4232c4b40 removed all callers of sepgsql_check_perms but left  
the function in place. This removes the function as well.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h

Fix PL/Perl build on Cygwin

commit   : 1c3aa54502dd7d2ced0c4e51de40aa4d61bfc04c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Sep 2022 17:56:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Sep 2022 17:56:14 +0200    

Click here for diff

This was broken by b4e936859dc441102eb0b6fb7a104f3948c90490.  The  
reason why this fixes it are not entirely clear, but it seemed the  
best way to get it working again.  
  
Discussion: https://www.postgresql.org/message-id/flat/8c4fcb72-2574-ff7c-4c25-1f032d4a2a57%40enterprisedb.com  

M src/pl/plperl/GNUmakefile

Doc: fix column list vs. replica identity rules.

commit   : 376af686111e57929c626254eb403c0e810d8e22    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 2 Sep 2022 16:44:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 2 Sep 2022 16:44:52 +0530    

Click here for diff

It was not strictly correct to say that a column list must always include  
replica identity columns because that is true for only updates and  
deletes.  
  
Author: Peter Smith  
Reviwed-by: Vignesh C, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAHut+PvOuc9=_4TbASc5=VUqh16UWtFO3GzcKQK_5m1hrW3vqg@mail.gmail.com  

M doc/src/sgml/ref/create_publication.sgml

Expand the use of get_dirent_type(), shaving a few calls to stat()/lstat()

commit   : bfb9dfd93720098cf8f3e7d802df9b02ebe3dc20    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 2 Sep 2022 16:58:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 2 Sep 2022 16:58:06 +0900    

Click here for diff

Several backend-side loops scanning one or more directories with  
ReadDir() (WAL segment recycle/removal in xlog.c, backend-side directory  
copy, temporary file removal, configuration file parsing, some logical  
decoding logic and some pgtz stuff) already know the type of the entry  
being scanned thanks to the dirent structure associated to the entry, on  
platforms where we know about DT_REG, DT_DIR and DT_LNK to make the  
difference between a regular file, a directory and a symbolic link.  
  
Relying on the direct structure of an entry saves a few system calls to  
stat() and lstat() in the loops updated here, shaving some code while on  
it.  The logic of the code remains the same, calling stat() or lstat()  
depending on if it is necessary to look through symlinks.  
  
Authors: Nathan Bossart, Bharath Rupireddy  
Reviewed-by: Andres Freund, Thomas Munro, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACV8n-J-f=yiLUOx2=HrQGPSOZM3nWzyQQvLPcccPXxEdg@mail.gmail.com  

M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/xlog.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/utils/misc/guc-file.l
M src/timezone/pgtz.c

Doc: Update struct Trigger definition.

commit   : 11e5f99d39ef58ce34c41f4163c1a3df2c639069    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 2 Sep 2022 16:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 2 Sep 2022 16:45:00 +0900    

Click here for diff

Commit 487e9861d added a new field to struct Trigger, but failed to  
update the documentation to match; backpatch to v13 where that came in.  
  
Reviewed by Richard Guo.  
  
Discussion: https://postgr.es/m/CAPmGK17NY92CyxJ%2BBG7A3JZurmng4jfRfzPiBTtNupGMF0xW1g%40mail.gmail.com  

M doc/src/sgml/trigger.sgml

Speed up lexing of long JSON strings

commit   : 0a8de93a48ce1e7479fb75fe10a8859559ec0c09    
  
author   : John Naylor <[email protected]>    
date     : Wed, 31 Aug 2022 10:39:17 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 31 Aug 2022 10:39:17 +0700    

Click here for diff

Use optimized linear search when looking ahead for end quotes,  
backslashes, and non-printable characters. This results in nearly 40%  
faster JSON parsing on x86-64 when most values are long strings, and  
all platforms should see some improvement.  
  
Reviewed by Andres Freund and Nathan Bossart  
Discussion: https://www.postgresql.org/message-id/CAFBsxsGhaR2KQ5eisaK%3D6Vm60t%3DaxhD8Ckj1qFoCH1pktZi%2B2w%40mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/CAFBsxsESLUyJ5spfOSyPrOvKUEYYNqsBosue9SV1j8ecgNXSKA%40mail.gmail.com  

M src/common/jsonapi.c
M src/test/regress/expected/json.out
M src/test/regress/sql/json.sql

Move darwin sysroot determination into separate file

commit   : 05519126a02ee39bf0957d3d85a1da5bd7e1c09c    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Sep 2022 16:54:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Sep 2022 16:54:19 -0700    

Click here for diff

The sysroot determination is fairly complex and will soon also be needed when  
building with meson. Instead of duplicating the logic, move it to a dedicated  
shell script invoked both by configure and meson.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/template/darwin
A src/tools/darwin_sysroot

Revert SQL/JSON features

commit   : 2f2b18bd3f554e96a8cc885b177211be12288e4a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Sep 2022 17:07:14 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Sep 2022 17:07:14 -0400    

Click here for diff

The reverts the following and makes some associated cleanups:  
  
    commit f79b803dc: Common SQL/JSON clauses  
    commit f4fb45d15: SQL/JSON constructors  
    commit 5f0adec25: Make STRING an unreserved_keyword.  
    commit 33a377608: IS JSON predicate  
    commit 1a36bc9db: SQL/JSON query functions  
    commit 606948b05: SQL JSON functions  
    commit 49082c2cc: RETURNING clause for JSON() and JSON_SCALAR()  
    commit 4e34747c8: JSON_TABLE  
    commit fadb48b00: PLAN clauses for JSON_TABLE  
    commit 2ef6f11b0: Reduce running time of jsonb_sqljson test  
    commit 14d3f24fa: Further improve jsonb_sqljson parallel test  
    commit a6baa4bad: Documentation for SQL/JSON features  
    commit b46bcf7a4: Improve readability of SQL/JSON documentation.  
    commit 112fdb352: Fix finalization for json_objectagg and friends  
    commit fcdb35c32: Fix transformJsonBehavior  
    commit 4cd8717af: Improve a couple of sql/json error messages  
    commit f7a605f63: Small cleanups in SQL/JSON code  
    commit 9c3d25e17: Fix JSON_OBJECTAGG uniquefying bug  
    commit a79153b7a: Claim SQL standard compliance for SQL/JSON features  
    commit a1e7616d6: Rework SQL/JSON documentation  
    commit 8d9f9634e: Fix errors in copyfuncs/equalfuncs support for JSON node types.  
    commit 3c633f32b: Only allow returning string types or bytea from json_serialize  
    commit 67b26703b: expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size.  
  
The release notes are also adjusted.  
  
Backpatch to release 15.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/keywords/sql2016-02-reserved.txt
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/makefuncs.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/Makefile
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
D src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parser.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.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/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/nodes/makefuncs.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/utils/formatting.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
D src/test/regress/expected/json_sqljson.out
D src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/expected/opr_sanity.out
D src/test/regress/expected/sqljson.out
M src/test/regress/parallel_schedule
D src/test/regress/sql/json_sqljson.sql
D src/test/regress/sql/jsonb_sqljson.sql
M src/test/regress/sql/opr_sanity.sql
D src/test/regress/sql/sqljson.sql
M src/tools/pgindent/typedefs.list

Add a regression test for contrib/pgrowlocks.

commit   : 90247e742f849794d061a0444071647728054b45    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Sep 2022 15:02:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Sep 2022 15:02:34 -0400    

Click here for diff

Dong Wook Lee, revised a bit by me  
  
Discussion: https://postgr.es/m/20220629055326.tdswmcjcr5jzbrsk@home-desktop  

A contrib/pgrowlocks/.gitignore
M contrib/pgrowlocks/Makefile
A contrib/pgrowlocks/expected/pgrowlocks.out
A contrib/pgrowlocks/specs/pgrowlocks.spec

aix: when building with gcc, tell gcc we're building a shared library

commit   : e5484554ba90536aaff42db588a6397633713c43    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Sep 2022 11:49:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Sep 2022 11:49:36 -0700    

Click here for diff

Not passing -shared to gcc when building a shared library triggers linking to  
the wrong libgcc (libgcc.a instead of libgcc_s.a) and prevents emitting  
correct unwind information. It's somewhat surprising that this hasn't caused  
known problems so far.  
  
Doing so requires adding path to libgcc to libpath, or linking statically to  
libgcc - as the latter increases .so size substantially (for not entirely  
obvious reasons), shared linking seems preferrable.  It likely is worth  
building executables with -shared-libgcc too, but I've not done that here.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/makefiles/Makefile.aix

Use --load-extension to set up for contrib/tcn's isolation tests.

commit   : a1b9b14cc80327854ff667973096a230434a2386    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Sep 2022 14:30:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Sep 2022 14:30:41 -0400    

Click here for diff

Oversight in commit 418ec3207: it's better to do it like this,  
else you have to drop and recreate the extension for each  
permutation.  tcn.spec only has one permutation at present,  
so this doesn't speed it up any, but it's still a bad example.  

M contrib/tcn/Makefile
M contrib/tcn/specs/tcn.spec

doc: in create statistics docs, mention analyze for parent info

commit   : 97fe6d2210d4c6a0be3ff16abc9432b2c0a867b8    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 23:11:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 23:11:46 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

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

doc: mention "bloom" as a possible index access method

commit   : dd03dfeb3bc952818a34aaee30c31d491190aa21    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:35:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:35:09 -0400    

Click here for diff

Also remove USING erroneously added recently.  
  
Reported-by: Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1zhCpC7hottyMWM5Pimr9vRLprSwzLg+7PgajWhKZqRzw@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml

Adjust XML test case to avoid unstable behavior.

commit   : 4ea07e7cf3c6b5ff7a7059c223fa54241533b0a5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 22:21:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 22:21:32 -0400    

Click here for diff

Buildfarm member bowerbird is (inconsistently) showing different  
results for this test case since we enabled ASLR for MSVC builds.  
It's not very clear whether that's a bug in its version of libxml2  
or the test case is relying on nominally-undefined behavior, ie the  
ordering of results from XPath's node().  It seems quite unlikely  
that it's *our* bug though, and what's more, using node() adds  
nothing to the test coverage so far as our code is concerned.  
So, tweak the test to not use node().  
  
For the moment, only change HEAD because we've only seen the  
problem there.  Perhaps a case will emerge for back-patching.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

doc: use FILTER in aggregate example

commit   : fede15417225c08479fc6cd10812a25826c65f86    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:19:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:19:06 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/query.sgml

doc: clarify that pgcrypto's gen_random_uuid calls core func.

commit   : fbd597e0b80d5590594be187a7c51e29ac7c5ca2    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:04:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:04:36 -0400    

Click here for diff

Previously it was just marked as a duplicate of the core function.  
  
Reported-by: Andreas Dijkman  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 13  

M doc/src/sgml/pgcrypto.sgml

doc: split out the NATURAL/CROSS JOIN in SELECT syntax

commit   : 3e337b585a13e61929c184730c0ad6ac97c05a38    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 21:46:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 21:46:14 -0400    

Click here for diff

This allows the syntax to be more accurate about what clauses are  
supported.  Also switch an example query to use the ANSI join syntax.  
  
Reported-by: Joel Jacobson  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

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

doc: warn of SECURITY DEFINER schemas for non-sql_body functions

commit   : 1703726488064901e05aeb24b463e1dc3d07bde9    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 21:10:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 21:10:37 -0400    

Click here for diff

Non-sql_body functions are evaluated at runtime.  
  
Reported-by: Erki Eessaar  
  
Discussion: https://postgr.es/m/AM9PR01MB8268BF5E74E119828251FD34FE409@AM9PR01MB8268.eurprd01.prod.exchangelabs.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_function.sgml

doc: mention that SET TIME ZONE often needs to be quoted

commit   : a009cb3141e35f07791510c13992b087dc835467    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 20:27:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 20:27:27 -0400    

Click here for diff

Also mention that time zone abbreviations are not supported.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/set.sgml

doc: document the maximum char/varchar length value

commit   : 62c49fca1330954a678d1d74e2a7883eb950fcff    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 19:43:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 19:43:06 -0400    

Click here for diff

Reported-by: Japin Li  
  
Discussion: https://postgr.es/m/MEYP282MB1669B13E98AE531617CB1386B6979@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  
  
Backpatch-through: 10  

M doc/src/sgml/datatype.sgml

doc: show direction is optional in FETCH/MOVE's FROM/IN syntax

commit   : 9bdad1b5153e5d6b77a8f9c6e32286d6bafcd76d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 19:28:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 19:28:42 -0400    

Click here for diff

It used to show direction was required for FROM/IN.  
  
Reported-by: Rob <[email protected]>  
  
Discussion: https://postgr.es/m/20211015165248.isqjceyilelhnu3k@localhost  
  
Author: Rob <[email protected]>  
  
Backpatch-through: 10  

M doc/src/sgml/ref/fetch.sgml
M doc/src/sgml/ref/move.sgml

Be smarter about freeing tuples during tuplesorts

commit   : 1083f94dacde5f5b383ca8e18a85babb5cb5e77f    
  
author   : David Rowley <[email protected]>    
date     : Thu, 1 Sep 2022 11:08:10 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 1 Sep 2022 11:08:10 +1200    

Click here for diff

During dumptuples() the call to writetuple() would pfree any non-null  
tuple.  This was quite wasteful as this happens just before we perform a  
reset of the context which stores all of those tuples.  
  
It seems to make sense to do a bit of a code refactor to make this work,  
so here we just get rid of the writetuple function and adjust the WRITETUP  
macro to call the state's writetup function.  The WRITETUP usage in  
mergeonerun() always has state->slabAllocatorUsed == true, so writetuple()  
would never free the tuple or do any memory accounting.  The only call  
path that needs memory accounting done is in dumptuples(), so let's just  
do it manually there.  
  
In passing, let's get rid of the state->memtupcount-- code that counts the  
memtupcount down to 0 one tuple at a time inside the loop.  That seems to  
be a rather inefficient way to set memtupcount to 0, so let's just zero it  
after the loop instead.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvqZXoDCyrfCzZJR0-xH+7_q+GgitcQiYXUjRani7h4j8Q@mail.gmail.com  

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

doc: simplify WITH clause syntax in CREATE DATABASE

commit   : 349baa87ae4bf1c65c3ed34073837a71a725b30b    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 17:08:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 17:08:44 -0400    

Click here for diff

Reported-by: Rob <[email protected]>  
  
Discussion: https://postgr.es/m/20211016171149.yaouvlw5kvux6dvk@localhost  
  
Author: Rob <[email protected]>  
  
Backpatch-through: 10  

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

Prevent long-term memory leakage in autovacuum launcher.

commit   : 1c1294be716d96e804aadafc249fcbfa8367621d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 16:23:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 16:23:20 -0400    

Click here for diff

get_database_list() failed to restore the caller's memory context,  
instead leaving current context set to TopMemoryContext which is  
how CommitTransactionCommand() leaves it.  The callers both think  
they are using short-lived contexts, for the express purpose of  
not having to worry about cleaning up individual allocations.  
The net effect therefore is that supposedly short-lived allocations  
could accumulate indefinitely in the launcher's TopMemoryContext.  
  
Although this has been broken for a long time, it seems we didn't  
have any obvious memory leak here until v15's rearrangement of the  
stats logic.  I (tgl) am not entirely convinced that there's no  
other leak at all, though, and we're surely at risk of adding one  
in future back-patched fixes.  So back-patch to all supported  
branches, even though this may be only a latent bug in pre-v15.  
  
Reid Thompson  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

Derive freeze cutoff from nextXID, not OldestXmin.

commit   : c3ffa731a5f99c4361203015ce2219d209fea94c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 31 Aug 2022 11:37:35 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 31 Aug 2022 11:37:35 -0700    

Click here for diff

Before now, the cutoffs that VACUUM used to determine which XIDs/MXIDs  
to freeze were determined at the start of each VACUUM by taking related  
cutoffs that represent which XIDs/MXIDs VACUUM should treat as still  
running, and subtracting an XID/MXID age based value controlled by GUCs  
like vacuum_freeze_min_age.  The FreezeLimit cutoff (XID freeze cutoff)  
was derived by subtracting an XID age value from OldestXmin, while the  
MultiXactCutoff cutoff (MXID freeze cutoff) was derived by subtracting  
an MXID age value from OldestMxact.  This approach didn't match the  
approach used nearby to determine whether this VACUUM operation should  
be an aggressive VACUUM or not.  
  
VACUUM now uses the standard approach instead: it subtracts the same  
age-based values from next XID/next MXID (rather than subtracting from  
OldestXmin/OldestMxact).  This approach is simpler and more uniform.  
Most of the time it will have only a negligible impact on how and when  
VACUUM freezes.  It will occasionally make VACUUM more robust in the  
event of problems caused by long running transaction.  These are cases  
where OldestXmin and OldestMxact are held back by so much that they  
attain an age that is a significant fraction of the value of age-based  
settings like vacuum_freeze_min_age.  
  
There is no principled reason why freezing should be affected in any way  
by the presence of a long-running transaction -- at least not before the  
point that the OldestXmin and OldestMxact limits used by each VACUUM  
operation attain an age that makes it unsafe to freeze some of the  
XIDs/MXIDs whose age exceeds the value of the relevant age-based  
settings.  The new approach should at least make freezing degrade more  
gracefully than before, even in the most extreme cases.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Nathan Bossart <[email protected]>  
Reviewed-By: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkOv5CEeyOO=c91XnT5WBR_0gii0Wn5UbZhJ=4TTykDYg@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Fix MSVC warning in compat_informix/rnull.pgc

commit   : 483ac6476198c66696b725d49aa42290a9a94a95    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 31 Aug 2022 09:31:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 31 Aug 2022 09:31:22 -0700    

Click here for diff

Building the ecpg tests with MSVC, with warnings enabled, results in the  
following warning:  
src/interfaces/ecpg/test/compat_informix/rnull.pgc(19,1): warning C4305: 'initializing': truncation from 'double' to 'float'  
  
The more obvious fix would be an 'f' suffix, but ecpg can't parse that.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/compat_informix/rnull.pgc
M src/interfaces/ecpg/test/expected/compat_informix-rnull.c

In the Snowball dictionary, don't try to stem excessively-long words.

commit   : 1058555a5eccffd17c47edf3e15dd7e26934b492    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 10:42:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 10:42:05 -0400    

Click here for diff

If the input word exceeds 1000 bytes, don't pass it to the stemmer;  
just return it as-is after case folding.  Such an input is surely  
not a word in any human language, so whatever the stemmer might  
do to it would be pretty dubious in the first place.  Adding this  
restriction protects us against a known recursion-to-stack-overflow  
problem in the Turkish stemmer, and it seems like good insurance  
against any other safety or performance issues that may exist in  
the Snowball stemmers.  (I note, for example, that they contain no  
CHECK_FOR_INTERRUPTS calls, so we really don't want them running  
for a long time.)  The threshold of 1000 bytes is arbitrary.  
  
An alternative definition could have been to treat such words as  
stopwords, but that seems like a bigger break from the old behavior.  
  
Per report from Egor Chindyaskin and Alexander Lakhin.  
Thanks to Olly Betts for the recommendation to fix it this way.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/snowball/dict_snowball.c

Fix a bug in roles_is_member_of.

commit   : 0101f770a05b07dd7a8e05b6f8f95d4e22f4e846    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 30 Aug 2022 08:32:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 30 Aug 2022 08:32:35 -0400    

Click here for diff

Commit e3ce2de09d814f8770b2e3b3c152b7671bcdb83f rearranged this  
function to be able to identify which inherited role had admin option  
on the target role, but it got the order of operations wrong, causing  
the function to return wrong answers in the presence of non-inherited  
grants.  
  
Fix that, and add a test case that verifies the correct behavior.  
  
Patch by me, reviewed by Nathan Bossart  
  
Discussion: http://postgr.es/m/CA+TgmoYamnu-xt-u7CqjYWnRiJ6BQaSpYOHXP=r4QGTfd1N_EA@mail.gmail.com  

M src/backend/utils/adt/acl.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

doc: Fix typo in user inheritance documentation

commit   : c7892c253fdc7bcb99a61e820798588ee4c071b9    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 31 Aug 2022 13:32:52 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 31 Aug 2022 13:32:52 +0200    

Click here for diff

Commit 620ac285483 accidentally introduced a typo in the privilege  
inheritance documentation  

M doc/src/sgml/user-manag.sgml

Refactor check_ functions to use filehandle for status

commit   : cad4323cd345ec91fbe8d118436d3d50fa53c300    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 31 Aug 2022 13:06:50 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 31 Aug 2022 13:06:50 +0200    

Click here for diff

When reporting failure in check_ functions there is (typically) a text-  
file mentioned in the error report which contains further details. Some  
check_ functions kept a separate flag variable to indicate failure, and  
some just checked the state of the filehandle as it's guaranteed to be  
open when the check failed. This refactors the functions to consistently  
do the same check on error reporting. As the error report contains the  
filepath, it makes more sense to check the filehandle state and skip the  
flag variable.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Reviewed-by: Bruce Momjian <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/version.c

plpython: Don't create pgxsdir subdirectory in installdir target

commit   : 7d5852ca83f4103d806ee7501f70b9354345f65d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 31 Aug 2022 07:42:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 31 Aug 2022 07:42:01 +0200    

Click here for diff

As of db23464715f4792298c639153dda7bfd9ad9d602, we don't install  
anything there anymore from plpython, so we don't need to create the  
installation directory anymore.  

M src/pl/plpython/Makefile

On NetBSD, force dynamic symbol resolution at postmaster start.

commit   : 8acd8f8690ed10f421a54e9b3fb6d49f2ce226f8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2022 17:28:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2022 17:28:32 -0400    

Click here for diff

The default of lazy symbol resolution means that when the postmaster  
first reaches the select() call in ServerLoop, it'll need to resolve  
the link to that libc entry point.  NetBSD's dynamic loader takes  
an internal lock while doing that, and if a signal interrupts the  
operation then there is a risk of self-deadlock should the signal  
handler do anything that requires that lock, as several of the  
postmaster signal handlers do.  The window for this is pretty narrow,  
and timing considerations make it unlikely that a signal would arrive  
right then anyway.  But it's semi-repeatable on slow single-CPU  
machines, and in principle the race could happen with any hardware.  
  
The least messy solution to this is to force binding of dynamic  
symbols at postmaster start, using the "-z now" linker option.  
While we're at it, also use "-z relro" so as to provide a small  
security gain.  
  
It's not entirely clear whether any other platforms share this  
issue, but for now we'll assume it's NetBSD-specific.  (We might  
later try to use "-z now" on more platforms for performance  
reasons, but that would not likely be something to back-patch.)  
  
Report and patch by me; the idea to fix it this way is from  
Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/template/netbsd

Various cleanups of the new memory context header code

commit   : 05f90842369538cf94bbd09970a008b9357f4101    
  
author   : David Rowley <[email protected]>    
date     : Wed, 31 Aug 2022 07:33:54 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 31 Aug 2022 07:33:54 +1200    

Click here for diff

Robert Haas reported that his older clang compiler didn't like the two  
Asserts which were verifying that the given MemoryContextMethodID was <=  
MEMORY_CONTEXT_METHODID_MASK when building with  
-Wtautological-constant-out-of-range-compare.  In my (David's) opinion,  
the compiler is wrong to warn about that.  Newer versions of clang don't  
warn about the out of range enum value, so perhaps this was a bug that has  
now been fixed.  To keep older clang versions happy, let's just cast the  
enum value to int to stop the compiler complaining.  
  
The main reason for the Asserts mentioned above to exist are to inform  
future developers which are adding new MemoryContexts if they run out of  
bit space in MemoryChunk to store the MemoryContextMethodID.  As pointed  
out by Tom Lane, it seems wise to also add a comment to the header for  
that enum to document the restriction on these enum values.  
  
Additionally, also fix an incorrect usage of UINT64CONST() which was  
introduced in c6e0fe1f2.  
  
Author: Robert Haas, David Rowley  
Discussion: https://postgr.es/m/CA+TgmoYGG2C7Vbw1cjkQRRBL3zOk8SmhrQnsJgzscX=N9AwPrw@mail.gmail.com  

M src/include/utils/memutils_internal.h
M src/include/utils/memutils_memorychunk.h

Revert "Add missing padding from MemoryChunk struct"

commit   : 5495796ad12aae971137d184ff25add8f6b03968    
  
author   : David Rowley <[email protected]>    
date     : Wed, 31 Aug 2022 03:06:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 31 Aug 2022 03:06:31 +1200    

Click here for diff

This reverts commit df0f4feef.  It turns out the problem which was causing  
the 32-bit ARM and PPC animals to fail was due to a MAXALIGN problem in  
slab.c.  This was fixed by d5ee4db0e.  The padding that was added in  
df0f4feef would only do anything on machines where uint64 was not aligned  
to 8 bytes.  The 32-bit machines which were failing are not in that  
category, so revert this commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/utils/memutils_memorychunk.h

Update the comment in rmgrlist.h to match it to the code.

commit   : c98b6acdb252546e9bea0b9a37d95ca63d2ff0fa    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 30 Aug 2022 09:16:41 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 30 Aug 2022 09:16:41 +0530    

Click here for diff

Author: Hayato Kuroda  
Reviwed-by: Amit Kapila  
Discussion: https://postgr.es/m/TYAPR01MB58665F20F412EDF27B0759CFF5769@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/include/access/rmgrlist.h

Drop replication origin slots before tablesync worker exits.

commit   : f6c5edb8abcac04eb3eac6da356e59d399b2bcef    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 30 Aug 2022 08:51:41 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 30 Aug 2022 08:51:41 +0530    

Click here for diff

Currently, the replication origin tracking of the tablesync worker is  
dropped by the apply worker. So, there will be a small lag between the  
tablesync worker exit and its origin tracking got removed. In the  
meantime, new tablesync workers can be launched and will try to set up  
a new origin tracking. This can lead the system to reach max configured  
limit (max_replication_slots) even if the user has configured the max  
limit considering the number of tablesync workers required in the system.  
  
We decided not to back-patch as this can occur in very narrow  
circumstances and users have to option to increase the configured limit by  
increasing max_replication_slots.  
  
Reported-by: Hubert Depesz Lubaczewski  
Author: Ajin Cherian  
Reviwed-by: Masahiko Sawada, Peter Smith, Hou Zhijie, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

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

Further code review of port/simd.h

commit   : 865424627db638acdbe4b5d0384d0b9cd34838a5    
  
author   : John Naylor <[email protected]>    
date     : Tue, 30 Aug 2022 09:44:44 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 30 Aug 2022 09:44:44 +0700    

Click here for diff

Add missing declaration per existing style, and fix a couple typos.  
  
Nathan Bossart and Julien Rouhaud  
  
Discussion: https://www.postgresql.org/message-id/20220829171712.GA509233%40nathanxps13  
Discussion: https://www.postgresql.org/message-id/20220830022636.qrcbcecmhztbxrwa%40jrouhaud  

M src/include/port/simd.h

Adjust comments that called MultiXactIds "XMIDs".

commit   : 9887dd38f9660721e4ef63333ab81a60b1b3da92    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 29 Aug 2022 19:42:30 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 29 Aug 2022 19:42:30 -0700    

Click here for diff

Oversights in commits 0b018fab and f3c15cbe.  

M src/backend/access/heap/heapam.c
M src/backend/commands/vacuum.c
M src/test/isolation/specs/vacuum-no-cleanup-lock.spec

Use MAXALIGN() in calculations using sizeof(SlabBlock)

commit   : d5ee4db0eaf65fb99e20907d5b3355e8bf38aeaf    
  
author   : David Rowley <[email protected]>    
date     : Tue, 30 Aug 2022 14:36:04 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 30 Aug 2022 14:36:04 +1200    

Click here for diff

c6e0fe1f2 added a new pointer field to SlabBlock to make it 4 bytes larger  
on 32-bit machines.  Prior to that commit, the size of that struct was a  
multiple of 8, which meant that MAXALIGN(sizeof(SlabBlock)) was the same  
as sizeof(SlabBlock), however, after c6e0fe1f2, due to the addition of the  
new pointer field to store a pointer to the owning context, that was no  
longer true on builds with sizeof(void *) == 4.  
  
This problem was highlighted by an Assert failure which was checking that  
the pointer given to pfree() was MAXALIGNED.  Various 32-bit ARM buildfarm  
animals were failing.  These have MAXIMUM_ALIGNOF of 8.  The only 32-bit  
testing I'd managed to do on c6e0fe1f2 had been on x86, which has a  
MAXIMUM_ALIGNOF of 4, therefore did not exhibit this issue.  
  
Here we define Slab_BLOCKHDRSZ and copy what is being done in aset.c and  
generation.c for doing calculations based on the size of the context's  
block type.  This means that SlabAlloc() will now always return a  
MAXALIGNed pointer.  
  
This also fixes an incorrect sentinel_ok() check in SlabCheck() which was  
incorrectly checking the wrong sentinel byte.  This must have previously  
not caused any issues due to the fullChunkSize never being large enough to  
store the sentinel byte.  
  
Diagnosed-by: Tomas Vondra, Tom Lane  
Author: Tomas Vondra, David Rowley  
Discussion: https://postgr.es/m/CAA4eK1%2B1JyW5TiL%3DyV-3Uq1CrfnTyn0Xrk5uArt31Z%3D8rgPhXQ%40mail.gmail.com  

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

commit   : b1ec7f47e396be7dd71d19328153c2e8dce80222    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 30 Aug 2022 09:52:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 30 Aug 2022 09:52:58 +0900    

Click here for diff

All the code and comments cleaned up here is irrelevant since 495ed0e.  
Note that this removes an assumption that CreateRestrictedToken() may  
not exist, something that could have happened when running under Windows  
NT as the code stated.  Rather than assuming that it may not exist, this  
causes pg_ctl to fail hard if the function cannot be loaded.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32/socket.c
M src/bin/pg_ctl/pg_ctl.c
M src/interfaces/libpq/win32.c
M src/port/dirmod.c

Clean up inconsistent use of fflush().

commit   : 7fed801135bae14d63b11ee4a10f6083767046d8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Aug 2022 13:55:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Aug 2022 13:55:38 -0400    

Click here for diff

More than twenty years ago (79fcde48b), we hacked the postmaster  
to avoid a core-dump on systems that didn't support fflush(NULL).  
We've mostly, though not completely, hewed to that rule ever since.  
But such systems are surely gone in the wild, so in the spirit of  
cleaning out no-longer-needed portability hacks let's get rid of  
multiple per-file fflush() calls in favor of using fflush(NULL).  
  
Also, we were fairly inconsistent about whether to fflush() before  
popen() and system() calls.  While we've received no bug reports  
about that, it seems likely that at least some of these call sites  
are at risk of odd behavior, such as error messages appearing in  
an unexpected order.  Rather than expend a lot of brain cells  
figuring out which places are at hazard, let's just establish a  
uniform coding rule that we should fflush(NULL) before these calls.  
A no-op fflush() is surely of trivial cost compared to launching  
a sub-process via a shell; while if it's not a no-op then we likely  
need it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogarchive.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/shell_archive.c
M src/backend/storage/file/fd.c
M src/backend/utils/error/elog.c
M src/bin/initdb/initdb.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/copy.c
M src/bin/psql/prompt.c
M src/bin/psql/psqlscanslash.l
M src/common/exec.c
M src/fe_utils/archive.c
M src/fe_utils/print.c
M src/interfaces/libpq/fe-print.c
M src/test/regress/pg_regress.c

Remove stray "the".

commit   : 20796536c10fe7869e7af2c69615f14a80555c5d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 29 Aug 2022 12:35:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 29 Aug 2022 12:35:46 -0400    

Click here for diff

Per off-list report.  

M doc/src/sgml/user-manag.sgml

Prevent WAL corruption after a standby promotion.

commit   : 6672d7913929b82ec723a54381773d9cdc20fe9d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 29 Aug 2022 10:47:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 29 Aug 2022 10:47:12 -0400    

Click here for diff

When a PostgreSQL instance performing archive recovery but not using  
standby mode is promoted, and the last WAL segment that it attempted  
to read ended in a partial record, the previous code would create  
invalid WAL on the new timeline. The WAL from the previously timeline  
would be copied to the new timeline up until the end of the last valid  
record, but instead of beginning to write WAL at immediately  
afterwards, the promoted server would write an overwrite contrecord at  
the beginning of the next segment. The end of the previous segment  
would be left as all-zeroes, resulting in failures if anything tried  
to read WAL from that file.  
  
The root of the issue is that ReadRecord() decides whether to set  
abortedRecPtr and missingContrecPtr based on the value of StandbyMode,  
but ReadRecord() switches to a new timeline based on the value of  
ArchiveRecoveryRequested. We shouldn't try to write an overwrite  
contrecord if we're switching to a new timeline, so change the test in  
ReadRecod() to check ArchiveRecoveryRequested instead.  
  
Code fix by Dilip Kumar. Comments by me incorporating suggested  
language from Álvaro Herrera. Further review from Kyotaro Horiguchi  
and Sami Imseih.  
  
Discussion: http://postgr.es/m/CAFiTN-t7umki=PK8dT1tcPV=mOUe2vNhHML6b3T7W7qqvvajjg@mail.gmail.com  
Discussion: http://postgr.es/m/FB0DEA0B-E14E-43A0-811F-C1AE93D00FF3%40amazon.com  

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

docs: Fix up some out-of-date references to INHERIT/NOINHERIT.

commit   : 620ac285483fd78a54206a8b523a877ba8fd1e9b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 29 Aug 2022 10:10:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 29 Aug 2022 10:10:09 -0400    

Click here for diff

Commit e3ce2de09d814f8770b2e3b3c152b7671bcdb83f should have updated  
these sections of the documentation, but failed to do so.  
  
Patch by me, reviewed by Nathan Bossart.  
  
Discussion: http://postgr.es/m/CA+TgmoaKMnde2W_=u7CqeCKi=FKnfbNQPwOR=c_3c8qD7b2nhQ@mail.gmail.com  

M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/user-manag.sgml

Add missing padding from MemoryChunk struct

commit   : df0f4feef8de933be61ce3e73142c82c37b17fa4    
  
author   : David Rowley <[email protected]>    
date     : Mon, 29 Aug 2022 23:20:25 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 29 Aug 2022 23:20:25 +1200    

Click here for diff

Buildfarm animals skate, grison and mamba are Assert failing on the  
pointer being given to repalloc not being MAXALIGNED.  c6e0fe1f2a made  
changes in that area.  
  
All of these animals are 32-bit with a MAXIMUM_ALIGNOF of 8 and a  
SIZEOF_VOID_P of 4.  I suspect that the pointer is not properly aligned due  
to the lack of padding in the MemoryChunk struct.  
  
Here we add the same type of padding that was previously used in  
AllocChunkData and GenerationChunk that c6e0fe1f2a neglected to add.  
  
Discussion: https://postgr.es/m/CAA4eK1%2B1JyW5TiL%3DyV-3Uq1CrfnTyn0Xrk5uArt31Z%3D8rgPhXQ%40mail.gmail.com  

M src/include/utils/memutils_memorychunk.h

Fix broken cast on MSVC

commit   : c6a43c25a8ba1a825588f7af25a7173f2e66ce8d    
  
author   : John Naylor <[email protected]>    
date     : Mon, 29 Aug 2022 17:25:59 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 29 Aug 2022 17:25:59 +0700    

Click here for diff

Per buildfarm animal drongo, casting a vector type to the same type  
causes a compile error. We still need the cast on ARM64, so invent a  
wrapper function that does the casting only where necessary.  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsEouaTwbmpqV%2BEW2%3DwFbhw2vHRe26NQTRcd0%3DNaOFDy7A%40mail.gmail.com  

M src/include/port/pg_lfind.h
M src/include/port/simd.h

Use ARM Advanced SIMD (NEON) intrinsics where available

commit   : 82739d4a80f2eeb2f96b56477bb04e463ea24800    
  
author   : John Naylor <[email protected]>    
date     : Mon, 29 Aug 2022 14:32:54 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 29 Aug 2022 14:32:54 +0700    

Click here for diff

NEON support is required on the Aarch64 architecture for standard  
implementations. Hardware designers for specialized markets can choose  
not to support it, but that's true of floating point as well, which  
we assume is supported. As with x86, some SIMD support is available  
on 32-bit platforms, but those are not interesting from a performance  
standpoint and would require an inconvenient runtime check.  
  
Nathan Bossart  
  
Reviewed by John Naylor, Andres Freund, Thomas Munro, and Tom Lane  
Discussion: https://www.postgresql.org/message-id/flat/CAFBsxsEyR9JkfbPcDXBRYEfdfC__OkwVGdwEAgY4Rv0cvw35EA%40mail.gmail.com#aba7a64b11503494ffd8dd27067626a9  

M src/include/port/simd.h

Abstract some more architecture-specific details away from SIMD functionality

commit   : f8f19f70868c6351b80f02a47fa65d56b728a5a2    
  
author   : John Naylor <[email protected]>    
date     : Mon, 29 Aug 2022 13:40:53 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 29 Aug 2022 13:40:53 +0700    

Click here for diff

Add a typedef to represent vectors containing four 32-bit integers,  
and add functions operating on them. Also separate out saturating  
subtraction into its own function. The motivation for this is to  
prepare for a future commit to add ARM NEON support.  
  
Nathan Bossart  
  
Reviewed by John Naylor and Tom Lane  
Discussion: https://www.postgresql.org/message-id/flat/CAFBsxsEyR9JkfbPcDXBRYEfdfC__OkwVGdwEAgY4Rv0cvw35EA%40mail.gmail.com#aba7a64b11503494ffd8dd27067626a9  

M src/include/port/pg_lfind.h
M src/include/port/simd.h

Improve performance of and reduce overheads of memory management

commit   : c6e0fe1f2a08505544c410f613839664eea9eb21    
  
author   : David Rowley <[email protected]>    
date     : Mon, 29 Aug 2022 17:15:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 29 Aug 2022 17:15:00 +1200    

Click here for diff

Whenever we palloc a chunk of memory, traditionally, we prefix the  
returned pointer with a pointer to the memory context to which the chunk  
belongs.  This is required so that we're able to easily determine the  
owning context when performing operations such as pfree() and repalloc().  
  
For the AllocSet context, prior to this commit we additionally prefixed  
the pointer to the owning context with the size of the chunk.  This made  
the header 16 bytes in size.  This 16-byte overhead was required for all  
AllocSet allocations regardless of the allocation size.  
  
For the generation context, the problem was worse; in addition to the  
pointer to the owning context and chunk size, we also stored a pointer to  
the owning block so that we could track the number of freed chunks on a  
block.  
  
The slab allocator had a 16-byte chunk header.  
  
The changes being made here reduce the chunk header size down to just 8  
bytes for all 3 of our memory context types.  For small to medium sized  
allocations, this significantly increases the number of chunks that we can  
fit on a given block which results in much more efficient use of memory.  
  
Additionally, this commit completely changes the rule that pointers to  
palloc'd memory must be directly prefixed by a pointer to the owning  
memory context and instead, we now insist that they're directly prefixed  
by an 8-byte value where the least significant 3-bits are set to a value  
to indicate which type of memory context the pointer belongs to.  Using  
those 3 bits as an index (known as MemoryContextMethodID) to a new array  
which stores the methods for each memory context type, we're now able to  
pass the pointer given to functions such as pfree() and repalloc() to the  
function specific to that context implementation to allow them to devise  
their own methods of finding the memory context which owns the given  
allocated chunk of memory.  
  
The reason we're able to reduce the chunk header down to just 8 bytes is  
because of the way we make use of the remaining 61 bits of the required  
8-byte chunk header.  Here we also implement a general-purpose MemoryChunk  
struct which makes use of those 61 remaining bits to allow the storage of  
a 30-bit value which the MemoryContext is free to use as it pleases, and  
also the number of bytes which must be subtracted from the chunk to get a  
reference to the block that the chunk is stored on (also 30 bits).  The 1  
additional remaining bit is to denote if the chunk is an "external" chunk  
or not.  External here means that the chunk header does not store the  
30-bit value or the block offset.  The MemoryContext can use these  
external chunks at any time, but must use them if any of the two 30-bit  
fields are not large enough for the value(s) that need to be stored in  
them.  When the chunk is marked as external, it is up to the MemoryContext  
to devise its own means to determine the block offset.  
  
Using 3-bits for the MemoryContextMethodID does mean we're limiting  
ourselves to only having a maximum of 8 different memory context types.  
We could reduce the bit space for the 30-bit value a little to make way  
for more than 3 bits, but it seems like it might be better to do that only  
if we ever need more than 8 context types.  This would only be a problem  
if some future memory context type which does not use MemoryChunk really  
couldn't give up any of the 61 remaining bits in the chunk header.  
  
With this MemoryChunk, each of our 3 memory context types can quickly  
obtain a reference to the block any given chunk is located on.  AllocSet  
is able to find the context to which the chunk is owned, by first  
obtaining a reference to the block by subtracting the block offset as is  
stored in the 'hdrmask' field and then referencing the block's 'aset'  
field.  The Generation context uses the same method, but GenerationBlock  
did not have a field pointing back to the owning context, so one is added  
by this commit.  
  
In aset.c and generation.c, all allocations larger than allocChunkLimit  
are stored on dedicated blocks.  When there's just a single chunk on a  
block like this, it's easy to find the block from the chunk, we just  
subtract the size of the block header from the chunk pointer.  The size of  
these chunks is also known as we store the endptr on the block, so we can  
just subtract the pointer to the allocated memory from that.  Because we  
can easily find the owning block and the size of the chunk for these  
dedicated blocks, we just always use external chunks for allocation sizes  
larger than allocChunkLimit.  For generation.c, this sidesteps the problem  
of non-external MemoryChunks being unable to represent chunk sizes >= 1GB.  
This is less of a problem for aset.c as we store the free list index in  
the MemoryChunk's spare 30-bit field (the value of which will never be  
close to using all 30-bits).  We can easily reverse engineer the chunk size  
from this when needed.  Storing this saves AllocSetFree() from having to  
make a call to AllocSetFreeIndex() to determine which free list to put the  
newly freed chunk on.  
  
For the slab allocator, this commit adds a new restriction that slab  
chunks cannot be >= 1GB in size.  If there happened to be any users of  
slab.c which used chunk sizes this large, they really should be using  
AllocSet instead.  
  
Here we also add a restriction that normal non-dedicated blocks cannot be  
1GB or larger.  It's now not possible to pass a 'maxBlockSize' >= 1GB  
during the creation of an AllocSet or Generation context.  Allocations can  
still be larger than 1GB, it's just these will always be on dedicated  
blocks (which do not have the 1GB restriction).  
  
Author: Andres Freund, David Rowley  
Discussion: https://postgr.es/m/CAApHDvpjauCRXcgcaL6+e3eqecEHoeRm9D-kcbuvBitgPnW=vw@mail.gmail.com  

M src/backend/utils/mmgr/README
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils.h
A src/include/utils/memutils_internal.h
A src/include/utils/memutils_memorychunk.h
M src/tools/pgindent/typedefs.list

Fix the incorrect assertion introduced in commit 7f13ac8123.

commit   : d2169c998553a6945fd51b8a1e5e9e1384283fdd    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 29 Aug 2022 08:10:10 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 29 Aug 2022 08:10:10 +0530    

Click here for diff

It has been incorrectly assumed in commit 7f13ac8123 that we can either  
purge all or none in the catalog modifying xids list retrieved from a  
serialized snapshot. It is quite possible that some of the xids in that  
array are old enough to be pruned but not others.  
  
As per buildfarm  
  
Author: Amit Kapila and Masahiko Sawada  
Reviwed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAA4eK1LBtv6ayE+TvCcPmC-xse=DVg=SmbyQD1nv_AaqcpUJEg@mail.gmail.com  

M contrib/test_decoding/expected/catalog_change_snapshot.out
M contrib/test_decoding/specs/catalog_change_snapshot.spec
M src/backend/replication/logical/snapbuild.c

Doc: fix example of recursive query.

commit   : 8c7fc86ca979f558bb7028763a71aa1ac7ca19b8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2022 10:44:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2022 10:44:52 -0400    

Click here for diff

Compute total number of sub-parts correctly, per [email protected]  
  
Simon Riggs  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/queries.sgml

Add more detail why repalloc and pfree do not accept NULL pointers

commit   : 805a397db40bd49789946e8fe42e564d564fc27b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 28 Aug 2022 09:55:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 28 Aug 2022 09:55:04 +0200    

Click here for diff

Per discussion, we choose not to change this.  This just gives a  
little bit more information.  
  
Discussion: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com  

M src/backend/utils/mmgr/README

Enable RandomizedBaseAddress (ASLR) on Windows with MSVC builds

commit   : 36389a060ca6b44d6ccc67653da77562a1ac5bb4    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 28 Aug 2022 16:04:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 28 Aug 2022 16:04:58 +0900    

Click here for diff

This has as effect to add /DYNAMICBASE to the .dll and .exe files  
generated by the builds, undoing 7f3e17b.  Note that ASLR was already  
enabled in MinGW as we have never added --disable-dynamicbase there.  
  
This change will ease a bit the integration of arm64 with MSVC, as ASLR  
support is mandatory in this case.  So, thanks to this commit, we have  
no need to make ASLR conditional depending on the architecture used for  
the build.  
  
Andres Freund has done a lot of testing with this option while working  
on meson, without seeing /DYNAMICBASE as being a problem in the Windows  
builds of the CI.  Personally, not supporting anything older than  
Windows 10 on HEAD makes me feel safer about this change, as we have  
seen ASLR with being a problem in process invocation particularly with  
Windows 8 and server 2012 back in 2014, even if Windows 10 was not  
really a thing back then.  45e004f is also something that can help in  
making the process invocation more stable.  We are very early in the  
development of Postgres 16, giving a lot of room to detect stability  
issues if any.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/MSBuildProject.pm

Avoid casting away const in sepgsql's quote_object_name.

commit   : 94077df1c2def788f888a27ed0035236f806466d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Aug 2022 12:52:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Aug 2022 12:52:39 -0400    

Click here for diff

quote_identifier's API is designed on the assumption that it's  
not worth worrying about a short-term memory leak when we have  
to produce a quoted version of the given identifier.  Whoever wrote  
quote_object_name took it on themselves to override that judgment,  
but the only way to do so is to cast away const someplace.  We can  
avoid that and substantially shorten the function by going along  
with quote_identifier's opinion.  AFAICS quote_object_name is not  
used in any way where this would be unsustainable.  
  
Per discussion of commit 45987aae2, which exposed that we had  
a casting-away-const situation here.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/label.c

Doc: add comment about bug fixed in back branches as of 3f7323cbb.

commit   : d1ce745db2d7db193c0be461db3cd34edd776dac    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Aug 2022 12:16:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Aug 2022 12:16:21 -0400    

Click here for diff

While the bug I just fixed in the back branches doesn't exist in  
HEAD, the requirement that MULTIEXPR SubPlans not share output  
parameters still does.  Add a comment to memorialize that, because  
perhaps it could be an issue again someday.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeSubplan.c

Fix typo in comment for writetuple() function

commit   : 924954c670355f2a0ca1dd4173574a28fc0eedec    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 27 Aug 2022 14:46:15 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 27 Aug 2022 14:46:15 +0300    

Click here for diff

Reported-by: David Rowley  
Discussion: https://postgr.es/m/CAApHDvrZ9Ky2LcWwcKsbdYChA850JE5qS%3DkGJiTNWS8mbBXZHw%40mail.gmail.com  

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

Be more careful to avoid including system headers after perl.h

commit   : 4eec2e03c34f9a357d86317b1cd05d80a2ab559d    
  
author   : John Naylor <[email protected]>    
date     : Sat, 27 Aug 2022 11:17:36 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 27 Aug 2022 11:17:36 +0700    

Click here for diff

Commit 121d2d3d70 included simd.h into pg_wchar.h. This caused a problem  
on Windows, since Perl has "#define free" (referring to globals), which  
breaks the Windows' header. To fix, move the static inline function  
definitions from plperl_helpers.h, into plperl.h, where we already  
document the necessary inclusion order. Since those functions were the  
only reason for the existence of plperl_helpers.h, remove it.  
  
First reported by Justin Pryzby  
  
Diagnosis and review by Andres Freund, patch by myself per suggestion  
from Tom Lane  
  
Discussion: https://www.postgresql.org/message-id/20220826115546.GE2342%40telsasoft.com  

M contrib/hstore_plperl/hstore_plperl.c
M contrib/jsonb_plperl/jsonb_plperl.c
M src/pl/plperl/GNUmakefile
M src/pl/plperl/SPI.xs
M src/pl/plperl/Util.xs
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl.h
D src/pl/plperl/plperl_helpers.h

Use correct connection for cancellation in frontend's parallel slots

commit   : 52144b6fcd626bb7dbe9fe282329c0174620a34b    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 27 Aug 2022 15:21:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 27 Aug 2022 15:21:31 +0900    

Click here for diff

While waiting for slots to become available in wait_on_slots() in  
parallel_slot.c, the cancellation always relied on the first connection  
in the set to do the job.  This could cause problems when this slot's  
socket is gone as PQgetCancel() would return NULL in this case.  Rather  
than always using the first connection, this changes the logic to use  
the first valid connection for the cancellation.  
  
Author: Ranier Vilela  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAEudQAokk1h_pUwGXsYS4oVOuf35s1O2o3TXGHpV8=AWikvgHA@mail.gmail.com  
Backpatch-through: 14  

M src/fe_utils/parallel_slot.c

Remove unneeded null pointer checks before PQfreemem()

commit   : e890ce7a4feb9d72cd502d52c5a4c4d853801974    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Aug 2022 19:16:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Aug 2022 19:16:28 +0200    

Click here for diff

PQfreemem() just calls free(), and the latter already checks for null  
pointers.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com  

M contrib/vacuumlo/vacuumlo.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/bin/pg_basebackup/receivelog.c

Remove unnecessary casts in free() and pfree()

commit   : 45987aae260a441886a010323bf3e143ce8e82d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Aug 2022 15:55:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Aug 2022 15:55:57 +0200    

Click here for diff

Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com  

M contrib/sepgsql/label.c
M src/backend/utils/fmgr/dfmgr.c

Use SSE2 in is_valid_ascii() where available.

commit   : 121d2d3d70ecdb2113b340c5f3b99a61341291af    
  
author   : John Naylor <[email protected]>    
date     : Fri, 26 Aug 2022 15:01:24 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 26 Aug 2022 15:01:24 +0700    

Click here for diff

Per flame graph from Jelte Fennema, COPY FROM ... USING BINARY shows  
input validation taking at least 5% of the profile, so it's worth trying  
to be more efficient here. With this change, validation of pure ASCII is  
nearly 40% faster on contemporary Intel hardware. To make this change  
legible and easier to adopt to additional architectures, use helper  
functions to abstract the platform details away.  
  
Reviewed by Nathan Bossart  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsG%3Dk8t%3DC457FXnoBXb%3D8iA4OaZkbFogFMachWif7mNnww%40mail.gmail.com  

M src/common/wchar.c
M src/include/mb/pg_wchar.h
M src/include/port/simd.h

Remove obsolete comment

commit   : ab9717847a2b0c32b93121f873f4dff331e26eb0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Aug 2022 10:33:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Aug 2022 10:33:55 +0200    

Click here for diff

The comment in basebackup.c updated by 33bd4698c11 was actually  
obsolete to begin with, since the symbols it was referring to haven't  
existed in that header file for quite some time.  The header file is  
still needed for other reasons, though, so keep the #include, just  
drop the comment.  

M src/backend/backup/basebackup.c

Fix typo in comment.

commit   : a8b02587a3c20997f8991878eb02ef475a343e1f    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 26 Aug 2022 16:55:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 26 Aug 2022 16:55:00 +0900    

Click here for diff

M src/backend/commands/copyfromparse.c

Add optimized functions for linear search within byte arrays

commit   : e813e0e16852c080259cd0813e1a82ecb2625aea    
  
author   : John Naylor <[email protected]>    
date     : Sat, 20 Aug 2022 21:14:01 -0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 20 Aug 2022 21:14:01 -0700    

Click here for diff

In similar vein to b6ef167564, add pg_lfind8() and pg_lfind8_le()  
to search for bytes equal or less-than-or-equal to a given byte,  
respectively. To abstract away platform details, add helper functions  
and typedefs to simd.h.  
  
John Naylor and Nathan Bossart, per suggestion from Andres Freund  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsGzaaGLF%3DNuq61iRXTyspbO9rOjhSqFN%3DV6ozzmta5mXg%40mail.gmail.com  

M src/include/port/pg_lfind.h
M src/include/port/simd.h
M src/test/modules/test_lfind/expected/test_lfind.out
M src/test/modules/test_lfind/sql/test_lfind.sql
M src/test/modules/test_lfind/test_lfind–1.0.sql
M src/test/modules/test_lfind/test_lfind.c

Remove configure probe for sockaddr_in6 and require AF_INET6.

commit   : bcc8b14ef630b2ad9aae7813981fb248fbff9ed8    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 26 Aug 2022 10:13:22 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 26 Aug 2022 10:13:22 +1200    

Click here for diff

SUSv3 <netinet/in.h> defines struct sockaddr_in6, and all targeted Unix  
systems have it.  Windows has it in <ws2ipdef.h>.  Remove the configure  
probe, the macro and a small amount of dead code.  
  
Also remove a mention of IPv6-less builds from the documentation, since  
there aren't any.  
  
This is similar to commits f5580882 and 077bf2f2 for Unix sockets.  Even  
though AF_INET6 is an "optional" component of SUSv3, there are no known  
modern operating system without it, and it seems even less likely to be  
omitted from future systems than AF_UNIX.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M configure
M configure.ac
M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/pgstatfuncs.c
M src/bin/initdb/initdb.c
M src/include/pg_config.h.in
M src/include/utils/inet.h
M src/interfaces/libpq/fe-connect.c
M src/port/inet_net_ntop.c
M src/tools/ifaddrs/test_ifaddrs.c
M src/tools/msvc/Solution.pm

libpq code should use libpq_gettext(), not _()

commit   : 28ec316787674dd74d00b296724a009b6edc2fb0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 20:46:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 20:46:58 +0200    

Click here for diff

Fix some wrong use and install a safeguard against future mistakes.  

M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/libpq-int.h

Fix doc oversight for custom WAL resource managers.

commit   : 66af5eea31e06fac288274cc056357cebbbbefe3    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 25 Aug 2022 10:26:31 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 25 Aug 2022 10:26:31 -0700    

Click here for diff

Reported-by: Bharath Rupireddy  
Backpatch-through: 15  
Discussion: https://postgr.es/m/CALj2ACU+at7RqnWEzS59QsFg3ZOF4C4GSp7pt+PWiLEp0zrEKg@mail.gmail.com  

M doc/src/sgml/tableam.sgml

Small refactor to get rid of -Wshadow=compatible-local warning

commit   : d389487525bc1d543f27543ed2ff824d3a30f508    
  
author   : David Rowley <[email protected]>    
date     : Fri, 26 Aug 2022 02:46:56 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 26 Aug 2022 02:46:56 +1200    

Click here for diff

Further reduce -Wshadow=compatible-local warnings by 1 by refactoring the  
code in gistRelocateBuildBuffersOnSplit() to make use of  
foreach_current_index() instead of manually incrementing a variable on  
each loop.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvpGZX-X=Bn4moyXgfFa0CdSUwoa04d3isit3=1qo8F8Bw@mail.gmail.com  

M src/backend/access/gist/gistbuildbuffers.c

More -Wshadow=compatible-local warning fixes

commit   : 3e0fff2e6888e39b0ad5cdfdb78bc1c2bb2b22c9    
  
author   : David Rowley <[email protected]>    
date     : Fri, 26 Aug 2022 02:35:40 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 26 Aug 2022 02:35:40 +1200    

Click here for diff

In a similar effort to f01592f91, here we're targetting fixing the  
warnings where we've deemed the shadowing variable to serve a close enough  
purpose to the shadowed variable just to reuse the shadowed version and  
not declare the shadowing variable at all.  
  
By my count, this takes the warning count from 106 down to 71.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/functioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/lib/integerset.c
M src/backend/libpq/auth.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/postmaster/autovacuum.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/dependencies.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pgbench/pgbench.c

Allow grant-level control of role inheritance behavior.

commit   : e3ce2de09d814f8770b2e3b3c152b7671bcdb83f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 25 Aug 2022 10:06:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 25 Aug 2022 10:06:02 -0400    

Click here for diff

The GRANT statement can now specify WITH INHERIT TRUE or WITH  
INHERIT FALSE to control whether the member inherits the granted  
role's permissions. For symmetry, you can now likewise write  
WITH ADMIN TRUE or WITH ADMIN FALSE to turn ADMIN OPTION on or off.  
  
If a GRANT does not specify WITH INHERIT, the behavior based on  
whether the member role is marked INHERIT or NOINHERIT. This means  
that if all roles are marked INHERIT or NOINHERIT before any role  
grants are performed, the behavior is identical to what we had before;  
otherwise, it's different, because ALTER ROLE [NO]INHERIT now only  
changes the default behavior of future grants, and has no effect on  
existing ones.  
  
Patch by me. Reviewed and testing by Nathan Bossart and Tushar Ahuja,  
with design-level comments from various others.  
  
Discussion: http://postgr.es/m/CA+Tgmoa5Sf4PiWrfxA=sGzDKg0Ojo3dADw=wAHOhR9dggV=RmQ@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M src/backend/commands/user.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/backend/utils/adt/acl.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_auth_members.h
M src/include/commands/user.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Move NON_EXEC_STATIC from c.h to postgres.h

commit   : 2059c5e3b06545e7d0650dba9c665332374c3c21    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 15:07:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 15:07:03 +0200    

Click here for diff

It is not needed at the scope of c.h, only in backend code.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/a6a6b48e-ca0a-b58d-18de-98e40d94b842%40enterprisedb.com  

M src/include/c.h
M src/include/postgres.h

Update another comment still referring to pg_start/stop_backup()

commit   : 421ccaa6272a2935a3d2e578ff6feeeeab7d8848    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 15:04:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 15:04:38 +0200    

Click here for diff

M src/test/recovery/t/020_archive_status.pl

doc: Fix typo in GRANT docs

commit   : d16c99aa71047e3cd94dad85f9fa82a7d6f94eed    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 25 Aug 2022 10:47:02 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 25 Aug 2022 10:47:02 +0200    

Click here for diff

Commit ce6b672e445 accidentally introduced a trivial typo in the  
documentation for GRANT.  

M doc/src/sgml/ref/grant.sgml

Fix typo in MVCC test comment

commit   : 0c67e9e566db32df3f420268e81e32f278a2f090    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 25 Aug 2022 10:31:20 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 25 Aug 2022 10:31:20 +0200    

Click here for diff

The optimization is named kill_prior_tuple but was accidentally  
spelled kill_prio_tuple in the test.  
  
Author: Mingli Zhang <[email protected]>  
Discussion: https://postgr.es/m/82d3e66a-d8ae-4bfa-943e-29c5add0743f@Spark  

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

Remove unused symbol __aarch64

commit   : 4112e39f70eed8d699ea5be7f5945a8970023d0d    
  
author   : John Naylor <[email protected]>    
date     : Thu, 25 Aug 2022 13:37:40 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 25 Aug 2022 13:37:40 +0700    

Click here for diff

This was added as a possible variant of __aarch64__ back when 64-bit  
ARM was vaporware. It hasn't shown up in the wild since then, so remove.  
  
Nathan Bossart  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsEN5nW3uRh%3Djrs-QexDrC1btu0ZfriD3FFfb%3D3J6tAngg%40mail.gmail.com  

M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/storage/s_lock.h

pg_dump: Fix new ICU tests

commit   : b4ddf3ee30bfb5b7da60411cabcf0589bdbd3f42    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 06:35:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 06:35:16 +0200    

Click here for diff

ICU doesn't support some server encodings, so we need to exclude them  
if a non-supported encoding was set up.  

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

aix: Fix SHLIB_EXPORTS reference in VPATH builds

commit   : 4444317f370cbbd6a9bb62d70dd8f1f062952ef4    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 24 Aug 2022 20:38:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 24 Aug 2022 20:38:28 -0700    

Click here for diff

The dependencies here aren't quite right independent of vpath builds or not,  
but this at least makes vpath builds succeed. And it's pretty rare to change  
the exports.txt file anyway... The referenced thread has a patch that will  
clean that up further.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

Remove SUBSYS.o rule in common.mk, hasn't been used in a long time

commit   : 05bf551040ba161ddfbf7da308d61d2b7b425bf3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 24 Aug 2022 20:38:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 24 Aug 2022 20:38:14 -0700    

Click here for diff

Apparently I missed that this SUBSYS.o rule isn't needed anymore in  
a4ebbd27527, likely because there still is a reference to it due to AIX - but  
that's self contained in src/backend/Makefile  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/common.mk

Remove rule to generate postgres.o, not needed for 20+ years

commit   : 68fc18d14c7e1150823cf4a5728089459723c9da    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 24 Aug 2022 20:37:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 24 Aug 2022 20:37:54 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/backend/Makefile

solaris: Use versioning scripts instead of -Bsymbolic

commit   : 3fb0687d328b8eef6ab0ff80300e5746f4a777cb    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 24 Aug 2022 20:37:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 24 Aug 2022 20:37:54 -0700    

Click here for diff

-Bsymbolic causes a lot of "ld: warning: symbol referencing errors"  
warnings. It's quite easy to add the symbol versioning script, we just need a  
slightly different parameter name.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

Include RelFileLocator fields individually in BufferTag.

commit   : 82ac34db2036ec5b3cb32c9180f40549aa790dc2    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 24 Aug 2022 15:50:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 24 Aug 2022 15:50:48 -0400    

Click here for diff

This is preparatory work for a project to increase the number of bits  
in a RelFileNumber from 32 to 56.  
  
Along the way, introduce static inline accessor functions for a couple  
of BufferTag fields.  
  
Dilip Kumar, reviewed by me. The overall patch series has also had  
review at various times from Andres Freund, Ashutosh Sharma, Hannu  
Krosing, Vignesh C, Álvaro Herrera, and Tom Lane.  
  
Discussion: http://postgr.es/m/CAFiTN-trubju5YbWAq-BSpZ90-Z6xCVBQE8BVqXqANOZAF1Znw@mail.gmail.com  

M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h

pg_dump: Dump colliculocale

commit   : 396d348b046c6b7e5dc83158c4c1df1377a1d2ef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 20:13:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 20:13:52 +0200    

Click here for diff

This was forgotten when the new column was introduced.  
  
Author: Marina Polyakova <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/7ad26354e75259f59c4a6c6997b8ee32%40postgrespro.ru  

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

Defend against stack overrun in a few more places.

commit   : f25bed3801e1e500850a9f3b29a003c644d4bd6d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Aug 2022 13:01:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Aug 2022 13:01:40 -0400    

Click here for diff

SplitToVariants() in the ispell code, lseg_inside_poly() in geo_ops.c,  
and regex_selectivity_sub() in selectivity estimation could recurse  
until stack overflow; fix by adding check_stack_depth() calls.  
So could next() in the regex compiler, but that case is better fixed by  
converting its tail recursion to a loop.  (We probably get better code  
that way too, since next() can now be inlined into its sole caller.)  
  
There remains a reachable stack overrun in the Turkish stemmer, but  
we'll need some advice from the Snowball people about how to fix that.  
  
Per report from Egor Chindyaskin and Alexander Lakhin.  These mistakes  
are old, so back-patch to all supported branches.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regc_lex.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/like_support.c

Doc: remove duplicate "a" from func.sgml

commit   : a73d6c87f2eb19681fe52d6d8bb7db38a7a7da2a    
  
author   : David Rowley <[email protected]>    
date     : Wed, 24 Aug 2022 23:45:57 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 24 Aug 2022 23:45:57 +1200    

Click here for diff

Author: Shinya Kato  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15, where that change was introduced  

M doc/src/sgml/func.sgml

Fix ICU locale option handling in CREATE DATABASE

commit   : 8b808f189fb1f62a6830e5c023f4ae49a1f4c9a8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 13:27:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 13:27:34 +0200    

Click here for diff

The code took the LOCALE option as the default/fallback for  
ICU_LOCALE, but this was neither documented nor intended, so remove  
it.  (It was probably left in from an earlier patch version.)  
  
Reported-by: Marina Polyakova <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/backend/commands/dbcommands.c

Remove initialization of MyClientConnectionInfo at backend startup

commit   : 701ac2cb1fa25ca0b8572e87073d9008ed406b55    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Aug 2022 19:19:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Aug 2022 19:19:00 +0900    

Click here for diff

This stuff should be already initialized at process startup, so adding  
this extra step is confusing for no gain.  
  
Per gripe from Tom Lane and Jacob Champion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Further -Wshadow=compatible-local warning fixes

commit   : f959bf9a5b9cecd2f6e6bdd24a34a7b269b00827    
  
author   : David Rowley <[email protected]>    
date     : Wed, 24 Aug 2022 22:04:28 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 24 Aug 2022 22:04:28 +1200    

Click here for diff

These should have been included in 421892a19 as these shadowed variable  
warnings can also be fixed by adjusting the scope of the shadowed variable  
to put the declaration for it in an inner scope.  
  
This is part of the same effort as f01592f91.  
  
By my count, this takes the warning count from 114 down to 106.  
  
Author: David Rowley and Justin Pryzby  
Discussion: https://postgr.es/m/CAApHDvrwLGBP%2BYw9vriayyf%3DXR4uPWP5jr6cQhP9au_kaDUhbA%40mail.gmail.com  

M src/backend/access/spgist/spgdoinsert.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeHash.c
M src/backend/optimizer/plan/planner.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/ruleutils.c

Change shared library installation naming on macOS

commit   : 161355ee6d2c64c0c4853a0646795028d666f052    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 08:23:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 08:23:49 +0200    

Click here for diff

It is not customary to install a shared library with a minor version  
number (libpq.5.16.dylib) on macOS.  We just need the file with the  
major version number (libpq.5.dylib) and the one without version  
number (libpq.dylib).  This also matches the installation layout used  
by Meson.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/Makefile.shlib

Allow parallel workers to retrieve some data from Port

commit   : d951052a9e02bfacad8bd6f0f53a4dcd3b7e6d1f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Aug 2022 12:57:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Aug 2022 12:57:13 +0900    

Click here for diff

This commit moves authn_id into a new global structure called  
ClientConnectionInfo (mapping to a MyClientConnectionInfo for each  
backend) which is intended to hold all the client information that  
should be shared between the backend and any of its parallel workers,  
access for extensions and triggers being the primary use case.  There is  
no need to push all the data of Port to the workers, and authn_id is  
quite a generic concept so using a separate structure provides the best  
balance (the name of the structure has been suggested by Robert Haas).  
  
While on it, and per discussion as this would be useful for a potential  
SYSTEM_USER that can be accessed through parallel workers, a second  
field is added for the authentication method, copied directly from  
Port.  
  
ClientConnectionInfo is serialized and restored using a new parallel  
key and a structure tracks the length of the authn_id, making the  
addition of more fields straight-forward.  
  
Author: Jacob Champion  
Reviewed-by: Bertrand Drouvot, Stephen Frost, Robert Haas, Tom Lane,  
Michael Paquier, Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/parallel.c
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/tools/pgindent/typedefs.list

Further reduce warnings with -Wshadow=compatible-local

commit   : 421892a192b8f95ab96c5edb61d424f80a4221d0    
  
author   : David Rowley <[email protected]>    
date     : Wed, 24 Aug 2022 12:27:12 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 24 Aug 2022 12:27:12 +1200    

Click here for diff

In a similar effort to f01592f91, here we're targetting fixing the  
warnings that -Wshadow=compatible-local produces that we can fix by moving  
a variable to an inner scope to stop that variable from being shadowed by  
another variable declared somewhere later in the function.  
  
All of the warnings being fixed here are changing the scope of variables  
which are being used as an iterator for a "for" loop.  In each instance,  
the fix happens to be changing the for loop to use the C99 type  
initialization.  Much of this code likely pre-dates our use of C99.  
  
Reducing the scope of the outer scoped variable seems like the safest way  
to fix these.  Renaming seems more likely to risk patches using the wrong  
variable.  Reducing the scope is more likely to result in a compilation  
failure after applying some future patch rather than introducing bugs with  
it.  
  
By my count, this takes the warning count from 129 down to 114.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/CAApHDvrwLGBP%2BYw9vriayyf%3DXR4uPWP5jr6cQhP9au_kaDUhbA%40mail.gmail.com  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/gist/gist.c
M src/backend/commands/copyfrom.c
M src/backend/commands/indexcmds.c
M src/backend/executor/nodeAgg.c
M src/backend/optimizer/path/costsize.c
M src/backend/statistics/mcv.c
M src/backend/storage/buffer/bufmgr.c
M src/bin/pg_dump/pg_dump.c
M src/interfaces/ecpg/pgtypeslib/numeric.c

Message style adjustment

commit   : 869e56a39976a42a393adc2d69df3abce7eff18f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 21:50:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 21:50:12 +0200    

Click here for diff

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

Remove further unwanted linker flags from perl_embed_ldflags

commit   : b4e936859dc441102eb0b6fb7a104f3948c90490    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 16:00:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 16:00:38 +0200    

Click here for diff

Remove the contents of $Config{ldflags} from ExtUtils::Embed's ldopts,  
like we already do with $Config{ccdlflags}.  Those flags are the  
choices of those who built the Perl installation, which are not  
necessarily appropriate for building PostgreSQL.  What we really want  
from ldopts are the options identifying the location and name of the  
libperl library, but unfortunately it doesn't appear possible to get  
that separately from the other stuff.  
  
The motivation for this was to strip -mmacosx-version-min options.  We  
already did something similar for the -arch option.  Both of those are  
now covered by this more general approach.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8c4fcb72-2574-ff7c-4c25-1f032d4a2a57%40enterprisedb.com  

M config/perl.m4
M configure

Remove our artificial PG_SOMAXCONN limit on listen queue length.

commit   : 0f47457f1129fa21131465aba5663a14b2a09386    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 10:14:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 10:14:45 -0400    

Click here for diff

I added this in commit 153f40067, out of paranoia about kernels  
possibly rejecting very large listen backlog requests.  However,  
POSIX has said for decades that the kernel must silently reduce  
any value it considers too large, and there's no evidence that  
any current system doesn't obey that.  Let's just drop this limit  
and save some complication.  
  
While we're here, compute the request as twice MaxConnections not  
twice MaxBackends; the latter no longer means what it did in 2001.  
  
Per discussion of a report from Kevin McKibbin.  
  
Discussion: https://postgr.es/m/CADc_NKg2d+oZY9mg4DdQdoUcGzN2kOYXBu-3--RW_hEe0tUV=g@mail.gmail.com  

M src/backend/libpq/pqcomm.c
M src/include/pg_config_manual.h

Doc: document possible need to raise kernel's somaxconn limit.

commit   : ba94dfd4c4f63cf8663f16e427bcc6fac35a4428    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 09:55:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 09:55:37 -0400    

Click here for diff

On fast machines, it's possible for applications such as pgbench  
to issue connection requests so quickly that the postmaster's  
listen queue overflows in the kernel, resulting in unexpected  
failures (with not-very-helpful error messages).  Most modern OSes  
allow the queue size to be increased, so document how to do that.  
  
Per report from Kevin McKibbin.  
  
Discussion: https://postgr.es/m/CADc_NKg2d+oZY9mg4DdQdoUcGzN2kOYXBu-3--RW_hEe0tUV=g@mail.gmail.com  

M doc/src/sgml/runtime.sgml

Doc: prefer sysctl to /proc/sys in docs and comments.

commit   : 4ee6740167b6a311660a1e8752447a496dd0d235    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 09:41:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 09:41:37 -0400    

Click here for diff

sysctl is more portable than Linux's /proc/sys file tree, and  
often easier to use too.  That's why most of our docs refer to  
sysctl when talking about how to adjust kernel parameters.  
Bring the few stragglers into line.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml
M src/backend/postmaster/postmaster.c

Remove offsetof definition

commit   : bd67b7e01031b688f2f19f657ece4aa2322dbcc8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 15:39:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 15:39:36 +0200    

Click here for diff

This was only needed to deal with some ancient and no longer supported  
systems.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/9a5223a2-3e25-d4fb-f092-01ec17428584%40enterprisedb.com  

M src/include/c.h

Don't bother to set sockaddr_un.sun_len.

commit   : c9818798147a4eec00bba61a05fa9bc88398ec3b    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 23 Aug 2022 23:52:17 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 23 Aug 2022 23:52:17 +1200    

Click here for diff

It's not necessary to fill in sun_len when calling bind() or connect(),  
on all known systems that have it.  
  
Discussion: https://postgr.es/m/2781112.1644819528%40sss.pgh.pa.us  

M src/common/ip.c

Add CHECK_FOR_INTERRUPTS while decoding changes.

commit   : f972ec5c285c3bc50d81f8044e08cd636017ab68    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 23 Aug 2022 10:20:02 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 23 Aug 2022 10:20:02 +0530    

Click here for diff

While decoding changes in a loop, if we skip all the changes there is no  
CFI making the loop uninterruptible.  
  
Reported-by: Whale Song and Andrey Borodin  
Bug: 17580  
Author: Masahiko Sawada  
Reviwed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Don't define FRONTEND for libpq

commit   : 1d77afefbd1dd13a0ebec9d6675dd305e86c0538    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    

Click here for diff

Not needed anymore after 7143b3e8213.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Don't define FRONTEND for ecpg libraries

commit   : 9352d5cf128ad9888918bba00b87ba347438fd26    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    

Click here for diff

Not needed anymore after 7143b3e8213.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/tools/msvc/Mkvcbuild.pm

Don't define FRONTEND for initdb

commit   : 06e3559bade1da89feb1a53d517c991fb4f15272    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    

Click here for diff

No headers requiring FRONTED to be defined are included as of af1a949109d.  
  
Since this is the last user of (contrib|frontend)_defines in Mkvcbuild.pm,  
remove them.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/Makefile
M src/tools/msvc/Mkvcbuild.pm

Remove redundant call to pgstat_report_wal()

commit   : 1bdd54e662d58ed49448255a004b668b56bae100    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:25:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:25:42 -0700    

Click here for diff

pgstat_report_stat() will be called before shutdown so an explicit call to  
pgstat_report_wal() just before shutdown is redundant.  
  
This likely was not redundant before 5891c7a8ed8, but now it clearly is.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAAKRu_aaq33UnG4TXq3S-OSXGWj1QGf0sU%2BECH4tNwGFNERkZA%40mail.gmail.com  

M src/backend/postmaster/walwriter.c

Add BackendType for standalone backends

commit   : 0c679464a837079acc75ff1d45eaa83f79e05690    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:22:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:22:50 -0700    

Click here for diff

All backends should have a BackendType to enable statistics reporting  
per BackendType.  
  
Add a new BackendType for standalone backends, B_STANDALONE_BACKEND (and  
alphabetize the BackendTypes). Both the bootstrap backend and single  
user mode backends will have BackendType B_STANDALONE_BACKEND.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAAKRu_aaq33UnG4TXq3S-OSXGWj1QGf0sU%2BECH4tNwGFNERkZA%40mail.gmail.com  

M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

pgstat: Acquire lock when reading variable-numbered stats

commit   : cd063344fb801a90a40923a5b8aefe4eb8d80762    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:16:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:16:50 -0700    

Click here for diff

Somewhere during the development of the patch acquiring a lock during read  
access to variable-numbered stats got lost. The missing lock acquisition won't  
cause corruption, but can lead to reading torn values when accessing  
stats. Add the missing lock acquisitions.  
  
Reported-by: Greg Stark <[email protected]>  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CAM-w4HMYkM_DkYhWtUGV+qE_rrBxKOzOF0+5faozxO3vXrc9wA@mail.gmail.com  
Backpatch: 15-  

M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
M src/include/utils/pgstat_internal.h

Switch format specifier for replication origins to %d

commit   : ba8321349bc02423aa4d49ebb5d579ec313cf930    
  
author   : John Naylor <[email protected]>    
date     : Tue, 23 Aug 2022 09:55:05 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 23 Aug 2022 09:55:05 +0700    

Click here for diff

Using %u with uint16 causes warnings with -Wformat-signedness. There are many  
other warnings, but for now change only these since c920fe4818 already changed  
the message string for most of them.  
  
Per report from Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/31e63649-0355-7088-831e-b07d5f908a8c%40enterprisedb.com  

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

Remove empty statement

commit   : 1b9050da66aba821fec18376bee30d17e91e7027    
  
author   : John Naylor <[email protected]>    
date     : Tue, 23 Aug 2022 09:24:32 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 23 Aug 2022 09:24:32 +0700    

Click here for diff

Peter Smith  
  
Discussion: https://www.postgresql.org/message-id/CAHut%2BPtRGVuj8Q_GpHHxZyk7fGwdYDG8_s4GSfKoc_4Yd9vR-w%40mail.gmail.com  

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

Make role grant system more consistent with other privileges.

commit   : ce6b672e4455820a0348214be0da1a024c3f619f    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 22 Aug 2022 11:35:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 22 Aug 2022 11:35:17 -0400    

Click here for diff

Previously, membership of role A in role B could be recorded in the  
catalog tables only once. This meant that a new grant of role A to  
role B would overwrite the previous grant. For other object types, a  
new grant of permission on an object - in this case role A - exists  
along side the existing grant provided that the grantor is different.  
Either grant can be revoked independently of the other, and  
permissions remain so long as at least one grant remains. Make role  
grants work similarly.  
  
Previously, when granting membership in a role, the superuser could  
specify any role whatsoever as the grantor, but for other object types,  
the grantor of record must be either the owner of the object, or a  
role that currently has privileges to perform a similar GRANT.  
Implement the same scheme for role grants, treating the bootstrap  
superuser as the role owner since roles do not have owners. This means  
that attempting to revoke a grant, or admin option on a grant, can now  
fail if there are dependent privileges, and that CASCADE can be used  
to revoke these. It also means that you can't grant ADMIN OPTION on  
a role back to a user who granted it directly or indirectly to you,  
similar to how you can't give WITH GRANT OPTION on a privilege back  
to a role which granted it directly or indirectly to you.  
  
Previously, only the superuser could specify GRANTED BY with a user  
other than the current user. Relax that rule to allow the grantor  
to be any role whose privileges the current user posseses. This  
doesn't improve compatibility with what we do for other object types,  
where support for GRANTED BY is entirely vestigial, but it makes this  
feature more usable and seems to make sense to change at the same time  
we're changing related behaviors.  
  
Along the way, fix "ALTER GROUP group_name ADD USER user_name" to  
require the same privileges as "GRANT group_name TO user_name".  
Previously, CREATEROLE privileges were sufficient for either, but  
only the former form was permissible with ADMIN OPTION on the role.  
Now, either CREATEROLE or ADMIN OPTION on the role suffices for  
either spelling.  
  
Patch by me, reviewed by Stephen Frost.  
  
Discussion: http://postgr.es/m/CA+TgmoaFr-RZeQ+WoQ5nKPv97oT9+aDgK_a5+qWHSgbDsMp1Vg@mail.gmail.com  

M doc/src/sgml/ref/alter_group.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M src/backend/commands/user.c
M src/backend/parser/gram.y
M src/backend/utils/adt/acl.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_auth_members.h
M src/include/utils/acl.h
M src/test/regress/expected/create_role.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/create_role.sql
M src/test/regress/sql/privileges.sql

Fix assertion failure in CREATE DATABASE

commit   : 36f729e2bc3539e777cda698dc441b8ccec42142    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Aug 2022 15:31:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Aug 2022 15:31:50 +0200    

Click here for diff

An assertion would fail when creating a database with libc locale  
provider from a template database with icu locale provider.  
  
Reported-by: Marina Polyakova <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/backend/commands/dbcommands.c
M src/bin/scripts/t/020_createdb.pl

doc: Minor wordsmithing to COPY docs

commit   : e2fe0aedd00eae89e6d00bca5c598d1ac31b266a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 22 Aug 2022 15:08:45 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 22 Aug 2022 15:08:45 +0200    

Click here for diff

Perform some minor wordsmithing on two sentences in the COPY documentation  
to make them clearer.  
  
While there, also ensure to wrap a few occurrences of CSV in <literal>  
which were missing this.  
  
Reported-by: Eric Mutta <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

pg_upgrade: Fix thinko in database info acquisition routine

commit   : f0b013b0fc0a53de0ffe610b403125affb9c6094    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Aug 2022 13:26:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Aug 2022 13:26:52 +0200    

Click here for diff

When checking whether the major version supports per-database locale  
providers, it was always looking at the version of the old cluster  
instead of the cluster that was passed in.  This would lead to  
failures to detect locale provider mismatches.  
  
Reported-by: Marina Polyakova <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/bin/pg_upgrade/info.c

Remove configure probes for sockaddr_storage members.

commit   : 64ef572c068fde7cbba7f82cd50f51c0131ffe3b    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 22 Aug 2022 16:47:17 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 22 Aug 2022 16:47:17 +1200    

Click here for diff

Remove four probes for members of sockaddr_storage.  Keep only the probe  
for sockaddr's sa_len, which is enough for our two remaining places that  
know about _len fields:  
  
1.  ifaddr.c needs to know if sockaddr has sa_len to understand the  
result of ioctl(SIOCGIFCONF).  Only AIX is still using the relevant code  
today, but it seems like a good idea to keep it compilable on Linux.  
  
2.  ip.c was testing for presence of ss_len to decide whether to fill in  
sun_len in our getaddrinfo_unix() function.  It's just as good to test  
for sa_len.  If you have one, you have them all.  
  
(The code in #2 isn't actually needed at all on several OSes I checked  
since modern versions ignore sa_len on input to system calls.  Proving  
that's the case for all relevant OSes is left for another day, but  
wouldn't get rid of that last probe anyway if we still want it for #1.)  
  
Discussion: https://postgr.es/m/CA%2BhUKGJJjF2AqdU_Aug5n2MAc1gr%3DGykNjVBZq%2Bd6Jrcp3Dyvg%40mail.gmail.com  

M config/c-library.m4
M configure
M configure.ac
M src/common/ip.c
M src/include/libpq/pqcomm.h
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Use logical operator && instead of & in vacuumparallel.c.

commit   : 838f798f172d509f022841b82277ec84d108a379    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 22 Aug 2022 08:53:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 22 Aug 2022 08:53:58 +0530    

Click here for diff

As such the current usage of & won't produce incorrect results but it  
would be better to use && to short-circuit the evaluation of second  
condition when the same is not required.  
  
Author: Ranier Vilela  
Reviewed-by: Tom Lane, Bharath Rupireddy  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAEudQApL8QcoYwQuutkWKY_h7gBY8F0Xs34YKfc7-G0i83K_pw@mail.gmail.com  

M src/backend/commands/vacuumparallel.c

Fix comment in walsender_private.h

commit   : 49e525a08fcb42c05dc27bd0bc36aa491becc55f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Aug 2022 10:02:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Aug 2022 10:02:53 +0900    

Click here for diff

All the members of the stucture are protected by the spinlock WalSnd,  
but a comment referred to "replyTime" and "latch" as not being in the  
set of what gets protected, contrary to what walsender.c does.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACWE_7srye4_GZ=N=-rD=qr2WHL9GZrMnhWJOJ5RdnNS2A@mail.gmail.com  

M src/include/replication/walsender_private.h

Remove dummyret definition

commit   : 585d0cd944d952f08f7649d02f1d6b6644e93611    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 20 Aug 2022 20:48:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 20 Aug 2022 20:48:47 +0200    

Click here for diff

This hasn't been used in a while (last use removed by 50d22de932, and  
before that 84b6d5f359), and since we are now preferring inline  
functions over complex macros, it's unlikely to be needed again.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/7110ab37-8ddd-437f-905c-6aa6205c6185%40enterprisedb.com  

M src/include/c.h

regress: allow to specify directory containing expected files, for ecpg

commit   : c855872074b5bf44ecea033674d22fac831cfc31    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 20 Aug 2022 10:59:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 20 Aug 2022 10:59:01 -0700    

Click here for diff

The ecpg tests have their input directory in the build directory, as the tests  
need to be built. Until now that required copying the expected/ directory to  
the build directory in VPATH builds. To avoid needing to implement the same  
for the meson build, add support for specifying the location of the expected  
directory.  
  
Now that that's not needed anymore, remove the copying of ecpg's expected  
directory to the build directory in VPATH builds.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Author: Andres Freund <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/Makefile
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h

Remove remaining mentions of UNSAFE_STAT_OK

commit   : 1509abe2c5da6002620718d18031f5b5234c15cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 20 Aug 2022 13:53:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 20 Aug 2022 13:53:21 +0200    

Click here for diff

The last use was removed by bed90759fcbcd72d4d06969eebab81e47326f9a2.  
  
Discussion: https://www.postgresql.org/message-id/flat/01229f9a-b358-d71e-31ae-4c0855d73cbc%40enterprisedb.com  

M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Reduce warnings with -Wshadow=compatible-local builds

commit   : 92fce4e1eda9b24d73f583fbe9b58f4e03f097a4    
  
author   : David Rowley <[email protected]>    
date     : Sat, 20 Aug 2022 15:16:51 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 20 Aug 2022 15:16:51 +1200    

Click here for diff

In a similar effort to f01592f91, here we further reduce the warnings we  
get about local variables being shadowed when building with  
-Wshadow=compatible-local.  This small change reduces the overall number  
of warnings by 36.  
  
Discussion: https://postgr.es/m/CAApHDvqBBqF=wmV5azrO7h3VwpwQo+JFBQ+g=E6wVUhKcqR8gA@mail.gmail.com  

M src/test/regress/regress.c

Remove shadowed local variables that are new in v15

commit   : f01592f9157707c4de1f00a0e0dc5a7e8fa8f1d5    
  
author   : David Rowley <[email protected]>    
date     : Sat, 20 Aug 2022 11:40:44 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 20 Aug 2022 11:40:44 +1200    

Click here for diff

Compiling with -Wshadow=compatible-local yields quite a few warnings about  
local variables being shadowed by compatible local variables in an inner  
scope.  Of course, this is perfectly valid in C, but we have had bugs in  
the past as a result of developers failing to notice this.  af7d270dd is a  
recent example.  
  
Here we do a cleanup of warnings we receive from -Wshadow=compatible-local  
for code which is new to PostgreSQL 15.  We've yet to have the discussion  
about if we actually ever want to run that as a standard compilation flag.  
We'll need to at least get the number of warnings down to something easier  
to manage before we can realistically consider if we want this or not.  
This commit is the first step towards reducing the warnings.  
  
The changes being made here are all fairly trivial.  Because of that, and  
the fact that v15 is still in beta, this is being back-patched into 15.  
It seems more risky not to do this as the risk of future bugs is increased  
by the additional conflicts that this commit could cause for any future  
bug fixes touching the same areas as this commit.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220817145434.GC26426%40telsasoft.com  
Backpatch-through: 15  

M src/backend/backup/basebackup_target.c
M src/backend/parser/parse_jsontable.c
M src/backend/replication/logical/tablesync.c
M src/backend/utils/adt/jsonpath_exec.c
M src/bin/pg_dump/pg_dump.c

Avoid reltuples distortion in very small tables.

commit   : 3097bde7dd1d9e7b1127b24935e70ca4609e22b2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 19 Aug 2022 09:26:08 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 19 Aug 2022 09:26:08 -0700    

Click here for diff

Consistently avoid trusting a sample of only one page at the point that  
VACUUM determines a new reltuples for the target table (though only when  
the table is larger than a single page).  This is follow-up work to  
commit 74388a1a, which added a heuristic to prevent reltuples from  
becoming distorted by successive VACUUM operations that each scan only a  
single heap page (which was itself more or less a bugfix for an issue in  
commit 44fa8488, which simplified VACUUM's handling of scanned pages).  
  
The original bugfix commit did not account for certain remaining cases  
that where not affected by its "2% of total relpages" heuristic.  This  
happened with relations that are small enough that just one of its pages  
exceeded the 2% threshold, yet still big enough for VACUUM to deem  
skipping most of its pages via the visibility map worthwhile.  reltuples  
could still become distorted over time with such a table, at least in  
scenarios where the VACUUM command is run repeatedly and without the  
table itself ever changing.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzk7d4m3oEbEWkWQKd+gz-eD_peBvdXVk1a_KBygXadFeg@mail.gmail.com  
Backpatch: 15-, where the rules for scanned pages changed.  

M src/backend/commands/vacuum.c

Move a definition inside a header file

commit   : 7d12693473eca4008c5c53bb36a5f083068a941b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Aug 2022 11:20:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Aug 2022 11:20:09 +0200    

Click here for diff

Over time, this has ended up in a slightly inappropriate place  
relative to the comments around it.  

M src/include/utils/date.h

doc: Improve some markups and some wording around archiving modules

commit   : 31e121d4f7bb3aad7a26021cbc7cfb43a077c7e3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Aug 2022 10:00:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Aug 2022 10:00:12 +0900    

Click here for diff

This commit adds or fixes markups used in a couple of places in the docs  
(for <command>, <systemitem> and <literal>).  While on it, this  
clarifies some of the documentation added recently for archiving modules  
with archive_command, that would still be used as default choice if no  
external module is defined (though an archive module could as well use  
an archive_command).  
  
Author: Maxim Yablokov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/archive-modules.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/basebackup-to-shell.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/psql-ref.sgml

Initialize index stats during parallel VACUUM.

commit   : 662ba729a67e5c6e43efbc5263e1d2c3a72a8741    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 18 Aug 2022 17:34:14 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 18 Aug 2022 17:34:14 -0700    

Click here for diff

Initialize shared memory allocated for index stats to avoid a hard  
crash.  This was possible when parallel VACUUM became confused about the  
current phase of index processing.  
  
Oversight in commit 8e1fae1938, which refactored parallel VACUUM.  
  
Author: Masahiko Sawada <[email protected]>  
Reported-By: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, the first version with the refactoring commit.  

M src/backend/commands/vacuumparallel.c

Use correct LSN for error reporting in pg_walinspect

commit   : d9fbb8862959912c5266364059c0abeda0c93bbf    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 18 Aug 2022 14:23:30 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 18 Aug 2022 14:23:30 -0700    

Click here for diff

Usage of ReadNextXLogRecord()'s first_record parameter for error  
reporting isn't always correct. For instance, in GetWALRecordsInfo()  
and GetWalStats(), we're reading multiple records, and first_record  
is always passed as the LSN of the first record which is then used  
for error reporting for later WAL record read failures. This isn't  
correct.  
  
The correct parameter to use for error reports in case of WAL  
reading failures is xlogreader->EndRecPtr. This change fixes it.  
  
While on it, removed an unnecessary Assert in pg_walinspect code.  
  
Reported-by: Robert Haas  
Author: Bharath Rupireddy  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZAOGzPUifrcZRjFZ2vbtcw3mp-mN6UgEoEcQg6bY3OVg%40mail.gmail.com  
Backpatch-through: 15  

M contrib/pg_walinspect/pg_walinspect.c

Bump catversion for 6566133c5f52771198aca07ed18f84519fac1be7

commit   : 9288c2e6f8e6bb523f309dd413af1344962ebc6e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 15:10:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 15:10:06 -0400    

Click here for diff

Omission noted by Tom Lane.  

M src/include/catalog/catversion.h

Don't add HAVE_LDAP_H HAVE_WINLDAP_H to pg_config.h

commit   : 4ab53b647abffb911bea35662ca4b22d788c25d4    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 18 Aug 2022 10:41:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 18 Aug 2022 10:41:42 -0700    

Click here for diff

They're not referenced, so we don't need them in in pg_config.h.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: http://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Ensure that pg_auth_members.grantor is always valid.

commit   : 6566133c5f52771198aca07ed18f84519fac1be7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 13:13:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 13:13:02 -0400    

Click here for diff

Previously, "GRANT foo TO bar" or "GRANT foo TO bar GRANTED BY baz"  
would record the OID of the grantor in pg_auth_members.grantor, but  
that role could later be dropped without modifying or removing the  
pg_auth_members record. That's not great, because we typically try  
to avoid dangling references in catalog data.  
  
Now, a role grant depends on the grantor, and the grantor can't be  
dropped without removing the grant or changing the grantor.  "DROP  
OWNED BY" will remove the grant, just as it does for other kinds of  
privileges. "REASSIGN OWNED BY" will not, again just like what we do  
in other cases involving privileges.  
  
pg_auth_members now has an OID column, because that is needed in order  
for dependencies to work. It also now has an index on the grantor  
column, because otherwise dropping a role would require a sequential  
scan of the entire table to see whether the role's OID is in use as  
a grantor. That probably wouldn't be too large a problem in practice,  
but it seems better to have an index just in case.  
  
A follow-on patch is planned with the goal of more thoroughly  
rationalizing the behavior of role grants. This patch is just trying  
to do enough to make sure that the data we store in the catalogs is at  
some basic level valid.  
  
Patch by me, reviewed by Stephen Frost  
  
Discussion: http://postgr.es/m/CA+TgmoaFr-RZeQ+WoQ5nKPv97oT9+aDgK_a5+qWHSgbDsMp1Vg@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/system_views.sql
M src/backend/commands/alter.c
M src/backend/commands/event_trigger.c
M src/backend/commands/tablecmds.c
M src/backend/commands/user.c
M src/include/catalog/dependency.h
M src/include/catalog/pg_auth_members.h
M src/test/regress/expected/create_role.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/create_role.sql
M src/test/regress/sql/privileges.sql

Improve performance of adjust_appendrel_attrs_multilevel.

commit   : 2f17b57017e5f1993dbe0f389e01f1302a541196    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2022 12:36:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2022 12:36:06 -0400    

Click here for diff

The present implementations of adjust_appendrel_attrs_multilevel and  
its sibling adjust_child_relids_multilevel are very messy, because  
they work by reconstructing the relids of the child's immediate  
parent and then seeing if that's bms_equal to the relids of the  
target parent.  Aside from being quite inefficient, this will not  
work with planned future changes to make joinrels' relid sets  
contain outer-join relids in addition to baserels.  
  
The whole thing can be solved at a stroke by adding explicit parent  
and top_parent links to child RelOptInfos, and making these functions  
work with RelOptInfo pointers instead of relids.  Doing that is  
simpler for most callers, too.  
  
In my original version of this patch, I got rid of  
RelOptInfo.top_parent_relids on the grounds that it was now redundant.  
However, that adds a lot of code churn in places that otherwise would  
not need changing, and arguably the extra indirection needed to fetch  
top_parent->relids in those places costs something.  So this version  
leaves that field in place.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/backend/partitioning/partprune.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/appendinfo.h

Adjust assertion in XLogDecodeNextRecord.

commit   : ec97db399f1eccda6652d44b99d5363728832eb7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 12:15:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 12:15:55 -0400    

Click here for diff

As written, if you use XLogBeginRead() to position an xlogreader at  
the beginning of a WAL page and then try to read WAL, this assertion  
will fail. However, the header comment for XLogBeginRead() claims  
that positioning an xlogreader at the beginning of a page is valid,  
and the code here is perfectly able to cope with it. It's only the  
assertion that causes trouble. So relax it.  
  
This is formally a bug in all supported branches, but as it doesn't  
seem to have any consequences for current uses of the xlogreader  
facility, no back-patch, at least for now.  
  
Dilip Kumar and Robert Haas  
  
Discussion: http://postgr.es/m/CA+TgmoaJSs2_7WHW2GzFYe9+zfPtxBKvT3GW47+x=ptUE=cULw@mail.gmail.com  

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

Fix subtly-incorrect matching of parent and child partitioned indexes.

commit   : e6dbb48487faf47c1436d26064736a906f885a03    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2022 12:11:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2022 12:11:47 -0400    

Click here for diff

When creating a partitioned index, DefineIndex tries to identify  
any existing indexes on the partitions that match the partitioned  
index, so that it can absorb those as child indexes instead of  
building new ones.  Part of the matching is to compare IndexInfo  
structs --- but that wasn't done quite right.  We're comparing  
the IndexInfo built within DefineIndex itself to one made from  
existing catalog contents by BuildIndexInfo.  Notably, while  
BuildIndexInfo will run index expressions and predicates through  
expression preprocessing, that has not happened to DefineIndex's  
struct.  The result is failure to match and subsequent creation  
of duplicate indexes.  
  
The easiest and most bulletproof fix is to build a new IndexInfo  
using BuildIndexInfo, thereby guaranteeing that the processing done  
is identical.  
  
While here, let's also extract the opfamily and collation data  
from the new partitioned index, removing ad-hoc logic that  
duplicated knowledge about how those are constructed.  
  
Per report from Christophe Pettus.  Back-patch to v11 where  
we invented partitioned indexes.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

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

When using the WAL-logged CREATE DATABASE strategy, bulk extend.

commit   : 3e63e8462f31657c8ae1c541c92daf43ede8f038    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 11:09:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 11:09:39 -0400    

Click here for diff

This should improve performance, and was suggested by Andres Freund.  
Back-patch to v15 to keep the code consistent across branches.  
  
Dilip Kumar  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CAFiTN-sJ0vVpJrZ=R5M+g7Tr8=NN4wKOtrqOcDEsfFfnZgivVA@mail.gmail.com  

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

Remove unused configure variable.

commit   : 27f1774aac1f8ffe642b55e78dbe0b64ed082cc6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2022 11:22:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2022 11:22:13 -0400    

Click here for diff

configure extracts TCL_SHLIB_LD_LIBS from tclConfig.sh, and puts the  
value into Makefile.global, but then we never use it anywhere.  It  
looks like I removed the only usage in cd75f94da, but didn't notice  
that it was the only usage.  Might as well mop this up while we're  
trying to get rid of unnecessary configure steps.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/Makefile.global.in

Simplify and clarify an error message

commit   : 08909e3aee6182a988da5bf5c1b543910ee096c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2022 11:33:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2022 11:33:53 +0200    

Click here for diff

M src/backend/commands/copyfromparse.c
M src/test/regress/expected/copy.out

mstcpip.h is not missing on MinGW.

commit   : f340f97a13b1455349ee27550623179c018fa036    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:21:24 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:21:24 +1200    

Click here for diff

Remove a small difference between MinGW and MSVC builds which isn't  
needed for modern MinGW, noticed in passing.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M src/backend/libpq/pqcomm.c
M src/interfaces/libpq/fe-connect.c

Remove configure probe for netinet/tcp.h.

commit   : 2492fe49dcb534844d9eece97504b4caca1d81ae    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:17:13 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:17:13 +1200    

Click here for diff

<netinet/tcp.h> is in SUSv3 and all targeted Unix systems have it.  
For Windows, we can provide a stub include file, to avoid some #ifdef  
noise.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M configure
M configure.ac
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/common/ip.c
M src/include/libpq/libpq-be.h
M src/include/pg_config.h.in
A src/include/port/win32/netinet/tcp.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/tools/msvc/Solution.pm

Fix macro problem with gai_strerror on Windows.

commit   : cce28f62680ca77f18762d58bc31f6b67c6ef692    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:16:00 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:16:00 +1200    

Click here for diff

Commit 5579388d was confused about why gai_strerror() didn't work, and  
used gai_strerrorA().  It turns out that we had explicitly undefined  
Windows' own macro for that somewhere else.  Get rid of all that, and  
use the system headers' definition of gai_sterror() directly as  
intended.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M src/include/port/win32/netdb.h
M src/include/port/win32/sys/socket.h

Remove configure probe for sys/sockio.h.

commit   : 2cea02fb85b9b00c3b95d8cd0e39cf91cd2ce289    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:12:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:12:20 +1200    

Click here for diff

On BSD-family systems, header <sys/sockio.h> defines socket ioctl  
numbers like SIOCGIFCONF.  Only AIX is using those now, but it defines  
them in <net/if.h> anyway.  
  
Supposing some PostgreSQL hacker wants to test that AIX-only code path  
on a more common development system by pretending not to have  
getifaddrs().  It's enough to include <sys/ioctl.h>, at least on macOS,  
FreeBSD and Linux, and we're already doing that.  

M configure
M configure.ac
M src/backend/libpq/ifaddr.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Remove configure probe for net/if.h.

commit   : 2f8d918359ccb34533690735eb46b851002ac698    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:11:58 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:11:58 +1200    

Click here for diff

<net/if.h> is in SUSv3 and all targeted Unixes have it.  It's used in a  
region that is already ifdef'd out for Windows.  We're not using it for  
any standard definitions, but it's where AIX defines conventional socket  
ioctl numbers.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M configure
M configure.ac
M src/backend/libpq/ifaddr.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Remove dead ifaddr.c fallback code.

commit   : a717cddcac518162cc17bae3c68a492db9ab2e75    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:08:02 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 18 Aug 2022 16:08:02 +1200    

Click here for diff

We carried a special implementation of pg_foreach_ifaddr() using  
Solaris's ioctl(SIOCGLIFCONF), but Solaris 11 and illumos adopted  
getifaddrs() more than a decade ago, and we prefer to use that.  Solaris  
10 is EOL'd.  Remove the dead code.  
  
Adjust comment about which OSes have getifaddrs(), which also  
incorrectly listed AIX.  AIX is in fact the only Unix in the build farm  
that *doesn't* have it today, so the implementation based on  
ioctl(SIOCGIFCONF) (note, no 'L') is still live.  All the others have  
had it for at least one but mostly two decades.  
  
The last-stop fallback at the bottom of the file is dead code in  
practice, but it's hard to justify removing it because the better  
options are all non-standard.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M src/backend/libpq/ifaddr.c

Update comment in gramparse.h

commit   : 3f5dbcb5fe0bd68df7e5de5e95e10b3b892c43b2    
  
author   : John Naylor <[email protected]>    
date     : Thu, 18 Aug 2022 09:45:05 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 18 Aug 2022 09:45:05 +0700    

Click here for diff

src/common/keywords.c hasn't included this header since afb0d0712.  

M src/include/parser/gramparse.h

Refer to replication origin roident as "ID" in user facing messages and docs

commit   : c920fe48181d81ce218faa746f8af92c41d03b2e    
  
author   : John Naylor <[email protected]>    
date     : Thu, 18 Aug 2022 08:57:13 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 18 Aug 2022 08:57:13 +0700    

Click here for diff

The table column that stores this is of type oid, but is actually limited  
to uint16 and has a different path for creating new values. Some of  
the documentation already referred to it as an ID, so let's standardize  
on that.  
  
While at it, most format strings already use %u, so for consintency  
change the remaining stragglers using %d.  
  
Per suggestions from Tom Lane and Justin Pryzby  
Discussion: https://www.postgresql.org/message-id/3437166.1659620465%40sss.pgh.pa.us  
Backpatch to v15  

M doc/src/sgml/replication-origins.sgml
M src/backend/replication/logical/origin.c

Fix hypothetical problem passing the wrong GROUP BY pathkeys

commit   : af7d270dd3c7523dad023f5761f630daa7fb2730    
  
author   : David Rowley <[email protected]>    
date     : Thu, 18 Aug 2022 11:32:55 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 18 Aug 2022 11:32:55 +1200    

Click here for diff

1349d2790 changed things to make the planner request that the  
query_pathkeys contain pathkeys for any ORDER BY / DISTINCT aggregates.  
Some code added prior to that commit in db0d67db2 made it so the order  
that the pathkeys appear in the group_pathkeys could be changed so that  
the GROUP BY could be executed in a more optimal order which minimized  
sort comparisons.  1349d2790 had to make sure that the pathkeys for any  
ORDER BY / DISTINCT aggregates remained at the end of the groupby_pathkeys  
and wasn't reordered, so some code was added to  
add_paths_to_grouping_rel() to first strip off any pathkeys belonging to  
ORDER BY / DISTINCT aggregates before passing to the function to optimize  
the order of the group_pathkeys.  
  
It seems I dropped the ball in 1349d2790 and mistakenly used the untouched  
PlannerInfo.group_pathkeys to pass to get_useful_group_keys_orderings()  
instead of the version that had the aggregate pathkeys removed.  It was  
only the code path that was handling creating paths for  
partially_grouped_rel which made this mistake.  In practice, we'll never  
have any extra pathkeys to strip off when processing  
partially_grouped_rel as that's only used when considering partial  
paths, which we never do when there are ORDER BY / DISTINCT aggregates.  
So this is just a hypothetical bug, not a live bug.  We already have the  
correct pathkeys determined, so it's of no extra cost to pass the  
correct variable.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planner.c

doc: Add a note on PO editors

commit   : a340359a4f9bed54e0af67dd90050c13e0976fb6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Aug 2022 23:41:56 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Aug 2022 23:41:56 +0200    

Click here for diff

While PO files can be edited in any text editor, specialized tools for  
translation editing can be quite helpful with automating tasks etc. Add  
a small note about PO editors to encourage new translators to research  
which tool works best for them.  
  
Reviewed-by: Bruce Momjian <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/nls.sgml

Refactor addition of PlaceHolderVars to joinrel targetlists.

commit   : afa0ec30bfd18611ec5bc4dfa394dc8838aece21    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2022 16:12:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2022 16:12:23 -0400    

Click here for diff

Make build_joinrel_tlist() responsible for adding PHVs that were  
already computed in one or the other input relation, and therefore  
change add_placeholders_to_joinrel() to only add PHVs that will be  
newly computed in this joinrel's output.  This makes the handling  
of PHVs in build_joinrel_tlist() more like its handling of plain  
Vars, which seems like a good thing on intelligibility grounds  
and will simplify planned future changes.  There is a purely  
cosmetic side-effect that the order of entries in the joinrel's  
tlist may change; but since it becomes more like the order of  
entries in the input tlists, that's not bad.  
  
The reason it wasn't done like this originally was the potential  
cost of looking up PlaceHolderInfo entries to consult ph_needed.  
Now that that's O(1) it shouldn't hurt.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/test/regress/expected/join.out

Use an explicit state flag to control PlaceHolderInfo creation.

commit   : b3ff6c742f6c7f750e9f74476576839cb039e1ab    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2022 15:52:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2022 15:52:53 -0400    

Click here for diff

Up to now, callers of find_placeholder_info() were required to pass  
a flag indicating if it's OK to make a new PlaceHolderInfo.  That'd  
be fine if the callers had free choice, but they do not.  Once we  
begin deconstruct_jointree() it's no longer OK to make more PHIs;  
while callers before that always want to create a PHI if it's not  
there already.  So there's no freedom of action, only the opportunity  
to cause bugs by creating PHIs too late.  Let's get rid of that in  
favor of adding a state flag PlannerInfo.placeholdersFrozen, which  
we can set at the point where it's no longer OK to make more PHIs.  
  
This patch also simplifies a couple of call sites that were using  
complicated logic to avoid calling find_placeholder_info() as much  
as possible.  Now that that lookup is O(1) thanks to the previous  
commit, the extra bitmap manipulations are probably a net negative.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/placeholder.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/planmain.h

Make PlaceHolderInfo lookup O(1).

commit   : 6569ca43973b754e8213072c8ddcae9e7baf2aaa    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2022 15:35:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2022 15:35:51 -0400    

Click here for diff

Up to now we've just searched the placeholder_list when we want to  
find the PlaceHolderInfo with a given ID.  While there's no evidence  
of that being a problem in the field, an upcoming patch will add  
find_placeholder_info() calls in build_joinrel_tlist(), which seems  
likely to make it more of an issue: a joinrel emitting lots of  
PlaceHolderVars would incur O(N^2) cost, and we might be building  
a lot of joinrels in complex queries.  Hence, add an array that  
can be indexed directly by phid to make the lookups constant-time.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/var.c
M src/include/nodes/pathnodes.h

Avoid using list_length() to test for empty list.

commit   : efd0c16becbf45e3b0215e124fde75fee8fcbce4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2022 11:12:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Aug 2022 11:12:35 -0400    

Click here for diff

The standard way to check for list emptiness is to compare the  
List pointer to NIL; our list code goes out of its way to ensure  
that that is the only representation of an empty list.  (An  
acceptable alternative is a plain boolean test for non-null  
pointer, but explicit mention of NIL is usually preferable.)  
  
Various places didn't get that memo and expressed the condition  
with list_length(), which might not be so bad except that there  
were such a variety of ways to check it exactly: equal to zero,  
less than or equal to zero, less than one, yadda yadda.  In the  
name of code readability, let's standardize all those spellings  
as "list == NIL" or "list != NIL".  (There's probably some  
microscopic efficiency gain too, though few of these look to be  
at all performance-critical.)  
  
A very small number of cases were left as-is because they seemed  
more consistent with other adjacent list_length tests that way.  
  
Peter Smith, with bikeshedding from a number of us  
  
Discussion: https://postgr.es/m/CAHut+PtQYe+ENX5KrONMfugf0q6NHg4hR5dAhqEXEc2eefFeig@mail.gmail.com  

M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_depend.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execPartition.c
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/partitioning/partprune.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/statistics/mcv.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tsquery.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

doc: Consistently spell case-insensitive

commit   : 4a319fce7671ffbe2a730f79529b7a2ef3794d41    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Aug 2022 10:05:03 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Aug 2022 10:05:03 +0200    

Click here for diff

While almost all occurrences of "case-insensitive{ly}" were spelled with  
a dash, a few were using "case insensitive{ly}" with a space instead. Fix  
by changing these to use a dash to be consistent.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/query.sgml
M doc/src/sgml/syntax.sgml

doc: Document pg_trgm being case-insensitive by default

commit   : 3e7d94fca0e5ad8835b0f2b1a584c83ea11ce439    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Aug 2022 09:56:02 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Aug 2022 09:56:02 +0200    

Click here for diff

pg_trgm is by default operating case-insensitively but the docs didn't  
mention that at all.  
  
Author: Erik Rijkers <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgtrgm.sgml

Use SetInstallXLogFileSegmentActive() in more places in xlog.c

commit   : d265cd202961c240a2875826ca47822b54f74db5    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Aug 2022 15:28:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Aug 2022 15:28:45 +0900    

Click here for diff

This reduces the code paths where XLogCtl->InstallXLogFileSegmentActive  
is directly touched, and this wrapper function does the same thing as  
the original code replaced by the function call.  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/CALj2ACVhkf-bC5CX-=6iBUfkO5GqmBntQH+m=HpY0iQ=-g1pRg@mail.gmail.com  

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

Allow event trigger table_rewrite for ALTER MATERIALIZED VIEW

commit   : 93f2349c36a7555a81d5e26edf9a0213fb3d323a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Aug 2022 14:55:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Aug 2022 14:55:20 +0900    

Click here for diff

This event can happen when using SET ACCESS METHOD, as the data files of  
the materialized need a full refresh but this command tag was not  
updated to reflect that.  The documentation is updated to track this  
behavior.  
  
Author: Onder Kalaci  
Discussion: https://postgr.es/m/CACawEhXwHN3X34FiwoYG8vXR-oyUdrp7qcfRWSzS+NPahS5gSw@mail.gmail.com  
Backpatch-through: 15  

M doc/src/sgml/event-trigger.sgml
M src/include/tcop/cmdtaglist.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Fix assert in logicalmsg_desc

commit   : c52ad9c4efdb91ce274c65b1acdb350e439c7b2d    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 16 Aug 2022 23:52:10 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 16 Aug 2022 23:52:10 +0200    

Click here for diff

The assert, introduced by 9f1cf97bb5, is intended to check if the prefix  
is terminated by a \0 byte, but it has two flaws. Firstly, prefix_size  
includes the \0 byte, so prefix[prefix_size] points to the byte after  
the null byte. Secondly, the check ensures the byte is not equal \0,  
while it should be checking the opposite.  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/rmgrdesc/logicalmsgdesc.c

doc: Remove reference to tty libpq connstring param

commit   : 40ca9073ff228163b1320122a82e4064da6cf54f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Aug 2022 22:54:43 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Aug 2022 22:54:43 +0200    

Click here for diff

The tty connection string parameter was removed in commit 14d9b3760  
but the reference to it in the docs was mistakenly kept.  Fix by  
removing it from the libpq documentation.  Backpatch through v14  
where the parameter was removed.  
  
Author: Noriyoshi Shinoda <[email protected]>  
Discussion: https://postgr.es/m/DM4PR84MB173433216FCC2A3961879000EE6B9@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  
Backpatch-through: 14  

M doc/src/sgml/libpq.sgml

doc: Add missing parenthesis to keycombo

commit   : 6cbed0ec791f3829d0e2092fd4c36d493ae75a50    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Aug 2022 12:44:24 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Aug 2022 12:44:24 +0200    

Click here for diff

The SIGINT keycombo for the pg_waldump stats emission was lacking a  
closing parenthesis.  Backpatch to 15 where this feature was added.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/ref/pg_waldump.sgml

Fix replica identity check for a partitioned table.

commit   : 0d5bd3a6cc3e4cd2fb44e2714e52a684cc7bbc25    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 16 Aug 2022 15:25:41 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 16 Aug 2022 15:25:41 +0530    

Click here for diff

The current publisher code checks if UPDATE or DELETE can be executed with  
the replica identity of the table even if it's a partitioned table. We can  
skip checking the replica identity for partitioned tables because the  
operations are actually performed on the leaf partitions (not the  
partitioned table).  
  
Reported-by: Brad Nicholson  
Author: Hou Zhijie  
Reviewed-by: Peter Smith, Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/CAMMnM%3D8i5DohH%3DYKzV0_wYuYSYvuOJoL9F5nzXTc%2ByzsG1f6rg%40mail.gmail.com  

M src/backend/executor/execReplication.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

doc: fix wrong tag used in create sequence manual.

commit   : f4c32cdd1cc3e759d8e300664ec553a16bcb6c37    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 16 Aug 2022 09:20:14 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 16 Aug 2022 09:20:14 +0900    

Click here for diff

In ref/create_sequence.sgml <literal> tag was used for nextval function name.  
This should have been <function> tag.  
  
Author: Noboru Saito  
Discussion: https://postgr.es/m/CAAM3qnJTDFFfRf5JHJ4AYrNcqXgMmj0pbH0%2Bvm%3DYva%2BpJyGymA%40mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ref/create_sequence.sgml

Fix headerscheck and cpluspluscheck's exit codes.

commit   : 3eae0cbf7e70db885c4ec37e0863022d3ad589d4    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 16 Aug 2022 10:53:29 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 16 Aug 2022 10:53:29 +1200    

Click here for diff

For the benefit of CI, which started running these header check scripts  
in its CompilerWarnings task in commit 81b9f23c9c8, they should report  
failure if any individual header failed to compile.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKtDwPo9wzKgbStDwfOhEpywMc6PQofio8fAHR7yUjgxw%40mail.gmail.com  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

doc: Add unit to pg_shmem_allocations attributes

commit   : 75ca8c14576238926e1f4c2e80c11dd23a1911c3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 15 Aug 2022 22:30:00 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 15 Aug 2022 22:30:00 +0200    

Click here for diff

The unit of size and allocated_size was not documented.  Speciyfing the  
unit is in line with how many other (but not all) system view attributes  
are documented so fixing by adding the unit which is "bytes".  
  
Author: Euler Taveira <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/system-views.sgml

Add missing bad-PGconn guards in libpq entry points.

commit   : bb9237a1295a29c4e41b97f9d34e3922ac69c071    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2022 15:40:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2022 15:40:07 -0400    

Click here for diff

There's a convention that externally-visible libpq functions should  
check for a NULL PGconn pointer, and fail gracefully instead of  
crashing.  PQflush() and PQisnonblocking() didn't get that memo  
though.  Also add a similar check to PQdefaultSSLKeyPassHook_OpenSSL;  
while it's not clear that ordinary usage could reach that with a  
null conn pointer, it's cheap enough to check, so let's be consistent.  
  
Daniele Varrazzo and Tom Lane  
  
Discussion: https://postgr.es/m/CA+mi_8Zm_mVVyW1iNFgyMd9Oh0Nv8-F+7Y3-BqwMgTMHuo_h2Q@mail.gmail.com  

M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-secure-openssl.c

Remove redundant spaces in _outA_Expr() output

commit   : 1c5818b9c68e5c2ac8f19d372f24cce409de1a26    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Aug 2022 12:43:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Aug 2022 12:43:52 +0200    

Click here for diff

Since WRITE_NODE_FIELD() output always starts with a space, we don't  
need to go out of our way to print another space right before it.  
  
This change is only for visual appearance; the tokenizer on the  
reading side would read it the same way (but there is no read support  
for A_Expr at this time anyway).  

M src/backend/nodes/outfuncs.c

Improve tab completion of ALTER TYPE in psql

commit   : f6c750d31d97a66a90e3389ae6832bf99cd15f30    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 15 Aug 2022 14:08:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 15 Aug 2022 14:08:59 +0900    

Click here for diff

This commit adds support for more tab completion in this command as of  
"ALTER TYPE .. SET".  The completion of "RENAME VALUE" was separated  
from the rest of the completions done for this command, so group  
everything together.  
  
Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm1u83jtD2wysdw9XwokEacSXEyUpELajEvOMgJTc3pQ7g@mail.gmail.com  

M src/bin/psql/tab-complete.c

Fix outdated --help message for postgres -f

commit   : f2108d3bd03d3cb101a8ddfa5fe127d30e7f47f4    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 15 Aug 2022 13:36:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 15 Aug 2022 13:36:36 +0900    

Click here for diff

This option switch supports a total of 8 values, as told by  
set_plan_disabling_options() and the documentation, but this was not  
reflected in the output generated by --help.  
  
Author: Junwang Zhao  
Discussion: https://postgr.es/m/CAEG8a3+pT3cWzyjzKs184L1XMNm8NDnoJLiSjAYSO7XqpRh_vA@mail.gmail.com  
Backpatch-through: 10  

M src/backend/main/main.c

Preserve memory context of VarStringSortSupport buffers.

commit   : a466219428a065ac24f7cec652f9188a5fba6f08    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Aug 2022 12:05:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Aug 2022 12:05:27 -0400    

Click here for diff

When enlarging the work buffers of a VarStringSortSupport object,  
varstrfastcmp_locale was careful to keep them in the ssup_cxt  
memory context; but varstr_abbrev_convert just used palloc().  
The latter creates a hazard that the buffers could be freed out  
from under the VarStringSortSupport object, resulting in stomping  
on whatever gets allocated in that memory later.  
  
In practice, because we only use this code for ICU collations  
(cf. 3df9c374e), the problem is confined to use of ICU collations.  
I believe it may have been unreachable before the introduction  
of incremental sort, too, as traditional sorting usually just  
uses one context for the duration of the sort.  
  
We could fix this by making the broken stanzas in varstr_abbrev_convert  
match the non-broken ones in varstrfastcmp_locale.  However, it seems  
like a better idea to dodge the issue altogether by replacing the  
pfree-and-allocate-anew coding with repalloc, which automatically  
preserves the chunk's memory context.  This fix does add a few cycles  
because repalloc will copy the chunk's content, which the existing  
coding assumes is useless.  However, we don't expect that these buffer  
enlargement operations are performance-critical.  Besides that, it's  
far from obvious that copying the buffer contents isn't required, since  
these stanzas make no effort to mark the buffers invalid by resetting  
last_returned, cache_blob, etc.  That seems to be safe upon examination,  
but it's fragile and could easily get broken in future, which wouldn't  
get revealed in testing with short-to-moderate-size strings.  
  
Per bug #17584 from James Inform.  Whether or not the issue is  
reachable in the older branches, this code has been broken on its  
own terms from its introduction, so patch all the way back.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add new win32 header to headerscheck and cpluspluscheck

commit   : 213bd0662cef220f7a30fea348288bb8989c1883    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 11:15:23 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 11:15:23 +1200    

Click here for diff

Commit 5579388d added src/include/port/win32/netdb.h but forgot to  
filter it out in the header checking scripts.  Per build farm animal  
crake.  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Remove configure probe for gethostbyname_r.

commit   : 52ea29045b79a5f996e454ac6c7f3bcd64aef572    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 09:57:48 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 09:57:48 +1200    

Click here for diff

It was only used by src/port/getaddrinfo.c, removed by the previous  
commit.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJFLPCtAC58EAimF6a6GPw30TU_59FUY%3DGWB_kC%3DJEmVQ%40mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-connect.c
M src/tools/msvc/Solution.pm

Remove replacement code for getaddrinfo.

commit   : 5579388d2dda60ded329a4623f9b4529e91a1b24    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 09:53:28 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 09:53:28 +1200    

Click here for diff

SUSv3, all targeted Unixes and modern Windows have getaddrinfo() and  
related interfaces.  Drop the replacement implementation, and adjust  
some headers slightly to make sure that the APIs are visible everywhere  
using standard POSIX headers and names.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M config/c-library.m4
M configure
M configure.ac
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/bin/initdb/initdb.c
M src/include/common/ip.h
D src/include/getaddrinfo.h
M src/include/libpq/libpq-be.h
M src/include/pg_config.h.in
M src/include/port/win32/netdb.h
M src/include/replication/walreceiver.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/port/Makefile
D src/port/getaddrinfo.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Remove configure probe for struct sockaddr_storage.

commit   : de42bc3ac8f7205f2c302b402e40704ceb46a70c    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 08:52:08 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 08:52:08 +1200    

Click here for diff

<sys/socket.h> provides sockaddr_storage in SUSv3 and all targeted Unix  
systems have it.  Windows has it too.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M config/c-library.m4
M configure
M configure.ac
M src/include/libpq/pqcomm.h
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Avoid misbehavior when hash_table_bytes < bucket_size.

commit   : 55d9cd46f65a5fc0c3bbb69d36cc9dba597a8c9c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 16:59:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 16:59:58 -0400    

Click here for diff

It's possible to reach this case when work_mem is very small and tupsize  
is (relatively) very large.  In that case ExecChooseHashTableSize would  
get an assertion failure, or with asserts off it'd compute nbuckets = 0,  
which'd likely cause misbehavior later (I've not checked).  To fix,  
clamp the number of buckets to be at least 1.  
  
This is due to faulty conversion of old my_log2() coding in 28d936031.  
Back-patch to v13, as that was.  
  
Zhang Mingli  
  
Discussion: https://postgr.es/m/beb64ca0-91e2-44ac-bf4a-7ea36275ec02@Spark  

M src/backend/executor/nodeHash.c

Remove HAVE_UNIX_SOCKETS.

commit   : f5580882856963d1b50f9e391a8dda82d44b69a6    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 08:46:53 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 14 Aug 2022 08:46:53 +1200    

Click here for diff

Since HAVE_UNIX_SOCKETS is now defined unconditionally, remove the macro  
and drop a small amount of dead code.  
  
The last known systems not to have them (as far as I know at least) were  
QNX, which we de-supported years ago, and Windows, which now has them.  
  
If a new OS ever shows up with the POSIX sockets API but without working  
AF_UNIX, it'll presumably still be able to compile the code, and fail at  
runtime with an unsupported address family error.  We might want to  
consider adding a HINT that you should turn off the option to use it if  
your network stack doesn't support it at that point, but it doesn't seem  
worth making the relevant code conditional at compile time.  
  
Also adjust a couple of places in the docs and comments that referred to  
builds without Unix-domain sockets, since there aren't any.  Windows  
still gets a special mention in those places, though, because we don't  
try to use them by default there yet.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/initdb.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/server.c
M src/common/ip.c
M src/include/port.h
M src/interfaces/libpq/fe-connect.c
M src/test/regress/pg_regress.c

Catch stack overflow when recursing in transformFromClauseItem().

commit   : e07ebd4b6e606a7c03ed3c6bf5d6bcbb725247b4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 15:21:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 15:21:28 -0400    

Click here for diff

Most parts of the parser can expect that the stack overflow check  
in transformExprRecurse() will trigger before things get desperate.  
However, transformFromClauseItem() can recurse directly to self  
without having analyzed any expressions, so it's possible to drive  
it to a stack-overrun crash.  Add a check to prevent that.  
  
Per bug #17583 from Egor Chindyaskin.  Back-patch to all supported  
branches.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_clause.c

Remove configurability of PPC spinlock assembly code.

commit   : 8ded65682bee2a1c04392a88e0df0f4fc7552623    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 13:36:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 13:36:39 -0400    

Click here for diff

Assume that we can use LWARX hint flags and the LWSYNC instruction  
on any PPC machine.  The check on the assembler's behavior was only  
needed for Apple's old assembler, which is no longer of interest  
now that we've de-supported all PPC-era versions of macOS (thanks  
to them not having clock_gettime()).  Also, given an up-to-date  
assembler these instructions work even on Apple's old hardware.  
It seems quite unlikely that anyone would be interested in running  
current Postgres on PPC hardware that's so old as to not have  
these instructions.  
  
Hence, rip out associated configure test and manual configuration  
options, and just use the modernized instructions all the time.  
Also, update atomics/arch-ppc.h to use these instructions as well.  
(It was already using LWSYNC unconditionally in another place,  
providing further proof that nobody is using PG on hardware old  
enough to have a problem with that.)  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/pg_config_manual.h
M src/include/port/atomics/arch-ppc.h
M src/include/storage/s_lock.h
M src/tools/msvc/Solution.pm

Remove configure probe for shl_load library.

commit   : adee0df127e088a47c58801fc5a412392297e1da    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:43:55 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:43:55 +1200    

Click here for diff

This was needed only by HP-UX 10, so it became redundant with commit  
9db300ce.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M configure
M configure.ac

Remove configure probe for sys/resource.h and refactor.

commit   : 36b3d52459aecd4f8bc39a4604e42186c48aa9d2    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:35:24 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:35:24 +1200    

Click here for diff

<sys/resource.h> is in SUSv2 and is on all targeted Unix systems.  We  
have a replacement for getrusage() on Windows, so let's just move its  
declarations into src/include/port/win32/sys/resource.h so that we can  
use a standard-looking #include.  Also remove an obsolete reference to  
CLK_TCK.  Also rename src/port/getrusage.c to win32getrusage.c,  
following the convention for Windows-only fallback code.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M configure
M configure.ac
M src/backend/storage/file/fd.c
M src/backend/tcop/postgres.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pgbench/pgbench.c
M src/include/pg_config.h.in
A src/include/port/win32/sys/resource.h
D src/include/rusagestub.h
M src/include/utils/pg_rusage.h
R088 src/port/getrusage.c src/port/win32getrusage.c
M src/test/regress/pg_regress.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Remove configure probes for sys/ipc.h, sys/sem.h, sys/shm.h.

commit   : 37a65d1db14658bc75faa3aea7bd5a064118d135    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:34:12 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:34:12 +1200    

Click here for diff

These are in SUSv2 and every targeted Unix system has them.  It's not  
hard to avoid including them on Windows system because they're mostly  
used in platform-specific translation units.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M config/c-library.m4
M configure
M configure.ac
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/storage/ipc/dsm_impl.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Remove configure probe for sys/select.h.

commit   : 7e50b4e3c52aaa13e86e0560d1382844074c9f1b    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:33:34 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:33:34 +1200    

Click here for diff

<sys/select.h> is in SUSv3 and every targeted Unix system has it.  
Provide an empty header in src/include/port/win32 so that we can  
include it unguarded even on Windows.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M configure
M configure.ac
M doc/src/sgml/libpq.sgml
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_dump/parallel.c
M src/bin/pgbench/pgbench.c
M src/fe_utils/parallel_slot.c
M src/include/pg_config.h.in
A src/include/port/win32/sys/select.h
M src/interfaces/libpq/fe-misc.c
M src/port/pgsleep.c
M src/test/examples/testlibpq2.c
M src/test/isolation/isolationtester.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/tools/msvc/Solution.pm

Remove configure probes for sys/un.h and struct sockaddr_un.

commit   : 077bf2f2750076675ae7195c58bec9a62d62fd34    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:26:43 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:26:43 +1200    

Click here for diff

<sys/un.h> is in SUSv3 and every targeted Unix has it.  Some Windows  
tool chains may still lack the approximately equivalent header  
<afunix.h>, so we already defined struct sockaddr_un ourselves on that  
OS for now.  To harmonize things a bit, move our definition into a new  
header src/include/port/win32/sys/un.h.  
  
HAVE_UNIX_SOCKETS is now defined unconditionally.  We migh remove that  
in a separate commit, pending discussion.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M config/c-library.m4
M configure
M configure.ac
M src/include/c.h
M src/include/libpq/pqcomm.h
M src/include/pg_config.h.in
M src/include/port.h
M src/include/port/win32.h
A src/include/port/win32/sys/un.h
M src/port/getpeereid.c
M src/tools/msvc/Solution.pm

Remove configure probe for sys/uio.h.

commit   : 75357ab94034c6f2e65d146632691072756365c5    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:24:42 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Aug 2022 23:24:42 +1200    

Click here for diff

<sys/uio.h> is in SUSv2, and all targeted Unix system have it, so we  
might as well drop the probe (in fact we never really needed this one).  
It's where struct iovec is defined, and as a common extension, it's also  
where non-standard preadv() and pwritev() are declared on systems that  
have them.  
  
We should also be able to assume that IOV_MAX is defined on Unix.  
  
To spell out what our pg_iovec.h header does for the OSes in the build  
farm as of today:  
  
  Windows: our own struct and functions  
  Solaris, Cygwin: <sys/uio.h>'s struct, our own functions  
  Every other Unix: <sys/uio.h>'s struct and functions  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port/pg_iovec.h
M src/tools/msvc/Solution.pm

Add missing fields to _outConstraint()

commit   : abf46ad9c7b3748e9c36cf6020206064e69cea7e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Aug 2022 10:32:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Aug 2022 10:32:38 +0200    

Click here for diff

As of 897795240cfaaed724af2f53ed2c50c9862f951f, check constraints can  
be declared invalid.  But that patch didn't update _outConstraint() to  
also show the relevant struct fields (which were only applicable to  
foreign keys before that).  This currently only affects debugging  
output, so no impact in practice.  

M src/backend/nodes/outfuncs.c

pg_upgrade: Fix some minor code issues

commit   : 9da300128df71b8f3f2a92038aee251413735dbe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Aug 2022 00:00:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Aug 2022 00:00:41 +0200    

Click here for diff

96ef3b8ff1cf1950e897fd2f766d4bd9ef0d5d56 accidentally copied a not  
applicable comment from the float8_pass_by_value code to the  
data_checksums code.  Remove that.  
  
87d3b35a1ca31a9d947a8f919a6006679216dff0 changed pg_upgrade to  
checking the checksum version rather than just the Boolean presence of  
checksums, but didn't change the field type in its ControlData struct  
from bool.  So this would not work correctly if there ever is a  
checksum version larger than 1.  

M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/pg_upgrade.h

pg_upgrade: Remove unused typedef

commit   : c0408743c48fd9d6e34c40c38d8ca826e4a28525    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 Aug 2022 23:45:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 Aug 2022 23:45:38 +0200    

Click here for diff

pgpid_t has been unused in pg_upgrade for a long time.  

M src/bin/pg_upgrade/pg_upgrade.h

doc: add missing role attributes to user management section

commit   : fab54e6c1a3efd12bde22a24ebc2b08f6affcd04    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 15:43:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 15:43:23 -0400    

Click here for diff

Reported-by: Shinya Kato  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Shinya Kato  
  
Backpatch-through: 10  

M doc/src/sgml/user-manag.sgml

doc: add section about heap-only tuples (HOT)

commit   : 115464bb5b4904e7536124eef168b7c17a56d4b4    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 15:05:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 15:05:13 -0400    

Click here for diff

Reported-by: Jonathan S. Katz  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/storage.sgml

doc: warn about security issues around log files

commit   : 50e088d6f262b602d2d983b41696188815ba1e00    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 12:02:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 12:02:21 -0400    

Click here for diff

Reported-by: Simon Riggs  
  
Discussion: https://postgr.es/m/CANP8+jJESuuXYq9Djvf-+tx2vY2OFLmfEuu+UvwHNJ1RT7iJCQ@mail.gmail.com  
  
Author: Simon Riggs  
  
Backpatch-through: 10  

M doc/src/sgml/config.sgml
M doc/src/sgml/maintenance.sgml

doc: clarify configuration file for Windows builds

commit   : 1886060b985135af5088bbd9368c54e39f1327cc    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 11:35:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 11:35:23 -0400    

Click here for diff

The use of file 'config.pl' was not clearly explained.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/install-windows.sgml

doc: document the CREATE INDEX "USING" clause

commit   : 74e28294cdbd422ba735d365d38746d8993411ff    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 11:26:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 11:26:03 -0400    

Click here for diff

Somehow this was in the syntax but had no description.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_index.sgml

doc: clarify CREATE TABLE AS ... IF NOT EXISTS

commit   : 7d66ccee99d57055a2ef42aa14b60ff6bdae5f1c    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 10:59:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 10:59:00 -0400    

Click here for diff

Mention that the table is not modified if it already exists.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_table_as.sgml

doc: improve wal_level docs for the 'minimal' level

commit   : 4d807bbc4b336f7d9e091903ca3a6f9d77b2a934    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 10:30:01 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 10:30:01 -0400    

Click here for diff

Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwZ24UcfkoyLLSW3PMGQATomOcw1nuYFRuMev-NoOF+mYw@mail.gmail.com  
  
Author: David G. Johnston  
  
Backpatch-through: 14, partial to 13  

M doc/src/sgml/config.sgml

doc: clarify DROP EXTENSION dependent members text

commit   : e2a02a30c4028feaeda2bffadbb7441198f8867b    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 09:06:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 09:06:48 -0400    

Click here for diff

Member tracking was added in PG 13.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwY1YtxQHVWUFYvSnOjZ5VPpXjF33V52bSKEwFjK2K=1Aw@mail.gmail.com  
  
Author: David G. Johnston  
  
Backpatch-through: 13  

M doc/src/sgml/ref/drop_extension.sgml

Avoid using a fake relcache entry to own an SmgrRelation.

commit   : 76733b399c490885564a560718de23d98bb5e66d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 12 Aug 2022 08:25:41 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 12 Aug 2022 08:25:41 -0400    

Click here for diff

If an error occurs before we close the fake relcache entry, the the  
fake relcache entry will be destroyed by the SmgrRelation will  
survive until end of transaction. Its smgr_owner pointer ends up  
pointing to already-freed memory.  
  
The original reason for using a fake relcache entry here was to try  
to avoid reusing an SMgrRelation across a relevant invalidation. To  
avoid that problem, just call smgropen() again each time we need a  
reference to it. Hopefully someday we will come up with a more  
elegant approach, but accessing uninitialized memory is bad so let's  
do this for now.  
  
Dilip Kumar, reviewed by Andres Freund and Tom Lane. Report by  
Justin Pryzby.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CAFiTN-vSFeE6_W9z698XNtFROOA_nSqUXWqLcG0emob_kJ+dEQ@mail.gmail.com  

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

MERGE docs adjustments

commit   : 3d895bc846f25859bd6dd242fbf204e6c5166e6f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Aug 2022 13:16:50 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Aug 2022 13:16:50 +0200    

Click here for diff

Per Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/merge.sgml

Reject MERGE in CTEs and COPY

commit   : 92af9143f13df8c54362ebbd4397cb53f207ff2d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Aug 2022 12:05:50 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Aug 2022 12:05:50 +0200    

Click here for diff

The grammar added for MERGE inadvertently made it accepted syntax in  
places that were not prepared to deal with it -- namely COPY and inside  
CTEs, but invoking these things with MERGE currently causes assertion  
failures or weird misbehavior in non-assertion builds.  Protect those  
places by checking for it explicitly until somebody decides to implement  
it.  
  
Reported-by: Alexey Borzov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/parser/parse_cte.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

Fix _outConstraint() for "identity" constraints

commit   : e7a552f303c56788d52ca4e46490236845662734    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 Aug 2022 08:17:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 Aug 2022 08:17:30 +0200    

Click here for diff

The set of fields printed by _outConstraint() in the CONSTR_IDENTITY  
case didn't match the set of fields actually used in that case.  (The  
code was probably uncarefully copied from the CONSTR_DEFAULT case.)  
Fix that by using the right set of fields.  Since there is no read  
support for this node type, this is really just for debugging output  
right now, so it doesn't affect anything important.  

M src/backend/nodes/outfuncs.c

Fix non-specific error message.

commit   : 34dffa0224bd34e0fa27b464f1821c9c43f07703    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Aug 2022 14:12:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Aug 2022 14:12:11 -0400    

Click here for diff

"something has gone wrong" is not helpful. Make this elog()  
consistent with the other one in the same function.  
  
Discussion: http://postgr.es/m/CA+Tgmoa_AZ2jUWSA_noiqOqnxBaWDR+t3bHjSygZi6+wqDBCXQ@mail.gmail.com  

M src/backend/postmaster/auxprocess.c

struct PQWalReceiverFunctions: use designated initializers

commit   : 2c860777656ab34ba0cec8f780ee26e31187dd0c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 11 Aug 2022 12:07:05 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 11 Aug 2022 12:07:05 +0200    

Click here for diff

We now require that compilers support this, and it makes the code easier  
to trace, so change it.  I'm fixated on this particular struct because  
I've had to navigate around it a number of times, but there are others  
elsewhere that could use the same treatment.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Add missing space in _outA_Const() output

commit   : 4e6dcbb6ae77d9f6f20072d19e433cab8329ea9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Aug 2022 10:35:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Aug 2022 10:35:39 +0200    

Click here for diff

Mistake introduced by 639a86e36aaecb84faaf941dcd0b183ba0aba9e9.  

M src/backend/nodes/outfuncs.c

Fix catalog lookup with the wrong snapshot during logical decoding.

commit   : 7f13ac812313666a2fbb8dacfbee67e78d2ba0bc    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 11 Aug 2022 10:09:24 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 11 Aug 2022 10:09:24 +0530    

Click here for diff

Previously, we relied on HEAP2_NEW_CID records and XACT_INVALIDATION  
records to know if the transaction has modified the catalog, and that  
information is not serialized to snapshot. Therefore, after the restart,  
if the logical decoding decodes only the commit record of the transaction  
that has actually modified a catalog, we will miss adding its XID to the  
snapshot. Thus, we will end up looking at catalogs with the wrong  
snapshot.  
  
To fix this problem, this change adds the list of transaction IDs and  
sub-transaction IDs, that have modified catalogs and are running during  
snapshot serialization, to the serialized snapshot. After restart or  
otherwise, when we restore from such a serialized snapshot, the  
corresponding list is restored in memory. Now, when decoding a COMMIT  
record, we check both the list and the ReorderBuffer to see if the  
transaction has modified catalogs.  
  
Since this adds additional information to the serialized snapshot, we  
cannot backpatch it. For back branches, we took another approach.  
We remember the last-running-xacts list of the decoded RUNNING_XACTS  
record after restoring the previously serialized snapshot. Then, we mark  
the transaction as containing catalog changes if it's in the list of  
initial running transactions and its commit record has  
XACT_XINFO_HAS_INVALS. This doesn't require any file format changes but  
the transaction will end up being added to the snapshot even if it has  
only relcache invalidations. But that won't be a problem since we use  
snapshot built during decoding only to read system catalogs.  
  
This commit bumps SNAPBUILD_VERSION because of a change in SnapBuild.  
  
Reported-by: Mike Oh  
Author: Masahiko Sawada  
Reviewed-by: Amit Kapila, Shi yu, Takamichi Osumi, Kyotaro Horiguchi, Bertrand Drouvot, Ahsan Hadi  
Backpatch-through: 10  
Discussion: https://postgr.es/m/81D0D8B0-E7C4-4999-B616-1E5004DBDCD2%40amazon.com  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/catalog_change_snapshot.out
A contrib/test_decoding/specs/catalog_change_snapshot.spec
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/reorderbuffer.h
M src/include/replication/snapbuild.h

Optimize xid/subxid searches in XidInMVCCSnapshot().

commit   : 37a6e5df3713498a21942dae2ed3122bba5b9f50    
  
author   : John Naylor <[email protected]>    
date     : Wed, 3 Aug 2022 09:59:28 -0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 3 Aug 2022 09:59:28 -0700    

Click here for diff

As reported by Yura Sokolov, scanning the snapshot->xip array has  
noticeable impact on scalability when there are a large number of  
concurrent writers. Use the optimized (on x86-64) routine from b6ef16756  
to speed up searches through the [sub]xip arrays. One benchmark showed  
a 5% increase in transaction throughput with 128 concurrent writers,  
and a 50% increase in a pathological case of 1024 writers. While a hash  
table would have scaled even better, it was ultimately rejected because  
of concerns around code complexity and memory allocation. Credit to Andres  
Freund for the idea to optimize linear search using SIMD instructions.  
  
Nathan Bossart  
  
Reviewed by: Andres Freund, John Naylor, Bharath Rupireddy, Masahiko Sawada  
Discussion: https://postgr.es/m/20220713170950.GA3116318%40nathanxps13  

M src/backend/utils/time/snapmgr.c

Move basebackup code to new directory src/backend/backup

commit   : a8c012869763c711abc9085f54b2a100b60a85fa    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 10 Aug 2022 14:03:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 10 Aug 2022 14:03:23 -0400    

Click here for diff

Reviewed by David Steele and Justin Pryzby  
  
Discussion: http://postgr.es/m/CA+TgmoafqboATDSoXHz8VLrSwK_MDhjthK4hEpYjqf9_1Fmczw%40mail.gmail.com  

M contrib/basebackup_to_shell/basebackup_to_shell.c
M src/backend/Makefile
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
A src/backend/backup/Makefile
R098 src/backend/replication/backup_manifest.c src/backend/backup/backup_manifest.c
R099 src/backend/replication/basebackup.c src/backend/backup/basebackup.c
R099 src/backend/replication/basebackup_copy.c src/backend/backup/basebackup_copy.c
R099 src/backend/replication/basebackup_gzip.c src/backend/backup/basebackup_gzip.c
R099 src/backend/replication/basebackup_lz4.c src/backend/backup/basebackup_lz4.c
R098 src/backend/replication/basebackup_progress.c src/backend/backup/basebackup_progress.c
R098 src/backend/replication/basebackup_server.c src/backend/backup/basebackup_server.c
R097 src/backend/replication/basebackup_sink.c src/backend/backup/basebackup_sink.c
R098 src/backend/replication/basebackup_target.c src/backend/backup/basebackup_target.c
R098 src/backend/replication/basebackup_throttle.c src/backend/backup/basebackup_throttle.c
R099 src/backend/replication/basebackup_zstd.c src/backend/backup/basebackup_zstd.c
M src/backend/replication/Makefile
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/pg_basebackup.c
R094 src/include/replication/backup_manifest.h src/include/backup/backup_manifest.h
R096 src/include/replication/basebackup.h src/include/backup/basebackup.h
R099 src/include/replication/basebackup_sink.h src/include/backup/basebackup_sink.h
R096 src/include/replication/basebackup_target.h src/include/backup/basebackup_target.h

Fix handling of R/W expanded datums that are passed to SQL functions.

commit   : 309857f9c1825d0591579579bdde2a8c8bd3e491    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Aug 2022 13:37:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Aug 2022 13:37:25 -0400    

Click here for diff

fmgr_sql must make expanded-datum arguments read-only, because  
it's possible that the function body will pass the argument to  
more than one callee function.  If one of those functions takes  
the datum's R/W property as license to scribble on it, then later  
callees will see an unexpected value, leading to wrong answers.  
  
From a performance standpoint, it'd be nice to skip this in the  
common case that the argument value is passed to only one callee.  
However, detecting that seems fairly hard, and certainly not  
something that I care to attempt in a back-patched bug fix.  
  
Per report from Adam Mackler.  This has been broken since we  
invented expanded datums, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/WScDU5qfoZ7PB2gXwNqwGGgDPmWzz08VdydcPFLhOwUKZcdWbblbo-0Lku-qhuEiZoXJ82jpiQU4hOjOcrevYEDeoAvz6nR0IU4IHhXnaCA=@mackler.email  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/functions.c
M src/test/regress/expected/create_function_sql.out
M src/test/regress/sql/create_function_sql.sql

Fix typo in test_oat_hooks README

commit   : 92dc33a3a229f7d24b8c97b6a18b417d79cf4d97    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 10 Aug 2022 13:49:48 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 10 Aug 2022 13:49:48 +0200    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/README

Improve the protocol message descriptions for 2PC logical replication.

commit   : 0e60a50e0bf158bead247731e00cee95bcf64daf    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 10 Aug 2022 16:41:31 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 10 Aug 2022 16:41:31 +0530    

Click here for diff

The messages were using 'two-phase transaction' at some places and  
'prepared transaction' at other places. Make them consistently use  
'prepared transaction'.  
  
Reported-by: Ekaterina Kiryanova  
Author: Peter Smith  
Reviewed by: Amit Kapila  
Backpatch-through: 15  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml

Remove unused short option from getopt_long() call

commit   : fa351b1b1321fe4b9f5201d8ebb6aa42cff27fad    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Aug 2022 12:02:32 +0300    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Aug 2022 12:02:32 +0300    

Click here for diff

The option was removed in 3ce7f72529 but the letter was left in the  
getopt_long() call.  

M src/bin/pg_basebackup/pg_basebackup.c

Introduce optimized routine for linear searches of arrays

commit   : b6ef167564905e8dab8af1b1dba0997ec61204ca    
  
author   : John Naylor <[email protected]>    
date     : Wed, 3 Aug 2022 09:49:04 -0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 3 Aug 2022 09:49:04 -0700    

Click here for diff

Use SSE2 intrinsics to speed up the search, where available.  Otherwise,  
use a simple 'for' loop.  The motivation to add this now is to speed up  
XidInMVCCSnapshot(), which is the reason only unsigned 32-bit integer  
arrays are optimized. Other types are left for future work, as is the  
extension of this technique to non-x86 platforms.  
  
Nathan Bossart  
  
Reviewed by: Andres Freund, Bharath Rupireddy, Masahiko Sawada  
Discussion: https://postgr.es/m/20220713170950.GA3116318%40nathanxps13  

A src/include/port/pg_lfind.h
M src/test/modules/Makefile
A src/test/modules/test_lfind/.gitignore
A src/test/modules/test_lfind/Makefile
A src/test/modules/test_lfind/expected/test_lfind.out
A src/test/modules/test_lfind/sql/test_lfind.sql
A src/test/modules/test_lfind/test_lfind–1.0.sql
A src/test/modules/test_lfind/test_lfind.c
A src/test/modules/test_lfind/test_lfind.control

doc: mention that COPY MATCH requires columns _in_ _order_

commit   : 356dd2ce5b7b0f3ea11e016f73b1f173604b8452    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 9 Aug 2022 20:37:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 9 Aug 2022 20:37:53 -0400    

Click here for diff

Question asked at SCaLE conference.  
  
Reported-by: doc suggestion by Stephen Frost  
  
Backpatch-through: 15  

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

Fix some inconsistencies with GUC categories

commit   : 0b039e3a8489c08ec61b4d40382047c389af91ad    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 9 Aug 2022 20:01:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 9 Aug 2022 20:01:44 +0900    

Click here for diff

This commit addresses a few things around GUCs:  
- The TCP-related parameters (the four tcp_keepalives_* and  
client_connection_check_interval are listed in postgresql.conf.sample in  
a subsection called "TCP settings" of "CONNECTIONS AND AUTHENTICATION",  
but they did not have their own group name in guc.c.  
- enable_group_by_reordering, stats_fetch_consistency and  
recovery_prefetch had an inconsistent description, missing a dot at the  
end.  
- In postgresql.conf.sample, "Process title" should not have a section  
of its own, but it should be a subsection of "REPORTING AND LOGGING".  
  
This impacts the contents of pg_settings, which could be seen as a  
compatibility break, so no backpatch is done.  This is similar to the  
cleanup done in a55a984.  
  
Author: Shinya Kato  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc_tables.h

Fix mismatched file identifications

commit   : ffbfde4c87725c5342aa0727ed61c5c3c7c0cb39    
  
author   : John Naylor <[email protected]>    
date     : Tue, 9 Aug 2022 09:21:37 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 9 Aug 2022 09:21:37 +0700    

Click here for diff

Masahiko Sawada  
Discussion: https://www.postgresql.org/message-id/CAD21AoASq93KPiNxipPaTCzEdsnxT9665UesOnWcKhmX9Qfx6A@mail.gmail.com  

M src/fe_utils/cancel.c
M src/include/common/compression.h

Fix obsolete comment in commit_ts.c.

commit   : 670475b2fa4bc683edf3d595292ce696496f6b49    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 9 Aug 2022 12:55:45 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 9 Aug 2022 12:55:45 +1200    

Click here for diff

Commit 08aa89b removed COMMIT_TS_SETTS, but left a reference in a  
comment.  
  
Author: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/20220726173343.GA154110%40nathanxps13  

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

Fix obsolete comments in instr_time.h.

commit   : 01126dc8cf2c6e06babf1bbb4dab41a4a96d704f    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 9 Aug 2022 11:50:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 9 Aug 2022 11:50:03 +1200    

Click here for diff

Commit 623cc673 removed gettimeofday(), and commits 24c3ce8f and  
495ed0ef removed support for very old Windows releases with low accuracy  
timers, but references to those things were left behind in comments.  
  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/295419.1659918447%40sss.pgh.pa.us  

M src/include/portability/instr_time.h

Fix MSVC build script's check for obsolete node support functions.

commit   : 9a9f25e217428cdf4119ff08b77f9f5bd45f563c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 14:43:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 14:43:35 -0400    

Click here for diff

Commit 964d01ae9 was a few bricks shy of a load here: the script  
checked whether gen_node_support.pl itself had been updated since it  
was last run, but not whether any of its input files had been updated.  
Fix that.  While here, scrape the list of input files from the  
Makefiles rather than having a duplicate copy, as we do for most  
other lists of source files.  
  
In passing, improve gen_node_support.pl's error report for an  
incorrect file list.  
  
Per gripe from Amit Kapila.  
  
Discussion: https://postgr.es/m/CAA4eK1KQk4vP-3mTAz26h-PRUZaGu8Fc=q-ZKSajsAthH0A15w@mail.gmail.com  

M src/backend/nodes/gen_node_support.pl
M src/tools/msvc/Solution.pm

Stabilize output of new regression test.

commit   : 71cac850d02f2ad46aca00d3852574bd48fb581a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 12:16:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 12:16:01 -0400    

Click here for diff

Per buildfarm, the output order of \dx+ isn't consistent across  
locales.  Apply NO_LOCALE to force C locale.  There might be a  
more localized way, but I'm not seeing it offhand, and anyway  
there is nothing in this test module that particularly cares  
about locales.  
  
Security: CVE-2022-2625  

M src/test/modules/test_extensions/Makefile

In extensions, don't replace objects not belonging to the extension.

commit   : b9b21acc766db54d8c337d508d0fe2f5bf2daab0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 11:12:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 11:12:31 -0400    

Click here for diff

Previously, if an extension script did CREATE OR REPLACE and there was  
an existing object not belonging to the extension, it would overwrite  
the object and adopt it into the extension.  This is problematic, first  
because the overwrite is probably unintentional, and second because we  
didn't change the object's ownership.  Thus a hostile user could create  
an object in advance of an expected CREATE EXTENSION command, and would  
then have ownership rights on an extension object, which could be  
modified for trojan-horse-type attacks.  
  
Hence, forbid CREATE OR REPLACE of an existing object unless it already  
belongs to the extension.  (Note that we've always forbidden replacing  
an object that belongs to some other extension; only the behavior for  
previously-free-standing objects changes here.)  
  
For the same reason, also fail CREATE IF NOT EXISTS when there is  
an existing object that doesn't belong to the extension.  
  
Our thanks to Sven Klemm for reporting this problem.  
  
Security: CVE-2022-2625  

M doc/src/sgml/extend.sgml
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_type.c
M src/backend/commands/createas.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/view.c
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/dependency.h
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext_cine–1.0–1.1.sql
A src/test/modules/test_extensions/test_ext_cine–1.0.sql
A src/test/modules/test_extensions/test_ext_cine.control
A src/test/modules/test_extensions/test_ext_cor–1.0.sql
A src/test/modules/test_extensions/test_ext_cor.control

aix: fix misreading of condition in 8f12a4e7add

commit   : 7e29a79a46d30dc236d097825ab849158929d977    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 11:34:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 11:34:42 -0700    

Click here for diff

This lead to choosing the aix4.1 specific way of building the export file for  
the backend, rather than the modern one.  
  
Per buildfarm member hoverfly.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/Makefile

Trust a few system headers to stand on their own

commit   : a2a36d56b96fe17c4ad9649936dcf7406eb78cc9    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    

Click here for diff

At some point in the past some headers (net/if.h on some BSDs in 2009,  
netinet/tcp.h on IRIX in 2000, sys/ucred.h in 2013 on then older openbsd),  
only compiled if other heades were included first, complicating configure  
tests. More recent tests indicate that that's not required anymore.  
  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

solaris: Remove unnecessary gcc / gnu ld vs sun studio differences

commit   : 20c105c4db56f784eebe39cb50ede8ad1bfa3899    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    

Click here for diff

Unfortunately one with_gnu_ld reference remains, otherwise we could remove the  
configure support for determining with_gnu_ld.  
  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib
M src/makefiles/Makefile.solaris

aix: Remove checks for very old OS versions

commit   : 8f12a4e7addc733deb5a656548fb8013609f50f1    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    

Click here for diff

Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/Makefile
M src/makefiles/Makefile.aix
M src/template/aix

windows: Remove HAVE_MINIDUMP_TYPE test

commit   : 9ddb870bd479c1e9cacc5605b7831a4df90fcbf5    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    

Click here for diff

We've relied on it being present for msvc for ages...  
  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/Makefile.global.in
M src/backend/main/main.c
M src/backend/port/win32/Makefile
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Rely on __func__ being supported

commit   : 320f92b744b44f961e5d56f5f21de003e8027a7f    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Aug 2022 09:36:01 -0700    

Click here for diff

Previously we fell back to __FUNCTION__ and then NULL. As __func__ is in C99  
that shouldn't be necessary anymore.  
  
Solution.pm defined HAVE_FUNCNAME__FUNCTION instead of  
HAVE_FUNCNAME__FUNC (originating in 4164e6636e2), as at some point in the past  
MSVC only supported __FUNCTION__. Our minimum version supports __func__.  
  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.ac
M src/backend/storage/lmgr/s_lock.c
M src/include/c.h
M src/include/pg_config.h.in
M src/include/storage/s_lock.h
M src/include/utils/elog.h
M src/tools/msvc/Solution.pm

Remove unportable use of timezone in recent test

commit   : afe58c8b746cac1e2c3e9f0fc96a0f69a46c84d3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 7 Aug 2022 10:19:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 7 Aug 2022 10:19:40 +0200    

Click here for diff

Per buildfarm member snapper  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/brin/t/02_wal_consistency.pl

Simplify replacement code for strtof.

commit   : cbf4403134738245db48b306c62eb1258f2b2bd0    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 7 Aug 2022 12:42:11 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 7 Aug 2022 12:42:11 +1200    

Click here for diff

strtof() is in C99 and all targeted systems have it.  We can remove the  
configure probe and some dead code, but we still need replacement code  
for a couple of systems that have known buggy implementations selected  
via platform template.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/152683.1659830125%40sss.pgh.pa.us  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port.h
M src/port/strtof.c
M src/tools/msvc/Solution.pm

Simplify gettimeofday for Windows.

commit   : 24c3ce8f1c707f9eeb1f68cebd44c2516ff799c2    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 7 Aug 2022 12:35:11 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 7 Aug 2022 12:35:11 +1200    

Click here for diff

Previously we bothered to forward-declare struct timezone, following man  
pages on typical systems, but POSIX actually says the argument (which we  
ignore anyway) is void *.  Drop a line.  
  
While here, add an assertion that nobody actually uses the tzp argument.  
  
Previously we did extra work to select between Windows APIs needed on  
older releases, but now we can just use the higher resolution function  
directly.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKwRpvGfcfq2qNVAQS2Wg1B9eA9QRhAmVSyJt1zsCN2sQ%40mail.gmail.com  

M src/include/port/win32_port.h
M src/port/win32gettimeofday.c

Fix function-defined-but-not-used warning.

commit   : 5c7121bcf8dbe94344742a5cd0fa0f016b7a76a1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2022 13:32:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2022 13:32:29 -0400    

Click here for diff

Buildfarm member jacana (MinGW) has been complaining that  
get_iso_localename is defined but not used.  This is evidently  
fallout from the recent removal of VS2013 support in pg_locale.c.  
Rearrange the #ifs so that get_iso_localename and its subroutine  
search_locale_enum won't get built on MinGW.  
  
I also noticed that a comment in get_iso_localename cross-  
referenced a comment in IsoLocaleName that isn't there anymore.  
Put back what I think is the referenced material.  

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

Fix data-corruption hazard in WAL-logged CREATE DATABASE.

commit   : 692df425b6883dd3edcc15bb984415ef349fafb1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2022 11:50:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2022 11:50:23 -0400    

Click here for diff

RelationCopyStorageUsingBuffer thought it could skip copying  
empty pages, but of course that does not work at all, because  
subsequent blocks will be out of place.  
  
Also fix it to acquire share lock on the source buffer.  It *might*  
be safe to not do that, but it's not very certain, and I don't think  
this code deserves any benefit of the doubt.  
  
Dilip Kumar, per complaint from me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Simplify gettimeofday() fallback logic.

commit   : 922a8fa098404cbd5c6089e78eca4aebd828f847    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 6 Aug 2022 08:34:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 6 Aug 2022 08:34:56 -0700    

Click here for diff

There's no known supported system needing 1 argument gettimeofday()  
support. The test for it was added a long time ago (92c6bf9775b). Remove.  
  
Until now we tested whether a gettimeofday() fallback is needed when  
targetting windows. Which lead to the odd result that HAVE_GETTIMEOFDAY only  
being defined when targetting MinGW (which has gettimeofday() since at least  
2007). As the fallback is specific to msvc, remove the configure code and  
rename src/port/gettimeofday.c to src/port/win32gettimeofday.c.  
  
While at it, also remove the definition of struct timezone, a forward  
declaration of the struct is sufficient.  
  
Reviewed-By: Tom Lane <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M config/c-library.m4
M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port.h
M src/include/port/win32_port.h
R098 src/port/gettimeofday.c src/port/win32gettimeofday.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Improve recently-added test reliability

commit   : 6c1c9f88ad5484fbef201b6adf59c319ceed764e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 6 Aug 2022 15:52:10 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 6 Aug 2022 15:52:10 +0200    

Click here for diff

Commit 59be1c942a47 already tried to make  
src/test/recovery/t/033_replay_tsp_drops more reliable, but it wasn't  
enough.  Try to improve on that by making this use of a replication slot  
to be more like others.  Also, don't drop the slot.  
  
Make a few other stylistic changes while at it.  It's still quite slow,  
which is another thing that we need to fix in this script.  
  
Backpatch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/033_replay_tsp_drops.pl

Fix comment in copyfrom_internal.h

commit   : 70d25bf70ce2eaed91406f56cd45dcfaa9ecabe0    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 6 Aug 2022 21:13:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 6 Aug 2022 21:13:45 +0900    

Click here for diff

COPY_NEW_FE has become COPY_FRONTEND in 3174d69, that has removed the  
frontend-backend protocol v2.  
  
Author: Zhang Mingli  
Discussion: https://postgr.es/m/aeec12a3-501e-449a-8d25-901c4ff706cf@Spark  

M src/include/commands/copyfrom_internal.h

Replace pgwin32_is_junction() with lstat().

commit   : 5fc88c5d53e43fa7dcea93499d230a0bf70f4f77    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Aug 2022 12:02:43 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Aug 2022 12:02:43 +1200    

Click here for diff

Now that lstat() reports junction points with S_IFLNK/S_ISLINK(), and  
unlink() can unlink them, there is no need for conditional code for  
Windows in a few places.  That was expressed by testing for WIN32 or  
S_ISLNK, which we can now constant-fold.  
  
The coding around pgwin32_is_junction() was a bit suspect anyway, as we  
never checked for errors, and we also know that errors can be spuriously  
reported because of transient sharing violations on this OS.  The  
lstat()-based code has handling for that.  
  
This also reverts 4fc6b6ee on master only.  That was done because  
lstat() didn't previously work for symlinks (junction points), but now  
it does.  
  
Tested-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn-%3DxGRNCvgiUPVVzjFLtnY0w%40mail.gmail.com  

M src/backend/commands/tablespace.c
M src/backend/replication/basebackup.c
M src/backend/storage/file/fd.c
M src/backend/utils/adt/misc.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/file_ops.c
M src/common/file_utils.c
M src/include/port.h
M src/include/port/win32_port.h
M src/port/dirmod.c

commit   : f357233c9db8be2a015163da8e1ab0630f444340    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Aug 2022 12:01:42 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Aug 2022 12:01:42 +1200    

Click here for diff

To support harmonization of Windows and Unix code, teach our unlink()  
wrapper that junction points need to be unlinked with rmdir() on  
Windows.  
  
Tested-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn-%3DxGRNCvgiUPVVzjFLtnY0w%40mail.gmail.com  

M src/port/dirmod.c

Provide lstat() for Windows.

commit   : c5cb8f3b770c043509b61528664bcd805e1777e6    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Aug 2022 12:00:57 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Aug 2022 12:00:57 +1200    

Click here for diff

Junction points will be reported with S_ISLNK(x.st_mode), simulating  
POSIX lstat().  stat() will follow pseudo-symlinks, like in POSIX (but  
only one level before giving up, unlike in POSIX).  
  
This completes a TODO left by commit bed90759fcb.  
  
Tested-by: Andrew Dunstan <[email protected]> (earlier version)  
Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn-%3DxGRNCvgiUPVVzjFLtnY0w%40mail.gmail.com  

M src/include/port/win32_port.h
M src/port/win32stat.c

Remove fallbacks for strtoll, strtoull.

commit   : feb593506b9b57e21052a9a7323e8f23faabdde6    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Aug 2022 09:59:45 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Aug 2022 09:59:45 +1200    

Click here for diff

strtoll was backfilled with either __strtoll or strtoq on systems without  
strtoll. The last such system on the buildfarm was an ancient HP-UX animal. We  
don't support HP-UX anymore, so remove.  
  
On other systems strtoll was present, but did not have a declaration. The last  
known instance on the buildfarm was running an ancient OSX and shut down in  
2019.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/include/c.h
M src/include/pg_config.h.in
M src/interfaces/ecpg/ecpglib/data.c
M src/timezone/private.h
M src/tools/msvc/Solution.pm

Fix comments about deduplication updating page.

commit   : f68faf4c7530e39e626b0aa3e4a36376e122fce7    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 5 Aug 2022 14:25:49 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 5 Aug 2022 14:25:49 -0700    

Click here for diff

nbtree deduplication passes add tuples from the original/target page to  
a temp page, merging as necessary.  The temp page is copied back to the  
target permanent page in the critical section.  This is similar to the  
approach taken by nbtree page splits.  
  
Adjust comments that referred to updating the original page in-place as  
tuples were merged.  These were left over from earlier versions of the  
deduplication patch that didn't yet use a temp page.  

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

Add missing parenthesis to max item size macro.

commit   : b2fe783aecadb42e17868787bb45aa6328796d2a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 5 Aug 2022 13:06:19 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 5 Aug 2022 13:06:19 -0700    

Click here for diff

Oversight in commit 92f37505, per buildfarm.  

M src/backend/access/nbtree/nbtdedup.c
M src/include/access/nbtree.h

Partially undo commit 94da73281.

commit   : 4c81a50e5b6ea0bf2bc9896a6c89d16163598b43    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 15:57:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 15:57:46 -0400    

Click here for diff

On closer inspection, mcv.c isn't as broken for ScalarArrayOpExpr  
as I thought.  The Var-on-right issue is real enough, but actually  
it does cope fine with a NULL array constant --- I was misled by  
an XXX comment suggesting it didn't.  Undo that part of the code  
change, and replace the XXX comment with something less misleading.  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c

Fix handling of bare boolean expressions in mcv_get_match_bitmap.

commit   : e33ae53ddec80c15d297a31713212c05ea7341db    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 15:00:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 15:00:03 -0400    

Click here for diff

Since v14, the extended stats machinery will try to estimate for  
otherwise-unsupported boolean expressions if they match an expression  
available from an extended stats object.  mcv.c did not get the memo  
about this, and would spit up with "unknown clause type".  Fortunately  
the case is easy to handle, since we can expect the expression yields  
boolean.  
  
While here, replace some not-terribly-on-point assertions with  
simpler runtime tests for lookup failure.  That seems appropriate  
so that we get an elog not a crash if we somehow get to the new  
it-should-be-a-bool-expression code with a subexpression that  
doesn't match any stats column.  
  
Per report from Danny Shemesh.  Thanks to Justin Pryzby for  
preliminary investigation.  
  
Discussion: https://postgr.es/m/CAFZC=QqD6=27wQPOW1pbRa98KPyuyn+7cL_Ay_Ck-roZV84vHg@mail.gmail.com  

M src/backend/statistics/mcv.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix non-bulletproof ScalarArrayOpExpr code for extended statistics.

commit   : 94da73281ed93c86d2f286996bcd61d8bfac4ffd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 13:58:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 13:58:37 -0400    

Click here for diff

statext_is_compatible_clause_internal() checked that the arguments  
of a ScalarArrayOpExpr are one Var and one Const, but it would allow  
cases where the Const was on the left.  Subsequent uses of the clause  
are not expecting that and would suffer assertion failures or core  
dumps.  mcv.c also had not bothered to cope with the case of a NULL  
array constant, which seems really unacceptably sloppy of somebody.  
(Although our tools failed us there too, since AFAIK neither Coverity  
nor any compiler warned of the obvious use-of-uninitialized-variable  
condition.)  It seems best to handle that by having  
statext_is_compatible_clause_internal() reject it.  
  
Noted while fixing bug #17570.  Back-patch to v13 where the  
extended stats code grew some awareness of ScalarArrayOpExpr.  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Backpatch addition of .git-blame-ignore-revs

commit   : d7714c1454c36e910b9caab107d5241f6a273521    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 19:36:24 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 19:36:24 +0200    

Click here for diff

This makes it more convenient for git config to contain the  
blame.ignoreRevsFile setting; otherwise current git versions complain if  
the file is not present.  
  
I constructed the file for each branch by scraping the file in branch  
master for commits that appear in that branch.  Because a few additional  
pgindent commits have been added to the list in master since the list  
was first created, this also propagates those to branches 14 and 15  
where the file already existed.  Also, some entries appear to have been  
made using author-date rather than committer-date in the format string,  
so some timestamps are changed.  Also remove bogus whitespace in the  
suggested `git log` format string.  
  
Backpatch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M .git-blame-ignore-revs

Fix incorrect permissions-checking code for extended statistics.

commit   : e5fc38ac303dd2427c0df5902f73a4c6e1fb48e4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 12:46:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 12:46:34 -0400    

Click here for diff

Commit a4d75c86b improved the extended-stats logic to allow extended  
stats to be collected on expressions not just bare Vars.  To apply  
such stats, we first verify that the user has permissions to read all  
columns used in the stats.  (If not, the query will likely fail at  
runtime, but the planner ought not do so.)  That had to get extended  
to check permissions of columns appearing within such expressions,  
but the code for that was completely wrong: it applied pull_varattnos  
to the wrong pointer, leading to "unrecognized node type" failures.  
Furthermore, although you couldn't get to this because of that bug,  
it failed to account for the attnum offset applied by pull_varattnos.  
  
This escaped recognition so far because the code in question is not  
reached when the user has whole-table SELECT privilege (which is the  
common case), and because only subexpressions not specially handled  
by statext_is_compatible_clause_internal() are at risk.  
  
I think a large part of the reason for this bug is under-documentation  
of what statext_is_compatible_clause() is doing and what its arguments  
are, so do some work on the comments to try to improve that.  
  
Per bug #17570 from Alexander Kozhemyakin.  Patch by Richard Guo;  
comments and other cosmetic improvements by me.  (Thanks also to  
Japin Li for diagnosis.)  Back-patch to v14 where the bug came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/extended_stats.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

BRIN: mask BRIN_EVACUATE_PAGE for WAL consistency checking

commit   : e44dae07f931383151e2eb34ed9b4cbf4bf14482    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 18:00:17 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 18:00:17 +0200    

Click here for diff

That bit is unlogged and therefore it's wrong to consider it in WAL page  
comparison.  
  
Add a test that tickles the case, as branch testing technology allows.  
  
This has been a problem ever since wal consistency checking was  
introduced (commit a507b86900f6 for pg10), so backpatch to all supported  
branches.  
  
Author: 王海洋 (Haiyang Wang) <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CACciXAD2UvLMOhc4jX9VvOKt7DtYLr3OYRBhvOZ-jRxtzc_7Jg@mail.gmail.com  
Discussion: https://postgr.es/m/CACciXADOfErX9Bx0nzE_SkdfXr6Bbpo5R=v_B6MUTEYW4ya+cg@mail.gmail.com  

M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_xlog.c
M src/test/modules/brin/Makefile
A src/test/modules/brin/t/02_wal_consistency.pl

Be more prescriptive in new doc about re-archiving of same WAL file.

commit   : d263ced225bffe2c340175125b0270d1869138fe    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 5 Aug 2022 08:30:55 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 5 Aug 2022 08:30:55 -0700    

Click here for diff

Nathan Bossart, reviewed by David Steele.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/backup.sgml

regress: fix test instability

commit   : 90a4b64134ce0cb9a31cdceb49e265e8e2f88b56    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 11:55:52 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 11:55:52 +0200    

Click here for diff

Having additional triggers in a test table made the ORDER BY clauses in  
old queries underspecified.  Add another column there for stability.  
  
Per sporadic buildfarm pink.  

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

Simplify coding style of is_valid_ascii()

commit   : 6b41a1579bd37aa95924d592d7a18a79d669662f    
  
author   : John Naylor <[email protected]>    
date     : Fri, 5 Aug 2022 13:07:31 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 5 Aug 2022 13:07:31 +0700    

Click here for diff

Calculate end of input rather than maintaining length,  
per prior suggestion from Heikki Linnakangas. In passing,  
use more natural language in a comment.  
  
Discussion: https://www.postgresql.org/message-id/b4648cc2-5e9c-c93a-52cc-51e5c658a4f6%40iki.fi  

M src/include/mb/pg_wchar.h

postgres_fdw: Disable batch insertion when there are WCO constraints.

commit   : 82593b9a3d5f1c58157f6e8fd7d69ef0d6f6eeb3    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 5 Aug 2022 17:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 5 Aug 2022 17:15:00 +0900    

Click here for diff

When inserting a view referencing a foreign table that has WITH CHECK  
OPTION constraints, in single-insert mode postgres_fdw retrieves the  
data that was actually inserted on the remote side so that the WITH  
CHECK OPTION constraints are enforced with the data locally, but in  
batch-insert mode it cannot currently retrieve the data (except for the  
row first inserted through the view), resulting in enforcing the WITH  
CHECK OPTION constraints with the data passed from the core (except for  
the first-inserted row), which led to incorrect results when inserting  
into a view referencing a foreign table in which a remote BEFORE ROW  
INSERT trigger changes the rows inserted through the view so that they  
violate the view's WITH CHECK OPTION constraint.  Also, the query  
inserting into the view caused an assertion failure in assert-enabled  
builds.  
  
Fix these by disabling batch insertion when inserting into such a view.  
  
Back-patch to v14 where batch insertion was added.  
  
Discussion: https://postgr.es/m/CAPmGK17LpbTZs4m4a_6THP54UBeK9fHvX8aVVA%2BC6yEZDZwQcg%40mail.gmail.com  

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

Fix ENABLE/DISABLE TRIGGER to handle recursion correctly

commit   : ec0925c22a3da7199650c9903a03a0017705ed5c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 4 Aug 2022 20:02:02 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 4 Aug 2022 20:02:02 +0200    

Click here for diff

Using ATSimpleRecursion() in ATPrepCmd() to do so as bbb927b4db9b did is  
not correct, because ATPrepCmd() can't distinguish between triggers that  
may be cloned and those that may not, so would wrongly try to recurse  
for the latter category of triggers.  
  
So this commit restores the code in EnableDisableTrigger() that  
86f575948c77 had added to do the recursion, which would do it only for  
triggers that may be cloned, that is, row-level triggers.  This also  
changes tablecmds.c such that ATExecCmd() is able to pass the value of  
ONLY flag down to EnableDisableTrigger() using its new 'recurse'  
parameter.  
  
This also fixes what seems like an oversight of 86f575948c77 that the  
recursion to partition triggers would only occur if EnableDisableTrigger()  
had actually changed the trigger.  It is more apt to recurse to inspect  
partition triggers even if the parent's trigger didn't need to be  
changed: only then can we be certain that all descendants share the same  
state afterwards.  
  
Backpatch all the way back to 11, like bbb927b4db9b.  Care is taken not  
to break ABI compatibility (and that no catversion bump is needed.)  
  
Co-authored-by: Amit Langote <[email protected]>  
Reviewed-by: Dmitry Koval <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqG-cZT3XzGAnEgZQLoQbyfJApVwOTQaCaas1mhpf+4V5A@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/include/commands/trigger.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Remove configure probe for fdatasync.

commit   : d2e150831af85fd30742f551a497db6639d91d0b    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 16:10:05 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 16:10:05 +1200    

Click here for diff

fdatasync() is in SUSv2, and all targeted Unix systems have it.  We have  
a replacement function for Windows.  
  
We retain the probe for the function declaration, which allows us to  
supply the mysteriously missing declaration for macOS, and also for  
Windows.  No need to keep a HAVE_FDATASYNC macro around.  
  
Also rename src/port/fdatasync.c to win32fdatasync.c since it's only for  
Windows.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  
Discussion: https://postgr.es/m/CA%2BhUKGJZJVO%3DiX%2Beb-PXi2_XS9ZRqnn_4URh0NUQOwt6-_51xQ%40mail.gmail.com  

M configure
M configure.ac
M src/backend/access/transam/xlog.c
M src/backend/storage/file/fd.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/include/access/xlogdefs.h
M src/include/pg_config.h.in
M src/include/port/freebsd.h
M src/include/port/win32_port.h
R088 src/port/fdatasync.c src/port/win32fdatasync.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Remove configure probe for clock_gettime.

commit   : 623cc67347cc62eb676570c81abe5e1f63ecaa1e    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 15:56:36 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 15:56:36 +1200    

Click here for diff

clock_gettime() is in SUSv2 and all targeted Unix systems have it.  
Remove a chunk of fallback code for old Unix is no longer reachable on  
modern systems, and untested as of the retirement of build farm animal  
prairiedog.  
  
There is no need to retain a HAVE_CLOCK_GETTIME macro here, because it  
is already used in a context with Unix and Windows code paths.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/portability/instr_time.h
M src/tools/msvc/Solution.pm

Fix nbtree maximum item size macro.

commit   : 92f375056c11193c26f1278446e6301f0c18ea22    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 4 Aug 2022 20:55:02 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 4 Aug 2022 20:55:02 -0700    

Click here for diff

Commit dd299df8189, which made heap TID a tiebreaker nbtree index  
column, introduced new rules on page space management to make suffix  
truncation safe for v4+ indexes.  New pivot tuples (generated by suffix  
truncation during leaf page splits) sometimes require dedicated extra  
space at the end of a new leaf page high key/pivot to store a heap TID  
using a special representation (a representation only used in pivot  
tuples).  
  
The definition of "1/3 of a page" was reduced by a single MAXALIGN()  
quantum for v4 indexes to make sure that the final enlarged pivot tuple  
always fit, even with a split point whose firstright tuple happened to  
already be at the "1/3 of a page" limit (limit for non-pivot tuples).  
Internal pages (which only contain pivot tuples) stuck with the original  
"1/3 of a page" definition.  This scheme made it impossible for any page  
split to fail to free enough space for its newitem, which is never okay.  
  
The macro that determines whether non-pivot tuples exceed their "1/3 of  
a leaf page" restriction was structured as if space was needed for all  
three tuples during a leaf page split (the new pivot plus two very large  
adjoining non-pivots that are separated by the split).  This was subtly  
wrong, in that it accidentally relied on implementation details that  
could (at least in theory) change in the future.  
  
To fix, make the macro subtract a single MAXALIGN() quantum, once.  The  
macro evaluates to exactly the same value as before in practice.  But it  
no longer depends on the current layout of nbtree's special area struct.  
  
No backpatch, since this isn't a live bug.  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Robert Haas <[email protected]>  
Diagnosed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA+Tgmoa7UBxivM7f6Ocx_qbq4=ky3uXc+WZNOBcVX+kvJvWOEA@mail.gmail.com  

M src/include/access/nbtree.h

Simplify replacement code for preadv and pwritev.

commit   : a0dc82711221aa220c5246fe788e5ed28924a4ea    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 11:43:14 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 11:43:14 +1200    

Click here for diff

preadv() and pwritev() are not standardized by POSIX, but appeared in  
NetBSD in 1999 and were adopted by at least OpenBSD, FreeBSD,  
DragonFlyBSD, Linux, AIX, illumos and macOS.  We don't use them much  
yet, but an active proposal uses them heavily.  
  
In 15, we had two replacement implementations for other OSes: one based  
on lseek() + -v function if available for true vector I/O, and the other  
based on a loop over p- function.  
  
The former would be an obstacle to hypothetical future multi-threaded  
code sharing file descriptors, while the latter would not, since commit  
cf112c12.  Furthermore, the number of targeted systems that could  
benefit from the former's potential upside has dwindled to just one  
niche OS, since macOS added the functions and we de-supported HP-UX.  
That doesn't seem like a good trade-off.  
  
Therefore, drop the lseek()-based variant, and also the pg_ prefix now  
that the file position portability hazard is gone.  
  
At the time of writing, the only systems in our build farm that lack  
native preadv/pwritev and thus use fallback code are:  
  
 * Solaris (but not illumos)  
 * macOS before release 11.0  
 * Windows  
  
With this commit, the above systems will now use the *same* fallback  
code, the version that loops over pread()/pwrite().  Windows already  
used that (though a later proposal may include true vector I/O for  
Windows), so this decision really only affects Solaris, until it gets  
around to adding these system calls.  
  
Also remove some useless includes while here.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/backend/storage/file/fd.c
M src/include/pg_config.h.in
M src/include/port/pg_iovec.h
M src/port/preadv.c
M src/port/pwritev.c
M src/tools/msvc/Solution.pm

Make consistent a couple of log messages when parsing HBA files

commit   : 718fe0a14add0fadb17d715d7aa24ebcf3fb35c4    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Aug 2022 09:50:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Aug 2022 09:50:27 +0900    

Click here for diff

This commit adjusts two log messages:  
- When a field in pg_ident.conf is not populated, report the line of the  
configuration file in an error context message instead of the main  
entry.  
- When parsing pg_ident.conf and finding an invalid regexp, add some  
information about the line of the configuration file involved within an  
error context message.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M src/backend/libpq/hba.c

Use hba_file/ident_file GUCs rather than pg_hba.conf/pg_ident.conf in logs

commit   : 47ab1ac822cd928bfe43b2c25be102a6a08902f4    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Aug 2022 09:36:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Aug 2022 09:36:42 +0900    

Click here for diff

This is particularly useful when log_min_messages is set to FATAL, so as  
one can know which file was not getting loaded whether hba_file or  
ident_file are set to some non-default values.  If using the default  
values of these GUC parameters, the same reports are generated.  
  
This commit changes the load (startup) and reload (SIGHUP) messages.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M src/backend/postmaster/postmaster.c
M src/backend/utils/init/postinit.c

Fix failure to set correct operator in window run condition

commit   : 53823a06be6f40d88d8e3ba45045ecee1a21fc5e    
  
author   : David Rowley <[email protected]>    
date     : Fri, 5 Aug 2022 10:14:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 5 Aug 2022 10:14:00 +1200    

Click here for diff

This was a simple omission in 9d9c02ccd where the code didn't correctly  
set the operator to use in the run condition OpExpr when the window  
function was both monotonically increasing and decreasing.  
  
Bug discovered by Julien Roze, although he did not report it.  
  
Reported-by: Phil Florent  
Discussion: https://postgr.es/m/PA4P191MB160009A09B9D0624359278CFBA9F9@PA4P191MB1600.EURP191.PROD.OUTLOOK.COM  
Backpatch-through: 15, where 9d9c02ccd was added  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Remove dead pread and pwrite replacement code.

commit   : cf112c122060568aa06efe4e6e6fb9b2dd4f1090    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:42:31 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:42:31 +1200    

Click here for diff

pread() and pwrite() are in SUSv2, and all targeted Unix systems have  
them.  
  
Previously, we defined pg_pread and pg_pwrite to emulate these function  
with lseek() on old Unixen.  The names with a pg_ prefix were a reminder  
of a portability hazard: they might change the current file position.  
That hazard is gone, so we can drop the prefixes.  
  
Since the remaining replacement code is Windows-only, move it into  
src/port/win32p{read,write}.c, and move the declarations into  
src/include/port/win32_port.h.  
  
No need for vestigial HAVE_PREAD, HAVE_PWRITE macros as they were only  
used for declarations in port.h which have now moved into win32_port.h.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Greg Stark <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/basebackup.c
M src/backend/replication/walreceiver.c
M src/backend/storage/file/fd.c
M src/backend/utils/init/miscinit.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/include/access/xlogreader.h
M src/include/pg_config.h.in
M src/include/port.h
M src/include/port/win32_port.h
M src/port/preadv.c
M src/port/pwritev.c
R061 src/port/pread.c src/port/win32pread.c
R059 src/port/pwrite.c src/port/win32pwrite.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Remove dead setenv, unsetenv replacement code.

commit   : 71f5dc6dfb3de50de28ddde53793540c2fa98b1f    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:38:36 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:38:36 +1200    

Click here for diff

setenv() and unsetenv() are in SUSv3 and targeted Unix systems have  
them.  We still need special code for these on Windows, but that doesn't  
require a configure probe.  
  
This marks the first time we require a SUSv3 (POSIX.1-2001) facility  
(rather than SUSv2).  The replacement code removed here was not needed  
on any targeted system or any known non-EOL'd Unix system, and was  
therefore dead and untested.  
  
No need for vestigial HAVE_SETENV and HAVE_UNSETENV macros, because we  
provide a replacement for Windows, and we didn't previously test the  
macros.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Greg Stark <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port.h
D src/port/setenv.c
D src/port/unsetenv.c
M src/tools/msvc/Solution.pm

Remove configure probes for poll and poll.h.

commit   : b79ec732d29fe42e91aeab4da62d446f226b594a    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:37:53 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:37:53 +1200    

Click here for diff

poll() and <poll.h> are in SUSv2 and all targeted Unix systems have  
them.  
  
Retain HAVE_POLL and HAVE_POLL_H macros for readability.  There's an  
error in latch.c that is now unreachable (since we always have one of  
WIN32 or HAVE_POLL defined), but that falls out of a decision to keep  
using defined(HAVE_POLL) instead of !defined(WIN32) to guard the poll()  
code.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port.h
M src/tools/msvc/Solution.pm

Remove configure probe for link.

commit   : 5963c9a154bd5590a7ea48826d9bd72c9324e071    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:36:50 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:36:50 +1200    

Click here for diff

link() is in SUSv2 and all targeted Unix systems have it.  We have  
replacement code for Windows that doesn't require a configure probe.  
Since only Windows needs it, rename src/port/link.c to win32link.c like  
other similar things.  
  
There is no need for a vestigial HAVE_LINK macro, because we expect all  
Unix and, with our replacement function, Windows systems to have it, so  
we didn't have any tests around link() usage.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port.h
R092 src/port/link.c src/port/win32link.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

commit   : 2b1f580ee2ca373d0451d89a40fc8f0a5f55ede9    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:22:56 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:22:56 +1200    

Click here for diff

symlink() and readlink() are in SUSv2 and all targeted Unix systems have  
them.  We have partial emulation on Windows.  Code that raised runtime  
errors on systems without it has been dead for years, so we can remove  
that and also references to such systems in the documentation.  
  
Define HAVE_READLINK and HAVE_SYMLINK macros on Unix.  Our Windows  
replacement functions based on junction points can't be used for  
relative paths or for non-directories, so the macros can be used to  
check for full symlink support.  The places that deal with tablespaces  
can just use symlink functions without checking the macros.  (If they  
did check the macros, they'd need to provide an #else branch with a  
runtime or compile time error, and it'd be dead code.)  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/ref/create_tablespace.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/tablespace.c
M src/backend/replication/basebackup.c
M src/backend/utils/adt/misc.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_rewind/file_ops.c
M src/common/exec.c
M src/include/pg_config.h.in
M src/include/port.h
M src/tools/msvc/Solution.pm

Remove configure probe for setsid.

commit   : adeef67834cc3db14c36430c1421cf4ed8a809d3    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:21:51 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:21:51 +1200    

Click here for diff

setsid() is in SUSv2 and all targeted Unix systems have it.  Retain a  
HAVE_SETSID macro, defined on Unix only.  That's easier to understand  
than !defined(WIN32), for the optional code it governs.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port.h
M src/tools/msvc/Solution.pm

Remove configure probe for shm_open.

commit   : 098f4d813b69b4f88943afa777ae4bba5166f803    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:19:36 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:19:36 +1200    

Click here for diff

shm_open() is in SUSv2 and all targeted Unix systems have it.  
  
We retain a HAVE_SHM_OPEN macro, because it's clearer to readers than  
something like !defined(WIN32).  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port.h
M src/tools/msvc/Solution.pm

commit   : bdb657edd6db1e471437d62f4642674a801ef32c    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:18:34 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:18:34 +1200    

Click here for diff

getrlimit() is in SUSv2 and all targeted systems have it.  
  
Windows doesn't have it.  We could just use #ifndef WIN32, but for a  
little more explanation about why we're making things conditional, let's  
retain the HAVE_GETRLIMIT macro.  It's defined in port.h for Unix systems.  
  
On systems that have it, it's not necessary to test for RLIMIT_CORE,  
RLIMIT_STACK or RLIMIT_NOFILE macros, since SUSv2 requires those and all  
targeted systems have them.  Also remove references to a pre-historic  
alternative spelling of RLIMIT_NOFILE, and coding that seemed to believe  
that Cygwin didn't have it.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/backend/storage/file/fd.c
M src/backend/tcop/postgres.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pgbench/pgbench.c
M src/include/pg_config.h.in
M src/include/port.h
M src/test/regress/pg_regress.c
M src/tools/msvc/Solution.pm

Remove configure probe for dlopen, and refactor.

commit   : ca1e85513e1c92afb80a74935cbbb6f7e4a3ccf9    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:12:45 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Aug 2022 09:12:45 +1200    

Click here for diff

dlopen() is in SUSv2 and all targeted Unix systems have it.  We still  
need replacement functions for Windows, but we don't need a configure  
probe for that.  
  
Since it's no longer needed by other operating systems, rename dlopen.c  
to win32dlopen.c and move the declarations into win32_port.h.  
  
Likewise, the macros RTLD_NOW and RTLD_GLOBAL now only need to be  
defined on Windows, since all targeted Unix systems have 'em.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/backend/utils/fmgr/dfmgr.c
M src/include/pg_config.h.in
M src/include/port.h
M src/include/port/win32_port.h
R093 src/port/dlopen.c src/port/win32dlopen.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Revert recent changes to 002_pg_upgrade.pl.

commit   : 87e22f675fd81ba1d96b0b9a34bbf26d5ec532d5    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Aug 2022 15:17:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Aug 2022 15:17:14 -0400    

Click here for diff

The test is proving to be unreliable in the buildfarm, and we neither  
agree on how best to fix it nor have time to do so before the upcoming  
release. So for now, put things back to the way they were before commit  
d498e052b4b84ae21b3b68d5b3fda6ead65d1d4d.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Fix check_exclusion_or_unique_constraint for UNIQUE NULLS NOT DISTINCT.

commit   : d59383924c580a77a2346d9b1284c8589b3d43e2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 14:16:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 14:16:26 -0400    

Click here for diff

Adjusting this function was overlooked in commit 94aa7cc5f.  The only  
visible symptom (so far) is that INSERT ... ON CONFLICT could go into  
an endless loop when inserting a null that has a conflict.  
  
Richard Guo and Tom Lane, per bug #17558 from Andrew Kesper  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execIndexing.c
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql

Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop.

commit   : 6ad86feecb246f6b9d1f097e2bf777775b7c2434    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 14:10:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 14:10:06 -0400    

Click here for diff

Ordinarily the functions called in this loop ought to have plenty  
of CFIs themselves; but we've now seen a case where no such CFI is  
reached, making the loop uninterruptible.  Even though that's from  
a recently-introduced bug, it seems prudent to install a CFI at  
the loop level in all branches.  
  
Per discussion of bug #17558 from Andrew Kesper (an actual fix for  
that bug will follow).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Add proper regression test for the recent SRFs-in-pathkeys problem.

commit   : cc116479917b7768bef46d0d789093bd6b25f7cd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 11:11:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 11:11:22 -0400    

Click here for diff

Remove the test case added by commit fac1b470a, which never actually  
worked to expose the problem it claimed to test.  Replace it with  
a case that does expose the problem, and also covers the SRF-not-  
at-the-top deficiency repaired in 1aa8dad41.  
  
Richard Guo, with some editorialization by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/incremental_sort.sql
M src/test/regress/sql/select_parallel.sql

Rephrase comments to make them clearer

commit   : f8f20203c2a4352491535f971b51802a8218bcd3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 4 Aug 2022 16:30:06 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 4 Aug 2022 16:30:06 +0200    

Click here for diff

The use of "we" when referring to the active backend might be  
misunderstood, so rephrase to make it clearer who is performing  
the actions discussed in the comment.  
  
Author: Junwang Zhao <[email protected]>  
Reviewed-by: Erikjan Rijkers <[email protected]>  
Reviewed-by: Robert Treat <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAEG8a3LRSMqkvjiURiJoSi4aGWORpiXUmUfQQK5PaD6WfPzu3w@mail.gmail.com  

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

Fix formatting and comment typos

commit   : bcabbfc6a94bb1d59e380f1bcb7cd5da8338cd11    
  
author   : John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 16:41:29 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 16:41:29 +0700    

Click here for diff

Justin Pryzby  
  
Discussion: https://www.postgresql.org/message-id/20220801181136.GJ15006%40telsasoft.com  

M src/backend/commands/dbcommands.c
M src/backend/commands/explain.c
M src/include/replication/reorderbuffer.h

Fix assorted doc typos

commit   : 9f08803828d7dc9691e773f5bec4eed21f5ff520    
  
author   : John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 15:59:32 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 15:59:32 +0700    

Click here for diff

Erik Rijkers and Justin Pryzby  
  
Backpatch to v14  
  
Discussion: https://www.postgresql.org/message-id/b79bfeff-d0e3-29a3-2576-0e325848dede%40xs4all.nl  

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

Clarify DROP EXTENSION docs regarding explicitly dependent routines

commit   : f217d093fd6107731654c43d837bb4fece205d47    
  
author   : John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 15:29:25 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 15:29:25 +0700    

Click here for diff

Per suggestion from Robert Haas  
  
Backpatch to v14  
  
Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZ1QvHquYHLkMy1oHKqz4-E7QQctj6e0ocq_GP1B5%2B9bA%40mail.gmail.com  

M doc/src/sgml/ref/drop_extension.sgml

Fix inconsistent comments for some function declarations in headers

commit   : 245e14e28b298e6ed00ea8d8c607b62387c9da92    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Aug 2022 17:36:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Aug 2022 17:36:21 +0900    

Click here for diff

Some of the headers list a couple of function prototypes located in a  
different file than what is referred to.  This fixes a couple of  
places where this inconsistency exists.  
  
Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4__RdcSNXPa7L62Ozvo_Q4LvT60o3Bnp8yrQ_m9y5CKvg@mail.gmail.com  

M src/include/access/nbtxlog.h
M src/include/replication/walreceiver.h
M src/include/storage/bufmgr.h

Support SSE2 intrinsics where available

commit   : 56f2c7b58bda00ea5ecc56a93467ed9eae6b3db7    
  
author   : John Naylor <[email protected]>    
date     : Wed, 3 Aug 2022 11:07:40 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 3 Aug 2022 11:07:40 +0700    

Click here for diff

SSE2 vector instructions are part of the spec for the 64-bit x86  
architecture. Until now we have relied on the compiler to autovectorize  
in some limited situations, but some useful coding idioms can only be  
expressed explicitly via compiler intrinsics. To this end, add a header  
that defines USE_SSE2 where available. While x86-only for now, we can  
add other architectures in the future. This will also be the intended  
place for helper functions that use vector operations.  
  
Reviewed by Nathan Bossart and Masahiko Sawada  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsE2G_H_5Wbw%2BNOPm70-BK4xxKf86-mRzY%3DL2sLoQqM%2B-Q%40mail.gmail.com  

A src/include/port/simd.h

Fix incorrect tests for SRFs in relation_can_be_sorted_early().

commit   : 1aa8dad41ffad99923a658389ee948e88394491c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2022 17:33:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2022 17:33:42 -0400    

Click here for diff

Commit fac1b470a thought we could check for set-returning functions  
by testing only the top-level node in an expression tree.  This is  
wrong in itself, and to make matters worse it encouraged others  
to make the same mistake, by exporting tlist.c's special-purpose  
IS_SRF_CALL() as a widely-visible macro.  I can't find any evidence  
that anyone's taken the bait, but it was only a matter of time.  
  
Use expression_returns_set() instead, and stuff the IS_SRF_CALL()  
genie back in its bottle, this time with a warning label.  I also  
added a couple of cross-reference comments.  
  
After a fair amount of fooling around, I've despaired of making  
a robust test case that exposes the bug reliably, so no test case  
here.  (Note that the test case added by fac1b470a is itself  
broken, in that it doesn't notice if you remove the code change.  
The repro given by the bug submitter currently doesn't fail either  
in v15 or HEAD, though I suspect that may indicate an unrelated bug.)  
  
Per bug #17564 from Martijn van Oosterhout.  Back-patch to v13,  
as the faulty patch was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/util/tlist.c
M src/include/optimizer/optimizer.h

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

commit   : bc76f5ac483a08fe2a699ce82d31a9a07520d502    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 3 Aug 2022 09:28:27 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 3 Aug 2022 09:28:27 -0700    

Click here for diff

M .git-blame-ignore-revs

Reduce test runtime of src/test/modules/snapshot_too_old.

commit   : 1da0850f0e4e37488e4f871b60cc5fbe5276a76f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2022 11:14:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2022 11:14:55 -0400    

Click here for diff

The sto_using_cursor and sto_using_select tests were coded to exercise  
every permutation of their test steps, but AFAICS there is no value in  
exercising more than one.  This matters because each permutation costs  
about six seconds, thanks to the "pg_sleep(6)".  Perhaps we could  
reduce that, but the useless permutations seem worth getting rid of  
in any case.  (Note that sto_using_hash_index got it right already.)  
  
While here, clean up some other sloppiness such as an unused table.  
  
This doesn't make too much difference in interactive testing, since the  
wasted time is typically masked by parallelization with other tests.  
However, the buildfarm runs this as a serial step, which means we can  
expect to shave ~40 seconds from every buildfarm run.  That makes it  
worth back-patching.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/snapshot_too_old/expected/sto_using_cursor.out
M src/test/modules/snapshot_too_old/expected/sto_using_select.out
M src/test/modules/snapshot_too_old/specs/sto_using_cursor.spec
M src/test/modules/snapshot_too_old/specs/sto_using_select.spec

Add wait_for_subscription_sync for TAP tests.

commit   : 0c20dd33db1607d6a85ffce24238c1e55e384b49    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 3 Aug 2022 15:31:17 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 3 Aug 2022 15:31:17 +0530    

Click here for diff

The TAP tests for logical replication in src/test/subscription are using  
the following code in many places to make sure that the subscription is  
synchronized with the publisher:  
  
  $node_publisher->wait_for_catchup('tap_sub');  
  $node_subscriber->poll_query_until('postgres',  
    qq[SELECT count(1) = 0  
       FROM pg_subscription_rel  
       WHERE srsubstate NOT IN ('r', 's')]);  
  
The new function wait_for_subscription_sync() can be used to replace the  
above code. This eliminates duplicated code and makes it easier to write  
future tests.  
  
Author: Masahiko Sawada  
Reviewed by: Amit Kapila, Shi yu  
Discussion: https://postgr.es/m/CAD21AoC-fvAkaKHa4t1urupwL8xbAcWRePeETvshvy80f6WV1A@mail.gmail.com  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.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/021_twophase.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/100_bugs.pl

Be more wary about 32-bit integer overflow in pg_stat_statements.

commit   : c67c2e2a29392b85ba7c728d3ceed986808eeec3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2022 18:05:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2022 18:05:34 -0400    

Click here for diff

We've heard a couple of reports of people having trouble with  
multi-gigabyte-sized query-texts files.  It occurred to me that on  
32-bit platforms, there could be an issue with integer overflow  
of calculations associated with the total query text size.  
Address that with several changes:  
  
1. Limit pg_stat_statements.max to INT_MAX / 2 not INT_MAX.  
The hashtable code will bound it to that anyway unless "long"  
is 64 bits.  We still need overflow guards on its use, but  
this helps.  
  
2. Add a check to prevent extending the query-texts file to  
more than MaxAllocHugeSize.  If it got that big, qtext_load_file  
would certainly fail, so there's not much point in allowing it.  
Without this, we'd need to consider whether extent, query_offset,  
and related variables shouldn't be off_t not size_t.  
  
3. Adjust the comparisons in need_gc_qtexts() to be done in 64-bit  
arithmetic on all platforms.  It appears possible that under duress  
those multiplications could overflow 32 bits, yielding a false  
conclusion that we need to garbage-collect the texts file, which  
could lead to repeatedly garbage-collecting after every hash table  
insertion.  
  
Per report from Bruno da Silva.  I'm not convinced that these  
issues fully explain his problem; there may be some other bug that's  
contributing to the query-texts file becoming so large in the first  
place.  But it did get that big, so #2 is a reasonable defense,  
and #3 could explain the reported performance difficulties.  
  
(See also commit 8bbe4cbd9, which addressed some related bugs.  
The second Discussion: link is the thread that led up to that.)  
  
This issue is old, and is primarily a problem for old platforms,  
so back-patch.  
  
Discussion: https://postgr.es/m/CAB+Nuk93fL1Q9eLOCotvLP07g7RAv4vbdrkm0cVQohDVMpAb9A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c

Remove unused fields from ExprEvalStep

commit   : 9fc1776dda9f1ba6d36c4e7970218c3391f1bb2c    
  
author   : David Rowley <[email protected]>    
date     : Wed, 3 Aug 2022 09:46:02 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 3 Aug 2022 09:46:02 +1200    

Click here for diff

These were added recently by 1349d2790.  
  
Reported-by: Zhihong Yu  
Discussion: https://postgr.es/m/CALNJ-vTi+YDuAWKp4Z_Dv=mrz=aq81qTg0D7wzc8y7rS_+i_cw@mail.gmail.com  

M src/include/executor/execExpr.h

Change type "char"'s I/O format for non-ASCII characters.

commit   : ec62ce55a813db5c925d89a53b5b22baa509abb6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2022 10:29:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2022 10:29:35 -0400    

Click here for diff

Previously, a byte with the high bit set was just transmitted  
as-is by charin() and charout().  This is problematic if the  
database encoding is multibyte, because the result of charout()  
won't be validly encoded, which breaks various stuff that  
expects all text strings to be validly encoded.  We've  
previously decided to enforce encoding validity rather than try  
to individually harden each place that might have a problem with  
such strings, so it's time to do something about "char".  
  
To fix, represent high-bit-set characters as \ooo (backslash  
and three octal digits), following the ancient "escape" format  
for bytea.  charin() will continue to accept the old way as well,  
though that is only reachable in single-byte encodings.  
  
Add some test cases just so there is coverage for this code.  
We'll otherwise leave this question undocumented as it was before,  
because we don't really want to encourage end-user use of "char".  
  
For the moment, back-patch into v15 so that this change appears  
in 15beta3.  If there's not great pushback we should consider  
absorbing this change into the older branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/char.c
M src/test/regress/expected/char.out
M src/test/regress/expected/char_1.out
M src/test/regress/expected/char_2.out
M src/test/regress/sql/char.sql

Improve performance of ORDER BY / DISTINCT aggregates

commit   : 1349d2790bf48a4de072931c722f39337e72055e    
  
author   : David Rowley <[email protected]>    
date     : Tue, 2 Aug 2022 23:11:45 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 2 Aug 2022 23:11:45 +1200    

Click here for diff

ORDER BY / DISTINCT aggreagtes have, since implemented in Postgres, been  
executed by always performing a sort in nodeAgg.c to sort the tuples in  
the current group into the correct order before calling the transition  
function on the sorted tuples.  This was not great as often there might be  
an index that could have provided pre-sorted input and allowed the  
transition functions to be called as the rows come in, rather than having  
to store them in a tuplestore in order to sort them once all the tuples  
for the group have arrived.  
  
Here we change the planner so it requests a path with a sort order which  
supports the most amount of ORDER BY / DISTINCT aggregate functions and  
add new code to the executor to allow it to support the processing of  
ORDER BY / DISTINCT aggregates where the tuples are already sorted in the  
correct order.  
  
Since there can be many ORDER BY / DISTINCT aggregates in any given query  
level, it's very possible that we can't find an order that suits all of  
these aggregates.  The sort order that the planner chooses is simply the  
one that suits the most aggregate functions.  We take the most strictly  
sorted variation of each order and see how many aggregate functions can  
use that, then we try again with the order of the remaining aggregates to  
see if another order would suit more aggregate functions.  For example:  
  
SELECT agg(a ORDER BY a),agg2(a ORDER BY a,b) ...  
  
would request the sort order to be {a, b} because {a} is a subset of the  
sort order of {a,b}, but;  
  
SELECT agg(a ORDER BY a),agg2(a ORDER BY c) ...  
  
would just pick a plan ordered by {a} (we give precedence to aggregates  
which are earlier in the targetlist).  
  
SELECT agg(a ORDER BY a),agg2(a ORDER BY b),agg3(a ORDER BY b) ...  
  
would choose to order by {b} since two aggregates suit that vs just one  
that requires input ordered by {a}.  
  
Author: David Rowley  
Reviewed-by: Ronan Dunklau, James Coleman, Ranier Vilela, Richard Guo, Tom Lane  
Discussion: https://postgr.es/m/CAApHDvpHzfo92%3DR4W0%2BxVua3BUYCKMckWAmo-2t_KiXN-wYH%3Dw%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeAgg.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepagg.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/include/catalog/catversion.h
M src/include/executor/execExpr.h
M src/include/executor/nodeAgg.h
M src/include/nodes/pathnodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/paths.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/sqljson.out
M src/test/regress/expected/tuplesort.out
M src/test/regress/sql/aggregates.sql

doc: Fix typos in protocol.sgml

commit   : a69959fab2f3633992b5cabec85acecbac6074c8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Aug 2022 19:55:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Aug 2022 19:55:59 +0900    

Click here for diff

Author: Ekaterina Kiryanova  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml

Move common catalog cache access routines to lsyscache.c

commit   : 6b24d3f9cc55d392f3c1b8ff58024d3e3b70d22a    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Aug 2022 10:47:22 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Aug 2022 10:47:22 +0530    

Click here for diff

In passing, move pg_relation_is_publishable next to similar functions.  
  
Suggested-by: Alvaro Herrera  
Author: Amit Kapila  
Reviewed-by: Hou Zhijie  
Discussion: https://postgr.es/m/CAHut+PupQ5UW9A9ut0Yjt21J9tHhx958z5L0k8-9hTYf_NYqxA@mail.gmail.com  

M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_subscription.c
M src/backend/utils/cache/lsyscache.c
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_subscription.h
M src/include/utils/lsyscache.h

Fix comment in pg_db_role_setting.h

commit   : c689baa158bbe76597b4dacd61c415b58b60f4e0    
  
author   : John Naylor <[email protected]>    
date     : Tue, 2 Aug 2022 11:49:37 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 2 Aug 2022 11:49:37 +0700    

Click here for diff

Noted by Japin Li  
  
Discussion: https://www.postgresql.org/message-id/MEYP282MB16691ACEDBC94161CF4BA1CCB69A9%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/include/catalog/pg_db_role_setting.h

Remove duplicated wait for subscription sync from 007_ddl.pl.

commit   : 7bf91ec0f3b4d2abd39de44c2bcdd11e290af9f4    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Aug 2022 09:30:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Aug 2022 09:30:46 +0530    

Click here for diff

An oversight in 8f2e2bbf14.  
  
Author: Masahiko Sawada  
Reviewed by: Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAD21AoC-fvAkaKHa4t1urupwL8xbAcWRePeETvshvy80f6WV1A@mail.gmail.com  

M src/test/subscription/t/007_ddl.pl

Add a regression test for contrib/tcn.

commit   : 418ec32072a6489e909e590247945011ec825059    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2022 19:18:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2022 19:18:37 -0400    

Click here for diff

Just whittling down the list of contrib modules with zero coverage.  
  
Discussion: https://postgr.es/m/[email protected]  

A contrib/tcn/.gitignore
M contrib/tcn/Makefile
A contrib/tcn/expected/tcn.out
A contrib/tcn/specs/tcn.spec

Relax overly strict rules in select_outer_pathkeys_for_merge()

commit   : b592422095655a64d638f541df784b19b8ecf8ad    
  
author   : David Rowley <[email protected]>    
date     : Tue, 2 Aug 2022 11:02:46 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 2 Aug 2022 11:02:46 +1200    

Click here for diff

The select_outer_pathkeys_for_merge function made an attempt to build the  
merge join pathkeys in the same order as query_pathkeys.  This was done as  
it may have led to no sort being required for an ORDER BY or GROUP BY  
clause in the upper planner.  However, this restriction seems overly  
strict as it required that we match the query_pathkeys entirely or we  
don't bother putting the merge join pathkeys in that order.  
  
Here we relax this rule so that we use a prefix of the query_pathkeys  
providing that prefix matches all of the join quals.  This may provide the  
upper planner with partially sorted input which will allow the use of  
incremental sorts instead of full sorts.  
  
Author: David Rowley  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/CAApHDvrtZu0PHVfDPFM4Yx3jNR2Wuwosv+T2zqa7LrhhBr2rRg@mail.gmail.com  

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

Add a regression test for contrib/pg_prewarm.

commit   : 2865b4060a434855f90fda41f1b8f4bca7c55b0e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2022 17:59:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2022 17:59:35 -0400    

Click here for diff

We had a little bit of coverage here thanks to e2f65f425,  
but not enough; notably, autoprewarm wasn't exercised at all.  
  
Dong Wook Lee, with help from Julien Rouhaud and myself  
  
Discussion: https://postgr.es/m/20220629053812.mifmdrch5iuasg2s@home-desktop  

A contrib/pg_prewarm/.gitignore
M contrib/pg_prewarm/Makefile
A contrib/pg_prewarm/t/001_basic.pl

Have ExecFindPartition cache the last found partition

commit   : 3592e0ff98b130c428c1d8091fc61767f7608732    
  
author   : David Rowley <[email protected]>    
date     : Tue, 2 Aug 2022 09:55:27 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 2 Aug 2022 09:55:27 +1200    

Click here for diff

Here we add code which detects when ExecFindPartition() continually finds  
the same partition and add a caching layer to improve partition lookup  
performance for such cases.  
  
Both RANGE and LIST partitioned tables traditionally require a binary  
search for the set of Datums that a partition needs to be found for. This  
binary search is commonly visible in profiles when bulk loading into a  
partitioned table.  Here we aim to reduce the overhead of bulk-loading  
into partitioned tables for cases where many consecutive tuples belong to  
the same partition and make the performance of this operation closer to  
what it is with a traditional non-partitioned table.  
  
When we find the same partition 16 times in a row, the next search will  
result in us simply just checking if the current set of values belongs to  
the last found partition.  For LIST partitioning we record the index into  
the PartitionBoundInfo's datum array.  This allows us to check if the  
current Datum is the same as the Datum that was last looked up.  This  
means if any given LIST partition supports storing multiple different  
Datum values, then the caching only works when we find the same value as  
we did the last time.  For RANGE partitioning we simply check if the given  
Datums are in the same range as the previously found partition.  
  
We store the details of the cached partition in PartitionDesc (i.e.  
relcache) so that the cached values are maintained over multiple  
statements.  
  
No caching is done for HASH partitions.  The majority of the cost in HASH  
partition lookups are in the hashing function(s), which would also have to  
be executed if we were to try to do caching for HASH partitioned tables.  
Since most of the cost is already incurred, we just don't bother.  We also  
don't do any caching for LIST partitions when we continually find the  
values being looked up belong to the DEFAULT partition.  We've no  
corresponding index in the PartitionBoundInfo's datum array for this case.  
We also don't cache when we find the given values match to a LIST  
partitioned table's NULL partition.  This is so cheap that there's no  
point in doing any caching for this.  We also don't cache for a RANGE  
partitioned table's DEFAULT partition.  
  
There have been a number of different patches submitted to improve  
partition lookups. Hou, Zhijie submitted a patch to detect when the value  
belonging to the partition key column(s) were constant and added code to  
cache the partition in that case.  Amit Langote then implemented an idea  
suggested by me to remember the last found partition and start to check if  
the current values work for that partition.  The final patch here was  
written by me and was done by taking many of the ideas I liked from the  
patches in the thread and redesigning other aspects.  
  
Discussion: https://postgr.es/m/OS0PR01MB571649B27E912EA6CC4EEF03942D9%40OS0PR01MB5716.jpnprd01.prod.outlook.com  
Author: Amit Langote, Hou Zhijie, David Rowley  
Reviewed-by: Amit Langote, Hou Zhijie  

M src/backend/executor/execPartition.c
M src/backend/partitioning/partdesc.c
M src/include/partitioning/partdesc.h

Check maximum number of columns in function RTEs, too.

commit   : 83f1793d6096deb419e16cc38201484a6f6e9f48    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2022 12:22:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2022 12:22:35 -0400    

Click here for diff

I thought commit fd96d14d9 had plugged all the holes of this sort,  
but no, function RTEs could produce oversize tuples too, either  
via long coldeflists or just from multiple functions in one RTE.  
(I'm pretty sure the other variants of base RTEs aren't a problem,  
because they ultimately refer to either a table or a sub-SELECT,  
whose widths are enforced elsewhere.  But we explicitly allow join  
RTEs to be overwidth, as long as you don't try to form their  
tuple result.)  
  
Per further discussion of bug #17561.  As before, patch all branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_relation.c

Fix error reporting after ioctl() call with pg_upgrade --clone

commit   : 8b1ec7d2953273501c5cea8185b6358dc7709eb5    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Aug 2022 16:38:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Aug 2022 16:38:23 +0900    

Click here for diff

errno was not reported correctly after attempting to clone a file,  
leading to incorrect error reports.  While scanning through the code, I  
have not noticed any similar mistakes.  
  
Error introduced in 3a769d8.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/bin/pg_upgrade/file.c

ci: remove minor version from freebsd image name

commit   : 2827f108d136de518f8f1aa7b1bbef0588e0a680    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 31 Jul 2022 17:40:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 31 Jul 2022 17:40:42 -0700    

Click here for diff

This way .cirrus.yml does not need to be changed just because freebsd releases  
a new minor version.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, just like the CI support  

M .cirrus.yml

Append -X to direct invocation of psql in new test for BASE_BACKUP

commit   : 7ff358b76a106d3950e798a351c0e97d5b5abfe6    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Aug 2022 09:58:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Aug 2022 09:58:19 +0900    

Click here for diff

Per buildfarm member wrasse, that looks to open a transaction when it  
loads its .psqlrc, causing the test to fail.  
  
Oversight in ad34146.  

M src/test/recovery/t/001_stream_rep.pl

Add more TAP tests with BASE_BACKUP and pg_backup_start/stop

commit   : ad341469b423cda4f0c3c3ed195ca6fa122b0609    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Aug 2022 09:16:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Aug 2022 09:16:11 +0900    

Click here for diff

This commit adds some test coverage for ee79647 (prevent BASE_BACKUP  
from running in the middle of another base backup) and b24b2be  
(BASE_BACKUP cancellation followed by pg_backup_start), caused by the  
interactions of replication and SQL commands in a logical replication  
connection in a WAL sender.  
  
The second test uses a design close to what has been introduced in  
0475a97f, where BASE_BACKUP is throttled to give enough room for a  
cancellation, though this time we rely on psql with multiple -c  
switches to keep a connection around for the second query.  
  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/Ys/[email protected]  

M src/test/recovery/t/001_stream_rep.pl

Remove test_oat_hooks.c's nodetag_to_string().

commit   : 3451a57f77848d69ced234b7989cc0e351383cd2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 16:58:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 16:58:20 -0400    

Click here for diff

In the short time this function has existed, it's already proven to be  
a nontrivial maintenance burden, since it has to be updated whenever a  
node tag is added or removed.  Although in principle we could now  
automate that, I see little justification for having such functionality  
here at all.  The function is only being applied to utility statements,  
for which we already have infrastructure for obtaining string names.  
Moreover, that infrastructure produces already-familiar-to-users names,  
unlike nodetag_to_string().  
  
So, remove this function and use the existing infrastructure instead.  
That saves over a thousand lines of largely-unreachable code.  
  
Back-patch to v15 where this code came in.  Although it seems unlikely  
that v15's nodetag list will change anymore, we might as well keep the  
two branches looking and acting alike; otherwise back-patching any  
test-results changes in this area will be painful.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/test_oat_hooks.c

Add --schema and --exclude-schema options to vacuumdb.

commit   : 7781f4e3e711ace6bcf9b6253a104b180cb78fcf    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 31 Jul 2022 16:41:50 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 31 Jul 2022 16:41:50 -0400    

Click here for diff

These two new options can be used to either process all tables in  
specific schemas or to skip processing all tables in specific  
schemas.  This change also refactors the handling of invalid  
combinations of command-line options to a new helper function.  
  
Author: Gilles Darold  
Reviewed-by: Justin Pryzby, Nathan Bossart and Michael Paquier.  
Discussion: https://postgr.es/m/929fbf3c-24b8-d454-811f-1d5898ab3e91%40migops.com  

M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c

ci: switch to freebsd 13.1

commit   : e1c95e50e99ae8ed9a779c505a289e24a2df195e    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 31 Jul 2022 12:31:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 31 Jul 2022 12:31:36 -0700    

Click here for diff

freebsd 13.0 is out of support, switch to 13.1. It might be a good idea to  
remove the minor version number from the image name, but there's not been a  
response to that so far...  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, just like the CI support  

M .cirrus.yml

Fix trim_array() for zero-dimensional array argument.

commit   : 4ddfbd2a8ea9b41ced0cad1d984c833085f8ce91    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 13:43:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 13:43:17 -0400    

Click here for diff

The code tried to access ARR_DIMS(v)[0] and ARR_LBOUND(v)[0]  
whether or not those values exist.  This made the range check  
on the "n" argument unstable --- it might or might not fail, and  
if it did it would report garbage for the allowed upper limit.  
These bogus accesses would probably annoy Valgrind, and if you  
were very unlucky even lead to SIGSEGV.  
  
Report and fix by Martin Kalcher.  Back-patch to v14 where this  
function was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/arrayfuncs.c
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Make new auto_explain test safe for log_error_verbosity = verbose.

commit   : bfac42ea0284f4608d1c37477db14374f4ac9e87    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 12:29:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 12:29:44 -0400    

Click here for diff

Allow for the possible presence of a SQLSTATE code in the expected  
warning message, similarly to b998196bb and 19408aae7 (although  
here I see no need to allow more than one specific SQLSTATE).  
Per gripe from Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/t/001_auto_explain.pl

Feed ObjectAddress to event triggers for ALTER TABLE ATTACH/DETACH

commit   : 43231423dafc0cedcb52169465589b0d1d3c47d2    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 31 Jul 2022 13:04:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 31 Jul 2022 13:04:43 +0900    

Click here for diff

These flavors of ALTER TABLE were already shaped to report the  
ObjectAddress of the partition attached or detached, but this data was  
not added to what is collected for event triggers.  The tests of  
test_ddl_deparse are updated to show the modification in the data  
reported.  
  
Author: Hou Zhijie  
Reviewed-by: Álvaro Herrera, Amit Kapila, Hayato Kuroda, Michael Paquier  
Discussion: https://postgr.es/m/OS0PR01MB571626984BD099DADF53F38394899@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/commands/tablecmds.c
M src/test/modules/test_ddl_deparse/expected/alter_table.out

Expand tests of test_ddl_deparse/ for ALTER TABLE

commit   : 07ff701dbd53aeb86dd5a09a8b943b3782d4b67f    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 31 Jul 2022 11:48:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 31 Jul 2022 11:48:14 +0900    

Click here for diff

This module is expanded to track the description of the objects changed  
in the subcommands of ALTER TABLE by reworking the function  
get_altertable_subcmdtypes() (now named get_altertable_subcmdinfo) used  
in the event trigger of the test.  It now returns a set of rows made of  
(subcommand type, object description) instead of a text array with only  
the information about the subcommand type.  
  
The tests have been lacking a lot of the subcommands added to  
AlterTableType over the years.  All the missing subcommands are added,  
and the code is now structured so as the addition of a new subcommand  
is detected by removing the default clause used in the switch for the  
subcommand types.  
  
The coverage of the module is increased from roughly 30% to 50%.  More  
could be done but this is already a nice improvement.  
  
Author: Michael Paquier, Hou Zhijie  
Reviewed-by: Álvaro Herrera, Amit Kapila, Hayato Kuroda  
Discussion: https://postgr.es/m/OS0PR01MB571626984BD099DADF53F38394899@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/expected/create_view.out
M src/test/modules/test_ddl_deparse/expected/test_ddl_deparse.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql
M src/test/modules/test_ddl_deparse/sql/test_ddl_deparse.sql
M src/test/modules/test_ddl_deparse/test_ddl_deparse–1.0.sql
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Improve regression test coverage of GiST index building.

commit   : 6a1f082abac9da756d473e16238a906ca5a592dc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 16:22:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 16:22:24 -0400    

Click here for diff

Add a test case that exercises the "buffering build" code path.  
This covers almost all the non-error-case lines in gistbuild.c  
and gistbuildbuffers.c.  
  
Matheus Alcantara, based on earlier work by Pavel Borisov  
  
Discussion: https://postgr.es/m/3z8Fde-IHbW57a7bEZtaf19f4YOCWu67IZoWJoGW18rKD9R16ZHHchf4d7KFI3Yg7-0N4NonFuwKEgh98HjMCZYoVx7KOioPo6Wn2nZRpf4=@pm.me  

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

Add regression test coverage for contrib/pg_buffercache.

commit   : be39d88934331c47c43d8c51500305e928f06240    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 15:33:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 15:33:44 -0400    

Click here for diff

We can't check the output of this view very closely without  
creating portability headaches, but we can make sure that  
the number of rows is as-expected.  In any case, this is  
sufficient to exercise all the C code within, which is a  
lot better than the 0% coverage we had before.  
  
DongWook Lee  
  
Discussion: https://postgr.es/m/CAAcByaLCHGJB7qAENEcx9D09UL=w4ma+yijwF_-1MSqQZ9wK6Q@mail.gmail.com  

A contrib/pg_buffercache/.gitignore
M contrib/pg_buffercache/Makefile
A contrib/pg_buffercache/expected/pg_buffercache.out
A contrib/pg_buffercache/sql/pg_buffercache.sql

Fix incorrect is-this-the-topmost-join tests in parallel planning.

commit   : d8e34fa7a18fab4aa8eb010edac133d63ecc11c6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 13:05:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 13:05:15 -0400    

Click here for diff

Two callers of generate_useful_gather_paths were testing the wrong  
thing when deciding whether to call that function: they checked for  
being at the top of the current join subproblem, rather than being at  
the actual top join.  This'd result in failing to construct parallel  
paths for a sub-join for which they might be useful.  
  
While set_rel_pathlist() isn't actively broken, it seems best to  
make its identical-in-intention test for this be like the other two.  
  
This has been wrong all along, but given the lack of field complaints  
I'm hesitant to back-patch into stable branches; we usually prefer  
to avoid non-bug-fix changes in plan choices in minor releases.  
It seems not too late for v15 though.  
  
Richard Guo, reviewed by Antonin Houska and Tom Lane  
  
Discussion: https://postgr.es/m/CAMbWs4-mH8Zf87-w+3P2J=nJB+5OyicO28ia9q_9o=Lamf_VHg@mail.gmail.com  

M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c

Adjust new pg_read_file() test cases for more portability.

commit   : d10fad96c664a503a4203fc4b5acd4e816b0158a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 11:17:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 11:17:07 -0400    

Click here for diff

It's allowed for an installation to remove postgresql.auto.conf,  
so don't rely on that being present.  Instead probe whether we can  
read postmaster.pid.  (If you've removed that, you broke the data  
directory's multiple-postmaster interlock, not to mention pg_ctl.)  
Per gripe from Michael Paquier.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revise test case added in 43746996399541ecb5c7b188725a5f097c15ceae.

commit   : 212bdc0cbc32ae5041bf1cd609f7b7a0c8930fc3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 23:24:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 23:24:39 -0400    

Click here for diff

Instead of using command_ok() to run psql, use safe_psql(). wrasse  
isn't happy, and it be because of failure to pass -X to the psql  
invocation, which safe_psql() will do automatically.  
  
Since safe_psql() returns standard output instead of writing it to  
a file, this requires some changes to the incantation for running  
'diff'.  
  
Test against the 'regression' database rather than 'postgres' so  
we test more than just one table. That also means we need to record  
the horizons later, after the test does "VACUUM FULL pg_largeobject".  
  
Add an ORDER BY clause to the horizon query for stability.  
  
Patch by me, reviewed by Tom Lane.  
  
Discussion: http://postgr.es/m/CA+TgmoaGBbpzgu3=du1f9zDUbkfycO0y=_uWrLFy=KKEqXWeLQ@mail.gmail.com  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Fix new recovery test for log_error_verbosity=verbose case

commit   : b998196bb59af02e985cfc93e1704773b5690fbf    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 29 Jul 2022 17:43:34 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 29 Jul 2022 17:43:34 -0400    

Click here for diff

The new test is from commit 9e4f914b5e.  
  
With this setting messages have SQL error numbers included, so that  
needs to be provided for in the pattern looked for.  

M src/test/recovery/t/033_replay_tsp_drops.pl

Fix brown paper bag bug in bbe08b8869bd29d587f24ef18eb45c7d4d14afca.

commit   : 43746996399541ecb5c7b188725a5f097c15ceae    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 16:31:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 16:31:57 -0400    

Click here for diff

We must issue the TRUNCATE command first and update relfrozenxid  
and relminmxid afterward; otherwise, TRUNCATE overwrites the  
previously-set values.  
  
Add a test case like I should have done the first time.  
  
Per buildfarm report from TestUpgradeXversion.pm, by way of Tom  
Lane.  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Support pg_read_[binary_]file (filename, missing_ok).

commit   : 283129e325b721a5a62227f20d7e3d149b379c73    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2022 15:38:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2022 15:38:49 -0400    

Click here for diff

There wasn't an especially nice way to read all of a file while  
passing missing_ok = true.  Add an additional overloaded variant  
to support that use-case.  
  
While here, refactor the C code to avoid a rats-nest of PG_NARGS  
checks, instead handling the argument collection in the outer  
wrapper functions.  It's a bit longer this way, but far more  
straightforward.  
  
(Upon looking at the code coverage report for genfile.c, I was  
impelled to also add a test case for pg_stat_file() -- tgl)  
  
Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_functions.sql
M src/backend/utils/adt/genfile.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

In transformRowExpr(), check for too many columns in the row.

commit   : fd96d14d950f2b1d19b5cb3b8e5a7d4d2b3fa161    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2022 13:30:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2022 13:30:50 -0400    

Click here for diff

A RowExpr with more than MaxTupleAttributeNumber columns would fail at  
execution anyway, since we cannot form a tuple datum with more than that  
many columns.  While heap_form_tuple() has a check for too many columns,  
it emerges that there are some intermediate bits of code that don't  
check and can be driven to failure with sufficiently many columns.  
Checking this at parse time seems like the most appropriate place to  
install a defense, since we already check SELECT list length there.  
  
While at it, make the SELECT-list-length error use the same errcode  
(TOO_MANY_COLUMNS) as heap_form_tuple does, rather than the generic  
PROGRAM_LIMIT_EXCEEDED.  
  
Per bug #17561 from Egor Chindyaskin.  The given test case crashes  
in all supported branches (and probably a lot further back),  
so patch all.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c

Fix mistake in bbe08b8869bd29d587f24ef18eb45c7d4d14afca.

commit   : 80d690721973f6a031143a24a34b78a0225101a2    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 11:20:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 11:20:07 -0400    

Click here for diff

The earlier commit used pg_class.relfilenode where it should have  
used pg_class.oid. This could lead to emitting an UPDATE statement  
into the dump that would update nothing (or the wrong thing) when  
executed in the new cluster, resulting in relfrozenxid and  
relminmxid being improperly carried forward for pg_largeobject.  
  
Noticed by Dilip Kumar.  
  
Discussion: http://postgr.es/m/CAFiTN-ty1Gzs6stk2vt9BJiq0m0hzf=aPnh3a-4Z3Tk5GzoENw@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c

Fix test instability

commit   : 59be1c942a47f6c8a4c47d242200fbbf4be59b88    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jul 2022 12:50:47 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jul 2022 12:50:47 +0200    

Click here for diff

On FreeBSD, the new test fails due to a WAL file being removed before  
the standby has had the chance to copy it.  Fix by adding a replication  
slot to prevent the removal until after the standby has connected.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reported-by: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/CAEze2Wj5nau_qpjbwihvmXLfkAWOZ5TKdbnqOc6nKSiRJEoPyQ@mail.gmail.com  

M src/test/recovery/t/033_replay_tsp_drops.pl

commit   : 0234ed81e958b2b6b21f231547e851c09c8f1744    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 29 Jul 2022 14:27:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 29 Jul 2022 14:27:40 +0530    

Click here for diff

This also improves comments atop is_publishable_class().  
  
Author: Peter Smith  
Reviewed-by: Amit Kapila, Hou Zhijie  
Discussion: https://postgr.es/m/CAHut+PupQ5UW9A9ut0Yjt21J9tHhx958z5L0k8-9hTYf_NYqxA@mail.gmail.com  

M src/backend/catalog/pg_publication.c

Use TRUNCATE to preserve relfilenode for pg_largeobject + index.

commit   : bbe08b8869bd29d587f24ef18eb45c7d4d14afca    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Jul 2022 16:03:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Jul 2022 16:03:42 -0400    

Click here for diff

Commit 9a974cbcba005256a19991203583a94b4f9a21a9 arranged to preserve  
the relfilenode of user tables across pg_upgrade, but failed to notice  
that pg_upgrade treats pg_largeobject as a user table and thus it needs  
the same treatment. Otherwise, large objects will appear to vanish  
after a  pg_upgrade.  
  
Commit d498e052b4b84ae21b3b68d5b3fda6ead65d1d4d fixed this problem  
by teaching pg_dump to UPDATE pg_class.relfilenode for pg_largeobject  
and its index. However, because an UPDATE on the catalog rows doesn't  
change anything on disk, this can leave stray files behind in the new  
cluster. They will normally be empty, but it's a little bit untidy.  
  
Hence, this commit arranges to do the same thing using DDL. Specifically,  
it makes TRUNCATE work for the pg_largeobject catalog when in  
binary-upgrade mode, and it then uses that command in binary-upgrade  
dumps as a way of setting pg_class.relfilenode for pg_largeobject and  
its index. That way, the old files are removed from the new cluster.  
  
Discussion: http://postgr.es/m/CA+TgmoYYMXGUJO5GZk1-MByJGu_bB8CbOL6GJQC8=Bzt6x6vDg@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/storage/smgr/md.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c

Improve speed of hash index build.

commit   : e09d7a1262c659578065eaf7edafe606d2c8ebf2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2022 14:34:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Jul 2022 14:34:32 -0400    

Click here for diff

In the initial data sort, if the bucket numbers are the same then  
next sort on the hash value.  Because index pages are kept in  
hash value order, this gains a little speed by allowing the  
eventual tuple insertions to be done sequentially, avoiding repeated  
data movement within PageAddItem.  This seems to be good for overall  
speedup of 5%-9%, depending on the incoming data.  
  
Simon Riggs, reviewed by Amit Kapila  
  
Discussion: https://postgr.es/m/CANbhV-FG-1ZNMBuwhUF7AxxJz3u5137dYL-o6hchK1V_dMw86g@mail.gmail.com  

M src/backend/access/hash/hashsort.c
M src/backend/utils/sort/tuplesortvariants.c

doc: avoid saying "inheritance" ...

commit   : 70a437aa45b6dcacc2ad894f95ef5bb46b26035f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jul 2022 18:21:56 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jul 2022 18:21:56 +0200    

Click here for diff

... when it applies to partitioned relations.  This is almost the  
opposite of 0c06534bd63b, which removed references to "partition" in  
favour of "child".  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/system-views.sgml

Clean up some residual confusion between OIDs and RelFileNumbers.

commit   : 851f4cc75cdd8c831f1baa9a7abf8c8248b65890    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Jul 2022 10:08:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Jul 2022 10:08:10 -0400    

Click here for diff

Commit b0a55e43299c4ea2a9a8c757f9c26352407d0ccc missed a few places  
where we are referring to the number used as a part of the relation  
filename as an "OID". We now want to call that a "RelFileNumber".  
  
Some of these places actually made it sound like the OID in question  
is pg_class.oid rather than pg_class.relfilenode, which is especially  
good to clean up.  
  
Dilip Kumar with some editing by me.  

M src/backend/commands/dbcommands.c
M src/backend/replication/basebackup.c
M src/backend/storage/file/reinit.c
M src/include/storage/reinit.h

Fix replay of create database records on standby

commit   : 9e4f914b5eba3f49ab99bdecdc4f96fac099571f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jul 2022 08:40:06 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jul 2022 08:40:06 +0200    

Click here for diff

Crash recovery on standby may encounter missing directories  
when replaying database-creation WAL records.  Prior to this  
patch, the standby would fail to recover in such a case;  
however, the directories could be legitimately missing.  
Consider the following sequence of commands:  
  
    CREATE DATABASE  
    DROP DATABASE  
    DROP TABLESPACE  
  
If, after replaying the last WAL record and removing the  
tablespace directory, the standby crashes and has to replay the  
create database record again, crash recovery must be able to continue.  
  
A fix for this problem was already attempted in 49d9cfc68bf4, but it  
was reverted because of design issues.  This new version is based  
on Robert Haas' proposal: any missing tablespaces are created  
during recovery before reaching consistency.  Tablespaces  
are created as real directories, and should be deleted  
by later replay.  CheckRecoveryConsistency ensures  
they have disappeared.  
  
The problems detected by this new code are reported as PANIC,  
except when allow_in_place_tablespaces is set to ON, in which  
case they are WARNING.  Apart from making tests possible, this  
gives users an escape hatch in case things don't go as planned.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Author: Asim R Praveen <[email protected]>  
Author: Paul Guo <[email protected]>  
Reviewed-by: Anastasia Lubennikova <[email protected]> (older versions)  
Reviewed-by: Fujii Masao <[email protected]> (older versions)  
Reviewed-by: Michaël Paquier <[email protected]>  
Diagnosed-by: Paul Guo <[email protected]>  
Discussion: https://postgr.es/m/CAEET0ZGx9AvioViLf7nbR_8tH9-=27DN5xWJ2P9-ROH16e4JUA@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
A src/test/recovery/t/033_replay_tsp_drops.pl

Fix comment in procarray.c.

commit   : d396606ebe9722baceabb156551169d83c85b8c8    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 28 Jul 2022 14:56:20 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 28 Jul 2022 14:56:20 +0900    

Click here for diff

Commit fea10a6434 renamed VariableCacheData.nextFullXid to nextXid.  
But commit dc7420c2c9 introduced the comment mentioning nextFullXid.  
This commit changes"nextFullXid" to "nextXid" in the comment.  
  
Author: Zhang Mingli  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/procarray.c

commit   : 4fc6b6eefcf98f79211bb790ee890ebcb05c178d    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 28 Jul 2022 14:13:37 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 28 Jul 2022 14:13:37 +1200    

Click here for diff

On Windows with MSVC, get_dirent_type() was recently made to return  
DT_LNK for junction points by commit 9d3444dc, which fixed some  
defective dirent.c code.  
  
On Windows with Cygwin, get_dirent_type() already worked for symlinks,  
as it does on POSIX systems, because Cygwin has its own fake symlinks  
that behave like POSIX (on closer inspection, Cygwin's dirent has the  
BSD d_type extension but it's probably always DT_UNKNOWN, so we fall  
back to lstat(), which understands Cygwin symlinks with S_ISLNK()).  
  
On Windows with MinGW/MSYS, we need extra code, because the MinGW  
runtime has its own readdir() without d_type, and the lstat()-based  
fallback has no knowledge of our convention for treating junctions as  
symlinks.  
  
Back-patch to 14, where get_dirent_type() landed.  
  
Reported-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/b9ddf605-6b36-f90d-7c30-7b3e95c46276%40dunslane.net  

M src/common/file_utils.c

Fix new auto_explain test case for Windows.

commit   : 5253519b27d3393c07eb04470f04462c67ad94a9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Jul 2022 18:58:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Jul 2022 18:58:20 -0400    

Click here for diff

In commit 7c34555f8, I overlooked the need to configure SSPI  
on Windows to allow login as the non-superuser role.  
Fix that by adding auth_extra/--create-role incantation  
(which, oddly enough, doesn't actually create the role).  
Per buildfarm.  
  
While here, upgrade the mechanism for temporarily setting  
$ENV{PGUSER}, as per recommendation from ilmari.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/t/001_auto_explain.pl

Bump catversion for commit d8cd0c6c95c0120168df93aae095df4e0682a08a.

commit   : 5f858dd3bebd1f3845aef2bff7f4345bfb7b74b3    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Jul 2022 16:18:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Jul 2022 16:18:21 -0400    

Click here for diff

The catalog contents haven't changed, but it's good to make clear  
that initdb is required. Changing RELMAPPER_FILEMAGIC would be more  
appropriate, but that doesn't actually produce a useful diagnostic,  
so cheat by doing this instead.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h

Convert macros to static inline functions (buf_internals.h)

commit   : 3ac88fddd92cc3fd8475a2f5f33837dc18d2057b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Jul 2022 13:54:37 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Jul 2022 13:54:37 -0400    

Click here for diff

Dilip Kumar, reviewed by Vignesh C, Ashutosh Sharma, and me.  
  
Discussion: http://postgr.es/m/CAFiTN-tYbM7D+2UGiNc2kAFMSQTa5FTeYvmg-Vj2HvPdVw2Gvg@mail.gmail.com  

M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h

Add missing PGDLLEXPORT markings in contrib/pg_prewarm.

commit   : 03361a368e7bf909283cc7721af004317fdabd3d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Jul 2022 12:00:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Jul 2022 12:00:10 -0400    

Click here for diff

After commit 089480c07, it's necessary for background worker entry  
points to be marked PGDLLEXPORT, else they aren't findable by  
LookupBackgroundWorkerFunction().  Since pg_prewarm lacks any  
regression tests, it's not surprising its worker entry points were  
overlooked.  (A quick search turned up no other such oversights.)  
  
I added some documentation pointing out the need for this, too.  
  
Robins Tharakan and Tom Lane  
  
CAEP4nAzndnQv3-1QKb=D-hLoK3Rko12HHMFHHtdj2GQAUXO3gw@mail.gmail.com  

M contrib/pg_prewarm/autoprewarm.c
M doc/src/sgml/bgworker.sgml

Fix read_relmap_file() concurrency on Windows.

commit   : a2e97cb2b6fb64c3ca3198f5c5f31190bc14c703    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 27 Jul 2022 11:12:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 27 Jul 2022 11:12:15 -0400    

Click here for diff

Commit d8cd0c6c95c0120168df93aae095df4e0682a08a introduced a file  
rename that could fail on Windows, probably due to other backends  
having an open file handle to the old file of the same name.  
Re-arrange the locking slightly to prevent that, by making sure the  
open() and close() run while we hold the lock.  
  
Thomas Munro. I added an explanatory comment.  
  
Discussion: https://postgr.es/m/CA%2BhUKGLZtCTgp4NTWV-wGbR2Nyag71%3DEfYTKjDKnk%2BfkhuFMHw%40mail.gmail.com  

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

Refactor code in charge of grabbing the relations of a subscription

commit   : ce3049b0215b63744d11c0ce3ac6afdb67fc2ff0    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 27 Jul 2022 19:50:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 27 Jul 2022 19:50:06 +0900    

Click here for diff

GetSubscriptionRelations() and GetSubscriptionNotReadyRelations() share  
mostly the same code, which scans pg_subscription_rel and fetches all  
the relations of a given subscription.  The only difference is that the  
second routine looks for all the relations not in a ready state.  This  
commit refactors the code to use a single routine, shaving a bit of  
code.  
  
Author: Vignesh C  
Reviewed-By: Kyotaro Horiguchi, Amit Kapila, Michael Paquier, Peter  
Smith  
Discussion: https://postgr.es/m/CALDaNm0eW-9g4G_EzHebnFT5zZoasWCS_EzZQ5BgnLZny9S=pg@mail.gmail.com  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/include/catalog/pg_subscription_rel.h

Split tuplesortvariants.c from tuplesort.c

commit   : d0b193c0fad13cf35122b0d3dc805c76e323e8bf    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:28:26 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:28:26 +0300    

Click here for diff

This commit puts the implementation of Tuple sort variants into the separate  
file tuplesortvariants.c.  That gives better separation of the code and  
serves well as the demonstration that Tuple sort variant can be defined outside  
of tuplesort.c.  
  
Discussion: https://postgr.es/m/CAPpHfdvjix0Ahx-H3Jp1M2R%2B_74P-zKnGGygx4OWr%3DbUQ8BNdw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Pavel Borisov, Maxim Orlov, Matthias van de Meent  
Reviewed-by: Andres Freund, John Naylor  

M src/backend/utils/sort/Makefile
M src/backend/utils/sort/tuplesort.c
A src/backend/utils/sort/tuplesortvariants.c
M src/include/utils/tuplesort.h

Split TuplesortPublic from Tuplesortstate

commit   : ec92fe98356a8a36427fe9ef52873b50fe17852e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:28:10 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:28:10 +0300    

Click here for diff

The new TuplesortPublic data structure contains the definition of  
sort-variant-specific interface methods and the part of Tuple sort operation  
state required by their implementations.  This will let define Tuple sort  
variants without knowledge of Tuplesortstate, that is without knowledge  
of generic sort implementation guts.  
  
Discussion: https://postgr.es/m/CAPpHfdvjix0Ahx-H3Jp1M2R%2B_74P-zKnGGygx4OWr%3DbUQ8BNdw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Pavel Borisov, Maxim Orlov, Matthias van de Meent  
Reviewed-by: Andres Freund, John Naylor  

M src/backend/utils/sort/tuplesort.c
M src/tools/pgindent/typedefs.list

Move memory management away from writetup() and tuplesort_put*()

commit   : 097366c45f5dfe142eb232dc6d348ca0705a63a9    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:27:58 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:27:58 +0300    

Click here for diff

This commit puts some generic work away from sort-variant-specific function.  
In particular, tuplesort_put*() now doesn't need to decrease available memory  
and switch to sort context before calling puttuple_common().  writetup()  
doesn't need to free SortTuple.tuple and increase available memory.  
  
Discussion: https://postgr.es/m/CAPpHfdvjix0Ahx-H3Jp1M2R%2B_74P-zKnGGygx4OWr%3DbUQ8BNdw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Pavel Borisov, Maxim Orlov, Matthias van de Meent  
Reviewed-by: Andres Freund, John Naylor  

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

Put abbreviation logic into puttuple_common()

commit   : 033dd02db2248ed792332b950431ced4771b8304    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:27:46 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:27:46 +0300    

Click here for diff

Abbreviation code is very similar along tuplesort_put*() functions.  This  
commit unifies that code and puts it into puttuple_common().  tuplesort_put*()  
functions differs in the abbreviation condition, so it has been added as an  
argument to the puttuple_common() function.  
  
Discussion: https://postgr.es/m/CAPpHfdvjix0Ahx-H3Jp1M2R%2B_74P-zKnGGygx4OWr%3DbUQ8BNdw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Pavel Borisov, Maxim Orlov, Matthias van de Meent  
Reviewed-by: Andres Freund, John Naylor  

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

Add new Tuplesortstate.removeabbrev function

commit   : cadfdd1edff103d696bbfcdd126c2dee516aed9b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:27:29 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:27:29 +0300    

Click here for diff

This commit is the preparation to move abbreviation logic into  
puttuple_common().  The new removeabbrev function turns datum1 representation  
of SortTuple's from the abbreviated key to the first column value.  Therefore,  
it encapsulates the differential part of abbreviation handling code in  
tuplesort_put*() functions, making these functions similar.  
  
Discussion: https://postgr.es/m/CAPpHfdvjix0Ahx-H3Jp1M2R%2B_74P-zKnGGygx4OWr%3DbUQ8BNdw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Pavel Borisov, Maxim Orlov, Matthias van de Meent  
Reviewed-by: Andres Freund, John Naylor  

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

Remove Tuplesortstate.copytup function

commit   : d47da3162b4d77c888c895dd36e4ef9cb92fcf19    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:26:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 27 Jul 2022 08:26:53 +0300    

Click here for diff

It's currently unclear how do we split functionality between  
Tuplesortstate.copytup() function and tuplesort_put*() functions.  
For instance, copytup_index() and copytup_datum() return error while  
tuplesort_putindextuplevalues() and tuplesort_putdatum() do their work.  
This commit removes Tuplesortstate.copytup() altogether, putting the  
corresponding code into tuplesort_put*().  
  
Discussion: https://postgr.es/m/CAPpHfdvjix0Ahx-H3Jp1M2R%2B_74P-zKnGGygx4OWr%3DbUQ8BNdw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Pavel Borisov, Maxim Orlov, Matthias van de Meent  
Reviewed-by: Andres Freund, John Naylor  

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

commit   : ffd1b6bb6f8a2ffc929699772610c6925364dbb3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 27 Jul 2022 13:35:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 27 Jul 2022 13:35:40 +0900    

Click here for diff

XLogRecordBlockHeader, the header holding the information for the data  
related to a block, tracks the length of the data appended to the WAL  
record with data_length (uint16).  This limitation in size was not  
enforced by the public routine in charge of registering the data  
assembled later to form the WAL record inserted, XLogRegisterBufData().  
Incorrectly used, it could lead to the generation of records with some  
of its data overflowed.  This commit adds some safeguards to prevent  
that for the block data, complaining immediately if attempting to add to  
a record block information with a size larger than UINT16_MAX, which is  
the limit implied by the internal logic.  
  
Note that this also adjusts XLogRegisterData() and XLogRegisterBufData()  
so as the length of the WAL record data given by the caller is unsigned,  
matching with what gets stored in XLogRecData->len.  
  
Extracted from a larger patch by the same author.  The original patch  
includes more protections when assembling a record in full that will be  
looked at separately later.  
  
Author: Matthias van de Meent  
Reviewed-by: Andres Freund, Heikki Linnakangas, Michael Paquier, David  
Zhang  
Discussion: https://postgr.es/m/CAEze2WgGiw+LZt+vHf8tWqB_6VxeLsMeoAuod0N=ij1q17n5pw@mail.gmail.com  

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

Improve makeArrayTypeName's algorithm for choosing array type names.

commit   : 70988b7b0a0bd03c59a2314d0b5bcf2135692349    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2022 15:38:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2022 15:38:05 -0400    

Click here for diff

As before, we start by prepending one underscore (truncating the  
base name if necessary).  But if there is a conflict, then instead of  
prepending more and more underscores, append an underscore and some  
digits, in much the same way that ChooseRelationName does.  While  
the previous logic could be driven to fail by creating a lot of  
types with long names differing only near the end, this version seems  
certain enough to eventually succeed that we can remove the failure  
code path that was there before.  
  
While at it, undo 6df7a9698's decision to split this code out of  
makeArrayTypeName.  That wasn't actually accomplishing anything,  
because no other function was using it --- and it would have been  
wrong to do so.  The convention that a prefix "_" means an array,  
not something else, is too ancient to mess with.  
  
Andrey Lepikhov and Dmitry Koval, reviewed by Masahiko Sawada and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_type.c
M src/test/regress/expected/alter_table.out

Fix brain fade in e530be2c5ce77475d56ccf8f4e0c4872b666ad5f.

commit   : 8bb3ad462f8d53b67d2c4707e9dde6604a276bd9    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2022 15:10:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2022 15:10:25 -0400    

Click here for diff

The BoolGetDatum() call ended up in the wrong place. It should be  
applied when we, err, want to convert a bool to a datum.  
  
Thanks to Tom Lane for noticing this.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/commands/user.c

Remove the restriction that the relmap must be 512 bytes.

commit   : d8cd0c6c95c0120168df93aae095df4e0682a08a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2022 14:56:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2022 14:56:25 -0400    

Click here for diff

Instead of relying on the ability to atomically overwrite the  
entire relmap file in one shot, write a new one and durably  
rename it into place. Removing the struct padding and the  
calculation showing why the map is exactly 512 bytes, and change  
the maximum number of entries to a nearby round number.  
  
Patch by me, reviewed by Andres Freund and Dilip Kumar.  
  
Discussion: http://postgr.es/m/CA+TgmoZq5%3DLWDK7kHaUbmWXxcaTuw_QwafgG9dr-BaPym_U8WQ%40mail.gmail.com  
Discussion: http://postgr.es/m/CAFiTN-ttOXLX75k_WzRo9ar=VvxFhrHi+rJxns997F+yvkm==A@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/activity/wait_event.c
M src/backend/utils/cache/relmapper.c
M src/include/utils/wait_event.h

Do not allow removal of superuser privileges from bootstrap user.

commit   : e530be2c5ce77475d56ccf8f4e0c4872b666ad5f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2022 14:10:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Jul 2022 14:10:38 -0400    

Click here for diff

A bootstrap user who is not a superuser will still own many  
important system objects, such as the pg_catalog schema, that  
will likely allow that user to regain superuser status. Therefore,  
allowing the superuser property to be removed from the superuser  
creates a false perception of security where none exists.  
  
Although removing superuser from the bootstrap user is also a bad idea  
and should be considered unsupported in all released versions, no  
back-patch, as this is a behavior change.  
  
Discussion: http://postgr.es/m/CA+TgmoZirCwArJms_fgvLBFrC6b=HdxmG7iAhv+kt_=NBA7tEw@mail.gmail.com  

M src/backend/commands/user.c

Force immediate commit after CREATE DATABASE etc in extended protocol.

commit   : f92944137cdec3e80e826879d817a2d3dff68b5f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2022 13:07:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2022 13:07:03 -0400    

Click here for diff

We have a few commands that "can't run in a transaction block",  
meaning that if they complete their processing but then we fail  
to COMMIT, we'll be left with inconsistent on-disk state.  
However, the existing defenses for this are only watertight for  
simple query protocol.  In extended protocol, we didn't commit  
until receiving a Sync message.  Since the client is allowed to  
issue another command instead of Sync, we're in trouble if that  
command fails or is an explicit ROLLBACK.  In any case, sitting  
in an inconsistent state while waiting for a client message  
that might not come seems pretty risky.  
  
This case wasn't reachable via libpq before we introduced pipeline  
mode, but it's always been an intended aspect of extended query  
protocol, and likely there are other clients that could reach it  
before.  
  
To fix, set a flag in PreventInTransactionBlock that tells  
exec_execute_message to force an immediate commit.  This seems  
to be the approach that does least damage to existing working  
cases while still preventing the undesirable outcomes.  
  
While here, add some documentation to protocol.sgml that explicitly  
says how to use pipelining.  That's latent in the existing docs if  
you know what to look for, but it's better to spell it out; and it  
provides a place to document this new behavior.  
  
Per bug #17434 from Yugo Nagata.  It's been wrong for ages,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/access/transam/xact.c
M src/backend/tcop/postgres.c
M src/include/access/xact.h

doc: Add note about re-archiving of same WAL files in docs.

commit   : 3cabe45a819f8a2a282d9d57e45f259c84e97c3f    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 26 Jul 2022 16:02:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 26 Jul 2022 16:02:43 +0900    

Click here for diff

The server may attempt to re-archive a WAL file that was previously archived.  
This commit adds the note about how an archive library should handle such  
a re-archiving.  
  
Author: Nathan Bossart  
Reviewed-by: David Steele, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CA+TgmoaeTe4oUT39A4nt=8LD6UJ5u0vcmGc5+Aksn-4oKRb8-w@mail.gmail.com  

M doc/src/sgml/backup.sgml

Reduce overhead of renaming archive status files.

commit   : 756e221db610f333649385f7fef96e7e9e23ed71    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 26 Jul 2022 16:00:18 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 26 Jul 2022 16:00:18 +0900    

Click here for diff

Presently, archive status files are durably renamed from .ready to  
.done to indicate that a file has been archived.  Persisting this  
rename to disk accounts for a significant amount of the overhead  
associated with archiving.  While durably renaming the file  
prevents re-archiving in most cases, archive commands and libraries  
must already gracefully handle attempts to re-archive the last  
archived file after a crash (e.g., a crash immediately after  
archive_command exits but before the server renames the status  
file).  
  
This change reduces the amount of overhead associated with  
archiving by using rename() instead of durable_rename() to rename  
the archive status files.  As a consequence, the server is more  
likely to attempt to re-archive files after a crash, but as noted  
above, archive commands and modules are already expected to handle  
this.  It is also possible that the server will attempt to re-  
archive files that have been removed or recycled, but the archiver  
already handles this, too.  
  
Author: Nathan Bossart  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/20220222011948.GA3850532@nathanxps13  

M src/backend/postmaster/pgarch.c

Fix path reference when parsing pg_ident.conf for pg_ident_file_mappings

commit   : 27e0ee57f68d27af68967759a2ff61a581f501dc    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Jul 2022 15:57:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Jul 2022 15:57:31 +0900    

Click here for diff

Since a2c8499, HbaFileName (default pg_hba.conf) was getting used  
instead of IdentFileName (default pg_ident.conf) as the parent file to  
use as reference when parsing the contents of pg_ident.conf, with  
pg_ident.conf correctly opened, when feeding this information to  
pg_ident_file_mappings.  This had two consequences:  
- On an I/O error when reading pg_ident.conf, the user would get an  
ERROR message referring to pg_hba.conf and not pg_ident.conf.  
- When reading an external file with a relative path using '@' in  
pg_ident.conf, the directory used to look at the file to load would be  
the base directory of pg_hba.conf rather than the one of pg_ident.conf,  
leading to errors in pg_ident_file_mappings inconsistent with what gets  
loaded at startup when pg_ident.conf and pg_hba.conf are located in  
different directories.  
  
This error only impacted the SQL view pg_ident_file_mappings that uses a  
logic new to v15 to fill the view with the parsed information, not the  
code paths loading these authentication files at startup.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20220726050402.vsr6fmz7rsgpmdz3@jrouhaud  
Backpatch-through: 15  

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

Eliminate duplicate code in table.c.

commit   : 857dd353480d98f920099ee0b73da178c197c13d    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 26 Jul 2022 08:22:53 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 26 Jul 2022 08:22:53 +0530    

Click here for diff

Additionally improve the error message similar to how it was done in  
2ed532ee8c.  
  
Author: Junwang Zhao, Aleksander Alekseev  
Reviewed-by: Amit Kapila, Alvaro Herrera, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CAEG8a3KbVtBm_BYf5tGsKHvmMieQVsq_jBPOg75VViQB7ACL8Q%40mail.gmail.com  

M src/backend/access/table/table.c
M src/test/regress/expected/tid.out

Fix a few issues with REINDEX grammar

commit   : 0a5f06b84de76939cf9805e4266d47c2e8bf66df    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Jul 2022 10:16:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Jul 2022 10:16:26 +0900    

Click here for diff

This addresses a couple of bugs in the REINDEX grammar, introduced by  
83011ce:  
- A name was never specified for DATABASE/SYSTEM, even if the query  
included one.  This caused such REINDEX queries to always work with any  
object name, but we should complain if the object name specified does  
not match the name of the database we are connected to.  A test is added  
for this case in the main regression test suite, provided by Álvaro.  
- REINDEX SYSTEM CONCURRENTLY [name] was getting rejected in the  
parser.  Concurrent rebuilds are not supported for catalogs but the  
error provided at execution time is more helpful for the user, and  
allowing this flavor results in a simplification of the parsing logic.  
- REINDEX DATABASE CONCURRENTLY was rebuilding the index in a  
non-concurrent way, as the option was not being appended correctly in  
the list of DefElems in ReindexStmt (REINDEX (CONCURRENTLY) DATABASE was  
working fine.  A test is added in the TAP tests of reindexdb for this  
case, where we already have a REINDEX DATABASE CONCURRENTLY query  
running on a small-ish instance.  This relies on the work done in  
2cbc3c1 for SYSTEM, but here we check if the OIDs of the index relations  
match or not after the concurrent rebuild.  Note that in order to get  
this part to work, I had to tweak the tests so as the index OID and  
names are saved separately.  This change not affect the reliability or  
of the coverage of the existing tests.  
  
While on it, I have implemented a tweak in the grammar to reduce the  
parsing by one branch, simplifying things even more.  
  
Author: Michael Paquier, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/reindex.sgml
M src/backend/parser/gram.y
M src/bin/scripts/t/090_reindexdb.pl
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Add test for session_preload_libraries and parameter permissions checks.

commit   : 7c34555f8c39eeefcc45b3c3f027d7a063d738fc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Jul 2022 15:45:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Jul 2022 15:45:24 -0400    

Click here for diff

We weren't exercising the session_preload_libraries option in any  
meaningful way.  auto_explain is a good testbed for doing so, since  
it's one of the primary use-cases for session_preload_libraries.  
Hence, adjust its TAP test to load the library via  
session_preload_libraries not shared_preload_libraries.  While at it,  
feed test-specific settings to the backend via PGOPTIONS rather than  
tediously rewriting postgresql.conf.  
  
Also, since auto_explain has some PGC_SUSET parameters, we can use it  
to provide a test case for the permissions-checking bug just fixed  
by commit b35617de3.  
  
Back-patch to v15 so that we have coverage for the permissions issue  
in that branch too.  To do that, I back-patched the refactoring  
recently done by commit 550bc0a6c.  
  
Dagfinn Ilmari Mannsåker and Tom Lane  
  
Discussion: https://postgr.es/m/CABwTF4VEpwTHhRQ+q5MiC5ucngN-whN-PdcKeufX7eLSoAfbZA@mail.gmail.com  

M contrib/auto_explain/t/001_auto_explain.pl

Add xheader_width pset option to psql

commit   : a45388d6e0984abb02074f0300cd9c5cbda13848    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 25 Jul 2022 14:24:50 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 25 Jul 2022 14:24:50 -0400    

Click here for diff

The setting controls tha maximum length of the header line in expanded  
format output. Possible settings are full, column, page, or an integer.  
the default is full, the current behaviour, and in this case the header  
line is the length of the widest line of output. column causes the  
header to be truncated to the width of the first column, page causes it  
to be truncated to the width of the terminal page, and an integer causes  
it to be truncated to that value. If the full value is less than the  
page or integer value no truncation occurs. If given without an argument  
this option prints its current setting.  
  
Platon Pronko, somewhat modified by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/tab-complete.c
M src/fe_utils/print.c
M src/include/fe_utils/print.h
M src/test/regress/expected/psql.out
M src/tools/pgindent/typedefs.list

Process session_preload_libraries within InitPostgres's transaction.

commit   : b35617de37870756bdb0e00ffc0a42441e56eefa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Jul 2022 10:27:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Jul 2022 10:27:43 -0400    

Click here for diff

Previously we did this after InitPostgres, at a somewhat randomly chosen  
place within PostgresMain.  However, since commit a0ffa885e doing this  
outside a transaction can cause a crash, if we need to check permissions  
while replacing a placeholder GUC.  (Besides which, a preloaded library  
could itself want to do database access within _PG_init.)  
  
To avoid needing an additional transaction start/end in every session,  
move the process_session_preload_libraries call to within InitPostgres's  
transaction.  That requires teaching the code not to call it when  
InitPostgres is called from somewhere other than PostgresMain, since  
we don't want session_preload_libraries to affect background workers.  
The most future-proof solution here seems to be to add an additional  
flag parameter to InitPostgres; fortunately, we're not yet very worried  
about API stability for v15.  
  
Doing this also exposed the fact that we're currently honoring  
session_preload_libraries in walsenders, even those not connected to  
any database.  This seems, at minimum, a POLA violation: walsenders  
are not interactive sessions.  Let's stop doing that.  
  
(All these comments also apply to local_preload_libraries, of course.)  
  
Per report from Gurjeet Singh (thanks also to Nathan Bossart and Kyotaro  
Horiguchi for review).  Backpatch to v15 where a0ffa885e came in.  
  
Discussion: https://postgr.es/m/CABwTF4VEpwTHhRQ+q5MiC5ucngN-whN-PdcKeufX7eLSoAfbZA@mail.gmail.com  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h

Fix ReadRecentBuffer for local buffers.

commit   : 7a08f78aea95a7046816fe6a711e83615ccdb737    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Jul 2022 08:48:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Jul 2022 08:48:38 +0300    

Click here for diff

It incorrectly used GetBufferDescriptor instead of  
GetLocalBufferDescriptor, causing it to not find the correct buffer in  
most cases, and performing an out-of-bounds memory read in the corner  
case that temp_buffers > shared_buffers.  
  
It also bumped the usage-count on the buffer, even if it was  
previously pinned. That won't lead to crashes or incorrect results,  
but it's different from what the shared-buffer case does, and  
different from the usual code in LocalBufferAlloc. Fix that too, and  
make the code ordering match LocalBufferAlloc() more closely, so that  
it's easier to verify that it's doing the same thing.  
  
Currently, ReadRecentBuffer() is only used with non-temp relations, in  
WAL redo, so the broken code is currently dead code. However, it could  
be used by extensions.  
  
Backpatch-through: 14  
Discussion: https://www.postgresql.org/message-id/2d74b46f-27c9-fb31-7f99-327a87184cc0%40iki.fi  
Reviewed-by: Thomas Munro, Zhang Mingli, Richard Guo  

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

Remove useless arguments in ReadCheckpointRecord().

commit   : 2387f52962e615eac937ed47de724e4d55ffffb7    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 20 Jul 2022 23:06:44 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 20 Jul 2022 23:06:44 +0900    

Click here for diff

This commit removes two arguments "report" and "whichChkpt"  
in ReadCheckpointRecord().  
  
"report" is obviously useless because it's always true, i.e., there are  
two callers of the function and they always specify true as "report".  
Commit 1d919de5eb removed the only call with "report" = false.  
  
"whichChkpt" indicated where the specified checkpoint location  
came from, pg_control or backup_label. This information was used  
to report different error messages depending on where the invalid  
checkpoint record came from, when it was found.  
But ReadCheckpointRecord() doesn't need to do that because  
its callers already do that and users can still identify where  
the invalid checkpoint record came from, by reading such log messages.  
Also when "whichChkpt" was 0, the word "primary checkpoint" was used  
in the log message and could confuse users because the concept of  
primary and secondary checkpoints was already removed before.  
These are why this commit removes "whichChkpt" argument.  
  
Author: Fujii Masao  
Reviewed-by: Bharath Rupireddy, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: improve documentation about random().

commit   : 6955bba0ede45e9379d04d7faaa889448919aa07    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 19:00:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 19:00:29 -0400    

Click here for diff

We didn't explicitly say that random() uses a randomly-chosen seed  
if you haven't called setseed().  Do so.  
  
Also, remove ref/set.sgml's no-longer-accurate (and never very  
relevant) statement that the seed value is multiplied by 2^31-1.  
  
Back-patch to v12 where set.sgml's claim stopped being true.  
The claim that we use a source of random bits as seed was debatable  
before 4203842a1, too, so v12 seems like a good place to stop.  
  
Per question from Carl Sopchak.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/set.sgml

Remove dead getpwuid_r replacement code.

commit   : e757cdd6ad1bc757df7a73616bde8d7e1cb2828a    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 24 Jul 2022 09:44:29 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 24 Jul 2022 09:44:29 +1200    

Click here for diff

getpwuid_r is in SUSv2 and all targeted Unix systems have it.  We don't  
use it for Windows.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Greg Stark <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/port/thread.c
M src/tools/msvc/Solution.pm

Remove dead handling for pre-POSIX sigwait().

commit   : fb12becdfb89e35f3f56768cefe1a837f0afafaf    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 24 Jul 2022 09:32:34 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 24 Jul 2022 09:32:34 +1200    

Click here for diff

sigwait() is in SUSv2 and all targeted Unix systems have it.  An earlier  
pre-standard function prototype existed on some older systems, but we  
no longer need a workaround for that.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Greg Stark <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/bin/psql/command.c
M src/bin/psql/startup.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Remove dead getrusage replacement code.

commit   : 86e5eb4f58a276870fbd29e3711b36e4a4280979    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 24 Jul 2022 09:21:57 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 24 Jul 2022 09:21:57 +1200    

Click here for diff

getrusage() is in SUSv2 and all targeted Unix systems have it.  
  
Note that POSIX only covers ru_utime and ru_stime and we rely on many  
more fields without any kind of configure probe, but that predates this  
commit.  
  
The only supported system we need replacement code for now is Windows,  
and that can be done without a configure probe.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Greg Stark <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com  

M configure
M configure.ac
M src/backend/tcop/postgres.c
M src/include/pg_config.h.in
M src/include/rusagestub.h
M src/port/getrusage.c
M src/tools/msvc/Solution.pm

Doc: update recovery/README.

commit   : b431dc5c3d7207ffb56b6045eb04265a53f63a03    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 16:10:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 16:10:14 -0400    

Click here for diff

Commit e2f65f425 added contrib/pg_prewarm to the prerequisites for  
running the src/test/recovery suite, but did not bother to update  
the documentation about that.  

M src/test/recovery/README

Increase minimum supported GNU make version to 3.81.

commit   : 8efefa748777baf6a61a0e5ec3858a2b90fd8e84    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 12:12:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 12:12:42 -0400    

Click here for diff

We've long held the minimum at 3.80, but that's required more than  
one workaround.  Commit 0f39b70a6 broke it again, because it turns  
out that exporting a target-specific variable didn't work in 3.80.  
Considering that 3.81 is now old enough to get a driver's license,  
and that the only remaining buildfarm member testing 3.80 (prairiedog)  
is likely to be retired soon, let's just stop supporting 3.80.  
  
Adjust docs and Makefile.global's minimum-version check to match.  
There are a couple of comments in the Makefiles suggesting that  
random things could be done differently after we desupport 3.80,  
but I couldn't get excited about changing any of them right now.  
  
Back-patch to v15, as 0f39b70a6 was.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml
M src/Makefile.global.in

Remove configure probe for wctype.h.

commit   : 634a89c7082538e9521a97e5e92126090b68645c    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 23 Jul 2022 16:54:00 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 23 Jul 2022 16:54:00 +1200    

Click here for diff

This header is present in SUSv2 and Windows.  
  
Also remove the inclusion of <wchar.h>, following clues that it was only  
included for the benefit of historical systems that didn't have  
<wctype.h>.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKAmTgbg_hMiGG5T7pkpzOnY1cWFAHYtZXHCpqeC_hCkA%40mail.gmail.com  

M configure
M configure.ac
M src/backend/utils/adt/formatting.c
M src/include/pg_config.h.in
M src/include/regex/regcustom.h
M src/include/tsearch/ts_locale.h
M src/tools/msvc/Solution.pm

Remove configure probe for sys/tas.h.

commit   : a3b8d2a997ab6e8d982495753013c440b32929ba    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 23 Jul 2022 14:44:31 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 23 Jul 2022 14:44:31 +1200    

Click here for diff

The last reference to HAVE_SYS_TAS_H disappeared with commit 718aa43a.  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Fix [install]check in interfaces/libpq/Makefile

commit   : 0f39b70a6f3664036d527fb04ba709d363072a2e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 20:15:11 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 20:15:11 +0200    

Click here for diff

The common recipe when TAP tests are disabled doesn't work, because the  
libpq-specific recipe wants to define the PATH environment variable, so  
the starting '@' is misinterpreted as part of the command instead of  
silencing said command.  
  
Fix by setting the environment variable in a way that doesn't interfere  
with the recipe.  
  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile

Rework grammar for REINDEX

commit   : 83011ce7d7f42b744a93d2b0819597d0aa94e9cc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 19:23:39 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 19:23:39 +0200    

Click here for diff

The part of grammar have grown needlessly duplicative and more complex  
that necessary.  Rewrite.  
  
Reviewed-by: Michaël Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/reindex.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Close old gap in dependency checks for functions returning composite.

commit   : 0b292bed9211e5c85b7b102690f526c3a6600c2e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2022 12:46:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2022 12:46:42 -0400    

Click here for diff

The dependency logic failed to register a column-level dependency  
when a view or rule contains a reference to a specific column of  
the result of a function-returning-composite.  That meant you could  
drop the column from the composite type, causing trouble for future  
executions of the view.  We've known about this for years, but never  
summoned the energy to actually fix it, instead installing various  
low-level defenses to prevent crashing on references to dropped columns.  
We had to do that to plug the hole in stable branches, where there might  
be pre-existing broken references; but let's fix the root cause today.  
  
To do that, add some logic (borrowed from get_rte_attribute_is_dropped)  
to find_expr_references_walker, to check whether a Var referencing an  
RTE_FUNCTION RTE is referencing a column of a composite type, and if  
so add the proper dependency.  
  
However ... it seems mighty unwise to remove said low-level defenses,  
since there could be other bugs now or in the future that allow  
reaching them.  By the same token, letting those defenses go untested  
seems unwise.  Hence, rather than just dropping the associated test  
cases, hack them to continue working by the expedient of manually  
dropping the pg_depend entries that this fix installs.  
  
Back-patch into v15.  I don't want to risk changing this behavior  
in stable branches, but it seems not too late for v15.  (Since  
we have already forced initdb for beta3, we can be sure that all  
production v15 installations will have these added dependencies.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_view.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/rangefuncs.sql

Fix minor memory leaks in psql's tab completion.

commit   : 90474c16a7d24991586aa97c78b880fe9c072aba    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2022 10:53:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2022 10:53:26 -0400    

Click here for diff

Tang Haiying and Tom Lane  
  
Discussion: https://postgr.es/m/OS0PR01MB6113EA19F05E217C823B4CCAFB909@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/bin/psql/tab-complete.c
M src/fe_utils/string_utils.c

parser: centralize common auxiliary productions

commit   : 7d158e8cb44b602ab76a3660b9f5f5c5c5992a1f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 12:57:01 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 12:57:01 +0200    

Click here for diff

Things like "opt_name" can well be shared by various commands rather  
than there being multiple definitions of the same thing.  Rename these  
productions and move them to appear together in gram.y, which may  
improve chances of reuse in the future.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/gram.y

Update src/backend/parser/README

commit   : 9853bf6ab0e3d869d04a3a22959a3c41bf01f0e0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 12:53:12 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 12:53:12 +0200    

Click here for diff

New files have been added to this directory, but not listed here.  
Repair.  

M src/backend/parser/README

Remove unnecessary Windows-specific basebackup code.

commit   : 5344723755bdbb13d5271ccea181166327c63e97    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 17:37:39 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 17:37:39 +1200    

Click here for diff

Commit c6f2f016 added an explicit check for a Windows "junction point".  
That turned out to be needed only because get_dirent_type() was busted  
on Windows.  It's been fixed by commit 9d3444dc, so remove it.  
  
Add a TAP-test to demonstrate that in-place tablespaces are copied by  
pg_basebackup.  This exercises the codepath that would fail before  
c6f2f016 on Windows, and shows that it still doesn't fail now that we're  
using get_dirent_type() on both Windows and Unix.  
  
Back-patch to 15, where in-place tablespaces arrived and caused this  
problem (ie directories where previously only symlinks were expected).  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLzLK4PUPx0_AwXEWXOYAejU%3D7XpxnYE55Y%2Be7hB2N3FA%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Fix get_dirent_type() for Windows junction points.

commit   : 9d3444dcce4d62716edec9c58c1b40be42185e7b    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 16:57:12 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 16:57:12 +1200    

Click here for diff

Commit 87e6ed7c8 added code that intended to report Windows "junction  
points" as DT_LNK (the same way we report symlinks on Unix).  Windows  
junction points are *also* directories according to the Windows  
attributes API, and we were reporting them as as DT_DIR.  Change the  
order we check the attribute flags, to prioritize DT_LNK.  
  
If at some point we start using Windows' recently added real symlinks  
and need to distinguish them from junction points, we may need to  
rethink this, but for now this continues the tradition of wrapper  
functions that treat junction points as symlinks.  
  
Back-patch to 14, where get_dirent_type() landed.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLzLK4PUPx0_AwXEWXOYAejU%3D7XpxnYE55Y%2Be7hB2N3FA%40mail.gmail.com  
Discussion: https://postgr.es/m/20220721111751.x7hod2xgrd76xr5c%40alvherre.pgsql  

M src/port/dirent.c

postgres_fdw: Fix bug in checking of return value of PQsendQuery().

commit   : 44ccdce514c4b3b92c8aca744e9cf7be4580be0b    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 21 Jul 2022 22:52:50 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 21 Jul 2022 22:52:50 +0900    

Click here for diff

When postgres_fdw begins an asynchronous data fetch, it submits FETCH query  
by using PQsendQuery(). If PQsendQuery() fails and returns 0, postgres_fdw  
should report an error. But, previously, postgres_fdw reported an error  
only when the return value is less than 0, though PQsendQuery() never return  
the values other than 0 and 1. Therefore postgres_fdw could not handle  
the failure to send FETCH query in an asynchronous data fetch.  
  
This commit fixes postgres_fdw so that it reports an error  
when PQsendQuery() returns 0.  
  
Back-patch to v14 where asynchronous execution was supported in postgres_fdw.  
  
Author: Fujii Masao  
Reviewed-by: Japin Li, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c

Remove O_FSYNC and associated macros.

commit   : a1b56090eb54544b8ae01b95b424c254c6b71678    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 12:30:37 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 12:30:37 +1200    

Click here for diff

O_FSYNC was a pre-POSIX way of spelling O_SYNC, supported since commit  
9d645fd84c3 for non-conforming operating systems of the time.  It's not  
needed on any modern system.  We can just use standard O_SYNC directly  
if it exists (= all targeted systems except Windows), and get rid of our  
OPEN_SYNC_FLAG macro.  
  
Similarly for standard O_DSYNC, we can just use that directly if it  
exists (= all targeted systems except DragonFlyBSD), and get rid of our  
OPEN_DATASYNC_FLAG macro.  
  
We still avoid choosing open_datasync as a default value for  
wal_sync_method if O_DSYNC has the same value as O_SYNC (= only  
OpenBSD), so there is no change in default behavior.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJE7y92NY7FG2ftUbZUaqohBU65_Ys_7xF5mUHo4wirTQ%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/include/access/xlogdefs.h

Remove fls(), use pg_leftmost_one_pos32() instead.

commit   : 4f1f5a7f85cee932c417aef589b27574813a06c9    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 09:41:12 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 09:41:12 +1200    

Click here for diff

Commit 4f658dc8 provided the traditional BSD fls() function in  
src/port/fls.c so it could be used in several places.  Later we added a  
bunch of similar facilities in pg_bitutils.h, based on compiler  
builtins that map to hardware instructions.  It's a bit confusing to  
have both 1-based and 0-based variants of this operation in use in  
different parts of the tree, and neither is blessed by a standard.  
Let's drop fls.c and the configure probe, and reuse the newer code.  
  
Reviewed-by: David Rowley <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2B7dSX1XF8yFGmYk-%3D48dbjH2kmzZj16XvhbrWP-9BzRg%40mail.gmail.com  

M configure
M configure.ac
M src/backend/access/hash/hashutil.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/utils/mmgr/dsa.c
M src/include/pg_config.h.in
M src/include/port.h
D src/port/fls.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Extend size_t support in pg_bitutils.h.

commit   : 3225399021b62cda66012b17ee60c7bec4733fce    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 09:40:39 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 09:40:39 +1200    

Click here for diff

Use a more compact notation that allows us to add more size_t variants  
as required.  This will be used by a later commit.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2B7dSX1XF8yFGmYk-%3D48dbjH2kmzZj16XvhbrWP-9BzRg%40mail.gmail.com  

M src/include/port/pg_bitutils.h

doc: use wording "restore" instead of "reload" of dumps

commit   : a4f09ef22981011020a5b7404dc2801751b15f64    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 14:55:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 14:55:23 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/textsearch.sgml

Make the name optional in CREATE STATISTICS.

commit   : 624aa2a13bd02dd584bb0995c883b5b93b2152df    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 21 Jul 2022 19:23:13 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 21 Jul 2022 19:23:13 +0100    

Click here for diff

This allows users to omit the statistics name in a CREATE STATISTICS  
command, letting the system auto-generate a sensible, unique name,  
putting the statistics object in the same schema as the table.  
  
Simon Riggs, reviewed by Matthias van de Meent.  
  
Discussion: https://postgr.es/m/CANbhV-FGD2d_C3zFTfT2aRfX_TaPSgOeKES58RLZx5XzQp5NhA@mail.gmail.com  

M doc/src/sgml/ref/create_statistics.sgml
M src/backend/commands/statscmds.c
M src/backend/parser/gram.y
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

doc: clarify that auth. names are lower case and case-sensitive

commit   : fa6c230ef23cfe5367cb883fd461580f6a42619d    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 13:58:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 13:58:20 -0400    

Click here for diff

This is true even for acronyms that are usually upper case, like LDAP.  
  
Reported-by: Alvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/client-auth.sgml

Fix ruleutils issues with dropped cols in functions-returning-composite.

commit   : b9654cecea6a544ad4c42a6779df77c2a5c7cd43    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2022 13:56:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2022 13:56:02 -0400    

Click here for diff

Due to lack of concern for the case in the dependency code, it's  
possible to drop a column of a composite type even though stored  
queries have references to the dropped column via functions-in-FROM  
that return the composite type.  There are "soft" references,  
namely FROM-clause aliases for such columns, and "hard" references,  
that is actual Vars referring to them.  The right fix for hard  
references is to add dependencies preventing the drop; something  
we've known for many years and not done (and this commit still doesn't  
address it).  A "soft" reference shouldn't prevent a drop though.  
We've been around on this before (cf. 9b35ddce9, 2c4debbd0), but  
nobody had noticed that the current behavior can result in dump/reload  
failures, because ruleutils.c can print more column aliases than the  
underlying composite type now has.  So we need to rejigger the  
column-alias-handling code to treat such columns as dropped and not  
print aliases for them.  
  
Rather than writing new code for this, I used expandRTE() which already  
knows how to figure out which function result columns are dropped.  
I'd initially thought maybe we could use expandRTE() in all cases, but  
that fails for EXPLAIN's purposes, because the planner strips a lot of  
RTE infrastructure that expandRTE() needs.  So this patch just uses it  
for unplanned function RTEs and otherwise does things the old way.  
  
If there is a hard reference (Var), then removing the column alias  
causes us to fail to print the Var, since there's no longer a name  
to print.  Failing seems less desirable than printing a made-up  
name, so I made it print "?dropped?column?" instead.  
  
Per report from Timo Stolz.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_relation.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

Add missing space in comments.

commit   : 2a51a066dd3e54e7087cf02f862c8067c78b9d0a    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 21 Jul 2022 16:25:07 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 21 Jul 2022 16:25:07 +0530    

Click here for diff

Author: Junwang Zhao  
Discussion: https://postgr.es/m/CAEG8a3++YQ6A-y5-w6KxP8QH6qxDJDk4dEtZw0cLcW9bsQFydg@mail.gmail.com  

M src/include/storage/lockdefs.h

Allow users to skip logical replication of data having origin.

commit   : 366283961ac0ed6d89014444c6090f3fd02fce0a    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 21 Jul 2022 08:47:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 21 Jul 2022 08:47:38 +0530    

Click here for diff

This patch adds a new SUBSCRIPTION parameter "origin". It specifies  
whether the subscription will request the publisher to only send changes  
that don't have an origin or send changes regardless of origin. Setting it  
to "none" means that the subscription will request the publisher to only  
send changes that have no origin associated. Setting it to "any" means  
that the publisher sends changes regardless of their origin. The default  
is "any".  
Usage:  
CREATE SUBSCRIPTION sub1 CONNECTION 'dbname=postgres port=9999'  
PUBLICATION pub1 WITH (origin = none);  
  
This can be used to avoid loops (infinite replication of the same data)  
among replication nodes.  
  
This feature allows filtering only the replication data originating from  
WAL but for initial sync (initial copy of table data) we don't have such a  
facility as we can only distinguish the data based on origin from WAL. As  
a follow-up patch, we are planning to forbid the initial sync if the  
origin is specified as none and we notice that the publication tables were  
also replicated from other publishers to avoid duplicate data or loops.  
  
We forbid to allow creating origin with names 'none' and 'any' to avoid  
confusion with the same name options.  
  
Author: Vignesh C, Amit Kapila  
Reviewed-By: Peter Smith, Amit Kapila, Dilip Kumar, Shi yu, Ashutosh Bapat, Hayato Kuroda  
Discussion: https://postgr.es/m/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9=9orqubhjcQ@mail.gmail.com  

M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/sql/replorigin.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/include/replication/pgoutput.h
M src/include/replication/walreceiver.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
A src/test/subscription/t/030_origin.pl

docs: Improve pg_settings_get_flags docs.

commit   : f2d0c7f18b0632a93d99f373edc3d8109faffbe2    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 20 Jul 2022 13:30:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 20 Jul 2022 13:30:58 +0900    

Click here for diff

In the docs, the GUC flags that pg_settings_get_flags() reported were  
listed using <simplelist>. But the list was treated as separate lines  
in the existing function table and didn't look good. For better view,  
this commit separates the list from the table entry for  
pg_settings_get_flags() and adds the table for it at the bottom of  
the existing function table.  
  
Author: Fujii Masao  
Reviewed-by: Alvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Tweak a bit the new TAP tests of REINDEX DATABASE/SYSTEM

commit   : 2b99ce10c2bc2b901cf2fe04f844f3983943bf9f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 21 Jul 2022 11:00:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 21 Jul 2022 11:00:48 +0900    

Click here for diff

This renames the relation storing the relfilenode state into something  
more generic as it also stores data for non-toast relations.  A  
restriction on the number of digits used for the OID number when  
filtering toast relation names is removed, while on it, as there is no  
need for it.  
  
Reported-by: Justin Pryzby  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/t/090_reindexdb.pl

Fix various memory leaks in psql's describe commands \d*

commit   : 171ab95f64493f30dccf34bb1cafaa7b4957cd4e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 21 Jul 2022 10:41:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 21 Jul 2022 10:41:33 +0900    

Click here for diff

Most of these have been introduced in d2d3547 with the new pattern  
validation logic, and would leak memory worth an amount of one  
PQExpBuffer each time (as of 256 bytes at minimum, possibly more).  
  
Most of the patch has been written by Tang Haiying, with a few tweaks  
coming from Álvaro Herrera.  
  
Reported-by: Tang Haiying  
Author: Tang Haiying, Álvaro Herrera  
Reviewed-by: Mark Dilger, Andres Freund, Álvaro Herrera, Tom Lane, Japin  
Li, Michael Paquier, Junwang Zhao  
Backpatch-through: 15  

M src/bin/psql/describe.c

Dump more fields when dumping planner internal data structures.

commit   : af119e08fd147e808927b1a4c9f091636d52eb45    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Jul 2022 13:54:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Jul 2022 13:54:25 -0400    

Click here for diff

Commit 964d01ae9 marked a lot of fields as read_write_ignore  
to stay consistent with what was dumped by the manually-maintained  
outfuncs.c code.  However, it seems that a pretty fair number  
of those omissions were either flat-out oversights, or a shortcut  
taken because hand-written code seemed like it'd be too much trouble.  
Let's upgrade things where it seems to make sense to dump.  
  
To do this, we need to add support to gen_node_support.pl and  
outfuncs.c for variable-length arrays of Node pointers.  That's  
pretty straightforward given the model of the existing code  
for arrays of scalars, but I found I needed to tighten the  
type-recognizing regexes in gen_node_support.pl.  (As they  
stood, they mistook "foo **" for "foo *".  Make sure they're  
all fully anchored to prevent additional problems.)  
  
The main thing left un-done here is that a lot of partitioning-related  
structs are still not dumped, because they are bare structs not Nodes.  
I'm not sure about the wisdom of that choice ... but changing it would  
be fairly invasive, so it probably requires more justification than  
just making planner node dumps more complete.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/outfuncs.c
M src/include/nodes/pathnodes.h

Process shared_preload_libraries in single-user mode.

commit   : 6c31ac091f31171601ee00972e131d8683e7b828    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 15 Jul 2022 12:24:10 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 15 Jul 2022 12:24:10 -0700    

Click here for diff

Without processing shared_preload_libraries, it's impossible to  
recover if custom WAL resource managers are needed. It may also pose a  
problem running VACUUM on a table with a custom AM, if the module  
implementing the AM is expecting to be loaded by  
shared_preload_libraries.  
  
The reason this wasn't done before was just the general principle to  
do fewer things in single-user mode. But it's easy enough to just set  
shared_preload_libraries to empty, for the same effect.  
  
Discussion: https://postgr.es/m/9decc18a42634f8a2f15c97a385a0f51a752f396.camel%40j-davis.com  
Reviewed-by: Tom Lane, Andres Freund  
Backpatch-through: 15  

M src/backend/tcop/postgres.c

Make serialization of Nodes' scalar-array fields more robust.

commit   : 2d04277121f2f8e18b65190f0dfa8ca97e9c29cb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Jul 2022 13:04:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Jul 2022 13:04:33 -0400    

Click here for diff

When the ability to print variable-length-array fields was first  
added to outfuncs.c, there was no corresponding read capability,  
as it was used only for debug dumps of planner-internal Nodes.  
Not a lot of thought seems to have been put into the output format:  
it's just the space-separated array elements and nothing else.  
Later such fields appeared in Plan nodes, and still later we grew  
read support so that Plans could be transferred to parallel workers,  
but the original text format wasn't rethought.  It seems inadequate  
to me because (a) no cross-check is possible that we got the right  
number of array entries, (b) we can't tell the difference between  
a NULL pointer and a zero-length array, and (c) except for  
WRITE_INDEX_ARRAY, we'd crash if a non-zero length is specified  
when the pointer is NULL, a situation that can arise in some fields  
that we currently conveniently avoid printing.  
  
Since we're currently in a campaign to make the Node infrastructure  
generally more it-just-works-without-thinking-about-it, now seems  
like a good time to improve this.  
  
Let's adopt a format similar to that used for Lists, that is "<>"  
for a NULL pointer or "(item item item)" otherwise.  Also retool  
the code to not have so many copies of the identical logic.  
  
I bumped catversion out of an abundance of caution, although I think  
that we don't use any such array fields in Nodes that can get into  
the catalogs.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h

Document the ability to specify TableAM for pgbench

commit   : f77ff083350eb5a2625a4dbfca61d15b66c4918b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 20 Jul 2022 15:44:44 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 20 Jul 2022 15:44:44 +0300    

Click here for diff

Upcoming custom Table Access Methods (TableAM) need benchmarking.  Despite  
pgbench doesn't have an explicit option for TableAM specification, one can  
specify it using PGOPTION environmental variable.  The present commit documents  
this way to specify TableAM for pgbench.  
  
Discussion: https://postgr.es/m/CAC77N6ih%3DLbhZQXV76grEsaVQkBL464Y2Foqq9o%3Df4UBfEOfEQ%40mail.gmail.com  
Author: Michel Pelletier, Alexander Korotkov  
Reviewed-by: Justin Pryzby, Mason Sharp, Michael Paquier  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/pgbench.sgml

Make subquery aliases optional in the FROM clause.

commit   : bcedd8f5fce0b69970cf0cee7bca560833d05869    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 20 Jul 2022 09:29:42 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 20 Jul 2022 09:29:42 +0100    

Click here for diff

This allows aliases for sub-SELECTs and VALUES clauses in the FROM  
clause to be omitted.  
  
This is an extension of the SQL standard, supported by some other  
database systems, and so eases the transition from such systems, as  
well as removing the minor inconvenience caused by requiring these  
aliases.  
  
Patch by me, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CAEZATCUCGCf82=hxd9N5n6xGHPyYpQnxW8HneeH+uP7yNALkWA@mail.gmail.com  

M doc/src/sgml/ref/select.sgml
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/backend/utils/adt/ruleutils.c
M src/include/parser/parse_node.h
M src/interfaces/ecpg/preproc/ecpg.addons
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Add PGDLLEXPORTS to some plpgsql function declarations

commit   : 1caf915ff31e91031f0a0b8e1016df2b59d6f9de    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jul 2022 10:24:50 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Jul 2022 10:24:50 +0200    

Click here for diff

After -fvisibility=hidden was added by 089480c07705, plpgsql_check no  
longer works; this quick hack fixes it.  It would be better to  
restructure the plpgsql.h header so that this doesn't look as random,  
but we can leave that for another day.  
  
Reported-by: Pavel Stehule  
Discussion: https://postgr.es/m/CAFj8pRAFxc3-SHMD3URU09JZXEKY3W-RwXKp8xPEnEq8rrka7w@mail.gmail.com  

M src/pl/plpgsql/src/plpgsql.h

Fix warnings on Windows.

commit   : bde60daa0ec9d0ee8dc79c0caa2c94d128527867    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 20 Jul 2022 16:09:50 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 20 Jul 2022 16:09:50 +1200    

Click here for diff

Avoid macro redefinition warnings.  
  
Reported-by: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/CAApHDvocHp4SXcPeMTwFiCQGaf9JypjTJ3Bh90jcPuGwxyDjjQ%40mail.gmail.com  

M src/include/port/win32_port.h

Add wal_sync_method=fdatasync for Windows.

commit   : 9430fb407bb64cc842e56fb5844265a9343dafba    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 20 Jul 2022 13:50:57 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 20 Jul 2022 13:50:57 +1200    

Click here for diff

Windows 10 gained support for flushing NTFS files with fdatasync()  
semantics.  The main advantage over open_datasync (in Windows API terms  
FILE_FLAG_WRITE_THROUGH) is that the latter does not flush SATA drive  
caches.  The default setting is not changed, so users have to opt in to  
this.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJZJVO%3DiX%2Beb-PXi2_XS9ZRqnn_4URh0NUQOwt6-_51xQ%40mail.gmail.com  

M configure
M configure.ac
M doc/src/sgml/wal.sgml
M src/include/c.h
M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
A src/port/fdatasync.c
M src/port/win32ntdll.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Fix assertion failure and segmentation fault in backup code.

commit   : b24b2be119c4cccceae838b62a3519a6d70b9476    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 11:53:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 11:53:29 +0900    

Click here for diff

When a non-exclusive backup is canceled, do_pg_abort_backup() is called  
and resets some variables set by pg_backup_start (pg_start_backup in v14  
or before). But previously it forgot to reset the session state indicating  
whether a non-exclusive backup is in progress or not in this session.  
  
This issue could cause an assertion failure when the session running  
BASE_BACKUP is terminated after it executed pg_backup_start and  
pg_backup_stop (pg_stop_backup in v14 or before). Also it could cause  
a segmentation fault when pg_backup_stop is called after BASE_BACKUP  
in the same session is canceled.  
  
This commit fixes the issue by making do_pg_abort_backup reset  
that session state.  
  
Back-patch to all supported branches.  
  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

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

Prevent BASE_BACKUP in the middle of another backup in the same session.

commit   : ee79647769f54076422a18845f12e106a34c5f87    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 09:31:57 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 09:31:57 +0900    

Click here for diff

Multiple non-exclusive backups are able to be run conrrently in different  
sessions. But, in the same session, only one non-exclusive backup can be  
run at the same moment. If pg_backup_start (pg_start_backup in v14 or before)  
is called in the middle of another non-exclusive backup in the same session,  
an error is thrown.  
  
However, previously, in logical replication walsender mode, even if that  
walsender session had already called pg_backup_start and started  
a non-exclusive backup, it could execute BASE_BACKUP command and  
start another non-exclusive backup. Which caused subsequent pg_backup_stop  
to throw an error because BASE_BACKUP unexpectedly reset the session state  
marked by pg_backup_start.  
  
This commit prevents BASE_BACKUP command in the middle of another  
non-exclusive backup in the same session.  
  
Back-patch to all supported branches.  
  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/basebackup.c

Tweak detail and hint messages to be consistent with project policy

commit   : 12c254c99f6c6f0bbfc7997ee10ea73fee30dea2    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Jul 2022 09:50:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Jul 2022 09:50:12 +0900    

Click here for diff

Detail and hint messages should be full sentences and should end with a  
period, but some of the messages newly-introduced in v15 did not follow  
that.  
  
Author: Justin Pryzby  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M contrib/basic_archive/basic_archive.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_jsontable.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/misc/guc.c
M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/sqljson.out
M src/test/regress/expected/triggers.out

Add regression test for TRUNCATE on foreign table not supporting TRUNCATE.

commit   : ecc84b916f8f36924e2b3de358045edfc3205e5a    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 20 Jul 2022 09:35:14 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 20 Jul 2022 09:35:14 +0900    

Click here for diff

file_fdw doesn't support INSERT, UPDATE, DELETE and TRUNCATE.  
It has the regression test that confirms that INSERT, UPDATE and DELETE  
fail on its foreign table, but not TRUNCATE yet. It's better to  
also test TRUNCATE fails on a foreign table not allowing TRUNCATE,  
for test coverage. This commit adds that regression test using file_fdw.  
  
Author: Yugo Nagata  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql

Fix missed corner cases for grantable permissions on GUCs.

commit   : 13d83881514856353dc86575eb0fc28132349a60    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2022 17:21:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2022 17:21:55 -0400    

Click here for diff

We allow users to set the values of not-yet-loaded extension GUCs,  
remembering those values in "placeholder" GUC entries.  When/if  
the extension is loaded later in the session, we need to verify that  
the user had permissions to set the GUC.  That was done correctly  
before commit a0ffa885e, but as of that commit, we'd check the  
permissions of the active role when the LOAD happens, not the role  
that had set the value.  (This'd be a security bug if it had made it  
into a released version.)  
  
In principle this is simple enough to fix: we just need to remember  
the exact role OID that set each GUC value, and use that not  
GetUserID() when verifying permissions.  Maintaining that data in  
the guc.c data structures is slightly tedious, but fortunately it's  
all basically just copy-n-paste of the logic for tracking the  
GucSource of each setting, as we were already doing.  
  
Another oversight is that validate_option_array_item() hadn't  
been taught to check for granted GUC privileges.  This appears  
to manifest only in that ALTER ROLE/DATABASE RESET ALL will  
fail to reset settings that the user should be allowed to reset.  
  
Patch by myself and Nathan Bossart, per report from Nathan Bossart.  
Back-patch to v15 where the faulty code came in.  
  
Discussion: https://postgr.es/m/20220706224727.GA2158260@nathanxps13  

M src/backend/commands/extension.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/pl/plperl/expected/plperl_init.out
M src/pl/plperl/sql/plperl_init.sql
M src/test/modules/unsafe_tests/expected/guc_privs.out
M src/test/modules/unsafe_tests/sql/guc_privs.sql

Convert planner's AggInfo and AggTransInfo structs to proper Nodes.

commit   : d6a3aeb9a37bdbb5aa8ed03a9f95e2b1a1b44ba7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2022 12:29:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2022 12:29:37 -0400    

Click here for diff

This is mostly just to get outfuncs.c support for them, so that  
the agginfos and aggtransinfos lists can be dumped when dumping  
the contents of PlannerInfo.  
  
While here, improve some related comments; notably, clean up  
obsolete comments left over from when preprocess_minmax_aggregates  
had to make its own scan of the query tree.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/prep/prepagg.c
M src/include/nodes/pathnodes.h

Estimate cost of elided SubqueryScan, Append, MergeAppend nodes better.

commit   : e2f6c307c02924e6ee1667890b56280ab1960d2e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2022 11:18:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2022 11:18:19 -0400    

Click here for diff

setrefs.c contains logic to discard no-op SubqueryScan nodes, that is,  
ones that have no qual to check and copy the input targetlist unchanged.  
(Formally it's not very nice to be applying such optimizations so late  
in the planner, but there are practical reasons for it; mostly that we  
can't unify relids between the subquery and the parent query until we  
flatten the rangetable during setrefs.c.)  This behavior falsifies our  
previous cost estimates, since we would've charged cpu_tuple_cost per  
row just to pass data through the node.  Most of the time that's little  
enough to not matter, but there are cases where this effect visibly  
changes the plan compared to what you would've gotten with no  
sub-select.  
  
To improve the situation, make the callers of cost_subqueryscan tell  
it whether they think the targetlist is trivial.  cost_subqueryscan  
already has the qual list, so it can check the other half of the  
condition easily.  It could make its own determination of tlist  
triviality too, but doing so would be repetitive (for callers that  
may call it several times) or unnecessarily expensive (for callers  
that can determine this more cheaply than a general test would do).  
  
This isn't a 100% solution, because createplan.c also does things  
that can falsify any earlier estimate of whether the tlist is  
trivial.  However, it fixes nearly all cases in practice, if results  
for the regression tests are anything to go by.  
  
setrefs.c also contains logic to discard no-op Append and MergeAppend  
nodes.  We did have knowledge of that behavior at costing time, but  
somebody failed to update it when a check on parallel-awareness was  
added to the setrefs.c logic.  Fix that while we're here.  
  
These changes result in two minor changes in query plans shown in  
our regression tests.  Neither is relevant to the purposes of its  
test case AFAICT.  
  
Patch by me; thanks to Richard Guo for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/create_view.out
M src/test/regress/expected/join.out

Wrap overly long lines

commit   : 1679d57a550530ebef624738cc1b12647714fca6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 19 Jul 2022 09:54:03 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 19 Jul 2022 09:54:03 +0200    

Click here for diff

Reported by Richard Guo.  
  
Reviewed-by: Richard Guo <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAMbWs4-3ywL_tPHJKk-Vvzr-tBaR--b6XxGGm8Xe7vsG38AWog@mail.gmail.com  

M src/backend/optimizer/plan/setrefs.c

Clean up temp file from refactored dtrace rule

commit   : 4371d34f299bc261ba54f9bc3cdd1087f4336de3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Jul 2022 07:31:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Jul 2022 07:31:58 +0200    

Click here for diff

related to eb6569fd0e24e2f0502ef7b496ba0d3125bd4f15  

M src/backend/utils/Makefile

Convert macros to static inline functions (itup.h)

commit   : 14a8bd98274aaf51912b29cbb869696fc825da00    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Jul 2022 06:58:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Jul 2022 06:58:11 +0200    

Click here for diff

Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com  

M src/include/access/itup.h

Rework logic and simplify syntax of REINDEX DATABASE/SYSTEM

commit   : 2cbc3c17a5c11d13c0ac92fe7557c56408f8f3d0    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 19 Jul 2022 11:45:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 19 Jul 2022 11:45:06 +0900    

Click here for diff

Per discussion, this commit includes a couple of changes to these two  
flavors of REINDEX:  
* The grammar is changed to make the name of the object optional, hence  
one can rebuild all the indexes of the wanted area by specifying only  
"REINDEX DATABASE;" or "REINDEX SYSTEM;".  Previously, the object name  
was mandatory and had to match the name of the database on which the  
command is issued.  
* REINDEX DATABASE is changed to ignore catalogs, making this task only  
possible with REINDEX SYSTEM.  This is a historical change, but there  
was no way to work only on the indexes of a database without touching  
the catalogs.  We have discussed more approaches here, like the addition  
of an option to skip the catalogs without changing the original  
behavior, but concluded that what we have here is for the best.  
  
This builds on top of the TAP tests introduced in 5fb5b6c, showing the  
change in behavior for REINDEX SYSTEM.  reindexdb is updated so as we do  
not issue an extra REINDEX SYSTEM when working on a database in the  
non-concurrent case, something that was confusing when --concurrently  
got introduced, so this simplifies the code.  
  
Author: Simon Riggs  
Reviewed-by: Ashutosh Bapat, Bernd Helmle, Álvaro Herrera, Cary Huang,  
Michael Paquier  
Discussion: https://postgr.es/m/CANbhV-H=NH6Om4-X6cRjDWfH_Mu1usqwkuYVp-hwdB_PSHWRfg@mail.gmail.com  

M doc/src/sgml/ref/reindex.sgml
M src/backend/commands/indexcmds.c
M src/backend/parser/gram.y
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/090_reindexdb.pl

Add more tests for REINDEX DATABASE/SYSTEM with relfilenode changes

commit   : 5fb5b6c4c176d873bd8405ec40f7002daf242a36    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 19 Jul 2022 10:51:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 19 Jul 2022 10:51:27 +0900    

Click here for diff

Adding such commands in the main regression test suite is not a good  
approach performance-wise as it impacts all the objects in the  
regression database, so this additional coverage is added in the TAP  
tests of reindexdb where we already run a few REINDEX commands with  
SYSTEM and DATABASE so there is no runtime difference for the test.  
This additional coverage checks which relations are rewritten with  
relfilenode changes, as of:  
- a toast index in user table.  
- a toast index in catalog table.  
- a catalog index.  
- a user index.  
  
This test suite is something I have implemented for a separate patch  
that reworks a bit the way we handle these two REINDEX behaviors, but it  
has enough value in itself to be in a separate commit.  This also makes  
easier to follow what actually changes once the REINDEX logic is  
reworked (currently, DABATASE rewrites both catalog and user tables, and  
SYSTEM works only on catalogs).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/t/090_reindexdb.pl

Use STDOUT/STDERR_FILENO in most of syslogger.

commit   : 950e64fa46b164df87b5eb7c6e15213ab9880f87    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 17:06:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 17:06:34 -0700    

Click here for diff

This fixes problems on windows when logging collector is used in a service,  
failing with:  
FATAL:  could not redirect stderr: Bad file descriptor  
  
This is triggered by 76e38b37a5. The problem is that STDOUT/STDERR_FILENO  
aren't defined on windows, which lead us to use _fileno(stdout) etc, but that  
doesn't work if stdout/stderr are closed.  
  
Author: Andres Freund <[email protected]>  
Reported-By: Sandeep Thakkar <[email protected]>  
Message-Id: [email protected] (on pgsql-packagers)  
Backpatch: 15-, where 76e38b37a5 came in  

M src/backend/postmaster/syslogger.c

windows: msvc: Define STDIN/OUT/ERR_FILENO.

commit   : c290e79cf07f5784fd68e726177503a6805c28d6    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 17:06:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 17:06:34 -0700    

Click here for diff

Because they are not available we've used _fileno(stdin) in some places, but  
that doesn't reliably work, because stdin might be closed. This is the  
prerequisite of the subsequent commit, fixing a failure introduced in  
76e38b37a5.  
  
Author: Andres Freund <[email protected]>  
Reported-By: Sandeep Thakkar <[email protected]>  
Message-Id: [email protected] (on pgsql-packagers)  
Backpatch: 15-, where 76e38b37a5 came in  

M src/include/port/win32_msvc/unistd.h

Improve perl style in ecpg's parser-construction scripts.

commit   : 0778eb79b1e2957743bbd577fc3d862a3dc007cf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Jul 2022 19:43:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Jul 2022 19:43:16 -0400    

Click here for diff

parse.pl and check_rules.pl used "no warnings 'uninitialized'",  
which doesn't seem like it measures up to current project standards.  
Removing that shows that it was hiding various places that accessed  
off the end of an array, which are easily protected by minor logic  
adjustments.  There's no change in the script results.  
  
While here, improve the Makefile rule that invokes these scripts.  
It neglected to depend on check_rules.pl, so that editing that file  
didn't result in re-running the check; and it ran check_rules.pl  
after building preproc.y, so that if check_rules.pl did fail the  
next "make" attempt would just bypass it.  check_rules.pl failures  
are sufficiently un-heard-of that I don't feel a need to back-patch  
this.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl

ecpg: use our instead of my in parse.pl to fix perlcritic complaint

commit   : d268d0f7a16e9e3c6de660b73543d875b8187def    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 14:53:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 14:53:02 -0700    

Click here for diff

In db0a272d123 I used open(our $something, ...), which perlcritic doesn't  
like. It looks like the warning is due to perlcritic knowing about 'my' but  
not 'our' when checking for bareword file handles.  
  
However, it's clearly unnecessary to use "our" here, change it to "my".  
  
Via buildfarm member crake and discussion with Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/parse.pl

Refactor dtrace postprocessing make rules

commit   : eb6569fd0e24e2f0502ef7b496ba0d3125bd4f15    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:22:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:22:50 -0700    

Click here for diff

This is in preparation for building postgres with meson / ninja.  
  
Move the dtrace postprocessing sed commands into a separate file so  
that it can be shared by meson.  Also split the rule into two for  
proper dependency declaration.  
  
Reviewed-by: Andres Freund <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/Makefile
A src/backend/utils/postprocess_dtrace.sed

Add output directory option to gen_node_support.pl

commit   : adba4b74710669cefe8e66cd8f586b47e6431f48    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:32:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:32:26 -0700    

Click here for diff

This is in preparation for building postgres with meson / ninja.  
  
When building with meson, commands are run at the root of the build tree. Add  
an option to put build output into the appropriate place. This can be utilized  
by src/tools/msvc/ for a minor simplification, which also provides some  
coverage for the new option.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl
M src/tools/msvc/Solution.pm

Add output directory argument to generate-unicode_norm_table.pl

commit   : c8a9246e09cc2786923df8e5abf3c9c317f3493c    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:18:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:18:36 -0700    

Click here for diff

This is in preparation for building postgres with meson / ninja.  
  
When building with meson, commands are run at the root of the build tree. Add  
an option to put build output into the appropriate place.  
  
Author: Andres Freund <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/common/unicode/generate-unicode_norm_table.pl

Add output file argument to generate-errcodes.pl

commit   : 2bf626b714b5189d6041c228f74cdb769ea169fa    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:15:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:15:09 -0700    

Click here for diff

This is in preparation for building postgres with meson / ninja.  
  
meson's 'capture' (redirecting stdout to a file) is a bit slower than programs  
redirecting output themselves (mostly due to a python wrapper necessary for  
windows). That doesn't matter for most things, but errcodes.h is a dependency  
of nearly everything, making it a bit faster seem worthwhile.  
  
Medium term it might also be worth avoiding writing errcodes.h if its contents  
didn't actually change, to avoid unnecessary recompilations.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/Makefile
M src/backend/utils/generate-errcodes.pl
M src/tools/msvc/Solution.pm

Add output path arg in generate-lwlocknames.pl

commit   : 4f20506fe04092a9174bfc6dea908c3dfdbaaf1e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:13:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:13:14 -0700    

Click here for diff

This is in preparation for building postgres with meson / ninja.  
  
When building with meson, commands are run at the root of the build tree. Add  
an option to put build output into the appropriate place. This can be utilized  
by src/tools/msvc/ for a minor simplification, which also provides some  
coverage for the new option.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/tools/msvc/Solution.pm

Move snowball_create.sql creation into perl file

commit   : b3a0d8324cf1f02c04a7099a436cfd68cfbf4566    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:11:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 12:11:34 -0700    

Click here for diff

This is in preparation for building postgres with meson / ninja.  
  
We already have duplicated code for this between the make and msvc  
builds. Adding a third copy seems like a bad plan, thus move the generation  
into a perl script.  
  
As we don't want to rely on perl being available for builds from tarballs,  
generate the file during distprep.  
  
Author: Peter Eisentraut <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/snowball/Makefile
A src/backend/snowball/snowball_create.pl
M src/tools/msvc/Install.pm

ecpg: Output dir, source dir, stamp file argument for preproc/*.pl

commit   : db0a272d123b8d7f4d4acbeb54f27682a566be83    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 11:59:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 11:59:03 -0700    

Click here for diff

This is in preparation for building postgres with meson / ninja.  
  
When building with meson, commands are run at the root of the build tree. Add  
an option to put build output into the appropriate place. This can be utilized  
by src/tools/msvc/ for a minor simplification, which also provides some  
coverage for the new option.  
  
Add option to generate a timestamp for check_rules.pl, so that proper  
dependencies on it having been run can be generated.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/tools/msvc/Solution.pm

psql: Output dir and dependency generation for sql_help

commit   : 7c3c2cb9aeda4f288e89b25ede8cc2fe5997ac98    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 11:57:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 11:57:31 -0700    

Click here for diff

This is in preparation for building postgres with meson / ninja.  
  
When building with meson, commands are run at the root of the build tree. Add  
an option to put build output into the appropriate place. This can be utilized  
by src/tools/msvc/ for a minor simplification, which also provides some  
coverage for the new option.  
  
To deal with dependencies to the variable set of input files to this script,  
add an option to generate a dependency file (which meson / ninja can consume).  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/Makefile
M src/bin/psql/create_help.pl
M src/tools/msvc/Solution.pm

Deal with paths containing \ and spaces in basebackup_to_shell tests

commit   : a91242b1bcb312d6f482a758a432a32bd375896e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 10:14:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 10:14:43 -0700    

Click here for diff

As $gzip is embedded in postgresql.conf \ needs to be escaped, otherwise guc.c  
will take it as a string escape. Similarly, if "$gzip" contains spaces, the  
prior incantation will fail. Both of these are common on windows.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where the test was added in 027fa0fd726  

M contrib/basebackup_to_shell/t/001_basic.pl

Reinstate tests accidentally removed by e3fcca0d0d

commit   : 0df4eb3f708626ba3b0fdfab5afccf785e5e945c    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 18 Jul 2022 19:16:23 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 18 Jul 2022 19:16:23 +0200    

Click here for diff

Commit e3fcca0d0d24 reverted modifications to HOT for BRIN, but it also  
removed a couple unrelated tests from stats.sql. Reinstate those tests.  
  
Reported-by: Peter Eisentraut  

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

pg_upgrade: Adjust quoting style in message to match guidelines

commit   : 973137de0819793a82fc6dc91bddb78750380917    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 14:53:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 14:53:00 +0200    

Click here for diff

M src/bin/pg_upgrade/check.c

Add another SQL/JSON error code

commit   : 976b06c6630cbf09bf933a006b5e662753e7c0be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 14:26:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 14:26:43 +0200    

Click here for diff

A code comment said that the standard does not define a number for  
ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE, but this was  
fixed in a later draft version of the standard, so use that number  
now.  

M src/backend/executor/execExprInterp.c
M src/backend/utils/errcodes.txt

Convert macros to static inline functions (tupmacs.h)

commit   : f58d7073b7750d58b5d53232f0d6a967f902b78f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 07:43:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 07:43:39 +0200    

Click here for diff

Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com  

M src/include/access/itup.h
M src/include/access/tupmacs.h

Mark all symbols exported from extension libraries PGDLLEXPORT.

commit   : 8cf64d35eaccab967c51d8bccf2c1babe3f84715    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 18:50:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 18:50:14 -0700    

Click here for diff

This is in preparation for defaulting to -fvisibility=hidden in extensions,  
instead of relying on all symbols in extensions to be exported.  
  
This should have been committed before 089480c0770, but something in my commit  
scripts went wrong.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/hstore.h
M contrib/ltree/ltree.h
M src/include/fmgr.h
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/plpy_util.h
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/worker_spi/worker_spi.c

Fix configure executable permissions.

commit   : 5050fe5458d16387728c0dd13eee9517fe4bce13    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 18:41:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 18:41:32 -0700    

Click here for diff

I do not [yet] understand how, but my prior commit (089480c0770) accidentally  
removed the exec bit from configure. I'll try to figure that out later, for  
now re-add to unbreak the buildfarm.  

M configure

Default to hidden visibility for extension libraries where possible

commit   : 089480c077056fc20fa8d8f5a3032a9dcf5ed812    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 17:49:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 17:49:51 -0700    

Click here for diff

Until now postgres built extension libraries with global visibility, i.e.  
exporting all symbols.  On the one platform where that behavior is not  
natively available, namely windows, we emulate it by analyzing the input files  
to the shared library and exporting all the symbols therein.  
  
Not exporting all symbols is actually desirable, as it can improve loading  
speed, reduces the likelihood of symbol conflicts and can improve intra  
extension library function call performance. It also makes the non-windows  
builds more similar to windows builds.  
  
Additionally, with meson implementing the export-all-symbols behavior for  
windows, turns out to be more verbose than desirable.  
  
This patch adds support for hiding symbols by default and, to counteract that,  
explicit symbol visibility annotation for compilers that support  
__attribute__((visibility("default"))) and -fvisibility=hidden. That is  
expected to be most, if not all, compilers except msvc (for which we already  
support explicit symbol export annotations).  
  
Now that extension library symbols are explicitly exported, we don't need to  
export all symbols on windows anymore, hence remove that behavior from  
src/tools/msvc. The supporting code can't be removed, as we still need to  
export all symbols from the main postgres binary.  
  
Author: Andres Freund <[email protected]>  
Author: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/Makefile.global.in
M src/Makefile.shlib
M src/include/c.h
M src/include/pg_config.h.in
M src/makefiles/pgxs.mk
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm

Remove now superfluous declarations of dlsym()ed symbols.

commit   : fd4bad1655391582f639527c325fc4a99680cc64    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 17:29:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 17:29:32 -0700    

Click here for diff

The prior commit declared them centrally.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/basic_archive/basic_archive.c
M contrib/bloom/bloom.h
M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/isn/isn.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree_plpython/ltree_plpython.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/option.c
M contrib/sepgsql/hooks.c
M contrib/test_decoding/test_decoding.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/pgoutput/pgoutput.c
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_main.c
M src/pl/tcl/pltcl.c
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/worker_spi/worker_spi.c

Add central declarations for dlsym()ed symbols

commit   : f2b73c8d75d583adcdd3562adca335d31f430ac5    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 17:23:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 17 Jul 2022 17:23:42 -0700    

Click here for diff

This is in preparation for defaulting to -fvisibility=hidden in extensions,  
instead of exporting all symbols. For that symbols intended to be exported  
need to be tagged with PGDLLEXPORT. Most extensions only need to do so for  
_PG_init() and functions defined with PG_FUNCTION_INFO_V1. Adding central  
declarations avoids each extension having to add PGDLLEXPORT. Any existing  
declarations in extensions will continue to work if fmgr.h is included before  
them, otherwise compilation for Windows will fail.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/include/fmgr.h
M src/include/jit/jit.h
M src/include/postmaster/pgarch.h
M src/include/replication/output_plugin.h

postgres_fdw: be more wary about shippability of reg* constants.

commit   : 31e5b502920351ddcf8f5efa7f2dc4a60ecdca3a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 18:11:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 18:11:22 -0400    

Click here for diff

Don't consider a constant of regconfig or other reg* types to be  
shippable unless it refers to a built-in object, or an object in  
an extension that's been marked shippable.  Without this  
restriction, we're too likely to send a constant that will fail  
to parse on the remote server.  
  
For the regconfig type only, consider OIDs up to 16383 to be  
"built in", rather than the normal cutoff of 9999.  Otherwise  
the initdb-created text search configurations will be considered  
unshippable, which is unlikely to make anyone happy.  
  
It's possible that this new restriction will de-optimize queries  
that were working satisfactorily before.  Users can restore any  
lost performance by making sure that objects that can be expected  
to exist on the remote side are in shippable extensions.  However,  
that's not a change that people are likely to be happy about having  
to make after a minor-release update.  Between that consideration  
and the lack of field complaints, let's just change this in HEAD.  
  
Noted while fixing bug #17483, although this is not precisely  
the problem that that report complained about.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix omissions in support for the "regcollation" type.

commit   : f49a9fc2bb1228e98cf4fe217e661f3d1dd2ca8c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 17:43:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 17:43:28 -0400    

Click here for diff

The patch that added regcollation doesn't seem to have been too  
thorough about supporting it everywhere that other reg* types  
are supported.  Fix that.  (The find_expr_references omission  
is moderately serious, since it could result in missing expression  
dependencies.  The others are less exciting.)  
  
Noted while fixing bug #17483.  Back-patch to v13 where  
regcollation was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/catcache.c

postgres_fdw: set search_path to 'pg_catalog' while deparsing constants.

commit   : 0a7ccee8fe9ffaff09ad45f4890a3457c69e80b7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 17:27:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 17:27:50 -0400    

Click here for diff

The motivation for this is to ensure successful transmission of the  
values of constants of regconfig and other reg* types.  The remote  
will be reading them with search_path = 'pg_catalog', so schema  
qualification is necessary when referencing objects in other schemas.  
  
Per bug #17483 from Emmanuel Quincerot.  Back-patch to all supported  
versions.  (There's some other stuff to do here, but it's less  
back-patchable.)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Disable unstable test cases in src/test/ssl/t/001_ssltests.pl.

commit   : e993166d71878a11a177b3ade601320d03f12cdf    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2022 21:57:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2022 21:57:32 -0400    

Click here for diff

Missed one in 55828a6b6084724b08675615a4e911ad4d421cd1 :-(  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/001_ssltests.pl

Disable unstable test cases in src/test/ssl/t/001_ssltests.pl.

commit   : 55828a6b6084724b08675615a4e911ad4d421cd1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2022 18:26:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2022 18:26:25 -0400    

Click here for diff

Some of the test cases added by commit 3a0e38504 are failing  
intermittently in CI testing.  It looks like, when a connection  
attempt fails, it's possible for psql to exit and the test script  
to slurp up the postmaster's log file before the connected backend  
has managed to write the log entry we're expecting to see.  
  
It's not clear whether that's fixable in any robust way.  Pending  
more thought, just comment out the log_like checks.  The ones in  
connect_ok tests should be fine, since surely the log entry should  
be emitted before we complete the client auth sequence.  I took  
out all the ones in connect_fails tests though.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/001_ssltests.pl

Remove postmaster.c's reset_shared() wrapper function.

commit   : 5e692dcacabd5dbc8ccfb9e37a2d26a574b6dea6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2022 12:26:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Jul 2022 12:26:19 -0400    

Click here for diff

reset_shared just invokes CreateSharedMemoryAndSemaphores, so let's  
get rid of it and invoke that directly.  This removes a confusing  
seeming-inconsistency between the postmaster's startup sequence  
and the startup sequence used in standalone mode.  
  
Nathan Bossart, reviewed by Pavel Borisov  
  
Discussion: https://postgr.es/m/20220329221702.GA559657@nathanxps13  

M src/backend/postmaster/postmaster.c

Attempt to fix compiler warning on old compiler

commit   : 506428d091760650971433f6bc083531c307b368    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Jul 2022 15:47:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Jul 2022 15:47:27 +0200    

Click here for diff

A couple more like b449afb582bb9015bfbb85abc10ce122aef9ec70, per  
complaints from lapwing.  

M contrib/pg_prewarm/autoprewarm.c
M contrib/postgres_fdw/postgres_fdw.c

Attempt to fix compiler warning on old compiler

commit   : b449afb582bb9015bfbb85abc10ce122aef9ec70    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Jul 2022 13:45:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Jul 2022 13:45:57 +0200    

Click here for diff

Build farm member lapwing (using gcc 4.7.2) didn't like one part of  
9fd45870c1436b477264c0c82eb195df52bc0919, raising a compiler warning.  
Revert that for now.  

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

Replace many MemSet calls with struct initialization

commit   : 9fd45870c1436b477264c0c82eb195df52bc0919    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Jul 2022 08:42:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Jul 2022 08:42:15 +0200    

Click here for diff

This replaces all MemSet() calls with struct initialization where that  
is easily and obviously possible.  (For example, some cases have to  
worry about padding bits, so I left those.)  
  
(The same could be done with appropriate memset() calls, but this  
patch is part of an effort to phase out MemSet(), so it doesn't touch  
memset() calls.)  
  
Reviewed-by: Ranier Vilela <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/amcheck/verify_heapam.c
M contrib/bloom/blcost.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgstattuple/pgstatindex.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_attrdef.c
M src/backend/catalog/pg_cast.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/prepare.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/optimizer/path/costsize.c
M src/backend/parser/parse_target.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/mmgr/portalmem.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/walmethods.c
M src/common/ip.c
M src/port/snprintf.c
M src/test/modules/test_predtest/test_predtest.c
M src/test/regress/regress.c

Emulate sigprocmask(), not sigsetmask(), on Windows.

commit   : c94ae9d827a360d74da6a304692d34a4dc8b6445    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 16 Jul 2022 16:07:45 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 16 Jul 2022 16:07:45 +1200    

Click here for diff

Since commit a65e0864, we've required Unix systems to have  
sigprocmask().  As noted in that commit's message, we were still  
emulating the historical pre-standard sigsetmask() function in our  
Windows support code.  Emulate standard sigprocmask() instead, for  
consistency.  
  
The PG_SETMASK() abstraction is now redundant and all calls could in  
theory be replaced by plain sigprocmask() calls, but that isn't done by  
this commit.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/3153247.1657834482%40sss.pgh.pa.us  

M src/backend/port/win32/signal.c
M src/include/libpq/pqsignal.h

Make dsm_impl_posix_resize more future-proof.

commit   : 3b8d23a3e14f05890f1f306902cd4b992beeee71    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 16 Jul 2022 10:59:52 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 16 Jul 2022 10:59:52 +1200    

Click here for diff

Commit 4518c798 blocks signals for a short region of code, but it  
assumed that whatever called it had the signal mask set to UnBlockSig on  
entry.  That may be true today (or may even not be, in extensions in the  
wild), but it would be better not to make that assumption.  We should  
save-and-restore the caller's signal mask.  
  
The PG_SETMASK() portability macro couldn't be used for that, which is  
why it wasn't done before.  But... considering that commit a65e0864  
established back in 9.6 that supported POSIX systems have sigprocmask(),  
and that this is POSIX-only code, there is no reason not to use standard  
sigprocmask() directly to achieve that.  
  
Back-patch to all supported releases, like 4518c798 and 80845b7c.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKx6Biq7_UuV0kn9DW%2B8QWcpJC1qwhizdtD9tN-fn0H0g%40mail.gmail.com  

M src/backend/storage/ipc/dsm_impl.c

Log details for client certificate failures

commit   : 3a0e385048adf84d212e010d82db16228e5f4060    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Jul 2022 16:18:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Jul 2022 16:18:32 +0200    

Click here for diff

Currently, debugging client certificate verification failures is  
mostly limited to looking at the TLS alert code on the client side.  
For simple deployments, sometimes it's enough to see "sslv3 alert  
certificate revoked" and know exactly what needs to be fixed, but if  
you add any more complexity (multiple CA layers, misconfigured CA  
certificates, etc.), trying to debug what happened based on the TLS  
alert alone can be an exercise in frustration.  
  
Luckily, the server has more information about exactly what failed in  
the chain, and we already have the requisite callback implemented as a  
stub.  We fill that in, collect the data, and pass the constructed  
error message back to the main code via a static variable.  This lets  
us add our error details directly to the final "could not accept SSL  
connection" log message, as opposed to issuing intermediate LOGs.  
  
It ends up looking like  
  
    LOG:  connection received: host=localhost port=43112  
    LOG:  could not accept SSL connection: certificate verify failed  
    DETAIL:  Client certificate verification failed at depth 1: unable to get local issuer certificate.  
            Failed certificate data (unverified): subject "/CN=Test CA for PostgreSQL SSL regression test client certs", serial number 2315134995201656577, issuer "/CN=Test root CA for PostgreSQL SSL regression test suite".  
  
The length of the Subject and Issuer strings is limited to prevent  
malicious client certs from spamming the logs.  In case the truncation  
makes things ambiguous, the certificate's serial number is also  
logged.  
  
Author: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/libpq/be-secure-openssl.c
A src/test/ssl/conf/client-long.config
A src/test/ssl/ssl/client-long.crt
A src/test/ssl/ssl/client-long.key
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm

Convert macros to static inline functions (xlog_internal.h)

commit   : 507ba16b28c724046551ef8757ebccb8b4fb6da6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Jul 2022 12:05:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Jul 2022 12:05:01 +0200    

Click here for diff

Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com  

M src/include/access/xlog_internal.h

Support gcc -fkeep-inline-functions

commit   : 3e9ca526012b0913db8285211ee52d5d6225334d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Jul 2022 12:05:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Jul 2022 12:05:01 +0200    

Click here for diff

For some systems, we need to avoid unsatisfied-external-reference  
errors in static inlines.  See  
27d2693187d1bcf2563ee7142ba37d4788c8d52b for example.  In order to  
test that on other systems, the gcc option -fkeep-inline-functions can  
be used.  But it actually is a bit stricter than what we currently  
have in place, so fix up a few more places along the lines of the  
above commit.  (This undoes part of commit  
2cd2569c72b8920048e35c31c9be30a6170e1410.)  
  
(Note, this does not add that gcc option anywhere to the build system,  
it just makes it possible to use it successfully manually.)  
  
Discussion: https://www.postgresql.org/message-id/flat/E1oBgIW-002ehP-VJ%40gemulon.postgresql.org  

M src/include/storage/bufpage.h
M src/include/utils/rel.h
M src/include/utils/snapmgr.h

Fix inconsistent parameter names between prototype and declaration

commit   : 80ad91ea8cfca6c817034423fc889876217c67af    
  
author   : David Rowley <[email protected]>    
date     : Fri, 15 Jul 2022 15:26:34 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 15 Jul 2022 15:26:34 +1200    

Click here for diff

Noticed while working in this area.  This code was introduced in PG15,  
which is still in beta, so backpatch to there for consistency.  
  
Backpatch-through: 15  

M src/include/optimizer/paths.h

docs: make monitoring "phases" table titles consistent

commit   : 582c3e9e8b8d27bec2deb71025c8e85b6257c589    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 20:01:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 20:01:11 -0400    

Click here for diff

Reported-by: Nitin Jadhav  
  
Discussion: https://postgr.es/m/CAMm1aWbmTHwHKC2PERH0CCaFVPoxrtLeS8=wNuoge94qdSp3vA@mail.gmail.com  
  
Author: Nitin Jadhav  
  
Backpatch-through: 13  

M doc/src/sgml/monitoring.sgml

doc: clarify how dropping of extensions affects dependent objs.

commit   : 5fe2d4c56edd315780e3c6a00caaa5625a719a87    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 17:41:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 17:41:03 -0400    

Click here for diff

Clarify that functions/procedures are dropped when any extension that  
depends on them is dropped.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwbPSHMDGkisRUmewopweC1bFvytVqB=a=X4GFg=4ZWxPA@mail.gmail.com  
  
Backpatch-through: 13  

M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_procedure.sgml
M doc/src/sgml/ref/drop_extension.sgml

pg_upgrade doc: mention that replication slots must be recreated

commit   : 47ae6948f0b03cade761b80932c60f208b41f748    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:34:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:34:30 -0400    

Click here for diff

Reported-by: Nikhil Shetty  
  
Discussion: https://postgr.es/m/CAFpL5Vxastip0Jei-K-=7cKXTg=5sahSe5g=om=x68NOX8+PUA@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/pgupgrade.sgml

doc: add documentation about ecpg Oracle-compatibility mode

commit   : 76fa4bf321c5f13c729f225a465e754958c0a5c5    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:19:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:19:45 -0400    

Click here for diff

Reported-by: Takeshi Ideriha  
  
Discussion: https://postgr.es/m/TYCPR01MB7041A157067208327D8DAAF9EAA59@TYCPR01MB7041.jpnprd01.prod.outlook.com  
  
Backpatch-through: 11  

M doc/src/sgml/ecpg.sgml

doc: move system views section to its own chapter

commit   : 64d364bb39cbb1d97ab6dbd6b873a1016a261d4b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:07:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:07:12 -0400    

Click here for diff

Previously it was inside the system catalogs chapter.  
  
Reported-by: Peter Smith  
  
Discussion: https://postgr.es/m/CAHut+PsMc18QP60D+L0hJBOXrLQT5m88yVaCDyxLq34gfPHsow@mail.gmail.com  
  
Backpatch-through: 15  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/postgres.sgml
A doc/src/sgml/system-views.sgml

doc: clarify the behavior of identically-named savepoints

commit   : ec1fe23afa93c444546d60c256f25c981c757d7c    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:44:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:44:22 -0400    

Click here for diff

Original patch by David G. Johnston.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwYQCxSSuSL18skCWG8QHFswOJ3hjovHsOZUE346i4OpVQ@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/release_savepoint.sgml
M doc/src/sgml/ref/savepoint.sgml

doc: clarify that "excluded" ON CONFLICT is a single row

commit   : 4f63f6aae0cd2bbcbb18c43db79c0351a69f91ad    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:33:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:33:28 -0400    

Click here for diff

Original patch by David G. Johnston.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwa4J0+WuO7kW1PLbjoEvzPN+Q_j+P2bXxNnCLaszY7ZdQ@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/insert.sgml

doc: mention that INSERT can block because of unique indexes

commit   : 6959e971b35e7e6e10d61b95699cec7985d053b1    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:17:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:17:19 -0400    

Click here for diff

Initial patch by David G. Johnston.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwZpbdzceO41VE-xt1Xh8rWRRfgopTAK1wL9EhCo0Am-Sw@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/insert.sgml

doc: mention the pg_locks lock names in parentheses

commit   : 3e071b2cf584052b0799ebbc4d38ecfdb5bd701a    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 12:08:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 12:08:55 -0400    

Click here for diff

Reported-by: Troy Frericks  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/mvcc.sgml

Don't clobber postmaster sigmask in dsm_impl_resize.

commit   : 80845b7c0b2cf0a26e44d7906d63cddbb4dd586c    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 15 Jul 2022 01:23:29 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 15 Jul 2022 01:23:29 +1200    

Click here for diff

Commit 4518c798 intended to block signals in regular backends that  
allocate DSM segments, but dsm_impl_resize() is also reached by  
dsm_postmaster_startup().  It's not OK to clobber the postmaster's  
signal mask, so only manipulate the signal mask when under the  
postmaster.  
  
Back-patch to all releases, like 4518c798.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKNpK%3D2OMeea_AZwpLg7Bm4%3DgYWk7eDjZ5F6YbozfOf8w%40mail.gmail.com  

M src/backend/storage/ipc/dsm_impl.c

Tighten up parsing logic in gen_node_support.pl.

commit   : 7c0eb3c622eb0882f460805109f244679b340964    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Jul 2022 09:04:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Jul 2022 09:04:23 -0400    

Click here for diff

Teach this script to handle function pointer fields honestly.  
Previously they were just silently ignored, but that's not likely to  
be a behavior we can accept indefinitely.  This mostly entails fixing  
it so that a field declaration spanning multiple lines can be parsed,  
because we have a bunch of such fields that're laid out that way.  
But that's a good improvement in its own right.  
  
With that change and a minor regex adjustment, the only struct it  
fails to parse in the node-defining headers is A_Const, because  
of the embedded union.  The path of least resistance is to move  
that union declaration outside the struct.  
  
Having done those things, we can make it error out if it finds  
any within-struct syntax it doesn't understand, which seems like  
a pretty important property for robustness.  
  
This commit doesn't change the output files at all; it's just in  
the way of future-proofing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h

Avoid shadowing a variable in sync.c.

commit   : 57944910585750b52173a0f67c9e0e42639f1c0a    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 12 Jul 2022 16:17:36 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 12 Jul 2022 16:17:36 +1200    

Click here for diff

It was confusing to reuse the variable name 'entry' in two scopes.  
Use distinct variable names.  
  
Reported-by: Ranier Vilela <[email protected]>  
Reported-by: Tom Lane <[email protected]>  
Reported-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CAEudQArDrFyQ15Am3rgWBunGBVZFDb90onTS8SRiFAWHeiLiFA%40mail.gmail.com  

M src/backend/storage/sync/sync.c

Create a distinct wait event for POSIX DSM allocation.

commit   : 7bae3bbf62d63cdd49ae4ca4a851cef0cdbe6ab5    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 14 Jul 2022 22:52:13 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 14 Jul 2022 22:52:13 +1200    

Click here for diff

Previously we displayed "DSMFillZeroWrite" while in posix_fallocate(),  
because we shared the same wait event for "mmap" and "posix" DSM types.  
Let's introduce a new wait event "DSMAllocate", to be more accurate.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20220711174518.yldckniicknsxgzl%40awork3.anarazel.de  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/ipc/dsm_impl.c
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h

Remove redundant ftruncate() for POSIX DSM memory.

commit   : 712704d3539e5ed6807e0b46fddaaf8ed47c2403    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 14 Jul 2022 19:23:35 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 14 Jul 2022 19:23:35 +1200    

Click here for diff

In early releases of the DSM infrastructure, it was possible to resize  
segments.  That was removed in release 12 by commit 3c60d0fa.  Now the  
ftruncate() + posix_fallocate() sequence during DSM segment creation has  
a redundant step: we're always extending from zero to the desired size,  
so we might as well just call posix_fallocate().  
  
Let's also include the remaining ftruncate() call (non-Linux POSIX  
systems) in the wait event reporting, for good measure.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJSm-nq8s%2B_59zb7NbFQF-OS%3DxTnTAiGLrQpuSmU2y_1A%40mail.gmail.com  

M src/backend/storage/ipc/dsm_impl.c

Block signals while allocating DSM memory.

commit   : 4518c798b2b9a84958eca4cde6e7e450b6150da6    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 13 Jul 2022 16:16:07 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 13 Jul 2022 16:16:07 +1200    

Click here for diff

On Linux, we call posix_fallocate() on shm_open()'d memory to avoid  
later potential SIGBUS (see commit 899bd785).  
  
Based on field reports of systems stuck in an EINTR retry loop there,  
there, we made it possible to break out of that loop via slightly odd  
coding where the CHECK_FOR_INTERRUPTS() call was somewhat removed from  
the loop (see commit 422952ee).  
  
On further reflection, that was not a great choice for at least two  
reasons:  
  
1.  If interrupts were held, the CHECK_FOR_INTERRUPTS() would do nothing  
and the EINTR error would be surfaced to the user.  
  
2.  If EINTR was reported but neither QueryCancelPending nor  
ProcDiePending was set, then we'd dutifully retry, but with a bit more  
understanding of how posix_fallocate() works, it's now clear that you  
can get into a loop that never terminates.  posix_fallocate() is not a  
function that can do some of the job and tell you about progress if it's  
interrupted, it has to undo what it's done so far and report EINTR, and  
if signals keep arriving faster than it can complete (cf recovery  
conflict signals), you're stuck.  
  
Therefore, for now, we'll simply block most signals to guarantee  
progress.  SIGQUIT is not blocked (see InitPostmasterChild()), because  
its expected handler doesn't return, and unblockable signals like  
SIGCONT are not expected to arrive at a high rate.  For good measure,  
we'll include the ftruncate() call in the blocked region, and add a  
retry loop.  
  
Back-patch to all supported releases.  
  
Reported-by: Alvaro Herrera <[email protected]>  
Reported-by: Nicola Contu <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20220701154105.jjfutmngoedgiad3%40alvherre.pgsql  

M src/backend/storage/ipc/dsm_impl.c

Correct some uses of e.g. and i.e. in message strings and documentation

commit   : 82785effc01d4bf5f98ed9f12a75c48009ff4e7e    
  
author   : John Naylor <[email protected]>    
date     : Thu, 14 Jul 2022 09:38:06 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 14 Jul 2022 09:38:06 +0700    

Click here for diff

E.g. means "for example" and i.e. means "that is". Fix a couple uses  
that don't match the intended meaning.  
  
Kyotaro Horiguchi  
  
Reviewed by Junwang Zhao and Aleksander Alekseev, with one addition by me  
Discussion: https://www.postgresql.org/message-id/flat/20220713.180943.589079824955875739.horikyota.ntt%40gmail.com  

M doc/src/sgml/ecpg.sgml
M src/bin/pg_upgrade/check.c

Remove support for Visual Studio 2013

commit   : 6203583b72b58272010f8d06999811ff39922acf    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Jul 2022 11:22:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Jul 2022 11:22:49 +0900    

Click here for diff

No members of the buildfarm are using this version of Visual Studio,  
resulting in all the code cleaned up here as being mostly dead, and  
VS2017 is the oldest version still supported.  
  
More versions could be cut, but the gain would be minimal, while  
removing only VS2013 has the advantage to remove from the core code all  
the dependencies on the value defined by _MSC_VER, where compatibility  
tweaks have accumulated across the years mostly around locales and  
strtof(), so that's a nice isolated cleanup.  
  
Note that this commit additionally allows a revert of 3154e16.  The  
versions of Visual Studio now supported range from 2015 to 2022.  
  
Author: Michael Paquier  
Reviewed-by: Juan José Santamaría Flecha, Tom Lane, Thomas Munro, Justin  
Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M doc/src/sgml/install-windows.sgml
M src/backend/main/main.c
M src/backend/optimizer/path/costsize.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/pg_locale.c
M src/include/port/win32_port.h
M src/port/chklocale.c
M src/port/strtof.c
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/README
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm

Fix output of createuser --help with --valid-until

commit   : 4ca9985957881c223b4802d309c0bbbcf8acd1c1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Jul 2022 08:32:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Jul 2022 08:32:18 +0900    

Click here for diff

The argument required by --valid-until, a timestamp string, was missing  
in the description of --help.  
  
Author: Shinoda, Noriyoshi  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/DM4PR84MB1734A6CE3839A68B59BEA599EE899@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M src/bin/scripts/createuser.c

Mop up pg_upgrade's nls.mk for commit b0a55e432.

commit   : a5f9f1b885a8f6bdc5b393736f1399986afdef6f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 14:33:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 14:33:24 -0400    

Click here for diff

We'll do this the hard way for today.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/nls.mk

Revert "Use wildcards instead of manually-maintained file lists in */nls.mk."

commit   : 54ba2f06236a7588433a5825134759ed798eccbf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 14:29:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 14:29:10 -0400    

Click here for diff

This reverts commit 617d69141220f277170927e03a19d2f1b77aed77.  
While I still think the basic idea is attractive, we need to sort  
out what happens with built .c files, and there also seem to be  
VPATH issues.  

M src/bin/initdb/nls.mk
M src/bin/pg_amcheck/nls.mk
M src/bin/pg_archivecleanup/nls.mk
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_checksums/nls.mk
M src/bin/pg_config/nls.mk
M src/bin/pg_controldata/nls.mk
M src/bin/pg_ctl/nls.mk
M src/bin/pg_dump/nls.mk
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_rewind/nls.mk
M src/bin/pg_test_fsync/nls.mk
M src/bin/pg_test_timing/nls.mk
M src/bin/pg_upgrade/nls.mk
M src/bin/pg_verifybackup/nls.mk
M src/bin/pg_waldump/nls.mk
M src/bin/psql/nls.mk
M src/bin/scripts/nls.mk
M src/interfaces/ecpg/ecpglib/nls.mk
M src/interfaces/ecpg/preproc/nls.mk
M src/interfaces/libpq/nls.mk
M src/pl/plperl/nls.mk
M src/pl/plpgsql/src/nls.mk
M src/pl/plpython/nls.mk
M src/pl/tcl/nls.mk

Avoid unsatisfied-external-reference errors in static inlines.

commit   : 27d2693187d1bcf2563ee7142ba37d4788c8d52b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 13:37:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 13:37:10 -0400    

Click here for diff

Commit 9c727360b neglected the lesson we've learned before:  
protect references to backend global variables with #ifndef FRONTEND.  
  
Since there's already a place for static inlines in this file,  
move the just-converted functions to that stanza.  Undo the  
entirely gratuitous de-macroization of RelationGetNumberOfBlocks  
(that one may be okay, since it has no global variable references,  
but it's also pointless).  
  
Per buildfarm.  

M src/include/storage/bufmgr.h

Use wildcards instead of manually-maintained file lists in */nls.mk.

commit   : 617d69141220f277170927e03a19d2f1b77aed77    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 12:56:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 12:56:42 -0400    

Click here for diff

The backend already used a mechanically-generated list of *.c files,  
but everywhere else we had a manually-written-out list of files in  
which to seek translatable messages.  Commit b0a55e432 contains the  
latest in a long line of failures to update those lists.  Rather than  
manually fix its oversight, let's change to using "$(wildcard *.c)"  
in all these nls.mk files.  
  
Many of these files also have manual references to some *.c files  
in other directories, most often src/common/.  Perhaps we should try  
to improve that situation too; but it's a bit less clear how, so for  
now just fix the local file references.  
  
Kyotaro Horiguchi and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/nls.mk
M src/bin/pg_amcheck/nls.mk
M src/bin/pg_archivecleanup/nls.mk
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_checksums/nls.mk
M src/bin/pg_config/nls.mk
M src/bin/pg_controldata/nls.mk
M src/bin/pg_ctl/nls.mk
M src/bin/pg_dump/nls.mk
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_rewind/nls.mk
M src/bin/pg_test_fsync/nls.mk
M src/bin/pg_test_timing/nls.mk
M src/bin/pg_upgrade/nls.mk
M src/bin/pg_verifybackup/nls.mk
M src/bin/pg_waldump/nls.mk
M src/bin/psql/nls.mk
M src/bin/scripts/nls.mk
M src/interfaces/ecpg/ecpglib/nls.mk
M src/interfaces/ecpg/preproc/nls.mk
M src/interfaces/libpq/nls.mk
M src/pl/plperl/nls.mk
M src/pl/plpgsql/src/nls.mk
M src/pl/plpython/nls.mk
M src/pl/tcl/nls.mk

Remove artificial restrictions on which node types have out/read funcs.

commit   : ff33a8c8874b43ec55d517ce0612ed79ad08a38a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 11:48:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Jul 2022 11:48:17 -0400    

Click here for diff

The initial version of gen_node_support.pl manually excluded most  
utility statement node types from having out/read support, and  
also some raw-parse-tree-only node types.  That was mostly to keep  
the output comparable to the old hand-maintained code.  We'd like  
to have out/read support for utility statements, for debugging  
purposes and so that they can be included in new-style SQL functions;  
so it's time to lift that restriction.  
  
Most if not all of the previously-excluded raw-parse-tree-only node  
types can appear in expression subtrees of utility statements, so  
they have to be handled too.  
  
We don't quite have full read support yet; certain custom_read_write  
node types need to have their handwritten read functions implemented  
before that will work.  
  
Doing this allows us to drop the previous hack in _outQuery to not  
dump the utilityStmt field in most cases, which means we no longer  
need manually-maintained out/read functions for Query, so get rid  
of those in favor of auto-generating them.  
  
Fix a couple of omissions in gen_node_support.pl that are exposed  
through having to handle more node types.  
  
catversion bump forced because somebody was sloppy about the field  
order in the manually-maintained Query out/read functions.  
(Committers should note that almost all changes in parsenodes.h  
are now grounds for a catversion bump.)  

M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h

Convert macros to static inline functions (bufmgr.h)

commit   : 9c727360bcc77cf88693129cd6e610b752fdd3d1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 14:33:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 14:33:03 +0200    

Click here for diff

Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com  

M src/include/storage/bufmgr.h

Convert macros to static inline functions (itemptr.h)

commit   : aeb767ca0b0243d0c8c0eae2e1a4390b49ebb66d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 14:33:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 14:33:03 +0200    

Click here for diff

Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com  

M src/include/storage/itemptr.h

Plug memory leak

commit   : e1df03b80d51e093fddb2d554c9a81a28dae568c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Jul 2022 12:10:03 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Jul 2022 12:10:03 +0200    

Click here for diff

Commit 054325c5eeb3 created a memory leak in PQsendQueryInternal in case  
an error occurs while sending the message.  Repair.  
  
Backpatch to 14, like that commit.  Reported by Coverity.  

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

Fix flag tests in src/test/modules/test_oat_hooks

commit   : f16180216d0a6dcefd76fef4121227b63df46681    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Jul 2022 11:57:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Jul 2022 11:57:25 +0200    

Click here for diff

In what must have been a copy'n paste mistake, all the flag tests use  
the same flag rather than a different flag each.  The bug is not  
suprising, considering that it's dead code; add a minimal, testimonial  
line to cover it.  
  
This is all pretty inconsequential, because this is just example code,  
but it had better be correct.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
M src/test/modules/test_oat_hooks/test_oat_hooks.c

Allow specifying STORAGE attribute for a new table

commit   : 784cedda0604ee4ac731fd0b00cd8b27e78c02d3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 12:21:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 12:21:45 +0200    

Click here for diff

Previously, the STORAGE specification was only available in ALTER  
TABLE.  This makes it available in CREATE TABLE as well.  
  
Also make the code and the documentation for STORAGE and COMPRESSION  
attributes consistent.  
  
Author:	Teodor Sigaev <[email protected]>  
Author: Aleksander Alekseev <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: wenjing zeng <[email protected]>  
Reviewed-by: Matthias van de Meent <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Remove useless assertions

commit   : 503e3833ef240c94e114be8703046d52f24da021    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 11:40:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 11:40:00 +0200    

Click here for diff

We don't need Assert(IsA(foo, String)) right before running  
strVal(foo), since strVal() already does the assertion internally (via  
castNode()).  

M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/functions.c
M src/backend/parser/parse_expr.c
M src/pl/plpgsql/src/pl_comp.c

Fix XID list support some more

commit   : 7057bf23546868ee5f1d9721e7129fb636aab042    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Jul 2022 10:34:54 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Jul 2022 10:34:54 +0200    

Click here for diff

Read/out support in 5ca0fe5c8ad7 was missing/incomplete, per Tom Lane.  
Again, as far as core is concerned, this is not only dead code but also  
untested; however, third parties may come to rely on it, so the standard  
features should work.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/read.c

Fix for make unportability

commit   : 58b4f366c0c4b3a5d65269f01150e4ec04cb20a2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 09:15:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 09:15:01 +0200    

Click here for diff

88dad06b47eb80f699211c9b0b7a1c6d9016ad19 contains a make $(shell)  
construct that apparently confuses older GNU make versions (possibly  
because of the # inside the shell command?).  This construct, which  
would allow # comments inside LINGUAS files, was adapted from gettext  
recommendations, but we don't actually need that functionality, so  
sidestep this whole issue by just using plain "cat".  
  
In passing, make this code work with vpath.  

M src/nls-global.mk

NLS: Put list of available languages into LINGUAS files

commit   : 88dad06b47eb80f699211c9b0b7a1c6d9016ad19    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 07:51:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Jul 2022 07:51:43 +0200    

Click here for diff

This moves the list of available languages from nls.mk into a separate  
file called po/LINGUAS.  Advantages:  
  
- It keeps the parts notionally managed by programmers (nls.mk)  
  separate from the parts notionally managed by translators (LINGUAS).  
  
- It's the standard practice recommended by the Gettext manual  
  nowadays.  
  
- The Meson build system also supports this layout (and of course  
  doesn't know anything about our custom nls.mk), so this would enable  
  sharing the list of languages between the two build systems.  
  
(The MSVC build system currently finds all po files by globbing, so it  
is not affected by this change.)  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/nls.sgml
M src/backend/nls.mk
A src/backend/po/LINGUAS
M src/bin/initdb/nls.mk
A src/bin/initdb/po/LINGUAS
M src/bin/pg_amcheck/nls.mk
A src/bin/pg_amcheck/po/LINGUAS
M src/bin/pg_archivecleanup/nls.mk
A src/bin/pg_archivecleanup/po/LINGUAS
M src/bin/pg_basebackup/nls.mk
A src/bin/pg_basebackup/po/LINGUAS
M src/bin/pg_checksums/nls.mk
A src/bin/pg_checksums/po/LINGUAS
M src/bin/pg_config/nls.mk
A src/bin/pg_config/po/LINGUAS
M src/bin/pg_controldata/nls.mk
A src/bin/pg_controldata/po/LINGUAS
M src/bin/pg_ctl/nls.mk
A src/bin/pg_ctl/po/LINGUAS
M src/bin/pg_dump/nls.mk
A src/bin/pg_dump/po/LINGUAS
M src/bin/pg_resetwal/nls.mk
A src/bin/pg_resetwal/po/LINGUAS
M src/bin/pg_rewind/nls.mk
A src/bin/pg_rewind/po/LINGUAS
M src/bin/pg_test_fsync/nls.mk
A src/bin/pg_test_fsync/po/LINGUAS
M src/bin/pg_test_timing/nls.mk
A src/bin/pg_test_timing/po/LINGUAS
M src/bin/pg_upgrade/nls.mk
A src/bin/pg_upgrade/po/LINGUAS
M src/bin/pg_verifybackup/nls.mk
A src/bin/pg_verifybackup/po/LINGUAS
M src/bin/pg_waldump/nls.mk
A src/bin/pg_waldump/po/LINGUAS
M src/bin/psql/nls.mk
A src/bin/psql/po/LINGUAS
M src/bin/scripts/nls.mk
A src/bin/scripts/po/LINGUAS
M src/interfaces/ecpg/ecpglib/nls.mk
A src/interfaces/ecpg/ecpglib/po/LINGUAS
M src/interfaces/ecpg/preproc/nls.mk
A src/interfaces/ecpg/preproc/po/LINGUAS
M src/interfaces/libpq/nls.mk
A src/interfaces/libpq/po/LINGUAS
M src/nls-global.mk
M src/pl/plperl/nls.mk
A src/pl/plperl/po/LINGUAS
M src/pl/plpgsql/src/nls.mk
A src/pl/plpgsql/src/po/LINGUAS
M src/pl/plpython/nls.mk
A src/pl/plpython/po/LINGUAS
M src/pl/tcl/nls.mk
A src/pl/tcl/po/LINGUAS

Small cleanup of create_list_bounds()

commit   : f29199d3190ffdc48f40233f58a346bbb906c060    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 17:01:01 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 17:01:01 +1200    

Click here for diff

When checking for interleaved partitions, we mark the partition as  
interleaved when;  
  
1. we find an earlier partition index when looping over the  
sorted-by-Datum indexes[] array, or;  
  
2. we find that the NULL partition allows some non-NULL Datum value.  
  
In the code, as it was written in db632fbca we'll continue to check for  
case 2 when we've already marked the partition as interleaved for case 1.  
Here we make it so we don't bother marking the partition as interleaved  
for case 2 when it's already been marked due to case 1.  
  
Really all this saves is a useless call to bms_add_member(), but since  
this code is new to PG15, it seems worth fixing it now to save anyone the  
trouble of complaining at some time in the future.  We have the  
opportunity to improve this now before PG15 is out.  This might ease some  
future back-patching pain.  
  
Per report and patch by Zhihong Yu.  However, I slightly revised the  
comments and altered the bms_add_member() code to match in both locations.  
We already know that index is equal to boundinfo->null_index from the if  
condition.  
  
Author: Zhihong Yu  
Discussion: https://postgr.es/m/CALNJ-vQbZR0pYxz9zQ5bqXVcwtGgNgVupeEpNT65HZ+yWZnc4g@mail.gmail.com  
Backpatch-through: 15, same as db632fbca.  

M src/backend/partitioning/partbounds.c

createuser: Add support for more clause types through new options

commit   : 08951a7c93cf0dd791ee6ac8a8cf5e4b152528e5    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Jul 2022 12:21:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Jul 2022 12:21:20 +0900    

Click here for diff

The following options are added to createuser:  
* --valid-until to generate a VALID UNTIL clause for the role created.  
* --bypassrls/--no-bypassrls for BYPASSRLS/NOBYPASSRLS.  
* -m/--member to make the new role a member of an existing role, with an  
extra ROLE clause generated.  The clause generated overlaps with  
-g/--role, but per discussion this was the most popular choice as option  
name.  
* -a/--admin for the addition of an ADMIN clause.  
  
These option names are chosen to be completely new, so as they do not  
impact anybody relying on the existing option set.  Tests are added for  
the new options and extended a bit, while on it, to cover more patterns  
where quotes are added to various elements of the query generated.  
  
Author: Shinya Kato  
Reviewed-by: Nathan Bossart, Daniel Gustafsson, Robert Haas, Kyotaro  
Horiguchi, David G. Johnston, Przemysław Sztoch  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/createuser.sgml
M src/bin/scripts/createuser.c
M src/bin/scripts/t/040_createuser.pl

Use list_copy_head() instead of list_truncate(list_copy(...), ...)

commit   : c23e3e6beb273ae8c0f8e616edb7ed1acb0271c4    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 15:03:47 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 15:03:47 +1200    

Click here for diff

Truncating off the end of a freshly copied List is not a very efficient  
way of copying the first N elements of a List.  
  
In many of the cases that are updated here, the pattern was only being  
used to remove the final element of a List.  That's about the best case  
for it, but there were many instances where the truncate trimming the List  
down much further.  
  
4cc832f94 added list_copy_head(), so let's use it in cases where it's  
useful.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/1986787.1657666922%40sss.pgh.pa.us  

M src/backend/catalog/objectaddress.c
M src/backend/commands/dropcmds.c
M src/backend/commands/sequence.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c

createuser: Cleanup and fix internal option ordering

commit   : 50e4c280f0661f3ef837d2c3beb5fcc100202324    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Jul 2022 11:29:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Jul 2022 11:29:02 +0900    

Click here for diff

This utility supports 23 options that are not really ordered in the  
code, making the addition of new things more complicated than necessary.  
This cleanup is in preparation for a patch to add even more options.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/createuser.c

Tidy up code in get_cheapest_group_keys_order()

commit   : 4cc832f94a583146fcf7886c9ce685894956d804    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 14:02:20 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 14:02:20 +1200    

Click here for diff

There are a few things that we could do a little better within  
get_cheapest_group_keys_order():  
  
1. We should be using list_free() rather than pfree() on a List.  
  
2. We should use for_each_from() instead of manually coding a for loop to  
skip the first n elements of a List  
  
3. list_truncate(list_copy(...), n) is not a great way to copy the first n  
elements of a list. Let's invent list_copy_head() for that.  That way we  
don't need to copy the entire list just to truncate it directly  
afterwards.  
  
4. We can simplify finding the cheapest cost by setting the cheapest cost  
variable to DBL_MAX.  That allows us to skip special-casing the initial  
iteration of the loop.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvrGyL3ft8waEkncG9y5HDMu5TFFJB1paoTC8zi9YK97Nw@mail.gmail.com  
Backpatch-through: 15, where get_cheapest_group_keys_order was added.  

M src/backend/nodes/list.c
M src/backend/optimizer/path/pathkeys.c
M src/include/nodes/pg_list.h

Fix ECPG's handling of type names that match SQL keywords.

commit   : 83f1c7b742e80d5aa15e6710ecb324e388d007b3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 17:05:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 17:05:46 -0400    

Click here for diff

Previously, ECPG could only cope with variable declarations whose  
type names either weren't any SQL keyword, or were at least partially  
reserved.  If you tried to use something in the unreserved_keyword  
category, you got a syntax error.  
  
This is pretty awful, not only because it says right on the tin that  
those words are not reserved, but because the set of such keywords  
tends to grow over time.  Thus, an ECPG program that was just fine  
last year could fail when recompiled with a newer SQL grammar.  
We had to work around this recently when STRING became a keyword,  
but it's time for an actual fix instead of a band-aid.  
  
To fix, borrow a trick from C parsers and make the lexer's behavior  
change when it sees a word that is known as a typedef.  This is not  
free of downsides: if you try to use such a name as a SQL keyword  
in EXEC SQL later in the program, it won't be recognized as a SQL  
keyword, leading to a syntax error there instead.  So in a real  
sense this is just trading one hazard for another.  But there is an  
important difference: with this, whether your ECPG program works  
depends only on what typedef names and SQL commands are used in the  
program text.  If it compiles today it'll still compile next year,  
even if more words have become SQL keywords.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/variable.c
M src/interfaces/ecpg/test/expected/preproc-type.c
M src/interfaces/ecpg/test/expected/preproc-type.stderr
M src/interfaces/ecpg/test/preproc/type.pgc

Invent qsort_interruptible().

commit   : e64cdab003027acef29e713087fb667e2319f679    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 16:30:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 16:30:36 -0400    

Click here for diff

Justin Pryzby reported that some scenarios could cause gathering  
of extended statistics to spend many seconds in an un-cancelable  
qsort() operation.  To fix, invent qsort_interruptible(), which is  
just like qsort_arg() except that it will also do CHECK_FOR_INTERRUPTS  
every so often.  This bloats the backend by a couple of kB, which  
seems like a good investment.  (We considered just enabling  
CHECK_FOR_INTERRUPTS in the existing qsort and qsort_arg functions,  
but there are some callers for which that'd demonstrably be unsafe.  
Opt-in seems like a better way.)  
  
For now, just apply qsort_interruptible() in statistics collection.  
There's probably more places where it could be useful, but we can  
always change other call sites as we find problems.  
  
Back-patch to v14.  Before that we didn't have extended stats on  
expressions, so that the problem was less severe.  Also, this patch  
depends on the sort_template infrastructure introduced in v14.  
  
Tom Lane and Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/analyze.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/sort/Makefile
A src/backend/utils/sort/qsort_interruptible.c
M src/include/port.h

Improve error reporting from validate_exec().

commit   : 920072339f304a7da0b5de966117420c96ad78cb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 15:37:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 15:37:39 -0400    

Click here for diff

validate_exec() didn't guarantee to set errno to something appropriate  
after a failure, leading to callers not being able to print an on-point  
message.  Improve that.  
  
Noted by Kyotaro Horiguchi, though this isn't exactly his proposal.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/exec.c
M src/common/exec.c

Remove trailing newlines in pg_upgrade's message strings.

commit   : 7652353d87a6753627a6b6b36d7acd68475ea7c7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 15:17:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 15:17:44 -0400    

Click here for diff

pg_upgrade does not use common/logging.c, which is unfortunate  
but changing it to do so seems like more work than is justified.  
However, we really need to make it work more like common/logging.c  
in one respect: the latter expects supplied message strings to not  
end with a newline, instead adding one internally.  As it stands,  
pg_upgrade's logging facilities expect a caller-supplied newline  
in some cases and not others, which is already an invitation to bugs,  
but the inconsistency with our other frontend code makes it worse.  
There are already several places with missing or extra newlines,  
and it's inevitable that there won't be more if we let this stand.  
  
Hence, run around and get rid of all trailing newlines in message  
strings, and add an Assert that there's not one, similar to the  
existing Assert in common/logging.c.  Adjust the logging functions  
to supply a newline at the right places.  
  
(Some of these strings also have a *leading* newline, which would  
be a good thing to get rid of too; but this patch doesn't attempt  
that.)  
  
There are some consequent minor changes in output.  The ones that  
aren't outright bug fixes are generally removal of extra blank  
lines that the original coding intentionally inserted.  It didn't  
seem worth being bug-compatible with that.  
  
Patch by me, reviewed by Kyotaro Horiguchi and Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c

Add defenses against unexpected changes in the NodeTag enum list.

commit   : eea9fa9b250f4044aa35d537f234c7d44fa9db3d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 11:22:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 11:22:52 -0400    

Click here for diff

Having different build systems producing different contents of the  
NodeTag enum would be catastrophic for extension ABI stability.  
But that ordering depends on the order in which gen_node_support.pl  
processes its input files.  It seems too fragile to let the Makefiles,  
MSVC build scripts, and soon meson build scripts all set this order  
independently.  As a klugy but serviceable solution, put a canonical  
copy of the file list into gen_node_support.pl itself, and check that  
against the files given on the command line.  
  
Also, while it's fine to add and delete node tags during development,  
we must not let the assigned NodeTag values change unexpectedly in  
stable branches.  Add a cross-check that can be enabled when a branch  
is forked off (or later, but that is a time when we're unlikely to  
miss doing it).  It just checks that the last auto-assigned number  
doesn't change, which is simplistic but will catch the most likely  
sorts of mistakes.  
  
From time to time we do need to add a node tag in a stable branch.  
To support doing that without changing the branch's auto-assigned  
tag numbers, invent pg_node_attr(nodetag_number(VALUE)) which can  
be used to give such a node a hand-assigned tag above the last  
auto-assigned one.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl
M src/include/nodes/nodes.h
M src/tools/RELEASE_CHANGES

Invent nodetag_only attribute for Nodes.

commit   : ca187d7455f174da40e26e6e0c8361821ee19559    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 10:46:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 10:46:58 -0400    

Click here for diff

This allows explaining gen_node_support.pl's handling of execnodes.h  
and some other input files as being a shortcut for explicit marking  
of all their node declarations as pg_node_attr(nodetag_only).  
I foresee that someday we might need to be more fine-grained about  
that, and this change provides the infrastructure needed to do so.  
For now, it just allows removal of the script's klugy special case  
for CallContext and InlineCodeBlock.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h

Rename some functions to mention Relation instead of RelFileLocator.

commit   : 09c5acee8ef90a9a94993dad937bdcd56ccaf1e3    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 12 Jul 2022 10:26:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 12 Jul 2022 10:26:48 -0400    

Click here for diff

This is definitely shorter, and hopefully clearer.  
  
Kyotaro Horiguchi, reviewed by Dilip Kumar and by me  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/smgr/smgr.c
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h

Add copy/equal support for XID lists

commit   : 5ca0fe5c8ad7987beee95669124c7e245f2816d8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Jul 2022 16:11:04 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Jul 2022 16:11:04 +0200    

Click here for diff

Commit f10a025cfe97 added support for List to store Xids, but didn't  
handle the new type in all cases.  Add some obviously necessary pieces.  
As far as I am aware, this is all dead code as far as core code is  
concerned, but it seems unacceptable not to have it in case third-party  
code wants to rely on this type of list.  (Some parts of the List API  
remain unimplemented, but that can be fixed as and when needed -- see  
lack of list_intersection_oid, list_deduplicate_int as precedents.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/test/modules/test_oat_hooks/test_oat_hooks.c

Fix out-of-bounds read in json_lex_string

commit   : d3117fc1a3e87717a57be0153408e5387e265e1b    
  
author   : John Naylor <[email protected]>    
date     : Tue, 12 Jul 2022 11:13:41 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 12 Jul 2022 11:13:41 +0700    

Click here for diff

Commit 3838fa269 added a lookahead loop to allow building strings multiple  
bytes at a time. This loop could exit because it reached the end of input,  
yet did not check for that before checking if we reached the end of a  
valid string. To fix, put the end of string check back in the outer loop.  
  
Per Valgrind animal skink  

M src/common/jsonapi.c

Support TRUNCATE triggers on foreign tables.

commit   : 3b00a944a9b3847fb02dae7c9ea62fe0b211b396    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 09:18:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 09:18:02 +0900    

Click here for diff

Now some foreign data wrappers support TRUNCATE command.  
So it's useful to support TRUNCATE triggers on foreign tables for  
audit logging or for preventing undesired truncation.  
  
Author: Yugo Nagata  
Reviewed-by: Fujii Masao, Ian Lawrence Barwick  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/ref/create_trigger.sgml
M src/backend/commands/trigger.c

Doc: Acknowledge historically supported CPUs and OSes.

commit   : 14168d3c62fa90f1ec447f873f0e4df16a57a717    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 12 Jul 2022 10:57:52 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 12 Jul 2022 10:57:52 +1200    

Click here for diff

PostgreSQL/POSTGRES has run on a huge range of CPUs and OSes.  As we're  
dropping some of the earliest systems the project was founded on, let's  
provide a place to remember them.  
  
Discussion: https://postgr.es/m/959917.1657522169%40sss.pgh.pa.us  

M doc/src/sgml/installation.sgml

Further tidy-up for old CPU architectures.

commit   : 718aa43a4ee613bf85afadb1596f861e1228ca43    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 12 Jul 2022 10:53:45 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 12 Jul 2022 10:53:45 +1200    

Click here for diff

Further to commit 92d70b77, let's drop the code we carry for the  
following untested architectures: M68K, M88K, M32R, SuperH.  We have no  
idea if anything actually works there, and surely as vintage hardware  
and microcontrollers they would be underpowered for modern purposes.  
  
We could always consider re-adding SuperH based on evidence of usage and  
build farm support, if someone shows up to provide it.  
  
While here, SPARC is usually written in all caps.  
  
Suggested-by: Tom Lane <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Robert Haas <[email protected]> (the idea, not the patch)  
Discussion: https://postgr.es/m/959917.1657522169%40sss.pgh.pa.us  

M doc/src/sgml/installation.sgml
M src/backend/storage/lmgr/s_lock.c
M src/include/storage/s_lock.h

Provide log_status_format(), useful for an emit_log_hook.

commit   : b40baa96a7ad789718dcf59b1dd73bae15c3a7e1    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 11 Jul 2022 12:29:33 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 11 Jul 2022 12:29:33 -0700    

Click here for diff

Refactor so that log_line_prefix() is a thin wrapper over a new  
function log_status_format(), and move the implementation to the  
latter. Export log_status_format() so that it can be used by an  
emit_log_hook.  
  
Discussion: https://postgr.es/m/39c8197652f4d3050aedafae79fa5af31096505f.camel%40j-davis.com  
Reviewed-by: Michael Paquier, Alvaro Herrera  

M src/backend/utils/error/elog.c
M src/include/utils/elog.h

Rationalize order of input files for gen_node_support.pl.

commit   : bf022d337ef096c79e6a0b51f0b42e69749ae210    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Jul 2022 13:38:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Jul 2022 13:38:40 -0400    

Click here for diff

Per a question from Andres Freund.  While here, also make the  
list of nodetag-only files easier to compare to the full list  
of input files.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/Makefile
M src/backend/nodes/gen_node_support.pl
M src/tools/msvc/Solution.pm

Fix mistake in comment.

commit   : b2d5b4c6e09b2a505ced098d2cb1e7b015bfc50d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 11 Jul 2022 13:32:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 11 Jul 2022 13:32:23 -0400    

Click here for diff

Kyotaro Horiguchi  
  
Discussion: http://postgr.es/m/[email protected]  

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

Convert macros to static inline functions (bufpage.h)

commit   : 2cd2569c72b8920048e35c31c9be30a6170e1410    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jul 2022 07:20:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Jul 2022 07:20:35 +0200    

Click here for diff

Remove PageIsValid() and PageSizeIsValid(), which weren't used and  
seem unnecessary.  
  
Some code using these formerly-macros needs some adjustments because  
it was previously playing loose with the Page vs. PageHeader types,  
which is no longer possible with the functions instead of macros.  
  
Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com  

M contrib/pageinspect/rawpage.c
M src/backend/storage/page/bufpage.c
M src/bin/pg_checksums/pg_checksums.c
M src/include/storage/bufpage.h
M src/include/storage/checksum_impl.h

Fix lock assertions in dshash.c.

commit   : eed959a457ea0ffb042f4881e23358ba145d148c    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 11 Jul 2022 14:47:16 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 11 Jul 2022 14:47:16 +1200    

Click here for diff

dshash.c previously maintained flags to be able to assert that you  
didn't hold any partition lock.  These flags could get out of sync with  
reality in error scenarios.  
  
Get rid of all that, and make assertions about the locks themselves  
instead.  Since LWLockHeldByMe() loops internally, we don't want to put  
that inside another loop over all partition locks.  Introduce a new  
debugging-only interface LWLockAnyHeldByMe() to avoid that.  
  
This problem was noted by Tom and Andres while reviewing changes to  
support the new shared memory stats system, and later showed up in  
reality while working on commit 389869af.  
  
Back-patch to 11, where dshash.c arrived.  
  
Reported-by: Tom Lane <[email protected]>  
Reported-by: Andres Freund <[email protected]>  
Reviewed-by: Kyotaro HORIGUCHI <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CA%2BhUKGJ31Wce6HJ7xnVTKWjFUWQZPBngxfJVx4q0E98pDr3kAw%40mail.gmail.com  

M src/backend/lib/dshash.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Build de-escaped JSON strings in larger chunks during lexing

commit   : 3838fa269c15706df2b85ce2d6af8aacd5611655    
  
author   : John Naylor <[email protected]>    
date     : Fri, 1 Jul 2022 17:28:20 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 1 Jul 2022 17:28:20 +0700    

Click here for diff

During COPY BINARY with large JSONB blobs, it was found that half  
the time was spent parsing JSON, with much of that spent in separate  
appendStringInfoChar() calls for each input byte.  
  
Add lookahead loop to json_lex_string() to allow batching multiple bytes  
via appendBinaryStringInfo(). Also use this same logic when de-escaping  
is not done, to avoid code duplication.  
  
Report and proof of concept patch by Jelte Fennema, reworked by Andres  
Freund and John Naylor  
  
Discussion: https://www.postgresql.org/message-id/CAGECzQQuXbies_nKgSiYifZUjBk6nOf2%3DTSXqRjj2BhUh8CTeA%40mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/flat/PR3PR83MB0476F098CBCF68AF7A1CA89FF7B49@PR3PR83MB0476.EURPRD83.prod.outlook.com  

M src/common/jsonapi.c

Fix two portability issues with the tests of test_oat_hooks

commit   : a6434b951558baad8372dc4b83bf87606dac9cda    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 12:47:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 12:47:52 +0900    

Click here for diff

This addresses two issues in the tests of test_oat_hooks:  
- The role regress_test_user was being left behind, preventing the test  
to succeed on repeated runs.  It makes sense to leave some objects  
behind to have more coverage for pg_upgrade (as does test_pg_dump), but  
the role dropped here does not own any objects so there is no reason to  
keep it.  
- GRANT SET ON PARAMETER is issued, creating an entry in  
pg_parameter_acl without cleaning up the entry created.  This causes  
an overlap with unsafe_tests as both use work_mem, making the latter  
fail.  This commit adds an extra REVOKE SET ON PARAMETER to clean the  
contents of pg_parameter_acl, switching to maintenance_work_mem rather  
than work_mem to avoid an overlap between both tests.  
  
The tests of test_oat_hooks cannot use installcheck yet as these are  
proving to be unstable with caching and the namespace search hooks, so  
the issues fixed here cannot be reached yet, but they would be once the  
hook issue is addressed and installcheck is allowed again in  
test_oat_hooks.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql

Improve error message with JSON_SERIALIZE()

commit   : 0a6be1f0ec3cc9b98453bdab2d4edcfd5a00c7fa    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 11:20:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 11:20:15 +0900    

Click here for diff

The error message introduced in 3c633f3 can share the same format string  
with an existing message used for JSON(), reducing the translation  
effort.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

commit   : 8445f5a21d40b969673ca03918c74b4fbc882bf4    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 11:07:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 11:07:33 +0900    

Click here for diff

The original comments mentioned a "parameter" as something not defined  
in a fast-exit path to assume a true status.  This is rather confusing  
as the parameter DefElem is defined, and the intention is to check if  
its value is defined.  This improves both comments to mention the value  
assigned to the DefElem's value instead, so as future patches are able  
to catch the tweak if this code pattern gets copied around more.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pv0yWynWTmp4o34s0d98xVubys9fy=p0YXsZ5_sUcNnMw@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/commands/define.c

doc: Fix inconsistent quotes in some jsonb fields

commit   : 1cd182163061f0c8619eaf79dc077ef78a81a13b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 10:56:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 10:56:17 +0900    

Click here for diff

Single quotes are not allowed in json internals, double quotes are.  
  
Reported-by: Eric Mutta  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M doc/src/sgml/json.sgml

Tidy up claimed supported CPUs and OSes.

commit   : 92d70b77ebb45ec43c163d7ebfe7a3c613c24621    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 11 Jul 2022 11:50:41 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 11 Jul 2022 11:50:41 +1200    

Click here for diff

 * Remove arbitrary mention of certain endianness and bitness variants;  
   it's enough to say that applicable variants are expected to work.  
 * List RISC-V (known to work, being tested).  
 * List SuperH and M88K (code exists, unknown status, like M68K).  
 * De-list VAX and remove code (known not to work).  
 * Remove stray trace of Alpha (support was removed years ago).  
 * List illumos, DragonFlyBSD (known to work, being tested).  
 * No need to single Windows out by listing a specific version, when we  
   don't do that for other OSes; it's enough to say that we support  
   current versions of the listed OSes (when 16 ships, that'll be  
   Windows 10+).  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Greg Stark <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKk7NZO1UnJM0PyixcZPpCGqjBXW_0bzFZpJBGAf84XKg%40mail.gmail.com  

M contrib/pgcrypto/crypt-blowfish.c
M doc/src/sgml/installation.sgml
M src/include/storage/s_lock.h

Fix \watch's interaction with libedit on ^C.

commit   : 21267b64771925c154a767b1f261b5501d7bb26f    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 10 Jul 2022 16:30:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 10 Jul 2022 16:30:03 +1200    

Click here for diff

When you hit ^C, the terminal driver in Unix-like systems echoes "^C" as  
well as sending an interrupt signal (depending on stty settings).  At  
least libedit (but maybe also libreadline) is then confused about the  
current cursor location, and corrupts the display if you try to scroll  
back.  Fix, by moving to a new line before the next prompt is displayed.  
  
Back-patch to all supported released.  
  
Author: Pavel Stehule <[email protected]>  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/3278793.1626198638%40sss.pgh.pa.us  

M src/bin/psql/command.c

Exclude nodetags.h from headerscheck and cpluspluscheck.

commit   : 301b06dd754007546305030683f439f675e40214    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 19:25:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 19:25:53 -0400    

Click here for diff

Since this file contains just a fragment of an enum declaration,  
it can't be compiled on its own.  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Make assorted quality-of-life improvements in gen_node_support.pl.

commit   : 8eccaf65254225921d6fd1f3bfa23e8a0b1f6bbb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 15:15:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 15:15:05 -0400    

Click here for diff

Fix incorrect reporting of the location of errors (such as bogus  
node attributes).  Add header comments to the generated files,  
containing copyright notices and reminders that they are generated  
files, as we do in other file-generating scripts.  Arrange to not  
leave a clutter of temporary files when the script detects an error.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/gen_node_support.pl

Doc: rearrange high-level commentary about node support coverage.

commit   : 3cd0ac987819280eb8dd3e0997f0294b8bc6355a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 15:10:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 15:10:15 -0400    

Click here for diff

copyfuncs.c and friends no longer seem like great places to put  
high-level remarks about what's covered and what isn't.  Move that  
material to backend/nodes/README and other more-prominent places.  
Add back (versions of) some remarks that disappeared in 2be87f092.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/README
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/nodes/execnodes.h

Mark Scan as an abstract node type, too.

commit   : 8c73c11a0d39049de2c1f400d8765a0eb21f5228    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 13:58:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 13:58:06 -0400    

Click here for diff

On further review, this one is never instantiated either.  

M src/include/nodes/plannodes.h
M src/test/modules/test_oat_hooks/test_oat_hooks.c

Mark PlanState as an abstract node type.

commit   : b4f79d278f2a78a65ff020b4e8cfa46a2587091d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 13:35:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Jul 2022 13:35:37 -0400    

Click here for diff

In the same vein as commit 251154beb, make it clear that we never  
instantiate PlanState.  
  
Also mark MemoryContextData as abstract.  This has no effect right now,  
since memnodes.h isn't one of the files fed to gen_node_support.pl.  
But it seems like good documentation and future-proofing.  

M src/include/nodes/execnodes.h
M src/include/nodes/memnodes.h
M src/test/modules/test_oat_hooks/test_oat_hooks.c

Remove code sections obsoleted by node support automation

commit   : 2be87f092a2ac786264b2020797aafa837de5a8e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 15:06:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 15:06:01 +0200    

Click here for diff

This removes the code sections that were ifdef'ed out by  
964d01ae90c314eb31132c2e7712d5d9fc237331.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/nodes/nodes.h

Move a comment

commit   : 3e44aee3cea426e331c5cec6452b52bf8dd25e19    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 13:22:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 13:22:46 +0200    

Click here for diff

Move a comment from the to-be-deleted section of nodes.h to where it  
might still be useful.  

M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h

Add generated nodes\nodetags.h to clean.bat

commit   : ec156cf974775914d8da942504b7282d124a594b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 10:20:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 10:20:54 +0200    

Click here for diff

M src/tools/msvc/clean.bat

Install generated nodes/nodetags.h

commit   : 3e79b7e8ee8852137bf0240ed15d6ffb655322a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 10:20:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 10:20:23 +0200    

Click here for diff

M src/include/Makefile

Fix vpath build

commit   : c842736006b1ca6f719f2fd2bd07f8edae42f684    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 09:44:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 09:44:09 +0200    

Click here for diff

M src/backend/nodes/Makefile

Automatically generate node support functions

commit   : 964d01ae90c314eb31132c2e7712d5d9fc237331    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 08:52:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Jul 2022 08:52:19 +0200    

Click here for diff

Add a script to automatically generate the node support functions  
(copy, equal, out, and read, as well as the node tags enum) from the  
struct definitions.  
  
For each of the four node support files, it creates two include files,  
e.g., copyfuncs.funcs.c and copyfuncs.switch.c, to include in the main  
file.  All the scaffolding of the main file stays in place.  
  
I have tried to mostly make the coverage of the output match what is  
currently there.  For example, one could now do out/read coverage of  
utility statement nodes, but I have manually excluded those for now.  
The reason is mainly that it's easier to diff the before and after,  
and adding a bunch of stuff like this might require a separate  
analysis and review.  
  
Subtyping (TidScan -> Scan) is supported.  
  
For the hard cases, you can just write a manual function and exclude  
generating one.  For the not so hard cases, there is a way of  
annotating struct fields to get special behaviors.  For example,  
pg_node_attr(equal_ignore) has the field ignored in equal functions.  
  
(In this patch, I have only ifdef'ed out the code to could be removed,  
mainly so that it won't constantly have merge conflicts.  It will be  
deleted in a separate patch.  All the code comments that are worth  
keeping from those sections have already been moved to the header  
files where the structs are defined.)  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce%40enterprisedb.com  

M src/backend/Makefile
A src/backend/nodes/.gitignore
M src/backend/nodes/Makefile
M src/backend/nodes/README
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
A src/backend/nodes/gen_node_support.pl
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/Makefile
M src/include/catalog/catversion.h
M src/include/executor/tuptable.h
A src/include/nodes/.gitignore
M src/include/nodes/extensible.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/value.h
M src/include/utils/rel.h
M src/tools/msvc/Solution.pm
M src/tools/pgindent/exclude_file_patterns

doc: add examples for array_length() and jsonb_array_length()

commit   : 2373fe78dfc9d4aa2348a86fffdf8eb9d757e9d5    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 8 Jul 2022 20:23:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 8 Jul 2022 20:23:35 -0400    

Click here for diff

The examples show the output of array_length() and jsonb_array_length()  
for empty arrays.  
  
Discussion: https://postgr.es/m/CAKFQuwaoBmRuWdMLzLHDCFDJDX3wvfQ7egAF0bpik_BFgG1KWg@mail.gmail.com  
  
Author: David G. Johnston  
  
Backpatch-through: 13  

M doc/src/sgml/func.sgml

doc: add pg_prewarm example

commit   : aa31b29375b9afbe1330d7726855645ff82a2e51    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 8 Jul 2022 18:36:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 8 Jul 2022 18:36:27 -0400    

Click here for diff

Discussion: https://postgr.es/m/20220618085541.ezxdaljlpo6x7msc@home-desktop  
  
Author: Dong Wook Lee  
  
Backpatch-through: 11  

M doc/src/sgml/pgprewarm.sgml

Add missing inequality searches to rbtree

commit   : e57519a4637a8d88ae993ac1273d2b59d03a0f75    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 8 Jul 2022 21:51:26 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 8 Jul 2022 21:51:26 +0300    

Click here for diff

PostgreSQL contains the implementation of the red-black tree.  The red-black  
tree is the ordered data structure, and one of its advantages is the ability  
to do inequality searches.  This commit adds rbt_find_less() and  
rbt_find_great() functions implementing these searches.  While these searches  
aren't yet used in the core code, they might be useful for extensions.  
  
Discussion: https://postgr.es/m/CAGRrpzYE8-7GCoaPjOiL9T_HY605MRax-2jgTtLq236uksZ1Sw%40mail.gmail.com  
Author: Steve Chavez, Alexander Korotkov  
Reviewed-by: Alexander Korotkov  

M src/backend/lib/rbtree.c
M src/include/lib/rbtree.h
M src/test/modules/test_rbtree/test_rbtree.c

Use C99 designator in the rbtree sentinel definition

commit   : 8d51d7f403c209ab4d5db203f5e350f6c71233ca    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 8 Jul 2022 21:51:00 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 8 Jul 2022 21:51:00 +0300    

Click here for diff

This change should improve the code readability.  
  
Discussion: https://postgr.es/m/CAGRrpzYE8-7GCoaPjOiL9T_HY605MRax-2jgTtLq236uksZ1Sw%40mail.gmail.com  
Author: Steve Chavez, Alexander Korotkov  
Reviewed-by: Alexander Korotkov  

M src/backend/lib/rbtree.c

Preserve relfilenode of pg_largeobject and its index across pg_upgrade.

commit   : d498e052b4b84ae21b3b68d5b3fda6ead65d1d4d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Jul 2022 10:15:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Jul 2022 10:15:19 -0400    

Click here for diff

Commit 9a974cbcba005256a19991203583a94b4f9a21a9 did this for user  
tables, but pg_upgrade treats pg_largeobject as a user table, and so  
needs the same treatment. Without this fix, if you rewrite the  
pg_largeobject table and then perform an upgrade with pg_upgrade, the  
table will apparently be empty on the new cluster, while all of your  
objects will end up with an orphaned file.  
  
With this fix, instead of the old cluster's pg_largeobject files ending  
up orphaned, the original files fro the new cluster do. That's mostly  
harmless because we expect the table to be empty, but we might want  
to arrange to remove the as part of the upgrade. Since we're still  
debating the best way of doing that, I (rhaas) have decided to postpone  
dealing with that problem and get the basic fix committed.  
  
Justin Pryzby, reviewed by Shruthi Gowda and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Adjust node serialization tag of A_Expr for consistency

commit   : bf1f4a364d6c72cc5c39a6d81d156a0335fdf332    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Jul 2022 11:03:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Jul 2022 11:03:45 +0200    

Click here for diff

Changed from AEXPR to A_EXPR for consistency.  
  
Discussion: https://www.postgresql.org/message-id/2592455.1657140387%40sss.pgh.pa.us  

M src/backend/nodes/outfuncs.c

Remove T_Join and T_Plan

commit   : 251154bebe98ca5d3487ccbe0dceb7f412b57934    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Jul 2022 10:38:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Jul 2022 10:38:02 +0200    

Click here for diff

These are abstract node types that don't need to have a node tag  
defined.  
  
Discussion: https://www.postgresql.org/message-id/2592455.1657140387%40sss.pgh.pa.us  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h
M src/include/nodes/nodes.h
M src/test/modules/test_oat_hooks/test_oat_hooks.c

Simplify json lexing state

commit   : 3de359f18f2bfbc96272bd265264aa5c2f247ca4    
  
author   : John Naylor <[email protected]>    
date     : Fri, 8 Jul 2022 14:53:20 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 8 Jul 2022 14:53:20 +0700    

Click here for diff

Instead of updating the length as we go, use a const pointer to end of  
the input, which we know already at the start.  
  
This simplifies the coding and may improve performance slightly, but  
the real motivation for doing this is to make further changes in this  
area easier to reason about.  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsGhaR2KQ5eisaK%3D6Vm60t%3DaxhD8Ckj1qFoCH1pktZi%2B2w%40mail.gmail.com  

M src/common/jsonapi.c

Reformat some more node comments

commit   : 3140f089855c03035ee354aa115618068f8d0206    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Jul 2022 09:22:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Jul 2022 09:22:27 +0200    

Click here for diff

Reformat some more comments in node field definitions to avoid long  
lines.  Similar to 835d476fd21bcfb60b055941dee8c3d9559af14c, based on  
additional per-field annotations that will be required.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/nodes/pathnodes.h
M src/include/utils/rel.h

Remove HP/Intel Itanium support.

commit   : 0ad5b48e58945e88b71eb5932d0c003a95def6ea    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 8 Jul 2022 11:21:46 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 8 Jul 2022 11:21:46 +1200    

Click here for diff

This CPU architecture has been discontinued.  We already removed HP-UX  
support, we never supported Windows/Itanium, and the open source  
operating systems that a vintage hardware owner might hope to run have  
all either ended Itanium support or never fully released support (NetBSD  
may eventually).  The extra code we carry for this rare ISA is now  
untested.  It seems like a good time to remove it.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/1415825.1656893299%40sss.pgh.pa.us  

M doc/src/sgml/installation.sgml
M src/backend/tcop/postgres.c
M src/include/miscadmin.h
M src/include/port/atomics.h
D src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/generic-msvc.h
M src/include/storage/s_lock.h
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Remove HP-UX port.

commit   : 9db300ce6e38411144f1e36dba345a5f91bbdee4    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 8 Jul 2022 11:17:47 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 8 Jul 2022 11:17:47 +1200    

Click here for diff

HP-UX hardware is no longer produced, build farm coverage recently  
ended, and there are no known active maintainers targeting this OS.  
Since there is a major rewrite of the build system in the pipeline for  
PostgreSQL 16, and that requires development, testing and maintainance  
for each OS and tool chain, it seems like a good time to drop support  
for:  
  
 * HP-UX, the operating system.  
 * HP aCC, the HP-UX native compiler.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/1415825.1656893299%40sss.pgh.pa.us  

M configure
M configure.ac
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/regress.sgml
M doc/src/sgml/runtime.sgml
M src/Makefile.shlib
M src/backend/libpq/ifaddr.c
D src/backend/port/hpux/tas.c.template
D src/backend/port/tas/hpux_hppa.s
M src/backend/tcop/postgres.c
M src/backend/utils/misc/ps_status.c
M src/include/pg_config.h.in
M src/include/port/atomics.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/fallback.h
D src/include/port/atomics/generic-acc.h
D src/include/port/hpux.h
M src/include/storage/s_lock.h
D src/makefiles/Makefile.hpux
M src/pl/plperl/ppport.h
M src/port/dlopen.c
M src/port/getrusage.c
D src/template/hpux
M src/test/regress/resultmap
M src/tools/msvc/Solution.pm
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Only allow returning string types or bytea from json_serialize

commit   : 3c633f32b9c712cc0b4c8d946f0eeae04a3ff51a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 7 Jul 2022 17:40:02 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 7 Jul 2022 17:40:02 -0400    

Click here for diff

These are documented to be the allowed types for the RETURNING clause,  
but the restriction was not being enforced, which caused a segfault if  
another type was specified. Add some testing for this.  
  
Per report from a.kozhemyakin  
  
Backpatch to release 15.  

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

Remove stray references to lefttree/righttree in the executor.

commit   : 88210542106de5b26fe6aa088d1811b68502d224    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Jul 2022 11:23:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Jul 2022 11:23:40 -0400    

Click here for diff

The general convention in the executor is to refer to child plans  
and planstates via the outerPlan[State] and innerPlan[State]  
macros, but a few places didn't do it like that.  For consistency  
and readability, convert all the stragglers to use the macros.  
(See also commit 40f42d2a3, which did some similar cleanup a few  
years ago, but missed these cases.)  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4-vYhh1xsa_veah4PUed2Xq=Ed_YH3=Mqt5A3Y=EgfCEg@mail.gmail.com  

M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeUnique.c

Add checkpoint and REDO LSN to log_checkpoints message.

commit   : 62c46eee2279eb0300ab7ffe393d0d0dcfafb157    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 7 Jul 2022 22:37:54 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 7 Jul 2022 22:37:54 +0900    

Click here for diff

It is useful for debugging purposes to report the checkpoint LSN and  
REDO LSN in log_checkpoints message. It can give more context while  
analyzing checkpoint-related issues. pg_controldata reports the last  
checkpoint LSN and REDO LSN, but having this information alongside  
the log message helps analyze issues that happened previously,  
connect the dots and identify the root cause.  
  
Author: Bharath Rupireddy, Kyotaro Horiguchi  
Reviewed-by: Michael Paquier, Julien Rouhaud, Nathan Bossart, Fujii Masao, Greg Stark  
Discussion: https://postgr.es/m/CALj2ACWt6kqriAHrO+AJj+OmP=suwbktHT5JoYAn-nqZe2gd2g@mail.gmail.com  

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

Fix alias matching in transformLockingClause().

commit   : 8d367a44d34bbcaca4a894db2b3de741795141b7    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 7 Jul 2022 13:08:08 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 7 Jul 2022 13:08:08 +0100    

Click here for diff

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE  
clause, transformLockingClause() finds the relation to lock by  
scanning the rangetable for an RTE with a matching eref->aliasname.  
However, it failed to account for the visibility rules of a join RTE.  
  
If a join RTE doesn't have a user-supplied alias, it will have a  
generated eref->aliasname of "unnamed_join" that is not visible as a  
relation name in the parse namespace. Such an RTE needs to be skipped,  
otherwise it might be found in preference to a regular base relation  
with a user-supplied alias of "unnamed_join", preventing it from being  
locked.  
  
In addition, if a join RTE doesn't have a user-supplied alias, but  
does have a join_using_alias, then the RTE needs to be matched using  
that alias rather than the generated eref->aliasname, otherwise a  
misleading "relation not found" error will be reported rather than a  
"join cannot be locked" error.  
  
Backpatch all the way, except for the second part which only goes back  
to 14, where JOIN USING aliases were added.  
  
Dean Rasheed, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com  

M src/backend/parser/analyze.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

postgres_fdw: Fix grammar.

commit   : 82699edbfe75534b3b6f6f4321339a432b7b8ff2    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 7 Jul 2022 16:25:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 7 Jul 2022 16:25:00 +0900    

Click here for diff

Oversight in commit 4036bcbbb; back-patch to v15 where that appeared.  

M contrib/postgres_fdw/connection.c

Convert macros to static inline functions (block.h)

commit   : d63d957e330c611f7a8c0ed02e4407f40f975026    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Jul 2022 08:30:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Jul 2022 08:30:52 +0200    

Click here for diff

Remove BlockIdIsValid(), which wasn't used and is unnecessary.  
  
Remove BlockIdCopy(), which wasn't used and can be done by struct  
assignment.  
  
(BlockIdEquals() also isn't used, but seems reasonable to keep  
around.)  
  
Reviewed-by: Amul Sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com  

M src/include/storage/block.h

Make Windows 10 the minimal runtime requirement for WIN32

commit   : 495ed0ef2d72a6a74def296e042022479d5d07bd    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Jul 2022 13:25:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Jul 2022 13:25:45 +0900    

Click here for diff

This commit bumps the runtime value of _WIN32_WINNT to be 0x0A00 for any  
builds on Windows.  Hence, this makes Windows 10 the minimal requirement  
when running PostgreSQL under WIN32, be it for builds of Cygwin, MinGW  
or Visual Studio.  
  
The previous minimal runtime version was either Windows Vista when  
building with at least Visual Studio 2015 or Windows XP for the rest.  
  
Windows 10 is the most modern version supported by Microsoft, and per  
discussion, as we don't have buildfarm members that run older versions  
anymore, this is the minimal supported version that suits better for our  
needs.  This will actually make easier the development of some patches,  
two being async I/O and large page handling by avoiding a lot of  
compatibility gotchas, on platforms that have most likely few users  
anyway.  
  
It is possible to remove MIN_WINNT in win32.h and the macros  
IsWindowsXXXOrGreater() that were used in the code at runtime to check  
which version of Windows was getting used.  The change in pg_locale.c  
comes from Juan.  Note that all my tests passed, and that the CI is  
green.  The buildfarm will quickly tell if this needs more adjustments.  
  
Author: Michael Paquier, Juan José Santamaría Flecha  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/backend/main/main.c
M src/backend/utils/adt/pg_locale.c
M src/bin/pg_ctl/pg_ctl.c
M src/include/port/win32.h

Re-order disable_on_error in tab-complete.

commit   : d547f7cf5efc531be8587641a5682cc46b37bc81    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 7 Jul 2022 09:00:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 7 Jul 2022 09:00:27 +0530    

Click here for diff

By convention, the tab-complete subscription parameters are listed in the  
COMPLETE_WITH lists in alphabetical order, but when the "disable_on_error"  
parameter was introduced this was not done.  
  
This patch just tidies that up.  
  
Reported-by: Peter Smith  
Author: Peter Smith  
Reviewed-by: Euler Taveira, Takamichi Osumi  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAHut+PucvKZgg_eJzUW--iL6DXHg1Jwj6F09tQziE3kUF67uLg@mail.gmail.com  

M src/bin/psql/tab-complete.c

Clean up some includes and comments in TAP test scripts

commit   : 1409eade9f206baebbe9ed7e18cc9ef2979c6594    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Jul 2022 10:13:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Jul 2022 10:13:01 +0900    

Click here for diff

A few tests included File::Path::rmtree without using it, and a comment  
related to the segment size for replication slot limits was wrong.  
  
Author: Pavel Borisov, Bharath Rupireddy  
Reviewed-by: Maxim Orlov  
Discussion: https://postgr.es/m/CALj2ACU4-aNLX=DrUM8F7QDwynJKzYRiqOj_33NhnGbhDs5-kQ@mail.gmail.com  

M src/bin/pg_verifybackup/t/007_wal.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/019_replslot_limit.pl

pgstat: slru: remove outdated comment

commit   : f4d3ca421d9c67d55e527f74dde515d7f87996de    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 15:50:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 15:50:38 -0700    

Click here for diff

That comment might have been true at some point during development, but  
definitely isn't anymore.  
  
Reported-By: Melanie Plageman <[email protected]>  
Backpatch: 15-  

M src/backend/utils/activity/pgstat_slru.c

Fix wrong field order in _readMergeWhenClause().

commit   : 55b8ac81723c45dca95d4ad4892a1ee28db37c23    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Jul 2022 17:26:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Jul 2022 17:26:27 -0400    

Click here for diff

We hadn't noticed this because it's dead code: there is no  
situation where we read raw parse trees from text format.  
So maybe the right fix is to remove the function altogether,  
but I'll forbear for now; it's not the only dead code in  
readfuncs.c, I think.  
  
Noted while comparing existing code to the results of  
Peter's auto-generation script.  

M src/backend/nodes/readfuncs.c

Overload index_form_tuple to allow the memory context to be supplied

commit   : 0229106afab93e9868e758f4b555daafcfac4b75    
  
author   : David Rowley <[email protected]>    
date     : Thu, 7 Jul 2022 08:14:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 7 Jul 2022 08:14:00 +1200    

Click here for diff

40af10b57 changed things so we make use of a generation memory context for  
storing tuples to be sorted by tuplesort.c. That change does not play  
nicely with the changes made in 9f03ca915 (back in 2014). That commit  
changed things so that index_form_tuple() is called while switched into  
the tuplestore's tuplecontext. In order to fetch the tuple from the index,  
index_form_tuple() must do various memory allocations which are unrelated  
to the storage of the final returned tuple. Although all of these  
allocations are pfree'd, the fact that we now use a generation context  
means that the memory for these pfree'd allocations won't be used again by  
any other allocation due to generation.c's lack of freelists.  This could  
result in sorts used for building indexes exceeding maintenance_work_mem  
by a very large amount.  
  
Here we fix it so we no longer allocate anything apart from the tuple  
itself into the generation context by adding a new version of  
index_form_tuple named index_form_tuple_context, which can be called to  
specify the MemoryContext to allocate the tuple into.  
  
Discussion: https://postgr.es/m/CAApHDvrHQkiFRHiGiAS-LMOvJN-eK-s762=tVzBz8ZqUea-a_A@mail.gmail.com  
Backpatch-through: 15, where 40af10b57 was added.  

M src/backend/access/common/indextuple.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/itup.h

pg_stat_statements: Fix test that assumes wal_records = rows.

commit   : 2d7ead85267cc0a41ea4e94ee0ac144d5214d353    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 6 Jul 2022 13:05:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 6 Jul 2022 13:05:51 -0400    

Click here for diff

It's not very robust to assume that each inserted row will produce  
exactly one WAL record and that no other WAL records will be generated  
in the process, because for example a particular transaction could  
always be the one that has to extend clog.  
  
Because these tests are not run by 'make installcheck' but only by  
'make check', it may be that in our current testing infrastructure  
this can't be hit, but it doesn't seem like a good idea to rely on  
that, since unrelated changes to the regression tests or the way  
write-ahead logging is done could easily cause it to start happening,  
and debugging such failures is a pain.  
  
Adjust the regression test to be less sensitive.  
  
Anton Melnikov, reviewed by Julien Rouhaud  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/sql/pg_stat_statements.sql

pgstat: drop subscription stats without slot as well, fix comment

commit   : 7b64e4b3fa04769b725306a75bf3dd26e5a854fa    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 08:53:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 08:53:25 -0700    

Click here for diff

There's no reason anymore to only drop subscription stats if associated with a  
slot, now that stats drops are transactional. And since there's now no other  
cleanup of stats, this would lead to stats for slot-less subscriptions to get  
leaked (however most slot-less subs won't have stats).  
  
Additionally, the comment referring to autovacuum cleaning up stats was  
clearly outdated.  
  
Author: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoAwiby3HeJE7vJe16Gr75RFfJ640dyHqvsiUhyKJTXPtw@mail.gmail.com  
Backpatch: 15-  

M src/backend/commands/subscriptioncmds.c

Change internal RelFileNode references to RelFileNumber or RelFileLocator.

commit   : b0a55e43299c4ea2a9a8c757f9c26352407d0ccc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 6 Jul 2022 11:39:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 6 Jul 2022 11:39:09 -0400    

Click here for diff

We have been using the term RelFileNode to refer to either (1) the  
integer that is used to name the sequence of files for a certain relation  
within the directory set aside for that tablespace/database combination;  
or (2) that value plus the OIDs of the tablespace and database; or  
occasionally (3) the whole series of files created for a relation  
based on those values. Using the same name for more than one thing is  
confusing.  
  
Replace RelFileNode with RelFileNumber when we're talking about just the  
single number, i.e. (1) from above, and with RelFileLocator when we're  
talking about all the things that are needed to locate a relation's files  
on disk, i.e. (2) from above. In the places where we refer to (3) as  
a relfilenode, instead refer to "relation storage".  
  
Since there is a ton of SQL code in the world that knows about  
pg_class.relfilenode, don't change the name of that column, or of other  
SQL-facing things that derive their name from it.  
  
On the other hand, do adjust closely-related internal terminology. For  
example, the structure member names dbNode and spcNode appear to be  
derived from the fact that the structure itself was called RelFileNode,  
so change those to dbOid and spcOid. Likewise, various variables with  
names like rnode and relnode get renamed appropriately, according to  
how they're being used in context.  
  
Hopefully, this is clearer than before. It is also preparation for  
future patches that intend to widen the relfilenumber fields from its  
current width of 32 bits. Variables that store a relfilenumber are now  
declared as type RelFileNumber rather than type Oid; right now, these  
are the same, but that can now more easily be changed.  
  
Dilip Kumar, per an idea from me. Reviewed also by Andres Freund.  
I fixed some whitespace issues, changed a couple of words in a  
comment, and made one other minor correction.  
  
Discussion: http://postgr.es/m/CA+TgmoamOtXbVAQf9hWFzonUo6bhhjS6toZQd7HZ-pmojtAmag@mail.gmail.com  
Discussion: http://postgr.es/m/CA+Tgmobp7+7kmi4gkq7Y+4AM9fTvL+O1oQ4-5gFTT+6Ng-dQ=g@mail.gmail.com  
Discussion: http://postgr.es/m/CAFiTN-vTe79M8uDH1yprOU64MNFE+R3ODRuA+JWf27JbhY4hJw@mail.gmail.com  

M contrib/bloom/blinsert.c
M contrib/oid2name/oid2name.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_visibility/pg_visibility.c
M src/backend/access/common/syncscan.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/tableamapi.c
M src/backend/access/transam/README
M src/backend/access/transam/README.parallel
M src/backend/access/transam/twophase.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.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/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/storage.c
M src/backend/commands/cluster.c
M src/backend/commands/copyfrom.c
M src/backend/commands/dbcommands.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/postmaster/checkpointer.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/README
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/cache/Makefile
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
R064 src/backend/utils/cache/relfilenodemap.c src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/cache/relmapper.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
R097 src/bin/pg_upgrade/relfilenode.c src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_waldump/pg_waldump.c
M src/common/relpath.c
M src/include/access/brin_xlog.h
M src/include/access/ginxlog.h
M src/include/access/gistxlog.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtxlog.h
M src/include/access/rewriteheap.h
M src/include/access/tableam.h
M src/include/access/xact.h
M src/include/access/xlog_internal.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/commands/sequence.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/common/relpath.h
M src/include/nodes/parsenodes.h
M src/include/postgres_ext.h
M src/include/postmaster/bgwriter.h
M src/include/replication/reorderbuffer.h
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/freespace.h
M src/include/storage/md.h
A src/include/storage/relfilelocator.h
D src/include/storage/relfilenode.h
M src/include/storage/sinval.h
M src/include/storage/smgr.h
M src/include/storage/standby.h
M src/include/storage/sync.h
M src/include/utils/inval.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
R052 src/include/utils/relfilenodemap.h src/include/utils/relfilenumbermap.h
M src/include/utils/relmapper.h
M src/test/recovery/t/018_wal_optimize.pl
M src/tools/pgindent/typedefs.list

Remove LLVM_CONFIG from Makefile.global.in

commit   : 7775c748db1257523ecbed1060dadb608bdff6de    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 08:11:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 08:11:39 -0700    

Click here for diff

LLVM_CONFIG is only used inside configure.  
  
Reviewed-By: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in

Tiny capitalization adjustment in pkg-config files

commit   : eb7a9cd459736f29c5d091cf1bf59842ec9c7175    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2022 10:32:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2022 10:32:40 +0200    

Click here for diff

This makes the output match that produced by meson (and also matches  
other packages and pkg-config's own documentation better).  

M src/Makefile.shlib

Remove size increase in ExprEvalStep caused by hashed saops

commit   : fe3caa1439378830d13423939b13e39d5afa8cf0    
  
author   : David Rowley <[email protected]>    
date     : Wed, 6 Jul 2022 19:40:32 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 6 Jul 2022 19:40:32 +1200    

Click here for diff

50e17ad28 increased the size of ExprEvalStep from 64 bytes up to 88 bytes.  
Lots of effort was spent during the development of the current expression  
evaluation code to make an instance of this struct as small as possible.  
Making this struct larger than needed reduces CPU cache efficiency during  
expression evaluation which causes noticeable slowdowns during query  
execution.  
  
In order to reduce the size of the struct, here we remove the fn_addr  
field. The values from this field can be obtained via fcinfo, just with  
some extra pointer dereferencing. The extra indirection does not seem to  
cause any noticeable slowdowns.  
  
Various other fields have been moved into the ScalarArrayOpExprHashTable  
struct. These fields are only used when the ScalarArrayOpExprHashTable  
pointer has already been dereferenced, so no additional pointer  
dereferences occur for these. Here we also make hash_fcinfo_data the last  
field in ScalarArrayOpExprHashTable so that we can avoid a further pointer  
dereference to get the FunctionCallInfoBaseData. This also saves a call to  
palloc().  
  
50e17ad28 was added in 14, but it's too late to adjust the size of the  
ExprEvalStep in that version, so here we just backpatch to 15, which is  
currently in beta.  
  
Author: Andres Freund, David Rowley  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h

Refactor sending of DataRow messages in replication protocol

commit   : 16d52fc89dbe8394ed318521e076f08fd2e4bf8c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2022 08:28:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2022 08:28:02 +0200    

Click here for diff

Some routines open-coded the construction of DataRow messages.  Use  
TupOutputState struct and associated functions instead, which was  
already done in some places.  
  
SendTimeLineHistory() is a bit more complicated and isn't converted by  
this.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/common/printsimple.c
M src/backend/replication/basebackup_copy.c

Unify DLSUFFIX on Darwin

commit   : b55f62abb2c2e07dfae99e19a2b3d7ca9e58dc1a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2022 07:30:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2022 07:30:16 +0200    

Click here for diff

macOS has traditionally used extension .dylib for shared libraries  
(used at build time) and .so for dynamically loaded modules (used by  
dlopen()).  This complicates the build system a bit.  Also, Meson uses  
.dylib for both, so it would be worth unifying this in order to be  
able to get equal build output.  
  
There doesn't appear to be any reason to use any particular extension  
for dlopened modules, since dlopen() will accept anything and  
PostgreSQL is well-factored to be able to deal with any extension.  
Other software packages that I have handy appear to be about 50/50  
split on which extension they use for their plugins.  So it seems  
possible to change this safely.  
  
Discussion: https://www.postgresql.org/message-id/flat/bcc45f78-e3c3-8fb3-7c42-5371b48b5266%40enterprisedb.com  

M config/python.m4
M configure
M src/Makefile.shlib
M src/makefiles/Makefile.darwin
M src/template/darwin

Reorder ecpg_config.h.in alphabetically

commit   : 4b8ee4e9d37bb12969aeaf4225b001b11da6de0c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2022 07:16:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Jul 2022 07:16:46 +0200    

Click here for diff

This makes it easier to maintain the order if we automate the  
generation of this file.  

M src/interfaces/ecpg/include/ecpg_config.h.in

autho_explain: Add GUC to log query parameters

commit   : d4bfe41281705c1bcb7093b3d07ce5ff1114341b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Jul 2022 09:55:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Jul 2022 09:55:30 +0900    

Click here for diff

auto_explain.log_parameter_max_length is a new GUC part of the  
extension, similar to the corresponding core setting, that controls the  
inclusion of query parameters in the logged explain output.  
  
More tests are added to check the behavior of this new parameter: when  
parameters logged in full (the default of -1), when disabled (value of  
0) and when partially truncated (value different than the two others).  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/auto_explain.c
M contrib/auto_explain/t/001_auto_explain.pl
M doc/src/sgml/auto-explain.sgml
M src/backend/commands/explain.c
M src/include/commands/explain.h

Tighten pg_upgrade's new check for non-upgradable anyarray usages.

commit   : 08385ed261965c4e1604e357330ac5bf9755b01a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 18:23:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 18:23:19 -0400    

Click here for diff

We only need to reject cases when the aggregate or operator is  
itself declared with a polymorphic type.  Per buildfarm.  
  
Discussion: https://postgr.es/m/3383880.QJadu78ljV@vejsadalnx  

M src/bin/pg_upgrade/check.c

pgstat: reduce timer overhead by leaving timer running.

commit   : 056cc366fafa8110f5761a7383ae1cd903dd728c    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 Jun 2022 12:48:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 Jun 2022 12:48:34 -0700    

Click here for diff

Previously the timer was enabled whenever there were any pending stats after  
executing a statement, just to then be disabled again when not idle  
anymore. That lead to an increase in GetCurrentTimestamp() calls from within  
timeout.c compared to 14.  
  
To avoid that increase, leave the timer enabled until stats are reported,  
rather than until idle. The timer is only disabled once the pending stats have  
been reported.  
  
For me this fixes the increase in GetCurrentTimestamp() calls, there now are  
fewer calls in 15 than in 14, in the previously slowed down workload.  
  
While at it, also update assertion in pgstat_report_stat() to be more precise.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-  

M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat.c

expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size.

commit   : 67b26703b4152a30a91208e28a4b72b3abda5832    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Jun 2022 18:33:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Jun 2022 18:33:42 -0700    

Click here for diff

The new expression step types increased the size of ExprEvalStep by ~4 for all  
types of expression steps, slowing down expression evaluation noticeably. Move  
them out of line.  
  
There's other issues with these expression steps, but addressing them is  
largely independent of this aspect.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h
M src/tools/pgindent/typedefs.list

commit   : 3f8148c256e067dc2e8929ed174671ba7dc3339c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 5 Jul 2022 11:01:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 5 Jul 2022 11:01:10 -0700    

Click here for diff

This reverts most of 91c0570a791, f28bf667f60, fe0972ee5e6, afdeff10526. The  
only thing left is the retry loop in 019_replslot_limit.pl that avoids  
spurious failures by retrying a couple times.  
  
We haven't seen any hard evidence that this is caused by anything but slow  
process shutdown. We did not find any cases where walsenders did not vanish  
after waiting for longer. Therefore there's no reason for this debugging code  
to remain.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-  

M src/backend/replication/slot.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/init/postinit.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/include/storage/lwlock.h
M src/test/recovery/t/019_replslot_limit.pl

Rename pg_checkpointer predefined role to pg_checkpoint.

commit   : b9eb0ff09eb843566645679c3ab65b3c9d12c08b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Jul 2022 13:31:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Jul 2022 13:31:42 -0400    

Click here for diff

This is more consistent with how other predefined roles that confer  
specific privileges are named.  
  
Nathan Bosart  
  
Discussion: http://postgr.es/m/CA+TgmoatH7+yYe+A8uJFNogg3VUDtFE6c-77yHAY8TRWR7oqyw@mail.gmail.com  

M doc/src/sgml/ref/checkpoint.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/tcop/utility.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat

Fix pg_upgrade to detect non-upgradable anyarray usages.

commit   : 09878cdd489ff7aca761998e7cb104f4fd98ae02    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 13:06:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 13:06:31 -0400    

Click here for diff

When we changed some built-in functions to use anycompatiblearray  
instead of anyarray, we created a dump/restore hazard for user-defined  
operators and aggregates relying on those functions: the user objects  
have to be modified to change their signatures similarly.  This causes  
pg_upgrade to fail partway through if the source installation contains  
such objects.  We generally try to have pg_upgrade detect such hazards  
and fail before it does anything exciting, so add logic to detect  
this case too.  
  
Back-patch to v14 where the change was made.  
  
Justin Pryzby, reviewed by Andrey Borodin  
  
Discussion: https://postgr.es/m/3383880.QJadu78ljV@vejsadalnx  

M src/bin/pg_upgrade/check.c

Fix errors in copyfuncs/equalfuncs support for JSON node types.

commit   : 8d9f9634ef21ab0023e2bd98e799f5ad2eec4539    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 11:12:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 11:12:33 -0400    

Click here for diff

Noted while comparing existing code to the output of the proposed  
patch to automate creation of these functions.  Some of the changes  
are just cosmetic, but others represent real bugs.  I've not  
attempted to analyze the user-visible impact.  
  
Back-patch to v15 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c

libpq: Improve idle state handling in pipeline mode

commit   : 054325c5eeb3140a067ba66735c3d811163ecd6a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jul 2022 14:21:20 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jul 2022 14:21:20 +0200    

Click here for diff

We were going into IDLE state too soon when executing queries via  
PQsendQuery in pipeline mode, causing several scenarios to misbehave in  
different ways -- most notably, as reported by Daniele Varrazzo, that a  
warning message is produced by libpq:  
  message type 0x33 arrived from server while idle  
But it is also possible, if queries are sent and results consumed not in  
lockstep, for the expected mediating NULL result values from PQgetResult  
to be lost (a problem which has not been reported, but which is more  
serious).  
  
Fix this by introducing two new concepts: one is a command queue element  
PGQUERY_CLOSE to tell libpq to wait for the CloseComplete server  
response to the Close message that is sent by PQsendQuery.  Because the  
application is not expecting any PGresult from this, the mechanism to  
consume it is a bit hackish.  
  
The other concept, authored by Horiguchi-san, is a PGASYNC_PIPELINE_IDLE  
state for libpq's state machine to differentiate "really idle" from  
merely "the idle state that occurs in between reading results from the  
server for elements in the pipeline".  This makes libpq not go fully  
IDLE when the libpq command queue contains entries; in normal cases, we  
only go IDLE once at the end of the pipeline, when the server response  
to the final SYNC message is received.  (However, there are corner cases  
it doesn't fix, such as terminating the query sequence by  
PQsendFlushRequest instead of PQpipelineSync; this sort of scenario is  
what requires PGQUERY_CLOSE bit above.)  
  
This last bit helps make the libpq state machine clearer; in particular  
we can get rid of an ugly hack in pqParseInput3 to avoid considering  
IDLE as such when the command queue contains entries.  
  
A new test mode is added to libpq_pipeline.c to tickle some related  
problematic cases.  
  
Reported-by: Daniele Varrazzo <[email protected]>  
Co-authored-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CA+mi_8bvD0_CW3sumgwPvWdNzXY32itoG_16tDYRu_1S2gV2iw@mail.gmail.com  

M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
A src/test/modules/libpq_pipeline/traces/pipeline_idle.trace

BRIN: improve documentation on summarization

commit   : 5001b44b11381f6e1787403ae81bce1ff1f78a99    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jul 2022 13:38:26 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jul 2022 13:38:26 +0200    

Click here for diff

The existing wording wasn't clear enough and some details weren't  
anywhere, such as the fact that autosummarization is off by default.  
Improve.  
  
Authors: Roberto Mello, Jaime Casanova, Justin Pryzby, Álvaro Herrera  
Discussion: https://postgr.es/m/CAKz==bK_NoJytRyQfX8K-erCW3Ff7--oGYpiB8+ePVS7dRVW_A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/brin.sgml
M doc/src/sgml/ref/create_index.sgml

Fix pg_prepared_statements.result_types for DML statements

commit   : 6ffff0fd225432fe2ae4bd5abb7ff6113e255418    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Jul 2022 10:26:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Jul 2022 10:26:36 +0200    

Click here for diff

Amendment to 84ad713cf85aeffee5dd39f62d49a1b9e34632da: Not all  
prepared statements have a result descriptor.  As currently coded,  
this would crash when reading pg_prepared_statements.  Make those  
cases return null for result_types instead.  Also add a test case for  
it.  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/prepare.c
M src/test/regress/expected/prepare.out
M src/test/regress/sql/prepare.sql

Simplify a bit the special rules generating unaccent.rules

commit   : e3dd7c06e62774628e102c3cd47ee46e85519de7    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 Jul 2022 16:17:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 Jul 2022 16:17:51 +0900    

Click here for diff

As noted by Thomas Munro, CLDR 36 has added SOUND RECORDING COPYRIGHT  
(U+2117), and we use CLDR 41, so this can be removed from the set of  
special cases.  
  
The set of regression tests is expanded for degree signs, which are two  
of the special cases, and a fancy case with U+210C in Latin-ASCII.xml  
that we have discovered about when diving into what could be done for  
Cyrillic characters (this last part is material for a future patch, not  
tackled yet).  
  
While on it, some of the assertions of generate_unaccent_rules.py are  
expanded to report the codepoint on which a failure is found, something  
useful for debugging.  
  
Extracted from a larger patch by the same author.  
  
Author: Przemysław Sztoch  
Discussion: https://postgr.es/m/[email protected]  

M contrib/unaccent/expected/unaccent.out
M contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/sql/unaccent.sql

Add result_types column to pg_prepared_statements view

commit   : 84ad713cf85aeffee5dd39f62d49a1b9e34632da    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Jul 2022 07:21:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Jul 2022 07:21:40 +0200    

Click here for diff

Containing the types of the columns returned by the prepared  
statement.  
  
Prompted by question from IRC user mlvzk.  
  
Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/prepare.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/prepare.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/prepare.sql

Remove durable_rename_excl()

commit   : eb64ceac7ec3422f2370b8824dce62ee8fe52dca    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 Jul 2022 12:54:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 Jul 2022 12:54:25 +0900    

Click here for diff

A previous commit replaced all the calls to this function with  
durable_rename() as of dac1ff3, making it used nowhere in the tree.  
Using it in extension code is also risky based on the issues described  
in this previous commit, so let's remove it.  This makes possible the  
removal of HAVE_WORKING_LINK.  
  
Author: Nathan Bossart  
Reviewed-by: Robert Haas, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/20220407182954.GA1231544@nathanxps13  

M src/backend/storage/file/fd.c
M src/include/pg_config_manual.h
M src/include/storage/fd.h

Replace durable_rename_excl() by durable_rename(), take two

commit   : dac1ff30906b9cef7859380905d038892b32968b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 Jul 2022 10:16:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 Jul 2022 10:16:12 +0900    

Click here for diff

durable_rename_excl() attempts to avoid overwriting any existing files  
by using link() and unlink(), and it falls back to rename() on some  
platforms (aka WIN32), which offers no such overwrite protection.  Most  
callers use durable_rename_excl() just in case there is an existing  
file, but in practice there shouldn't be one (see below for more  
details).  
  
Furthermore, failures during durable_rename_excl() can result in  
multiple hard links to the same file.  As per Nathan's tests, it is  
possible to end up with two links to the same file in pg_wal after a  
crash just before unlink() during WAL recycling.  Specifically, the test  
produced links to the same file for the current WAL file and the next  
one because the half-recycled WAL file was re-recycled upon restarting,  
leading to WAL corruption.  
  
This change replaces all the calls of durable_rename_excl() to  
durable_rename().  This removes the protection against accidentally  
overwriting an existing file, but some platforms are already living  
without it and ordinarily there shouldn't be one.  The function itself  
is left around in case any extensions are using it.  It will be removed  
on HEAD via a follow-up commit.  
  
Here is a summary of the existing callers of durable_rename_excl() (see  
second discussion link at the bottom), replaced by this commit.  First,  
basic_archive used it to avoid overwriting an archive concurrently  
created by another server, but as mentioned above, it will still  
overwrite files on some platforms.  Second, xlog.c uses it to recycle  
past WAL segments, where an overwrite should not happen (origin of the  
change at f0e37a8) because there are protections about the WAL segment  
to select when recycling an entry.  The third and last area is related  
to the write of timeline history files.  writeTimeLineHistory() will  
write a new timeline history file at the end of recovery on promotion,  
so there should be no such files for the same timeline.  
What remains is writeTimeLineHistoryFile(), that can be used in parallel  
by a WAL receiver and the startup process, and some digging of the  
buildfarm shows that EEXIST from a WAL receiver can happen with an error  
of "could not link file \"pg_wal/xlogtemp.NN\" to \"pg_wal/MM.history\",  
which would cause an automatic restart of the WAL receiver as it is  
promoted to FATAL, hence this should improve the stability of the WAL  
receiver as rename() would overwrite an existing TLI history file  
already fetched by the startup process at recovery.  
  
This is a bug fix, but knowing the unlikeliness of the problem involving  
one or more crashes at an exceptionally bad moment, no backpatch is  
done.  Also, I want to be careful with such changes (aaa3aed did the  
opposite of this change by removing HAVE_WORKING_LINK so as Windows  
would do a link() rather than a rename() but this was not  
concurrent-safe).  A backpatch could be revisited in the future.  This  
is the second time this change is attempted, ccfbd92 being the first  
one, but this time no assertions are added for the case of a TLI history  
file written concurrently by the WAL receiver or the startup process  
because we can expect one to exist (some of the TAP tests are able to  
trigger with a proper timing).  
  
Author: Nathan Bossart  
Reviewed-by: Robert Haas, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/20220407182954.GA1231544@nathanxps13  
Discussion: https://postgr.es/m/[email protected]  

M contrib/basic_archive/basic_archive.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c

Refactor sending of RowDescription messages in replication protocol

commit   : 2ce648f750a91b04bfa371a8f966703a382fcc97    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jul 2022 07:25:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jul 2022 07:25:26 +0200    

Click here for diff

Some routines open-coded the construction of RowDescription messages.  
Instead, we have support for doing this using tuple descriptors and  
DestRemoteSimple, so use that instead.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/common/tupdesc.c
M src/backend/replication/basebackup_copy.c
M src/backend/replication/walsender.c

Implement List support for TransactionId

commit   : f10a025cfe97c1a341f636368e67af5ca644c5d8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Jul 2022 14:52:12 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Jul 2022 14:52:12 +0200    

Click here for diff

Use it for RelationSyncEntry->streamed_txns, which is currently using an  
integer list.  
  
The API support is not complete, not because it is hard to write but  
because it's unclear that it's worth the code space, there being so  
little use of XID lists.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Amit Kapila <[email protected]>  

M src/backend/nodes/list.c
M src/backend/nodes/outfuncs.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/nodes/nodes.h
M src/include/nodes/pg_list.h

Prevent write operations on large objects in read-only transactions

commit   : 55f4802785f66a584c05dca40e5d9b25491674b2    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Jul 2022 15:48:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Jul 2022 15:48:52 +0900    

Click here for diff

Attempting such an operation would already fail, but in various and  
confusing ways.  For example, while in recovery, some elog() messages  
would be reported, but these should never be user-facing.  This commit  
restricts any write operations done on large objects in a read-only  
context, so as the errors generated are more user-friendly.  This is per  
the discussion done with Tom Lane and Robert Haas.  
  
Some regression tests are added to check the case of all the SQL  
functions working on large objects (including an update of the test's  
alternate output).  
  
Author: Yugo Nagata  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/lobj.sgml
M src/backend/libpq/be-fsstubs.c
M src/test/regress/expected/largeobject.out
M src/test/regress/expected/largeobject_1.out
M src/test/regress/sql/largeobject.sql

Fix for change timeline field of IDENTIFY_SYSTEM to int8

commit   : 8ba3cb2f1863e3243aa40d73633bd88f774f74ce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jul 2022 08:06:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jul 2022 08:06:05 +0200    

Click here for diff

Amendment to ec40f3422412cfdc140b5d3f67db7fd2dac0f1e2: We also need to  
change the way the datum is supplied to int8.  Otherwise, the value is  
still cut off as an int4, and it will crash on 32-bit platforms.  

M src/backend/replication/walsender.c

Change timeline field of IDENTIFY_SYSTEM to int8

commit   : ec40f3422412cfdc140b5d3f67db7fd2dac0f1e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jul 2022 07:25:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jul 2022 07:25:26 +0200    

Click here for diff

It was int4, but in the other replication commands, timelines are  
returned as int8.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/replication/walsender.c

Fix attlen in RowDescription of BASE_BACKUP response

commit   : 4e85b97304a74f5f0fc82136b95f0d5a67b7fd53    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jul 2022 07:25:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Jul 2022 07:25:26 +0200    

Click here for diff

Should be 8 for int8, not -1.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/replication/basebackup_copy.c

Use a short socket directory path in pg_upgrade testing.

commit   : 255625df1d3a9823c891d585fbf5c3bb913182eb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 21:38:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 21:38:32 -0400    

Click here for diff

Several buildfarm members are failing the pg_upgrade test in  
REL_15_STABLE, though the identical test is fine in HEAD.  
On thorntail it's possible to see that the problem is an  
overlength socket path name, and I bet the same is true  
on the others.  
  
The normally-started postmasters used in the test are already  
set up with short socket directory paths, but we neglected to  
tell pg_upgrade itself to do likewise when starting child  
postmasters, and indeed it seems to be explicitly selecting  
the test directory instead.  
  
Back-patch to v15 where the current test script was introduced.  
(The previous script might have the same issue, because I don't  
see any use of -s/--socketdir in it either; but we've had no  
complaints, so leave it alone for now.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Remove %error-verbose directive from jsonpath parser

commit   : 89a39d4a4da01b13dddcbcf9bcdac2205c9b1279    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 3 Jul 2022 17:08:25 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 3 Jul 2022 17:08:25 -0400    

Click here for diff

None of the other bison parsers contains this directive, and it gives  
rise to some unfortunate and impenetrable messages, so just remove it.  
  
Backpatch to release 12, where it was introduced.  
  
Per gripe from Erik Rijkers  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonpath_gram.y
M src/test/regress/expected/jsonb_sqljson.out

Allow makeaclitem() to accept multiple privilege names.

commit   : b762bbde30d21d6a091d44cc2cbbfb1c9550be52    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 16:49:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 16:49:12 -0400    

Click here for diff

Interpret its privileges argument as a comma-separated list of  
privilege names, as in has_table_privilege and other functions.  
This is actually net less code, since the support routine to  
parse that already exists, and we can drop convert_priv_string()  
which had no other use-case.  
  
Robins Tharakan  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/acl.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Add Windows file version information to libpq/test programs.

commit   : b6a5158f98fd5158f66943d721061418f183b370    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 3 Jul 2022 13:07:17 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 3 Jul 2022 13:07:17 -0700    

Click here for diff

Back-patch to v15, the first version to install these programs.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/test/Makefile

Simplify tab completion of extension versions, redux.

commit   : 22a67fdd5d2756860e0e0813e4a1ae11b69e21c7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 15:27:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 15:27:27 -0400    

Click here for diff

After commit 662dbe2c8, psql tab completion didn't conveniently  
support the case of "ALTER EXTENSION foo UPDATE".  It'd always  
add "TO", which is fine if you want to specify a target version  
but not if you don't ... and surely the latter is the much more  
common case.  
  
To fix, remove "TO" from the initially offered completion; you now  
need to press TAB one additional time to get that.  We won't try to  
duplicate the old behavior of attempting initial completion on the  
target version along with TO.  It's too squirrelly to get the quoting  
right, and this is such an infrequent usage that it doesn't seem worth  
expending a lot of effort and special code on.  
  
Noted by Noah Misch.  Back-patch to v15.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Remove redundant null pointer checks before PQclear and PQconninfoFree

commit   : 5faef9d582012433db9ad05af27a77bd591508e1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 3 Jul 2022 20:11:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 3 Jul 2022 20:11:05 +0200    

Click here for diff

These functions already had the free()-like behavior of handling null  
pointers as a no-op.  But it wasn't documented, so add it explicitly  
to the documentation, too.  
  
Discussion: https://www.postgresql.org/message-id/flat/dac5d2d0-98f5-94d9-8e69-46da2413593d%40enterprisedb.com  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/libpq.sgml
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/describe.c
M src/fe_utils/query_utils.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c

Remove redundant null pointer checks before free()

commit   : 02c408e21a6e78ff246ea7a1beb4669634fa9c4c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Jun 2022 21:50:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Jun 2022 21:50:56 +0200    

Click here for diff

Per applicable standards, free() with a null pointer is a no-op.  
Systems that don't observe that are ancient and no longer relevant.  
Some PostgreSQL code already required this behavior, so this change  
does not introduce any new requirements, just makes the code more  
consistent.  
  
Discussion: https://www.postgresql.org/message-id/flat/dac5d2d0-98f5-94d9-8e69-46da2413593d%40enterprisedb.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/uuid-ossp/uuid-ossp.c
M src/backend/bootstrap/bootstrap.c
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/backend/regex/regc_pg_locale.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/error/elog.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.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/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/copy.c
M src/bin/psql/describe.c
M src/bin/psql/input.c
M src/bin/psql/tab-complete.c
M src/common/fe_memutils.c
M src/fe_utils/connect_utils.c
M src/fe_utils/string_utils.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-secure-common.c
M src/port/getaddrinfo.c

Remove redundant null pointer checks before pg_free()

commit   : 098c703d308fa88dc9e3f9f623ca023ce4717794    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Jun 2022 11:51:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Jun 2022 11:51:38 +0200    

Click here for diff

These are especially useless because the whole point of pg_free() was  
to do that very check before calling free().  
  
pg_free() could be removed altogether, but I'm keeping it here to keep  
the API consistent.  
  
Discussion: https://www.postgresql.org/message-id/flat/dac5d2d0-98f5-94d9-8e69-46da2413593d%40enterprisedb.com  

M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/variables.c

Fix previous commit's ecpg_clocale for ppc Darwin.

commit   : e2bc242833da27cd73c279bebfb321a65384808f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 2 Jul 2022 21:03:19 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 2 Jul 2022 21:03:19 -0700    

Click here for diff

Per buildfarm member prairiedog, this platform rejects uninitialized  
global variables in shared libraries.  Back-patch to v10, like the  
addition of the variable.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/connect.c

ecpglib: call newlocale() once per process.

commit   : 5633836ef306aa4d2be44821b601494054b479d7    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 2 Jul 2022 13:00:30 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 2 Jul 2022 13:00:30 -0700    

Click here for diff

ecpglib has been calling it once per SQL query and once per EXEC SQL GET  
DESCRIPTOR.  Instead, if newlocale() has not succeeded before, call it  
while establishing a connection.  This mitigates three problems:  
- If newlocale() failed in EXEC SQL GET DESCRIPTOR, the command silently  
  proceeded without the intended locale change.  
- On AIX, each newlocale()+freelocale() cycle leaked memory.  
- newlocale() CPU usage may have been nontrivial.  
  
Fail the connection attempt if newlocale() fails.  Rearrange  
ecpg_do_prologue() to validate the connection before its uselocale().  
  
The sort of program that may regress is one running in an environment  
where newlocale() fails.  If that program establishes connections  
without running SQL statements, it will stop working in response to this  
change.  I'm betting against the importance of such an ECPG use case.  
Most SQL execution (any using ECPGdo()) has long required newlocale()  
success, so there's little a connection could do without newlocale().  
  
Back-patch to v10 (all supported versions).  
  
Reviewed by Tom Lane.  Reported by Guillaume Lelarge.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c

Emit debug message when executing extension script.

commit   : 43470717c47092194832b90737dc74ec6ab9ef33    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 2 Jul 2022 11:20:45 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 2 Jul 2022 11:20:45 -0700    

Click here for diff

Allows extension authors to more easily debug problems related to the  
sequence of update scripts that are executed.  
  
Discussion: https://postgr.es/m/5636a7534a4833884172fe4369d825b26170b3cc.camel%40j-davis.com  
Reviewed-by: Peter Eisentraut, Nathan Bossart  

M src/backend/commands/extension.c

Reformat some node comments

commit   : 835d476fd21bcfb60b055941dee8c3d9559af14c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 2 Jul 2022 12:33:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 2 Jul 2022 12:33:07 +0200    

Click here for diff

Reformat some comments in node field definitions to avoid long lines.  
  
This makes room for per-field annotations in a future patch to  
generate node support functions automatically.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h

Default to dynamic_shared_memory_type=sysv on Solaris.

commit   : 94ebf8117c93f19218e60eb24f3f6bd09b796767    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 2 Jul 2022 16:06:47 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 2 Jul 2022 16:06:47 +1200    

Click here for diff

POSIX shm_open() can sleep for a long time and fail spuriously because  
of contention on an internal lock file on Solaris (and presumably  
illumos).  Commit 389869af fixed the main problem with this, namely that  
we could crash, but it's now clear that "posix" is not a good default.  
  
Therefore, choose "sysv" at initdb time on Solaris and illumos.  Other  
choices are still available by editing the postgresql.conf file.  
  
Back-patch only to 15, because contention is much less likely further  
back, and it doesn't seem like a good idea to change this in released  
branches.  This should clear up the failures on build farm animal  
margay.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKqKrCV5xKWfh9rnm%3Do%3DDwZLTLtnsj_XpUi9g5%3DV%2B9oyg%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c

Introduce pg_attribute_nonnull(...)

commit   : 0507977aa4a356052ea0e5da209162e4b2125c1d    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 2 Jul 2022 12:30:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 2 Jul 2022 12:30:45 +0900    

Click here for diff

pg_attribute_nonnull(...) can be used to generate compiler warnings  
when a function is called with the specified arguments set to NULL, as  
per an idea from Andres Freund.  An empty argument list indicates that  
no pointer arguments can be NULL.  pg_attribute_nonnull() only works for  
compilers that support the nonnull function attribute.  If nonnull is  
not supported, pg_attribute_nonnull() has no effect.  
  
As a beginning, this commit uses it for the DefineCustomXXXVariable()  
functions to generate warnings when the "name" and "value" arguments are  
set to NULL.  This will likely be expanded to other places in the  
future, where it makes sense.  
  
Author: Nathan Bossart  
Reviewed by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h
M src/include/utils/guc.h

Replace PGISOLATIONTIMEOUT with 2 * PG_TEST_TIMEOUT_DEFAULT.

commit   : c99c67fc43f8659517310c62e8a2637d56d0e449    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 1 Jul 2022 18:27:50 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 1 Jul 2022 18:27:50 -0700    

Click here for diff

Now that the more-generic variable exists, use it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/README
M src/test/isolation/isolationtester.c

Fix race condition in t/028_pitr_timelines.pl.

commit   : 4f4c72c2dc06e944950305b0c1f48071ff49e263    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 1 Jul 2022 18:27:18 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 1 Jul 2022 18:27:18 -0700    

Click here for diff

Per buildfarm members sungazer and mylodon.  Back-patch to v15, which  
introduced this test.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/028_pitr_timelines.pl

Remove no-longer-used parameter for create_groupingsets_path().

commit   : f172b11d616e4e440be6b3235721e283e4c16460    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2022 18:39:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Jul 2022 18:39:30 -0400    

Click here for diff

numGroups is unused since commit b5635948a; let's get rid of it.  
  
XueJing Zhao, reviewed by Richard Guo  
  
Discussion: https://postgr.es/m/DM6PR05MB64923CC8B63A2CAF3B2E5D47B7AD9@DM6PR05MB6492.namprd05.prod.outlook.com  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/pathnode.h

Add missing GETTEXT_FLAGS entry

commit   : f58f1fb6c0f0990558d0859018b31412b1338447    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 16:41:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 16:41:46 +0200    

Click here for diff

M src/bin/psql/nls.mk

Add construct_array_builtin, deconstruct_array_builtin

commit   : d746021de18baf0f29eff0388204a0664f41eb8b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 10:51:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 10:51:45 +0200    

Click here for diff

There were many calls to construct_array() and deconstruct_array() for  
built-in types, for example, when dealing with system catalog columns.  
These all hardcoded the type attributes necessary to pass to these  
functions.  
  
To simplify this a bit, add construct_array_builtin(),  
deconstruct_array_builtin() as wrappers that centralize this hardcoded  
knowledge.  This simplifies many call sites and reduces the amount of  
hardcoded stuff that is spread around.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/2914356f-9e5f-8c59-2995-5997fc48bcba%40enterprisedb.com  

M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_trgm/trgm_op.c
M contrib/pgcrypto/pgp-pgsql.c
M src/backend/access/common/reloptions.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/analyze.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/policy.c
M src/backend/commands/prepare.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/nodeTidscan.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/statistics/extended_stats.c
M src/backend/tsearch/dict.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/misc/guc.c
M src/include/utils/array.h
M src/test/modules/test_rls_hooks/test_rls_hooks.c

doc: Add index entry for MERGE SQL command.

commit   : 7c2d6f8d3400edab2b91de7765db9ec71235fac9    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 1 Jul 2022 14:19:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 1 Jul 2022 14:19:52 +0900    

Click here for diff

Back-patch to v15, where MERGE command was supported.  
  
Author: Fujii Masao  
Reviewed-by: Alvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/merge.sgml

Clarify that pg_dump takes ACCESS SHARE lock

commit   : 4e2e8d71fe25e43fc82351bd350a6e80beee50be    
  
author   : John Naylor <[email protected]>    
date     : Fri, 1 Jul 2022 11:41:36 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 1 Jul 2022 11:41:36 +0700    

Click here for diff

Add link to the description of lock levels to avoid confusing "shared locks"  
with SHARE locks.  
  
Florin Irion  
  
Reviewed-by: Álvaro Herrera, Tom Lane, and Nathan Bossart  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml

Harden dsm_impl.c against unexpected EEXIST.

commit   : 389869af59dadb1584ece2f9d344a31e4bfe45eb    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 1 Jul 2022 12:05:52 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 1 Jul 2022 12:05:52 +1200    

Click here for diff

Previously, we trusted the OS not to report EEXIST unless we'd passed in  
IPC_CREAT | IPC_EXCL or O_CREAT | O_EXCL, as appropriate.  Solaris's  
shm_open() can in fact do that, causing us to crash because we didn't  
ereport and then we blithely assumed the mapping was successful.  
  
Let's treat EEXIST just like any other error, unless we're actually  
trying to create a new segment.  This applies to shm_open(), where this  
behavior has been seen, and also to the equivalent operations for our  
sysv and mmap modes just on principle.  
  
Based on the underlying reason for the error, namely contention on a  
lock file managed by Solaris librt for each distinct name, this problem  
is only likely to happen on 15 and later, because the new shared memory  
stats system produces shm_open() calls for the same path from  
potentially large numbers of backends concurrently during  
authentication.  Earlier releases only shared memory segments between a  
small number of parallel workers under one Gather node.  You could  
probably hit it if you tried hard enough though, and we should have been  
more defensive in the first place.  Therefore, back-patch to all  
supported releases.  
  
Per build farm animal margay.  This isn't the end of the story, though,  
it just changes random crashes into random "File exists" errors; more  
work needed for a green build farm.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKqKrCV5xKWfh9rnm%3Do%3DDwZLTLtnsj_XpUi9g5%3DV%2B9oyg%40mail.gmail.com  

M src/backend/storage/ipc/dsm_impl.c

Fix code comments still referring to pg_start/stop_backup()

commit   : 33bd4698c1174d24f6e53f965f6d64aeab3611f6    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Jul 2022 09:37:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Jul 2022 09:37:17 +0900    

Click here for diff

pg_start_backup() and pg_stop_backup() have been respectively renamed to  
pg_backup_start() and pg_backup_stop() as of 39969e2, but a few comments  
did not get the call.  
  
Reviewed-by: Kyotaro Horiguchi, David Steele  
Discussion: https://postgr.es/m/YrqGlj1+4DF3dbZ/@paquier.xyz  

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

Refactor the TAP test of auto_explain

commit   : 550bc0a6c0c6af20d34c16902f0ed977550396eb    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Jul 2022 09:13:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Jul 2022 09:13:57 +0900    

Click here for diff

Previously, the tests were structured so as all the queries whose plans  
are checked run first, followed by pattern checks using the full set of  
server logs.  This can be problematic when extending the tests, as this  
increases query plan overlaps, where two tests finish by having similar  
plan outputs potentially invalidating the tests wanted.  
  
The tests are refactored so as log content matches are checked in  
isolation of each query run, by grabbing the position of the server logs  
before running each query whose plan is generated in the logs.  This  
avoids issues when extending the tests, something that would become a  
larger problem with a follow-up patch that adds a new GUC in  
auto_explain to control the size of the each parameter logged.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/t/001_auto_explain.pl

Change some unnecessary MemSet calls

commit   : 258f48f858b0bcc4c3fac3fa01f79ee61ad0cd1e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 00:16:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 00:16:38 +0200    

Click here for diff

MemSet() with a value other than 0 just falls back to memset(), so the  
indirection is unnecessary if the value is constant and not 0.  Since  
there is some interest in getting rid of MemSet(), this gets some easy  
cases out of the way.  (There are a few MemSet() calls that I didn't  
change to maintain the consistency with their surrounding code.)  
  
Discussion: https://www.postgresql.org/message-id/flat/CAEudQApCeq4JjW1BdnwU=m=-DvG5WyUik0Yfn3p6UNphiHjj+w@mail.gmail.com  

M contrib/hstore/hstore_gist.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M contrib/oid2name/oid2name.c
M contrib/pg_trgm/trgm_gist.c
M src/backend/access/hash/hashovfl.c
M src/backend/replication/walreceiver.c
M src/backend/utils/adt/tsgistidx.c

Avoid unnecessary MemSet call

commit   : 8cd61d288adfabe1b7f83359eb0abd27382eec08    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Jun 2022 19:10:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Jun 2022 19:10:13 +0100    

Click here for diff

The variable in question was changed from a struct to a pointer some  
time ago (77947c51c08).  Using MemSet to zero it still works but is  
obviously unidiomatic and confusing, so change it to a straight  
assignment.  
  
Author: Ranier Vilela <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAEudQApCeq4JjW1BdnwU=m=-DvG5WyUik0Yfn3p6UNphiHjj+w@mail.gmail.com  

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

Stamp HEAD as 16devel.

commit   : d31d30973a190f69d414f7fc7b670771ac346a59    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Jun 2022 11:26:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Jun 2022 11:26:40 -0400    

Click here for diff

Let the hacking begin ...  

M configure
M configure.ac
M doc/src/sgml/filelist.sgml
D doc/src/sgml/release-15.sgml
A doc/src/sgml/release-16.sgml
M doc/src/sgml/release.sgml
M src/tools/git_changelog
M src/tools/version_stamp.pl