PostgreSQL 14.0 commit log

Stamp 14.0.

commit   : 86a4dc1e6f29d1992a2afa3fac1a0b0a6e84568c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Sep 2021 16:57:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Sep 2021 16:57:41 -0400    

Click here for diff

M configure
M configure.ac

Translation updates

commit   : 9f535e4aeafc4e427355760178ecc89055f96942    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Sep 2021 09:22:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Sep 2021 09:22:27 +0200    

Click here for diff

Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 941ca560d0b36a8bace8432b06302ca003829f42  

M src/bin/psql/po/de.po

Update list of acknowledgments in release notes

commit   : 3cc51338438acb38ea14cebe6fd979f00ad5bebf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Sep 2021 08:59:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Sep 2021 08:59:03 +0200    

Click here for diff

current through e8b39cebdaf042dfeeb31d2f48f0fe7b33886210  

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

Fix typos in docs

commit   : e8b39cebdaf042dfeeb31d2f48f0fe7b33886210    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 26 Sep 2021 19:18:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 26 Sep 2021 19:18:23 +0900    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/datatype.sgml

Doc: final(?) updates for 14.0 release notes.

commit   : 765f677f364100072160e7af37288eb1df2ff355    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Sep 2021 11:36:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Sep 2021 11:36:43 -0400    

Click here for diff

Add the customary short list of major features.  Set release date.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: extend warnings about collation-mismatch hazards in postgres_fdw.

commit   : 02c4e3533926f4e7398611b6349d7c438b86c63b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Sep 2021 10:53:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Sep 2021 10:53:54 -0400    

Click here for diff

Be a little more vocal about the risks of remote collations not  
matching local ones.  Actually fixing these risks seems hard,  
and I've given up on the idea that it might be back-patchable.  
So the best we can do for the back branches is add documentation.  
  
Per discussion of bug #16583 from Jiří Fejfar.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/postgres-fdw.sgml

Add alternative output for OpenSSL 3 without legacy loaded

commit   : 6d0001aabf2a49180a236d9c2a7ecdf24e0cdb37    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sat, 25 Sep 2021 11:27:28 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sat, 25 Sep 2021 11:27:28 +0200    

Click here for diff

OpenSSL 3 introduced the concept of providers to support modularization,  
and moved the outdated ciphers to the new legacy provider. In case it's  
not loaded in the users openssl.cnf file there will be a lot of regress  
test failures, so add alternative outputs covering those.  
  
Also document the need to load the legacy provider in order to use older  
ciphers with OpenSSL-enabled pgcrypto.  
  
This will be backpatched to all supported version once there is sufficient  
testing in the buildfarm of OpenSSL 3.  
  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

A contrib/pgcrypto/expected/blowfish_1.out
A contrib/pgcrypto/expected/cast5_1.out
A contrib/pgcrypto/expected/des_1.out
A contrib/pgcrypto/expected/pgp-decrypt_1.out
A contrib/pgcrypto/expected/pgp-pubkey-decrypt_1.out
M doc/src/sgml/pgcrypto.sgml

Disable OpenSSL EVP digest padding in pgcrypto

commit   : 4fa2b15e1c9cae79afe17c14591074111b0d4093    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sat, 25 Sep 2021 11:27:20 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sat, 25 Sep 2021 11:27:20 +0200    

Click here for diff

The PX layer in pgcrypto is handling digest padding on its own uniformly  
for all backend implementations. Starting with OpenSSL 3.0.0, DecryptUpdate  
doesn't flush the last block in case padding is enabled so explicitly  
disable it as we don't use it.  
  
This will be backpatched to all supported version once there is sufficient  
testing in the buildfarm of OpenSSL 3.  
  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/openssl.c

doc: Improve description of index vacuuming with GUCs

commit   : bfe1ead94488986008771c0d295c2725bab952cb    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 25 Sep 2021 15:11:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 25 Sep 2021 15:11:52 +0900    

Click here for diff

Index vacuums may happen multiple times depending on the number of dead  
tuples stored, as of maintenance_work_mem for a manual VACUUM.  For  
autovacuum, this is controlled by autovacuum_work_mem instead, if set.  
The documentation mentioned the former, but not the latter in the  
context of autovacuum.  
  
Reported-by: Nikolai Berkoff  
Author: Laurenz Albe, Euler Taveira  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/monitoring.sgml

doc: Add missing markup in CREATE EVENT TRIGGER page

commit   : 3eea9139ee46124746e942293d57e3fb1d3c0e09    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 25 Sep 2021 14:48:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 25 Sep 2021 14:48:09 +0900    

Click here for diff

Reported-by: rir  
Discussion: https://postgr.es/m/20210924183658.3syyitp3yuxjv2fp@localhost  
Backpatch-through: 9.6  

M doc/src/sgml/ref/create_event_trigger.sgml

Add missing $Test::Builder::Level settings

commit   : e536a2683439c3dd4ea6d339a878fa4430e3174d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Sep 2021 22:49:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Sep 2021 22:49:20 +0200    

Click here for diff

One of these was accidentally removed by c50624c.  The others are  
added by analogy.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl

Split macros from visibilitymap.h into a separate header

commit   : 7186f07189baf069c54718315b81e65d87f4c0c1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 Sep 2021 19:59:03 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 Sep 2021 19:59:03 +0300    

Click here for diff

That allows to include just visibilitymapdefs.h from file.c, and in turn,  
remove include of postgres.h from relcache.h.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20210913232614.czafiubr435l6egi%40alap3.anarazel.de  
Author: Alexander Korotkov  
Reviewed-by: Andres Freund, Tom Lane, Alvaro Herrera  
Backpatch-through: 13  

M src/bin/pg_upgrade/file.c
M src/include/access/visibilitymap.h
A src/include/access/visibilitymapdefs.h
M src/include/utils/relcache.h

Release memory allocated by dependency_degree

commit   : abb2f9144ba1b7ac806f3779f53ae2f6174cd2d9    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 21 Sep 2021 01:13:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 21 Sep 2021 01:13:11 +0200    

Click here for diff

Calculating degree of a functional dependency may allocate a lot of  
memory - we have released mot of the explicitly allocated memory, but  
e.g. detoasted varlena values were left behind. That may be an issue,  
because we consider a lot of dependencies (all combinations), and the  
detoasting may happen for each one again.  
  
Fixed by calling dependency_degree() in a dedicated context, and  
resetting it after each call. We only need the calculated dependency  
degree, so we don't need to copy anything.  
  
Backpatch to PostgreSQL 10, where extended statistics were introduced.  
  
Backpatch-through: 10  
Discussion: https://www.postgresql.org/message-id/20210915200928.GP831%40telsasoft.com  

M src/backend/statistics/dependencies.c

Free memory after building each statistics object

commit   : bb7628e55eda6f450f0f824d11c9a34b11f6bb12    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 21 Sep 2021 01:14:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 21 Sep 2021 01:14:11 +0200    

Click here for diff

Until now, all extended statistics on a given relation were built in the  
same memory context, without resetting. Some of the memory was released  
explicitly, but not all of it - for example memory allocated while  
detoasting values is hard to free. This is how it worked since extended  
statistics were introduced in PostgreSQL 10, but adding support for  
extended stats on expressions made the issue somewhat worse as it  
increases the number of statistics to build.  
  
Fixed by adding a memory context which gets reset after building each  
statistics object (all the statistics kinds included in it). Resetting  
it after building each statistics kind would be even better, but it  
would require more invasive changes and copying of results, making it  
harder to backpatch.  
  
Backpatch to PostgreSQL 10, where extended statistics were introduced.  
  
Author: Justin Pryzby  
Reported-by: Justin Pryzby  
Reviewed-by: Tomas Vondra  
Backpatch-through: 10  
Discussion: https://www.postgresql.org/message-id/20210915200928.GP831%40telsasoft.com  

M src/backend/statistics/extended_stats.c

Invalidate all partitions for a partitioned table in publication.

commit   : 9eff8593265929d3a1fcdee375bd0a801c12b367    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 22 Sep 2021 08:13:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 22 Sep 2021 08:13:37 +0530    

Click here for diff

Updates/Deletes on a partition were allowed even without replica identity  
after the parent table was added to a publication. This would later lead  
to an error on subscribers. The reason was that we were not invalidating  
the partition's relcache and the publication information for partitions  
was not getting rebuilt. Similarly, we were not invalidating the  
partitions' relcache after dropping a partitioned table from a publication  
which will prohibit Updates/Deletes on its partition without replica  
identity even without any publication.  
  
Reported-by: Haiying Tang  
Author: Hou Zhijie and Vignesh C  
Reviewed-by: Vignesh C and Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/OS0PR01MB6113D77F583C922F1CEAA1C3FBD29@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/include/catalog/pg_publication.h
M src/include/commands/publicationcmds.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Fix "single value strategy" index deletion issue.

commit   : e665129c4727004e7a7c12c86d077abc750b3307    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 21 Sep 2021 18:57:31 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 21 Sep 2021 18:57:31 -0700    

Click here for diff

It is not appropriate for deduplication to apply single value strategy  
when triggered by a bottom-up index deletion pass.  This wastes cycles  
because later bottom-up deletion passes will overinterpret older  
duplicate tuples that deduplication actually just skipped over "by  
design".  It also makes bottom-up deletion much less effective for low  
cardinality indexes that happen to cross a meaningless "index has single  
key value per leaf page" threshold.  
  
To fix, slightly narrow the conditions under which deduplication's  
single value strategy is considered.  We already avoided the strategy  
for a unique index, since our high level goal must just be to buy time  
for VACUUM to run (not to buy space).  We'll now also avoid it when we  
just had a bottom-up pass that reported failure.  The two cases share  
the same high level goal, and already overlapped significantly, so this  
approach is quite natural.  
  
Oversight in commit d168b666, which added bottom-up index deletion.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznaOvM+Gyj-JQ0X=JxoMDxctDTYjiEuETdAGbF5EUc3MA@mail.gmail.com  
Backpatch: 14-, where bottom-up deletion was introduced.  

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

Fix places in TestLib.pm in need of adaptation to the output of Msys perl

commit   : 90251ff199858844fa450ba9614092c06c67fc4f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Sep 2021 08:43:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Sep 2021 08:43:00 +0900    

Click here for diff

Contrary to the output of native perl, Msys perl generates outputs with  
CRLFs characters.  There are already places in the TAP code where CRLFs  
(\r\n) are automatically converted to LF (\n) on Msys, but we missed a  
couple of places when running commands and using their output for  
comparison, that would lead to failures.  
  
This problem has been found thanks to the test added in 5adb067 using  
TestLib::command_checks_all(), but after a closer look more code paths  
were missing a filter.  
  
This is backpatched all the way down to prevent any surprises if a new  
test is introduced in stable branches.  
  
Reviewed-by: Andrew Dunstan, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/test/perl/TestLib.pm

Fix misevaluation of STABLE parameters in CALL within plpgsql.

commit   : 2ad5f963e1306aa6f4cf96076a230e96529d2237    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Sep 2021 19:06:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Sep 2021 19:06:33 -0400    

Click here for diff

Before commit 84f5c2908, a STABLE function in a plpgsql CALL  
statement's argument list would see an up-to-date snapshot,  
because exec_stmt_call would push a new snapshot.  I got rid of  
that because the possibility of the snapshot disappearing within  
COMMIT made it too hard to manage a snapshot across the CALL  
statement.  That's fine so far as the procedure itself goes,  
but I forgot to think about the possibility of STABLE functions  
within the CALL argument list.  As things now stand, those'll  
be executed with the Portal's snapshot as ActiveSnapshot,  
keeping them from seeing updates more recent than Portal startup.  
  
(VOLATILE functions don't have a problem because they take their  
own snapshots; which indeed is also why the procedure itself  
doesn't have a problem.  There are no STABLE procedures.)  
  
We can fix this by pushing a new snapshot transiently within  
ExecuteCallStmt itself.  Popping the snapshot before we get  
into the procedure proper eliminates the management problem.  
The possibly-useless extra snapshot-grab is slightly annoying,  
but it's no worse than what happened before 84f5c2908.  
  
Per bug #17199 from Alexander Nawratil.  Back-patch to v11,  
like the previous patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/functioncmds.c
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Document XLOG_INCLUDE_XID a little better

commit   : c1d1ae1db23796e4d1b04f5c087944722cf1446a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Sep 2021 19:47:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Sep 2021 19:47:53 -0300    

Click here for diff

I noticed that commit 0bead9af484c left this flag undocumented in  
XLogSetRecordFlags, which led me to discover that the flag doesn't  
actually do what the one comment on it said it does.  Improve the  
situation by adding some more comments.  
  
Backpatch to 14, where the aforementioned commit appears.  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Stamp 14rc1.

commit   : 8aed7f7a2ec46ad60c84c3c97300210850c3fbc8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Sep 2021 17:33:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Sep 2021 17:33:01 -0400    

Click here for diff

M configure
M configure.ac

Remove overzealous index deletion assertion.

commit   : 955a6a893498a5d3af544d9c0b1c292b19ec1690    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 20 Sep 2021 14:26:24 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 20 Sep 2021 14:26:24 -0700    

Click here for diff

A broken HOT chain is not an unexpected condition, even when the offset  
number points past the end of the page's line pointer array.  
heap_prune_chain() does not (and never has) treated this condition as  
unexpected, so derivative code in heap_index_delete_tuples() shouldn't  
do so either.  
  
Oversight in commit 4228817449.  
  
The assertion can probably only fail on Postgres 14 and master.  Earlier  
releases don't have commit 3c3b8a4b, which taught VACUUM to truncate the  
line pointer array of heap pages.  Backpatch all the same, just to be  
consistent.  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, just like commit 4228817449.  

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

Translation updates

commit   : 3e8525aab86e78593844c9b395be40938582ebaf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Sep 2021 16:23:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Sep 2021 16:23:13 +0200    

Click here for diff

Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 10b675b81a3a04bac460cb049e0b7b6e17fb4795  

M src/backend/nls.mk
M src/backend/po/de.po
M src/backend/po/fr.po
D src/backend/po/id.po
M src/backend/po/ja.po
D src/backend/po/pl.po
D src/backend/po/pt_BR.po
M src/backend/po/ru.po
D src/backend/po/tr.po
M src/backend/po/uk.po
M src/bin/initdb/nls.mk
M src/bin/initdb/po/el.po
M src/bin/initdb/po/fr.po
D src/bin/initdb/po/he.po
D src/bin/initdb/po/it.po
M src/bin/initdb/po/ja.po
D src/bin/initdb/po/pl.po
D src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/tr.po
M src/bin/initdb/po/uk.po
D src/bin/initdb/po/vi.po
M src/bin/initdb/po/zh_CN.po
M src/bin/pg_amcheck/nls.mk
M src/bin/pg_amcheck/po/de.po
M src/bin/pg_amcheck/po/el.po
M src/bin/pg_amcheck/po/fr.po
M src/bin/pg_amcheck/po/ja.po
A src/bin/pg_amcheck/po/ru.po
M src/bin/pg_amcheck/po/uk.po
M src/bin/pg_amcheck/po/zh_CN.po
M src/bin/pg_archivecleanup/nls.mk
M src/bin/pg_archivecleanup/po/el.po
M src/bin/pg_archivecleanup/po/ja.po
D src/bin/pg_archivecleanup/po/pl.po
M src/bin/pg_archivecleanup/po/ru.po
M src/bin/pg_archivecleanup/po/tr.po
M src/bin/pg_archivecleanup/po/uk.po
D src/bin/pg_archivecleanup/po/vi.po
M src/bin/pg_archivecleanup/po/zh_CN.po
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/fr.po
D src/bin/pg_basebackup/po/he.po
D src/bin/pg_basebackup/po/it.po
M src/bin/pg_basebackup/po/ja.po
D src/bin/pg_basebackup/po/pl.po
D src/bin/pg_basebackup/po/pt_BR.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_basebackup/po/uk.po
D src/bin/pg_basebackup/po/vi.po
M src/bin/pg_basebackup/po/zh_CN.po
M src/bin/pg_checksums/po/el.po
M src/bin/pg_checksums/po/ja.po
M src/bin/pg_checksums/po/ru.po
M src/bin/pg_checksums/po/uk.po
M src/bin/pg_checksums/po/zh_CN.po
M src/bin/pg_config/nls.mk
M src/bin/pg_config/po/el.po
M src/bin/pg_config/po/fr.po
M src/bin/pg_config/po/ja.po
D src/bin/pg_config/po/nb.po
D src/bin/pg_config/po/ro.po
M src/bin/pg_config/po/ru.po
D src/bin/pg_config/po/ta.po
M src/bin/pg_config/po/tr.po
M src/bin/pg_config/po/uk.po
M src/bin/pg_config/po/zh_CN.po
D src/bin/pg_config/po/zh_TW.po
M src/bin/pg_controldata/nls.mk
M src/bin/pg_controldata/po/el.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_controldata/po/ja.po
D src/bin/pg_controldata/po/pl.po
D src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/uk.po
D src/bin/pg_controldata/po/vi.po
M src/bin/pg_controldata/po/zh_CN.po
M src/bin/pg_ctl/nls.mk
M src/bin/pg_ctl/po/cs.po
M src/bin/pg_ctl/po/el.po
M src/bin/pg_ctl/po/fr.po
D src/bin/pg_ctl/po/he.po
M src/bin/pg_ctl/po/ja.po
D src/bin/pg_ctl/po/pl.po
D src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_ctl/po/uk.po
M src/bin/pg_ctl/po/zh_CN.po
M src/bin/pg_dump/nls.mk
M src/bin/pg_dump/po/cs.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/el.po
M src/bin/pg_dump/po/fr.po
D src/bin/pg_dump/po/he.po
D src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/ja.po
D src/bin/pg_dump/po/pl.po
D src/bin/pg_dump/po/pt_BR.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_dump/po/uk.po
M src/bin/pg_dump/po/zh_CN.po
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_resetwal/po/el.po
M src/bin/pg_resetwal/po/fr.po
D src/bin/pg_resetwal/po/it.po
M src/bin/pg_resetwal/po/ja.po
D src/bin/pg_resetwal/po/pl.po
D 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_resetwal/po/zh_CN.po
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/po/de.po
M src/bin/pg_rewind/po/el.po
M src/bin/pg_rewind/po/fr.po
D src/bin/pg_rewind/po/it.po
M src/bin/pg_rewind/po/ja.po
D src/bin/pg_rewind/po/ko.po
D src/bin/pg_rewind/po/pl.po
D src/bin/pg_rewind/po/pt_BR.po
M src/bin/pg_rewind/po/ru.po
D src/bin/pg_rewind/po/tr.po
M src/bin/pg_rewind/po/uk.po
M src/bin/pg_rewind/po/zh_CN.po
M src/bin/pg_test_fsync/po/el.po
M src/bin/pg_test_fsync/po/ja.po
M src/bin/pg_test_fsync/po/ru.po
M src/bin/pg_test_fsync/po/uk.po
M src/bin/pg_test_fsync/po/zh_CN.po
M src/bin/pg_test_timing/nls.mk
D src/bin/pg_test_timing/po/cs.po
M src/bin/pg_test_timing/po/el.po
M src/bin/pg_test_timing/po/ja.po
D src/bin/pg_test_timing/po/ko.po
D src/bin/pg_test_timing/po/pl.po
M src/bin/pg_test_timing/po/ru.po
D src/bin/pg_test_timing/po/sv.po
D src/bin/pg_test_timing/po/tr.po
M src/bin/pg_test_timing/po/uk.po
D src/bin/pg_test_timing/po/vi.po
M src/bin/pg_test_timing/po/zh_CN.po
M src/bin/pg_upgrade/po/cs.po
M src/bin/pg_upgrade/po/es.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_upgrade/po/tr.po
M src/bin/pg_upgrade/po/uk.po
M src/bin/pg_upgrade/po/zh_CN.po
M src/bin/pg_verifybackup/po/el.po
M src/bin/pg_verifybackup/po/fr.po
M src/bin/pg_verifybackup/po/ja.po
M src/bin/pg_verifybackup/po/ru.po
M src/bin/pg_verifybackup/po/uk.po
M src/bin/pg_verifybackup/po/zh_CN.po
M src/bin/pg_waldump/nls.mk
M src/bin/pg_waldump/po/cs.po
M src/bin/pg_waldump/po/el.po
M src/bin/pg_waldump/po/es.po
M src/bin/pg_waldump/po/ja.po
M src/bin/pg_waldump/po/ru.po
M src/bin/pg_waldump/po/tr.po
M src/bin/pg_waldump/po/uk.po
D src/bin/pg_waldump/po/vi.po
M src/bin/pg_waldump/po/zh_CN.po
M src/bin/psql/nls.mk
M src/bin/psql/po/de.po
M src/bin/psql/po/el.po
M src/bin/psql/po/fr.po
D src/bin/psql/po/he.po
M src/bin/psql/po/ja.po
D src/bin/psql/po/pl.po
D src/bin/psql/po/pt_BR.po
M src/bin/psql/po/ru.po
M src/bin/psql/po/uk.po
M src/bin/psql/po/zh_CN.po
D src/bin/psql/po/zh_TW.po
M src/bin/scripts/nls.mk
M src/bin/scripts/po/cs.po
M src/bin/scripts/po/de.po
A src/bin/scripts/po/el.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/fr.po
D src/bin/scripts/po/he.po
D src/bin/scripts/po/it.po
M src/bin/scripts/po/ja.po
D src/bin/scripts/po/pl.po
D src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/tr.po
M src/bin/scripts/po/uk.po
M src/bin/scripts/po/zh_CN.po
M src/interfaces/ecpg/ecpglib/nls.mk
A src/interfaces/ecpg/ecpglib/po/el.po
M src/interfaces/ecpg/ecpglib/po/ja.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/ecpglib/po/uk.po
M src/interfaces/ecpg/ecpglib/po/zh_CN.po
M src/interfaces/ecpg/preproc/nls.mk
M src/interfaces/ecpg/preproc/po/cs.po
M src/interfaces/ecpg/preproc/po/de.po
A src/interfaces/ecpg/preproc/po/el.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/ecpg/preproc/po/ja.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/ecpg/preproc/po/tr.po
M src/interfaces/ecpg/preproc/po/uk.po
M src/interfaces/ecpg/preproc/po/zh_CN.po
M src/interfaces/libpq/nls.mk
M src/interfaces/libpq/po/el.po
M src/interfaces/libpq/po/fr.po
D src/interfaces/libpq/po/he.po
D src/interfaces/libpq/po/it.po
M src/interfaces/libpq/po/ja.po
D src/interfaces/libpq/po/pl.po
D src/interfaces/libpq/po/pt_BR.po
M src/interfaces/libpq/po/ru.po
D src/interfaces/libpq/po/tr.po
M src/interfaces/libpq/po/uk.po
M src/interfaces/libpq/po/zh_CN.po
D src/interfaces/libpq/po/zh_TW.po
M src/pl/plperl/nls.mk
M src/pl/plperl/po/el.po
M src/pl/plperl/po/fr.po
M src/pl/plperl/po/ja.po
M src/pl/plperl/po/ru.po
M src/pl/plperl/po/uk.po
M src/pl/plperl/po/zh_CN.po
D src/pl/plperl/po/zh_TW.po
M src/pl/plpgsql/src/nls.mk
M src/pl/plpgsql/src/po/de.po
A src/pl/plpgsql/src/po/el.po
M src/pl/plpgsql/src/po/fr.po
M src/pl/plpgsql/src/po/ja.po
D src/pl/plpgsql/src/po/ro.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpgsql/src/po/uk.po
M src/pl/plpgsql/src/po/zh_CN.po
D src/pl/plpgsql/src/po/zh_TW.po
M src/pl/plpython/po/el.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/ja.po
M src/pl/plpython/po/ru.po
M src/pl/plpython/po/uk.po
M src/pl/plpython/po/zh_CN.po
M src/pl/tcl/nls.mk
M src/pl/tcl/po/el.po
M src/pl/tcl/po/fr.po
M src/pl/tcl/po/ja.po
D src/pl/tcl/po/pt_BR.po
D src/pl/tcl/po/ro.po
M src/pl/tcl/po/ru.po
M src/pl/tcl/po/uk.po
M src/pl/tcl/po/zh_CN.po
D src/pl/tcl/po/zh_TW.po

doc: Replace characters that the PDF build cannot handle

commit   : 89a967e9b5262db1cea62a5725dd7bd7489d240d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Sep 2021 10:05:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Sep 2021 10:05:46 +0200    

Click here for diff

A few characters in the acknowledgments list cannot be handled by the  
PDF build, so replace with a similar ASCII character.  

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

Update list of acknowledgments in release notes

commit   : 3609b453cd655060562f8750ce0ce4bdddf43a57    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Sep 2021 09:18:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Sep 2021 09:18:17 +0200    

Click here for diff

current through 66061077155d68463ec00604ba7d6f0ae69716e8  

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

Disallow extended statistics on system columns

commit   : 66061077155d68463ec00604ba7d6f0ae69716e8    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 20 Sep 2021 00:34:57 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 20 Sep 2021 00:34:57 +0200    

Click here for diff

Since introduction of extended statistics, we've disallowed references  
to system columns. So for example  
  
    CREATE STATISTICS s ON ctid FROM t;  
  
would fail. But with extended statistics on expressions, it was possible  
to work around this limitation quite easily  
  
    CREATE STATISTICS s ON (ctid::text) FROM t;  
  
This is an oversight in a4d75c86bf, fixed by adding a simple check.  
Backpatch to PostgreSQL 14, where support for extended statistics on  
expressions was introduced.  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/20210816013255.GS10479%40telsasoft.com  

M src/backend/commands/statscmds.c

Doc: further tweaking of v14 release notes.

commit   : 2a9a34c3100d8c0311c63baaa435be38a7d7aae5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Sep 2021 12:10:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Sep 2021 12:10:34 -0400    

Click here for diff

A recent question reminded me that the notes' description of  
commit 86dc90056 rather undersold its benefits.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: fix typos.

commit   : 55abb37506e9af4bbc4d8410ac8469b9d38e84e7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Sep 2021 11:36:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Sep 2021 11:36:53 -0400    

Click here for diff

"PGcon" should be "PGconn".  Noted by D. Frey.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/lobj.sgml

Doc: copy-editing for v14 release notes.

commit   : f8dacf125db42547579629be1936fa613bad8070    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Sep 2021 17:09:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Sep 2021 17:09:46 -0400    

Click here for diff

Improve various item descriptions.  Rearrange some things into  
(IMO) more logical order.  Fix missing markup and dubious  
choices of link destinations.  Drop a couple of items that  
were later back-patched or otherwise don't seem to need  
to be documented here.  

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

Doc: update v14 release notes through today.

commit   : 68b6ed42e69f920c67902e33d4a648bd39e0a19b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Sep 2021 13:46:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Sep 2021 13:46:07 -0400    

Click here for diff

Account for recent commits, notably reversion of 0827e8af7.  
Strip trailing spaces.  

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

pageinspect: Make page deletion elog less chatty.

commit   : 55934416d2c50cdc9fba044a97fb14da1c779589    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 17 Sep 2021 14:19:50 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 17 Sep 2021 14:19:50 -0700    

Click here for diff

An elog that reports the value of a transaction ID stored on a deleted  
nbtree page was added by commit e5d8a999, which taught page deletion to  
store full 64-bit XIDs.  It seems very chatty on further reflection, so  
lower its elevel from NOTICE to DEBUG2.  
  
Author: Peter Geoghegan <[email protected]>  
Backpatch: 14-, just like the nbtree XID enhancement.  

M contrib/pageinspect/btreefuncs.c

Fix pull_varnos to cope with translated PlaceHolderVars.

commit   : 4d5b4483db1c6370861ca968edd753ab4dc03f9d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Sep 2021 15:41:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Sep 2021 15:41:16 -0400    

Click here for diff

Commit 55dc86eca changed pull_varnos to use (if possible) the associated  
ph_eval_at for a PlaceHolderVar.  I missed a fine point though: we might  
be looking at a PHV in the quals or tlist of a child appendrel, in which  
case we need to compute a ph_eval_at value that's been translated in the  
same way that the PHV itself has been (cf. adjust_appendrel_attrs).  
Fortunately, enough info is available in the PlaceHolderInfo to make  
such translation possible without additional outside data, so we don't  
need another round of uglification of planner APIs.  This is a little  
bit complicated, but since it's a hard-to-hit corner case, I'm not much  
worried about adding cycles here.  
  
Per report from Jaime Casanova.  Back-patch to v12, like the previous  
commit.  
  
Discussion: https://postgr.es/m/20210915230959.GB17635@ahch-to  

M src/backend/optimizer/util/var.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix EXPLAIN to handle SEARCH BREADTH FIRST queries.

commit   : 388726753b638fb9938883bdd057b2ffe6f950f5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Sep 2021 10:45:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Sep 2021 10:45:42 -0400    

Click here for diff

The rewriter transformation for SEARCH BREADTH FIRST produces a  
FieldSelect on a Var of type RECORD, where the Var references the  
recursive union's worktable output.  EXPLAIN VERBOSE failed to handle  
this case, because it only expected such Vars to appear in CteScans  
not WorkTableScans.  Fix that, and add some test cases exercising  
EXPLAIN on SEARCH and CYCLE queries.  
  
In principle this oversight is an old bug, but it seems that the  
case is unreachable without SEARCH BREADTH FIRST, because the  
parser fails when attempting to create such a reference manually.  
So for today I'll just patch HEAD/v14.  Someday we might find that  
the code portion of this patch needs to be back-patched further.  
  
Per report from Atsushi Torikoshi.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Message style improvements

commit   : f46dc96fcc652d5c29343e0eb4fa8e86a9468c36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Sep 2021 14:48:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Sep 2021 14:48:52 +0200    

Click here for diff

M src/backend/commands/typecmds.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/multirangetypes.c
M src/test/regress/expected/jsonb.out

Fix performance regression from session statistics.

commit   : 7890a423470b3a763aa22faf69a44cb6a2df8f0e    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Sep 2021 02:02:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Sep 2021 02:02:40 -0700    

Click here for diff

Session statistics, as introduced by 960869da08, had several shortcomings:  
  
- an additional GetCurrentTimestamp() call that also impaired the accuracy of  
  the data collected  
  
  This can be avoided by passing the current timestamp we already have in  
  pgstat_report_stat().  
  
- an additional statistics UDP packet sent every 500ms  
  
  This is solved by adding the new statistics to PgStat_MsgTabstat.  
  This is conceptually ugly, because session statistics are not  
  table statistics.  But the struct already contains data unrelated  
  to tables, so there is not much damage done.  
  
  Connection and disconnection are reported in separate messages, which  
  reduces the number of additional messages to two messages per session and a  
  slight increase in PgStat_MsgTabstat size (but the same number of table  
  stats fit).  
  
- Session time computation could overflow on systems where long is 32 bit.  
  
Reported-By: Andres Freund <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Laurenz Albe <[email protected]>  
Discussion: https://postgr.es/m/20210801205501.nyxzxoelqoo4x2qc%40alap3.anarazel.de  
Backpatch: 14-, where the feature was introduced.  

M src/backend/postmaster/pgstat.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/backend_status.c
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

Fix variable shadowing in procarray.c.

commit   : 92a8d7610ea0f440a80328ced342b782180a3f43    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 16 Sep 2021 13:06:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 16 Sep 2021 13:06:21 +0900    

Click here for diff

ProcArrayGroupClearXid function has a parameter named "proc",  
but the same name was used for its local variables. This commit fixes  
this variable shadowing, to improve code readability.  
  
Back-patch to all supported versions, to make future back-patching  
easy though this patch is classified as refactoring only.  
  
Reported-by: Ranier Vilela  
Author: Ranier Vilela, Aleksander Alekseev  
https://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com  

M src/backend/storage/ipc/procarray.c

Use int instead of size_t in procarray.c.

commit   : fe8821ca7da4bc1f72688cece0b7f2c3076d813d    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 16 Sep 2021 12:52:30 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 16 Sep 2021 12:52:30 +0900    

Click here for diff

All size_t variables declared in procarray.c are actually int ones.  
Let's use int instead of size_t for those variables. Which would  
reduce Wsign-compare compiler warnings.  
  
Back-patch to v14 where commit 941697c3c1 added size_t variables  
in procarray.c, to make future back-patching easy though  
this patch is classified as refactoring only.  
  
Reported-by: Ranier Vilela  
Author: Ranier Vilela, Aleksander Alekseev  
https://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com  

M src/backend/storage/ipc/procarray.c

Disallow LISTEN in background workers.

commit   : d84d62b6225b4af86cd9837b71f6fd2cf33fe80c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Sep 2021 12:31:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Sep 2021 12:31:56 -0400    

Click here for diff

It's possible to execute user-defined SQL in some background processes;  
for example, logical replication workers can fire triggers.  This opens  
the possibility that someone would try to execute LISTEN in such a  
context.  But since only regular backends ever call  
ProcessNotifyInterrupt, no messages would actually be received, and  
thus the registered listener would simply prevent the message queue  
from being cleaned.  Eventually NOTIFY would stop working, which is bad.  
  
Perhaps someday somebody will invent infrastructure to make listening  
in a background worker actually useful.  In the meantime, forbid it.  
  
Back-patch to v13, which is where we introduced the MyBackendType  
variable.  It'd be a lot harder to implement the check without that,  
and it doesn't seem worth the trouble.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/utility.c

Fix hash_array

commit   : 9b2fd490577bc957429f337cfd72869eb8ef08c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 11:59:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 11:59:34 +0200    

Click here for diff

Commit 054adca641ac1279dc8d9b74fda41948ac35e9a9 neglected to  
initialize the type_id field of the synthesized type cache entry, so  
it would make a new one on every call.  
  
Also, better use the per-function memory context for this; otherwise  
it leaks memory.  
  
Discussion: https://www.postgresql.org/message-id/flat/17158-8a2ba823982537a4%40postgresql.org  

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

doc: Clarify refresh options for DROP PUBLICATION

commit   : 6e6adbddbce1391ffb676ce9779f24c25a6a9f09    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 15 Sep 2021 09:54:45 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 15 Sep 2021 09:54:45 +0200    

Click here for diff

The available refresh options are specified as refresh_options under  
REFRESH PUBLICATION, and DROP PUBLICATION itself has an option named  
refresh. Clarify what we mean by refresh options to avoid confusion.  
  
Backpatch through v14 where ALTER SUBSCRIPTION ... DROP PUBLICATION  
was introduced.  
  
Author: Masahiko Sawada <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Peter Smith <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoCm1wJ3A8Q9EmBjRbShYkJ+o+Oa_z9O0hvwhvhUa2BSyg@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/alter_subscription.sgml

Send NOTIFY signals during CommitTransaction.

commit   : 0eff10a008447bc6f6594547e2fc04756849eaed    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 17:18:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 17:18:25 -0400    

Click here for diff

Formerly, we sent signals for outgoing NOTIFY messages within  
ProcessCompletedNotifies, which was also responsible for sending  
relevant ones of those messages to our connected client.  It therefore  
had to run during the main-loop processing that occurs just before  
going idle.  This arrangement had two big disadvantages:  
  
* Now that procedures allow intra-command COMMITs, it would be  
useful to send NOTIFYs to other sessions immediately at COMMIT  
(though, for reasons of wire-protocol stability, we still shouldn't  
forward them to our client until end of command).  
  
* Background processes such as replication workers would not send  
NOTIFYs at all, since they never execute the client communication  
loop.  We've had requests to allow triggers running in replication  
workers to send NOTIFYs, so that's a problem.  
  
To fix these things, move transmission of outgoing NOTIFY signals  
into AtCommit_Notify, where it will happen during CommitTransaction.  
Also move the possible call of asyncQueueAdvanceTail there, to  
ensure we don't bloat the async SLRU if a background worker sends  
many NOTIFYs with no one listening.  
  
We can also drop the call of asyncQueueReadAllNotifications,  
allowing ProcessCompletedNotifies to go away entirely.  That's  
because commit 790026972 added a call of ProcessNotifyInterrupt  
adjacent to PostgresMain's call of ProcessCompletedNotifies,  
and that does its own call of asyncQueueReadAllNotifications,  
meaning that we were uselessly doing two such calls (inside two  
separate transactions) whenever inbound notify signals coincided  
with an outbound notify.  We need only set notifyInterruptPending  
to ensure that ProcessNotifyInterrupt runs, and we're done.  
  
The existing documentation suggests that custom background workers  
should call ProcessCompletedNotifies if they want to send NOTIFY  
messages.  To avoid an ABI break in the back branches, reduce it  
to an empty routine rather than removing it entirely.  Removal  
will occur in v15.  
  
Although the problems mentioned above have existed for awhile,  
I don't feel comfortable back-patching this any further than v13.  
There was quite a bit of churn in adjacent code between 12 and 13.  
At minimum we'd have to also backpatch 51004c717, and a good deal  
of other adjustment would also be needed, so the benefit-to-risk  
ratio doesn't look attractive.  
  
Per bug #15293 from Michael Powers (and similar gripes from others).  
  
Artur Zakirov and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bgworker.sgml
M src/backend/access/transam/xact.c
M src/backend/commands/async.c
M src/backend/tcop/postgres.c
M src/include/commands/async.h

Fix planner error with multiple copies of an AlternativeSubPlan.

commit   : 29aa0ce361d16a79e4ebf7561cbb16ed1d0e2211    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 15:11:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 15:11:21 -0400    

Click here for diff

It's possible for us to copy an AlternativeSubPlan expression node  
into multiple places, for example the scan quals of several  
partition children.  Then it's possible that we choose a different  
one of the alternatives as optimal in each place.  Commit 41efb8340  
failed to consider this scenario, so its attempt to remove "unused"  
subplans could remove subplans that were still used elsewhere.  
  
Fix by delaying the removal logic until we've examined all the  
AlternativeSubPlans in a given query level.  (This does assume that  
AlternativeSubPlans couldn't get copied to other query levels, but  
for the foreseeable future that's fine; cf qual_is_pushdown_safe.)  
  
Per report from Rajkumar Raghuwanshi.  Back-patch to v14  
where the faulty logic came in.  
  
Discussion: https://postgr.es/m/CAKcux6==O3NNZC3bZ2prRYv3cjm3_Zw1GfzmOjEVqYN4jub2+Q@mail.gmail.com  

M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

jit: Do not try to shut down LLVM state in case of LLVM triggered errors.

commit   : 4e86887e0922f20add67e2473c7baae8c7f05d5e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 13 Sep 2021 18:07:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 13 Sep 2021 18:07:19 -0700    

Click here for diff

If an allocation failed within LLVM it is not safe to call back into LLVM as  
LLVM is not generally safe against exceptions / stack-unwinding. Thus errors  
while in LLVM code are promoted to FATAL. However llvm_shutdown() did call  
back into LLVM even in such cases, while llvm_release_context() was careful  
not to do so.  
  
We cannot generally skip shutting down LLVM, as that can break profiling. But  
it's OK to do so if there was an error from within LLVM.  
  
Reported-By: Jelte Fennema <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178C52CCA0A8DEA0207DC14F7FF9@AM5PR83MB0178.EURPRD83.prod.outlook.com  
Backpatch: 11-, where jit was introduced  

M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/include/jit/llvmjit.h

Fix potential for compiler warning in GlobalVisTestFor().

commit   : 0d0bbee5e3ee2eabe3a1f6081cbc4226520764c0    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 13 Sep 2021 16:50:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 13 Sep 2021 16:50:10 -0700    

Click here for diff

In d9d8aa9bb9a I added a defensive NULL assignment to protect against a  
not-too-smart compiler warning about unitialized variable use after the  
switch. Unfortunately I only did so on master and forgot to adjust that for  
14.  
  
Stephen noticed that there actually is a compiler warning :(.  
  
Reported-By: Stephen Frost <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/procarray.c

Clear conn->errorMessage at successful completion of PQconnectdb().

commit   : 896a0c44f93b0b449fdf7e6c3973deab5fdfed4f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 16:53:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 16:53:11 -0400    

Click here for diff

Commits ffa2e4670 and 52a10224e caused libpq's connection-establishment  
functions to usually leave a nonempty string in the connection's  
errorMessage buffer, even after a successful connection.  While that  
was intentional on my part, more sober reflection says that it wasn't  
a great idea: the string would be a bit confusing.  Also this broke at  
least one application that checked for connection success by examining  
the errorMessage, instead of using PQstatus() as documented.  Let's  
clear the buffer at success exit, restoring the pre-v14 behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix EXIT out of outermost block in plpgsql.

commit   : 4ffd3fe4d6ccc9ff36271e5a21ea3b065621b982    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 12:42:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 12:42:03 -0400    

Click here for diff

Ordinarily, using EXIT this way would draw "control reached end of  
function without RETURN".  However, if the function is one where we  
don't require an explicit RETURN (such as a DO block), that should  
not happen.  It did anyway, because add_dummy_return() neglected to  
account for the case.  
  
Per report from Herwig Goemans.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_control.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/sql/plpgsql_control.sql

doc: fix PG 14 release note typo

commit   : 10faeb7ed5049afb70d26561e9991d52c363bd8e    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 Sep 2021 10:42:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 Sep 2021 10:42:16 -0400    

Click here for diff

Reported-by: Robert Haas  
  
Backpatch-through: 14 only  

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

Doc: Remove type information for import_generated in postgres-fdw.sgml.

commit   : 749945c2425b7c83d95b0359733f4839049fdcb8    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 13 Sep 2021 17:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 13 Sep 2021 17:30:00 +0900    

Click here for diff

The type information for FDW options is only added to HEAD; remove this  
from back branches.  Oversight in commit aa769f80e.  
  
Apply the patch to v12, v13, and v14.  
  
Discussion: https://postgr.es/m/CAPmGK14z92twaKwRoccHbbh5Va5vbRDZcTYYTx50+0JTQ8xx_g@mail.gmail.com  

M doc/src/sgml/postgres-fdw.sgml

Fix reorder buffer memory accounting for toast changes.

commit   : f5e0ff4631b5402950db69c989c88c4c6295504b    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Sep 2021 10:35:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Sep 2021 10:35:00 +0530    

Click here for diff

While processing toast changes in logical decoding, we rejigger the  
tuple change to point to in-memory toast tuples instead to on-disk toast  
tuples. And, to make sure the memory accounting is correct, we were  
subtracting the old change size and then after re-computing the new tuple,  
re-adding its size at the end. Now, if there is any error before we add  
the new size, we will release the changes and that will update the  
accounting info (subtracting the size from the counters). And we were  
underflowing there which leads to an assertion failure in assert enabled  
builds and wrong memory accounting in reorder buffer otherwise.  
  
Author: Bertrand Drouvot  
Reviewed-by: Amit Kapila  
Backpatch-through: 13, where memory accounting was introduced  
Discussion: https://postgr.es/m/[email protected]  

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

Fix error handling with threads on OOM in ECPG connection logic

commit   : cc057fb315e24b78552f5b7ac05792418042e71b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Sep 2021 13:24:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Sep 2021 13:24:04 +0900    

Click here for diff

An out-of-memory failure happening when allocating the structures to  
store the connection parameter keywords and values would mess up with  
the set of connections saved, as on failure the pthread mutex would  
still be hold with the new connection object listed but free()'d.  
  
Rather than just unlocking the mutex, which would leave the static list  
of connections into an inconsistent state, move the allocation for the  
structures of the connection parameters before beginning the test  
manipulation.  This ensures that the list of connections and the  
connection mutex remain consistent all the time in this code path.  
  
This error is unlikely going to happen, but this could mess up badly  
with ECPG clients in surprising ways, so backpatch all the way down.  
  
Reported-by: ryancaicse  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/interfaces/ecpg/ecpglib/connect.c

Make pg_regexec() robust against out-of-range search_start.

commit   : b33283cbd336adbf982c21aac1399130c8ffaaa9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Sep 2021 15:19:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Sep 2021 15:19:31 -0400    

Click here for diff

If search_start is greater than the length of the string, we should just  
return REG_NOMATCH immediately.  (Note that the equality case should  
*not* be rejected, since the pattern might be able to match zero  
characters.)  This guards various internal assumptions that the min of a  
range of string positions is not more than the max.  Violation of those  
assumptions could allow an attempt to fetch string[search_start-1],  
possibly causing a crash.  
  
Jaime Casanova pointed out that this situation is reachable with the  
new regexp_xxx functions that accept a user-specified start position.  
I don't believe it's reachable via any in-core call site in v14 and  
below.  However, extensions could possibly call pg_regexec with an  
out-of-range search_start, so let's back-patch the fix anyway.  
  
Discussion: https://postgr.es/m/20210911180357.GA6870@ahch-to  

M src/backend/regex/regexec.c

Fix some anomalies with NO SCROLL cursors.

commit   : d844cd75a6764a1dd2d8b3410144df9ebf8a0f04    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Sep 2021 13:18:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Sep 2021 13:18:32 -0400    

Click here for diff

We have long forbidden fetching backwards from a NO SCROLL cursor,  
but the prohibition didn't extend to cases in which we rewind the  
query altogether and then re-fetch forwards.  I think the reason is  
that this logic was mainly meant to protect plan nodes that can't  
be run in the reverse direction.  However, re-reading the query output  
is problematic if the query is volatile (which includes SELECT FOR  
UPDATE, not just queries with volatile functions): the re-read can  
produce different results, which confuses the cursor navigation logic  
completely.  Another reason for disliking this approach is that some  
code paths will either fetch backwards or rewind-and-fetch-forwards  
depending on the distance to the target row; so that seemingly  
identical use-cases may or may not draw the "cursor can only scan  
forward" error.  Hence, let's clean things up by disallowing rewind  
as well as fetch-backwards in a NO SCROLL cursor.  
  
Ordinarily we'd only make such a definitional change in HEAD, but  
there is a third reason to consider this change now.  Commit ba2c6d6ce  
created some new user-visible anomalies for non-scrollable cursors  
WITH HOLD, in that navigation in the cursor result got confused if the  
cursor had been partially read before committing.  The only good way  
to resolve those anomalies is to forbid rewinding such a cursor, which  
allows removal of the incorrect cursor state manipulations that  
ba2c6d6ce added to PersistHoldablePortal.  
  
To minimize the behavioral change in the back branches (including  
v14), refuse to rewind a NO SCROLL cursor only when it has a holdStore,  
ie has been held over from a previous transaction due to WITH HOLD.  
This should avoid breaking most applications that have been sloppy  
about whether to declare cursors as scrollable.  We'll enforce the  
prohibition across-the-board beginning in v15.  
  
Back-patch to v11, as ba2c6d6ce was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/portalcmds.c
M src/backend/tcop/pquery.c
M src/test/regress/expected/portals.out
M src/test/regress/sql/portals.sql

Avoid fetching from an already-terminated plan.

commit   : b7056c0a25e545f4c1efcc1e2a6118e4626e377b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Sep 2021 13:36:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Sep 2021 13:36:31 -0400    

Click here for diff

Some plan node types don't react well to being called again after  
they've already returned NULL.  PortalRunSelect() has long dealt  
with this by calling the executor with NoMovementScanDirection  
if it sees that we've already run the portal to the end.  However,  
commit ba2c6d6ce overlooked this point, so that persisting an  
already-fully-fetched cursor would fail if it had such a plan.  
  
Per report from Tomas Barton.  Back-patch to v11, as the faulty  
commit was.  (I've omitted a test case because the type of plan  
that causes a problem isn't all that stable.)  
  
Discussion: https://postgr.es/m/CAPV2KRjd=ErgVGbvO2Ty20tKTEZZr6cYsYLxgN_W3eAo9pf5sw@mail.gmail.com  

M src/backend/commands/portalcmds.c

pgbench: Stop counting skipped transactions as soon as timer is exceeded.

commit   : b27d0cd3147e2a0215253f61944c392a30265db8    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 10 Sep 2021 01:28:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 10 Sep 2021 01:28:17 +0900    

Click here for diff

When throttling is used, transactions that lag behind schedule by  
more than the latency limit are counted and reported as skipped.  
Previously, there was the case where pgbench counted all skipped  
transactions even if the timer specified in -T option was exceeded.  
This could take a very long time to do that especially when unrealistically  
high rate setting in -R option caused quite a lot of transactions that  
lagged behind schedule. This could prevent pgbench from ending  
immediately, and so pgbench could look like it got stuck to users.  
  
To fix the issue, this commit changes pgbench so that it stops counting  
skipped transactions as soon as the timer is exceeded. The timer can  
make pgbench end soon even when there are lots of skipped transactions  
that have not been counted yet.  
  
Note that there is no guarantee that all skipped transactions are  
counted under -T though there is under -t. This is OK in practice  
because it's very unlikely to happen with realistic setting. Also this is  
not the issue that this commit newly introdues. There used to be  
the case where pgbench ended without counting all skipped  
transactions since before.  
  
Back-patch to v14. Per discussion, we decided not to bother  
back-patch to the stable branches because it's hard to imagine  
the issue happens in practice (with realistic setting).  
  
Author: Yugo Nagata, Fabien COELHO  
Reviewed-by: Greg Sabino Mullane, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Check for relation length overrun soon enough.

commit   : 7430c774209cd98bbc33076cc3c07497c1086d9a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Sep 2021 11:45:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Sep 2021 11:45:48 -0400    

Click here for diff

We don't allow relations to exceed 2^32-1 blocks, because block  
numbers are 32 bits and the last possible block number is reserved  
to mean InvalidBlockNumber.  There is a check for this in mdextend,  
but that's really way too late, because the smgr API requires us to  
create a buffer for the block-to-be-added, and we do not want to  
have any buffer with blocknum InvalidBlockNumber.  (Such a case  
can trigger assertions in bufmgr.c, plus I think it might confuse  
ReadBuffer's logic for data-past-EOF later on.)  So put the check  
into ReadBuffer.  
  
Per report from Christoph Berg.  It's been like this forever,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix issue with WAL archiving in standby.

commit   : b5ec22bf5e8f19964f7c7d7ef357ff947a38c7fc    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Sep 2021 23:58:05 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Sep 2021 23:58:05 +0900    

Click here for diff

Previously, walreceiver always closed the currently-opened WAL segment  
and created its archive notification file, after it finished writing  
the current segment up and received any WAL data that should be  
written into the next segment. If walreceiver exited just before  
any WAL data in the next segment arrived at standby, it did not  
create the archive notification file of the current segment  
even though that's known completed. This behavior could cause  
WAL archiving of the segment to be delayed until subsequent  
restartpoints or checkpoints created its notification file.  
  
To fix the issue, this commit changes walreceiver so that it creates  
an archive notification file of a current WAL segment immediately  
if that's known completed before receiving next WAL data.  
  
Back-patch to all supported branches.  
  
Reported-by: Kyotaro Horiguchi  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walreceiver.c

Avoid useless malloc/free traffic around getFormattedTypeName().

commit   : 52c300df323e8ebb3d0613baa4711179d9f342f3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 15:09:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 15:09:42 -0400    

Click here for diff

Coverity complained that one caller of getFormattedTypeName() failed  
to free the returned string.  Which is true, but rather than fixing  
that one, let's get rid of this tedious and error-prone requirement.  
Now that getFormattedTypeName() caches its result, strdup'ing that  
result and expecting the caller to free it accomplishes little except  
to waste cycles.  We do create a leak in the case where getTypes didn't  
make a TypeInfo for the type, but that basically shouldn't ever happen.  
  
Back-patch, as commit 6c450a861 was.  This isn't a particularly  
interesting bug fix, but the API change seems like a hazard for  
future back-patching activity if we don't back-patch it.  

M src/bin/pg_dump/pg_dump.c

Fix misleading comments about TOAST access macros.

commit   : 67948a433e18a8561daf89dcc53e591a3fac659a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 14:11:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 14:11:35 -0400    

Click here for diff

Seems to have been my error in commit aeb1631ed.  
Noted by Christoph Berg.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/postgres.h

Fix rewriter to set hasModifyingCTE correctly on rewritten queries.

commit   : 03d01d746b9338dd1568d37d26b344928f82c5ff    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 12:05:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 12:05:43 -0400    

Click here for diff

If we copy data-modifying CTEs from the original query to a replacement  
query (from a DO INSTEAD rule), we must set hasModifyingCTE properly  
in the replacement query.  Failure to do this can cause various  
unpleasantness, such as unsafe usage of parallel plans.  The code also  
neglected to propagate hasRecursive, though that's only cosmetic at  
the moment.  
  
A difficulty arises if the rule action is an INSERT...SELECT.  We  
attach the original query's RTEs and CTEs to the sub-SELECT Query, but  
data-modifying CTEs are only allowed to appear in the topmost Query.  
For the moment, throw an error in such cases.  It would probably be  
possible to avoid this error by attaching the CTEs to the top INSERT  
Query instead; but that would require a bunch of new code to adjust  
ctelevelsup references.  Given the narrowness of the use-case, and  
the need to back-patch this fix, it does not seem worth the trouble  
for now.  We can revisit this if we get field complaints.  
  
Per report from Greg Nancarrow.  Back-patch to all supported branches.  
(The test case added here does not fail before v10, but there are  
plenty of places checking top-level hasModifyingCTE in 9.6, so I have  
no doubt that this code change is necessary there too.)  
  
Greg Nancarrow and Tom Lane  
  
Discussion: https://postgr.es/m/CAJcOf-f68DT=26YAMz_i0+Au3TcLO5oiHY5=fL6Sfuits6r+_w@mail.gmail.com  
Discussion: https://postgr.es/m/CAJcOf-fAdj=nDKMsRhQzndm-O13NY4dL6xGcEvdX5Xvbbi0V7g@mail.gmail.com  

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

Disable anonymous record hash support except in special cases

commit   : 054adca641ac1279dc8d9b74fda41948ac35e9a9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Sep 2021 09:25:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Sep 2021 09:25:46 +0200    

Click here for diff

Commit 01e658fa74 added hash support for row types.  This also added  
support for hashing anonymous record types, using the same approach  
that the type cache uses for comparison support for record types: It  
just reports that it works, but it might fail at run time if a  
component type doesn't actually support the operation.  We get away  
with that for comparison because most types support that.  But some  
types don't support hashing, so the current state can result in  
failures at run time where the planner chooses hashing over sorting,  
whereas that previously worked if only sorting was an option.  
  
We do, however, want the record hashing support for path tracking in  
recursive unions, and the SEARCH and CYCLE clauses built on that.  In  
that case, hashing is the only plan option.  So enable that, this  
commit implements the following approach: The type cache does not  
report that hashing is available for the record type.  This undoes  
that part of 01e658fa74.  Instead, callers that require hashing no  
matter what can override that result themselves.  This patch only  
touches the callers to make the aforementioned recursive query cases  
work, namely the parse analysis of unions, as well as the hash_array()  
function.  
  
Reported-by: Sait Talha Nisanci <[email protected]>  
Bug: #17158  
Discussion: https://www.postgresql.org/message-id/flat/17158-8a2ba823982537a4%40postgresql.org  

M src/backend/parser/analyze.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/cache/typcache.c
M src/include/parser/analyze.h
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

Invalidate relcache for publications defined for all tables.

commit   : 8db27fbc11974ef491fec97be3365277ed4fab20    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 8 Sep 2021 09:58:28 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 8 Sep 2021 09:58:28 +0530    

Click here for diff

Updates/Deletes on a relation were allowed even without replica identity  
after we define the publication for all tables. This would later lead to  
an error on subscribers. The reason was that for such publications we were  
not invalidating the relcache and the publication information for  
relations was not getting rebuilt. Similarly, we were not invalidating the  
relcache after dropping of such publications which will prohibit  
Updates/Deletes without replica identity even without any publication.  
  
Author: Vignesh C and Hou Zhijie  
Reviewed-by: Hou Zhijie, Kyotaro Horiguchi, Amit Kapila  
Backpatch-through: 10, where it was introduced  
Discussion: https://postgr.es/m/CALDaNm0pF6zeWqCA8TCe2sDuwFAy8fCqba=nHampCKag-qLixg@mail.gmail.com  

M src/backend/catalog/dependency.c
M src/backend/commands/publicationcmds.c
M src/include/commands/publicationcmds.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Consistently use read-only instead of "read only"

commit   : b7fd291042a846b04439f122cb81a41d3cd2e8de    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 7 Sep 2021 21:59:25 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 7 Sep 2021 21:59:25 +0200    

Click here for diff

This affects one message and some documentation that used the format  
"read only", unlike everything else that used read-only.  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/CABUevExuxKwn0YM3+wdSeQSvK6CRrJ-hewocGVX3R4-xVX4eMw@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/mvcc.sgml
M src/backend/postmaster/postmaster.c

Finish reverting 3eda9fc09fd6b9a1aec2d0113c633c69c3214b4d.

commit   : 8b895374cd9cf6989bcee5b6f70f65f2d3520224    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Sep 2021 10:52:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Sep 2021 10:52:25 -0400    

Click here for diff

Commit 67c33a114 should have set v14's catversion back to what it was  
before 3eda9fc09, to avoid forcing a useless pg_upgrade cycle on users  
of 14beta3.  Do that now.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h

Fix missing words in comment.

commit   : e66add755df2eae5e874dc96743f3faaf4bced83    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Sep 2021 10:28:55 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Sep 2021 10:28:55 +0300    

Click here for diff

Introduced by commit c3928b467a, backpatch to v14 like that one.  
  
Author: Amit Langote  
Discussion: https://www.postgresql.org/message-id/CA+HiwqFQgNLS6VGntMcuJV6erBFV425xA6wBVnY=41GK4zC0Bw@mail.gmail.com  

M src/backend/executor/nodeForeignscan.c

AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS.

commit   : 47d54b6ba2749f5da72b7ab612e53e7f7b45b819    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 6 Sep 2021 11:27:59 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 6 Sep 2021 11:27:59 -0700    

Click here for diff

We make each AIX shared library export all globals found in .o files  
that originate in the library.  That doesn't include symbols acquired by  
-lpgcommon_shlib.  That is good on average, but it became a problem for  
libpq when commit e6afa8918c461c1dd80c5063a950518fa4e950cd moved five  
official libpq API symbols into src/common.  Fix this by implementing  
the SHLIB_EXPORTS mechanism for AIX, so affected libraries export the  
same symbols that they export on Linux.  This reintroduces symbols  
pg_encoding_to_char, pg_utf_mblen, pg_char_to_encoding,  
pg_valid_server_encoding, and pg_valid_server_encoding_id.  Back-patch  
to v13, where the aforementioned commit first appeared.  While a minor  
release is usually the wrong time to add or remove symbol exports in  
libpq or libecpg, we should expect users to want each documented symbol.  
  
Tony Reix  
  
Discussion: https://postgr.es/m/PR3PR02MB6396742E2FC3E77D37A920BC86C79@PR3PR02MB6396.eurprd02.prod.outlook.com  

M src/Makefile.shlib
M src/port/README

Fix bogus timetz_zone() results for DYNTZ abbreviations.

commit   : 599c73a91a0471465a84f12fe6a2e7236a825721    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Sep 2021 11:29:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Sep 2021 11:29:52 -0400    

Click here for diff

timetz_zone() delivered completely wrong answers if the zone was  
specified by a dynamic TZ abbreviation, because it failed to account  
for the difference between the POSIX conventions for field values in  
struct pg_tm and the conventions used in PG-specific datetime code.  
  
As a stopgap fix, just adjust the tm_year and tm_mon fields to match  
PG conventions.  This is fixed in a different way in HEAD (388e71af8)  
but I don't want to back-patch the change of reference point.  
  
Discussion: https://postgr.es/m/CAJ7c6TOMG8zSNEZtCn5SPe+cCk3Lfxb71ZaQwT2F4T7PJ_t=KA@mail.gmail.com  

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

Fix pkg-config files for static linking

commit   : 1e9afc868eb5a3b2f50629c2724d9fcdbe0afee2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Sep 2021 09:41:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Sep 2021 09:41:03 +0200    

Click here for diff

Since ea53100d5 (PostgreSQL 12), the shipped pkg-config files have  
been broken for statically linking libpq because libpgcommon and  
libpgport are missing.  This patch adds those two missing private  
dependencies (in a non-hardcoded way).  
  
Reported-by: Filip Gospodinov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/Makefile.shlib

Further portability tweaks for float4/float8 hash functions.

commit   : 718978d9daa7128e0f5e4e06c0fd402cdd63704f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Sep 2021 16:29:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Sep 2021 16:29:08 -0400    

Click here for diff

Attempting to make hashfloat4() look as much as possible like  
hashfloat8(), I'd figured I could replace NaNs with get_float4_nan()  
before widening to float8.  However, results from protosciurus  
and topminnow show that on some platforms that produces a different  
bit-pattern from get_float8_nan(), breaking the intent of ce773f230.  
Rearrange so that we use the result of get_float8_nan() for all NaN  
cases.  As before, back-patch.  

M src/backend/access/hash/hashfunc.c

Minor improvements for psql help output.

commit   : 5edbcbd5b94c696526e18bbb490ab2e9f4282826    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Sep 2021 13:27:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Sep 2021 13:27:55 -0400    

Click here for diff

Fix alphabetization of the output of "\?", and improve one description.  
  
Update PageOutput counts where needed, fixing breakage from previous  
patches.  
  
Haiying Tang (PageOutput fixes by me)  
  
Discussion: https://postgr.es/m/OS0PR01MB61136018064660F095CB57A8FB129@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/bin/psql/help.c

Revert "Avoid creating archive status ".ready" files too early"

commit   : aa8bd0890bb29356a465d235dee59c1b08fa5fc5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 4 Sep 2021 12:14:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 4 Sep 2021 12:14:30 -0400    

Click here for diff

This reverts commit 515e3d84a0b5 and equivalent commits in back  
branches.  This solution to the problem has a number of problems, so  
we'll try again with a different approach.  
  
Per note from Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/walwriter.c
M src/include/access/xlog.h
M src/include/access/xlogdefs.h

Remove arbitrary MAXPGPATH limit on command lengths in pg_ctl.

commit   : 69d670e68ec9bd00b71ddc528274746790d7b6bd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 21:04:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 21:04:44 -0400    

Click here for diff

Replace fixed-length command buffers with psprintf() calls.  We didn't  
have anything as convenient as psprintf() when this code was written,  
but now that we do, there's little reason for the limitation to  
stand.  Removing it eliminates some corner cases where (for example)  
starting the postmaster with a whole lot of options fails.  
  
Most individual file names that pg_ctl deals with are still restricted  
to MAXPGPATH, but we've seldom had complaints about that limitation  
so long as it only applies to one filename.  
  
Back-patch to all supported branches.  
  
Phil Krylov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

Disallow creating an ICU collation if the DB encoding won't support it.

commit   : 2cc018ba8f80a5236faf2c58dfcd18fee581dbbc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 16:38:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 16:38:55 -0400    

Click here for diff

Previously this was allowed, but the collation effectively vanished  
into the ether because of the way lookup_collation() works: you could  
not use the collation, nor even drop it.  Seems better to give an  
error up front than to leave the user wondering why it doesn't work.  
  
(Because this test is in DefineCollation not CreateCollation, it does  
not prevent pg_import_system_collations from creating ICU collations,  
regardless of the initially-chosen encoding.)  
  
Per bug #17170 from Andrew Bille.  Back-patch to v10 where ICU support  
was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/collationcmds.c

Set the volatility of the timestamptz version of date_bin() back to immutable

commit   : 67c33a114f38edbd66f68d7b2c0cb7b03611ec48    
  
author   : John Naylor <[email protected]>    
date     : Fri, 3 Sep 2021 13:38:15 -0400    
  
committer: John Naylor <[email protected]>    
date     : Fri, 3 Sep 2021 13:38:15 -0400    

Click here for diff

543f36b43d was too hasty in thinking that the volatility of date_bin()  
had to match date_trunc(), since only the latter references  
session_timezone.  
  
Bump catversion  
  
Per feedback from Aleksander Alekseev  
Backpatch to v14, as the former commit was  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Fix portability issue in tests from commit ce773f230.

commit   : 08b96a2b5243957acd3f7c3105af8b5b2d0da3ef    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 10:01:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 10:01:02 -0400    

Click here for diff

Modern POSIX seems to require strtod() to accept "-NaN", but there's  
nothing about NaN in SUSv2, and some of our oldest buildfarm members  
don't like it.  Let's try writing it as -'NaN' instead; that seems  
to produce the same result, at least on Intel hardware.  
  
Per buildfarm.  

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

In count_usable_fds(), duplicate stderr not stdin.

commit   : 6b54f12332a184bfd03524c012795678ddc992f4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Sep 2021 18:53:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Sep 2021 18:53:10 -0400    

Click here for diff

We had a complaint that the postmaster fails to start if the invoking  
program closes stdin.  That happens because count_usable_fds expects  
to be able to dup(0), and if it can't, we conclude there are no free  
FDs and go belly-up.  So far as I can find, though, there is no other  
place in the server that touches stdin, and it's not unreasonable to  
expect that a daemon wouldn't use that file.  
  
As a simple improvement, let's dup FD 2 (stderr) instead.  Unlike stdin,  
it *is* reasonable for us to expect that stderr be open; even if we are  
configured not to touch it, common libraries such as libc might try to  
write error messages there.  
  
Per gripe from Mario Emmenlauer.  Given the lack of previous complaints,  
I'm not excited about pushing this into stable branches, but it seems  
OK to squeeze it into v14.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix float4/float8 hash functions to produce uniform results for NaNs.

commit   : 23c6bc581dc90d08421a13494f135681504ee4e6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Sep 2021 17:24:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Sep 2021 17:24:42 -0400    

Click here for diff

The IEEE 754 standard allows a wide variety of bit patterns for NaNs,  
of which at least two ("NaN" and "-NaN") are pretty easy to produce  
from SQL on most machines.  This is problematic because our btree  
comparison functions deem all NaNs to be equal, but our float hash  
functions know nothing about NaNs and will happily produce varying  
hash codes for them.  That causes unexpected results from queries  
that hash a column containing different NaN values.  It could also  
produce unexpected lookup failures when using a hash index on a  
float column, i.e. "WHERE x = 'NaN'" will not find all the rows  
it should.  
  
To fix, special-case NaN in the float hash functions, not too much  
unlike the existing special case that forces zero and minus zero  
to hash the same.  I arranged for the most vanilla sort of NaN  
(that coming from the C99 NAN constant) to still have the same  
hash code as before, to reduce the risk to existing hash indexes.  
  
I dithered about whether to back-patch this into stable branches,  
but ultimately decided to do so.  It's a clear improvement for  
queries that hash internally.  If there is anybody who has -NaN  
in a hash index, they'd be well advised to re-index after applying  
this patch ... but the misbehavior if they don't will not be much  
worse than the misbehavior they had before.  
  
Per bug #17172 from Ma Liangzhu.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hashfunc.c
M src/test/regress/expected/hash_func.out
M src/test/regress/sql/hash_func.sql

doc: Replace some uses of "which" by "that" in parallel.sgml

commit   : 2c1981ec3c8e1c5a52a8e9513a832d362f4fb4c1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Sep 2021 11:35:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Sep 2021 11:35:56 +0900    

Click here for diff

This makes the documentation more accurate grammatically.  
  
Author: Elena Indrupskaya  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/parallel.sgml

Doc: clarify how triggers relate to transactions.

commit   : 95bc40f880a68dc092ca34c4813f2b27962f233d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Sep 2021 17:24:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Sep 2021 17:24:59 -0400    

Click here for diff

Laurenz Albe, per gripe from Nathan Long.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/trigger.sgml

Identify simple column references in extended statistics

commit   : 50ba70a957f9e018495a111fc4b5e5eb2ea62044    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 1 Sep 2021 17:41:54 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 1 Sep 2021 17:41:54 +0200    

Click here for diff

Until now, when defining extended statistics, everything except a plain  
column reference was treated as complex expression. So for example "a"  
was a column reference, but "(a)" would be an expression. In most cases  
this does not matter much, but there were a couple strange consequences.  
For example  
  
    CREATE STATISTICS s ON a FROM t;  
  
would fail, because extended stats require at least two columns. But  
  
    CREATE STATISTICS s ON (a) FROM t;  
  
would succeed, because that requirement does not apply to expressions.  
Moreover, that statistics object is useless - the optimizer will always  
use the regular statistics collected for attribute "a".  
  
So do a bit more work to identify those expressions referencing a single  
column, and translate them to a simple column reference. Backpatch to  
14, where support for extended statistics on expressions was introduced.  
  
Reported-by: Justin Pryzby  
Backpatch-through: 14  
Discussion: https://postgr.es/m/20210816013255.GS10479%40telsasoft.com  

M src/backend/commands/statscmds.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

pgbench: Fix bug in measurement of disconnection delays.

commit   : d760d942c73c9a161feefb7dc4a0004b9b4e7787    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 1 Sep 2021 17:05:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 1 Sep 2021 17:05:13 +0900    

Click here for diff

When -C/--connect option is specified, pgbench establishes and closes  
the connection for each transaction. In this case pgbench needs to  
measure the times taken for all those connections and disconnections,  
to include the average connection time in the benchmark result.  
But previously pgbench could not measure those disconnection delays.  
To fix the bug, this commit makes pgbench measure the disconnection  
delays whenever the connection is closed at the end of transaction,  
if -C/--connect option is specified.  
  
Back-patch to v14. Per discussion, we concluded not to back-patch to v13  
or before because changing that behavior in stable branches would  
surprise users rather than providing benefits.  
  
Author: Yugo Nagata  
Reviewed-by: Fabien COELHO, Tatsuo Ishii, Asif Rehman, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Fix the random test failure in 001_rep_changes.

commit   : b7ad093d50e13aadfffb1662f53cd16a1c59e09d    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 1 Sep 2021 10:00:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 1 Sep 2021 10:00:12 +0530    

Click here for diff

The check to test whether the subscription workers were restarting after a  
change in the subscription was failing. The reason was that the test was  
assuming the walsender started before it reaches the 'streaming' state and  
the walsender was exiting due to an error before that. Now, the walsender  
was erroring out before reaching the 'streaming' state because it tries to  
acquire the slot before the previous walsender has exited.  
  
In passing, improve the die messages so that it is easier to investigate  
the failures in the future if any.  
  
Reported-by: Michael Paquier, as per buildfarm  
Author: Ajin Cherian  
Reviewed-by: Masahiko Sawada, Amit Kapila  
Backpatch-through: 10, where this test was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/001_rep_changes.pl

VACUUM VERBOSE: Don't report "pages removed".

commit   : 0d892cf73a13b3a32af438a059a168e711aa0a7f    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 20:37:17 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 20:37:17 -0700    

Click here for diff

It doesn't make any sense to report this information, since VACUUM  
VERBOSE reports on heap relation truncation directly.  This was an  
oversight in commit 7ab96cf6, which made VACUUM VERBOSE output a little  
more consistent with nearby autovacuum-specific log output.  Adjust  
comments that describe how this is supposed to work in passing.  
  
Also bring truncation-related VACUUM VERBOSE output in line with the  
convention established for VACUUM VERBOSE output by commit f4f4a649.  
  
Author: Peter Geoghegan <[email protected]>  
Backpatch: 14-, where VACUUM VERBOSE's output changed.  

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

Don't print extra parens around expressions in extended stats

commit   : 4d1816ec26e877297608a850736afed962527d70    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 1 Sep 2021 00:42:32 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 1 Sep 2021 00:42:32 +0200    

Click here for diff

The code printing expressions for extended statistics doubled the  
parens, producing results like ((a+1)), which is unnecessary and not  
consistent with how we print expressions elsewhere.  
  
Fixed by tweaking the code to produce just a single set of parens.  
  
Reported by Mark Dilger, fix by me. Backpatch to 14, where support for  
extended statistics on expressions was added.  
  
Reported-by: Mark Dilger  
Discussion: https://postgr.es/m/20210122040101.GF27167%40telsasoft.com  

M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/stats_ext.out

Mark the timestamptz variant of date_bin() as stable

commit   : 3eda9fc09fd6b9a1aec2d0113c633c69c3214b4d    
  
author   : John Naylor <[email protected]>    
date     : Tue, 31 Aug 2021 14:15:22 -0400    
  
committer: John Naylor <[email protected]>    
date     : Tue, 31 Aug 2021 14:15:22 -0400    

Click here for diff

Previously, it was immutable by lack of marking. This is not  
correct, since the time zone could change.  
  
Bump catversion  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsG2UHk8mOWL0tca%3D_cg%2B_oA5mVRNLhDF0TBw980iOg5NQ%40mail.gmail.com  
Backpatch to v14, when this function came in  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

In pg_dump, avoid doing per-table queries for RLS policies.

commit   : a20a9f26cefcf4e35ba7bb3d9e8672cb4ce1cf32    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 15:04:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 15:04:05 -0400    

Click here for diff

For no particularly good reason, getPolicies() queried pg_policy  
separately for each table.  We can collect all the policies in  
a single query instead, and attach them to the correct TableInfo  
objects using findTableByOid() lookups.  On the regression  
database, this reduces the number of queries substantially, and  
provides a visible savings even when running against a local  
server.  
  
Per complaint from Hubert Depesz Lubaczewski.  Since this is such  
a simple fix and can have a visible performance benefit, back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Cache the results of format_type() queries in pg_dump.

commit   : 9407dbbcb5b587cbefc4af14d1612b49abcb143b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 13:53:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 13:53:33 -0400    

Click here for diff

There's long been a "TODO: there might be some value in caching  
the results" annotation on pg_dump's getFormattedTypeName function;  
but we hadn't gotten around to checking what it was costing us to  
repetitively look up type names.  It turns out that when dumping the  
current regression database, about 10% of the total number of queries  
issued are duplicative format_type() queries.  However, Hubert Depesz  
Lubaczewski reported a not-unusual case where these account for over  
half of the queries issued by pg_dump.  Individually these queries  
aren't expensive, but when network lag is a factor, they add up to a  
problem.  We can very easily add some caching to getFormattedTypeName  
to solve it.  
  
Since this is such a simple fix and can have a visible performance  
benefit, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Rename the role in stats_ext to have regress_ prefix

commit   : 4090ff2a99b76b7bd51534fb0f7013aa646d1e24    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 31 Aug 2021 19:21:29 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 31 Aug 2021 19:21:29 +0200    

Click here for diff

Commit 5be8ce82e8 added a new role to the stats_ext regression suite,  
but the role name did not start with regress_ causing failures when  
running with ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS. Fixed by  
renaming the role to start with the expected regress_ prefix.  
  
Backpatch-through: 10, same as the new regression test  
Discussion: https://postgr.es/m/1F238937-7CC2-4703-A1B1-6DC225B8978A%40enterprisedb.com  

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

Fix lookup error in extended stats ownership check

commit   : a371a5ba349d9c39e7754f7d0f195ac46ee87b3f    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 31 Aug 2021 18:03:05 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 31 Aug 2021 18:03:05 +0200    

Click here for diff

When an ownership check on extended statistics object failed, the code  
was calling aclcheck_error_type to report the failure, which is clearly  
wrong, resulting in cache lookup errors. Fix by calling aclcheck_error.  
  
This issue exists since the introduction of extended statistics, so  
backpatch all the way back to PostgreSQL 10. It went unnoticed because  
there were no tests triggering the error, so add one.  
  
Reported-by: Mark Dilger  
Backpatch-through: 10, where extended stats were introduced  
Discussion: https://postgr.es/m/1F238937-7CC2-4703-A1B1-6DC225B8978A%40enterprisedb.com  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix missed lock acquisition while inlining new-style SQL functions.

commit   : 983d7033df6e03134572eb75dd76603fb9245211    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 12:02:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 12:02:36 -0400    

Click here for diff

When starting to use a query parsetree loaded from the catalogs,  
we must begin by applying AcquireRewriteLocks(), to obtain the same  
relation locks that the parser would have gotten if the query were  
entered interactively, and to do some other cleanup such as dealing  
with later-dropped columns.  New-style SQL functions are just as  
subject to this rule as other stored parsetrees; however, of the  
places dealing with such functions, only init_sql_fcache had gotten  
the memo.  In particular, if we successfully inlined a new-style  
set-returning SQL function that contained any relation references,  
we'd either get an assertion failure or attempt to use those  
relation(s) sans locks.  
  
I also added AcquireRewriteLocks calls to fmgr_sql_validator and  
print_function_sqlbody.  Desultory experiments didn't demonstrate any  
failures in those, but I suspect that I just didn't try hard enough.  
Certainly we don't expect nearby code paths to operate without locks.  
  
On the same logic of it-ought-to-have-the-same-effects-as-the-old-code,  
call pg_rewrite_query() in fmgr_sql_validator, too.  It's possible  
that neither code path there needs to bother with rewriting, but  
doing the analysis to prove that is beyond my goals for today.  
  
Per bug #17161 from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_proc.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_function_3.out
M src/test/regress/sql/create_function_3.sql

Report tuple address in data-corruption error message

commit   : eae08e21653c356f0e9223d26379527d653b71ed    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Aug 2021 16:29:12 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Aug 2021 16:29:12 -0400    

Click here for diff

Most data-corruption reports mention the location of the problem, but  
this one failed to.  Add it.  
  
Backpatch all the way back.  In 12 and older, also assign the  
ERRCODE_DATA_CORRUPTED error code as was done in commit fd6ec93bf890 for  
13 and later.  
  
Discussion: https://postgr.es/m/[email protected]  

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

psql: Fix name quoting on extended statistics

commit   : ce6b662aae7abc8b533b0cfa8fff50a9001508b1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Aug 2021 14:01:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Aug 2021 14:01:29 -0400    

Click here for diff

Per our message style guidelines, for human consumption we quote  
qualified names as a whole rather than each part separately; but commits  
bc085205c8a4 introduced a deviation for extended statistics and  
a4d75c86bf15 copied it.  I don't agree with this policy applying to  
names shown by psql, but that's a poor reason to deviate from the  
practice only in two obscure corners, so make said corners use the same  
style as everywhere else.  
  
Backpatch to 14.  The first of these is older, but I'm not sure we want  
to destabilize the psql output in the older branches for such a small  
thing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/stats_ext.out

pgbench: Avoid unnecessary measurement of connection delays.

commit   : efe2382d5ade2c8d63f2aa1b48cc85691a2bfabd    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 30 Aug 2021 21:35:24 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 30 Aug 2021 21:35:24 +0900    

Click here for diff

Commit 547f04e734 changed pgbench so that it used the measurement result  
of connection delays in its benchmark report only when -C/--connect option  
is specified. But previously those delays were unnecessarily measured  
even when that option is not specified. Which was a waste of cycles.  
This commit improves pgbench so that it avoids such unnecessary measurement.  
  
Back-patch to v14 where commit 547f04e734 first appeared.  
  
Author: Yugo Nagata  
Reviewed-by: Fabien COELHO, Asif Rehman, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Add list of acknowledgments to release notes

commit   : 7af5c38eb9da5b0ae72c1dd3d847f43cd39d1f5a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Aug 2021 08:56:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Aug 2021 08:56:16 +0200    

Click here for diff

This contains all individuals mentioned in the commit messages during  
PostgreSQL 14 development.  
  
current through ed740b06b18e1a23becd54c97ff229aba4c94349  

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

Fix incorrect error code in StartupReplicationOrigin().

commit   : 0a143c33f01257a0670af71205343b505f5bd89b    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 30 Aug 2021 09:22:28 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 30 Aug 2021 09:22:28 +0530    

Click here for diff

ERRCODE_CONFIGURATION_LIMIT_EXCEEDED was used for checksum failure, use  
ERRCODE_DATA_CORRUPTED instead.  
  
Reported-by: Tatsuhito Kasahara  
Author: Tatsuhito Kasahara  
Backpatch-through: 9.6, where it was introduced  
Discussion: https://postgr.es/m/CAP0=ZVLHtYffs8SOWcFJWrBGoRzT9QQbk+_aP+E5AHLNXiOorA@mail.gmail.com  

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

Keep stats up to date for partitioned tables

commit   : e1efc5b465c844969a0ed0d07e1364f3ce424d8c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 15:58:23 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 15:58:23 -0400    

Click here for diff

In the long-going saga for analyze on partitioned tables, one thing I  
missed while reverting 0827e8af70f4 is the maintenance of analyze count  
and last analyze time for partitioned tables.  This is a mostly trivial  
change that enables users assess the need for invoking manual ANALYZE on  
partitioned tables.  
  
This patch, posted by Justin and modified a bit by me (Álvaro), can be  
mostly traced back to Hosoya-san, though any problems introduced with  
the scissors are mine.  
  
Backpatch to 14, in line with 6f8127b73901.  
  
Co-authored-by: Yuzuko Hosoya <[email protected]>  
Co-authored-by: Justin Pryzby <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/analyze.c
M src/backend/postmaster/pgstat.c

psql \dX: reference regclass with "pg_catalog." prefix

commit   : 359bcf775550aa577c86ea30a6d071487fcca1ed    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 12:04:15 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 12:04:15 -0400    

Click here for diff

Déjà vu of commit fc40ba1296a7, for another backslash command.  
Strictly speaking this isn't a bug, but since all references to catalog  
objects are schema-qualified, we might as well be consistent.  The  
omission first appeared in commit ad600bba0422 and replicated in  
a4d75c86bf15; backpatch to 14.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

psql \dP: reference regclass with "pg_catalog." prefix

commit   : a32860b88f1ffd6ba5b8bc803aecf6bc0f87cf02    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 11:45:47 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 11:45:47 -0400    

Click here for diff

Strictly speaking this isn't a bug, but since all references to catalog  
objects are schema-qualified, we might as well be consistent.  The  
omission first appeared in commit 1c5d9270e339, so backpatch to 12.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Fix data loss in wal_level=minimal crash recovery of CREATE TABLESPACE.

commit   : 5513c09c89993cb0b2c1a4222b15722bcf71844b    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 27 Aug 2021 23:33:23 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 27 Aug 2021 23:33:23 -0700    

Click here for diff

If the system crashed between CREATE TABLESPACE and the next checkpoint,  
the result could be some files in the tablespace unexpectedly containing  
no rows.  Affected files would be those for which the system did not  
write WAL; see the wal_skip_threshold documentation.  Before v13, a  
different set of conditions governed the writing of WAL; see v12's  
<sect2 id="populate-pitr">.  (The v12 conditions were broader in some  
ways and narrower in others.)  Users may want to audit non-default  
tablespaces for unexpected short files.  The bug could have truncated an  
index without affecting the associated table, and reindexing the index  
would fix that particular problem.  
  
This fixes the bug by making create_tablespace_directories() more like  
TablespaceCreateDbspace().  create_tablespace_directories() was  
recursively removing tablespace contents, reasoning that WAL redo would  
recreate everything removed that way.  That assumption holds for other  
wal_level values.  Under wal_level=minimal, the old approach could  
delete files for which no other copy existed.  Back-patch to 9.6 (all  
supported versions).  
  
Reviewed by Robert Haas and Prabhat Sahu.  Reported by Robert Haas.  
  
Discussion: https://postgr.es/m/CA+TgmoaLO9ncuwvr2nN-J4VEP5XyAcy=zKiHxQzBbFRxxGxm0w@mail.gmail.com  

M src/backend/commands/tablespace.c
M src/test/recovery/t/018_wal_optimize.pl

Count SP-GiST index scans in pg_stat statistics.

commit   : e84d4810cd47d83a6a864fa33db74bcc5570dd76    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Aug 2021 19:42:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Aug 2021 19:42:42 -0400    

Click here for diff

Somehow, spgist overlooked the need to call pgstat_count_index_scan().  
Hence, pg_stat_all_indexes.idx_scan and equivalent columns never  
became nonzero for an SP-GiST index, although the related per-tuple  
counters worked fine.  
  
This fix works a bit differently from other index AMs, in that the  
counter increment occurs in spgrescan not spggettuple/spggetbitmap.  
It looks like this won't make the user-visible semantics noticeably  
different, so I won't go to the trouble of introducing an is-this-  
the-first-call flag just to make the counter bumps happen in the  
same places.  
  
Per bug #17163 from Christian Quest.  Back-patch to all supported  
versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/spgist/spgscan.c

Use maintenance_io_concurrency for ANALYZE prefetch

commit   : 9efa998a6403c5fe973ce5801d09ffa63e706eb6    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 27 Aug 2021 19:23:11 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 27 Aug 2021 19:23:11 -0400    

Click here for diff

When prefetching pages for ANALYZE, we should be using  
maintenance_io_concurrenty (by calling  
get_tablespace_maintenance_io_concurrency(), not  
get_tablespace_io_concurrency()).  
  
ANALYZE prefetching was introduced in c6fc50c, so back-patch to 14.  
  
Backpatch-through: 14  
Reported-By: Egor Rogov  
Discussion: https://postgr.es/m/9beada99-34ce-8c95-fadb-451768d08c64%40postgrespro.ru  

M src/backend/commands/analyze.c

docs: Add command tags for SQL commands

commit   : 8f6c110349769e2b6375cd01e632199a104dc4a1    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 27 Aug 2021 18:25:34 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 27 Aug 2021 18:25:34 -0400    

Click here for diff

Commit 6c3ffd6 added a couple new predefined roles but didn't properly  
wrap the SQL commands mentioned in the description of those roles with  
command tags, so add them now.  
  
Backpatch-through: 14  
Reported-by: Michael Banck  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/user-manag.sgml

docs: clarify bgw_restart_time documentation

commit   : 652804ebde82b6bb04b427becbcb4f6bea02ff90    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 27 Aug 2021 22:50:19 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 27 Aug 2021 22:50:19 +0200    

Click here for diff

Author: Dave Cramer <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CADK3HHLZmqAQZ2ByPDQQ9yhGqax36kksq6sDkV0yYzsxw6ipvQ@mail.gmail.com  

M doc/src/sgml/bgworker.sgml

track_io_timing logging: Don't special case 0 ms.

commit   : 6a1095234e0fcfa5c2f618c7c841e8ffe3c6c712    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 13:33:58 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 13:33:58 -0700    

Click here for diff

Adjust track_io_timing related logging code added by commit 94d13d474d.  
Make it consistent with other nearby autovacuum and autoanalyze logging  
code by removing logic that suppressed zero millisecond outputs.  
  
log_autovacuum_min_duration log output now reliably shows "read:" and  
"write:" millisecond-based values in its report (when track_io_timing is  
enabled).  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Stephen Frost <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznW0FNxSVQMSRazAMYNfZ6DR_gr5WE78hc6E1CBkkJpzw@mail.gmail.com  
Backpatch: 14-, where the track_io_timing logging was introduced.  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c

Reorder log_autovacuum_min_duration log output.

commit   : fd134f374ef7a8cc0b2d878a92dfe2c7088e084b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 13:08:39 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 13:08:39 -0700    

Click here for diff

This order seems more natural.  It starts with details that are  
particular to heap and index data structures, and ends with system-level  
costs incurred during the autovacuum worker's VACUUM/ANALYZE operation.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkzxK6ahA9xxsOftRtBX_R0swuHZsvo4QUbak1Bz7hb7Q@mail.gmail.com  
Backpatch: 14-, which enhanced the log output in various ways.  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c

Handle interaction of regexp's makesearch and MATCHALL more honestly.

commit   : 3068e45799327298a3f4c22b03db2aa48e2ab0da    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Aug 2021 12:18:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Aug 2021 12:18:58 -0400    

Click here for diff

Second thoughts about commit 824bf7190: we apply makesearch() to  
an NFA after having determined whether it is a MATCHALL pattern.  
Prepending ".*" doesn't make it non-MATCHALL, but it does change the  
maximum possible match length, and makesearch() failed to update that.  
This has no ill effects given the stylized usage of search NFAs, but  
it seems like it's better to keep the data structure consistent.  In  
particular, fixing this allows more honest handling of the MATCHALL  
check in matchuntil(): we can now assert that maxmatchall is infinity,  
instead of lamely assuming that it should act that way.  
  
In passing, improve the code in dump[c]nfa so that infinite maxmatchall  
is printed as "inf" not a magic number.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c

contrib/amcheck: Add heapam CHECK_FOR_INTERRUPTS().

commit   : ba05dfe943046820312eaa20995ffc626936b8be    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 26 Aug 2021 18:42:18 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 26 Aug 2021 18:42:18 -0700    

Click here for diff

Add a CHECK_FOR_INTERRUPTS() call to make heap relation verification  
responsive to query cancellations.  
  
Author: Mark Dilger <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzk-9RtQgb2QiuLv8j2O0j9tSFKPmmch5nWSZhguUxvbrw%40mail.gmail.com  
Backpatch: 14-, where amcheck heap verification was introduced.  

M contrib/amcheck/verify_heapam.c

Remove redundant test.

commit   : ed740b06b18e1a23becd54c97ff229aba4c94349    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Aug 2021 11:06:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Aug 2021 11:06:34 -0400    

Click here for diff

The condition "context_start < context_end" is strictly weaker  
than "context_end - context_start >= 50", so we don't need both.  
Oversight in commit ffd3944ab, noted by tanghy.fnst.  
  
In passing, line-wrap a nearby test to make it more readable.  
  
Discussion: https://postgr.es/m/OS0PR01MB61137C4054774F44E3A9DC89FBC69@OS0PR01MB6113.jpnprd01.prod.outlook.com  

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

Fix broken snapshot handling in parallel workers.

commit   : 11c1239881b399d1fe87186f1f8a10a505d4a692    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 25 Aug 2021 08:32:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 25 Aug 2021 08:32:04 -0400    

Click here for diff

Pengchengliu reported an assertion failure in a parallel woker while  
performing a parallel scan using an overflowed snapshot. The proximate  
cause is that TransactionXmin was set to an incorrect value.  The  
underlying cause is incorrect snapshot handling in parallel.c.  
  
In particular, InitializeParallelDSM() was unconditionally calling  
GetTransactionSnapshot(), because I (rhaas) mistakenly thought that  
was always retrieving an existing snapshot whereas, at isolation  
levels less than REPEATABLE READ, it's actually taking a new one. So  
instead do this only at higher isolation levels where there actually  
is a single snapshot for the whole transaction.  
  
By itself, this is not a sufficient fix, because we still need to  
guarantee that TransactionXmin gets set properly in the workers. The  
easiest way to do that seems to be to install the leader's active  
snapshot as the transaction snapshot if the leader did not serialize a  
transaction snapshot. This doesn't affect the results of future  
GetTrasnactionSnapshot() calls since those have to take a new snapshot  
anyway; what we care about is the side effect of setting TransactionXmin.  
  
Report by Pengchengliu. Patch by Greg Nancarrow, except for some comment  
text which I supplied.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo

commit   : a599109e591426689d5f79041af45525b00ef7b2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Aug 2021 10:14:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Aug 2021 10:14:51 +0200    

Click here for diff

M src/include/utils/typcache.h

Fix incorrect merge in ECPG code with DECLARE

commit   : 8ab3452df8d5ff26cf52c089b986256b0c02d555    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Aug 2021 15:16:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Aug 2021 15:16:55 +0900    

Click here for diff

The same condition was repeated twice when comparing the connection used  
by existing declared statement with the one coming from a fresh DECLARE  
statement.  This had no consequences, but let's keep the code clean.  
Oversight in f576de1.  
  
Author: Shenhao Wang  
Discussion: https://postgr.es/m/OSBPR01MB42149653BC0AB0A49D23C1B8F2C69@OSBPR01MB4214.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

M src/interfaces/ecpg/preproc/ecpg.header

Fix toast rewrites in logical decoding.

commit   : 9d7a80ce0185bd0c38bd973638bb7e9a854cf9f8    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 25 Aug 2021 10:10:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 25 Aug 2021 10:10:50 +0530    

Click here for diff

Commit 325f2ec555 introduced pg_class.relwrite to skip operations on  
tables created as part of a heap rewrite during DDL. It links such  
transient heaps to the original relation OID via this new field in  
pg_class but forgot to do anything about toast tables. So, logical  
decoding was not able to skip operations on internally created toast  
tables. This leads to an error when we tried to decode the WAL for the  
next operation for which it appeared that there is a toast data where  
actually it didn't have any toast data.  
  
To fix this, we set pg_class.relwrite for internally created toast tables  
as well which allowed skipping operations on them during logical decoding.  
  
Author: Bertrand Drouvot  
Reviewed-by: David Zhang, Amit Kapila  
Backpatch-through: 11, where it was introduced  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/sql/toast.sql
M src/backend/catalog/toasting.c
M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/include/catalog/toasting.h
M src/include/commands/tablecmds.h

Doc: Tweak function prototype indentation for consistency.

commit   : 22583edee7f4c6be6894b03c5cd93fd02e2a826a    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 25 Aug 2021 13:00:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 25 Aug 2021 13:00:01 +0900    

Click here for diff

M doc/src/sgml/fdwhandler.sgml

ecpg: Remove trailing period from error message.

commit   : d207df71f4af7de8e3e865e2635ae3a6b3a98d51    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 09:56:04 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 09:56:04 +0900    

Click here for diff

This commit improves the ecpg's error message that commit f576de1db1 updated,  
so that it gets rid of trailing period and uppercases the command name  
in the error message.  
  
Back-patch to v14 where the error message exists.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/ecpg.header

Avoid using ambiguous word "positive" in error message.

commit   : ec619102aa56d3356fb6550a343af01ad477e4a2    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 11:46:25 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 11:46:25 +0900    

Click here for diff

There are two identical error messages about valid value of modulus for  
hash partition, in PostgreSQL source code. Commit 0e1275fb07 improved  
only one of them so that ambiguous word "positive" was avoided there,  
and forgot to improve the other. This commit improves the other.  
Which would reduce translator burden.  
  
Back-pach to v11 where the error message exists.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out

Improve error message about valid value for distance in phrase operator.

commit   : 1d0567ec61fbc429a7717ab8d5027952c806a8fb    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 11:43:56 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 11:43:56 +0900    

Click here for diff

The distance in phrase operator must be an integer value between zero  
and MAXENTRYPOS inclusive. But previously the error message about  
its valid value included the information about its upper limit  
but not lower limit (i.e., zero). This commit improves the error message  
so that it also includes the information about its lower limit.  
  
Back-patch to v9.6 where full-text phrase search was supported.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

Fix regexp misbehavior with capturing parens inside "{0}".

commit   : 244dd79923a16afcf5f9a8dea53fc3af2ac0f7db    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Aug 2021 16:37:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Aug 2021 16:37:27 -0400    

Click here for diff

Regexps like "(.){0}...\1" drew an "invalid backreference number".  
That's not unreasonable on its face, since the capture group will  
never be matched if it's iterated zero times.  However, other engines  
such as Perl's don't complain about this, nor do we throw an error for  
related cases such as "(.)|\1", even though that backref can never  
succeed either.  Also, if the zero-iterations case happens at runtime  
rather than compile time --- say, "(x)*...\1" when there's no "x" to  
be found --- that's not an error, we just deem the backref to not  
match.  Making this even less defensible, no error was thrown for  
nested cases such as "((.)){0}...\2"; and to add insult to injury,  
those cases could result in assertion failures instead.  (It seems  
that nothing especially bad happened in non-assert builds, though.)  
  
Let's just fix it so that no error is thrown and instead the backref  
is deemed to never match, so that compile-time detection of no  
iterations behaves the same as run-time detection.  
  
Per report from Mark Dilger.  This appears to be an aboriginal error  
in Spencer's library, so back-patch to all supported versions.  
  
Pre-v14, it turns out to also be necessary to back-patch one aspect of  
commits cb76fbd7e/00116dee5, namely to create capture-node subREs with  
the begin/end states of their subexpressions, not the current lp/rp  
of the outer parseqatom invocation.  Otherwise delsub complains that  
we're trying to disconnect a state from itself.  This is a bit scary  
but code examination shows that it's safe: in the pre-v14 code, if we  
want to wrap iteration around the subexpression, the first thing we do  
is overwrite the atom's begin/end fields with new states.  So the  
bogus values didn't survive long enough to be used for anything, except  
if no iteration is required, in which case it doesn't matter.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/sql/test_regex.sql
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Fix Alter Subscription's Add/Drop Publication behavior.

commit   : 5cfcd46e9d297eac627bf3183272713112ac5f60    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 24 Aug 2021 08:38:11 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 24 Aug 2021 08:38:11 +0530    

Click here for diff

The current refresh behavior tries to just refresh added/dropped  
publications but that leads to removing wrong tables from subscription. We  
can't refresh just the dropped publication because it is quite possible  
that some of the tables are removed from publication by that time and now  
those will remain as part of the subscription. Also, there is a chance  
that the tables that were part of the publication being dropped are also  
part of another publication, so we can't remove those.  
  
So, we decided that by default, add/drop commands will also act like  
REFRESH PUBLICATION which means they will refresh all the publications. We  
can keep the old behavior for "add publication" but it is better to be  
consistent with "drop publication".  
  
Author: Hou Zhijie  
Reviewed-by: Masahiko Sawada, Amit Kapila  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/OS0PR01MB5716935D4C2CC85A6143073F94EF9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/alter_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/bin/psql/tab-complete.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
A src/test/subscription/t/021_alter_sub_pub.pl

Prevent regexp back-refs from sometimes matching when they shouldn't.

commit   : 779557bd22895420b48eba409d2286f1dea08c06    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Aug 2021 17:41:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Aug 2021 17:41:07 -0400    

Click here for diff

The recursion in cdissect() was careless about clearing match data  
for capturing parentheses after rejecting a partial match.  This  
could allow a later back-reference to succeed when by rights it  
should fail for lack of a defined referent.  
  
To fix, think a little more rigorously about what the contract  
between different levels of cdissect's recursion needs to be.  
With the right spec, we can fix this using fewer rather than more  
resets of the match data; the key decision being that a failed  
sub-match is now explicitly responsible for clearing any matches  
it may have set.  
  
There are enough other cross-checks and optimizations in the code  
that it's not especially easy to exhibit this problem; usually, the  
match will fail as-expected.  Plus, regexps that are even potentially  
vulnerable are most likely user errors, since there's just not much  
point in writing a back-ref that doesn't always have a referent.  
These facts perhaps explain why the issue hasn't been detected,  
even though it's almost certainly a couple of decades old.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regexec.c
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/sql/test_regex.sql
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Avoid creating archive status ".ready" files too early

commit   : e3fb6170e58c4325cd1e1eb22f96ef43c3b4152a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Aug 2021 15:50:35 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Aug 2021 15:50:35 -0400    

Click here for diff

WAL records may span multiple segments, but XLogWrite() does not  
wait for the entire record to be written out to disk before  
creating archive status files.  Instead, as soon as the last WAL page of  
the segment is written, the archive status file is created, and the  
archiver may process it.  If PostgreSQL crashes before it is able to  
write and flush the rest of the record (in the next WAL segment), the  
wrong version of the first segment file lingers in the archive, which  
causes operations such as point-in-time restores to fail.  
  
To fix this, keep track of records that span across segments and ensure  
that segments are only marked ready-for-archival once such records have  
been completely written to disk.  
  
This has always been wrong, so backpatch all the way back.  
  
Author: Nathan Bossart <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Ryo Matsumura <[email protected]>  
Reviewed-by: Andrey Borodin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/walwriter.c
M src/include/access/xlog.h
M src/include/access/xlogdefs.h

Fix backup manifests to generate correct WAL-Ranges across timelines

commit   : 65b649fecb0c0bd2c2c1f075f94f45a74cdc41be    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Aug 2021 11:09:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Aug 2021 11:09:54 +0900    

Click here for diff

In a backup manifest, WAL-Ranges stores the range of WAL that is  
required for the backup to be valid.  pg_verifybackup would then  
internally use pg_waldump for the checks based on this data.  
  
When the timeline where the backup started was more than 1 with a  
history file looked at for the manifest data generation, the calculation  
of the WAL range for the first timeline to check was incorrect.  The  
previous logic used as start LSN the start position of the first  
timeline, but it needs to use the start LSN of the backup.  This would  
cause failures with pg_verifybackup, or any tools making use of the  
backup manifests.  
  
This commit adds a test based on a logic using a self-promoted node,  
making it rather cheap.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/backend/replication/backup_manifest.c
M src/bin/pg_verifybackup/t/007_wal.pl

Improve error messages about misuse of SELECT INTO.

commit   : 8f6a52196aceb11a78eb1d673a03ab3ab72da231    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Aug 2021 10:22:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Aug 2021 10:22:14 -0400    

Click here for diff

Improve two places in plpgsql, and one in spi.c, where an error  
message would confusingly tell you that you couldn't use a SELECT  
query, when what you had written *was* a SELECT query.  The actual  
problem is that you can't use SELECT ... INTO in these contexts,  
but the messages failed to make that apparent.  Special-case  
SELECT INTO to make these errors more helpful.  
  
Also, fix the same spots in plpgsql, as well as several messages  
in exec_eval_expr(), to not quote the entire complained-of query or  
expression in the primary error message.  That behavior very easily  
led to violating our message style guideline about keeping the primary  
error message short and single-line.  Also, since the important part  
of the message was after the inserted text, it could make the real  
problem very hard to see.  We can report the query or expression as  
the first line of errcontext instead.  
  
Per complaint from Roger Mason.  Back-patch to v14, since (a) some  
of these messages are new in v14 and (b) v14's translatable strings  
are still somewhat in flux.  The problem's older than that of  
course, but I'm hesitant to change the behavior further back.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/spi.c
M src/pl/plpgsql/src/expected/plpgsql_array.out
M src/pl/plpgsql/src/pl_exec.c

Fix performance bug in regexp's citerdissect/creviterdissect.

commit   : 57a2d4a1b3bb48ec422a2701f8df026123a98a27    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Aug 2021 14:19:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Aug 2021 14:19:04 -0400    

Click here for diff

After detecting a sub-match "dissect" failure (i.e., a backref match  
failure) in the i'th sub-match of an iteration node, we should proceed  
by adjusting the attempted length of the i'th submatch.  As coded,  
though, these functions changed the attempted length of the *last*  
sub-match, and only after exhausting all possibilities for that would  
they back up to adjust the next-to-last sub-match, and then the  
second-from-last, etc; all of which is wasted effort, since only  
changing the start or length of the i'th sub-match can possibly make  
it succeed.  This oversight creates the possibility for exponentially  
bad performance.  Fortunately the problem is masked in most cases by  
optimizations or constraints applied elsewhere; which explains why  
we'd not noticed it before.  But it is possible to reach the problem  
with fairly simple, if contrived, regexps.  
  
Oversight in my commit 173e29aa5.  That's pretty ancient now,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regexec.c

Remove --quiet option from pg_amcheck

commit   : 92ce7f527960ca672d2ad70e61442f4e5b3bb641    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 20 Aug 2021 12:44:54 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 20 Aug 2021 12:44:54 +0200    

Click here for diff

Using --quiet in combination with --no-strict-names didn't work as  
documented, a warning message was still emitted. Since the --quiet  
flag was working in an unconventional way to other utilities, fix  
by removing the functionality instead.  
  
Backpatch through 14 where pg_amcheck was introduced.  
  
Bug: 17148  
Reported-by: Chen Jiaoqian <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M doc/src/sgml/ref/pg_amcheck.sgml
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl

pg_amcheck: Fix block number parsing on command line

commit   : 88cfcbb79f8064705362d8cfc0dff23d3c16195f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Aug 2021 07:48:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Aug 2021 07:48:22 +0200    

Click here for diff

The previous code wouldn't handle higher block numbers on systems  
where sizeof(long) == 4.  
  
Reviewed-by: Mark Dilger <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/6a10a211-872b-3c4c-106b-909ae5fefa61%40enterprisedb.com  

M src/bin/pg_amcheck/pg_amcheck.c

Avoid trying to lock OLD/NEW in a rule with FOR UPDATE.

commit   : 4649003933522282f03643c5a50fd2eb2a31a783    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Aug 2021 12:12:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Aug 2021 12:12:35 -0400    

Click here for diff

transformLockingClause neglected to exclude the pseudo-RTEs for  
OLD/NEW when processing a rule's query.  This led to odd errors  
or even crashes later on.  This bug is very ancient, but it's  
not terribly surprising that nobody noticed, since the use-case  
for SELECT FOR UPDATE in a non-view rule is somewhere between  
thin and non-existent.  Still, crashing is not OK.  
  
Per bug #17151 from Zhiyong Wu.  Thanks to Masahiko Sawada  
for analysis of the problem.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Unset MyBEEntry, making elog.c's call to pgstat_get_my_query_id() safe.

commit   : 18914f24ec6e704e81a5528cf09f3d54b23ef12b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 19 Aug 2021 04:59:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 19 Aug 2021 04:59:06 -0700    

Click here for diff

Previously log messages late during shutdown could end up using either another  
backend's PgBackendStatus (multi user) or segfault (single user) because  
pgstat_get_my_query_id()'s check for !MyBEEntry didn't filter out use after  
pgstat_beshutdown_hook().  
  
This became a bug in 4f0b0966c86, but was a bit fishy before. But given  
there's no known problematic cases before 14, it doesn't seem worth  
backpatching further.  
  
Also fixes a wrong filename in a comment, introduced in e1025044.  
  
Reported-By: Andres Freund <[email protected]>  
Reviewed-By: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/Julien Rouhaud <[email protected]>  
Backpatch: 14-  

M src/backend/utils/activity/backend_status.c

Fix typo in protocol.sgml.

commit   : e1915646658def5dd87331ac77fb9d8d0abd763b    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 Aug 2021 09:05:54 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 Aug 2021 09:05:54 +0530    

Click here for diff

The 'Stream Stop' message is misspelled as 'Stream End' in the docs.  
  
Author: Masahiko Sawada  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M doc/src/sgml/protocol.sgml

Revert refactoring of hex code to src/common/

commit   : 1900c140554efdcaa94134705e9be7ce1437be9c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Aug 2021 09:20:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Aug 2021 09:20:19 +0900    

Click here for diff

This is a combined revert of the following commits:  
- c3826f8, a refactoring piece that moved the hex decoding code to  
src/common/.  This code was cleaned up by aef8948, as it originally  
included no overflow checks in the same way as the base64 routines in  
src/common/ used by SCRAM, making it unsafe for its purpose.  
- aef8948, a more advanced refactoring of the hex encoding/decoding code  
to src/common/ that added sanity checks on the result buffer for hex  
decoding and encoding.  As reported by Hans Buschmann, those overflow  
checks are expensive, and it is possible to see a performance drop in  
the decoding/encoding of bytea or LOs the longer they are.  Simple SQLs  
working on large bytea values show a clear difference in perf profile.  
- ccf4e27, a cleanup made possible by aef8948.  
  
The reverts of all those commits bring back the performance of hex  
decoding and encoding back to what it was in ~13.  Fow now and  
post-beta3, this is the simplest option.  
  
Reported-by: Hans Buschmann  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/replication/backup_manifest.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/varlena.c
M src/common/Makefile
D src/common/hex.c
D src/include/common/hex.h
M src/include/common/sha2.h
M src/include/utils/builtins.h
M src/tools/msvc/Mkvcbuild.pm

Fix check_agg_arguments' examination of aggregate FILTER clauses.

commit   : 61f9dae2ce7680d51035e5bb8668cf5227346eac    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Aug 2021 18:12:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Aug 2021 18:12:51 -0400    

Click here for diff

Recursion into the FILTER clause was mis-implemented, such that a  
relevant Var or Aggref at the very top of the FILTER clause would  
be ignored.  (Of course, that'd have to be a plain boolean Var or  
boolean-returning aggregate.)  The consequence would be  
mis-identification of the correct semantic level of the aggregate,  
which could lead to not-per-spec query behavior.  If the FILTER  
expression is an aggregate, this could also lead to failure to issue  
an expected "aggregate function calls cannot be nested" error, which  
would likely result in a core dump later on, since the planner and  
executor aren't expecting such cases to appear.  
  
The root cause is that commit b560ec1b0 blindly copied some code  
that assumed it's recursing into a List, and thus didn't examine the  
top-level node.  To forestall questions about why this call doesn't  
look like the others, as well as possible future copy-and-paste  
mistakes, let's change all three check_agg_arguments_walker calls in  
check_agg_arguments, even though only the one for the filter clause  
is really broken.  
  
Per bug #17152 from Zhiyong Wu.  This has been wrong since we  
implemented FILTER, so back-patch to all supported versions.  
(Testing suggests that pre-v11 branches manage to avoid crashing  
in the bad-Aggref case, thanks to "redundant" checks in ExecInitAgg.  
But I'm not sure how thorough that protection is, and anyway the  
wrong-behavior issue remains, so fix 9.6 and 10 too.)  
  
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

Fix pg_amcheck --skip option parameter handling

commit   : 5310c61ecc14f23d28429f055c968a97d5e8b39c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 18 Aug 2021 11:23:43 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 18 Aug 2021 11:23:43 +0200    

Click here for diff

The skip options set for all-visible and all-frozen were incorrect  
as they used space rather than hyphen, causing a syntax error when  
invoked. Also, the option for not skipping any pages at all, none,  
was documented but not implemented.  
  
Backpatch through 14 where pg_amcheck was introduced.  
  
Bug: #17149  
Reported-by: Chen Jiaoqian <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/bin/pg_amcheck/pg_amcheck.c

Prevent ALTER TYPE/DOMAIN/OPERATOR from changing extension membership.

commit   : 8f51ee63df3a9022cfd07d7482b8f3f21ff8f46d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Aug 2021 14:29:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Aug 2021 14:29:22 -0400    

Click here for diff

If recordDependencyOnCurrentExtension is invoked on a pre-existing,  
free-standing object during an extension update script, that object  
will become owned by the extension.  In our current code this is  
possible in three cases:  
  
* Replacing a "shell" type or operator.  
* CREATE OR REPLACE overwriting an existing object.  
* ALTER TYPE SET, ALTER DOMAIN SET, and ALTER OPERATOR SET.  
  
The first of these cases is intentional behavior, as noted by the  
existing comments for GenerateTypeDependencies.  It seems like  
appropriate behavior for CREATE OR REPLACE too; at least, the obvious  
alternatives are not better.  However, the fact that it happens during  
ALTER is an artifact of trying to share code (GenerateTypeDependencies  
and makeOperatorDependencies) between the CREATE and ALTER cases.  
Since an extension script would be unlikely to ALTER an object that  
didn't already belong to the extension, this behavior is not very  
troubling for the direct target object ... but ALTER TYPE SET will  
recurse to dependent domains, and it is very uncool for those to  
become owned by the extension if they were not already.  
  
Let's fix this by redefining the ALTER cases to never change extension  
membership, full stop.  We could minimize the behavioral change by  
only changing the behavior when ALTER TYPE SET is recursing to a  
domain, but that would complicate the code and it does not seem like  
a better definition.  
  
Per bug #17144 from Alex Kozhemyakin.  Back-patch to v13 where ALTER  
TYPE SET was added.  (The other cases are older, but since they only  
affect the directly-named object, there's not enough of a problem to  
justify changing the behavior further back.)  
  
Discussion: https://postgr.es/m/[email protected]  

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/operatorcmds.c
M src/backend/commands/typecmds.c
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_type.h

Improved ECPG warning as suggested by Michael Paquier and removed test case that triggers the warning during regression tests.

commit   : e2d6da0708df2c2e244d8748c26ebc49c0963ed5    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 17 Aug 2021 14:58:33 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 17 Aug 2021 14:58:33 +0200    

Click here for diff

M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/test/expected/sql-declare.c
M src/interfaces/ecpg/test/expected/sql-declare.stderr
M src/interfaces/ecpg/test/expected/sql-declare.stdout
M src/interfaces/ecpg/test/sql/declare.pgc

Set type identifier on BIO

commit   : b88377ad65dfa714e1bd1c041421446065c07c9c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 17 Aug 2021 14:27:37 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 17 Aug 2021 14:27:37 +0200    

Click here for diff

In OpenSSL there are two types of BIO's (I/O abstractions):  
source/sink and filters. A source/sink BIO is a source and/or  
sink of data, ie one acting on a socket or a file. A filter  
BIO takes a stream of input from another BIO and transforms it.  
In order for BIO_find_type() to be able to traverse the chain  
of BIO's and correctly find all BIO's of a certain type they  
shall have the type bit set accordingly, source/sink BIO's  
(what PostgreSQL implements) use BIO_TYPE_SOURCE_SINK and  
filter BIO's use BIO_TYPE_FILTER. In addition to these, file  
descriptor based BIO's should have the descriptor bit set,  
BIO_TYPE_DESCRIPTOR.  
  
The PostgreSQL implementation didn't set the type bits, which  
went unnoticed for a long time as it's only really relevant  
for code auditing the OpenSSL installation, or doing similar  
tasks. It is required by the API though, so this fixes it.  
  
Backpatch through 9.6 as this has been wrong for a long time.  
  
Author: Itamar Gafni  
Discussion: https://postgr.es/m/SN6PR06MB39665EC10C34BB20956AE4578AF39@SN6PR06MB3966.namprd06.prod.outlook.com  
Backpatch-through: 9.6  

M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c

doc: \123 and \x12 escapes in COPY are in database encoding.

commit   : f90c05959ec3fb712cba889817e0a0689fa6fa89    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Aug 2021 10:00:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Aug 2021 10:00:06 +0300    

Click here for diff

The backslash sequences, including \123 and \x12 escapes, are interpreted  
after encoding conversion. The docs failed to mention that.  
  
Backpatch to all supported versions.  
  
Reported-by: Andreas Grob  
Discussion: https://www.postgresql.org/message-id/17142-9181542ca1df75ab%40postgresql.org  

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

Revert analyze support for partitioned tables

commit   : b3d24cc0f0aa882ceec0a74a99f94166c6fc3247    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Aug 2021 17:27:52 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Aug 2021 17:27:52 -0400    

Click here for diff

This reverts the following commits:  
1b5617eb844cd2470a334c1d2eec66cf9b39c41a Describe (auto-)analyze behavior for partitioned tables  
0e69f705cc1a3df273b38c9883fb5765991e04fe Set pg_class.reltuples for partitioned tables  
41badeaba8beee7648ebe7923a41c04f1f3cb302 Document ANALYZE storage parameters for partitioned tables  
0827e8af70f4653ba17ed773f123a60eadd9f9c9 autovacuum: handle analyze for partitioned tables  
  
There are efficiency issues in this code when handling databases with  
large numbers of partitions, and it doesn't look like there isn't any  
trivial way to handle those.  There are some other issues as well.  It's  
now too late in the cycle for nontrivial fixes, so we'll have to let  
Postgres 14 users continue to manually deal with ANALYZE their  
partitioned tables, and hopefully we can fix the issues for Postgres 15.  
  
I kept [most of] be280cdad298 ("Don't reset relhasindex for partitioned  
tables on ANALYZE") because while we added it due to 0827e8af70f4, it is  
a good bugfix in its own right, since it affects manual analyze as well  
as autovacuum-induced analyze, and there's no reason to revert it.  
  
I retained the addition of relkind 'p' to tables included by  
pg_stat_user_tables, because reverting that would require a catversion  
bump.  
Also, in pg14 only, I keep a struct member that was added to  
PgStat_TabStatEntry to avoid breaking compatibility with existing stat  
files.  
  
Backpatch to 14.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/maintenance.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/backend/access/common/reloptions.c
M src/backend/commands/analyze.c
M src/backend/commands/tablecmds.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Refresh apply delay on reload of recovery_min_apply_delay at recovery

commit   : f83d80ea1e57927471848d901843ddc6fd5ecacc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 16 Aug 2021 12:11:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 16 Aug 2021 12:11:49 +0900    

Click here for diff

This commit ensures that the wait interval in the replay delay loop  
waiting for an amount of time defined by recovery_min_apply_delay is  
correctly handled on reload, recalculating the delay if this GUC value  
is updated, based on the timestamp of the commit record being replayed.  
  
The previous behavior would be problematic for example with replay  
still waiting even if the delay got reduced or just cancelled.  If the  
apply delay was increased to a larger value, the wait would have just  
respected the old value set, finishing earlier.  
  
Author: Soumyadeep Chakraborty, Ashwin Agrawal  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/CAE-ML+93zfr-HLN8OuxF0BjpWJ17O5dv1eMvSE5jsj9jpnAXZA@mail.gmail.com  
Backpatch-through: 9.6  

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

Add RISC-V spinlock support in s_lock.h.

commit   : 4ffbd55d9346b6a8ba391c6df9a0f692c4b61ace    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Aug 2021 13:58:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Aug 2021 13:58:47 -0400    

Click here for diff

Like the ARM case, just use gcc's __sync_lock_test_and_set();  
that will compile into AMOSWAP.W.AQ which does what we need.  
  
At some point it might be worth doing some work on atomic ops  
for RISC-V, but this should be enough for a creditable port.  
  
Back-patch to all supported branches, just in case somebody  
wants to try them on RISC-V.  
  
Marek Szuba  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/s_lock.h

pg_amcheck: Message style and structuring improvements

commit   : e546d1d052f220b077cf4d9fee8e6d5bf85911c5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Aug 2021 17:15:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Aug 2021 17:15:03 +0200    

Click here for diff

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

Fix connection handling for DEALLOCATE and DESCRIBE statements

commit   : a945f5527322d18d02990a9772a893f741e7d8df    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 13 Aug 2021 10:34:04 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 13 Aug 2021 10:34:04 +0200    

Click here for diff

After binding a statement to a connection with DECLARE STATEMENT the connection  
was still not used for DEALLOCATE and DESCRIBE statements. This patch fixes  
that, adds a missing warning and cleans up the code.  
  
Author: Hayato Kuroda  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/TYAPR01MB5866BA57688DF2770E2F95C6F5069%40TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/sql-declare.c
M src/interfaces/ecpg/test/expected/sql-declare.stderr
M src/interfaces/ecpg/test/expected/sql-declare.stdout
M src/interfaces/ecpg/test/sql/declare.pgc

Fix sslsni connparam boolean check

commit   : ffff00a3556734f859f375b8c76c89f1d2920bcd    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 13 Aug 2021 10:32:16 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 13 Aug 2021 10:32:16 +0200    

Click here for diff

The check for sslsni only checked for existence of the parameter  
but not for the actual value of the param.  This meant that the  
SNI extension was always turned on.  Fix by inspecting the value  
of sslsni and only activate the SNI extension iff sslsni has been  
enabled.  Also update the docs to be more in line with how other  
boolean params are documented.  
  
Backpatch to 14 where sslsni was first implemented.  
  
Reviewed-by: Tom Lane  
Backpatch-through: 14, where sslni was added  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-secure-openssl.c

Fix incorrect hash table resizing code in simplehash.h

commit   : dc23c77d07af086574124ea5ca65acf9360b8691    
  
author   : David Rowley <[email protected]>    
date     : Fri, 13 Aug 2021 16:41:56 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 13 Aug 2021 16:41:56 +1200    

Click here for diff

This fixes a bug in simplehash.h which caused an incorrect size mask to be  
used when the hash table grew to SH_MAX_SIZE (2^32).  The code was  
incorrectly setting the size mask to 0 when the hash tables reached the  
maximum possible number of buckets.  This would result always trying to  
use the 0th bucket causing an  infinite loop of trying to grow the hash  
table due to there being too many collisions.  
  
Seemingly it's not that common for simplehash tables to ever grow this big  
as this bug dates back to v10 and nobody seems to have noticed it before.  
However, probably the most likely place that people would notice it would  
be doing a large in-memory Hash Aggregate with something close to at least  
2^31 groups.  
  
After this fix, the code now works correctly with up to within 98% of 2^32  
groups and will fail with the following error when trying to insert any  
more items into the hash table:  
  
ERROR:  hash table size exceeded  
  
However, the work_mem (or hash_mem_multiplier in newer versions) settings  
will generally cause Hash Aggregates to spill to disk long before reaching  
that many groups.  The minimal test case I did took a work_mem setting of  
over 192GB to hit the bug.  
  
simplehash hash tables are used in a few other places such as Bitmap Index  
Scans, however, again the size that the hash table can become there is  
also limited to work_mem and it would take a relation of around 16TB  
(2^31) pages and a very large work_mem setting to hit this.  With smaller  
work_mem values the table would become lossy and never grow large enough  
to hit the problem.  
  
Author: Yura Sokolov  
Reviewed-by: David Rowley, Ranier Vilela  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10, where simplehash.h was added  

M src/include/lib/simplehash.h

Make EXEC_BACKEND more convenient on macOS.

commit   : 8201b60565b8da465e75da4e4c6d2f01bf976a43    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 13 Aug 2021 10:38:22 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 13 Aug 2021 10:38:22 +1200    

Click here for diff

It's hard to disable ASLR on current macOS releases, for testing with  
-DEXEC_BACKEND.  You could already set the environment variable  
PG_SHMEM_ADDR to something not likely to collide with mappings created  
earlier in process startup.  Let's also provide a default value that  
works on current releases and architectures, for developer convenience.  
  
As noted in the pre-existing comment, this is a horrible hack, but  
-DEXEC_BACKEND is only used by Unix-based PostgreSQL developers for  
testing some otherwise Windows-only code paths, so it seems excusable.  
  
Back-patch to all supported branches.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/20210806032944.m4tz7j2w47mant26%40alap3.anarazel.de  

M src/backend/port/sysv_shmem.c

Use appropriate tuple descriptor in FDW batching

commit   : 886531f3f403cae67a4537f0a2a1edc730f6b793    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 12 Aug 2021 21:32:53 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 12 Aug 2021 21:32:53 +0200    

Click here for diff

The FDW batching code was using the same tuple descriptor both for all  
slots (regular and plan slots), but that's incorrect - the subplan may  
use a different descriptor. Currently this is benign, because batching  
is used only for INSERTs, and in that case the descriptors always match.  
But that would change if we allow batching UPDATEs.  
  
Fix by copying the appropriate tuple descriptor. Backpatch to 14, where  
the FDW batching was implemented.  
  
Author: Amit Langote  
Backpatch-through: 14, where FDW batching was added  
Discussion: https://postgr.es/m/CA%2BHiwqEWd5B0-e-RvixGGUrNvGkjH2s4m95%3DJcwUnyV%3Df0rAKQ%40mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Fix segfault during EvalPlanQual with mix of local and foreign partitions.

commit   : 6458ed18fe40ac91f29496128dd1a49c0ef2db5b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 12 Aug 2021 11:02:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 12 Aug 2021 11:02:29 +0300    

Click here for diff

It's not sensible to re-evaluate a direct-modify Foreign Update or Delete  
during EvalPlanQual. However, ExecInitForeignScan() can still get called  
if a table mixes local and foreign partitions. EvalPlanQualStart() left  
the es_result_relations array uninitialized in the child EPQ EState, but  
ExecInitForeignScan() still expected to find it. That caused a segfault.  
  
Fix by skipping the es_result_relations lookup during EvalPlanQual  
processing. To make things a bit more robust, also skip the  
BeginDirectModify calls, and add a runtime check that ExecForeignScan()  
is not called on direct-modify foreign scans during EvalPlanQual  
processing.  
  
This is new in v14, commit 1375422c782. Before that, EvalPlanQualStart()  
copied the whole ResultRelInfo array to the EPQ EState. Backpatch to v14.  
  
Report and diagnosis by Andrey Lepikhov.  
  
Discussion: https://www.postgresql.org/message-id/cb2b808d-cbaa-4772-76ee-c8809bafcf3d%40postgrespro.ru  

M src/backend/executor/nodeForeignscan.c

Fix failure of btree_gin indexscans with "char" type and </<= operators.

commit   : a4957b5a72dc9e169b78604f67357bb3dc49d826    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Aug 2021 18:10:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Aug 2021 18:10:30 -0400    

Click here for diff

As a result of confusion about whether the "char" type is signed or  
unsigned, scans for index searches like "col < 'x'" or "col <= 'x'"  
would start at the middle of the index not the left end, thus missing  
many or all of the entries they should find.  Fortunately, this  
is not a symptom of index corruption.  It's only the search logic  
that is broken, and we can fix it without unpleasant side-effects.  
  
Per report from Jason Kim.  This has been wrong since btree_gin's  
beginning, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/btree_gin.c
M contrib/btree_gin/expected/char.out

Stamp 14beta3.

commit   : 26f5391df63445692c88e4540dcbb558e567044c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Aug 2021 16:47:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Aug 2021 16:47:06 -0400    

Click here for diff

M configure
M configure.ac

Translation updates

commit   : 7f7a9c20621f52867100fa3acfb4d453004ed924    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 Aug 2021 11:51:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 Aug 2021 11:51:59 +0200    

Click here for diff

Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 1234b3cdae465246e534cc4114129f18d3c04c38  

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/ja.po
M src/backend/po/uk.po
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/ja.po
M src/bin/initdb/po/uk.po
M src/bin/pg_amcheck/nls.mk
M src/bin/pg_amcheck/po/de.po
M src/bin/pg_amcheck/po/el.po
A src/bin/pg_amcheck/po/ja.po
A src/bin/pg_amcheck/po/uk.po
M src/bin/pg_archivecleanup/po/el.po
M src/bin/pg_archivecleanup/po/es.po
M src/bin/pg_archivecleanup/po/ja.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/uk.po
M src/bin/pg_checksums/po/el.po
M src/bin/pg_checksums/po/es.po
M src/bin/pg_checksums/po/ja.po
M src/bin/pg_config/po/el.po
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/ja.po
M src/bin/pg_controldata/po/el.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/ja.po
M src/bin/pg_ctl/po/el.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/ja.po
M src/bin/pg_ctl/po/uk.po
M src/bin/pg_dump/po/el.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/ja.po
M src/bin/pg_dump/po/uk.po
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_resetwal/po/de.po
A src/bin/pg_resetwal/po/el.po
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/ja.po
M src/bin/pg_rewind/nls.mk
A src/bin/pg_rewind/po/el.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/ja.po
M src/bin/pg_rewind/po/uk.po
M src/bin/pg_test_fsync/po/el.po
M src/bin/pg_test_fsync/po/es.po
M src/bin/pg_test_fsync/po/ja.po
M src/bin/pg_test_fsync/po/uk.po
M src/bin/pg_test_timing/po/el.po
M src/bin/pg_test_timing/po/ja.po
M src/bin/pg_test_timing/po/uk.po
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_upgrade/po/ja.po
M src/bin/pg_upgrade/po/uk.po
M src/bin/pg_verifybackup/po/el.po
M src/bin/pg_verifybackup/po/es.po
M src/bin/pg_verifybackup/po/ja.po
M src/bin/pg_verifybackup/po/uk.po
M src/bin/pg_waldump/po/el.po
M src/bin/pg_waldump/po/es.po
M src/bin/pg_waldump/po/ja.po
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/ja.po
M src/bin/psql/po/uk.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/ja.po
M src/bin/scripts/po/uk.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/ja.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/ja.po
M src/interfaces/ecpg/preproc/po/uk.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/el.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/uk.po
M src/pl/plperl/po/el.po
M src/pl/plperl/po/es.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpython/po/el.po
M src/pl/plpython/po/es.po
M src/pl/tcl/po/el.po
M src/pl/tcl/po/es.po

Doc: Fix misleading statement about VACUUM memory limits

commit   : b5815dd00ad32b413070b088d083754d7ec42d37    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 16:46:49 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 16:46:49 +1200    

Click here for diff

In ec34040af I added a mention that there was no point in setting  
maintenance_work_limit to anything higher than 1GB for vacuum, but that  
was incorrect as ginInsertCleanup() also looks at what  
maintenance_work_mem is set to during VACUUM and that's not limited to  
1GB.  
  
Here I attempt to make it more clear that the limitation is only around  
the number of dead tuple identifiers that we can collect during VACUUM.  
  
I've also added a note to autovacuum_work_mem to mention this limitation.  
I didn't do that in ec34040af as I'd had some wrong-headed ideas about  
just limiting the maximum value for that GUC to 1GB.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvpGwOAvunp-E-bN_rbAs3hmxMoasm5pzkYDbf36h73s7w@mail.gmail.com  
Backpatch-through: 9.6, same as ec34040af  

M doc/src/sgml/config.sgml

Use ExplainPropertyInteger for queryid in EXPLAIN

commit   : c26552f4fc4fb72c64103ea877ea3c2a251856ad    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 15:46:28 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 15:46:28 +1200    

Click here for diff

This saves a few lines of code.  Also add a comment to mention why we use  
ExplainPropertyInteger instead of ExplainPropertyUInteger given that  
queryid is a uint64 type.  
  
Author: David Rowley  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/CAApHDvqhSLYpSU_EqUdN39w9Uvb8ogmHV7_3YhJ0S3aScGBjsg@mail.gmail.com  
Backpatch-through: 14, where this code was originally added  

M src/backend/commands/explain.c

doc: mention pg_upgrade extension script

commit   : 9268fc34526427a48bc27b5ac4727c7fb4cddf7a    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 8 Aug 2021 21:05:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 8 Aug 2021 21:05:46 -0400    

Click here for diff

Since commit e462856a7a, pg_upgrade automatically creates a script to  
update extensions, so mention that instead of ALTER EXTENSION.  
  
Backpatch-through: 9.6  

M doc/src/sgml/ref/pgupgrade.sgml

Doc: remove bogus <indexterm> items.

commit   : c905e64d42fe0725ab7fe84b70a41b4c381aee07    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Aug 2021 15:35:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Aug 2021 15:35:30 -0400    

Click here for diff

Copy-and-pasteo in 665c5855e, evidently.  The 9.6 docs toolchain  
whined about duplicate index entries, though our modern toolchain  
doesn't.  In any case, these GUCs surely are not about the  
default settings of these values.  

M doc/src/sgml/config.sgml

commit   : 5227d99896726b3c889e388f14a3593e104e36ee    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Aug 2021 11:56:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Aug 2021 11:56:29 -0400    

Click here for diff

I had committer's remorse almost immediately after pushing cb76fbd7e,  
upon finding that removing capturing subexpressions' subREs from the  
data structure broke my proposed patch for REG_NOSUB optimization.  
Revert that data structure change.  Instead, address the concern  
about not changing capturing subREs' endpoints by not changing the  
endpoints.  We don't need to, because the point of that bit was just  
to ensure that the atom has endpoints distinct from the outer state  
pair that we're stringing the branch between.  We already made  
suitable states in the parenthesized-subexpression case, so the  
additional ones were just useless overhead.  This seems more  
understandable than Spencer's original coding, and it ought to be  
a shade faster too by saving a few state creations and arc changes.  
(I actually see a couple percent improvement on Jacobson's web  
corpus, though that's barely above the noise floor so I wouldn't  
put much stock in that result.)  
  
Also, fix the logic added by ea1268f63 to ensure that the subRE  
recorded in v->subs[subno] is exactly the one with capno == subno.  
Spencer's original coding recorded the child subRE of the capture  
node, which is okay so far as having the right endpoint states is  
concerned, but as of cb76fbd7e the capturing subRE itself always  
has those endpoints too.  I think the inconsistency is confusing  
for the REG_NOSUB optimization.  
  
As before, backpatch to v14.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c

commit   : 5e6ad63c6db79a5515e7a4117b5de053530fd7d9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 22:27:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 22:27:02 -0400    

Click here for diff

Up to now, we remembered the definition of a capturing parenthesis  
subexpression by storing a pointer to the associated subRE node.  
That was okay before, because that subRE didn't get modified anymore  
while parsing the rest of the regexp.  However, in the wake of  
commit ea1268f63, that's no longer true: the outer invocation of  
parseqatom() feels free to scribble on that subRE.  This seems to  
work anyway, because the states we jam into the child atom in the  
"prepare a general-purpose state skeleton" stanza aren't really  
semantically different from the original endpoints of the child atom.  
But that would be mighty easy to break, and it's definitely not how  
things worked before.  
  
Between this and the issue fixed in the prior commit, it seems best  
to get rid of this dependence on subRE nodes entirely.  We don't need  
the whole child subRE for future backrefs, only its starting and ending  
NFA states; so let's just store pointers to those.  
  
Also, in the corner case where we make an extra subRE to handle  
immediately-nested capturing parentheses, it seems like it'd be smart  
to have the extra subRE have the same begin/end states as the original  
child subRE does (s/s2 not lp/rp).  I think that linking it from lp to  
rp might actually be semantically wrong, though since Spencer's original  
code did it that way, I'm not totally certain.  Using s/s2 is certainly  
not wrong, in any case.  
  
Per report from Mark Dilger.  Back-patch to v14 where the problematic  
patches came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c

Fix use-after-free issue in regexp engine.

commit   : f42ea8350db22725a251e98a5dafb4d2539c800f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 22:05:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 22:05:27 -0400    

Click here for diff

Commit cebc1d34e taught parseqatom() to optimize cases where a branch  
contains only one, "messy", atom by getting rid of excess subRE nodes.  
The way we really should do that is to keep the subRE built for the  
"messy" child atom; but to avoid changing parseqatom's nominal API,  
I made it delete that node after copying its fields to the outer subRE  
made by parsebranch().  It seems that that actually worked at the time;  
but it became dangerous after ea1268f63, because that later commit  
allowed the lower invocation of parse() to return a subRE that was also  
pointed to by some v->subs[] entry.  This meant we could wind up with a  
dangling pointer in v->subs[], allowing a later backref to misbehave,  
but only if that subRE struct had been reused in between.  So the damage  
seems confined to cases like '((...))...(...\2'.  
  
To fix, do what I should have done before and modify parseqatom's API  
to make it possible for it to remove the caller's subRE instead of the  
callee's.  That's safer because we know that subRE isn't complete yet,  
so noplace else will have a pointer to it.  
  
Per report from Mark Dilger.  Back-patch to v14 where the problematic  
patches came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/sql/test_regex.sql

pg_amcheck: Message style improvements

commit   : 51b95fb257a24aa4186960be8abc277774466218    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 20:34:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 20:34:49 +0200    

Click here for diff

M src/bin/pg_amcheck/pg_amcheck.c

Really fix the ambiguity in REFRESH MATERIALIZED VIEW CONCURRENTLY.

commit   : 2c915905e3e82b1db28dce8630f8d20b3db316f2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 13:29:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 13:29:32 -0400    

Click here for diff

Rather than trying to pick table aliases that won't conflict with  
any possible user-defined matview column name, adjust the queries'  
syntax so that the aliases are only used in places where they can't be  
mistaken for column names.  Mostly this consists of writing "alias.*"  
not just "alias", which adds clarity for humans as well as machines.  
We do have the issue that "SELECT alias.*" acts differently from  
"SELECT alias", but we can use the same hack ruleutils.c uses for  
whole-row variables in SELECT lists: write "alias.*::compositetype".  
  
We might as well revert to the original aliases after doing this;  
they're a bit easier to read.  
  
Like 75d66d10e, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_amcheck: Add missing translation markers

commit   : 9b0d71725eb2ca6ea0aaffdc38be599b90e7dc56    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 13:36:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 13:36:59 +0200    

Click here for diff

M src/bin/pg_amcheck/nls.mk
M src/bin/pg_amcheck/pg_amcheck.c

Message style improvements

commit   : d954019f0a60bb989ef6fe8e478b764d0d5f301c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 12:09:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 12:09:22 +0200    

Click here for diff

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c

Don't elide casting to typmod -1.

commit   : e5f6493e3584ea7eec1f992f87639e7f186ae03e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Aug 2021 17:32:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Aug 2021 17:32:54 -0400    

Click here for diff

Casting a value that's already of a type with a specific typmod  
to an unspecified typmod doesn't do anything so far as run-time  
behavior is concerned.  However, it really ought to change the  
exposed type of the expression to match.  Up to now,  
coerce_type_typmod hasn't bothered with that, which creates gotchas  
in contexts such as recursive unions.  If for example one side of  
the union is numeric(18,3), but it needs to be plain numeric to  
match the other side, there's no direct way to express that.  
  
This is easy enough to fix, by inserting a RelabelType to update the  
exposed type of the expression.  However, it's a bit nervous-making  
to change this behavior, because it's stood for a really long time.  
(I strongly suspect that it's like this in part because the logic  
pre-dates the introduction of RelabelType in 7.0.  The commit log  
message for 57b30e8e2 is interesting reading here.)  As a compromise,  
we'll sneak the change into 14beta3, and consider back-patching to  
stable branches if no complaints emerge in the next three months.  
  
Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com  

M src/backend/parser/parse_coerce.c
M src/test/regress/expected/expressions.out
M src/test/regress/sql/expressions.sql

Adjust the integer overflow tests in the numeric code.

commit   : 0325565702d8fd18ba66cdeaad4d7f43744525b2    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 6 Aug 2021 21:30:25 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 6 Aug 2021 21:30:25 +0100    

Click here for diff

Formerly, the numeric code tested whether an integer value of a larger  
type would fit in a smaller type by casting it to the smaller type and  
then testing if the reverse conversion produced the original value.  
That's perfectly fine, except that it caused a test failure on  
buildfarm animal castoroides, most likely due to a compiler bug.  
  
Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That  
matches existing code in other places, such as int84(), which is more  
widely tested, and so is less likely to go wrong.  
  
While at it, add regression tests covering the numeric-to-int8/4/2  
conversions, and adjust the recently added tests to the style of  
434ddfb79a (on the v11 branch) to make failures easier to diagnose.  
  
Per buildfarm via Tom Lane, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us  

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

Add missing message punctuation

commit   : c3a135b41eed3c719a0c34b8cc072835ff21b129    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Aug 2021 22:11:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Aug 2021 22:11:02 +0200    

Click here for diff

M src/backend/catalog/pg_type.c
M src/test/regress/expected/multirangetypes.out

Fix wording

commit   : acd6b6e637fb670003d4ac2477212b4d51016f9a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Aug 2021 20:55:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Aug 2021 20:55:59 +0200    

Click here for diff

M doc/src/sgml/rules.sgml
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/bin/pg_resetwal/pg_resetwal.c

Doc: remove commit 2945a488a from v14 release notes.

commit   : 64b7a8353214a3fa84942366ffb66b36c7f3d2e3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Aug 2021 19:09:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Aug 2021 19:09:24 -0400    

Click here for diff

Now that this has been back-patched, it's no longer a new feature  
for v14.  

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

postgres_fdw: Fix issues with generated columns in foreign tables.

commit   : 588d3f597c67fac6191658c3befc3b9120772905    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 5 Aug 2021 20:00:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 5 Aug 2021 20:00:01 +0900    

Click here for diff

postgres_fdw imported generated columns from the remote tables as plain  
columns, and caused failures like "ERROR: cannot insert a non-DEFAULT  
value into column "foo"" when inserting into the foreign tables, as it  
tried to insert values into the generated columns.  To fix, we do the  
following under the assumption that generated columns in a postgres_fdw  
foreign table are defined so that they represent generated columns in  
the underlying remote table:  
  
* Send DEFAULT for the generated columns to the foreign server on insert  
  or update, not generated column values computed on the local server.  
* Add to postgresImportForeignSchema() an option "import_generated" to  
  include column generated expressions in the definitions of foreign  
  tables imported from a foreign server.  The option is true by default.  
  
The assumption seems reasonable, because that would make a query of the  
postgres_fdw foreign table return values for the generated columns that  
are consistent with the generated expression.  
  
While here, fix another issue in postgresImportForeignSchema(): it tried  
to include column generated expressions as column default expressions in  
the foreign table definitions when the import_default option was enabled.  
  
Per bug #16631 from Daniel Cherniy.  Back-patch to v12 where generated  
columns were added.  
  
Discussion: https://postgr.es/m/16631-e929fe9db0ffc7cf%40postgresql.org  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
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 division-by-zero error in to_char() with 'EEEE' format.

commit   : ecbdbdfd9056a55e38f7922565c7ce46b1321907    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 5 Aug 2021 09:27:35 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 5 Aug 2021 09:27:35 +0100    

Click here for diff

This fixes a long-standing bug when using to_char() to format a  
numeric value in scientific notation -- if the value's exponent is  
less than -NUMERIC_MAX_DISPLAY_SCALE-1 (-1001), it produced a  
division-by-zero error.  
  
The reason for this error was that get_str_from_var_sci() divides its  
input by 10^exp, which it produced using power_var_int(). However, the  
underflow test in power_var_int() causes it to return zero if the  
result scale is too small. That's not a problem for power_var_int()'s  
only other caller, power_var(), since that limits the rscale to 1000,  
but in get_str_from_var_sci() the exponent can be much smaller,  
requiring a much larger rscale. Fix by introducing a new function to  
compute 10^exp directly, with no rscale limit. This also allows 10^exp  
to be computed more efficiently, without any numeric multiplication,  
division or rounding.  
  
Discussion: https://postgr.es/m/CAEZATCWhojfH4whaqgUKBe8D5jNHB8ytzemL-PnRx+KCTyMXmg@mail.gmail.com  

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

pgbench: When using pipelining only do PQconsumeInput() when necessary.

commit   : fa604e0dd07a39ba34f93d06ded8243280dffdeb    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:19:44 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:19:44 -0700    

Click here for diff

Up to now we did a PQconsumeInput() for each pipelined query, asking the OS  
for more input - which it often won't have, as all results might already have  
been sent. That turns out to have a noticeable performance impact.  
  
Alvaro Herrera reviewed the idea to add the PQisBusy() check, but not this  
concrete patch.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14, where libpq/pgbench pipelining was introduced.  

M src/bin/pgbench/pgbench.c

Make vacuum_index_cleanup reloption RELOPT_TYPE_ENUM.

commit   : e8086bd3ba0ab73a18ac2293dd14f488734126ec    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 3 Aug 2021 21:53:40 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 3 Aug 2021 21:53:40 -0700    

Click here for diff

Oversight in commit 3499df0d, which generalized the reloption as a way  
of giving users a way to consistently avoid VACUUM's index bypass  
optimization.  
  
Per off-list report from Nikolay Shaplov.  
  
Backpatch: 14-, where index cleanup reloption was extended.  

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

C comment: correct heading of extension query

commit   : 3a0ba31a32f2def545399549c2ace6951f98e47c    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 12:26:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 12:26:08 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.6  

M src/bin/pg_upgrade/version.c

doc: interval spill method for units greater than months

commit   : 2c92bae3e944d7159611e3010c34fd91b696a27f    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 12:17:58 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 12:17:58 -0400    

Click here for diff

Units are _truncated_ to months, but only in back branches since the  
recent commit.  
  
Reported-by: Bryn Llewellyn  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.6 to 14  

M doc/src/sgml/datatype.sgml

pg_upgrade: warn about extensions that need updating

commit   : 4051a7775752bb6643b2fef45f30142b65726b1a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:58:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:58:15 -0400    

Click here for diff

Also create a script that can be run to update them.  
  
Reported-by: Dave Cramer  
  
Discussion: https://postgr.es/m/CADK3HHKawwbOcGwMGnDuAf3-U8YfvTcS8jqDv3UM=niijs3MMA@mail.gmail.com  
  
Backpatch-through: 9.6  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/version.c

pg_upgrade: improve docs about extension upgrades

commit   : 9f6215b4c9e1f208a520c255eff7c6c1dece93c9    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:27:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:27:33 -0400    

Click here for diff

The previous wording was unclear about the steps needed to upgrade  
extensions, and how to update them after pg_upgrade.  
  
Reported-by: Dave Cramer  
  
Discussion: https://postgr.es/m/CADK3HHKawwbOcGwMGnDuAf3-U8YfvTcS8jqDv3UM=niijs3MMA@mail.gmail.com  
  
Backpatch-through: 9.6  

M doc/src/sgml/ref/pgupgrade.sgml

doc: mention inheritance's tableoid can be used in partitioning

commit   : c362570e83ab08e41e18437e158a8542dd8c3556    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:11:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:11:51 -0400    

Click here for diff

Previously tableoid was not mentioned in the partition doc section.  We  
only had a link to the "all the normal rules" of inheritance section.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ddl.sgml

doc: add example of using pg_dump with GNU split and gzip

commit   : 924e1d0da958c82b79b225b43672532f9f36df9b    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 10:57:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 10:57:32 -0400    

Click here for diff

This is only possible with GNU split, not other versions like BSD split.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.6  

M doc/src/sgml/backup.sgml

Fix oversight in commit 1ec7fca8592178281cd5cdada0f27a340fb813fc.

commit   : fb234086fe81fb1848934b6e1f6382611fc9ad4f    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 2 Aug 2021 12:45:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 2 Aug 2021 12:45:01 +0900    

Click here for diff

I failed to account for the possibility that when  
ExecAppendAsyncEventWait() notifies multiple async-capable nodes using  
postgres_fdw, a preceding node might invoke process_pending_request() to  
process a pending asynchronous request made by a succeeding node.  In  
that case the succeeding node should produce a tuple to return to the  
parent Append node from tuples fetched by process_pending_request() when  
notified.  Repair.  
  
Per buildfarm via Michael Paquier.  Back-patch to v14, like the previous  
commit.  
  
Thanks to Tom Lane for testing.  
  
Discussion: https://postgr.es/m/YQP0UPT8KmPiHTMs%40paquier.xyz  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/executor/nodeAppend.c

Use elog, not Assert, to report failure to provide an outer snapshot.

commit   : ec410c985e6d360f666e39be5609f3c4da5edc8f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Jul 2021 11:50:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Jul 2021 11:50:14 -0400    

Click here for diff

As of commit 84f5c2908, executing SQL commands (via SPI or otherwise)  
requires having either an active Portal, or a caller-established  
active snapshot.  We were simply Assert'ing that that's the case.  
But we've now had a couple different reports of people testing  
extensions that didn't meet this requirement, and were confused by  
the resulting crash.  Let's convert the Assert to a test-and-elog,  
in hopes of making the issue clearer for extension authors.  
  
Per gripes from Liu Huailing and RekGRpth.  Back-patch to v11,  
like the prior commit.  
  
Discussion: https://postgr.es/m/OSZPR01MB6215671E3C5956A034A080DFBEEC9@OSZPR01MB6215.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/pquery.c

Fix corner-case errors and loss of precision in numeric_power().

commit   : 0d6b87497e32a5b15be8fa3247b8fae48358bb1b    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 31 Jul 2021 11:23:48 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 31 Jul 2021 11:23:48 +0100    

Click here for diff

This fixes a couple of related problems that arise when raising  
numbers to very large powers.  
  
Firstly, when raising a negative number to a very large integer power,  
the result should be well-defined, but the previous code would only  
cope if the exponent was small enough to go through power_var_int().  
Otherwise it would throw an internal error, attempting to take the  
logarithm of a negative number. Fix this by adding suitable handling  
to the general case in power_var() to cope with negative bases,  
checking for integer powers there.  
  
Next, when raising a (positive or negative) number whose absolute  
value is slightly less than 1 to a very large power, the result should  
approach zero as the power is increased. However, in some cases, for  
sufficiently large powers, this would lose all precision and return 1  
instead of 0. This was due to the way that the local_rscale was being  
calculated for the final full-precision calculation:  
  
  local_rscale = rscale + (int) val - ln_dweight + 8  
  
The first two terms on the right hand side are meant to give the  
number of significant digits required in the result ("val" being the  
estimated result weight). However, this failed to account for the fact  
that rscale is clipped to a maximum of NUMERIC_MAX_DISPLAY_SCALE  
(1000), and the result weight might be less then -1000, causing their  
sum to be negative, leading to a loss of precision. Fix this by  
forcing the number of significant digits calculated to be nonnegative.  
It's OK for it to be zero (when the result weight is less than -1000),  
since the local_rscale value then includes a few extra digits to  
ensure an accurate result.  
  
Finally, add additional underflow checks to exp_var() and power_var(),  
so that they consistently return zero for cases like this where the  
result is indistinguishable from zero. Some paths through this code  
already returned zero in such cases, but others were throwing overflow  
errors.  
  
Dean Rasheed, reviewed by Yugo Nagata.  
  
Discussion: http://postgr.es/m/CAEZATCW6Dvq7+3wN3tt5jLj-FyOcUgT5xNoOqce5=6Su0bCR0w@mail.gmail.com  

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

Fix range check in ECPG numeric to int conversion

commit   : f051b87ace6dda42c191b77858c8d099af0de46a    
  
author   : John Naylor <[email protected]>    
date     : Fri, 30 Jul 2021 13:50:23 -0400    
  
committer: John Naylor <[email protected]>    
date     : Fri, 30 Jul 2021 13:50:23 -0400    

Click here for diff

The previous coding guarded against -INT_MAX instead of INT_MIN,  
leading to -2147483648 being rejected as out of range.  
  
Per bug #17128 from Kevin Sweet  
  
Discussion: https://www.postgresql.org/message-id/flat/17128-55a8a879727a3e3a%40postgresql.org  
Reviewed-by: Tom Lane  
Backpatch to all supported branches  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout
M src/interfaces/ecpg/test/pgtypeslib/num_test.pgc

Update obsolete comment that still referred to CheckpointLock

commit   : 99da905d5c4335d2df80f5cf05dad046a10d30fb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jul 2021 12:52:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jul 2021 12:52:49 +0300    

Click here for diff

CheckpointLock was removed in commit d18e75664a, and commit ce197e91d0  
updated a leftover comment in CreateCheckPoint, but there was another  
copy of it in CreateRestartPoint still.  

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

postgres_fdw: Fix handling of pending asynchronous requests.

commit   : 1cf7fb376acd48710c1c2c5cd97d11cd82e71ae4    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 30 Jul 2021 17:00:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 30 Jul 2021 17:00:01 +0900    

Click here for diff

A pending asynchronous request is handled by process_pending_request(),  
which previously not only processed an in-progress remote query but  
performed ExecForeignScan() to produce a tuple to return to the local  
server asynchronously from the result of the remote query.  But that led  
to a server crash when executing a query or led to an "InstrStartNode  
called twice in a row" or "InstrEndLoop called on running node" failure  
when doing EXPLAIN ANALYZE of it, in cases where the plan tree for it  
contained multiple async-capable nodes accessing the same  
initplan/subplan that contained multiple async-capable nodes scanning  
the same foreign tables as for the parent async-capable nodes, as  
reported by Andrey Lepikhov.  The reason is that the second step in  
process_pending_request() invoked when executing the initplan/subplan  
for one of the parent async-capable nodes caused recursive execution of  
the initplan/subplan for another of the parent async-capable nodes.  
  
To fix, split process_pending_request() into the two steps and postpone  
the second step until ForeignAsyncConfigureWait() is called for each of  
the pending asynchronous requests.  Also, in ExecAppendAsyncEventWait()  
we assumed that FDWs would register at least one wait event in a  
WaitEventSet created there when they were called from  
ForeignAsyncConfigureWait() in that function, but allow FDWs to register  
zero wait events in the WaitEventSet; modify ExecAppendAsyncEventWait()  
to just return in that case.  
  
Oversight in commit 27e1f1456.  Back-patch to v14 where that commit went  
in.  
  
Andrey Lepikhov and Etsuro Fujita  
  
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
M src/backend/executor/nodeAppend.c

Remove unused argument in apply_handle_commit_internal().

commit   : f4b939f1a3720209e1941b88e11e02ea5e671c1b    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 30 Jul 2021 08:21:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 30 Jul 2021 08:21:59 +0530    

Click here for diff

Oversight in commit 0926e96c49.  
  
Author: Masahiko Sawada  
Reviewed-By: Amit Kapila  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

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

Close yet another race condition in replication slot test code

commit   : f951f6f69c7e77acdd04776168126f00e269dcfb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 29 Jul 2021 17:09:06 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 29 Jul 2021 17:09:06 -0400    

Click here for diff

Buildfarm shows that this test has a further failure mode when a  
checkpoint starts earlier than expected, so we detect a "checkpoint  
completed" line that's not the one we want.  Change the config to try  
and prevent this.  
  
Per buildfarm  
  
While at it, update one comment that was forgotten in commit  
d18e75664a2f.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/test/recovery/t/019_replslot_limit.pl

docs: Fix bit_count example output

commit   : c73bba23ef07f88ce3860a06bbf56180e00b185d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Jul 2021 21:39:40 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Jul 2021 21:39:40 +0200    

Click here for diff

The returnvalue for the bit_count(::bytea) example was assuming a  
non-default value of standard_conforming_strings.  This was fixed  
in the tests in commit ebedd0c78.  
  
Author: [email protected]  
Discussion: https://postgr.es/m/OSZPR01MB6551FFAC1088C82C3D799BE0FAEB9@OSZPR01MB6551.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

M doc/src/sgml/func.sgml

Improve libpq's handling of OOM during error message construction.

commit   : 43f1d2ab361ccbd5ba8b53578fd4bcea9a6344a6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Jul 2021 13:33:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Jul 2021 13:33:31 -0400    

Click here for diff

Commit ffa2e4670 changed libpq so that multiple error reports  
occurring during one operation (a connection attempt or query)  
are accumulated in conn->errorMessage, where before new ones  
usually replaced any prior error.  At least in theory, that makes  
us more vulnerable to running out of memory for the errorMessage  
buffer.  If it did happen, the user would be left with just an  
empty-string error report, which is pretty unhelpful.  
  
We can improve this by relying on pqexpbuffer.c's existing "broken  
buffer" convention to track whether we've hit OOM for the current  
operation's error string, and then substituting a constant "out of  
memory" string in the small number of places where the errorMessage  
is read out.  
  
While at it, apply the same method to similar OOM cases in  
pqInternalNotice and pqGetErrorNotice3.  
  
Back-patch to v14 where ffa2e4670 came in.  In principle this could  
go back further; but in view of the lack of field reports, the  
hazard seems negligible in older branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h

Avoid calling TestLib::perl2host on a symlinked directory

commit   : c42d3d04d7d03782ae179bf92ea0eb9f2fa8f409    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 12:15:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 12:15:03 -0400    

Click here for diff

Certain versions of msys2/Windows have been observed to resolve symlinks  
in perl2host rather than just follow them. This defeats using a  
symlinked shorter path to a longer path, and makes certain tests fail.  
We therefore call perl2host on the parent directory of the symlink and  
thereafter just use that result.  
  
Apply to release 14 where the problem has been observed.  

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

Make TestLib::perl2host more consistent and robust

commit   : 68011e17d098da66070a2d648a609625241f73f6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 12:15:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 12:15:03 -0400    

Click here for diff

Sometimes cygpath has been observed to return a path with a trailing  
slash. That can cause problems, Also, make "cygpath" usage  
consistent with "pwd -W" with respect to the use of forward slashes.  
  
Backpatch to release 14 where the current code was introduced.  

M src/test/perl/TestLib.pm

Add missing exit() in pg_verifybackup when failing to find pg_waldump

commit   : 67445deb7eca32d25721dffb228b009bfbe415d5    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Jul 2021 10:59:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Jul 2021 10:59:56 +0900    

Click here for diff

pg_verifybackup needs by default pg_waldump to check after a range of  
WAL segments required for a backup, except if --no-parse-wal is  
specified.  The code checked for the presence of the binary pg_waldump  
in an installation and reported an error, but it forgot to properly  
exit().  This could lead to confusing errors reported.  
  
Reviewed-by: Robert Haas, Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/bin/pg_verifybackup/pg_verifybackup.c

Update minimum recovery point on truncation during WAL replay of abort record.

commit   : f2a3d7404e5d4aa17dbdf7299b1f0d548fe59b9d    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 29 Jul 2021 01:30:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 29 Jul 2021 01:30:02 +0900    

Click here for diff

If a file is truncated, we must update minRecoveryPoint. Once a file is  
truncated, there's no going back; it would not be safe to stop recovery  
at a point earlier than that anymore.  
  
Commit 7bffc9b7bf changed xact_redo_commit() so that it updates  
minRecoveryPoint on truncation, but forgot to change xact_redo_abort().  
  
Back-patch to all supported versions.  
  
Reported-by: [email protected]  
Author: Fujii Masao  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/b029fce3-4fac-4265-968e-16f36ff4d075.mengjuan.cmj@alibaba-inc.com  

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

Disallow negative strides in date_bin()

commit   : fc0d9b8c224ff6b84113cefdca1ba9dde879d863    
  
author   : John Naylor <[email protected]>    
date     : Wed, 28 Jul 2021 11:22:58 -0400    
  
committer: John Naylor <[email protected]>    
date     : Wed, 28 Jul 2021 11:22:58 -0400    

Click here for diff

It's not clear what the semantics of negative strides would be, so throw  
an error instead.  
  
Per report from Bauyrzhan Sakhariyev  
  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://www.postgresql.org/message-id/CAKpL73vZmLuFVuwF26FJ%2BNk11PVHhAnQRoREFcA03x7znRoFvA%40mail.gmail.com  
Backpatch to v14  

M doc/src/sgml/func.sgml
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

Doc: Clarify lock levels taken during ATTACH PARTITION

commit   : 5a8a9be08307a1c06fbed4510667de6b4f40fe56    
  
author   : David Rowley <[email protected]>    
date     : Wed, 28 Jul 2021 15:02:12 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 28 Jul 2021 15:02:12 +1200    

Click here for diff

It wasn't all that clear which lock levels, if any, would be held on the  
DEFAULT partition during an ATTACH PARTITION operation.  
  
Also, clarify which locks will be taken if the DEFAULT partition or the  
table being attached are themselves partitioned tables.  
  
Here I'm only backpatching to v12 as before then we obtained an ACCESS  
EXCLUSIVE lock on the partitioned table.  It seems much less relevant to  
mention which locks are taken on other tables when the partitioned table  
itself is locked with an ACCESS EXCLUSIVE lock.  
  
Author: Matthias van de Meent, David Rowley  
Discussion: https://postgr.es/m/CAEze2WiTB6iwrV8W_J=fnrnZ7fowW3qu-8iQ8zCHP3FiQ6+o-A@mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml

Set pg_setting.pending_restart when pertinent config lines are removed

commit   : ad3b40eb26a30d376e8448eb1170421501f0fc6b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Jul 2021 15:44:12 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Jul 2021 15:44:12 -0400    

Click here for diff

This changes the behavior of examining the pg_file_settings view after  
changing a config option that requires restart.  The user needs to know  
that any change of such options does not take effect until a restart,  
and this worked correctly if the line is edited without removing it.  
However, for the case where the line is removed altogether, the flag  
doesn't get set, because a flag was only set in set_config_option, but  
that's not called for lines removed.  Repair.  
  
(Ref.: commits 62d16c7fc561 and a486e35706ea)  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc-file.l

Fix bugs in polymorphic-argument resolution for multiranges.

commit   : b7ea0e8c41f1e512923267a57cd08df63115b783    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 15:01:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 15:01:49 -0400    

Click here for diff

We failed to deal with an UNKNOWN-type input for  
anycompatiblemultirange; that should throw an error indicating  
that we don't know how to resolve the multirange type.  
  
We also failed to infer the type of an anycompatiblerange output  
from an anycompatiblemultirange input or vice versa.  
  
Per bug #17066 from Alexander Lakhin.  Back-patch to v14  
where multiranges were added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_coerce.c
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/polymorphism.sql

Avoid using ambiguous word "non-negative" in error messages.

commit   : fd90f6ba7a75f51d14dac27219bb3755b893e251    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 28 Jul 2021 01:20:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 28 Jul 2021 01:20:16 +0900    

Click here for diff

The error messages using the word "non-negative" are confusing  
because it's ambiguous about whether it accepts zero or not.  
This commit improves those error messages by replacing it with  
less ambiguous word like "greater than zero" or  
"greater than or equal to zero".  
  
Also this commit added the note about the word "non-negative" to  
the error message style guide, to help writing the new error messages.  
  
When postgres_fdw option fetch_size was set to zero, previously  
the error message "fetch_size requires a non-negative integer value"  
was reported. This error message was outright buggy. Therefore  
back-patch to all supported versions where such buggy error message  
could be thrown.  
  
Reported-by: Hou Zhijie  
Author: Bharath Rupireddy  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/OS0PR01MB5716415335A06B489F1B3A8194569@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M contrib/postgres_fdw/option.c
M doc/src/sgml/sources.sgml
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/tsquery_op.c
M src/test/modules/test_shm_mq/test.c
M src/test/regress/expected/hash_part.out

doc: for various substring funcs, document if only first match

commit   : 5a353a2d43eeab7554a6986b04b0a9d98ad55c92    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 26 Jul 2021 22:54:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 26 Jul 2021 22:54:35 -0400    

Click here for diff

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

M doc/src/sgml/func.sgml

pg_resetxlog: add option to set oldest xid & use by pg_upgrade

commit   : 695b4a113abca380fd7aed26cefa039e4e8cd569    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 26 Jul 2021 22:38:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 26 Jul 2021 22:38:14 -0400    

Click here for diff

Add pg_resetxlog -u option to set the oldest xid in pg_control.  
Previously -x set this value be -2 billion less than the -x value.  
However, this causes the server to immediately scan all relation's  
relfrozenxid so it can advance pg_control's oldest xid to be inside the  
autovacuum_freeze_max_age range, which is inefficient and might disrupt  
diagnostic recovery.  pg_upgrade will use this option to better create  
the new cluster to match the old cluster.  
  
Reported-by: Jason Harvey, Floris Van Nee  
  
Discussion: https://postgr.es/m/[email protected], [email protected]  
  
Author: Bertrand Drouvot  
  
Backpatch-through: 9.6  

M doc/src/sgml/ref/pg_resetwal.sgml
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h

psql \dX: check schema when listing statistics objects

commit   : 611e42444b121370f561d860552beb7d28dacbf8    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 26 Jul 2021 17:12:28 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 26 Jul 2021 17:12:28 +0200    

Click here for diff

Commit ad600bba04 added psql command \dX listing extended statistics  
objects, but it failed to consider search_path when selecting the  
elements so some of the returned elements might be invisible.  
  
The visibility was already considered for tab completion (added by  
commit d99d58cdc8), so adding it to the query is fairly simple.  
  
Reported and fix by Justin Pryzby, regression tests by me. Backpatch  
to PostgreSQL 14, where \dX was introduced.  
  
Batchpatch-through: 14  
Author: Justin Pryzby  
Reviewed-by: Tatsuro Yamada  
Discussion: https://postgr.es/m/c027a541-5856-75a5-0868-341301e1624b%40nttcom.co.jp_1  

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

doc: Fix command example to run regression tests with PGOPTIONS

commit   : f2a37ddbb10177fd731109df4a63d10150a91c0d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Jul 2021 16:27:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Jul 2021 16:27:01 +0900    

Click here for diff

The documentation mentioned the use of log_checkpoints, that cannot be  
used in this context.  This commit replaces log_checkpoints with  
force_parallel_mode, a developer option useful to perform checks related  
to parallelism.  
  
Oversight in 854434c.  
  
Author: Haiying Tang  
Discussion: https://postgr.es/m/OS0PR01MB6113954B883ACEB2DDC973F2FBE59@OS0PR01MB6113.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

M doc/src/sgml/regress.sgml

Harden pg_stat_statements tests against CLOBBER_CACHE_ALWAYS.

commit   : e6d9544681b3f5c66a16c72bfd8dca450ec7536a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Jul 2021 23:25:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Jul 2021 23:25:15 -0400    

Click here for diff

Turns out the buildfarm hasn't been testing this, which will soon change.  
  
Julien Rouhaud, per report from me  
  
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

Fix incorrect comment for get_agg_clause_costs

commit   : dece64a941457686184654968ac1ded58b7d4ee8    
  
author   : David Rowley <[email protected]>    
date     : Mon, 26 Jul 2021 14:56:09 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 26 Jul 2021 14:56:09 +1200    

Click here for diff

Adjust the header comment in get_agg_clause_costs so that it matches what  
the function currently does.  No recursive searching has been done ever  
since 0a2bc5d61.  It also does not determine the aggtranstype like the  
comment claimed. That's all done in preprocess_aggref().  
preprocess_aggref also now determines the numOrderedAggs, so remove the  
mention that get_agg_clause_costs also calculates "counts".  
  
Normally, since this is just an adjustment of a comment it might not be  
worth back-patching, but since this code is new to PG14 and that version  
is still in beta, then it seems worth having the comments match.  
  
Discussion: https://postgr.es/m/CAApHDvrrGrTJFPELrjx0CnDtz9B7Jy2XYW3Z2BKifAWLSaJYwQ@mail.gmail.com  
Backpatch-though: 14  

M src/backend/optimizer/prep/prepagg.c

Fix a couple of memory leaks in src/bin/pg_basebackup/

commit   : b0d28671964d61416248789e3cee4508ac6281b4    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Jul 2021 11:14:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Jul 2021 11:14:08 +0900    

Click here for diff

These have been introduced by 7fbe0c8, and could happen for  
pg_basebackup and pg_receivewal.  
  
Per report from Coverity for the ones in walmethods.c, I have spotted  
the ones in receivelog.c after more review.  
  
Backpatch-through: 10  

M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Get rid of artificial restriction on hash table sizes on Windows.

commit   : b154ee63bb659ce280d486db6bbbe77ddec105c5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Jul 2021 14:02:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Jul 2021 14:02:27 -0400    

Click here for diff

The point of introducing the hash_mem_multiplier GUC was to let users  
reproduce the old behavior of hash aggregation, i.e. that it could use  
more than work_mem at need.  However, the implementation failed to get  
the job done on Win64, where work_mem is clamped to 2GB to protect  
various places that calculate memory sizes using "long int".  As  
written, the same clamp was applied to hash_mem.  This resulted in  
severe performance regressions for queries requiring a bit more than  
2GB for hash aggregation, as they now spill to disk and there's no  
way to stop that.  
  
Getting rid of the work_mem restriction seems like a good idea, but  
it's a big job and could not conceivably be back-patched.  However,  
there's only a fairly small number of places that are concerned with  
the hash_mem value, and it turns out to be possible to remove the  
restriction there without too much code churn or any ABI breaks.  
So, let's do that for now to fix the regression, and leave the  
larger task for another day.  
  
This patch does introduce a bit more infrastructure that should help  
with the larger task, namely pg_bitutils.h support for working with  
size_t values.  
  
Per gripe from Laurent Hasson.  Back-patch to v13 where the  
behavior change came in.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/MN2PR15MB25601E80A9B6D1BA6F592B1985E39@MN2PR15MB2560.namprd15.prod.outlook.com  

M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeMemoize.c
M src/backend/optimizer/path/costsize.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/optimizer/util/pathnode.c
M src/include/miscadmin.h
M src/include/port/pg_bitutils.h

Deduplicate choice of horizon for a relation procarray.c.

commit   : 3d0a4636aa4c976e971c05c77e162fc70c61f40b    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 24 Jul 2021 20:14:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 24 Jul 2021 20:14:03 -0700    

Click here for diff

5a1e1d83022 was a minimal bug fix for dc7420c2c92. To avoid future bugs of  
that kind, deduplicate the choice of a relation's horizon into a new helper,  
GlobalVisHorizonKindForRel().  
  
As the code in question was only introduced in dc7420c2c92 it seems worth  
backpatching this change as well, otherwise 14 will look different from all  
other branches.  
  
A different approach to this was suggested by Matthias van de Meent.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14, like 5a1e1d83022  

M src/backend/storage/ipc/procarray.c

Fix check for conflicting session- vs transaction-level locks.

commit   : 712ba6b8b73870fa9e3336df8d88f4bc5f824112    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 18:35:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 18:35:52 -0400    

Click here for diff

We have an implementation restriction that PREPARE TRANSACTION can't  
handle cases where both session-lifespan and transaction-lifespan locks  
are held on the same lockable object.  (That's because we'd otherwise  
need to acquire a new PROCLOCK entry during post-prepare cleanup, which  
is an operation that might fail.  The situation can only arise with odd  
usages of advisory locks, so removing the restriction is probably not  
worth the amount of effort it would take.)  AtPrepare_Locks attempted  
to enforce this, but its logic was many bricks shy of a load, because  
it only detected cases where the session and transaction locks had the  
same lockmode.  Locks of different modes on the same object would lead  
to the rather unhelpful message "PANIC: we seem to have dropped a bit  
somewhere".  
  
To fix, build a transient hashtable with one entry per locktag,  
not one per locktag + mode, and use that to detect conflicts.  
  
Per bug #17122 from Alexander Pyhalov.  This bug is ancient,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/lock.c
M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/sql/prepared_xacts.sql

Make printf("%s", NULL) print "(null)" instead of crashing.

commit   : 89ad14cd7870bce199448c527e3130c36f80d2bf    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 13:41:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 13:41:17 -0400    

Click here for diff

We previously took a hard-line attitude that callers should never print  
a null string pointer, and doing so is worthy of an assertion failure  
or crash.  However, we've long since flushed out any easy-to-find bugs  
of that nature.  What remains is a lot of code that perhaps could fail  
that way in hard-to-reach corner cases.  For example, in something as  
simple as  
    ereport(ERROR,  
            (errcode(ERRCODE_UNDEFINED_OBJECT),  
             errmsg("constraint \"%s\" for table \"%s\" does not exist",  
                    conname, get_rel_name(relid))));  
one must wonder whether it's completely guaranteed that get_rel_name  
cannot return NULL in this context.  If such a situation did occur,  
the existing policy converts what might be a pretty minor bug into  
a server crash condition.  This is not good for robustness.  
  
Hence, let's follow the lead of glibc and print "(null)" instead  
of failing.  We should, of course, still consider it a bug if that  
behavior is reachable in ordinary use; but crashing seems less  
desirable than not crashing.  
  
This fix works across-the-board in v12 and up, where we always use  
src/port/snprintf.c.  Before that, on most platforms we're at the mercy  
of the local libc, but it appears that Solaris 10 is the only supported  
platform where we'd still get a crash.  Most other platforms such as  
*BSD, macOS, and Solaris 11 have adopted glibc's behavior at some  
point.  (AIX and HPUX just print "" not "(null)", but that's close  
enough.)  I've not checked what Windows' native printf would do, but  
it doesn't matter because we've long used snprintf.c on that platform.  
  
In v12 and up, also const-ify related code so that we're not casting  
away const on the constant string.  This is just neatnik-ism, since  
next to no compilers will warn about that.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

Remove configure-time thread safety checking (thread_test.c).

commit   : d5e913a81cbab063c53b0a06dc8894da89390676    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 12:16:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 12:16:40 -0400    

Click here for diff

This testing was useful when it was written, nigh twenty years ago,  
but it seems fairly pointless for any platform built in the last  
dozen or more years.  (Compare also the comments at 8a2121185.)  
Also we now have reports that the test program itself fails under  
ThreadSanitizer.  Rather than invest effort in fixing it, let's  
just drop it, and assume that the few people who still care  
already know they need to use --disable-thread-safety.  
  
Back-patch into v14, for consistency with 8a2121185.  
  
Discussion: https://postgr.es/m/CADhDkKzPSiNvA3Hyq+wSR_icuPmazG0cFe=YnC3U-CFcYLc8Xw@mail.gmail.com  

D config/thread_test.c
M configure
M configure.ac

Fix division by zero error in date_bin

commit   : 81322fc409743f9ef169cb7bd89b0d0113a0aaa1    
  
author   : John Naylor <[email protected]>    
date     : Thu, 22 Jul 2021 17:34:19 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 22 Jul 2021 17:34:19 -0400    

Click here for diff

Bauyrzhan Sakhariyev, via Github  
  
Backpatch to v14  

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

jit: Don't inline functions that access thread-locals.

commit   : b1c1b7af573bbc9fe9039c82ffb7d3a3c378fe4a    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 22 Jul 2021 14:11:17 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 22 Jul 2021 14:11:17 +1200    

Click here for diff

Code inlined by LLVM can crash or fail with "Relocation type not  
implemented yet!" if it tries to access thread local variables.  Don't  
inline such code.  
  
Back-patch to 11, where LLVM arrived.  Bug #16696.  
  
Author: Dmitry Marakasov <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/jit/llvm/llvmjit_inline.cpp

Doc: improve documentation about exponentiation operator.

commit   : 227c4e57d6a70961e015ed4185facfc638afd048    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jul 2021 18:03:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jul 2021 18:03:33 -0400    

Click here for diff

Now that we're not having to wedge this into the straitjacket of  
the old operator table format, we can add another example to  
clarify the point about left-to-right associativity.  
  
Per suggestion from mdione at grulic.org.ar.  
  
https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Document "B" and "us" as accepted units in postgres.conf.sample

commit   : 65cc77c9847022f895a12012085606d8553c5fff    
  
author   : John Naylor <[email protected]>    
date     : Wed, 21 Jul 2021 10:17:07 -0400    
  
committer: John Naylor <[email protected]>    
date     : Wed, 21 Jul 2021 10:17:07 -0400    

Click here for diff

In postgresql.conf, memory and file size GUCs can be specified with "B"  
(bytes) as of b06d8e58b. Likewise, time GUCs can be specified with "us"  
(microseconds) as of caf626b2c. Update postgres.conf.sample to reflect  
that fact.  
  
Pavel Luzanov  
  
Backpatch to v12, which is the earliest version that allows both of  
these units. A separate commit will document the "B" case for v11.  
  
Discussion: https://www.postgresql.org/message-id/flat/f10d16fc-8fa0-1b3c-7371-cb3a35a13b7a%40postgrespro.ru  

M src/backend/utils/misc/postgresql.conf.sample

Add missing check of noError parameter in euc_tw_and_big5.c

commit   : e5cebe1ae8895fd9793344e70f58714e0a1742a4    
  
author   : John Naylor <[email protected]>    
date     : Wed, 21 Jul 2021 09:09:32 -0400    
  
committer: John Naylor <[email protected]>    
date     : Wed, 21 Jul 2021 09:09:32 -0400    

Click here for diff

Oversight in ea1b99a66  
  
Yukun Wang  
  
Backpatch to v14 where this parameter was introduced  
Discussion: https://www.postgresql.org/message-id/flat/OS0PR01MB6003FCEFF0201EF21685FD33B4E39%40OS0PR01MB6003.jpnprd01.prod.outlook.com  

M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c

doc: Document that only superusers can use pg_import_system_collations().

commit   : 9c1d56a9b08f87303749e60f9df8cf5c26c279eb    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 21 Jul 2021 13:52:37 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 21 Jul 2021 13:52:37 +0900    

Click here for diff

Back-patch to v10 where pg_import_system_collations() was added.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

doc: PG 14 relnote adjustments

commit   : f8d1333dec312f96673efc6314a0f1df99e38abc    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 20 Jul 2021 19:37:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 20 Jul 2021 19:37:04 -0400    

Click here for diff

Reported-by: Elena Indrupskaya  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Elena Indrupskaya  
  
Backpatch-through: 14 only  

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

Fix corner-case uninitialized-variable issues in plpgsql.

commit   : 899564e010abf216a90c48d9a1ce3728b8b00266    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Jul 2021 13:01:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Jul 2021 13:01:48 -0400    

Click here for diff

If an error was raised during our initial attempt to check whether  
a successfully-compiled expression is "simple", subsequent calls of  
exec_stmt_execsql would suppose that stmt->mod_stmt was already computed  
when it had not been.  This could lead to assertion failures in debug  
builds; in production builds the effect would typically be to act as  
if INTO STRICT had been specified even when it had not been.  Of course  
that only matters if the subsequent attempt to execute the expression  
succeeds, so that the problem can only be reached by fixing a failure  
in some referenced, inline-able SQL function and then retrying the  
calling plpgsql function in the same session.  
  
(There might be even-more-obscure ways to change the expression's  
behavior without changing the plpgsql function, but that one seems  
like the only one people would be likely to hit in practice.)  
  
The most foolproof way to fix this would be to arrange for  
exec_prepare_plan to not set expr->plan until we've finished the  
subsidiary simple-expression check.  But it seems hard to do that  
without creating reference-count leak issues.  So settle for documenting  
the hazard in a comment and fixing exec_stmt_execsql to test separately  
for whether it's computed stmt->mod_stmt.  (That adds a test-and-branch  
per execution, but hopefully that's negligible in context.)  In v11 and  
up, also fix exec_stmt_call which had a variant of the same issue.  
  
Per bug #17113 from Alexander Lakhin.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_simple.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_simple.sql

Fix some issues with WAL segment opening for pg_receivewal --compress

commit   : 3a0d2d0cbaf349a1aba928bb7b14edeaffab5212    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Jul 2021 12:12:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Jul 2021 12:12:47 +0900    

Click here for diff

The logic handling the opening of new WAL segments was fuzzy when using  
--compress if a partial, non-compressed, segment with the same base name  
existed in the repository storing those files.  In this case, using  
--compress would cause the code to first check for the existence and the  
size of a non-compressed segment, followed by the opening of a new  
compressed, partial, segment.  The code was accidentally working  
correctly on most platforms as the buildfarm has proved, except  
bowerbird where gzflush() could fail in this code path.  It is wrong  
anyway to take the code path used pre-padding when creating a new  
partial, non-compressed, segment, so let's fix it.  
  
Note that this issue exists when users mix successive runs of  
pg_receivewal with or without compression, as discovered with the tests  
introduced by ffc9dda.  
  
While on it, this refactors the code so as code paths that need to know  
about the ".gz" suffix are down from four to one in walmethods.c, easing  
a bit the introduction of new compression methods.  This addresses a  
second issue where log messages generated for an unexpected failure  
would not show the compressed segment name involved, which was  
confusing, printing instead the name of the non-compressed equivalent.  
  
Reported-by: Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Doc: vacuum_multixact_failsafe_age is multixact-based.

commit   : e1cdf61726e8d70971cf29d98c7ab5806875ac0e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Jul 2021 17:20:24 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Jul 2021 17:20:24 -0700    

Click here for diff

Oversight in commit 1e55e7d1, which added a wraparound failsafe  
mechanism to VACUUM.  
  
Backpatch: 14-, where VACUUM failsafe was introduced.  

M doc/src/sgml/config.sgml

vacuumdb: Correct comment about --force-index-cleanup.

commit   : 9a3d41a26fbb00c67b1ac00306b21ab83f171e08    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Jul 2021 17:06:47 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Jul 2021 17:06:47 -0700    

Click here for diff

Commit 3499df0d added a comment that incorrectly suggested that  
--force-index-cleanup did not appear in the same major version as the  
similar --no-index-cleanup option.  In fact, both options are new to  
PostgreSQL 14.  
  
Backpatch: 14-, where both options were introduced.  

M src/bin/scripts/vacuumdb.c

Make new replication slot test code even less racy

commit   : 1e8751380836056fdf546433dcf0328bc18c9313    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Jul 2021 17:21:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Jul 2021 17:21:07 -0400    

Click here for diff

Further fix the test code in ead9e51e8236, this time by waiting until  
the checkpoint has completed before moving on; this ensures that the  
WAL segment removal has already happened when we create the next slot.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/019_replslot_limit.pl

Don't allow to set replication slot_name as ''.

commit   : 40295d158fd4d462c55e6debae19dcd43ab530a6    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 19 Jul 2021 10:54:21 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 19 Jul 2021 10:54:21 +0530    

Click here for diff

We don't allow to create replication slot_name as an empty string ('') via  
SQL API pg_create_logical_replication_slot() but it is allowed to be set  
via Alter Subscription command. This will lead to apply worker repeatedly  
keep trying to stream data via slot_name '' and the user is not allowed to  
create the slot with that name.  
  
Author: Japin Li  
Reviewed-By: Ranier Vilela, Amit Kapila  
Backpatch-through: 10, where it was introduced  
Discussion: https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/commands/subscriptioncmds.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

doc: Mention CASCADE/RESTRICT for DROP STATISTICS

commit   : 6d0dc1a7da7942915c8160caa379c58dfd1488b8    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Jul 2021 12:39:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Jul 2021 12:39:50 +0900    

Click here for diff

This grammar has no effect as there are no dependencies on statistics,  
but it is supported by the parser.  This is more consistent with the  
other DROP commands.  
  
Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm1LA=yNmzcSfy+0oe6CEAgsxXRf_-UutE3ZncFi8QkFNQ@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ref/drop_statistics.sgml

Support for unnest(multirange)

commit   : 244ad5415557812a6ac4dc5d6e2ae908361d82c3    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 18 Jul 2021 21:07:24 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 18 Jul 2021 21:07:24 +0300    

Click here for diff

It has been spotted that multiranges lack of ability to decompose them into  
individual ranges.  Subscription and proper expanded object representation  
require substantial work, and it's too late for v14.  This commit  
provides the implementation of unnest(multirange), which is quite trivial.  
unnest(multirange) is defined as a polymorphic procedure.  
  
Catversion is bumped.  
  
Reported-by: Jonathan S. Katz  
Discussion: https://postgr.es/m/flat/60258efe-bd7e-4886-82e1-196e0cac5433%40postgresql.org  
Author: Alexander Korotkov  
Reviewed-by: Justin Pryzby, Jonathan S. Katz, Zhihong Yu, Tom Lane  
Reviewed-by: Alvaro Herrera  

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

Make new replication slot test code less racy

commit   : d8f3b021c618bf58c19f88fb86476793fd650336    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 17 Jul 2021 13:19:17 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 17 Jul 2021 13:19:17 -0400    

Click here for diff

The new test code added in ead9e51e8236 is racy -- it hinges on  
shared-memory state, which changes before the WARNING message is logged.  
Put it the other way around.  
  
Backpatch to 13.  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/019_replslot_limit.pl

Doc: document the current-transaction-modes GUCs.

commit   : 4466b38ec6ffd4ddea135c5baff978b7b43f8257    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Jul 2021 11:52:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Jul 2021 11:52:54 -0400    

Click here for diff

We had documentation of default_transaction_isolation et al,  
but for some reason not of transaction_isolation et al.  
AFAICS this is just an ancient oversight, so repair.  
  
Per bug #17077 from Yanliang Lei.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/set_transaction.sgml

Fix pg_dump for disabled triggers on partitioned tables

commit   : 3c5b7c6286215de41ba0a327d065876ff8bc26b2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 17:29:22 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 17:29:22 -0400    

Click here for diff

pg_dump failed to preserve the 'enabled' flag (which can be not only  
disabled, but also REPLICA or ALWAYS) for partitions which had it  
changed from their respective parents.  Attempt to handle that by  
including a definition for such triggers in the dump, but replace the  
standard CREATE TRIGGER line with an ALTER TRIGGER line.  
  
Backpatch to 11, where these triggers can exist.  In branches 11 and 12,  
pick up a few test lines from commit b9b408c48724 to verify that  
pg_upgrade is okay with these arrangements.  
  
Co-authored-by: Justin Pryzby <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
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/t/002_pg_dump.pl
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Preserve firing-on state when cloning row triggers to partitions

commit   : eef92de11e50837e4a0d02fc7269fdba7c97e583    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 13:01:43 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 13:01:43 -0400    

Click here for diff

When triggers are cloned from partitioned tables to their partitions,  
the 'tgenabled' flag (origin/replica/always/disable) was not propagated.  
Make it so that the flag on the trigger on partition is initially set to  
the same value as on the partitioned table.  
  
Add a test case to verify the behavior.  
  
Backpatch to 11, where this appeared in commit 86f575948c77.  
  
Author: Álvaro Herrera <[email protected]>  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Advance old-segment horizon properly after slot invalidation

commit   : e5bcbb10707b844471c67d5e5fd8226d1891ee97    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 12:07:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 12:07:30 -0400    

Click here for diff

When some slots are invalidated due to the max_slot_wal_keep_size limit,  
the old segment horizon should move forward to stay within the limit.  
However, in commit c6550776394e we forgot to call KeepLogSeg again to  
recompute the horizon after invalidating replication slots.  In cases  
where other slots remained, the limits would be recomputed eventually  
for other reasons, but if all slots were invalidated, the limits would  
not move at all afterwards.  Repair.  
  
Backpatch to 13 where the feature was introduced.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reported-by: Marcin Krupowicz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/replication/slot.c
M src/include/replication/slot.h
M src/test/recovery/t/019_replslot_limit.pl

doc: Spell checking

commit   : 525115a332af0fd479503550fd4f82551b797aea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jul 2021 10:35:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jul 2021 10:35:38 +0200    

Click here for diff

M doc/src/sgml/bki.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/release-14.sgml
M doc/src/sgml/wal.sgml

docs: fix inconsistencies in markup and case

commit   : 9ffe128a6d616675b559a14a89f8b42a30084323    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 15 Jul 2021 23:22:59 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 15 Jul 2021 23:22:59 +0200    

Click here for diff

Ensure to properly mark up function parameters in text with <parameter>,  
avoid using <acronym> for terms which aren't acronyms and properly place  
the ", and" in a value list. The acronym removal is a follow-up to commit  
fb72a7b8c3 which removed it for minmax-multi.  In passing, also fix an  
incorrectly cased word.  
  
Author: Ekaterina Kiryanova <[email protected]>  
Reviewed-by: Laurenz Albe <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v14  

M doc/src/sgml/amcheck.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml

Ensure HAVE_DECL_XXX macros in MSVC builds match those in Unix.

commit   : 081e86bd9e7e00af3cbf9bcdec8277f02d22e6b4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Jul 2021 11:00:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Jul 2021 11:00:43 -0400    

Click here for diff

Autoconf's AC_CHECK_DECLS() always defines HAVE_DECL_whatever  
as 1 or 0, but some of the entries in msvc/Solution.pm showed  
such symbols as "undef" instead of 0.  Fix that for consistency.  
There's no live bug in current usages AFAICS, but it's not hard  
to imagine one creeping in if more-complex #if tests get added.  
  
Back-patch to v13, which is as far back as Solution.pm contains  
this data.  The inconsistency still exists in the manually-filled  
pg_config_ext.h.win32 files of older branches; but as long as the  
problem is only latent, it doesn't seem worth the trouble to  
clean things up there.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Solution.pm

Fix small inconsistencies in catalog definition of multirange operators

commit   : 4d39d4e639b44503c9950f61ec882113385db7ec    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 15 Jul 2021 14:18:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 15 Jul 2021 14:18:19 +0300    

Click here for diff

This commit fixes the description of a couple of multirange operators and  
oprjoin for another multirange operator.  The change of oprjoin is more  
cosmetic since both old and new functions return the same constant.  
  
These cosmetic changes don't worth catalog incompatibility between 14beta2  
and 14beta3.  So, catversion isn't bumped.  
  
Discussion: https://postgr.es/m/CAPpHfdv9OZEuZDqOQoUKpXhq%3Dmc-qa4gKCPmcgG5Vvesu7%3Ds1w%40mail.gmail.com  
Backpatch-throgh: 14  

M src/include/catalog/pg_operator.dat

Remove unnecessary assertion in postmaster.c

commit   : b90063511a3ee41d037b2da0d4e0b3bc399140c5    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 15 Jul 2021 15:00:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 15 Jul 2021 15:00:52 +0900    

Click here for diff

A code path asserted that the archiver was dead, but a check made that  
impossible to happen.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACW=CYE1ars+2XyPTEPq0wQvru4c0dPZ=Nrn3EqNBkksvQ@mail.gmail.com  
Backpatch-throgh: 14  

M src/backend/postmaster/postmaster.c

Clarify description of pg_stat_statements columns

commit   : 3b57d5af7435d0d21bdec392dc1ce7c13871df8b    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 14 Jul 2021 11:04:15 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 14 Jul 2021 11:04:15 +0200    

Click here for diff

Reported-By: Peter Eisentraut  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgstatstatements.sgml

Fix unexpected error messages for various flavors of ALTER TABLE

commit   : 0c83eb2e0edb42f54a37fdeac85fb80eb5de2cca    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Jul 2021 17:15:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Jul 2021 17:15:01 +0900    

Click here for diff

Some commands of ALTER TABLE could fail with the following error:  
ERROR:  "tab" is of the wrong type  
  
This error is unexpected, as all the code paths leading to  
ATWrongRelkindError() should use a supported set of relkinds to generate  
correct error messages.  This commit closes the gap with such mistakes,  
by adding all the missing relkind combinations.  Tests are added to  
check all the problems found.  Note that some combinations are not used,  
but these are left around as it could have an impact on applications  
relying on this code.  
  
2ed532e has done a much larger refactoring on HEAD to make such error  
messages easier to manage in the long-term, so nothing is needed there.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Peter Eisentraut, Ahsan Hadi, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

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

Fix lack of message pluralization

commit   : b4842a8d085e970ff24667954c0d861e911e16c1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jul 2021 09:15:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jul 2021 09:15:14 +0200    

Click here for diff

M src/backend/storage/ipc/signalfuncs.c

Change the name of the Result Cache node to Memoize

commit   : 47ca4836441d1c24f75a94d43af8bd72d4c8d057    
  
author   : David Rowley <[email protected]>    
date     : Wed, 14 Jul 2021 12:45:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 14 Jul 2021 12:45:00 +1200    

Click here for diff

"Result Cache" was never a great name for this node, but nobody managed  
to come up with another name that anyone liked enough.  That was until  
David Johnston mentioned "Node Memoization", which Tom Lane revised to  
just "Memoize".  People seem to like "Memoize", so let's do the rename.  
  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where Result Cache was introduced  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/release-14.sgml
M src/backend/commands/explain.c
M src/backend/executor/Makefile
M src/backend/executor/execAmi.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
R065 src/backend/executor/nodeResultCache.c src/backend/executor/nodeMemoize.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.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/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
A src/include/executor/nodeMemoize.h
D src/include/executor/nodeResultCache.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/join.out
R088 src/test/regress/expected/resultcache.out src/test/regress/expected/memoize.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/sysviews.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/join.sql
R088 src/test/regress/sql/resultcache.sql src/test/regress/sql/memoize.sql
M src/test/regress/sql/partition_prune.sql
M src/tools/pgindent/typedefs.list

Rename debug_invalidate_system_caches_always to debug_discard_caches.

commit   : 6201fa3c166fe2383dd44a9dd5082bc748c2937a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Jul 2021 15:01:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Jul 2021 15:01:01 -0400    

Click here for diff

The name introduced by commit 4656e3d66 was agreed to be unreasonably  
long.  To match this change, rename initdb's recently-added  
--clobber-cache option to --discard-caches.  
  
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/config.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/regress.sgml
M doc/src/sgml/release-14.sgml
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/initdb.c
M src/include/pg_config_manual.h
M src/include/utils/inval.h
M src/pl/plpgsql/src/expected/plpgsql_cache.out
M src/pl/plpgsql/src/expected/plpgsql_cache_1.out
M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/sql/plpgsql_cache.sql
M src/pl/plpgsql/src/sql/plpgsql_record.sql
M src/test/isolation/specs/deadlock-soft-2.spec

Robustify tuplesort's free_sort_tuple function

commit   : a92709fed63428a711f36270a2b4bee039399d60    
  
author   : David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 13:27:44 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 13:27:44 +1200    

Click here for diff

41469253e went to the trouble of removing a theoretical bug from  
free_sort_tuple by checking if the tuple was NULL before freeing it. Let's  
make this a little more robust by also setting the tuple to NULL so that  
should we be called again we won't end up doing a pfree on the already  
pfree'd tuple. Per advice from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6, same as 41469253e  

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

Fix theoretical bug in tuplesort

commit   : a3b8d91ccd7964e5bec1066c9e598277294efd33    
  
author   : David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 12:42:04 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 12:42:04 +1200    

Click here for diff

This fixes a theoretical bug in tuplesort.c which, if a bounded sort was  
used in combination with a byval Datum sort (tuplesort_begin_datum), when  
switching the sort to a bounded heap in make_bounded_heap(), we'd call  
free_sort_tuple().  The problem was that when sorting Datums of a byval  
type, the tuple is NULL and free_sort_tuple() would free the memory for it  
regardless of that.  This would result in a crash.  
  
Here we fix that simply by adding a check to see if the tuple is NULL  
before trying to disassociate and free any memory belonging to it.  
  
The reason this bug is only theoretical is that nowhere in the current  
code base do we do tuplesort_set_bound() when performing a Datum sort.  
However, let's backpatch a fix for this as if any extension uses the code  
in this way then it's likely to cause problems.  
  
Author: Ronan Dunklau  
Discussion: https://postgr.es/m/CAApHDvpdoqNC5FjDb3KUTSMs5dg6f+XxH4Bg_dVcLi8UYAG3EQ@mail.gmail.com  
Backpatch-through: 9.6, oldest supported version  

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

Probe for preadv/pwritev in a more macOS-friendly way.

commit   : e75da4f1b6c63523021e550f1a92c67d2b8a92fb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jul 2021 19:17:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jul 2021 19:17:35 -0400    

Click here for diff

Apple's mechanism for dealing with functions that are available  
in only some OS versions confuses AC_CHECK_FUNCS, and therefore  
AC_REPLACE_FUNCS.  We can use AC_CHECK_DECLS instead, so long as  
we enable -Werror=unguarded-availability-new.  This allows people  
compiling for macOS to control whether or not preadv/pwritev are  
used by setting MACOSX_DEPLOYMENT_TARGET, rather than supplying  
a back-rev SDK.  (Of course, the latter still works, too.)  
  
James Hilliard  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Fix typo in function prototype

commit   : 9b450b1f1e5bbeac414bbb8e6a2f08fa40f470ff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jul 2021 22:07:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jul 2021 22:07:35 +0200    

Click here for diff

M doc/src/sgml/indexam.sgml

Remove dead assignment to local variable.

commit   : 233280803cb6b3fe6b905abc1a28913855f40dd6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Jul 2021 11:13:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Jul 2021 11:13:33 +0300    

Click here for diff

This should have been removed in commit 7e30c186da, which split the loop  
into two. Only the first loop uses the 'from' variable; updating it in  
the second loop is bogus. It was never read after the first loop, so this  
was harmless and surely optimized away by the compiler, but let's be tidy.  
  
Backpatch to all supported versions.  
  
Author: Ranier Vilela  
Discussion: https://www.postgresql.org/message-id/CAEudQAoWq%2BAL3BnELHu7gms2GN07k-np6yLbukGaxJ1vY-zeiQ%40mail.gmail.com  

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

doc: Make release note entries more accurate

commit   : 166fcf4a6364769501dd8562db927abefdd310b2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jul 2021 08:45:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jul 2021 08:45:34 +0200    

Click here for diff

Two tsquery-related release note entries had inaccuracies in the  
before and after examples.  Clean that up.  

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

Revert "Fix issues with Windows' stat() for files pending on deletion"

commit   : 5e60237ad1b4e2d159aec48ffd9914a633d2d6e0    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 14:46:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 14:46:40 +0900    

Click here for diff

This reverts commit 54fb8c7, as per the issues reported by fairywren  
when it comes to MinGW because of the lack of microsoft_native_stat()  
there.  Using just stat() for MSVC is not sufficient to take care of the  
concurrency problems with files pending on deletion.  It may be possible  
to paint some __MINGW64__ in the code to switch to a different  
implementation of stat() in this build context, but I am not sure either  
if relying on the implementation of stat() in MinGW to take care of the  
problems we are trying to fix is enough or not.  So this needs more  
study.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/port/open.c
M src/port/win32stat.c

Fix issues with Windows' stat() for files pending on deletion

commit   : de1510e2f5a1826890b206253016ebfc592c2f0a    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 13:02:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 13:02:45 +0900    

Click here for diff

The code introduced by bed9075 to enhance the stat() implementation on  
Windows for file sizes larger than 4GB fails to properly detect files  
pending for deletion with its method based on NtQueryInformationFile()  
or GetFileInformationByHandleEx(), as proved by Alexander Lakhin in a  
custom TAP test of his own.  
  
The method used in the implementation of open() to sleep and loop when  
when failing on ERROR_ACCESS_DENIED (EACCES) is showing much more  
stability, so switch to this method.  This could still lead to issues if  
the permission problem stays around for much longer than the timeout of  
1 second used, but that should (hopefully) never happen in  
performance-critical paths.  Still, there could be a point in increasing  
the timeouts for the sake of machines that handle heavy loads.  
  
Note that WIN32's open() now uses microsoft_native_stat() as it should  
be similar to stat() when working around issues with concurrent file  
deletions.  
  
I have spent some time testing this patch with pgbench in combination  
of the SQL functions from genfile.c, as well as running the TAP test  
provided on the thread with MSVC builds, and this looks much more  
stable than the previous method.  
  
Author: Alexander Lakhin  
Reviewed-by: Tom Lane, Michael Paquier,	Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/port/open.c
M src/port/win32stat.c

Lock the extension during ALTER EXTENSION ADD/DROP.

commit   : 69dfc36fd54d1620209d5d40f3c68006d96b0046    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Jul 2021 12:54:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Jul 2021 12:54:24 -0400    

Click here for diff

Although we were careful to lock the object being added or dropped,  
we failed to get any sort of lock on the extension itself.  This  
allowed the ALTER to proceed in parallel with a DROP EXTENSION,  
which is problematic for a couple of reasons.  If both commands  
succeeded we'd be left with a dangling link in pg_depend, which  
would cause problems later.  Also, if the ALTER failed for some  
reason, it might try to print the extension's name, and that could  
result in a crash or (in older branches) a silly error message  
complaining about extension "(null)".  
  
Per bug #17098 from Alexander Lakhin.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/extension.c

Fix pgbench timestamp bugs.

commit   : 5614a0f78eaaa51c07bd753ca854de238c730b84    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 11 Jul 2021 19:50:55 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 11 Jul 2021 19:50:55 +1200    

Click here for diff

Commit 547f04e changed pgbench to use microsecond accounting, but  
introduced a couple of logging and aggregation bugs:  
  
1.  We print Unix epoch timestamps so that you can correlate them with  
other logs, but these were inadvertently changed to use a  
system-dependent reference epoch.  Compute Unix timestamps, and begin  
aggregation intervals on the boundaries of whole Unix epoch seconds, as  
before.  
  
2.  The user-supplied aggregation interval needed to be scaled.  
  
Back-patch to 14.  
  
Author: Fabien COELHO <[email protected]>  
Author: Yugo NAGATA <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Reported-by: YoungHwan Joo <[email protected]>  
Reported-by: Gregory Smith <[email protected]>  
Discussion: https://postgr.es/m/CAF7igB1r6wRfSCEAB-iZBKxkowWY6%2BdFF2jObSdd9%2BiVK%2BvHJg%40mail.gmail.com  
Discussion: https://postgr.es/m/CAHLJuCW_8Vpcr0%3Dt6O_gozrg3wXXWXZXDioYJd3NhvKriqgpfQ%40mail.gmail.com  

M src/bin/pgbench/pgbench.c

Fix assign_record_type_typmod().

commit   : 10a07973cf72b32f32f0e05ada16c84580496d93    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 9 Jul 2021 14:15:48 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 9 Jul 2021 14:15:48 -0700    

Click here for diff

If an error occurred in the wrong place, it was possible to leave an  
unintialized entry in the hash table, leading to a crash. Fixed.  
  
Also, be more careful about the order of operations so that an  
allocation error doesn't leak memory in CacheMemoryContext or  
unnecessarily advance NextRecordTypmod.  
  
Backpatch through version 11. Earlier versions (prior to 35ea75632a5)  
do not exhibit the problem, because an uninitialized hash entry  
contains a valid empty list.  
  
Author: Sait Talha Nisanci <[email protected]>  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/HE1PR8303MB009069D476225B9A9E194B8891779@HE1PR8303MB0090.EURPRD83.prod.outlook.com  
Backpatch-through: 11  

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

Fix busted test for ldap_initialize.

commit   : ebc346e5bb72b2a68258f1be8791f2b90191cd38    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Jul 2021 13:19:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Jul 2021 13:19:31 -0400    

Click here for diff

Sigh ... I was expecting AC_CHECK_LIB to do something it didn't,  
namely update LIBS.  This led to not finding ldap_initialize.  
Fix by moving the probe for ldap_initialize.  In some sense this  
is more correct anyway, since (at least for now) we care about  
whether ldap_initialize exists in libldap not libldap_r.  
  
Per buildfarm member elver and local testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

Fix numeric_mul() overflow due to too many digits after decimal point.

commit   : 06883d58ff29cf4fb8c32fd13ce9947796b9fb0f    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 10 Jul 2021 12:45:00 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 10 Jul 2021 12:45:00 +0100    

Click here for diff

This fixes an overflow error when using the numeric * operator if the  
result has more than 16383 digits after the decimal point by rounding  
the result. Overflow errors should only occur if the result has too  
many digits *before* the decimal point.  
  
Discussion: https://postgr.es/m/CAEZATCUmeFWCrq2dNzZpRj5+6LfN85jYiDoqm+ucSXhb9U2TbA@mail.gmail.com  

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

Un-break AIX build, take 2.

commit   : 9ffad7ae7ffc632ff8d3822916c431b7e4a4df38    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 16:59:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 16:59:07 -0400    

Click here for diff

I incorrectly diagnosed the reason why hoverfly is unhappy.  
Looking closer, it appears that it fails to link libldap  
unless libssl is also present; so the problem was my  
idea of clearing LIBS before making the check.  Revert  
to essentially the original coding, except that instead  
of failing when libldap_r isn't there, use libldap.  
  
Per buildfarm member hoverfly.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

libpq: Fix sending queries in pipeline aborted state

commit   : 1beaa654da61ee66857a3c5125682b629f62fdf9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Jul 2021 15:57:59 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Jul 2021 15:57:59 -0400    

Click here for diff

When sending queries in pipeline mode, we were careless about leaving  
the connection in the right state so that PQgetResult would behave  
correctly; trying to read further results after sending a query after  
having read a result with an error would sometimes hang.  Fix by  
ensuring internal libpq state is changed properly.  All the state  
changes were being done by the callers of pqAppendCmdQueueEntry(); it  
would have become too repetitious to have this logic in each of them, so  
instead put it all in that function and relieve callers of the  
responsibility.  
  
Add a test to verify this case.  Without the code fix, this new test  
hangs sometimes.  
  
Also, document that PQisBusy() would return false when no queries are  
pending result.  This is not intuitively obvious, and NULL would be  
obtained by calling PQgetResult() at that point, which is confusing.  
Wording by Boris Kolpackov.  
  
In passing, fix bogus use of "false" to mean "0", per Ranier Vilela.  
  
Backpatch to 14.  
  
Author: Álvaro Herrera <[email protected]>  
Reported-by: Boris Kolpackov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c

Un-break AIX build.

commit   : 7f2eca6f9db6e2227b87d03204e201ee6d759b5b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 14:15:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 14:15:41 -0400    

Click here for diff

In commit d0a02bdb8, I'd supposed that uniformly probing for  
ldap_bind would make the intent clearer.  However, that seems  
not to work on AIX, for obscure reasons (maybe it's a macro  
there?).  Revert to the former behavior of probing  
ldap_simple_bind for thread-safe cases and ldap_bind otherwise.  
  
Per buildfarm member hoverfly.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

Avoid creating a RESULT RTE that's marked LATERAL.

commit   : 1d98fdaed89c00465ef68fa2804967ea27b03abc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 13:38:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 13:38:24 -0400    

Click here for diff

Commit 7266d0997 added code to pull up simple constant function  
results, converting the RTE_FUNCTION RTE to a dummy RTE_RESULT  
RTE since it no longer need be scanned.  But I forgot to clear  
the LATERAL flag if the RTE has it set.  If the function reduced  
to a constant, it surely contains no lateral references so this  
simplification is logically OK.  It's needed because various other  
places will Assert that RESULT RTEs aren't LATERAL.  
  
Per bug #17097 from Yaoguang Chen.  Back-patch to v13 where the  
faulty code came in.  
  
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

Update configure's probe for libldap to work with OpenLDAP 2.5.

commit   : 5620ec83362d08b9f86c90c97c0a70031c4d0b2c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 12:38:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 12:38:55 -0400    

Click here for diff

The separate libldap_r is gone and libldap itself is now always  
thread-safe.  Unfortunately there seems no easy way to tell by  
inspection whether libldap is thread-safe, so we have to take  
it on faith that libldap is thread-safe if there's no libldap_r.  
That should be okay, as it appears that libldap_r was a standard  
part of the installation going back at least 20 years.  
  
Report and patch by Adrian Ho.  Back-patch to all supported  
branches, since people might try to build any of them with  
a newer OpenLDAP.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Reject cases where a query in WITH rewrites to just NOTIFY.

commit   : 39b6e85f135f7a1dcf43c0551d7d10e8c57b7fce    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 11:02:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 11:02:26 -0400    

Click here for diff

Since the executor can't cope with a utility statement appearing  
as a node of a plan tree, we can't support cases where a rewrite  
rule inserts a NOTIFY into an INSERT/UPDATE/DELETE command appearing  
in a WITH clause of a larger query.  (One can imagine ways around  
that, but it'd be a new feature not a bug fix, and so far there's  
been no demand for it.)  RewriteQuery checked for this, but it  
missed the case where the DML command rewrites to *only* a NOTIFY.  
That'd lead to crashes later on in planning.  Add the missed check,  
and improve the level of testing of this area.  
  
Per bug #17094 from Yaoguang Chen.  It's been busted since WITH  
was introduced, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove more obsolete comments about semaphores.

commit   : 8d48a3436dd83f7d6e3cde2d76f91f49f27ba16d    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 9 Jul 2021 17:51:48 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 9 Jul 2021 17:51:48 +1200    

Click here for diff

Commit 6753333f stopped using semaphores as the sleep/wake mechanism for  
heavyweight locks, but some obsolete references to that scheme remained  
in comments.  As with similar commit 25b93a29, back-patch all the way.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLafjB1uzXcy%3D%3D2L3cy7rjHkqOVn7qRYGBjk%3D%3DtMJE7Yg%40mail.gmail.com  

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

Fix incorrect return value in pg_size_pretty(bigint)

commit   : 6de3a21bbc0601b22cd465311d10978acca7cc0b    
  
author   : David Rowley <[email protected]>    
date     : Fri, 9 Jul 2021 14:04:40 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 9 Jul 2021 14:04:40 +1200    

Click here for diff

Due to how pg_size_pretty(bigint) was implemented, it's possible that when  
given a negative number of bytes that the returning value would not match  
the equivalent positive return value when given the equivalent positive  
number of bytes.  This was due to two separate issues.  
  
1. The function used bit shifting to convert the number of bytes into  
larger units.  The rounding performed by bit shifting is not the same as  
dividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These two  
operations are only equivalent with positive numbers.  
  
2. The half_rounded() macro rounded towards positive infinity.  This meant  
that negative numbers rounded towards zero and positive numbers rounded  
away from zero.  
  
Here we fix #1 by dividing the values instead of bit shifting.  We fix #2  
by adjusting the half_rounded macro always to round away from zero.  
  
Additionally, adjust the pg_size_pretty(numeric) function to be more  
explicit that it's using division rather than bit shifting.  A casual  
observer might have believed bit shifting was used due to a static  
function being named numeric_shift_right.  However, that function was  
calculating the divisor from the number of bits and performed division.  
Here we make that more clear.  This change is just cosmetic and does not  
affect the return value of the numeric version of the function.  
  
Here we also add a set of regression tests both versions of  
pg_size_pretty() which test the values directly before and after the  
function switches to the next unit.  
  
This bug was introduced in 8a1fab36a. Prior to that negative values were  
always displayed in bytes.  
  
Author: Dean Rasheed, David Rowley  
Discussion: https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.com  
Backpatch-through: 9.6, where the bug was introduced.  

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

doc: minor PG 14 relnote changes

commit   : 9893d5124b1a0a2d84fb8038bde3bf11491abf7a    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 8 Jul 2021 18:59:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 8 Jul 2021 18:59:19 -0400    

Click here for diff

Backpatch-through: 14 only  

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

doc: PG 14 relnote, move system view items to the proper sect.

commit   : 6f566f0e9b1aab41eea1ca1991e04e3d8a79c198    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 8 Jul 2021 13:08:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 8 Jul 2021 13:08:09 -0400    

Click here for diff

Backpatch-through: 14 only  

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

doc: improve PG 14 relnote item about adding btree pages to FSM

commit   : 049d3617a3bedb2a1d97d1621f36c861f52269a7    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 8 Jul 2021 12:27:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 8 Jul 2021 12:27:30 -0400    

Click here for diff

Wording confirmed by Peter Geoghegan.  
  
Backpatch-through: 14 only  

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

Fix crash in postgres_fdw for provably-empty remote UPDATE/DELETE.

commit   : 30a35bca3f9306f87ca8db095ddac2ba62156934    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Jul 2021 15:21:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Jul 2021 15:21:25 -0400    

Click here for diff

In 86dc90056, I'd written find_modifytable_subplan with the assumption  
that if the immediate child of a ModifyTable is a Result, it must be  
a projecting Result with a subplan.  However, if the UPDATE or DELETE  
has a provably-constant-false WHERE clause, that's not so: we'll  
generate a dummy subplan with a childless Result.  Add the missing  
null-check so we don't crash on such cases.  
  
Per report from Alexander Pyhalov.  
  
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

doc: Fix description about pg_stat_statements.track_planning.

commit   : e48f2afee631be42739e50fbefd758503e8dcf82    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 7 Jul 2021 21:54:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 7 Jul 2021 21:54:47 +0900    

Click here for diff

This commit fixes wrong wording like "a fewer kinds"  
in the description about track_planning option.  
  
Back-patch to v13 where pg_stat_statements.track_planning was added.  
  
Author: Justin Pryzby  
Reviewed-by: Julien Rouhaud, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgstatstatements.sgml

postgres_fdw: Tighten up allowed values for batch_size, fetch_size options.

commit   : 4173477b3841749ce491c77b54a5940f6f3e9eb6    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 7 Jul 2021 11:13:40 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 7 Jul 2021 11:13:40 +0900    

Click here for diff

Previously the values such as '100$%$#$#', '9,223,372,' were accepted and  
treated as valid integers for postgres_fdw options batch_size and fetch_size.  
Whereas this is not the case with fdw_startup_cost and fdw_tuple_cost options  
for which an error is thrown. This was because endptr was not used  
while converting strings to integers using strtol.  
  
This commit changes the logic so that it uses parse_int function  
instead of strtol as it serves the purpose by returning false in case  
if it is unable to convert the string to integer. Note that  
this function also rounds off the values such as '100.456' to 100 and  
'100.567' or '100.678' to 101.  
  
While on this, use parse_real for fdw_startup_cost and fdw_tuple_cost options.  
  
Since parse_int and parse_real are being used for reloptions and GUCs,  
it is more appropriate to use in postgres_fdw rather than using strtol  
and strtod directly.  
  
Back-patch to v14.  
  
Author: Bharath Rupireddy  
Reviewed-by: Ashutosh Bapat, Tom Lane, Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/CALj2ACVMO6wY5Pc4oe1OCgUOAtdjHuFsBDw8R5uoYR86eWFQDA@mail.gmail.com  

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/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Avoid doing catalog lookups in postgres_fdw's conversion_error_callback.

commit   : 86d4914210e9e7f8f8c32defacc71744d0222feb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 12:36:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 12:36:12 -0400    

Click here for diff

As in 50371df26, this is a bad idea since the callback can't really  
know what error is being thrown and thus whether or not it is safe  
to attempt catalog accesses.  Rather than pushing said accesses into  
the mainline code where they'd usually be a waste of cycles, we can  
look at the query's rangetable instead.  
  
This change does mean that we'll be printing query aliases (if any  
were used) rather than the table or column's true name.  But that  
doesn't seem like a bad thing: it's certainly a more useful definition  
in self-join cases, for instance.  In any case, it seems unlikely that  
any applications would be depending on this detail, so it seems safe  
to change.  
  
Patch by me.  Original complaint by Andres Freund; Bharath Rupireddy  
noted the connection to conversion_error_callback.  
  
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

Doc: add info about timestamps with fractional-minute UTC offsets.

commit   : 94911ec28f01d1babe61053977ca9f057983cb21    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 10:34:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 10:34:51 -0400    

Click here for diff

Our code has supported fractional-minute UTC offsets for ages, but  
there was no mention of the possibility in the main docs, and only  
a very indirect reference in Appendix B.  Improve that.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Reduce overhead of cache-clobber testing in LookupOpclassInfo().

commit   : 07f1e06964adeec6d79bb24f3b1d50666694213b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Jul 2021 16:51:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Jul 2021 16:51:57 -0400    

Click here for diff

Commit 03ffc4d6d added logic to bypass all caching behavior in  
LookupOpclassInfo when CLOBBER_CACHE_ALWAYS is enabled.  It doesn't  
look like I stopped to think much about what that would cost, but  
recent investigation shows that the cost is enormous: it roughly  
doubles the time needed for cache-clobber test runs.  
  
There does seem to be value in this behavior when trying to test  
the opclass-cache loading logic itself, but for other purposes the  
cost is excessive.  Hence, let's back off to doing this only when  
debug_invalidate_system_caches_always is at least 3; or in older  
branches, when CLOBBER_CACHE_RECURSIVELY is defined.  
  
While here, clean up some other minor issues in LookupOpclassInfo.  
Re-order the code so we aren't left with broken cache entries (leading  
to later core dumps) in the unlikely case that we suffer OOM while  
trying to allocate space for a new entry.  (That seems to be my  
oversight in 03ffc4d6d.)  Also, in >= v13, stop allocating one array  
entry too many.  That's evidently left over from sloppy reversion in  
851b14b0c.  
  
Back-patch to all supported branches, mainly to reduce the runtime  
of cache-clobbering buildfarm animals.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rethink blocking annotations in detach-partition-concurrently-[34].

commit   : 9fa6fe466c9d2eaba4fdd8091203ee61e74d71bf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Jul 2021 14:34:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Jul 2021 14:34:47 -0400    

Click here for diff

In 741d7f104, I tried to make the reports from canceled steps come out  
after the pg_cancel_backend() steps, since that was the most common  
ordering before.  However, that doesn't ensure that a canceled step  
doesn't report even later, as shown in a recent failure on buildfarm  
member idiacanthus.  Rather than complicating things even more with  
additional annotations, let's just force the cancel's effect to be  
reported first.  It's not *that* unnatural-looking.  
  
Back-patch to v14 where these test cases appeared.  
  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=idiacanthus&dt=2021-07-02%2001%3A40%3A04  

M src/test/isolation/expected/detach-partition-concurrently-3.out
M src/test/isolation/expected/detach-partition-concurrently-4.out
M src/test/isolation/specs/detach-partition-concurrently-3.spec
M src/test/isolation/specs/detach-partition-concurrently-4.spec

doc: Fix quoting markup

commit   : 1479c5afdce2c57928dc1322bd71106858a0770f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jul 2021 08:26:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jul 2021 08:26:00 +0200    

Click here for diff

M doc/src/sgml/appendix-obsolete-default-roles.sgml

Doc: Hash Indexes.

commit   : f3690fbdeac43ab8547c212062ec515a55dd118c    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 5 Jul 2021 09:38:17 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 5 Jul 2021 09:38:17 +0530    

Click here for diff

A new chapter for Hash Indexes, designed to help users understand how  
they work and when to use them.  
  
Backpatch-through 10 where we have made hash indexes durable.  
  
Author: Simon Riggs  
Reviewed-By: Justin Pryzby, Amit Kapila  
Discussion: https://postgr.es/m/CANbhV-HRjNPYgHo--P1ewBrFJ-GpZPb9_25P7=Wgu7s7hy_sLQ@mail.gmail.com  

M doc/src/sgml/filelist.sgml
A doc/src/sgml/hash.sgml
M doc/src/sgml/postgres.sgml

doc: Mention requirement to --enable-tap-tests on section for TAP tests

commit   : 95e2f925f1443f49b31e861a8d66dabca5528aaa    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 4 Jul 2021 20:59:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 4 Jul 2021 20:59:10 +0900    

Click here for diff

Author: Greg Sabino Mullane  
Discussion: https://postgr.es/m/CAKAnmmJYH2FBn_+Vwd2FD5SaKn8hjhAXOCHpZc6n4wXaUaW_SA@mail.gmail.com  
Backpatch-through: 9.6  

M doc/src/sgml/regress.sgml

Doc: mention that VACUUM can't utilize over 1GB of RAM

commit   : b88e5fe60eef5decd3ccfd73566559dc6136cb61    
  
author   : David Rowley <[email protected]>    
date     : Sun, 4 Jul 2021 22:29:16 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 4 Jul 2021 22:29:16 +1200    

Click here for diff

Document that setting maintenance_work_mem to values over 1GB has no  
effect on VACUUM.  
  
Reported-by: Martín Marqués  
Author: Laurenz Albe  
Discussion: https://postgr.es/m/CABeG9LsZ2ozUMcqtqWu_-GiFKB17ih3p8wBHXcpfnHqhCnsc7A%40mail.gmail.com  
Backpatch-through: 9.6, oldest supported release  

M doc/src/sgml/config.sgml

doc: adjust "cities" example to be consistent with other SQL

commit   : e033e260b9d0fcba969e5314be967429ade1b9ec    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 20:42:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 20:42:46 -0400    

Click here for diff

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

M doc/src/sgml/advanced.sgml

docs: clarify new aggressive vacuum mode for multi-xacts

commit   : d54092955690e29656186ff5d4d315a3c56ccb37    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 18:00:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 18:00:30 -0400    

Click here for diff

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

M doc/src/sgml/maintenance.sgml

Don't try to print data type names in slot_store_error_callback().

commit   : 63a952167092bd2d457691202d71ace943e1b06a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Jul 2021 16:04:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Jul 2021 16:04:54 -0400    

Click here for diff

The existing code tried to do syscache lookups in an already-failed  
transaction, which is problematic to say the least.  After some  
consideration of alternatives, the best fix seems to be to just drop  
type names from the error message altogether.  The table and column  
names seem like sufficient localization.  If the user is unsure what  
types are involved, she can check the local and remote table  
definitions.  
  
Having done that, we can also discard the LogicalRepTypMap hash  
table, which had no other use.  Arguably, LOGICAL_REP_MSG_TYPE  
replication messages are now obsolete as well; but we should  
probably keep them in case some other use emerges.  (The complexity  
of removing something from the replication protocol would likely  
outweigh any savings anyhow.)  
  
Masahiko Sawada and Bharath Rupireddy, per complaint from Andres  
Freund.  Back-patch to v10 where this code originated.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: PG 14 relnotes, mention CONCURRENTLY improvements

commit   : 56d467a07de1c203cfe78fea69cd8326fa297e23    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 14:46:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 14:46:31 -0400    

Click here for diff

Add items for vacuum not having to wait for CONCURRENTLY, and  
CONCURRENTLY not having to wait for other CONCURRENTLY operations.  
  
Reported-by: Simon Riggs  
  
Discussion: https://postgr.es/m/CANbhV-EMM4nf7Ys-Yae_kY25dXT_3eiOXke2+yw44jgy+4jNsA@mail.gmail.com  
  
Backpatch-through: 14 only  

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

doc: update PG 14 release notes

commit   : a3a681f8590d9476c8ce94172316d3d339375fe6    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 1 Jul 2021 20:33:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 1 Jul 2021 20:33:32 -0400    

Click here for diff

Mostly addition of <literal> tags  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 14 only  

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

doc: Remove inappropriate <acronym> tags

commit   : fb72a7b8c384e25d752b22a69e77d8227af65b4b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 22:23:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 22:23:37 +0200    

Click here for diff

M doc/src/sgml/brin.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/release-14.sgml

add missing tag from commit b8c4261e5e

commit   : 1da2ea0cccc7f9ce5eed3d6e62cba785e82a6a0d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 15:38:06 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 15:38:06 -0400    

Click here for diff

M GNUmakefile.in
M doc/src/sgml/installation.sgml

doc: Clean up title case use

commit   : 46bbe5d777722938496f177706cc87ff64512def    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 21:27:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 21:27:39 +0200    

Click here for diff

M doc/src/sgml/appendix-obsolete-default-roles.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/logicaldecoding.sgml

Add new make targets world-bin and install-world-bin

commit   : 100e9ae53f210c9e82671f1cc554aca945c4c180    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 14:21:09 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 14:21:09 -0400    

Click here for diff

These are the same as world and install-world respectively, but without  
building or installing the documentation. There are many reasons for  
wanting to be able to do this, including speed, lack of documentation  
building tools, and wanting to build other formats of the documentation.  
Plans for simplifying the buildfarm client code include using these  
targets.  
  
Backpatch to all live branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M doc/src/sgml/installation.sgml

Add --clobber-cache option to initdb, for CCA testing.

commit   : d0477080174b227e6f5cbe0dd10c4d79abb7f3e6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Jul 2021 13:33:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Jul 2021 13:33:05 -0400    

Click here for diff

Commit 4656e3d66 replaced the "#define CLOBBER_CACHE_ALWAYS"  
testing mechanism with a GUC, which has been a great help for  
doing cache-clobber testing in more efficient ways; but there  
is a gap in the implementation.  The only way to do cache-clobber  
testing during an initdb run is to use the old method with #define,  
because one can't set the GUC from outside.  Improve this by  
adding a switch to initdb for the purpose.  
  
(Perhaps someday we should let initdb pass through arbitrary  
"-c NAME=VALUE" switches.  Quoting difficulties dissuaded me  
from attempting that right now, though.)  
  
Back-patch to v14 where 4656e3d66 came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Don't reset relhasindex for partitioned tables on ANALYZE

commit   : be280cdad2985749e558212b0a5c8bdf9abb4e6a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 1 Jul 2021 12:56:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 1 Jul 2021 12:56:30 -0400    

Click here for diff

Commit 0e69f705cc1a introduced code to analyze partitioned table;  
however, that code fails to preserve pg_class.relhasindex correctly.  
Fix by observing whether any indexes exist rather than accidentally  
falling through to assuming none do.  
  
Backpatch to 14.  
  
Author: Alexander Pyhalov <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Discussion: https://postgr.es/m/CALNJ-vS1R3Qoe5t4tbzxrkpBtzRbPq1dDcW4RmA_a+oqweF30w@mail.gmail.com  

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

Fix prove_installcheck to use correct paths when used with PGXS

commit   : c4774ce339beff4a8968ceecb86bbbfa3335ed2b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 08:29:10 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 08:29:10 -0400    

Click here for diff

The prove_installcheck recipe in src/Makefile.global.in was emitting  
bogus paths for a couple of elements when used with PGXS. Here we create  
a separate recipe for the PGXS case that does it correctly. We also take  
the opportunity to make the make the file more readable by breaking up  
the prove_installcheck and prove_check recipes across several lines, and  
to remove the setting for REGRESS_SHLIB to src/test/recovery/Makefile,  
which is the only set of tests that actually need it.  
  
Backpatch to all live branches  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/test/recovery/Makefile

Replace magic constants used in pg_stat_get_replication_slot().

commit   : a9cb00a965c6ac0cd434733fae0948218702e501    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 11:40:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 11:40:06 +0530    

Click here for diff

A few variables have been using 10 as a magic constant while  
PG_STAT_GET_REPLICATION_SLOT_COLS can be used instead.  
  
Author: Masahiko Sawada  
Reviewed-By: Amit Kapila  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/CAD21AoBvqODDfmD17DkEuPCvV2KbruukXQ2Vwrv5Xi-TsAsTJA@mail.gmail.com  

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

Allow streaming the changes after speculative aborts.

commit   : dfceed30abc191c097557357dd6db56e875bb7e1    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 09:48:07 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 09:48:07 +0530    

Click here for diff

Until now, we didn't allow to stream the changes in logical replication  
till we receive speculative confirm or the next DML change record after  
speculative inserts. The reason was that we never use to process  
speculative aborts but after commit 4daa140a2f it is possible to process  
them so we can allow streaming once we receive speculative abort after  
speculative insertion.  
  
We decided to backpatch to 14 where the feature for streaming in progress  
transactions have been introduced as this is a minor change and makes that  
functionality better.  
  
Author: Amit Kapila  
Reviewed-By: Dilip Kumar  
Backpatch-through: 14  
Discussion: https://postgr.es/m/CAA4eK1KdqmTCtrBR6oFfGELrLLbDLDedL6zACcsUOQuTJBj1vw@mail.gmail.com  

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

Fix incorrect PITR message for transaction ROLLBACK PREPARED

commit   : 607a3a43bca573a02570f374fd98c82a0c2e12a1    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Jun 2021 11:49:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Jun 2021 11:49:10 +0900    

Click here for diff

Reaching PITR on such a transaction would cause the generation of a LOG  
message mentioning a transaction committed, not aborted.  
  
Oversight in 4f1b890.  
  
Author: Simon Riggs  
Discussion: https://postgr.es/m/CANbhV-GJ6KijeCgdOrxqMCQ+C8QiK657EMhCy4csjrPcEUFv_Q@mail.gmail.com  
Backpatch-through: 9.6  

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

Fixes for multirange selectivity estimation

commit   : 322e82b77ef4acb9697c6e4259292f5671cb85bb    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 29 Jun 2021 23:18:09 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 29 Jun 2021 23:18:09 +0300    

Click here for diff

 * Fix enumeration of the multirange operators in calc_multirangesel() and  
   calc_multirangesel() switches.  
 * Add more regression tests for matching to empty ranges/multiranges.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/c5269c65-f967-77c5-ff7c-15e621c47f6a%40gmail.com  
Author: Alexander Korotkov  
Backpatch-through: 14, where multiranges were introduced  

M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/test/regress/expected/multirangetypes.out
M src/test/regress/sql/multirangetypes.sql

Fix libpq state machine in pipeline mode

commit   : 690339fcd58759d213523f87071f992c4402e980    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jun 2021 15:01:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jun 2021 15:01:29 -0400    

Click here for diff

The original coding required that PQpipelineSync had been called before  
the first call to PQgetResult, and failure to do that would result in an  
unexpected NULL result being returned.  Fix by setting the right state  
when a query is sent, rather than leaving it unchanged and having  
PQpipelineSync apply the necessary state change.  
  
A new test case to verify the behavior is added, which relies on the new  
PQsendFlushRequest() function added by commit a7192326c74d.  
  
Backpatch to 14, where pipeline mode was added.  
  
Reported-by: Boris Kolpackov <[email protected]>  
Author: Álvaro Herrera <[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/t/001_libpq_pipeline.pl
A src/test/modules/libpq_pipeline/traces/nosync.trace

Add PQsendFlushRequest to libpq

commit   : 69cf1d5429d48d030d71d5dd4931084d422413cb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jun 2021 14:37:39 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jun 2021 14:37:39 -0400    

Click here for diff

This new libpq function allows the application to send an 'H' message,  
which instructs the server to flush its outgoing buffer.  
  
This hasn't been needed so far because the Sync message already requests  
a buffer; and I failed to realize that this was needed in pipeline mode  
because PQpipelineSync also causes the buffer to be flushed.  However,  
sometimes it is useful to request a flush without establishing a  
synchronization point.  
  
Backpatch to 14, where pipeline mode was introduced in libpq.  
  
Reported-by: Boris Kolpackov <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/libpq-fe.h

Fix bogus logic for reporting which hash partition conflicts.

commit   : f8b51464c265696c1eab1c896bddc797beb9a13c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Jun 2021 14:34:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Jun 2021 14:34:31 -0400    

Click here for diff

Commit efbfb6424 added logic for reporting exactly which existing  
partition conflicts when complaining that a new hash partition's  
modulus isn't compatible with the existing ones.  However, it  
misunderstood the partitioning data structure, and would select  
the wrong partition in some cases, or crash outright due to fetching  
a bogus table OID in other cases.  
  
Per bug #17076 from Alexander Lakhin.  Fix by Amit Langote;  
some further work on the code comments by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

doc: Improve PG14 release notes

commit   : caa0f07d2d4b69cd53b5bf7c847d9d65eadbbfee    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 28 Jun 2021 20:58:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 28 Jun 2021 20:58:47 -0400    

Click here for diff

Mostly markup improvements.  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 14 only  

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

Don't use abort(3) in libpq's fe-print.c.

commit   : cf1f545bf281d3dcb7b44e6b7f21a9369024fbf0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 14:17:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 14:17:42 -0400    

Click here for diff

Causing a core dump on out-of-memory seems pretty unfriendly,  
and surely is far outside the expected behavior of a general-purpose  
library.  Just print an error message (as we did already) and return.  
These functions unfortunately don't have an error return convention,  
but code using them is probably just looking for a quick-n-dirty  
print method and wouldn't bother to check anyway.  
  
Although these functions are semi-deprecated, it still seems  
appropriate to back-patch this.  In passing, also back-patch  
b90e6cef1, just to reduce cosmetic differences between the  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Don't depend on -fwrapv semantics in pgbench's random() function.

commit   : 203c5aaaba56715168c1e80a45d4929120c9281b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 12:40:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 12:40:37 -0400    

Click here for diff

Instead use the common/int.h functions to check for integer overflow  
in a more C-standard-compliant fashion.  This is motivated by recent  
failures on buildfarm member moonjelly, where it appears that  
development-tip gcc is optimizing without regard to the -fwrapv  
switch.  Presumably that's a gcc bug that will be fixed soon, but  
we might as well install cleaner coding here rather than wait.  
  
(This does not address the question of whether we'll ever be able  
to get rid of using -fwrapv.  Testing shows that this spot is the  
only place where doing so creates visible regression test failures,  
but unfortunately that proves very little.)  
  
Back-patch to v12.  The common/int.h functions exist in v11, but  
that branch doesn't use them in any client-side code.  I judge  
that this case isn't interesting enough in the real world to take  
even a small risk of issues from being the first such use.  
  
Tom Lane and Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Pre branch pgindent / pgperltidy run

commit   : e1c1c30f635390b6a3ae4993e8cac213a33e6e3f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Jun 2021 11:05:54 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Jun 2021 11:05:54 -0400    

Click here for diff

Along the way make a slight adjustment to  
src/include/utils/queryjumble.h to avoid an unused typedef.  

M src/backend/access/heap/hio.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/executor/nodeModifyTable.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/storage/ipc/procarray.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/include/nodes/execnodes.h
M src/include/utils/queryjumble.h
M src/test/perl/PostgresNode.pm
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/020_messages.pl
M src/tools/pgindent/typedefs.list

Message style improvements

commit   : c31833779d5a4775d7220be4b9143bec66c9a9fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jun 2021 08:36:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jun 2021 08:36:44 +0200    

Click here for diff

M src/backend/access/common/toast_compression.c
M src/backend/catalog/catalog.c
M src/backend/catalog/pg_inherits.c
M src/backend/commands/tablecmds.c
M src/backend/postmaster/pgstat.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/standby.c
M src/backend/tcop/fastpath.c
M src/backend/utils/adt/multirangetypes.c
M src/test/regress/expected/compression_1.out
M src/test/regress/expected/multirangetypes.out

Improve RelationGetIdentityKeyBitmap().

commit   : ee3fdb8f3465b3a5937a7fe647b7b6584a600647    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 28 Jun 2021 10:56:53 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 28 Jun 2021 10:56:53 +0530    

Click here for diff

We were using RelationGetIndexList() to update the relation's replica  
identity index but instead, we can directly use RelationGetReplicaIndex()  
which uses the same functionality. This is a minor code readability  
improvement.  
  
Author: Japin Li  
Reviewed-By: Takamichi Osumi, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

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

Fix race condition in TransactionGroupUpdateXidStatus().

commit   : b786304c2904a4e444fe740bbc2e0b69efacc19d    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 28 Jun 2021 09:29:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 28 Jun 2021 09:29:38 +0530    

Click here for diff

When we cannot immediately acquire XactSLRULock in exclusive mode at  
commit time, we add ourselves to a list of processes that need their XIDs  
status update. We do this if the clog page where we need to update the  
current transaction status is the same as the group leader's clog page,  
otherwise, we allow the caller to clear it by itself. Now, when we can't  
add ourselves to any group, we were not clearing the current proc if it  
has already become a member of some group which was leading to an  
assertion failure when the same proc was assigned to another backend after  
the current backend exits.  
  
Reported-by: Alexander Lakhin  
Bug: 17072  
Author: Amit Kapila  
Tested-By: Alexander Lakhin  
Backpatch-through: 11, where it was introduced  
Discussion: https://postgr.es/m/[email protected]  

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

Change recovery_init_sync_method to PGC_SIGHUP.

commit   : 34a8b64b4e5f0cd818e5cc7f98846de57938ea57    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 28 Jun 2021 15:17:43 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 28 Jun 2021 15:17:43 +1200    

Click here for diff

The setting has no effect except during startup.  It's still nice to be  
able to change it dynamically, which is expected to be pretty useful to  
an admin following crash recovery when restarting the cluster is not so  
appealing.  
  
Per discussions following commits 2941138e6 and 61752afb2.  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-by: Fujii Masao <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/20210529192321.GM2082%40telsasoft.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Fix variable initialization with ALTER SUBSCRIPTION DROP PUBLICATION

commit   : 79718c1c6c007c27e9c1b8e92bd96d17067606fa    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Jun 2021 12:11:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Jun 2021 12:11:18 +0900    

Click here for diff

copy_data is not a supported option with this sub-command of ALTER  
SUBSCRIPTION, which would not make a variable related to it initialized  
after parsing the option set in DefElems.  A refresh could then refer to  
it.  
  
Author: Ranier Vilela  
Reviewed-by: Peter Smith  
Discussion: https://postgr.es/m/CAEudQAp5P8nr=ze2Gv=BMj=DJFZnrvendZCZcC-fos3QiDe2sg@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

Add test for CREATE INDEX CONCURRENTLY with not-so-immutable predicate

commit   : 09a69f6e23369847cf11cd03c999a0342d47bbcc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Jun 2021 11:17:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Jun 2021 11:17:05 +0900    

Click here for diff

83158f7 has improved index_set_state_flags() so as it is possible to use  
transactional updates when updating pg_index state flags, but there was  
not really a test case which stressed directly the possibility it fixed.  
This commit adds such a test, using a predicate that looks valid in  
appearance but calls a stable function.  
  
Author: Andrey Lepikhov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

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

Remove memory leaks in isolationtester.

commit   : 642c0697c96b9c6ba5d194653a329f7820565f01    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Jun 2021 12:45:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Jun 2021 12:45:04 -0400    

Click here for diff

specscanner.l leaked a kilobyte of memory per token of the spec file.  
Apparently somebody thought that the introductory code block would be  
executed once; but it's once per yylex() call.  
  
A couple of functions in isolationtester.c leaked small amounts of  
memory due to not bothering to free one-time allocations.  Might  
as well improve these so that valgrind gives this program a clean  
bill of health.  Also get rid of an ugly static variable.  
  
Coverity complained about one of the one-time leaks, which led me  
to try valgrind'ing isolationtester, which led to discovery of the  
larger leak.  

M src/test/isolation/isolationtester.c
M src/test/isolation/specscanner.l

Error message refactoring

commit   : c302a6139072fed9410204fa9e751d95930e05ff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 27 Jun 2021 09:41:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 27 Jun 2021 09:41:16 +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/logical.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/numeric.c

Doc: update v14 release notes for revert of commit c0cb87fbb.

commit   : dcffc9ba8a1e0ab1b0a57e9b9d38e3dc9960f83f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Jun 2021 15:45:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Jun 2021 15:45:16 -0400    

Click here for diff

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

Remove undesirable libpq dependency on stringinfo.c.

commit   : 8ec00dc5cd70e0e579e9fbf8661bc46f5ccd8078    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Jun 2021 14:20:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Jun 2021 14:20:17 -0400    

Click here for diff

Commit c0cb87fbb unwisely introduced a dependency on the StringInfo  
machinery in fe-connect.c.  We must not use that in libpq, because  
it will do a summary exit(1) if it hits OOM, and that is not  
appropriate behavior for a general-purpose library.  The goal of  
allowing arbitrary line lengths in service files doesn't seem like  
it's worth a lot of effort, so revert back to the previous method  
of using a stack-allocated buffer and failing on buffer overflow.  
  
This isn't an exact revert though.  I kept that patch's refactoring  
to have a single exit path, as that seems cleaner than having each  
error path know what to do to clean up.  Also, I made the fixed-size  
buffer 1024 bytes not 256, just to push off the need for an expandable  
buffer some more.  
  
There is more to do here; in particular the lack of any mechanical  
check for this type of mistake now seems pretty hazardous.  But this  
fix gets us back to the level of robustness we had in v13, anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove non-existing variable reference in MSVC's Solution.pm

commit   : d5a2c413fcdd187dc16c4fab16610af7d4849cc1    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 26 Jun 2021 13:52:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 26 Jun 2021 13:52:48 +0900    

Click here for diff

The version string is grabbed from PACKAGE_VERSION in pg_config.h in the  
MSVC build since 8f4fb4c6, but an error message referenced a variable  
that existed before that.  This had no consequences except if one messes  
up enough with the version number of the build.  
  
Author: Anton Voloshin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/tools/msvc/Solution.pm

Remove some useless logs from the TAP tests of pgbench

commit   : 704e1dbd9aa29a0b46c356f1803ad55cbdef2c20    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 26 Jun 2021 12:39:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 26 Jun 2021 12:39:54 +0900    

Click here for diff

002_pgbench_no_server was printing some array pointers instead of the  
actual contents of those arrays for the expected outputs of stdout and  
stderr for a tested command.  This does not add any new information that  
can help with debugging as the test names allow to track failure  
locations, if any.  
  
This commit simply removes those logs as the rest of the printed  
information is redundant with command_checks_all().  
  
Per discussion with Andrew Dunstan and Álvaro Herrera.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/bin/pgbench/t/002_pgbench_no_server.pl

Remove unnecessary failure cases in RemoveRoleFromObjectPolicy().

commit   : 5a0f1c8c0193f0dd7fba50c22d96781fa2414007    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Jun 2021 13:59:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Jun 2021 13:59:38 -0400    

Click here for diff

It's not really necessary for this function to open or lock the  
relation associated with the pg_policy entry it's modifying.  The  
error checks it's making on the rel are if anything counterproductive  
(e.g., if we don't want to allow installation of policies on system  
catalogs, here is not the place to prevent that).  In particular, it  
seems just wrong to insist on an ownership check.  That has the net  
effect of forcing people to use superuser for DROP OWNED BY, which  
surely is not an effect we want.  Also there is no point in rebuilding  
the dependencies of the policy expressions, which aren't being  
changed.  Lastly, locking the table also seems counterproductive; it's  
not helping to prevent race conditions, since we failed to re-read the  
pg_policy row after acquiring the lock.  That means that concurrent  
DDL would likely result in "tuple concurrently updated/deleted"  
errors; which is the same behavior this code will produce, with less  
overhead.  
  
Per discussion of bug #17062.  Back-patch to all supported versions,  
as the failure cases this eliminates seem just as undesirable in 9.6  
as in HEAD.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/policy.c

Doc: remove commit f560209c6 from v14 release notes.

commit   : 8a80562d732c0da1ddcc9fb88dfb976f4b846577    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Jun 2021 11:18:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Jun 2021 11:18:15 -0400    

Click here for diff

Now that this has been back-patched, it's no longer a new feature  
for v14.  

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

commit   : 38ff135d9466c35b506b1049fedef73047907be0    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 20:15:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 20:15:24 +0900    

Click here for diff

This fixes a couple of problems within the so-said code of this commit  
subject:  
- Replace the use of open() with slurp_file(), fixing an issue reported  
by buildfarm member fairywren whose perl installation keep around CRLF  
characters, causing the matching patterns for the logs to fail.  
- Remove the eval block, which is not really necessary.  
  
This set of issues has come into light after fixing a different issue  
with c13585fe, and this is wrong since this code has been introduced.  
  
Reported-by: Andrew Dunstan, and buildfarm member fairywren  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Put option listing back into alphabetical order

commit   : 3af10943ce21450e299b3915b9cad47cd90369e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jun 2021 11:40:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jun 2021 11:40:06 +0200    

Click here for diff

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

Fixes in ALTER SUBSCRIPTION DROP PUBLICATION code

commit   : e59d428f34297cd0eb67e3b4e4b8c8bc58504921    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jun 2021 09:51:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jun 2021 09:51:24 +0200    

Click here for diff

ALTER SUBSCRIPTION DROP PUBLICATION does not actually support  
copy_data option, so remove it from tab completion.  
  
Also, reword the error message that is thrown when all the  
publications from a subscription are specified to be dropped.  
  
Also, made few doc and cosmetic adjustments.  
  
Author: Vignesh C <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Japin Li <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CALDaNm21RwsDzs4xj14ApteAF7auyyomHNnp+NEL-sH8m-jMvQ@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/bin/psql/tab-complete.c
M src/test/regress/expected/subscription.out

doc: Change reloption data type spelling for consistency

commit   : 63e6d05bf34da58eef7cd1ed461b9c8315177a38    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jun 2021 08:11:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jun 2021 08:11:10 +0200    

Click here for diff

Use "floating point" rather than "float4", like everywhere else in  
this context.  
  
Author: [email protected]  
Discussion: https://www.postgresql.org/message-id/flat/TYAPR01MB28965989AF84B57FC351B97BC40F9@TYAPR01MB2896.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_table.sgml

Remove redundant variable pageSize in gistinitpage

commit   : a60c4c5c1a99746485123ae93fbd3e58c78e5d62    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jun 2021 07:55:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jun 2021 07:55:34 +0200    

Click here for diff

In gistinitpage, pageSize variable looks redundant, instead just  
pass BLCKSZ. This will be consistent with its peers BloomInitPage,  
brin_page_init and SpGistInitPage.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CALj2ACWj=V1k5591eeZK2sOg2FYuBUp6azFO8tMkBtGfXf8PMQ@mail.gmail.com  

M src/backend/access/gist/gistutil.c

Doc: Fix minor formatting issue in logicaldecoding.sgml.

commit   : 847c62ee76cbc237b3a204ca94b1b12811d698e3    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 25 Jun 2021 08:22:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 25 Jun 2021 08:22:44 +0530    

Click here for diff

Author: Guillaume Lelarge  
Discussion: https://www.postgresql.org/message-id/CAECtzeXf3_oZoU6mgFCOy5+pDZ5n4XtH0Da4a5n_KacraVWiHQ@mail.gmail.com  

M doc/src/sgml/logicaldecoding.sgml

doc: Add acronyms for MITM and SNI

commit   : 15ff5401d1719aaf6c9a47e5abea517cc2bcbaf1    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 11:29:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 11:29:03 +0900    

Click here for diff

This adds MITM and SNI as acronyms, as the documentation already had  
them marked up with <acronym>.  
  
While on it, make sure to spell man-in-the-middle with dashes  
consistently, and add acronyms for those new terms where appropriate.  
  
Author: Daniel Gustafsson  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml

Add more debugging information with log checks in TAP tests of pgbench

commit   : 87b2124dfa0782a697ea7b90aff15a6f6117a720    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 09:56:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 09:56:44 +0900    

Click here for diff

fairywren is not happy with the pattern checks introduced by c13585f.  
I am not sure if this outlines a bug in pgbench or if the regex patterns  
used in the tests are too restrictive for this buildfarm member's  
environment.  This adds more debugging information to show the log  
entries that do not match with the expected pattern, to help in finding  
out what's happening.  That seems like a good addition in the long-term  
anyway as that may not be the only issue in this area.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/001_pgbench_with_server.pl

doc: Move remove_temp_files_after_crash to section for developer options

commit   : 797b0fc0b078c7b4c46ef9f2d9e47aa2d98c6c63    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 08:40:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 08:40:16 +0900    

Click here for diff

The main goal of this option is to allow inspecting temporary files for  
debugging purposes, so moving the parameter there is natural.  
  
Oversight in cd91de0.  
  
Reported-by: Justin Pryzby  
Author: Euler Taveira  
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

Prepare for forthcoming LLVM 13 API change.

commit   : 9b4e4cfe66ff133717c1b8ba3c2725d525c3e67c    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 25 Jun 2021 09:55:26 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 25 Jun 2021 09:55:26 +1200    

Click here for diff

LLVM 13 (due out in September) has changed the semantics of  
LLVMOrcAbsoluteSymbols(), so we need to bump some reference counts to  
avoid a double-free that causes crashes and bad query results.  
  
A proactive change seems necessary to avoid having a window of time  
where our respective latest releases would interact badly.  It's  
possible that the situation could change before then, though.  
  
Thanks to Fabien Coelho for monitoring bleeding edge LLVM and Andres  
Freund for tracking down the change.  
  
Back-patch to 11, where the JIT code arrived.  
  
Discussion: https://postgr.es/m/CA%2BhUKGLEy8mgtN7BNp0ooFAjUedDTJj5dME7NxLU-m91b85siA%40mail.gmail.com  

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

Fix pattern matching logic for logs in TAP tests of pgbench

commit   : c13585fe9e55813cf9feac67fe7b65d3a78fff92    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 06:52:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Jun 2021 06:52:36 +0900    

Click here for diff

The logic checking for the format of per-thread logs used grep() with  
directly "$re", which would cause the test to consider all the logs as  
a match without caring about their format at all.  Using "/$re/" makes  
grep() perform a regex test, which is what we want here.  
  
While on it, improve some of the tests to be more picky with the  
patterns expected and add more comments to describe the tests.  
  
Issue discovered while digging into a separate patch.  
  
Author: Fabien Coelho, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Further stabilize postgres_fdw test.

commit   : 802177090992511c610804da54a4603d4f50c594    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Jun 2021 15:02:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Jun 2021 15:02:13 -0400    

Click here for diff

The queries involving ft1_nopw don't stably return the same row  
anymore.  I surmise that an autovacuum hitting "S 1"."T 1"  
right after the updates introduced by f61db909d/5843659d0 freed  
some space, changing where subsequent insertions get stored.  
It's only by good luck that these results were stable before,  
though, since a LIMIT without ORDER BY isn't well defined,  
and it's not like we've ever treated that table as append-only  
in this test script.  
  
Since we only really care whether these commands succeed or not,  
just replace "SELECT *" with "SELECT 1".  
  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2021-06-23%2019%3A52%3A08  

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

Another fix to relmapper race condition.

commit   : 9b8ed0f52bffceaccf6fa650ffe482e7da20fbf2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 24 Jun 2021 11:19:03 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 24 Jun 2021 11:19:03 +0300    

Click here for diff

In previous commit, I missed that relmap_redo() was also not acquiring the  
RelationMappingLock. Thanks to Thomas Munro for pointing that out.  
  
Backpatch-through: 9.6, like previous commit.  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGLev%3DPpOSaL3WRZgOvgk217et%2BbxeJcRr4eR-NttP1F6Q%40mail.gmail.com  

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

Prevent race condition while reading relmapper file.

commit   : b6d8d2073f228d9f7198f1f9826d8f6ab643c219    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 24 Jun 2021 10:45:23 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 24 Jun 2021 10:45:23 +0300    

Click here for diff

Contrary to the comment here, POSIX does not guarantee atomicity of a  
read(), if another process calls write() concurrently. Or at least Linux  
does not. Add locking to load_relmap_file() to avoid the race condition.  
  
Fixes bug #17064. Thanks to Alexander Lakhin for the report and test case.  
  
Backpatch-through: 9.6, all supported versions.  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Doc: Update logical replication message formats.

commit   : f08722cf83ab1fabee948a4e5754bf6236ad700b    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 24 Jun 2021 11:51:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 24 Jun 2021 11:51:58 +0530    

Click here for diff

Commits 9de77b5453 and ac4645c015 missed to update the logical replication  
message formats section in the docs.  
  
Author: Brar Piening  
Reviewed-by: Amit Kapila  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/protocol.sgml

Doc: Update caveats in synchronous logical replication.

commit   : c66fb78ebb4f473bb4fd8773de3cda9339e14f81    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 24 Jun 2021 09:13:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 24 Jun 2021 09:13:46 +0530    

Click here for diff

Reported-by: Simon Riggs  
Author: Takamichi Osumi  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.6  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/logicaldecoding.sgml

Allow non-quoted identifiers as isolation test session/step names.

commit   : a443c1b2d6a646cf90a8afc193c07ed12a2bf045    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Jun 2021 18:41:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Jun 2021 18:41:39 -0400    

Click here for diff

For no obvious reason, isolationtester has always insisted that  
session and step names be written with double quotes.  This is  
fairly tedious and does little for test readability, especially  
since the names that people actually choose almost always look  
like normal identifiers.  Hence, let's tweak the lexer to allow  
SQL-like identifiers not only double-quoted strings.  
  
(They're SQL-like, not exactly SQL, because I didn't add any  
case-folding logic.  Also there's no provision for U&"..." names,  
not that anyone's likely to care.)  
  
There is one incompatibility introduced by this change: if you write  
"foo""bar" with no space, that used to be taken as two identifiers,  
but now it's just one identifier with an embedded quote mark.  
  
I converted all the src/test/isolation/ specfiles to remove  
unnecessary double quotes, but stopped there because my  
eyes were glazing over already.  
  
Like 741d7f104, back-patch to all supported branches, so that this  
isn't a stumbling block for back-patching isolation test changes.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/specs/oldest_xmin.spec
M src/test/isolation/README
M src/test/isolation/specparse.y
M src/test/isolation/specs/aborted-keyrevoke.spec
M src/test/isolation/specs/alter-table-1.spec
M src/test/isolation/specs/alter-table-2.spec
M src/test/isolation/specs/alter-table-3.spec
M src/test/isolation/specs/alter-table-4.spec
M src/test/isolation/specs/async-notify.spec
M src/test/isolation/specs/classroom-scheduling.spec
M src/test/isolation/specs/create-trigger.spec
M src/test/isolation/specs/deadlock-hard.spec
M src/test/isolation/specs/deadlock-parallel.spec
M src/test/isolation/specs/deadlock-simple.spec
M src/test/isolation/specs/deadlock-soft-2.spec
M src/test/isolation/specs/deadlock-soft.spec
M src/test/isolation/specs/delete-abort-savept-2.spec
M src/test/isolation/specs/delete-abort-savept.spec
M src/test/isolation/specs/detach-partition-concurrently-1.spec
M src/test/isolation/specs/detach-partition-concurrently-2.spec
M src/test/isolation/specs/detach-partition-concurrently-3.spec
M src/test/isolation/specs/detach-partition-concurrently-4.spec
M src/test/isolation/specs/drop-index-concurrently-1.spec
M src/test/isolation/specs/eval-plan-qual-trigger.spec
M src/test/isolation/specs/eval-plan-qual.spec
M src/test/isolation/specs/fk-contention.spec
M src/test/isolation/specs/fk-deadlock.spec
M src/test/isolation/specs/fk-deadlock2.spec
M src/test/isolation/specs/fk-partitioned-1.spec
M src/test/isolation/specs/fk-partitioned-2.spec
M src/test/isolation/specs/freeze-the-dead.spec
M src/test/isolation/specs/horizons.spec
M src/test/isolation/specs/index-only-scan.spec
M src/test/isolation/specs/inherit-temp.spec
M src/test/isolation/specs/insert-conflict-do-nothing-2.spec
M src/test/isolation/specs/insert-conflict-do-nothing.spec
M src/test/isolation/specs/insert-conflict-do-update-2.spec
M src/test/isolation/specs/insert-conflict-do-update-3.spec
M src/test/isolation/specs/insert-conflict-do-update.spec
M src/test/isolation/specs/insert-conflict-specconflict.spec
M src/test/isolation/specs/lock-committed-keyupdate.spec
M src/test/isolation/specs/lock-committed-update.spec
M src/test/isolation/specs/lock-update-delete.spec
M src/test/isolation/specs/lock-update-traversal.spec
M src/test/isolation/specs/multiple-cic.spec
M src/test/isolation/specs/multiple-row-versions.spec
M src/test/isolation/specs/multixact-no-deadlock.spec
M src/test/isolation/specs/multixact-no-forget.spec
M src/test/isolation/specs/nowait-2.spec
M src/test/isolation/specs/nowait-3.spec
M src/test/isolation/specs/nowait-4.spec
M src/test/isolation/specs/nowait-5.spec
M src/test/isolation/specs/nowait.spec
M src/test/isolation/specs/partial-index.spec
M src/test/isolation/specs/partition-concurrent-attach.spec
M src/test/isolation/specs/partition-key-update-1.spec
M src/test/isolation/specs/partition-key-update-2.spec
M src/test/isolation/specs/partition-key-update-3.spec
M src/test/isolation/specs/partition-key-update-4.spec
M src/test/isolation/specs/plpgsql-toast.spec
M src/test/isolation/specs/predicate-gin.spec
M src/test/isolation/specs/predicate-gist.spec
M src/test/isolation/specs/predicate-hash.spec
M src/test/isolation/specs/predicate-lock-hot-tuple.spec
M src/test/isolation/specs/prepared-transactions-cic.spec
M src/test/isolation/specs/prepared-transactions.spec
M src/test/isolation/specs/project-manager.spec
M src/test/isolation/specs/propagate-lock-delete.spec
M src/test/isolation/specs/read-only-anomaly-2.spec
M src/test/isolation/specs/read-only-anomaly-3.spec
M src/test/isolation/specs/read-only-anomaly.spec
M src/test/isolation/specs/read-write-unique-2.spec
M src/test/isolation/specs/read-write-unique-3.spec
M src/test/isolation/specs/read-write-unique-4.spec
M src/test/isolation/specs/read-write-unique.spec
M src/test/isolation/specs/receipt-report.spec
M src/test/isolation/specs/referential-integrity.spec
M src/test/isolation/specs/reindex-concurrently.spec
M src/test/isolation/specs/reindex-schema.spec
M src/test/isolation/specs/ri-trigger.spec
M src/test/isolation/specs/sequence-ddl.spec
M src/test/isolation/specs/serializable-parallel-2.spec
M src/test/isolation/specs/serializable-parallel.spec
M src/test/isolation/specs/simple-write-skew.spec
M src/test/isolation/specs/skip-locked-2.spec
M src/test/isolation/specs/skip-locked-3.spec
M src/test/isolation/specs/skip-locked-4.spec
M src/test/isolation/specs/skip-locked.spec
M src/test/isolation/specs/temporal-range-integrity.spec
M src/test/isolation/specs/timeouts.spec
M src/test/isolation/specs/total-cash.spec
M src/test/isolation/specs/truncate-conflict.spec
M src/test/isolation/specs/tuplelock-conflict.spec
M src/test/isolation/specs/tuplelock-partition.spec
M src/test/isolation/specs/tuplelock-update.spec
M src/test/isolation/specs/tuplelock-upgrade-no-deadlock.spec
M src/test/isolation/specs/two-ids.spec
M src/test/isolation/specs/update-conflict-out.spec
M src/test/isolation/specs/update-locked-tuple.spec
M src/test/isolation/specs/vacuum-concurrent-drop.spec
M src/test/isolation/specs/vacuum-conflict.spec
M src/test/isolation/specs/vacuum-reltuples.spec
M src/test/isolation/specs/vacuum-skip-locked.spec
M src/test/isolation/specscanner.l

Doc: fix confusion about LEAKPROOF in syntax summaries.

commit   : 2031e1668e5577e64cfed29da69a34903d5a5227    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Jun 2021 14:27:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Jun 2021 14:27:13 -0400    

Click here for diff

The syntax summaries for CREATE FUNCTION and allied commands  
made it look like LEAKPROOF is an alternative to  
IMMUTABLE/STABLE/VOLATILE, when of course it is an orthogonal  
option.  Improve that.  
  
Per gripe from aazamrafeeque0.  Thanks to David Johnston for  
suggestions.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_routine.sgml
M doc/src/sgml/ref/create_function.sgml

Don't assume GSSAPI result strings are null-terminated.

commit   : 126cdaf47af275f76b2f2ddb023bfdc6f018ae30    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Jun 2021 14:01:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Jun 2021 14:01:32 -0400    

Click here for diff

Our uses of gss_display_status() and gss_display_name() assumed  
that the gss_buffer_desc strings returned by those functions are  
null-terminated.  It appears that they generally are, given the  
lack of field complaints up to now.  However, the available  
documentation does not promise this, and some man pages  
for gss_display_status() show examples that rely on the  
gss_buffer_desc.length field instead of expecting null  
termination.  Also, we now have a report that on some  
implementations, clang's address sanitizer is of the opinion  
that the byte after the specified length is undefined.  
  
Hence, change the code to rely on the length field instead.  
  
This might well be cosmetic rather than fixing any real bug, but  
it's hard to be sure, so back-patch to all supported branches.  
While here, also back-patch the v12 changes that made pg_GSS_error  
deal honestly with multiple messages available from  
gss_display_status.  
  
Per report from Sudheer H R.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.c

Improve display of query results in isolation tests.

commit   : 4a054069a36032a59afceb07f3b837f09ab1a2e9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Jun 2021 11:12:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Jun 2021 11:12:31 -0400    

Click here for diff

Previously, isolationtester displayed SQL query results using some  
ad-hoc code that clearly hadn't had much effort expended on it.  
Field values longer than 14 characters weren't separated from  
the next field, and usually caused misalignment of the columns  
too.  Also there was no visual separation of a query's result  
from subsequent isolationtester output.  This made test result  
files confusing and hard to read.  
  
To improve matters, let's use libpq's PQprint() function.  Although  
that's long since unused by psql, it's still plenty good enough  
for the purpose here.  
  
Like 741d7f104, back-patch to all supported branches, so that this  
isn't a stumbling block for back-patching isolation test changes.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/concurrent_ddl_dml.out
M contrib/test_decoding/expected/concurrent_stream.out
M contrib/test_decoding/expected/delayed_startup.out
M contrib/test_decoding/expected/mxact.out
M contrib/test_decoding/expected/oldest_xmin.out
M contrib/test_decoding/expected/ondisk_startup.out
M contrib/test_decoding/expected/snapshot_transfer.out
M contrib/test_decoding/expected/subxact_without_top.out
M contrib/test_decoding/expected/twophase_snapshot.out
M src/test/isolation/expected/aborted-keyrevoke.out
M src/test/isolation/expected/alter-table-1.out
M src/test/isolation/expected/alter-table-2.out
M src/test/isolation/expected/alter-table-3.out
M src/test/isolation/expected/alter-table-4.out
M src/test/isolation/expected/async-notify.out
M src/test/isolation/expected/classroom-scheduling.out
M src/test/isolation/expected/create-trigger.out
M src/test/isolation/expected/deadlock-parallel.out
M src/test/isolation/expected/delete-abort-savept-2.out
M src/test/isolation/expected/delete-abort-savept.out
M src/test/isolation/expected/detach-partition-concurrently-1.out
M src/test/isolation/expected/detach-partition-concurrently-2.out
M src/test/isolation/expected/detach-partition-concurrently-3.out
M src/test/isolation/expected/detach-partition-concurrently-4.out
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/expected/eval-plan-qual-trigger.out
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/expected/fk-partitioned-2.out
M src/test/isolation/expected/freeze-the-dead.out
M src/test/isolation/expected/horizons.out
M src/test/isolation/expected/inherit-temp.out
M src/test/isolation/expected/insert-conflict-do-nothing-2.out
M src/test/isolation/expected/insert-conflict-do-nothing.out
M src/test/isolation/expected/insert-conflict-do-update-2.out
M src/test/isolation/expected/insert-conflict-do-update-3.out
M src/test/isolation/expected/insert-conflict-do-update.out
M src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/expected/lock-committed-keyupdate.out
M src/test/isolation/expected/lock-committed-update.out
M src/test/isolation/expected/lock-update-delete.out
M src/test/isolation/expected/lock-update-delete_1.out
M src/test/isolation/expected/lock-update-traversal.out
M src/test/isolation/expected/multiple-cic.out
M src/test/isolation/expected/multiple-row-versions.out
M src/test/isolation/expected/multixact-no-deadlock.out
M src/test/isolation/expected/multixact-no-forget.out
M src/test/isolation/expected/multixact-no-forget_1.out
M src/test/isolation/expected/nowait-2.out
M src/test/isolation/expected/nowait-3.out
M src/test/isolation/expected/nowait-4.out
M src/test/isolation/expected/nowait-4_1.out
M src/test/isolation/expected/nowait-5.out
M src/test/isolation/expected/nowait.out
M src/test/isolation/expected/partial-index.out
M src/test/isolation/expected/partition-concurrent-attach.out
M src/test/isolation/expected/partition-key-update-2.out
M src/test/isolation/expected/partition-key-update-3.out
M src/test/isolation/expected/partition-key-update-4.out
M src/test/isolation/expected/plpgsql-toast.out
M src/test/isolation/expected/predicate-gin.out
M src/test/isolation/expected/predicate-gist.out
M src/test/isolation/expected/predicate-hash.out
M src/test/isolation/expected/predicate-lock-hot-tuple.out
M src/test/isolation/expected/prepared-transactions-cic.out
M src/test/isolation/expected/prepared-transactions.out
M src/test/isolation/expected/project-manager.out
M src/test/isolation/expected/read-only-anomaly-2.out
M src/test/isolation/expected/read-only-anomaly-3.out
M src/test/isolation/expected/read-only-anomaly.out
M src/test/isolation/expected/read-write-unique-2.out
M src/test/isolation/expected/read-write-unique-3.out
M src/test/isolation/expected/read-write-unique-4.out
M src/test/isolation/expected/read-write-unique.out
M src/test/isolation/expected/receipt-report.out
M src/test/isolation/expected/referential-integrity.out
M src/test/isolation/expected/reindex-concurrently.out
M src/test/isolation/expected/ri-trigger.out
M src/test/isolation/expected/sequence-ddl.out
M src/test/isolation/expected/serializable-parallel-2.out
M src/test/isolation/expected/serializable-parallel.out
M src/test/isolation/expected/skip-locked-2.out
M src/test/isolation/expected/skip-locked-3.out
M src/test/isolation/expected/skip-locked-4.out
M src/test/isolation/expected/skip-locked-4_1.out
M src/test/isolation/expected/skip-locked.out
M src/test/isolation/expected/temporal-range-integrity.out
M src/test/isolation/expected/timeouts.out
M src/test/isolation/expected/total-cash.out
M src/test/isolation/expected/truncate-conflict.out
M src/test/isolation/expected/tuplelock-conflict.out
M src/test/isolation/expected/tuplelock-partition.out
M src/test/isolation/expected/tuplelock-update.out
M src/test/isolation/expected/tuplelock-upgrade-no-deadlock.out
M src/test/isolation/expected/two-ids.out
M src/test/isolation/expected/update-conflict-out.out
M src/test/isolation/expected/vacuum-reltuples.out
M src/test/isolation/isolationtester.c
M src/test/modules/brin/expected/summarization-and-inprogress-insertion.out
M src/test/modules/delay_execution/expected/partition-addition.out
M src/test/modules/delay_execution/expected/partition-removal-1.out
M src/test/modules/snapshot_too_old/expected/sto_using_cursor.out
M src/test/modules/snapshot_too_old/expected/sto_using_hash_index.out
M src/test/modules/snapshot_too_old/expected/sto_using_select.out

Add test case for obsoleting slot with active walsender, take 2

commit   : 24043c27b46f873211177e3460ab09dc011802a5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 23 Jun 2021 09:53:18 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 23 Jun 2021 09:53:18 -0400    

Click here for diff

The code to signal a running walsender when its reserved WAL size grows  
too large is completely uncovered before this commit; this adds coverage  
for that case.  
  
This test involves sending SIGSTOP to walsender and walreceiver, then  
advancing enough WAL for a checkpoint to trigger, then sending SIGCONT.  
  
There's no precedent for STOP signalling in Perl tests, and my reading  
of relevant manpages says it's likely to fail on Windows.  Because of  
this, this test is always skipped on that platform.  
  
This version fixes a couple of rarely hit race conditions in the  
previous attempt 09126984a263; most notably, both LOG string searches  
are loops, not just the second one; we acquire the start-of-log position  
before STOP-signalling; and reference the correct process name in the  
test description.  All per Tom Lane.  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/019_replslot_limit.pl

Use annotations to reduce instability of isolation-test results.

commit   : 741d7f1047fe52da7ced6fa9cea661ce9320c8d4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Jun 2021 21:43:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Jun 2021 21:43:12 -0400    

Click here for diff

We've long contended with isolation test results that aren't entirely  
stable.  Some test scripts insert long delays to try to force stable  
results, which is not terribly desirable; but other erratic failure  
modes remain, causing unrepeatable buildfarm failures.  I've spent a  
fair amount of time trying to solve this by improving the server-side  
support code, without much success: that way is fundamentally unable  
to cope with diffs that stem from chance ordering of arrival of  
messages from different server processes.  
  
We can improve matters on the client side, however, by annotating  
the test scripts themselves to show the desired reporting order  
of events that might occur in different orders.  This patch adds  
three types of annotations to deal with (a) test steps that might or  
might not complete their waits before the isolationtester can see them  
waiting; (b) test steps in different sessions that can legitimately  
complete in either order; and (c) NOTIFY messages that might arrive  
before or after the completion of a step in another session.  We might  
need more annotation types later, but this seems to be enough to deal  
with the instabilities we've seen in the buildfarm.  It also lets us  
get rid of all the long delays that were previously used, cutting more  
than a minute off the runtime of the isolation tests.  
  
Back-patch to all supported branches, because the buildfarm  
instabilities affect all the branches, and because it seems desirable  
to keep isolationtester's capabilities the same across all branches  
to simplify possible future back-patching of tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/concurrent_ddl_dml.out
M src/test/isolation/README
M src/test/isolation/expected/alter-table-3.out
M src/test/isolation/expected/alter-table-4.out
M src/test/isolation/expected/deadlock-hard.out
M src/test/isolation/expected/deadlock-simple.out
M src/test/isolation/expected/detach-partition-concurrently-3.out
M src/test/isolation/expected/detach-partition-concurrently-4.out
M src/test/isolation/expected/eval-plan-qual-trigger.out
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/expected/fk-deadlock2_1.out
M src/test/isolation/expected/fk-deadlock2_2.out
M src/test/isolation/expected/fk-deadlock_1.out
M src/test/isolation/expected/fk-partitioned-1.out
M src/test/isolation/expected/fk-partitioned-2.out
M src/test/isolation/expected/insert-conflict-do-nothing-2.out
M src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/expected/lock-committed-keyupdate.out
M src/test/isolation/expected/lock-update-delete_1.out
M src/test/isolation/expected/multiple-cic.out
D src/test/isolation/expected/multiple-cic_1.out
M src/test/isolation/expected/multixact-no-forget_1.out
M src/test/isolation/expected/nowait-4.out
M src/test/isolation/expected/nowait-4_1.out
M src/test/isolation/expected/nowait-5.out
M src/test/isolation/expected/partition-concurrent-attach.out
M src/test/isolation/expected/partition-key-update-1.out
M src/test/isolation/expected/partition-key-update-3.out
M src/test/isolation/expected/propagate-lock-delete.out
M src/test/isolation/expected/read-write-unique-2.out
M src/test/isolation/expected/read-write-unique-3.out
M src/test/isolation/expected/read-write-unique-4.out
M src/test/isolation/expected/read-write-unique.out
M src/test/isolation/expected/sequence-ddl.out
M src/test/isolation/expected/skip-locked-4_1.out
M src/test/isolation/expected/timeouts.out
M src/test/isolation/expected/tuplelock-update.out
M src/test/isolation/isolationtester.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specs/deadlock-hard.spec
M src/test/isolation/specs/deadlock-soft-2.spec
M src/test/isolation/specs/detach-partition-concurrently-3.spec
M src/test/isolation/specs/detach-partition-concurrently-4.spec
M src/test/isolation/specs/insert-conflict-specconflict.spec
M src/test/isolation/specs/multiple-cic.spec
M src/test/isolation/specs/timeouts.spec
M src/test/isolation/specs/tuplelock-update.spec
M src/test/isolation/specscanner.l

Restore the portal-level snapshot for simple expressions, too.

commit   : d102aafb6259a6a412803d4b1d8c4f00aa17f67e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Jun 2021 17:48:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Jun 2021 17:48:39 -0400    

Click here for diff

Commits 84f5c2908 et al missed the need to cover plpgsql's "simple  
expression" code path.  If the first thing we execute after a  
COMMIT/ROLLBACK is one of those, rather than a full-fledged SPI command,  
we must explicitly do EnsurePortalSnapshotExists() to make sure we have  
an outer snapshot.  Note that it wouldn't be good enough to just push a  
snapshot for the duration of the expression execution: what comes back  
might be toasted, so we'd better have a snapshot protecting it.  
  
The test case demonstrating this fact cheats a bit by marking a SQL  
function immutable even though it fetches from a table.  That's  
nothing that users haven't been seen to do, though.  
  
Per report from Jim Nasby.  Back-patch to v11, like the previous fix.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Add list of ignorable pgindent commits for git-blame.

commit   : 8e638845ff6bb255ad1dea15831089a234535391    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 22 Jun 2021 09:06:32 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 22 Jun 2021 09:06:32 -0700    

Click here for diff

Add a .git-blame-ignore-revs file with a list of pgindent, pgperlyidy,  
and reformat-dat-files commit hashes.  Postgres hackers that configure  
git to use the ignore file will get git-blame output that avoids  
attributing line changes to the ignored indent commits.  This makes  
git-blame output much easier to work with in practice.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=cVh3GHTP6SdLU-Gnmt2zRdF8vZkcrFdSzXQ=WhbWm9Q@mail.gmail.com  

A .git-blame-ignore-revs
M src/tools/RELEASE_CHANGES
M src/tools/pgindent/README

Stamp 14beta2.

commit   : bafad2c5b261a1449bed60ebac9e7918ebcc42b4    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 21 Jun 2021 17:07:55 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 21 Jun 2021 17:07:55 -0400    

Click here for diff

M configure
M configure.ac

Use correct horizon when vacuuming catalog relations.

commit   : 5a1e1d83022b976ebdec5cfa8f255c4278b75b8e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jun 2021 05:13:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jun 2021 05:13:46 -0700    

Click here for diff

In dc7420c2c92 I (Andres) accidentally used  
RelationIsAccessibleInLogicalDecoding() as the sole condition to use the  
non-shared catalog horizon in GetOldestNonRemovableTransactionId(). That is  
incorrect, as RelationIsAccessibleInLogicalDecoding() checks whether wal_level  
is logical.  
  
The correct check, as done e.g. in GlobalVisTestFor(), is to check  
IsCatalogRelation() and RelationIsAccessibleInLogicalDecoding().  
  
The observed misbehavior of this bug was that there could be an endless loop  
in lazy_scan_prune(), because the horizons used in heap_page_prune() and the  
individual tuple liveliness checks did not match. Likely there are other  
potential consequences as well.  
  
A later commit will unify the determination which horizon has to be used, and  
add additional assertions to make it easier to catch a bug like this.  
  
Reported-By: Justin Pryzby <[email protected]>  
Diagnosed-By: Matthias van de Meent <[email protected]>  
Author: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/CAEze2Wg32Y9+WJfw=aofkRx1ZRFt_Ev6bNPc4PSaz7PjSFtZgQ@mail.gmail.com  

M src/backend/storage/ipc/procarray.c

Fix assert failure in expand_grouping_sets

commit   : 8d29d45d9b3cab95a866efbcdd9138b3d76741b3    
  
author   : David Rowley <[email protected]>    
date     : Mon, 21 Jun 2021 23:11:23 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 21 Jun 2021 23:11:23 +1200    

Click here for diff

linitial_node() fails in assert enabled builds if the given pointer is  
not of the specified type.  Here the type is IntList.  The code thought  
it should be expecting List, but it was wrong.  
  
In the existing tests which run this code the initial list element is  
always NIL.  Since linitial_node() allows NULL, we didn't trigger any  
assert failures in the existing regression tests.  
  
There is still some discussion as to whether we need a few more tests in  
this area, but for now, since beta2 is looming, fix the bug first.  
  
Bug: #17067  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Yaoguang Chen  

M src/backend/parser/parse_agg.c

Translation updates

commit   : a7bb0ce58f56ee8907c3f49c52d99f502536c796    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jun 2021 12:32:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jun 2021 12:32:14 +0200    

Click here for diff

Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 70796ae860c444c764bb591c885f22cac1c168ec  

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
M src/bin/initdb/po/el.po
M src/bin/initdb/po/es.po
M src/bin/pg_amcheck/nls.mk
A src/bin/pg_amcheck/po/el.po
A src/bin/pg_amcheck/po/es.po
M src/bin/pg_amcheck/po/fr.po
A src/bin/pg_amcheck/po/zh_CN.po
M src/bin/pg_archivecleanup/po/el.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_checksums/po/el.po
M src/bin/pg_checksums/po/es.po
M src/bin/pg_config/po/el.po
M src/bin/pg_config/po/es.po
M src/bin/pg_controldata/nls.mk
A src/bin/pg_controldata/po/el.po
M src/bin/pg_ctl/po/el.po
M src/bin/pg_ctl/po/es.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_rewind/po/es.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_rewind/po/zh_CN.po
M src/bin/pg_test_fsync/po/el.po
M src/bin/pg_test_fsync/po/es.po
M src/bin/pg_test_timing/po/el.po
M src/bin/pg_test_timing/po/es.po
M src/bin/pg_test_timing/po/zh_CN.po
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_verifybackup/nls.mk
A src/bin/pg_verifybackup/po/el.po
M src/bin/pg_verifybackup/po/es.po
M src/bin/pg_waldump/nls.mk
A src/bin/pg_waldump/po/el.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/scripts/po/es.po
M src/bin/scripts/po/fr.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/libpq/po/el.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/fr.po
M src/pl/plperl/nls.mk
A src/pl/plperl/po/el.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpython/nls.mk
A src/pl/plpython/po/el.po
M src/pl/tcl/po/el.po

Finish rename of PQtraceSetFlags() to PQsetTraceFlags().

commit   : 047a259e35b9dde2dad5fd0e5d5d784bb327b848    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 21 Jun 2021 02:48:11 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 21 Jun 2021 02:48:11 -0700    

Click here for diff

Jie Zhang  
  
Discussion: https://postgr.es/m/TYWPR01MB767844835390EDD8DB276D75F90A9@TYWPR01MB7678.jpnprd01.prod.outlook.com  

M doc/src/sgml/libpq.sgml

amcheck: Fix code comments

commit   : 97b7134186490b36e01efc9d2feaf7038c666457    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jun 2021 11:17:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Jun 2021 11:17:49 +0200    

Click here for diff

Code comments were claiming that verify_heapam() was checking  
privileges on the relation it was operating on, but it didn't actually  
do that.  Perhaps earlier versions of the patch did that, but now the  
access is regulated by privileges on the function.  Remove the wrong  
comments.  

M contrib/amcheck/verify_heapam.c

doc: adjust PG 14 relnotes to be current

commit   : 69a58bfe4ab05567a8fab8bdce7f3095ed06b99c    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 21 Jun 2021 01:09:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 21 Jun 2021 01:09:32 -0400    

Click here for diff

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

doc: add mention of +4GB windows file handling in PG14 relnotes

commit   : 90855908b751d40f67352fa0252e0fcdaa7e317b    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 20 Jun 2021 23:53:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 20 Jun 2021 23:53:00 -0400    

Click here for diff

Reported-by: Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoCTHyouoGv-xt1qNjjvPbGMErLi0AJncByTvr66Nq7j8g@mail.gmail.com  

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

Remove overzealous VACUUM failsafe assertions.

commit   : e8f201ab82be234b2f103234cf9f262f9afeaeba    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 20 Jun 2021 18:14:00 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 20 Jun 2021 18:14:00 -0700    

Click here for diff

The failsafe can trigger when index processing is already disabled.  
This can happen when VACUUM's INDEX_CLEANUP parameter is "off" and the  
failsafe happens to trigger.  Remove assertions that assume that index  
processing is directly tied to the failsafe.  
  
Oversight in commit c242baa4, which made it possible for the failsafe to  
trigger in a two-pass strategy VACUUM that has yet to make its first  
call to lazy_vacuum_all_indexes().  

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

Revert "Add test case for obsoleting slot with active walsender"

commit   : 96795176810b979a2bf1f4563bdcb161679d5b95    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 20 Jun 2021 12:28:08 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 20 Jun 2021 12:28:08 -0400    

Click here for diff

This reverts commit 09126984a263; the test case added there failed once  
in circumstances that remain mysterious.  It seems better to remove the  
test for now so that 14beta2 doesn't have random failures built in.  

M src/test/recovery/t/019_replslot_limit.pl

Stabilize test case added by commit f61db909d.

commit   : 5843659d091bfb6f2c60e010ea1fd00e55ee6ada    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Jun 2021 11:48:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Jun 2021 11:48:44 -0400    

Click here for diff

Buildfarm members ayu and tern have sometimes shown a different  
plan than expected for this query.  I'd been unable to reproduce  
that before today, but I finally realized what is happening.  
If there is a concurrent open transaction (probably an autovacuum  
run in the buildfarm, but this can also be arranged manually),  
then the index entries for the rows removed by the DELETE a few  
lines up are not killed promptly, causing a change in the planner's  
estimate of the extremal value of ft2.c1, which moves the rowcount  
estimate for "c1 > 1100" by enough to change the join plan from  
nestloop to hash.  
  
To fix, change the query condition to "c1 > 1000", causing the  
hash plan to be preferred whether or not a concurrent open  
transaction exists.  Since this UPDATE is tailored to be a no-op,  
nothing else changes.  
  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=ayu&dt=2021-06-09%2022%3A45%3A48  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=ayu&dt=2021-06-13%2022%3A38%3A18  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=tern&dt=2021-06-20%2004%3A55%3A36  

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

Provide feature-test macros for libpq features added in v14.

commit   : 6991e774e0304f5ef488cf1ae4fa79578b6ae3d5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 19 Jun 2021 11:44:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 19 Jun 2021 11:44:39 -0400    

Click here for diff

We had a request to provide a way to test at compile time for the  
availability of the new pipeline features.  More generally, it  
seems like a good idea to provide a way to test via #ifdef for  
all new libpq API features.  People have been using the version  
from pg_config.h for that; but that's more likely to represent the  
server version than the libpq version, in the increasingly-common  
scenario where they're different.  It's safer if libpq-fe.h itself  
is the source of truth about what features it offers.  
  
Hence, establish a policy that starting in v14 we'll add a suitable  
feature-is-present macro to libpq-fe.h when we add new API there.  
(There doesn't seem to be much point in applying this policy  
retroactively, but it's not too late for v14.)  
  
Tom Lane and Alvaro Herrera, per suggestion from Boris Kolpackov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/libpq-fe.h

Handle no replica identity index case in RelationGetIdentityKeyBitmap.

commit   : 2731ce1bd550d08f3fdd7bcb1497af4b95170976    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 19 Jun 2021 11:30:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 19 Jun 2021 11:30:33 +0530    

Click here for diff

Commit e7eea52b2d has introduced a new function  
RelationGetIdentityKeyBitmap which omits to handle the case where there is  
no replica identity index on a relation.  
  
Author: Mark Dilger  
Reviewed-by: Takamichi Osumi, Amit Kapila  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/utils/cache/relcache.c
M src/test/subscription/t/001_rep_changes.pl

Support disabling index bypassing by VACUUM.

commit   : 3499df0dee8c4ea51d264a674df5b5e31991319a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 18 Jun 2021 20:04:07 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 18 Jun 2021 20:04:07 -0700    

Click here for diff

Generalize the INDEX_CLEANUP VACUUM parameter (and the corresponding  
reloption): make it into a ternary style boolean parameter.  It now  
exposes a third option, "auto".  The "auto" option (which is now the  
default) enables the "bypass index vacuuming" optimization added by  
commit 1e55e7d1.  
  
"VACUUM (INDEX_CLEANUP TRUE)" is redefined to once again make VACUUM  
simply do any required index vacuuming, regardless of how few dead  
tuples are encountered during the first scan of the target heap relation  
(unless there are exactly zero).  This gives users a way of opting out  
of the "bypass index vacuuming" optimization, if for whatever reason  
that proves necessary.  It is also expected to be used by PostgreSQL  
developers as a testing option from time to time.  
  
"VACUUM (INDEX_CLEANUP FALSE)" does the same thing as it always has: it  
forcibly disables both index vacuuming and index cleanup.  It's not  
expected to be used much in PostgreSQL 14.  The failsafe mechanism added  
by commit 1e55e7d1 addresses the same problem in a simpler way.  
INDEX_CLEANUP can now be thought of as a testing and compatibility  
option.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Masahiko Sawada <[email protected]>  
Reviewed-By: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznrBoCST4_Gxh_G9hA8NzGUbeBGnOUC8FcXcrhqsv6OHQ@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/vacuumdb.c
M src/include/commands/vacuum.h
M src/include/utils/rel.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Add test case for obsoleting slot with active walsender

commit   : 09126984a2631db8dd6299f23954e0dede69735f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 18 Jun 2021 18:42:00 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 18 Jun 2021 18:42:00 -0400    

Click here for diff

The code to signal a running walsender when its reserved WAL size grows  
too large is completely uncovered before this commit; this adds coverage  
for that case.  
  
This test involves sending SIGSTOP to walsender and walreceiver and  
running a checkpoint while advancing WAL, then sending SIGCONT.  There's  
no precedent for this coding in Perl tests, and my reading of relevant  
manpages says it's likely to fail on Windows.  Because of this, this  
test is always skipped on that platform.  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/019_replslot_limit.pl

Fix misbehavior of DROP OWNED BY with duplicate polroles entries.

commit   : d21fca084356946664bfce19d66d2df2bb873cbd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Jun 2021 18:00:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Jun 2021 18:00:09 -0400    

Click here for diff

Ordinarily, a pg_policy.polroles array wouldn't list the same role  
more than once; but CREATE POLICY does not prevent that.  If we  
perform DROP OWNED BY on a role that is listed more than once,  
RemoveRoleFromObjectPolicy either suffered an assertion failure  
or encountered a tuple-updated-by-self error.  Rewrite it to cope  
correctly with duplicate entries, and add a CommandCounterIncrement  
call to prevent the other problem.  
  
Per discussion, there's other cleanup that ought to happen here,  
but this seems like the minimum essential fix.  
  
Per bug #17062 from Alexander Lakhin.  It's been broken all along,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/policy.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Improve version reporting in pgbench.

commit   : 84bee9610965331d5110971d8de390a5bbe2effc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Jun 2021 17:05:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Jun 2021 17:05:23 -0400    

Click here for diff

Commit 547f04e73 caused pgbench to start printing its version number,  
which seems like a fine idea, but it needs a bit more work:  
* Print the server version number too, when different.  
* Print the PG_VERSION string, not some reconstructed approximation.  
  
This patch copies psql's well-tested code for the same purpose.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Centralize the logic for protective copying of utility statements.

commit   : 7c337b6b527b7052e6a751f966d5734c56f668b5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Jun 2021 11:22:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Jun 2021 11:22:58 -0400    

Click here for diff

In the "simple Query" code path, it's fine for parse analysis or  
execution of a utility statement to scribble on the statement's node  
tree, since that'll just be thrown away afterwards.  However it's  
not fine if the node tree is in the plan cache, as then it'd be  
corrupted for subsequent executions.  Up to now we've dealt with  
that by having individual utility-statement functions apply  
copyObject() if they were going to modify the tree.  But that's  
prone to errors of omission.  Bug #17053 from Charles Samborski  
shows that CREATE/ALTER DOMAIN didn't get this memo, and can  
crash if executed repeatedly from plan cache.  
  
In the back branches, we'll just apply a narrow band-aid for that,  
but in HEAD it seems prudent to have a more principled fix that  
will close off the possibility of other similar bugs in future.  
Hence, let's hoist the responsibility for doing copyObject up into  
ProcessUtility from its children, thus ensuring that it happens for  
all utility statement types.  
  
Also, modify ProcessUtility's API so that its callers can tell it  
whether a copy step is necessary.  It turns out that in all cases,  
the immediate caller knows whether the node tree is transient, so  
this doesn't involve a huge amount of code thrashing.  In this way,  
while we lose a little bit in the execute-from-cache code path due  
to sometimes copying node trees that wouldn't be mutated anyway,  
we gain something in the simple-Query code path by not copying  
throwaway node trees.  Statements that are complex enough to be  
expensive to copy are almost certainly ones that would have to be  
copied anyway, so the loss in the cache code path shouldn't be much.  
  
(Note that this whole problem applies only to utility statements.  
Optimizable statements don't have the issue because we long ago made  
the executor treat Plan trees as read-only.  Perhaps someday we will  
make utility statement execution act likewise, but I'm not holding  
my breath.)  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/sepgsql/hooks.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/include/tcop/utility.h

Don't set a fast default for anything but a plain table

commit   : 0a4efdc7ebf2584257b166c87e82797eb92815b5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 18 Jun 2021 06:51:12 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 18 Jun 2021 06:51:12 -0400    

Click here for diff

The fast default code added in Release 11 omitted to check that the  
table a fast default was being added to was a plain table. Thus one  
could be added to a foreign table, which predicably blows up. Here we  
perform that check.  
  
In addition, on the back branches, since some of these might have  
escaped into the wild, if we encounter a missing value for  
an attribute of something other than a plain table we ignore it.  
  
Fixes bug #17056  
  
Backpatch to release 11,  
  
Reviewed by: Andres Freund, Álvaro Herrera and Tom Lane  

M src/backend/catalog/heap.c
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Make archiver process handle barrier events.

commit   : 981524d2e3aa3f28d364c472e34f5386be846811    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 18 Jun 2021 17:57:09 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 18 Jun 2021 17:57:09 +0900    

Click here for diff

Commit d75288fb27 made WAL archiver process an auxiliary process.  
An auxiliary process needs to handle barrier events but the commit  
forgot to make archiver process do that.  
  
Reported-by: Thomas Munro  
Author: Fujii Masao  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/CA+hUKGLah2w1pWKHonZP_+EQw69=q56AHYwCgEN8GDzsRG_Hgw@mail.gmail.com  

M src/backend/postmaster/pgarch.c

doc: Apply markup <productname> to OpenSSL more consistently

commit   : f80979f659d39e238e95444e6752142799428078    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Jun 2021 14:22:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Jun 2021 14:22:31 +0900    

Click here for diff

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

M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml

Tidy up GetMultiXactIdMembers()'s behavior on error

commit   : d24c5658a80c8f5037e9e1948de311d3f3350f12    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 17 Jun 2021 14:50:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 17 Jun 2021 14:50:42 +0300    

Click here for diff

One of the error paths left *members uninitialized. That's not a live  
bug, because most callers don't look at *members when the function  
returns -1, but let's be tidy. One caller, in heap_lock_tuple(), does  
"if (members != NULL) pfree(members)", but AFAICS it never passes an  
invalid 'multi' value so it should not reach that error case.  
  
The callers are also a bit inconsistent in their expectations.  
heap_lock_tuple() pfrees the 'members' array if it's not-NULL, others  
pfree() it if "nmembers >= 0", and others if "nmembers > 0". That's  
not a live bug either, because the function should never return 0, but  
add an Assert for that to make it more clear. I left the callers alone  
for now.  
  
I also moved the line where we set *nmembers. It wasn't wrong before,  
but I like to do that right next to the 'return' statement, to make it  
clear that it's always set on return.  
  
Also remove one unreachable return statement after ereport(ERROR), for  
brevity and for consistency with the similar if-block right after it.  
  
Author: Greg Nancarrow with the additional changes by me  
Backpatch-through: 9.6, all supported versions  

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

Document a few caveats in synchronous logical replication.

commit   : 3cb828dbe26087e7754f49f3cfe3ed036d5af439    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 17 Jun 2021 09:56:05 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 17 Jun 2021 09:56:05 +0530    

Click here for diff

In a synchronous logical setup, locking [user] catalog tables can cause  
deadlock. This is because logical decoding of transactions can lock  
catalog tables to access them so exclusively locking those in transactions  
can lead to deadlock. To avoid this users must refrain from having  
exclusive locks on catalog tables.  
  
Author: Takamichi Osumi  
Reviewed-by: Vignesh C, Amit Kapila  
Backpatch-through: 9.6  
Discussion: https://www.postgresql.org/message-id/20210222222847.tpnb6eg3yiykzpky%40alap3.anarazel.de  

M doc/src/sgml/logicaldecoding.sgml

Fix plancache refcount leak after error in ExecuteQuery.

commit   : 131ea3e908d3c97a2fe1ab25cce5046dd5cb905f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Jun 2021 19:30:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Jun 2021 19:30:17 -0400    

Click here for diff

When stuffing a plan from the plancache into a Portal, one is  
not supposed to risk throwing an error between GetCachedPlan and  
PortalDefineQuery; if that happens, the plan refcount incremented  
by GetCachedPlan will be leaked.  I managed to break this rule  
while refactoring code in 9dbf2b7d7.  There is no visible  
consequence other than some memory leakage, and since nobody is  
very likely to trigger the relevant error conditions many times  
in a row, it's not surprising we haven't noticed.  Nonetheless,  
it's a bug, so rearrange the order of operations to remove the  
hazard.  
  
Noted on the way to looking for a better fix for bug #17053.  
This mistake is pretty old, so back-patch to all supported  
branches.  

M src/backend/commands/prepare.c

Fix copying data into slots with FDW batching

commit   : 99cea49d6525e30bc3768e4ffb95377e7584dea1    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 16 Jun 2021 22:53:31 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 16 Jun 2021 22:53:31 +0200    

Click here for diff

Commit b676ac443b optimized handling of tuple slots with bulk inserts  
into foreign tables, so that the slots are initialized only once and  
reused for all batches. The data was however copied into the slots only  
after the initialization, inserting duplicate values when the slot gets  
reused. Fixed by moving the ExecCopySlot outside the init branch.  
  
The existing postgres_fdw tests failed to catch this due to inserting  
data into foreign tables without unique indexes, and then checking only  
the number of inserted rows. This adds a new test with both a unique  
index and a check of inserted values.  
  
Reported-by: Alexander Pyhalov  
Discussion: https://postgr.es/m/7a8cf8d56b3d18e5c0bccd6cd42d04ac%40postgrespro.ru  

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

commit   : 6b787d9e32005867ee3660d1ea20f447810a403d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Jun 2021 11:52:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Jun 2021 11:52:05 -0400    

Click here for diff

I started out with the goal of reporting ERRCODE_CONNECTION_FAILURE  
when walrcv_connect() fails, but as I looked around I realized that  
whoever wrote this code was of the opinion that errcodes are purely  
optional.  That's not my understanding of our project policy.  Hence,  
make sure that an errcode is provided in each ereport that (a) is  
ERROR or higher level and (b) isn't arguably an internal logic error.  
Also fix some very dubious existing errcode assignments.  
  
While this is not per policy, it's also largely cosmetic, since few  
of these cases could get reported to applications.  So I don't  
feel a need to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix outdated comment that talked about seek position of WAL file.

commit   : d0303bc8d2670d11c9df9220aa08a2c33529e100    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Jun 2021 12:34:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Jun 2021 12:34:32 +0300    

Click here for diff

Since commit c24dcd0cfd, we have been using pg_pread() to read the WAL  
file, which doesn't change the seek position (unless we fall back to  
the implementation in src/port/pread.c). Update comment accordingly.  
  
Backpatch-through: 12, where we started to use pg_pread()  

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

Update another variant expected-result file.

commit   : d3c878499c9d639ff06e0664d06b8c731e30c2fc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Jun 2021 16:11:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Jun 2021 16:11:45 -0400    

Click here for diff

This should have been updated in 533e9c6b0, but it was overlooked.  
Given the lack of complaints, I won't bother back-patching.  

M src/test/isolation/expected/lock-update-delete_1.out

Remove another orphan expected-result file.

commit   : f6352a0d4e437ac8bc266f77df22d064592056c9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Jun 2021 16:09:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Jun 2021 16:09:14 -0400    

Click here for diff

aborted-keyrevoke_2.out was apparently needed when it was added (in  
commit 0ac5ad513) to handle the case of serializable transaction mode.  
However, the output in serializable mode actually matches the regular  
aborted-keyrevoke.out file, and AFAICT has done so for a long time.  
There's no need to keep dragging this variant along.  

D src/test/isolation/expected/aborted-keyrevoke_2.out

Further refinement of stuck_on_old_timeline recovery test

commit   : 54a5ed22016940d7ad5060ed62d23473924756a1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 15 Jun 2021 15:30:11 -0400    
  
committer: Andrew Dunstan <[email protected]>