PostgreSQL 13.0 commit log

Stamp 13.0.

commit   : 29be9983a64c011eac0b9ee29895cce71e15ea77    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2020 16:47:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2020 16:47:36 -0400    

Click here for diff

M configure
M configure.in

Doc: improve v13 release note item about autovacuum and INSERTs.

commit   : 4406364e2bf421459be7bd21503da093d910e0c3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2020 13:30:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2020 13:30:18 -0400    

Click here for diff

The previous text was confusing, per off-list discussion with  
Bruce Momjian.  

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

Copy editing: fix a bunch of misspellings and poor wording.

commit   : e62c5ea22c12f63d8d5ca3b228a458dfc10ae314    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2020 12:43:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Sep 2020 12:43:42 -0400    

Click here for diff

99% of this is docs, but also a couple of comments.  No code changes.  
  
Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/btree.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_statistics.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/sources.sgml
M src/backend/access/gin/README
M src/backend/utils/adt/jsonpath_exec.c
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Translation updates

commit   : d83268ae10cdeb2aa88e32286e94a8a8f59653a0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2020 10:06:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2020 10:06:30 +0200    

Click here for diff

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

M src/backend/po/es.po
M src/backend/po/fr.po
M src/backend/po/ru.po
M src/backend/po/sv.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/ru.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_verifybackup/po/es.po
M src/bin/pg_verifybackup/po/fr.po
M src/bin/pg_verifybackup/po/ru.po
M src/bin/pg_verifybackup/po/sv.po
M src/bin/pg_waldump/po/es.po
M src/bin/psql/po/es.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/sv.po
M src/interfaces/libpq/po/fr.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/fr.po

Update list of acknowledgments in release notes

commit   : f6727f29d52072bd0e87fbc9ed7af0d880db0d5c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2020 09:05:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Sep 2020 09:05:13 +0200    

Click here for diff

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

Use factorial rather than numeric_fac in create_operator.sql.

commit   : 9ab5ed4194f3863ff744e195027da747d4db4106    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Sep 2020 18:03:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Sep 2020 18:03:44 -0400    

Click here for diff

These two SQL functions are aliases for the same C function, so this  
change has no semantic effect.  However, because we dropped the  
numeric_fac alias in HEAD (commit 76f412ab3), operator definitions  
based on that one don't port forward, causing problems for cross-version  
upgrade tests based on the regression database.  
  
Patch all active back branches to dodge the problem.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix comments in heapam.c.

commit   : f083afac9df707778288b9ab448be169a25e3ea6    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 18 Sep 2020 09:40:04 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 18 Sep 2020 09:40:04 +0530    

Click here for diff

After commits 85f6b49c2c and 3ba59ccc89, we can allow parallel inserts  
which was earlier not possible as parallel group members won't conflict  
for relation extension and page lock.  In those commits, we forgot to  
update comments at few places.  
  
Author: Amit Kapila  
Reviewed-by: Robert Haas and Dilip Kumar  
Backpatch-through: 13  
Discussion: https://postgr.es/m/CAFiTN-tMrQh5FFMPx5aWJ+1gi1H6JxktEhq5mDwCHgnEO5oBkA@mail.gmail.com  

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

Update parallel BTree scan state when the scan keys can't be satisfied.

commit   : 0abd9cd2f3a1cad201ca28767aa0a720cc341179    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 17 Sep 2020 15:16:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 17 Sep 2020 15:16:46 +0530    

Click here for diff

For parallel btree scan to work for array of scan keys, it should reach  
BTPARALLEL_DONE state once for every distinct combination of array keys.  
This is required to ensure that the parallel workers don't try to seize  
blocks at the same time for different scan keys. We missed to update this  
state when we discovered that the scan keys can't be satisfied.  
  
Author: James Hunter  
Reviewed-by: Amit Kapila  
Tested-by: Justin Pryzby  
Backpatch-through: 10, where it was introduced  
Discussion: https://postgr.es/m/[email protected]  

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

Fix bogus completion tag usage in walsender

commit   : bfb12cd2b59da2ce51a9c86bf2c468202d8f96ee    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 16 Sep 2020 13:04:38 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 16 Sep 2020 13:04:38 -0300    

Click here for diff

Since commit fd5942c18f97 (2012, 9.3-era), walsender has been sending  
completion tags for certain replication commands twice -- and they're  
not even consistent.  Apparently neither libpq nor JDBC have a problem  
with it, but it's not kosher.  Fix by remove the EndCommand() call in  
the common code path for them all, and inserting specific calls to  
EndReplicationCommand() specifically in those places where it's needed.  
  
EndReplicationCommand() is a new simple function to send the completion  
tag for replication commands.  Do this instead of sending a generic  
SELECT completion tag for them all, which was also pretty bogus (if  
innocuous).  While at it, change StartReplication() to use  
EndReplicationCommand() instead of pg_puttextmessage().  
  
In commit 2f9661311b83, I failed to realize that replication commands  
are not close-enough kin of regular SQL commands, so the  
DROP_REPLICATION_SLOT tag I added is undeserved and a type pun.  Take it  
out.  
  
Backpatch to 13, where the latter commit appeared.  The duplicate tag  
has been sent since 9.3, but since nothing is broken, it doesn't seem  
worth fixing.  
  
Per complaints from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c
M src/backend/tcop/dest.c
M src/include/tcop/cmdtaglist.h
M src/include/tcop/dest.h

Fix amcheck child check pg_upgrade bug.

commit   : c287f585865b81c96602db995dacf2c006c79d58    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 16 Sep 2020 10:42:28 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 16 Sep 2020 10:42:28 -0700    

Click here for diff

Commit d114cc53 overlooked the fact that pg_upgrade'd B-Tree indexes  
have leaf page high keys whose offset numbers do not match the one from  
the copy of the tuple one level up (the copy stored with a downlink for  
leaf page's right sibling page).  This led to false positive reports of  
corruption from bt_index_parent_check() when it was called to verify a  
pg_upgrade'd index.  
  
To fix, skip comparing the offset number on pg_upgrade'd B-Tree indexes.  
  
Author: Anastasia Lubennikova <[email protected]>  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Andrew Bille <[email protected]>  
Diagnosed-By: Anastasia Lubennikova <[email protected]>  
Bug: #16619  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 13-, where child check was enhanced.  

M contrib/amcheck/verify_nbtree.c

Avoid unnecessary recursion to child tables in ALTER TABLE SET NOT NULL.

commit   : 17280b31c2f218f1b1f0c1fbacae7e781010a01b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2020 13:38:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2020 13:38:26 -0400    

Click here for diff

If a partitioned table's column is already marked NOT NULL, there is  
no need to examine its partitions, because we can rely on previous  
DDL to have enforced that the child columns are NOT NULL as well.  
(Unfortunately, the same cannot be said for traditional inheritance,  
so for now we have to restrict the optimization to partitioned tables.)  
Hence, we may skip recursing to child tables in this situation.  
  
The reason this case is worth worrying about is that when pg_dump dumps  
a partitioned table having a primary key, it will include the requisite  
NOT NULL markings in the CREATE TABLE commands, and then add the  
primary key as a separate step.  The primary key addition generates a  
SET NOT NULL as a subcommand, just to be sure.  So the situation where  
a SET NOT NULL is redundant does arise in the real world.  
  
Skipping the recursion does more than just save a few cycles: it means  
that a command such as "ALTER TABLE ONLY partition_parent ADD PRIMARY  
KEY" will take locks only on the partition parent table, not on the  
partitions.  It turns out that parallel pg_restore is effectively  
assuming that that's true, and has little choice but to do so because  
the dependencies listed for such a TOC entry don't include the  
partitions.  pg_restore could thus issue this ALTER while data restores  
on the partitions are still in progress.  Taking unnecessary locks on  
the partitions not only hurts concurrency, but can lead to actual  
deadlock failures, as reported by Domagoj Smoljanovic.  
  
(A contributing factor in the deadlock is that TRUNCATE on a child  
partition wants a non-exclusive lock on the parent.  This seems  
likewise unnecessary, but the fix for it is more invasive so we  
won't consider back-patching it.  Fortunately, getting rid of one  
of these two poor behaviors is enough to remove the deadlock.)  
  
Although support for partitioned primary keys came in with v11,  
this patch is dependent on the SET NOT NULL refactoring done by  
commit f4a3fdfbd, so we can only patch back to v12.  
  
Patch by me; thanks to Alvaro Herrera and Amit Langote for review.  
  
Discussion: https://postgr.es/m/VI1PR03MB31670CA1BD9625C3A8C5DD05EB230@VI1PR03MB3167.eurprd03.prod.outlook.com  

M src/backend/commands/tablecmds.c

Fix bogus cache-invalidation logic in logical replication worker.

commit   : 3e3f8f20206cbbb8d30be528d2a640d14a95c25c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2020 12:07:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 16 Sep 2020 12:07:31 -0400    

Click here for diff

The code recorded cache invalidation events by zeroing the "localreloid"  
field of affected cache entries.  However, it's possible for an inval  
event to occur even while we have the entry open and locked.  So an  
ill-timed inval could result in "cache lookup failed for relation 0"  
errors, if the worker's code tried to use the cleared field.  We can  
fix that by creating a separate bool field to record whether the entry  
needs to be revalidated.  (In the back branches, cram the bool into  
what had been padding space, to avoid an ABI break in the somewhat  
unlikely event that any extension is looking at this struct.)  
  
Also, rearrange the logic in logicalrep_rel_open so that it  
does the right thing in cases where table_open would fail.  
We should retry the lookup by name in that case, but we didn't.  
  
The real-world impact of this is probably small.  In the first place,  
the error conditions are very low probability, and in the second place,  
the worker would just exit and get restarted.  We only noticed because  
in a CLOBBER_CACHE_ALWAYS build, the failure can occur repeatedly,  
preventing the worker from making progress.  Nonetheless, it's clearly  
a bug, and it impedes a useful type of testing; so back-patch to v10  
where this code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Change LogicalTapeSetBlocks() to use nBlocksWritten.

commit   : 6e146a663536f86c8421ac6ed08c4eb9a69979fd    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 15 Sep 2020 21:34:05 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 15 Sep 2020 21:34:05 -0700    

Click here for diff

Previously, it was based on nBlocksAllocated to account for tapes with  
open write buffers that may not have made it to the BufFile yet.  
  
That was unnecessary, because callers do not need to get the number of  
blocks while a tape has an open write buffer; and it also conflicted  
with the preallocation logic added for HashAgg.  
  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

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

HashAgg: release write buffers sooner by rewinding tape.

commit   : 42a46f5a76ecb435ac3a29fc3a0d03f1cfff17ab    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 15 Sep 2020 21:16:31 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 15 Sep 2020 21:16:31 -0700    

Click here for diff

This was an oversight. The purpose of 7fdd919ae7 was to avoid keeping  
tape buffers around unnecessisarily, but HashAgg didn't rewind early  
enough.  
  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/backend/executor/nodeAgg.c

Fix use-after-free bug with event triggers in an extension script

commit   : 873cb8fca9b14bde3e1d5577fcbb7b76d303076d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 15 Sep 2020 21:03:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 15 Sep 2020 21:03:14 -0300    

Click here for diff

ALTER TABLE commands in an extension script are added to an event  
trigger command list; but starting with commit b5810de3f4 they do so in  
a memory context that's too short-lived, so when execution ends and time  
comes to use the entries, they've already been freed.  
  
(This would also be a problem with ALTER TABLE commands in a  
multi-command query string, but these serendipitously end in  
PortalContext -- which probably explains why it took so long for this to  
be reported.)  
  
Fix by using the memory context specifically set for that, instead.  
  
Backpatch to 13, where the aforementioned commit appeared.  
  
Reported-by: Philippe Beaudoin  
Author: Jehan-Guillaume de Rorthais <[email protected]>  
Discussion: https://postgr.es/m/20200902193715.6e0269d4@firost  

M src/backend/commands/event_trigger.c
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext_evttrig–1.0–2.0.sql
A src/test/modules/test_extensions/test_ext_evttrig–1.0.sql
A src/test/modules/test_extensions/test_ext_evttrig.control

Doc: improve release notes' info about FROM UNPACKAGED feature removal.

commit   : d42c6176446440b185fcb95c214b7e40d5758b60    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Sep 2020 14:29:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Sep 2020 14:29:43 -0400    

Click here for diff

Per gripe from Jonathan Katz.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: fix misstatement in v13 release notes.

commit   : 001d2c5f15bf8d554a7fe28af033d82c24de4e44    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Sep 2020 10:58:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Sep 2020 10:58:37 -0400    

Click here for diff

Parallel vacuuming isn't restricted to b-tree indexes.  
Noted by Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Stamp 13rc1.

commit   : efea2b85fa2c3dec1c8039f1c97fcfe53ee5e82c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Sep 2020 16:08:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Sep 2020 16:08:07 -0400    

Click here for diff

M configure
M configure.in

Translation updates

commit   : bab6f77f24407e0924dac292af9e65016fce99bf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Sep 2020 13:14:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Sep 2020 13:14:53 +0200    

Click here for diff

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

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

Fix interpolation in test name.

commit   : 6fb1c5b528267918a88c4143985a08a3c997e528    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 13 Sep 2020 23:29:51 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 13 Sep 2020 23:29:51 -0700    

Click here for diff

A pre-commit review had reported the problem, but the fix reached only  
v10 and earlier.  Back-patch to v11.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/020_archive_status.pl

Message fixes and style improvements

commit   : b1b53f15bbac106e241b14ae1bc13f2708fe74c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Sep 2020 06:42:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Sep 2020 06:42:07 +0200    

Click here for diff

M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xlog.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/tablecmds.c
M src/backend/libpq/hba.c
M src/backend/nodes/params.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/replication/basebackup.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/backend/utils/sort/sharedtuplestore.c
M src/bin/pg_verifybackup/parse_manifest.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/scripts/vacuumdb.c
M src/fe_utils/archive.c
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/limit.out

Use the properly transformed RangeVar for expandTableLikeClause().

commit   : b380484a850b6bf7d9fc0d85c555a2366e38451f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Sep 2020 12:51:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Sep 2020 12:51:21 -0400    

Click here for diff

transformCreateStmt() adjusts the transformed statement's RangeVar  
to specify the target schema explicitly, for the express reason  
of making sure that auxiliary statements derived by parse  
transformation operate on the right table.  But the refactoring  
I did in commit 502898192 got this wrong and passed the untransformed  
RangeVar to expandTableLikeClause().  This could lead to assertion  
failures or weird misbehavior if the wrong table was accessed.  
  
Per report from Alexander Lakhin.  Like the previous patch, back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/utility.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/sql/create_table_like.sql

commit   : e6bbe07deec9824eb62fbbf38c4bfe7aaf674d37    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 6 Sep 2020 16:46:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 6 Sep 2020 16:46:13 +0200    

Click here for diff

The original stylesheets seemed to think this was a good idea, but our  
users find it confusing and unhelpful, so undo that logic.  
  
Reported-by: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.22.394.2006210914370.859381%40pseudo  

M doc/src/sgml/stylesheet.xsl

logtape.c: do not preallocate for tapes when sorting

commit   : 93106d71a18afdda2b9bf6e6b8e6c7f9cea2d0ef    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 11 Sep 2020 17:10:02 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 11 Sep 2020 17:10:02 -0700    

Click here for diff

The preallocation logic is only useful for HashAgg, so disable it when  
sorting.  
  
Also, adjust an out-of-date comment.  
  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wzn_o7tE2+hRVvwSFghRb75AJ5g-nqGzDUqLYMexjOAe=g@mail.gmail.com  
Backpatch-through: 13  

M src/backend/executor/nodeAgg.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/logtape.h

psql: Display stats target of extended statistics

commit   : aeb781107a7ca0cfe109c188534ecbf9c392f6ba    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Sep 2020 16:15:47 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Sep 2020 16:15:47 -0300    

Click here for diff

The stats target can be set since commit d06215d03, but wasn't shown by  
psql.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Georgios Kokolatos <[email protected]>  
Reviewed-by: Tatsuro Yamada <[email protected]>  

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

commit   : 6dcec8fe13b41b0773e9122168a1b53f3e458206    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Sep 2020 12:53:25 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Sep 2020 12:53:25 -0300    

Click here for diff

Thinko in 40b3e2c201af.  
  
Reported-by: "Wang, Shenhao" <[email protected]>  
Discussion: https://postgr.es/m/ed98706b82694b57a8c0d339a10732aa@G08CNEXMBPEKD06.g08.fujitsu.local  

M src/backend/catalog/pg_cast.c

Doc: some more v13 release note tweaking.

commit   : 9892564121d425291c4fd06ff083147dd70b9156    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2020 18:42:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2020 18:42:57 -0400    

Click here for diff

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

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

Doc: update v13 release notes through today, do a copy-editing pass.

commit   : 3965de54e718600a4703233936e56a3202caf73f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2020 17:43:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2020 17:43:16 -0400    

Click here for diff

Also set the release date ... hopefully we won't have to change that.  

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

Doc: fill in "major enhancements" list in v13 release notes.

commit   : 3d92252d7d8bf7080ba61f1bda3d27bd8a3617e1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2020 13:14:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2020 13:14:09 -0400    

Click here for diff

Jonathan S. Katz, minor tweaks by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Use _exit(2) for SIGQUIT during ProcessStartupPacket, too.

commit   : 3f29aa48b6df318e43d0efe5735f61175ef38574    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2020 12:06:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Sep 2020 12:06:26 -0400    

Click here for diff

Bring the signal handling for startup-packet collection into line  
with the policy established in commits bedadc732 and 8e19a8264,  
namely don't risk running atexit callbacks when handling SIGQUIT.  
  
Ideally, we'd not do so for SIGTERM or timeout interrupts either,  
but that change seems a bit too risky for the back branches.  
For now, just improve the comments in this area to describe the risk.  
  
Also relocate where BackendInitialize re-disables these interrupts,  
to minimize the code span where they're active.  This doesn't buy  
a whole lot of safety, but it can't hurt.  
  
In passing, rename startup_die() to remove confusion about whether  
it is for the startup process.  
  
Like the previous commits, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

doc: Remove buggy ICU collation from documentation

commit   : 9f358c5ef31327f7a67af783f5f37468bbac3aed    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Sep 2020 15:31:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Sep 2020 15:31:09 +0200    

Click here for diff

We have had multiple reports that point to the  
'@colReorder=latn-digit' collation customization being buggy.  We have  
reported this to ICU and are waiting for a fix.  In the meantime,  
remove references to this from the documentation and replace it by  
another reordering example.  Apparently, many users have been picking  
up this example specifically from the documentation.  
  
Author: Jehan-Guillaume de Rorthais <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/153201618542.1404.3611626898935613264%40wrigleys.postgresql.org  

M doc/src/sgml/charset.sgml

Fix title in reference section

commit   : 727f6fb8f71f7ed64e6883164765bbf6cb7684ec    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 10 Sep 2020 14:15:26 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 10 Sep 2020 14:15:26 +0200    

Click here for diff

Reported-by: Robert Kahlert  
Author: Daniel Gustafsson  

M doc/src/sgml/biblio.sgml

Clean up some code and comments in partbounds.c.

commit   : d601a930756b96fe05beb75a1b624a8155c98cc8    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 10 Sep 2020 18:00:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 10 Sep 2020 18:00:01 +0900    

Click here for diff

Do some minor cleanup for commit c8434d64c: 1) remove a useless  
assignment (in normal builds) and 2) improve comments a little.  
  
Back-patch to v13 where the aforementioned commit went in.  
  
Author: Etsuro Fujita  
Reviewed-by: Alvaro Herrera  
Discussion: https://postgr.es/m/CAPmGK16yCd2R4=bQ4g8N2dT9TtA5ZU+qNmJ3LPc_nypbNy4_2A@mail.gmail.com  

M src/backend/partitioning/partbounds.c

Doc: clean up contributor names.

commit   : 32a433455a0a6918b9c8f300d6c0be73ef06e9f9    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 10 Sep 2020 16:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 10 Sep 2020 16:15:00 +0900    

Click here for diff

Standardize Japanese names as given-name-first.  
  
Author: Etsuro Fujita  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/CAPmGK14S5frHWzsKS14R2LeMjKkjr5PeqRGiKZ0os0A+o8BWuQ@mail.gmail.com  

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

doc: Fix some grammar and inconsistencies

commit   : b3d89b7a889614a5ad549bae49b8a6fdda3a6bdd    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 10 Sep 2020 15:50:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 10 Sep 2020 15:50:42 +0900    

Click here for diff

Some comments are fixed while on it.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_verifybackup.sgml
M doc/src/sgml/sources.sgml
M src/backend/replication/logical/relation.c
M src/backend/storage/lmgr/proc.c

Fix rd_firstRelfilenodeSubid for nailed relations, in parallel workers.

commit   : 6f15be5bedfc423b8a8f2f0282e2a0eb20a16663    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 9 Sep 2020 18:50:24 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 9 Sep 2020 18:50:24 -0700    

Click here for diff

Move applicable code out of RelationBuildDesc(), which nailed relations  
bypass.  Non-assert builds experienced no known problems.  Back-patch to  
v13, where commit c6b92041d38512a4176ed76ad06f713d2e6c01a8 introduced  
rd_firstRelfilenodeSubid.  
  
Kyotaro Horiguchi.  Reported by Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/relcache.c
M src/test/regress/expected/reindex_catalog.out
M src/test/regress/sql/reindex_catalog.sql

Make archiver's SIGQUIT handler exit via _exit().

commit   : 35e59398abbb562f1e831af206f1d1cc8c3cb7db    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2020 15:32:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2020 15:32:34 -0400    

Click here for diff

Commit 8e19a8264 changed the SIGQUIT handlers of almost all server  
processes not to run atexit callbacks.  The archiver process was  
skipped, perhaps because it's not connected to shared memory; but  
it's just as true here that running atexit callbacks in a signal  
handler is unsafe.  So let's make it work like the rest.  
  
In HEAD and v13, we can use the common SignalHandlerForCrashExit  
handler.  Before that, just tweak pgarch_exit to use _exit(2)  
explicitly.  
  
Like the previous commit, back-patch to all supported branches.  
  
Kyotaro Horiguchi, back-patching by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgarch.c

commit   : 6b473ab4f23736d67c420909ab65c55228dcd6e6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2020 12:00:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2020 12:00:49 -0400    

Click here for diff

Commit 15cb2bd27 neglected to make the running text match the  
tables, leaving the reader with the strong impression that  
we cannot count.  Also, don't drop an unrelated para between  
a table and the para describing it.  

M doc/src/sgml/xindex.sgml

Minor fixes in docs and error messages.

commit   : aa33187164e1d8571f1568f0470aaace8f791876    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2020 11:53:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Sep 2020 11:53:39 -0400    

Click here for diff

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

M doc/src/sgml/bgworker.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/intarray.sgml
M src/backend/replication/backup_manifest.c
M src/backend/utils/misc/guc.c

Add missing quote in docs

commit   : 1bf0b9c5f58c61c160519a77a8f9dd24cea68b32    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 9 Sep 2020 12:20:53 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 9 Sep 2020 12:20:53 +0200    

Click here for diff

Mistake in commit 68b603e1a9.  
  
Reported-by: Ian Barwick  

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

Check default partitions constraints while descending

commit   : d0230a43fcae6f923fcedfe6f27db7fca8760d95    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 8 Sep 2020 19:35:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 8 Sep 2020 19:35:15 -0300    

Click here for diff

Partitioning tuple route code assumes that the partition chosen while  
descending the partition hierarchy is always the correct one.  This is  
true except when the partition is the default partition and another  
partition has been added concurrently: the partition constraint changes  
and we don't recheck it.  This can lead to tuples mistakenly being added  
to the default partition that should have been rejected.  
  
Fix by rechecking the default partition constraint while descending the  
hierarchy.  
  
An isolation test based on the reproduction steps described by Hao Wu  
(with tweaks for extra coverage) is included.  
  
Backpatch to 12, where this bug came in with 898e5e3290a7.  
  
Reported by: Hao Wu <[email protected]>  
Author: Amit Langote <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqFqBmcSSap4sFnCBUEL_VfOMmEKaQ3gwUhyfa4c7J_-nA@mail.gmail.com  
Discussion: https://postgr.es/m/DM5PR0501MB3910E97A9EDFB4C775CF3D75A42F0@DM5PR0501MB3910.namprd05.prod.outlook.com  

M src/backend/executor/execPartition.c
A src/test/isolation/expected/partition-concurrent-attach.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-concurrent-attach.spec

Adjust cost model for HashAgg that spills to disk.

commit   : b61d048e0d480f4311c62bf3026879c83ba9aaad    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 7 Sep 2020 13:31:59 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 7 Sep 2020 13:31:59 -0700    

Click here for diff

Tomas Vondra observed that the IO behavior for HashAgg tends to be  
worse than for Sort. Penalize HashAgg IO costs accordingly.  
  
Also, account for the CPU effort of spilling the tuples and reading  
them back.  
  
Discussion: https://postgr.es/m/20200906212112.nzoy5ytrzjjodpfh@development  
Reviewed-by: Tomas Vondra  
Backpatch-through: 13  

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

Clarify comments in enforce_generic_type_consistency().

commit   : e02c99bff6fcf7a14292cf99b16e4810ea89a2de    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Sep 2020 14:52:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Sep 2020 14:52:33 -0400    

Click here for diff

Some of the pre-existing comments were vague about whether they  
referred to all polymorphic types or only the old-style ones.  
  
Also be more consistent about using the "family 1" vs "family 2"  
terminology.  
  
Himanshu Upadhyaya and Tom Lane  
  
Discussion: https://postgr.es/m/CAPF61jBUg9XoMPNuLpoZ+h6UZ2VxKdNt3rQL1xw1GOBwjWzAXQ@mail.gmail.com  

M src/backend/parser/parse_coerce.c

Update list of acknowledgments in release notes

commit   : 1e83138da14d61d572b0b58a9da6a2cf535ea198    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Sep 2020 09:08:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Sep 2020 09:08:58 +0200    

Click here for diff

current through b7cf9e42ac2d4b153eb781195ebf369d4b8b566e  

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

doc: Tweak sentence for pg_checksums when enabling checksums

commit   : b7cf9e42ac2d4b153eb781195ebf369d4b8b566e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 7 Sep 2020 14:35:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 7 Sep 2020 14:35:13 +0900    

Click here for diff

The previous version of the docs mentioned that files are rewritten,  
implying that a second copy of each file gets created, but each file is  
updated in-place.  
  
Author: Michael Banck  
Reviewed-by: Daniel Gustafsson, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M doc/src/sgml/ref/pg_checksums.sgml

Change path in example of file_fdw for logs

commit   : a82919afe26ad93a135aa5f017a3f31ec5a6547a    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 6 Sep 2020 19:28:32 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 6 Sep 2020 19:28:32 +0200    

Click here for diff

It's better to use a relative path into the data directory, than to a  
hardcoded home directory of user 'josh'.  
  
Discussion: https://postgr.es/m/CABUevEyuf67Yu_r9gpDMs5MKifK7+-+pe=ZjKzya4JEn9kUk1w@mail.gmail.com  

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

Fix misleading error message about inconsistent moving-aggregate types.

commit   : f04203ab7e683bc3e961a40b002cf3c8d1d12100    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Sep 2020 12:55:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Sep 2020 12:55:13 -0400    

Click here for diff

We reported the wrong types when complaining that an aggregate's  
moving-aggregate implementation is inconsistent with its regular  
implementation.  
  
This was wrong since the feature was introduced, so back-patch  
to all supported branches.  
  
Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1x808LH=LPhZp9mNSP0Xd1xDqEd+XeGcvEe48dfE6xV=A@mail.gmail.com  

M src/backend/catalog/pg_aggregate.c

Remove useless lstat() call in pg_rewind.

commit   : e7f06ea60a3c07128176b294ce3fb0555edd15a5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Sep 2020 11:50:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Sep 2020 11:50:40 -0400    

Click here for diff

This is duplicative of an lstat that was just done by the calling  
function (traverse_datadir), besides which we weren't really doing  
anything with the results.  There's not much point in checking to  
see if someone removed the file since the previous lstat, since the  
FILE_ACTION_REMOVE code would have to deal with missing-file cases  
anyway.  Moreover, the "exists = false" assignment was a dead store;  
nothing was done with that value later.  
  
A syscall saved is a syscall earned, so back-patch to 9.5  
where this code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/filemap.c

Make new authentication test case more robust.

commit   : 8df601bd4067ecdf373ebe43bdf03159a12e2e9d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2020 21:01:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2020 21:01:59 -0400    

Click here for diff

I happened to notice that the new test case I added in b55b4dad9  
falls over if one runs "make check" repeatedly; though not in branches  
after v10.  That's because it was assuming that tmp_check/pgpass  
wouldn't exist already.  However, it's only been since v11 that the  
Makefiles forcibly remove all of tmp_check/ before starting a TAP run.  
This fix to unlink the file is therefore strictly necessary only in  
v10 ... but it seems wisest to do it across the board, rather than  
let the test rely on external logic to get the conditions right.  

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

Fix over-eager ping'ing in logical replication receiver.

commit   : 9b81a30f924cf30e6bf3abb3366706440351e163    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2020 20:20:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2020 20:20:05 -0400    

Click here for diff

Commit 3f60f690f only partially fixed the broken-status-tracking  
issue in LogicalRepApplyLoop: we need ping_sent to have the same  
lifetime as last_recv_timestamp.  The effects are much less serious  
than what that commit fixed, though.  AFAICS this would just lead to  
extra ping requests being sent, once per second until the sender  
responds.  Still, it's a bug, so backpatch to v10 as before.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix bogus MaxAllocSize check in logtape.c.

commit   : 4a4f3bf983b4abd908585a8d752eee0e47627034    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 4 Sep 2020 12:01:58 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 4 Sep 2020 12:01:58 -0700    

Click here for diff

Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wz=NZPZc3-fkdmvu=w2itx0PiB-G6QpxHXZOjuvFAzPdZw@mail.gmail.com  
Backpatch-through: 13  

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

Collect attribute data on extension owned tables being dumped

commit   : 72857482c135677703111855f33550c442108eaa    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 4 Sep 2020 13:53:09 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 4 Sep 2020 13:53:09 -0400    

Click here for diff

If this data is not collected, pg_dump segfaults if asked for column  
inserts.  
  
Fix by Fabrízio de Royes Mello  
  
Backpatch to release 12 where the bug was introduced.  

M src/bin/pg_dump/pg_dump.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_pg_dump/test_pg_dump–1.0.sql

C comment: correct use of 64-"byte" cache line size

commit   : 7574af1e1b94a4de7a6f63f3a7854a508ab7b0e0    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 4 Sep 2020 13:27:52 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 4 Sep 2020 13:27:52 -0400    

Click here for diff

Reported-by: Kelly Min  
  
Discussion: https://postgr.es/m/CAPSbxatOiQO90LYpSC3+svAU9-sHgDfEP4oFhcEUt_X=DqFA9g@mail.gmail.com  
  
Backpatch-through: 9.5  

M src/include/storage/buf_internals.h

Fix rare deadlock failure in create_am regression test.

commit   : afec6ba0bae0258835b81fcc0eeed3ff9c455427    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2020 12:40:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Sep 2020 12:40:28 -0400    

Click here for diff

The "DROP ACCESS METHOD gist2" test will require locking the index  
to be dropped and then its table; while most ordinary operations  
lock a table first then its index.  While no concurrent test scripts  
should be touching fast_emp4000, autovacuum might chance to be  
processing that table when the DROP runs, resulting in a deadlock  
failure.  This is pretty rare but we see it in the buildfarm from  
time to time.  
  
To fix, acquire a lock on fast_emp4000 before issuing the DROP.  
  
Since the point of the exercise is mostly to prevent buildfarm  
failures, back-patch to 9.6 where this test was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid lockup of a parallel worker when reporting a long error message.

commit   : 17424e79d9794b00bdb6653185fc27ba423d8d81    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Sep 2020 16:52:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Sep 2020 16:52:09 -0400    

Click here for diff

Because sigsetjmp() will restore the initial state with signals blocked,  
the code path in bgworker.c for reporting an error and exiting would  
execute that way.  Usually this is fairly harmless; but if a parallel  
worker had an error message exceeding the shared-memory communication  
buffer size (16K) it would lock up, because it would wait for a  
resume-sending signal from its parallel leader which it would never  
detect.  
  
To fix, just unblock signals at the appropriate point.  
  
This can be shown to fail back to 9.6.  The lack of parallel query  
infrastructure makes it difficult to provide a simple test case for  
9.5; but I'm pretty sure the issue exists in some form there as well,  
so apply the code change there too.  
  
Vignesh C, reviewed by Bharath Rupireddy, Robert Haas, and myself  
  
Discussion: https://postgr.es/m/CALDaNm1d1hHPZUg3xU4XjtWBOLCrA+-2cJcLpw-cePZ=GgDVfA@mail.gmail.com  

M src/backend/postmaster/bgworker.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Doc: mention packager-supplied tools for server start/stop, initdb, etc.

commit   : 214bc9038e39e209924514b77db4ee491f95509a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Sep 2020 11:45:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Sep 2020 11:45:26 -0400    

Click here for diff

The majority of our audience is probably using a pre-packaged Postgres  
build rather than raw sources.  For them, much of runtime.sgml is not  
too relevant, and they should be reading the packager's docs instead.  
Add some notes pointing that way in appropriate places.  
  
Text by me; thanks to Daniel Gustafsson for review and discussion,  
and to Laurenz Albe for an earlier version.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml

Fix typo in comment

commit   : 352b8cf59f400e69a80db12f920adf12a1b0607c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 1 Sep 2020 20:43:23 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 1 Sep 2020 20:43:23 -0400    

Click here for diff

Introduced by 8b08f7d4820f; backpatch to 11.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.h

doc: clarify that max_wal_size is "during" checkpoints

commit   : 2c7db50ce83ec375ad6ddeba498f07c78bc10e97    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 1 Sep 2020 17:00:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 1 Sep 2020 17:00:10 -0400    

Click here for diff

Previous wording was "between".  
  
Reported-by: Pavel Luzanov  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/config.sgml

Raise error on concurrent drop of partitioned index

commit   : 15dad5776578e884ee7857abb278a116c0c3e578    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 1 Sep 2020 13:40:43 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 1 Sep 2020 13:40:43 -0400    

Click here for diff

We were already raising an error for DROP INDEX CONCURRENTLY on a  
partitioned table, albeit a different and confusing one:  
  ERROR:  DROP INDEX CONCURRENTLY must be first action in transaction  
  
Change that to throw a more comprehensible error:  
  ERROR:  cannot drop partitioned index \"%s\" concurrently  
  
Michael Paquier authored the test case for indexes on temporary  
partitioned tables.  
  
Backpatch to 11, where indexes on partitioned tables were added.  
  
Reported-by: Jan Mussler <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/drop_index.sgml
M src/backend/commands/tablecmds.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Teach libpq to handle arbitrary-length lines in .pgpass files.

commit   : 4178b749963cbf28d438b81e38dedcf885ccdda3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Sep 2020 13:14:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Sep 2020 13:14:44 -0400    

Click here for diff

Historically there's been a hard-wired assumption here that no line of  
a .pgpass file could be as long as NAMEDATALEN*5 bytes.  That's a bit  
shaky to start off with, because (a) there's no reason to suppose that  
host names fit in NAMEDATALEN, and (b) this figure fails to allow for  
backslash escape characters.  However, it fails completely if someone  
wants to use a very long password, and we're now hearing reports of  
people wanting to use "security tokens" that can run up to several  
hundred bytes.  Another angle is that the file is specified to allow  
comment lines, but there's no reason to assume that long comment lines  
aren't possible.  
  
Rather than guessing at what might be a more suitable limit, let's  
replace the fixed-size buffer with an expansible PQExpBuffer.  That  
adds one malloc/free cycle to the typical use-case, but that's surely  
pretty cheap relative to the I/O this code has to do.  
  
Also, add TAP test cases to exercise this code, because there was no  
test coverage before.  
  
This reverts most of commit 2eb3bc588, as there's no longer a need for  
a warning message about overlength .pgpass lines.  (I kept the explicit  
check for comment lines, though.)  
  
In HEAD and v13, this also fixes an oversight in 74a308cf5: there's not  
much point in explicit_bzero'ing the line buffer if we only do so in two  
of the three exit paths.  
  
Back-patch to all supported branches, except that the test case only  
goes back to v10 where src/test/authentication/ was added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: document how the backup manifest is transferred

commit   : 73018f564af91b135e541b28133369c5e3de975d    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 18:48:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 18:48:38 -0400    

Click here for diff

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

M doc/src/sgml/protocol.sgml

doc: add commas after 'i.e.' and 'e.g.'

commit   : 1d3ff89ecfbbdd8bf56d4773d8f2749156eeb7c1    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 18:33:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 18:33:37 -0400    

Click here for diff

This follows the American format,  
https://jakubmarian.com/comma-after-i-e-and-e-g/. There is no intention  
of requiring this format for future text, but making existing text  
consistent every few years makes sense.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/bki.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/create_event_trigger.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_procedure.sgml
M doc/src/sgml/ref/create_statistics.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/release-13.sgml
M doc/src/sgml/replication-origins.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/sslinfo.sgml
M doc/src/sgml/tableam.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/wal.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xml2.sgml

C comment: remove mention of use of t_hoff WAL structure member

commit   : 787ccf5a5fc92698e8cc8ebfb6fe1a0bf28981a4    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 17:51:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 17:51:31 -0400    

Click here for diff

Reported-by: Antonin Houska  
  
Discussion: https://postgr.es/m/21643.1595353537@antos  
  
Backpatch-through: 9.5  

M src/include/access/heapam_xlog.h

pg_upgrade doc: mention saving postgresql.conf.auto files

commit   : cef30b66fdf619a1b7aa0c2605719e64e980c6f2    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 17:36:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 17:36:23 -0400    

Click here for diff

Also mention files included by postgresql.conf.  
  
Reported-by: Álvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

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

doc: Update partitioning limitation on BEFORE triggers

commit   : 97dc0d1d58916e2f063ce8a7eec6bd4d3bc29197    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 31 Aug 2020 17:04:40 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 31 Aug 2020 17:04:40 -0400    

Click here for diff

Reported-by: Erwin Brandstetter <[email protected]>  
Discussion: https://postgr.es/m/CAGHENJ6Le7S3qJJx2TvWvTwRNS3N=BtoNeb7AF2rZvfNBMeQcg@mail.gmail.com  

M doc/src/sgml/ddl.sgml

docs: in mapping SQL to C data types, timestamp isn't a pointer

commit   : bef7b917a76af659b4d6bce813702764e2c749db    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 17:05:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 17:05:53 -0400    

Click here for diff

It is an int64.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/xfunc.sgml

commit   : 9bb4f98bb7745b7339fb7d102cdc36d66c002f67    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 16:59:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 16:59:59 -0400    

Click here for diff

There is an file-fdw example that reads the server config file, so cross  
link them.  
  
Reported-by: Oleg Samoilov  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/config.sgml
M doc/src/sgml/file-fdw.sgml

docs: clarify intermediate certificate creation instructions

commit   : 8924ca865b18cac0b655170989bcd9507991d06f    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 16:21:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 16:21:03 -0400    

Click here for diff

Specifically, explain the v3_ca openssl specification.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/runtime.sgml

docs: replace "stable storage" with "durable" in descriptions

commit   : 1bb41c6ad795e018e396eb3e216b2d21fadc865a    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 15:23:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 15:23:19 -0400    

Click here for diff

For PG, "durable storage" has a clear meaning, while "stable storage"  
does not, so use the former.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml

doc: improve description of subscripting of arrays

commit   : 8006ac1c5117a56fcd138d663a3fe3709c8f9988    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 13:49:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 13:49:17 -0400    

Click here for diff

It wasn't clear the non-integers are cast to integers for subscripting,  
rather than throwing an error.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/syntax.sgml

docs: improve 'capitals' inheritance example

commit   : 64fd65008c62ec011ba2d0673ca09849ae2b07c8    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 13:43:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 13:43:04 -0400    

Click here for diff

Adds constraints and improves wording.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/advanced.sgml

doc: clarify the useful features of procedures

commit   : 785affc1d653bac43b7d4fad93f22e9e51aefcc1    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 13:20:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 31 Aug 2020 13:20:04 -0400    

Click here for diff

This was not clearly documented when procedures were added in PG 11.  
  
Reported-by: Robin Abbi  
  
Discussion: https://postgr.es/m/CAGmg_NX327KKVuJmbWZD=pGutYFxzZjX1rU+3ji8UuX=8ONn9Q@mail.gmail.com  
  
Backpatch-through: 11  

M doc/src/sgml/xfunc.sgml

Fix docs bug stating file_fdw requires absolute paths

commit   : 3a1f6a2581e41ee2c724e8422675942d30a52ff7    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 31 Aug 2020 13:03:54 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 31 Aug 2020 13:03:54 +0200    

Click here for diff

It has always (since the first commit) worked with relative paths, so  
use the same wording as other parts of the documentation.  
  
Author: Bruce Momjian  
Discussion: https://postgr.es/m/CABUevExx-hm=cit+A9LeKBH39srvk8Y2tEZeEAj5mP8YfzNKUg@mail.gmail.com  

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

Mark factorial operator, and postfix operators in general, as deprecated.

commit   : 845cfe012fd15300cd090b05fb4029a26b848a67    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Aug 2020 14:37:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Aug 2020 14:37:24 -0400    

Click here for diff

Per discussion, we're planning to remove parser support for postfix  
operators in order to simplify the grammar.  So it behooves us to  
put out a deprecation notice at least one release before that.  
  
There is only one built-in postfix operator, ! for factorial.  
Label it deprecated in the docs and in pg_description, and adjust  
some examples that formerly relied on it.  (The sister prefix  
operator !! is also deprecated.  We don't really have to remove  
that one, but since we're suggesting that people use factorial()  
instead, it seems better to remove both operators.)  
  
Also state in the CREATE OPERATOR ref page that postfix operators  
in general are going away.  
  
Although this changes the initial contents of pg_description,  
I did not force a catversion bump; it doesn't seem essential.  
  
In v13, also back-patch 4c5cf5431, so that there's someplace for  
the <link>s to point to.  
  
Mark Dilger and John Naylor, with some adjustments by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/typeconv.sgml
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_proc.dat

Fix code for re-finding scan position in a multicolumn GIN index.

commit   : 1df14a5669428c0060ebdcebed8c1f807b659893    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Aug 2020 17:36:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Aug 2020 17:36:13 -0400    

Click here for diff

collectMatchBitmap() needs to re-find the index tuple it was previously  
looking at, after transiently dropping lock on the index page it's on.  
The tuple should still exist and be at its prior position or somewhere  
to the right of that, since ginvacuum never removes tuples but  
concurrent insertions could add one.  However, there was a thinko in  
that logic, to the effect of expecting any inserted tuples to have the  
same index "attnum" as what we'd been scanning.  Since there's no  
physical separation of tuples with different attnums, it's not terribly  
hard to devise scenarios where this fails, leading to transient "lost  
saved point in index" errors.  (While I've duplicated this with manual  
testing, it seems impossible to make a reproducible test case with our  
available testing technology.)  
  
Fix by just continuing the scan when the attnum doesn't match.  
  
While here, improve the error message used if we do fail, so that it  
matches the wording used in btree for a similar case.  
  
collectMatchBitmap()'s posting-tree code path was previously not  
exercised at all by our regression tests.  While I can't make  
a regression test that exhibits the bug, I can at least improve  
the code coverage here, so do that.  The test case I made for this  
is an extension of one added by 4b754d6c1, so it only works in  
HEAD and v13; didn't seem worth trying hard to back-patch it.  
  
Per bug #16595 from Jesse Kinkead.  This has been broken since  
multicolumn capability was added to GIN (commit 27cb66fdf),  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gin/ginget.c
M src/test/regress/expected/gin.out
M src/test/regress/sql/gin.sql

docs: client certificates are always sent to the server

commit   : 32c42b815ad2377c0bddc4f55b7bf32a5204a87d    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 25 Aug 2020 09:53:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 25 Aug 2020 09:53:12 -0400    

Click here for diff

They are not "requested" by the server.  
  
Reported-by: Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/libpq.sgml

doc: Fix up title case

commit   : 62340f8eca4c9d4e49097eaf0a341aca8450b56b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 25 Aug 2020 07:29:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 25 Aug 2020 07:29:05 +0200    

Click here for diff

This fixes some instances that were missed in earlier processings and  
that now look a bit strange because they are inconsistent with nearby  
titles.  

M doc/src/sgml/dml.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/plpgsql.sgml

Improve the vacuum error context phase information.

commit   : b4ef5ac0b7bfa734ad908bb5577cf4ee65ce2974    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 24 Aug 2020 08:22:54 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 24 Aug 2020 08:22:54 +0530    

Click here for diff

We were displaying the wrong phase information for 'info' message in the  
index clean up phase because we were switching to the previous phase a bit  
early. We were also not displaying context information for heap phase  
unless the block number is valid which is fine for error cases but for  
messages at 'info' or lower error level it appears to be inconsistent with  
index phase information.  
  
Reported-by: Sawada Masahiko  
Author: Sawada Masahiko  
Reviewed-by: Amit Kapila  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/CA+fd4k4HcbhPnCs7paRTw1K-AHin8y4xKomB9Ru0ATw0UeTy2w@mail.gmail.com  

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

Avoid pushing quals down into sub-queries that have grouping sets.

commit   : de627adaad3a161b3ae0cafeb76c20519845799b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Aug 2020 14:46:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Aug 2020 14:46:40 -0400    

Click here for diff

The trouble with doing this is that an apparently-constant subquery  
output column isn't really constant if it is a grouping column that  
appears in only some of the grouping sets.  A qual using such a  
column would be subject to incorrect const-folding after push-down,  
as seen in bug #16585 from Paul Sivash.  
  
To fix, just disable qual pushdown altogether if the sub-query has  
nonempty groupingSets.  While we could imagine far less restrictive  
solutions, there is not much point in working harder right now,  
because subquery_planner() won't move HAVING clauses to WHERE within  
such a subquery.  If the qual stays in HAVING it's not going to be  
a lot more useful than if we'd kept it at the outer level.  
  
Having said that, this restriction could be removed if we used a  
parsetree representation that distinguished such outputs from actual  
constants, which is something I hope to do in future.  Hence, make  
the patch a minimal addition rather than integrating it more tightly  
(e.g. by renumbering the existing items in subquery_is_pushdown_safe's  
comment).  
  
Back-patch to 9.5 where grouping sets were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

Fix ALTER TABLE's scheduling rules for AT_AddConstraint subcommands.

commit   : 47de6ac11b53cf24393a2ef048f9e8921163da0a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Aug 2020 12:34:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Aug 2020 12:34:17 -0400    

Click here for diff

Commit 1281a5c90 rearranged the logic in this area rather drastically,  
and it broke the case of adding a foreign key constraint in the same  
ALTER that adds the pkey or unique constraint it depends on.  While  
self-referential fkeys are surely a pretty niche case, this used to  
work so we shouldn't break it.  
  
To fix, reorganize the scheduling rules in ATParseTransformCmd so  
that a transformed AT_AddConstraint subcommand will be delayed into  
a later pass in all cases, not only when it's been spit out as a  
side-effect of parsing some other command type.  
  
Also tweak the logic so that we won't run ATParseTransformCmd twice  
while doing this.  It seems to work even without that, but it's  
surely wasting cycles to do so.  
  
Per bug #16589 from Jeremy Evans.  Back-patch to v13 where the new  
code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Fix format, incorrect structure names and markup inconsistencies

commit   : 610394c7b876bc841464aad38f8abed09d63924e    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 22 Aug 2020 22:26:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 22 Aug 2020 22:26:18 +0900    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M doc/src/sgml/datetime.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/protocol.sgml

docs: improve description of how to handle multiple databases

commit   : 3669792934593a7b682c5b32dea41c9e3b48e6cc    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 21 Aug 2020 20:23:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 21 Aug 2020 20:23:09 -0400    

Click here for diff

This is a redesign of the intro to the managing databases chapter.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: David G. Johnston  
  
Backpatch-through: 9.5  

M doc/src/sgml/manage-ag.sgml

docs: add COMMENT examples for new features, rename rtree

commit   : 35f2d22ba909735448606fefc126b73e4fb3c627    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 21 Aug 2020 18:29:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 21 Aug 2020 18:29:37 -0400    

Click here for diff

Reported-by: Jürgen Purtz  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Jürgen Purtz  
  
Backpatch-through: 11  

M doc/src/sgml/ref/comment.sgml

Fix handling of CREATE TABLE LIKE with inheritance.

commit   : 894f5dea76e1a59fa2f3e1905c6a44f254d9d08b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2020 15:00:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Aug 2020 15:00:42 -0400    

Click here for diff

If a CREATE TABLE command uses both LIKE and traditional inheritance,  
Vars in CHECK constraints and expression indexes that are absorbed  
from a LIKE parent table tended to get mis-numbered, resulting in  
wrong answers and/or bizarre error messages (though probably not any  
actual crashes, thanks to validation occurring in the executor).  
  
In v12 and up, the same could happen to Vars in GENERATED expressions,  
even in cases with no LIKE clause but multiple traditional-inheritance  
parents.  
  
The cause of the problem for LIKE is that parse_utilcmd.c supposed  
it could renumber such Vars correctly during transformCreateStmt(),  
which it cannot since we have not yet accounted for columns added via  
inheritance.  Fix that by postponing processing of LIKE INCLUDING  
CONSTRAINTS, DEFAULTS, GENERATED, INDEXES till after we've performed  
DefineRelation().  
  
The error with GENERATED and multiple inheritance is a simple oversight  
in MergeAttributes(); it knows it has to renumber Vars in inherited  
CHECK constraints, but forgot to apply the same processing to inherited  
GENERATED expressions (a/k/a defaults).  
  
Per bug #16272 from Tom Gottfried.  The non-GENERATED variants of the  
issue are ancient, presumably dating right back to the addition of  
CREATE TABLE LIKE; hence back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/include/nodes/parsenodes.h
M src/include/parser/parse_utilcmd.h
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/sql/create_table_like.sql

Fix explain regression test failure.

commit   : bc2ebf3acfd287247cd9ee286c44e969af1c81de    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 22 Aug 2020 01:22:55 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 22 Aug 2020 01:22:55 +0900    

Click here for diff

Commit 9d701e624f caused the regression test for EXPLAIN to fail on  
the buildfarm member prion. This happened because of instability of  
test output, i.e., in text format, whether "Planning:" line is output  
varies depending on the system state.  
  
This commit updated the regression test so that it ignores that  
"Planning:" line to produce more stable test output and get rid of  
the test failure.  
  
Back-patch to v13.  
  
Author: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

Rework EXPLAIN for planner's buffer usage.

commit   : 674899ae02c375b03411c0676e7cfb4bafeebac9    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 21 Aug 2020 20:48:59 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 21 Aug 2020 20:48:59 +0900    

Click here for diff

Commit ce77abe63c allowed EXPLAIN (BUFFERS) to report the information  
on buffer usage during planning phase. However three issues were  
reported regarding this feature.  
  
(1) Previously, EXPLAIN option BUFFERS required ANALYZE. So the query  
    had to be actually executed by specifying ANALYZE even when we  
    want to see only the planner's buffer usage. This was inconvenient  
    especially when the query was write one like DELETE.  
  
(2) EXPLAIN included the planner's buffer usage in summary  
    information. So SUMMARY option had to be enabled to report that.  
    Also this format was confusing.  
  
(3) The output structure for planning information was not consistent  
    between TEXT format and the others. For example, "Planning" tag  
    was output in JSON format, but not in TEXT format.  
  
For (1), this commit allows us to perform EXPLAIN (BUFFERS) without  
ANALYZE to report the planner's buffer usage.  
  
For (2), this commit changed EXPLAIN output so that the planner's  
buffer usage is reported before summary information.  
  
For (3), this commit made the output structure for planning  
information more consistent between the formats.  
  
Back-patch to v13 where the planner's buffer usage was allowed to  
be reported in EXPLAIN.  
  
Reported-by: Pierre Giraud, David Rowley  
Author: Fujii Masao  
Reviewed-by: David Rowley, Julien Rouhaud, Pierre Giraud  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Fix a few typos in JIT comments and README

commit   : 0d7437de73b68b0105d00ff4fed3e7894b02f6d5    
  
author   : David Rowley <[email protected]>    
date     : Fri, 21 Aug 2020 09:34:47 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 21 Aug 2020 09:34:47 +1200    

Click here for diff

Reviewed-by: Abhijit Menon-Sen  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CAApHDvobgmCs6CohqhKTUf7D8vffoZXQTCBTERo9gbOeZmvLTw%40mail.gmail.com  
Backpatch-through: 11, where JIT was added  

M src/backend/jit/README
M src/include/jit/llvmjit_emit.h

Revise REINDEX CONCURRENTLY recovery instructions

commit   : 2a9f042c47053e3ce73f634cce9622fa0151f63c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 20 Aug 2020 13:49:04 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 20 Aug 2020 13:49:04 -0400    

Click here for diff

When the leftover invalid index is "ccold", there's no need to re-run  
the command.  Reword the instructions to make that explicit.  
  
Backpatch to 12, where REINDEX CONCURRENTLY appeared.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/reindex.sgml

Suppress unnecessary RelabelType nodes in yet more cases.

commit   : 69ffc2f838990fb2c802087091ce7c2ff1b735eb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Aug 2020 14:07:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Aug 2020 14:07:49 -0400    

Click here for diff

Commit a477bfc1d fixed eval_const_expressions() to ensure that it  
didn't generate unnecessary RelabelType nodes, but I failed to notice  
that some other places in the planner had the same issue.  Really  
noplace in the planner should be using plain makeRelabelType(), for  
fear of generating expressions that should be equal() to semantically  
equivalent trees, but aren't.  
  
An example is that because canonicalize_ec_expression() failed  
to be careful about this, we could end up with an equivalence class  
containing both a plain Const, and a Const-with-RelabelType  
representing exactly the same value.  So far as I can tell this led to  
no visible misbehavior, but we did waste a bunch of cycles generating  
and evaluating "Const = Const-with-RelabelType" to prove such entries  
are redundant.  
  
Hence, move the support function added by a477bfc1d to where it can  
be more generally useful, and use it in the places where planner code  
previously used makeRelabelType.  
  
Back-patch to v12, like the previous patch.  While I have no concrete  
evidence of any real misbehavior here, it's certainly possible that  
I overlooked a case where equivalent expressions that aren't equal()  
could cause a user-visible problem.  In any case carrying extra  
RelabelType nodes through planning to execution isn't very desirable.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/nodeFuncs.h

Avoid non-constant format string argument to fprintf().

commit   : bff41b2b8938f5e3e7d536da6d7a14a1648b4dec    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Aug 2020 13:13:09 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 18 Aug 2020 13:13:09 +0300    

Click here for diff

As Tom Lane pointed out, it could defeat the compiler's printf() format  
string verification.  
  
Backpatch to v12, like that patch that introduced it.  
  
Discussion: https://www.postgresql.org/message-id/1069283.1597672779%40sss.pgh.pa.us  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/pg_rewind.c

Disable autovacuum for BRIN test table

commit   : b83f1bcca0bb460413da4ce856b030502b4f71c5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 17 Aug 2020 16:20:06 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 17 Aug 2020 16:20:06 -0400    

Click here for diff

This should improve stability in the tests.  
  
Per buildfarm member hyrax (CLOBBER_CACHE_ALWAYS) via Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: fix description of UNION/CASE/etc type unification.

commit   : 8216a1d3ed27364c7b2a9e6db76f15202a6070c1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Aug 2020 15:40:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Aug 2020 15:40:07 -0400    

Click here for diff

The description of what select_common_type() does was not terribly  
accurate.  Improve it.  
  
David Johnston and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/typeconv.sgml

Fix printing last progress report line in client programs.

commit   : 5ca1798f32b7fe730fef7ccd8d69e785a50134b8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Aug 2020 09:27:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 17 Aug 2020 09:27:29 +0300    

Click here for diff

A number of client programs have a "--progress" option that when printing  
to a TTY, updates the current line by printing a '\r' and overwriting it.  
After the last line, '\n' needs to be printed to move the cursor to the  
next line. pg_basebackup and pgbench got this right, but pg_rewind and  
pg_checksums were slightly wrong. pg_rewind printed the newline to stdout  
instead of stderr, and pg_checksums printed the newline even when not  
printing to a TTY. Fix them, and also add a 'finished' argument to  
pg_basebackup's progress_report() function, to keep it consistent with  
the other programs.  
  
Backpatch to v12. pg_rewind's newline was broken with the logging changes  
in commit cc8d415117 in v12, and pg_checksums was introduced in v12.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h

doc: Fix description about bgwriter and checkpoint in HA section

commit   : 3424c6bef0b897f9c6800f55d34a162a07319795    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Aug 2020 10:24:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Aug 2020 10:24:24 +0900    

Click here for diff

Since 806a2ae, the work of the bgwriter is split the checkpointer, but a  
portion of the documentation did not get the message.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CA+fd4k6jXxjAtjMVC=wG3=QGpauZBtcgN3Jhw+oV7zXGKVLKzQ@mail.gmail.com  
Backpatch-through: 9.5  

M doc/src/sgml/high-availability.sgml

Doc: various improvements for pg_basebackup reference page.

commit   : 277e49eca73a719695d0b74360b54124e76c6833    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2020 15:43:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Aug 2020 15:43:34 -0400    

Click here for diff

Put the -r option in the right section (it certainly isn't an  
option controlling "the location and format of the output").  
  
Clarify the behavior of the tablespace and waldir options  
(that part per gripe from [email protected]).  
  
Make a large number of small copy-editing fixes in text that  
visibly wasn't written by native speakers, and try to avoid  
grammatical inconsistencies between the descriptions of  
the different options.  
  
Back-patch to v13, since HEAD hasn't meaningfully diverged yet.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_basebackup.sgml

Prevent concurrent SimpleLruTruncate() for any given SLRU.

commit   : 592a589a04bd456410b853d86bd05faa9432cbbb    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 15 Aug 2020 10:15:53 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 15 Aug 2020 10:15:53 -0700    

Click here for diff

The SimpleLruTruncate() header comment states the new coding rule.  To  
achieve this, add locktype "frozenid" and two LWLocks.  This closes a  
rare opportunity for data loss, which manifested as "apparent  
wraparound" or "could not access status of transaction" errors.  Data  
loss is more likely in pg_multixact, due to released branches' thin  
margin between multiStopLimit and multiWrapLimit.  If a user's physical  
replication primary logged ":  apparent wraparound" messages, the user  
should rebuild standbys of that primary regardless of symptoms.  At less  
risk is a cluster having emitted "not accepting commands" errors or  
"must be vacuumed" warnings at some point.  One can test a cluster for  
this data loss by running VACUUM FREEZE in every database.  Back-patch  
to 9.5 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/commands/vacuum.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/adt/lockfuncs.c
M src/include/storage/lmgr.h
M src/include/storage/lock.h

Be more careful about the shape of hashable subplan clauses.

commit   : b538e83f17e36fd0fe0686815da0ff5866ce8a64    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Aug 2020 22:14:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Aug 2020 22:14:03 -0400    

Click here for diff

nodeSubplan.c expects that the testexpr for a hashable ANY SubPlan  
has the form of one or more OpExprs whose LHS is an expression of the  
outer query's, while the RHS is an expression over Params representing  
output columns of the subquery.  However, the planner only went as far  
as verifying that the clauses were all binary OpExprs.  This works  
99.99% of the time, because the clauses have the right shape when  
emitted by the parser --- but it's possible for function inlining to  
break that, as reported by PegoraroF10.  To fix, teach the planner  
to check that the LHS and RHS contain the right things, or more  
accurately don't contain the wrong things.  Given that this has been  
broken for years without anyone noticing, it seems sufficient to just  
give up hashing when it happens, rather than go to the trouble of  
commuting the clauses back again (which wouldn't necessarily work  
anyway).  
  
While poking at that, I also noticed that nodeSubplan.c had a baked-in  
assumption that the number of hash clauses is identical to the number  
of subquery output columns.  Again, that's fine as far as parser output  
goes, but it's not hard to break it via function inlining.  There seems  
little reason for that assumption though --- AFAICS, the only thing  
it's buying us is not having to store the number of hash clauses  
explicitly.  Adding code to the planner to reject such cases would take  
more code than getting nodeSubplan.c to cope, so I fixed it that way.  
  
This has been broken for as long as we've had hashable SubPlans,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeSubplan.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/execnodes.h
M src/include/optimizer/clauses.h
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

pg_dump: fix dependencies on FKs to partitioned tables

commit   : b7cc21c57d738b41f6116f46d566b9949a433747    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Aug 2020 17:33:31 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Aug 2020 17:33:31 -0400    

Click here for diff

Parallel-restoring a foreign key that references a partitioned table  
with several levels of partitions can fail:  
  
pg_restore: while PROCESSING TOC:  
pg_restore: from TOC entry 6684; 2606 29166 FK CONSTRAINT fk fk_a_fkey postgres  
pg_restore: error: could not execute query: ERROR:  there is no unique constraint matching given keys for referenced table "pk"  
Command was: ALTER TABLE fkpart3.fk  
    ADD CONSTRAINT fk_a_fkey FOREIGN KEY (a) REFERENCES fkpart3.pk(a);  
  
This happens in parallel restore mode because some index partitions  
aren't yet attached to the topmost partitioned index that the FK uses,  
and so the index is still invalid.  The current code marks the FK as  
dependent on the first level of index-attach dump objects; the bug is  
fixed by recursively marking the FK on their children.  
  
Backpatch to 12, where FKs to partitioned tables were introduced.  
  
Reported-by: Tom Lane <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-master  

M src/bin/pg_dump/pg_dump.c

Fix postmaster's behavior during smart shutdown.

commit   : 1c6066fbdb70a92b10b8616652d25c4434cd222e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Aug 2020 13:26:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Aug 2020 13:26:57 -0400    

Click here for diff

Up to now, upon receipt of a SIGTERM ("smart shutdown" command), the  
postmaster has immediately killed all "optional" background processes,  
and subsequently refused to launch new ones while it's waiting for  
foreground client processes to exit.  No doubt this seemed like an OK  
policy at some point; but it's a pretty bad one now, because it makes  
for a seriously degraded environment for the remaining clients:  
  
* Parallel queries are killed, and new ones fail to launch. (And our  
parallel-query infrastructure utterly fails to deal with the case  
in a reasonable way --- it just hangs waiting for workers that are  
not going to arrive.  There is more work needed in that area IMO.)  
  
* Autovacuum ceases to function.  We can tolerate that for awhile,  
but if bulk-update queries continue to run in the surviving client  
sessions, there's eventually going to be a mess.  In the worst case  
the system could reach a forced shutdown to prevent XID wraparound.  
  
* The bgwriter and walwriter are also stopped immediately, likely  
resulting in performance degradation.  
  
Hence, let's rearrange things so that the only immediate change in  
behavior is refusing to let in new normal connections.  Once the last  
normal connection is gone, shut everything down as though we'd received  
a "fast" shutdown.  To implement this, remove the PM_WAIT_BACKUP and  
PM_WAIT_READONLY states, instead staying in PM_RUN or PM_HOT_STANDBY  
while normal connections remain.  A subsidiary state variable tracks  
whether or not we're letting in new connections in those states.  
  
This also allows having just one copy of the logic for killing child  
processes in smart and fast shutdown modes.  I moved that logic into  
PostmasterStateMachine() by inventing a new state PM_STOP_BACKENDS.  
  
Back-patch to 9.6 where parallel query was added.  In principle  
this'd be a good idea in 9.5 as well, but the risk/reward ratio  
is not as good there, since lack of autovacuum is not a problem  
during typical uses of smart shutdown.  
  
Per report from Bharath Rupireddy.  
  
Patch by me, reviewed by Thomas Munro  
  
Discussion: https://postgr.es/m/CALj2ACXAZ5vKxT9P7P89D87i3MDO9bfS+_bjMHgnWJs8uwUOOw@mail.gmail.com  

M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/postinit.c
M src/include/libpq/libpq-be.h

Fix typo in test comment.

commit   : cabec1dbdf405211c1a4d30f52a91e8de2cf7226    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 14 Aug 2020 10:40:50 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 14 Aug 2020 10:40:50 +0300    

Click here for diff

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

commit   : 124772e3cac6d3bf6c1f6d32518209c6a3fdd3eb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Aug 2020 20:00:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Aug 2020 20:00:39 -0400    

Click here for diff

Make these examples self-contained by providing declarations of the  
user-defined row types they rely on.  There wasn't room to do this  
in the old doc format, but now there is, and I think it makes the  
examples a good bit less confusing.  

M doc/src/sgml/func.sgml

Handle new HOT chains in index-build table scans

commit   : 2f29fd4cb2522dfd64888892f0442a0ead8c6dd0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2020 17:33:49 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Aug 2020 17:33:49 -0400    

Click here for diff

When a table is scanned by heapam_index_build_range_scan (née  
IndexBuildHeapScan) and the table lock being held allows concurrent data  
changes, it is possible for new HOT chains to sprout in a page that were  
unknown when the scan of a page happened.  This leads to an error such  
as  
  ERROR:  failed to find parent tuple for heap-only tuple at (X,Y) in table "tbl"  
because the root tuple was not present when we first obtained the list  
of the page's root tuples.  This can be fixed by re-obtaining the list  
of root tuples, if we see that a heap-only tuple appears to point to a  
non-existing root.  
  
This was reported by Anastasia as occurring for BRIN summarization  
(which exists since 9.5), but I think it could theoretically also happen  
with CREATE INDEX CONCURRENTLY (much older) or REINDEX CONCURRENTLY  
(very recent).  It seems a happy coincidence that BRIN forces us to  
backpatch this all the way to 9.5.  
  
Reported-by: Anastasia Lubennikova <[email protected]>  
Diagnosed-by: Anastasia Lubennikova <[email protected]>  
Co-authored-by: Anastasia Lubennikova <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5 - master  

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

BRIN: Handle concurrent desummarization properly

commit   : 8782ea2f36a2468e08c227c8d7907a5a1a9f5e32    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Aug 2020 15:33:36 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Aug 2020 15:33:36 -0400    

Click here for diff

If a page range is desummarized at just the right time concurrently with  
an index walk, BRIN would raise an error indicating index corruption.  
This is scary and unhelpful; silently returning that the page range is  
not summarized is sufficient reaction.  
  
This bug was introduced by commit 975ad4e602ff as additional protection  
against a bug whose actual fix was elsewhere.  Backpatch equally.  
  
Reported-By: Anastasia Lubennikova <[email protected]>  
Diagnosed-By: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5 - master  

M src/backend/access/brin/brin_revmap.c

Stamp 13beta3.

commit   : 1754a71986e806330ac3ab9e8125c902286b829d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2020 17:12:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2020 17:12:51 -0400    

Click here for diff

M configure
M configure.in

Document clashes between logical replication and untrusted users.

commit   : b601f24c875d79e747eb8b50a4b1555ac22cf8f9    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 10 Aug 2020 09:22:54 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 10 Aug 2020 09:22:54 -0700    

Click here for diff

Back-patch to v10, which introduced logical replication.  
  
Security: CVE-2020-14349  

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

Empty search_path in logical replication apply worker and walsender.

commit   : 412c5c4010c0bec294f60a10cd56929680d3f95b    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 10 Aug 2020 09:22:54 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 10 Aug 2020 09:22:54 -0700    

Click here for diff

This is like CVE-2018-1058 commit  
582edc369cdbd348d68441fc50fa26a84afd0c1a.  Today, a malicious user of a  
publisher or subscriber database can invoke arbitrary SQL functions  
under an identity running replication, often a superuser.  This fix may  
cause "does not exist" or "no schema has been selected to create in"  
errors in a replication process.  After upgrading, consider watching  
server logs for these errors.  Objects accruing schema qualification in  
the wake of the earlier commit are unlikely to need further correction.  
Back-patch to v10, which introduced logical replication.  
  
Security: CVE-2020-14349  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/worker.c
M src/test/subscription/t/001_rep_changes.pl

Move connect.h from fe_utils to src/include/common.

commit   : 41dae35532d40041297ee728eac1f4584af05570    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 10 Aug 2020 09:22:54 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 10 Aug 2020 09:22:54 -0700    

Click here for diff

Any libpq client can use the header.  Clients include backend components  
postgres_fdw, dblink, and logical replication apply worker.  Back-patch  
to v10, because another fix needs this.  In released branches, just copy  
the header and keep the original.  

M contrib/oid2name/oid2name.c
M contrib/vacuumlo/vacuumlo.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_upgrade/server.c
M src/bin/scripts/common.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/cancel.c
R096 src/include/fe_utils/connect.h src/include/common/connect.h
M src/tools/findoidjoins/findoidjoins.c

Make contrib modules' installation scripts more secure.

commit   : 98ca64899cec6a4bf3099481aff43b8777319c41    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2020 10:44:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Aug 2020 10:44:42 -0400    

Click here for diff

Hostile objects located within the installation-time search_path could  
capture references in an extension's installation or upgrade script.  
If the extension is being installed with superuser privileges, this  
opens the door to privilege escalation.  While such hazards have existed  
all along, their urgency increases with the v13 "trusted extensions"  
feature, because that lets a non-superuser control the installation path  
for a superuser-privileged script.  Therefore, make a number of changes  
to make such situations more secure:  
  
* Tweak the construction of the installation-time search_path to ensure  
that references to objects in pg_catalog can't be subverted; and  
explicitly add pg_temp to the end of the path to prevent attacks using  
temporary objects.  
  
* Disable check_function_bodies within installation/upgrade scripts,  
so that any security gaps in SQL-language or PL-language function bodies  
cannot create a risk of unwanted installation-time code execution.  
  
* Adjust lookup of type input/receive functions and join estimator  
functions to complain if there are multiple candidate functions.  This  
prevents capture of references to functions whose signature is not the  
first one checked; and it's arguably more user-friendly anyway.  
  
* Modify various contrib upgrade scripts to ensure that catalog  
modification queries are executed with secure search paths.  (These  
are in-place modifications with no extension version changes, since  
it is the update process itself that is at issue, not the end result.)  
  
Extensions that depend on other extensions cannot be made fully secure  
by these methods alone; therefore, revert the "trusted" marking that  
commit eb67623c9 applied to earthdistance and hstore_plperl, pending  
some better solution to that set of issues.  
  
Also add documentation around these issues, to help extension authors  
write secure installation scripts.  
  
Patch by me, following an observation by Andres Freund; thanks  
to Noah Misch for review.  
  
Security: CVE-2020-14350  

M contrib/btree_gist/btree_gist–1.1–1.2.sql
M contrib/citext/citext–1.1–1.2.sql
M contrib/citext/citext–1.2–1.3.sql
M contrib/cube/cube–1.1–1.2.sql
M contrib/cube/cube–1.3–1.4.sql
M contrib/earthdistance/earthdistance–1.1.sql
M contrib/earthdistance/earthdistance.control
M contrib/hstore/hstore–1.1–1.2.sql
M contrib/hstore/hstore–1.3–1.4.sql
M contrib/hstore_plperl/hstore_plperl.control
M contrib/intagg/intagg–1.0–1.1.sql
M contrib/intarray/intarray–1.1–1.2.sql
M contrib/ltree/ltree–1.0–1.1.sql
M contrib/pg_trgm/pg_trgm–1.2–1.3.sql
M contrib/seg/seg–1.0–1.1.sql
M contrib/seg/seg–1.2–1.3.sql
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/ref/create_extension.sgml
M src/backend/commands/extension.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/typecmds.c

Translation updates

commit   : 378bd1ed6e4314a8b8b32c555f73524c2283b016    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Aug 2020 15:15:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Aug 2020 15:15:50 +0200    

Click here for diff

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

M src/bin/initdb/po/uk.po
M src/bin/pg_archivecleanup/po/uk.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_checksums/nls.mk
A src/bin/pg_checksums/po/uk.po
A src/bin/pg_checksums/po/zh_CN.po
M src/bin/pg_config/po/uk.po
M src/bin/pg_controldata/po/uk.po
M src/bin/pg_ctl/po/uk.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_resetwal/nls.mk
A src/bin/pg_resetwal/po/uk.po
M src/bin/pg_rewind/nls.mk
A src/bin/pg_rewind/po/uk.po
M src/bin/pg_test_fsync/po/uk.po
M src/bin/pg_test_timing/po/uk.po
M src/bin/pg_verifybackup/nls.mk
A src/bin/pg_verifybackup/po/zh_CN.po
M src/bin/pg_waldump/nls.mk
A src/bin/pg_waldump/po/uk.po
M src/bin/pg_waldump/po/zh_CN.po
M src/bin/psql/po/uk.po
M src/interfaces/ecpg/ecpglib/po/uk.po
M src/interfaces/ecpg/preproc/po/uk.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/uk.po
M src/interfaces/libpq/po/zh_CN.po
M src/pl/plpgsql/src/po/uk.po
M src/pl/plpython/po/uk.po
M src/pl/tcl/po/uk.po

Doc: update v13 release notes for changes through today.

commit   : bc635dd16388015c72e47a4b90c4c3ceecebb0cd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Aug 2020 16:59:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Aug 2020 16:59:53 -0400    

Click here for diff

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

Check for fseeko() failure in pg_dump's _tarAddFile().

commit   : dd63a71ebe3937e0ec965248513fb71e45ee0ec8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Aug 2020 12:39:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Aug 2020 12:39:08 -0400    

Click here for diff

Coverity pointed out, not unreasonably, that we checked fseeko's  
result at every other call site but these.  Failure to seek in the  
temp file (note this is NOT pg_dump's output file) seems quite  
unlikely, and even if it did happen the file length cross-check  
further down would probably detect the problem.  Still, that's a  
poor excuse for not checking the result of a system call.  

M src/bin/pg_dump/pg_backup_tar.c

walsnd: Don't set waiting_for_ping_response spuriously

commit   : 900429d0c03668ac474770c01ba5911b15025dfb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 8 Aug 2020 12:31:55 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 8 Aug 2020 12:31:55 -0400    

Click here for diff

Ashutosh Bapat noticed that when logical walsender needs to wait for  
WAL, and it realizes that it must send a keepalive message to  
walreceiver to update the sent-LSN, which *does not* request a reply  
from walreceiver, it wrongly sets the flag that it's going to wait for  
that reply.  That means that any future would-be sender of feedback  
messages ends up not sending a feedback message, because they all  
believe that a reply is expected.  
  
With built-in logical replication there's not much harm in this, because  
WalReceiverMain will send a ping-back every wal_receiver_timeout/2  
anyway; but with other logical replication systems (e.g. pglogical) it  
can cause significant pain.  
  
This problem was introduced in commit 41d5f8ad734, where the  
request-reply flag was changed from true to false to WalSndKeepalive,  
without at the same time removing the line that sets  
waiting_for_ping_response.  
  
Just removing that line would be a sufficient fix, but it seems better  
to shift the responsibility of setting the flag to WalSndKeepalive  
itself instead of requiring caller to do it; this is clearly less  
error-prone.  
  
Author: Álvaro Herrera <[email protected]>  
Reported-by: Ashutosh Bapat <[email protected]>  
Backpatch: 9.5 and up  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Add list of acknowledgments to release notes

commit   : f1c3a41bd695c4ba97d50ffa4b2ab2a72068bd3b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Aug 2020 20:38:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Aug 2020 20:38:55 +0200    

Click here for diff

This contains all individuals mentioned in the commit messages during  
PostgreSQL 13 development.  
  
current through 79a3ab1e98d6b5952e29ad91e07c0e9fc777cc0b  

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

Fix yet another issue with step generation in partition pruning.

commit   : 79a3ab1e98d6b5952e29ad91e07c0e9fc777cc0b    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 7 Aug 2020 14:45:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 7 Aug 2020 14:45:01 +0900    

Click here for diff

Commit 13838740f fixed some issues with step generation in partition  
pruning, but there was yet another one: get_steps_using_prefix() assumes  
that clauses in the passed-in prefix list are sorted in ascending order  
of their partition key numbers, but the caller failed to ensure this for  
range partitioning, which led to an assertion failure in debug builds.  
Adjust the caller function to arrange the clauses in the prefix list in  
the required order for range partitioning.  
  
Back-patch to v11, like the previous commit.  
  
Patch by me, reviewed by Amit Langote.  
  
Discussion: https://postgr.es/m/CAPmGK16jkXiFG0YqMbU66wte-oJTfW6D1HaNvQf%3D%2B5o9%3Dm55wQ%40mail.gmail.com  

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

amcheck: Sanitize metapage's allequalimage field.

commit   : be9bdab983cfc44db1d7f8c06df7d7a7cbcb8128    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 6 Aug 2020 15:25:47 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 6 Aug 2020 15:25:47 -0700    

Click here for diff

This will be helpful if it ever proves necessary to revoke an opclass's  
support for deduplication.  
  
Backpatch: 13-, where nbtree deduplication was introduced.  

M contrib/amcheck/verify_nbtree.c

Fix bogus EXPLAIN output for Hash Aggregate

commit   : 05dfb813245bf3b896b5317570a24a3d66e97a41    
  
author   : David Rowley <[email protected]>    
date     : Fri, 7 Aug 2020 10:22:08 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 7 Aug 2020 10:22:08 +1200    

Click here for diff

9bdb300de modified the EXPLAIN output for Hash Aggregate to show details  
from parallel workers. However, it neglected to consider that a given  
parallel worker may not have assisted with the given Hash Aggregate. This  
can occur when workers fail to start or during Parallel Append with  
enable_partitionwise_join enabled when only a single worker is working on  
a non-parallel aware sub-plan. It could also happen if a worker simply  
wasn't fast enough to get any work done before other processes went and  
finished all the work.  
  
The bogus output came from the fact that ExplainOpenWorker() skipped  
showing any details for non-initialized workers but show_hashagg_info()  
did show details from the worker.  This meant that the worker properties  
that were shown were not properly attributed to the worker that they  
belong to.  
  
In passing, we also now don't show Hash Aggregate properties for the  
leader process when it did not contribute any work to the Hash Aggregate.  
This can occur either during Parallel Append when only a parallel worker  
worked on a given sub plan or with parallel_leader_participation set to  
off.  This aims to make the behavior of Hash Aggregate's EXPLAIN output  
more similar to Sort's.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20200805012105.GZ28072%40telsasoft.com  
Backpatch-through: 13, where the original breakage was introduced  

M src/backend/commands/explain.c

doc: clarify "state" table reference in tutorial

commit   : d0aa57d0e9441b9fab5de5dbed0cb0afd4fa756d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 5 Aug 2020 17:12:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 5 Aug 2020 17:12:10 -0400    

Click here for diff

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

M doc/src/sgml/advanced.sgml

Fix matching of sub-partitions when a partitioned plan is stale.

commit   : c43a36fa8fff380072d9fc745b1e27baf1a4d3f8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Aug 2020 15:38:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Aug 2020 15:38:55 -0400    

Click here for diff

Since we no longer require AccessExclusiveLock to add a partition,  
the executor may see that a partitioned table has more partitions  
than the planner saw.  ExecCreatePartitionPruneState's code for  
matching up the partition lists in such cases was faulty, and would  
misbehave if the planner had successfully pruned any partitions from  
the query.  (Thus, trouble would occur only if a partition addition  
happens concurrently with a query that uses both static and dynamic  
partition pruning.)  This led to an Assert failure in debug builds,  
and probably to crashes or query misbehavior in production builds.  
  
To repair the bug, just explicitly skip zeroes in the plan's  
relid_map[] list.  I also made some cosmetic changes to make the code  
more readable (IMO anyway).  Also, convert the cross-checking Assert  
to a regular test-and-elog, since it's now apparent that this logic  
is more fragile than one would like.  
  
Currently, there's no way to repeatably exercise this code, except  
with manual use of a debugger to stop the backend between planning  
and execution.  Hence, no test case in this patch.  We oughta do  
something about that testability gap, but that's for another day.  
  
Amit Langote and Tom Lane, per report from Justin Pryzby.  Oversight  
in commit 898e5e329; backpatch to v12 where that appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c

Increase hard-wired timeout values in ecpg regression tests.

commit   : 565f1690264b5773c23b86303645cf11a0893cff    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2020 15:20:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Aug 2020 15:20:31 -0400    

Click here for diff

A couple of test cases had connect_timeout=14, a value that seems  
to have been plucked from a hat.  While it's more than sufficient  
for normal cases, slow/overloaded buildfarm machines can get a timeout  
failure here, as per recent report from "sungazer".  Increase to 180  
seconds, which is in line with our typical timeouts elsewhere in  
the regression tests.  
  
Back-patch to 9.6; the code looks different in 9.5, and this doesn't  
seem to be quite worth the effort to adapt to that.  
  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sungazer&dt=2020-08-04%2007%3A12%3A22  

M src/interfaces/ecpg/test/connect/test1.pgc
M src/interfaces/ecpg/test/connect/test5.pgc
M src/interfaces/ecpg/test/expected/connect-test1-minGW32.stderr
M src/interfaces/ecpg/test/expected/connect-test1.c
M src/interfaces/ecpg/test/expected/connect-test1.stderr
M src/interfaces/ecpg/test/expected/connect-test5.c
M src/interfaces/ecpg/test/expected/connect-test5.stderr

Make new SSL TAP test for channel_binding more robust

commit   : 1a01595cc2ffb20ef9f2bc1a92d39728b65e3797    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Aug 2020 14:36:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Aug 2020 14:36:09 +0900    

Click here for diff

The test would fail in an environment including a certificate file in  
~/.postgresql/.  bdd6e9b fixed a similar failure, and d6e612f introduced  
the same problem again with a new test.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/test/ssl/t/002_scram.pl

doc: PG 13 relnotes: hash_mem_multiplier can restore old behav.

commit   : e7a6cd5dcf24c6d4b04d036a4837c7af154c4b49    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 3 Aug 2020 17:01:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 3 Aug 2020 17:01:42 -0400    

Click here for diff

Document that hash_mem_multiplier can get query behavior closer to the  
pre-PG 13 behavior of allowing hashing to use more memory.  
  
Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-Wzn3kwQm_pe6g2=ki+P7+ZRqH5GvFGn6SWfv_j7UUgcLdQ@mail.gmail.com  
  
Backpatch-through: 13 only  

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

Remove unnecessary "DISTINCT" in psql's queries for \dAc and \dAf.

commit   : 72ca61101ad4076941f175b50cc86e6372023034    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2020 14:02:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2020 14:02:35 -0400    

Click here for diff

A moment's examination of these queries is sufficient to see that  
they do not produce duplicate rows, unless perhaps there's  
catalog corruption.  Using DISTINCT anyway is inefficient and  
confusing; moreover it sets a poor example for anyone who  
refers to psql -E output to see how to query the catalogs.  

M src/bin/psql/describe.c

Doc: fix obsolete info about allowed range of TZ offsets in timetz.

commit   : 6d78f219e8afc57b6ca3765eb2dfa1b8fe095ddc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2020 13:11:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2020 13:11:16 -0400    

Click here for diff

We've allowed UTC offsets up to +/- 15:59 since commit cd0ff9c0f, but  
that commit forgot to fix the documentation about timetz.  
  
Per bug #16571 from osdba.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Fix behavior of ecpg's "EXEC SQL elif name".

commit   : 44cd434ec4a70d2dfbc460492fc0574d08440250    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2020 09:46:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Aug 2020 09:46:12 -0400    

Click here for diff

This ought to work much like C's "#elif defined(name)"; but the code  
implemented it in a way equivalent to endif followed by ifdef, so that  
it didn't matter whether any previous branch of the IF construct had  
succeeded.  Fix that; add some test cases covering elif and nested IFs;  
and improve the documentation, which also seemed a bit confused.  
  
AFAICS the code has been like this since the feature was added in 1999  
(commit b57b0e044).  So while it's surely wrong, there might be code  
out there relying on the current behavior.  Hence, don't back-patch  
into stable branches.  It seems all right to fix it in v13 though.  
  
Per report from Ashutosh Sharma.  Reviewed by Ashutosh Sharma and  
Michael Meskes.  
  
Discussion: https://postgr.es/m/CAE9k0P=dQk9X0cU2tN49S7a9tv733-e1pVdpB1P-pWJ5PdTktg@mail.gmail.com  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/expected/preproc-define.c
M src/interfaces/ecpg/test/expected/preproc-define.stderr
M src/interfaces/ecpg/test/preproc/define.pgc

Fix rare failure in LDAP tests.

commit   : f5293fb09e7346bb663f2f5c63081e8aabe61a8e    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 3 Aug 2020 12:39:15 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 3 Aug 2020 12:39:15 +1200    

Click here for diff

Instead of writing a query to psql's stdin, use -c.  This avoids a  
failure where psql exits before we write, seen a few times on the build  
farm.  Thanks to Tom Lane for the suggestion.  
  
Back-patch to 11, where the LDAP tests arrived.  
  
Reviewed-by: Noah Misch <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLFmW%2BHQYPeKiwSp5sdFFHtFViCpw4Mh6yAgEx74r5-Cw%40mail.gmail.com  

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

commit   : 719304a3043d9f60247df371f55236058a7f3caa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2020 17:00:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Aug 2020 17:00:26 -0400    

Click here for diff

The type-name pattern in \dAc and \dAf was matched only to the actual  
pg_type.typname string, which is fairly user-unfriendly in cases where  
that is not what's shown to the user by format_type (compare "_int4"  
and "integer[]").  Make this code match what \dT does, i.e. match the  
pattern against either typname or format_type() output.  Also fix its  
broken handling of schema-name restrictions.  (IOW, make these  
processSQLNamePattern calls match \dT's.)  While here, adjust  
whitespace to make the query a little prettier in -E output, too.  
  
Also improve some inaccuracies and shaky grammar in the related  
documentation.  
  
Noted while working on a patch for intarray's opclasses; I wondered  
why I couldn't get a match to "integer*" for the input type name.  

M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/describe.c

Use int64 instead of long in incremental sort code

commit   : 22c105595fc736ae94ce3b806da16b0bd8e94fb8    
  
author   : David Rowley <[email protected]>    
date     : Sun, 2 Aug 2020 14:23:57 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 2 Aug 2020 14:23:57 +1200    

Click here for diff

Windows 64bit has 4-byte long values which is not suitable for tracking  
disk space usage in the incremental sort code. Let's just make all these  
fields int64s.  
  
Author: James Coleman  
Discussion: https://postgr.es/m/CAApHDvpky%2BUhof8mryPf5i%3D6e6fib2dxHqBrhp0Qhu0NeBhLJw%40mail.gmail.com  
Backpatch-through: 13, where the incremental sort code was added  

M src/backend/commands/explain.c
M src/include/nodes/execnodes.h
M src/include/utils/tuplesort.h

Restore lost amcheck TOAST test coverage.

commit   : 725b43b9c3b3c25c60ac717c41047ad0dffb1312    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 31 Jul 2020 15:34:26 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 31 Jul 2020 15:34:26 -0700    

Click here for diff

Commit eba77534 fixed an amcheck false positive bug involving  
inconsistencies in TOAST input state between table and index.  A test  
case was added that verified that such an inconsistency didn't result in  
a spurious corruption related error.  
  
Test coverage from the test was accidentally lost by commit 501e41dd,  
which propagated ALTER TABLE ...  SET STORAGE attstorage state to  
indexes.  This broke the test because the test specifically relied on  
attstorage not being propagated.  This artificially forced there to be  
index tuples whose datums were equivalent to the datums in the heap  
without the datums actually being bitwise equal.  
  
Fix this by updating pg_attribute directly instead.  Commit 501e41dd  
made similar changes to a test_decoding TOAST-related test case which  
made the same assumption, but overlooked the amcheck test case.  
  
Backpatch: 11-, just like commit eba77534 (and commit 501e41dd).  

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

Fix oversight in ALTER TYPE: typmodin/typmodout must propagate to arrays.

commit   : 5c439f189bf4bdbb0ff75b2043ca713d76019528    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Jul 2020 17:11:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Jul 2020 17:11:28 -0400    

Click here for diff

If a base type supports typmods, its array type does too, with the  
same interpretation.  Hence changes in pg_type.typmodin/typmodout  
must be propagated to the array type.  
  
While here, improve AlterTypeRecurse to not recurse to domains if  
there is nothing we'd need to change.  
  
Oversight in fe30e7ebf.  Back-patch to v13 where that came in.  

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

Fix recently-introduced performance problem in ts_headline().

commit   : 11dce63d6c3f676a9f1829eca96f085b6d935af0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Jul 2020 11:43:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Jul 2020 11:43:12 -0400    

Click here for diff

The new hlCover() algorithm that I introduced in commit c9b0c678d  
turns out to potentially take O(N^2) or worse time on long documents,  
if there are many occurrences of individual query words but few or no  
substrings that actually satisfy the query.  (One way to hit this  
behavior is with a "common_word & rare_word" type of query.)  This  
seems unavoidable given the original goal of checking every substring  
of the document, so we have to back off that idea.  Fortunately, it  
seems unlikely that anyone would really want headlines spanning all of  
a long document, so we can avoid the worse-than-linear behavior by  
imposing a maximum length of substring that we'll consider.  
  
For now, just hard-wire that maximum length as a multiple of max_words  
times max_fragments.  Perhaps at some point somebody will argue for  
exposing it as a ts_headline parameter, but I'm hesitant to make such  
a feature addition in a back-patched bug fix.  
  
I also noted that the hlFirstIndex() function I'd added in that  
commit was unnecessarily stupid: it really only needs to check whether  
a HeadlineWordEntry's item pointer is null or not.  This wouldn't make  
all that much difference in typical cases with queries having just  
a few terms, but a cycle shaved is a cycle earned.  
  
In addition, add a CHECK_FOR_INTERRUPTS call in TS_execute_recurse.  
This ensures that hlCover's loop is cancellable if it manages to take  
a long time, and it may protect some other TS_execute callers as well.  
  
Back-patch to 9.6 as the previous commit was.  I also chose to add the  
CHECK_FOR_INTERRUPTS call to 9.5.  The old hlCover() algorithm seems  
to avoid the O(N^2) behavior, at least on the test case I tried, but  
nonetheless it's not very quick on a long document.  
  
Per report from Stephen Frost.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/tsvector_op.c

Doc: fix high availability solutions comparison.

commit   : 0d9b64fe8d2d98f8f074334f86aaaedfb2b5a1e1    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Fri, 31 Jul 2020 07:46:25 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Fri, 31 Jul 2020 07:46:25 +0900    

Click here for diff

In "High Availability, Load Balancing, and Replication" chapter,  
certain descriptions of Pgpool-II were not correct at this point.  It  
does not need conflict resolution. Also "Multiple-Server Parallel  
Query Execution" is not supported anymore.  
  
Discussion: https://postgr.es/m/20200726.230128.53842489850344110.t-ishii%40sraoss.co.jp  
Author: Tatsuo Ishii  
Reviewed-by: Bruce Momjian  
Backpatch-through: 9.5  

M doc/src/sgml/high-availability.sgml

Use pg_bitutils for HyperLogLog.

commit   : 07cbcdd00c2465a844513f14b7a96232013d3129    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 30 Jul 2020 08:44:58 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 30 Jul 2020 08:44:58 -0700    

Click here for diff

Using pg_leftmost_one_post32() yields substantial performance benefits.  
  
Backpatching to version 13 because HLL is used for HashAgg  
improvements in 9878b643, which was also backpatched to 13.  
  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-WzkGvDKVDo+0YvfvZ+1CE=iCi88DCOGFF3i1hTGGaxcKPw@mail.gmail.com  
Backpatch-through: 13  

M src/backend/lib/hyperloglog.c

doc: Mention index references in pg_inherits

commit   : e710f3b8e7da43de2ad8113ce7c7933928092656    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 30 Jul 2020 15:48:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 30 Jul 2020 15:48:52 +0900    

Click here for diff

Partitioned indexes are also registered in pg_inherits, but the  
description of this catalog did not reflect that.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M doc/src/sgml/catalogs.sgml

Add hash_mem_multiplier GUC.

commit   : 78530c8e7a5abe0b646b0b46527f8799f831e1e1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 29 Jul 2020 14:14:57 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 29 Jul 2020 14:14:57 -0700    

Click here for diff

Add a GUC that acts as a multiplier on work_mem.  It gets applied when  
sizing executor node hash tables that were previously size constrained  
using work_mem alone.  
  
The new GUC can be used to preferentially give hash-based nodes more  
memory than the generic work_mem limit.  It is intended to enable admin  
tuning of the executor's memory usage.  Overall system throughput and  
system responsiveness can be improved by giving hash-based executor  
nodes more memory (especially over sort-based alternatives, which are  
often much less sensitive to being memory constrained).  
  
The default value for hash_mem_multiplier is 1.0, which is also the  
minimum valid value.  This means that hash-based nodes continue to apply  
work_mem in the traditional way by default.  
  
hash_mem_multiplier is generally useful.  However, it is being added now  
due to concerns about hash aggregate performance stability for users  
that upgrade to Postgres 13 (which added disk-based hash aggregation in  
commit 1f39bce0).  While the old hash aggregate behavior risked  
out-of-memory errors, it is nevertheless likely that many users actually  
benefited.  Hash agg's previous indifference to work_mem during query  
execution was not just faster; it also accidentally made aggregation  
resilient to grouping estimate problems (at least in cases where this  
didn't create destabilizing memory pressure).  
  
hash_mem_multiplier can provide a certain kind of continuity with the  
behavior of Postgres 12 hash aggregates in cases where the planner  
incorrectly estimates that all groups (plus related allocations) will  
fit in work_mem/hash_mem.  This seems necessary because hash-based  
aggregation is usually much slower when only a small fraction of all  
groups can fit.  Even when it isn't possible to totally avoid hash  
aggregates that spill, giving hash aggregation more memory will reliably  
improve performance (the same cannot be said for external sort  
operations, which appear to be almost unaffected by memory availability  
provided it's at least possible to get a single merge pass).  
  
The PostgreSQL 13 release notes should advise users that increasing  
hash_mem_multiplier can help with performance regressions associated  
with hash aggregation.  That can be taken care of by a later commit.  
  
Author: Peter Geoghegan  
Reviewed-By: Álvaro Herrera, Jeff Davis  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAH2-WzmD%2Bi1pG6rc1%2BCjc4V6EaFJ_qSuKCCHVnH%3DoruqD-zqow%40mail.gmail.com  
Backpatch: 13-, where disk-based hash aggregation was introduced.  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M doc/src/sgml/runtime.sgml
M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.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/backend/utils/adt/ri_triggers.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/executor/hashjoin.h
M src/include/executor/nodeHash.h
M src/include/miscadmin.h

HashAgg: use better cardinality estimate for recursive spilling.

commit   : 3a232a3183d517743acf232794fadc07f0944220    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 28 Jul 2020 23:15:47 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 28 Jul 2020 23:15:47 -0700    

Click here for diff

Use HyperLogLog to estimate the group cardinality in a spilled  
partition. This estimate is used to choose the number of partitions if  
we recurse.  
  
The previous behavior was to use the number of tuples in a spilled  
partition as the estimate for the number of groups, which lead to  
overpartitioning. That could cause the number of batches to be much  
higher than expected (with each batch being very small), which made it  
harder to interpret EXPLAIN ANALYZE results.  
  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/backend/executor/nodeAgg.c
M src/include/executor/nodeAgg.h

Rename another "hash_mem" local variable.

commit   : cdd7bd695bed552936e86b70ff1d234360bc5bea    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 28 Jul 2020 17:59:14 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 28 Jul 2020 17:59:14 -0700    

Click here for diff

Missed by my commit 564ce621.  
  
Backpatch: 13-, where disk-based hash aggregation was introduced.  

M src/backend/executor/nodeAgg.c

Correct obsolete UNION hash aggs comment.

commit   : b6c15e71f33fe9aa7f38cc7bde26d420fbaaef5b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 28 Jul 2020 17:14:06 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 28 Jul 2020 17:14:06 -0700    

Click here for diff

Oversight in commit 1f39bce0, which added disk-based hash aggregation.  
  
Backpatch: 13-, where disk-based hash aggregation was introduced.  

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

Doc: Remove obsolete CREATE AGGREGATE note.

commit   : e362f469c50f6e671285640cc2087345ab55a9b2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 28 Jul 2020 16:58:59 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 28 Jul 2020 16:58:59 -0700    

Click here for diff

The planner is in fact willing to use hash aggregation when work_mem is  
not set high enough for everything to fit in memory.  This has been the  
case since commit 1f39bce0, which added disk-based hash aggregation.  
  
There are a few remaining cases in which hash aggregation is avoided as  
a matter of policy when the planner surmises that spilling will be  
necessary.  For example, callers of choose_hashed_setop() still  
conservatively avoid hash aggregation when spilling is anticipated.  
That doesn't seem like a good enough reason to mention hash aggregation  
in this context.  
  
Backpatch: 13-, where disk-based hash aggregation was introduced.  

M doc/src/sgml/ref/create_aggregate.sgml

Make EXPLAIN ANALYZE of HashAgg more similar to Hash Join

commit   : a57c837e5cdf601d6ec05e5e10a40d01f1d2b84e    
  
author   : David Rowley <[email protected]>    
date     : Wed, 29 Jul 2020 11:43:11 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 29 Jul 2020 11:43:11 +1200    

Click here for diff

There were various unnecessary differences between Hash Agg's EXPLAIN  
ANALYZE output and Hash Join's.  Here we modify the Hash Agg output so  
that it's better aligned to Hash Join's.  
  
The following changes have been made:  
1. Start batches counter at 1 instead of 0.  
2. Always display the "Batches" property, even when we didn't spill to  
   disk.  
3. Use the text "Batches" instead of "HashAgg Batches" for text format.  
4. Use the text "Memory Usage" instead of "Peak Memory Usage" for text  
   format.  
5. Include "Batches" before "Memory Usage" in both text and non-text  
   formats.  
  
In passing also modify the "Planned Partitions" property so that we show  
it regardless of if the value is 0 or not for non-text EXPLAIN formats.  
This was pointed out by Justin Pryzby and probably should have been part  
of 40efbf870.  
  
Reviewed-by: Justin Pryzby, Jeff Davis  
Discussion: https://postgr.es/m/CAApHDvrshRnA6C0VFnu7Fb9TVvgGo80PUMm5+2DiaS1gEkPvtw@mail.gmail.com  
Backpatch-through: 13, where HashAgg batching was introduced  

M src/backend/commands/explain.c
M src/backend/executor/nodeAgg.c

Doc: Improve documentation for pg_jit_available()

commit   : dc6f2fb4353508af27dde44bdf5cb14749ae73a1    
  
author   : David Rowley <[email protected]>    
date     : Tue, 28 Jul 2020 22:52:43 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 28 Jul 2020 22:52:43 +1200    

Click here for diff

Per complaint from Scott Ribe. Based on wording suggestion from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11, where pg_jit_available() was added  

M doc/src/sgml/func.sgml

doc: Mention the rename of wal_keep_segments GUC in release note.

commit   : 128fd0a65ae54d97896cb6409fbc56d5da6319f1    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 28 Jul 2020 11:23:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 28 Jul 2020 11:23:02 +0900    

Click here for diff

Commit f5dff45962 renamed wal_keep_segments to wal_keep_size.  
This commit adds the mention to this change in the release note.  
  
Author: Fujii Masao  
Reviewed-by: David Steele  
Discussion: https://postgr.es/m/[email protected]  

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

Fix some issues with step generation in partition pruning.

commit   : cebe10a5f307635e187f424d0dce700666ae58fd    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 28 Jul 2020 11:00:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 28 Jul 2020 11:00:00 +0900    

Click here for diff

In the case of range partitioning, get_steps_using_prefix() assumes that  
the passed-in prefix list contains at least one clause for each of the  
partition keys earlier than one specified in the passed-in  
step_lastkeyno, but the caller (ie, gen_prune_steps_from_opexps())  
didn't take it into account, which led to a server crash or incorrect  
results when the list contained no clauses for such partition keys, as  
reported in bug #16500 and #16501 from Kobayashi Hisanori.  Update the  
caller to call that function only when the list created there contains  
at least one clause for each of the earlier partition keys in the case  
of range partitioning.  
  
While at it, fix some other issues:  
  
* The list to pass to get_steps_using_prefix() is allowed to contain  
  multiple clauses for the same partition key, as described in the  
  comment for that function, but that function actually assumed that the  
  list contained just a single clause for each of middle partition keys,  
  which led to an assertion failure when the list contained multiple  
  clauses for such partition keys.  Update that function to match the  
  comment.  
* In the case of hash partitioning, partition keys are allowed to be  
  NULL, in which case the list to pass to get_steps_using_prefix()  
  contains no clauses for NULL partition keys, but that function treats  
  that case as like the case of range partitioning, which led to the  
  assertion failure.  Update the assertion test to take into account  
  NULL partition keys in the case of hash partitioning.  
* Fix a typo in a comment in get_steps_using_prefix_recurse().  
* gen_partprune_steps() failed to detect self-contradiction from  
  strict-qual clauses and an IS NULL clause for the same partition key  
  in some cases, producing incorrect partition-pruning steps, which led  
  to incorrect results of partition pruning, but didn't cause any  
  user-visible problems fortunately, as the self-contradiction is  
  detected later in the query planning.  Update that function to detect  
  the self-contradiction.  
  
Per bug #16500 and #16501 from Kobayashi Hisanori.  Patch by me, initial  
diagnosis for the reported issue and review by Dmitry Dolgov.  
Back-patch to v11, where partition pruning was introduced.  
  
Discussion: https://postgr.es/m/16500-d1613f2a78e1e090%40postgresql.org  
Discussion: https://postgr.es/m/16501-5234a9a0394f6754%40postgresql.org  

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

Remove hashagg_avoid_disk_plan GUC.

commit   : 5a6cc6ffa914775e0184207686c2216998126549    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 27 Jul 2020 17:53:17 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 27 Jul 2020 17:53:17 -0700    

Click here for diff

Note: This GUC was originally named enable_hashagg_disk when it appeared  
in commit 1f39bce0, which added disk-based hash aggregation.  It was  
subsequently renamed in commit 92c58fd9.  
  
Author: Peter Geoghegan  
Reviewed-By: Jeff Davis, Álvaro Herrera  
Discussion: https://postgr.es/m/9d9d1e1252a52ea1bad84ea40dbebfd54e672a0f.camel%40j-davis.com  
Backpatch: 13-, where disk-based hash aggregation was introduced.  

M doc/src/sgml/config.sgml
M doc/src/sgml/release-13.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/include/optimizer/cost.h

Fix corner case with 16kB-long decompression in pgcrypto, take 2

commit   : 0caf1fc6e86a8985ef8b881a4dbb3488381ff976    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Jul 2020 15:58:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Jul 2020 15:58:54 +0900    

Click here for diff

A compressed stream may end with an empty packet.  In this case  
decompression finishes before reading the empty packet and the  
remaining stream packet causes a failure in reading the following  
data.  This commit makes sure to consume such extra data, avoiding a  
failure when decompression the data.  This corner case was reproducible  
easily with a data length of 16kB, and existed since e94dd6a.  A cheap  
regression test is added to cover this case based on a random,  
incompressible string.  
  
The first attempt of this patch has allowed to find an older failure  
within the compression logic of pgcrypto, fixed by b9b6105.  This  
involved SLES 15 with z390 where a custom flavor of libz gets used.  
Bonus thanks to Mark Wong for providing access to the specific  
environment.  
  
Reported-by: Frank Gagnepain  
Author: Kyotaro Horiguchi, Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M contrib/pgcrypto/expected/pgp-compression.out
M contrib/pgcrypto/pgp-compress.c
M contrib/pgcrypto/sql/pgp-compression.sql

Fix handling of structure for bytea data type in ECPG

commit   : ed4a9dc9cf69eee06f4e655ef5d175c5efa87dd7    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Jul 2020 10:29:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Jul 2020 10:29:08 +0900    

Click here for diff

Some code paths dedicated to bytea used the structure for varchar.  This  
did not lead to any actual bugs, as bytea and varchar have the same  
definition, but it could become a trap if one of these definitions  
changes for a new feature or a bug fix.  
  
Issue introduced by 050710b.  
  
Author: Shenhao Wang  
Reviewed-by: Vignesh C, Michael Paquier  
Discussion: https://postgr.es/m/07ac7dee1efc44f99d7f53a074420177@G08CNEXMBPEKD06.g08.fujitsu.local  
Backpatch-through: 12  

M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c

Fix LookupTupleHashEntryHash() pipeline-stall issue.

commit   : 7f5f2249b27a46a4d91d6be5aff188ca67719fa7    
  
author   : Jeff Davis <[email protected]>    
date     : Sun, 26 Jul 2020 14:55:52 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sun, 26 Jul 2020 14:55:52 -0700    

Click here for diff

Refactor hash lookups in nodeAgg.c to improve performance.  
  
Author: Andres Freund and Jeff Davis  
Discussion: https://postgr.es/m/20200612213715.op4ye4q7gktqvpuo%40alap3.anarazel.de  
Backpatch-through: 13  

M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/include/executor/executor.h

Tweak behavior of pg_stat_activity.leader_pid

commit   : 21b0055359f036e3ba22402d14536431dd39242e    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 26 Jul 2020 16:32:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 26 Jul 2020 16:32:20 +0900    

Click here for diff

The initial implementation of leader_pid in pg_stat_activity added by  
b025f32 took the approach to strictly print what a PGPROC entry  
includes.  In short, if a backend has been involved in parallel query at  
least once, leader_pid would remain set as long as the backend is alive.  
For a parallel group leader, this means that the field would always be  
set after it participated at least once in parallel query, and after  
more discussions this could be confusing if using for example a  
connection pooler.  
  
This commit changes the data printed so as leader_pid becomes always  
NULL for a parallel group leader, showing up a non-NULL value only for  
the parallel workers, and actually as long as a parallel query is  
running as workers are shut down once the query has completed.  
  
This does not change the definition of any catalog, so no catalog bump  
is needed.  Per discussion with Justin Pryzby, Álvaro Herrera, Julien  
Rouhaud and me.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/adt/pgstatfuncs.c

Fix buffer usage stats for nodes above Gather Merge.

commit   : b15367ae39402eb4eb8736f9c38c607995c82bb2    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 25 Jul 2020 10:31:19 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 25 Jul 2020 10:31:19 +0530    

Click here for diff

Commit 85c9d347 addressed a similar problem for Gather and Gather  
Merge nodes but forgot to account for nodes above parallel nodes.  This  
still works for nodes above Gather node because we shut down the workers  
for Gather node as soon as there are no more tuples.  We can do a similar  
thing for Gather Merge as well but it seems better to account for stats  
during nodes shutdown after completing the execution.  
  
Reported-by: Stéphane Lorek, Jehan-Guillaume de Rorthais  
Author: Jehan-Guillaume de Rorthais <[email protected]>  
Reviewed-by: Amit Kapila  
Backpatch-through: 10, where it was introduced  
Discussion: https://postgr.es/m/20200718160206.584532a2@firost  

M src/backend/executor/execProcnode.c

Replace TS_execute's TS_EXEC_CALC_NOT flag with TS_EXEC_SKIP_NOT.

commit   : 70eca6a9a6df679a86f30442194cc6b858b82000    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Jul 2020 15:43:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Jul 2020 15:43:56 -0400    

Click here for diff

It's fairly silly that ignoring NOT subexpressions is TS_execute's  
default behavior.  It's wrong on its face and it encourages errors  
of omission.  Moreover, the only two remaining callers that aren't  
specifying CALC_NOT are in ts_headline calculations, and it's very  
arguable that those are bugs: if you've specified "!foo" in your  
query, why would you want to get a headline that includes "foo"?  
  
Hence, rip that out and change the default behavior to be to calculate  
NOT accurately.  As a concession to the slim chance that there is still  
somebody somewhere who needs the incorrect behavior, provide a new  
SKIP_NOT flag to explicitly request that.  
  
Back-patch into v13, mainly because it seems better to change this  
at the same time as the previous commit's rejiggering of TS_execute  
related APIs.  Any outside callers affected by this change are  
probably also affected by that one.  
  
Discussion: https://postgr.es/m/CALT9ZEE-aLotzBg-pOp2GFTesGWVYzXA3=mZKzRDa_OKnLF7Mg@mail.gmail.com  

M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector_op.c
M src/include/tsearch/ts_utils.h

Fix assorted bugs by changing TS_execute's callback API to ternary logic.

commit   : 92fe6895d66da93a3c920089cfbbe4eb2db2145e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Jul 2020 15:26:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Jul 2020 15:26:51 -0400    

Click here for diff

Text search sometimes failed to find valid matches, for instance  
'!crew:A'::tsquery might fail to locate 'crew:1B'::tsvector during  
an index search.  The root of the issue is that TS_execute's callback  
functions were not changed to use ternary (yes/no/maybe) reporting  
when we made the search logic itself do so.  It's somewhat annoying  
to break that API, but on the other hand we now see that any code  
using plain boolean logic is almost certainly broken since the  
addition of phrase search.  There seem to be very few outside callers  
of this code anyway, so we'll just break them intentionally to get  
them to adapt.  
  
This allows removal of tsginidx.c's private re-implementation of  
TS_execute, since that's now entirely duplicative.  It's also no  
longer necessary to avoid use of CALC_NOT in tsgistidx.c, since  
the underlying callbacks can now do something reasonable.  
  
Back-patch into v13.  We can't change this in stable branches,  
but it seems not quite too late to fix it in v13.  
  
Tom Lane and Pavel Borisov  
  
Discussion: https://postgr.es/m/CALT9ZEE-aLotzBg-pOp2GFTesGWVYzXA3=mZKzRDa_OKnLF7Mg@mail.gmail.com  

M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector_op.c
M src/include/tsearch/ts_utils.h
M src/test/regress/expected/tsearch.out
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tsearch.sql
M src/test/regress/sql/tstypes.sql

Fix ancient violation of zlib's API spec.

commit   : 7dab4569d19341720316d139141f1c867ef438bf    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Jul 2020 17:19:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Jul 2020 17:19:37 -0400    

Click here for diff

contrib/pgcrypto mishandled the case where deflate() does not consume  
all of the offered input on the first try.  It reset the next_in pointer  
to the start of the input instead of leaving it alone, causing the wrong  
data to be fed to the next deflate() call.  
  
This has been broken since pgcrypto was committed.  The reason for the  
lack of complaints seems to be that it's fairly hard to get stock zlib  
to not consume all the input, so long as the output buffer is big enough  
(which it normally would be in pgcrypto's usage; AFAICT the input is  
always going to be packetized into packets no larger than ZIP_OUT_BUF).  
However, IBM's zlibNX implementation for AIX evidently will do it  
in some cases.  
  
I did not add a test case for this, because I couldn't find one that  
would fail with stock zlib.  When we put back the test case for  
bug #16476, that will cover the zlibNX situation well enough.  
  
While here, write deflate()'s second argument as Z_NO_FLUSH per its  
API spec, instead of hard-wiring the value zero.  
  
Per buildfarm results and subsequent investigation.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/pgp-compress.c

doc: Document that ssl_ciphers does not affect TLS 1.3

commit   : dbd03482c626e7c5bb92dde983c4b9de6f623253    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Jul 2020 17:13:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Jul 2020 17:13:00 +0200    

Click here for diff

TLS 1.3 uses a different way of specifying ciphers and a different  
OpenSSL API.  PostgreSQL currently does not support setting those  
ciphers.  For now, just document this.  In the future, support for  
this might be added somehow.  
  
Reviewed-by: Jonathan S. Katz <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M doc/src/sgml/config.sgml

Fix error message.

commit   : 6b366190d54a2cfc57782e11c62f05899e17b6ae    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 23 Jul 2020 21:10:49 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 23 Jul 2020 21:10:49 +1200    

Click here for diff

Remove extra space.  Back-patch to all releases, like commit 7897e3bb.  
  
Author: Lu, Chenyang <[email protected]>  
Discussion: https://postgr.es/m/795d03c6129844d3803e7eea48f5af0d%40G08CNEXMBPEKD04.g08.fujitsu.local  

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

Revert "Fix corner case with PGP decompression in pgcrypto"

commit   : 9f5162ef43c52396c4365b9cabfdffb4e4bf716d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 Jul 2020 08:29:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 Jul 2020 08:29:14 +0900    

Click here for diff

This reverts commit 9e10898, after finding out that buildfarm members  
running SLES 15 on z390 complain on the compression and decompression  
logic of the new test: pipistrelles, barbthroat and steamerduck.  
  
Those hosts are visibly using hardware-specific changes to improve zlib  
performance, requiring more investigation.  
  
Thanks to Tom Lane for the discussion.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M contrib/pgcrypto/expected/pgp-compression.out
M contrib/pgcrypto/pgp-compress.c
M contrib/pgcrypto/sql/pgp-compression.sql

Fix corner case with PGP decompression in pgcrypto

commit   : 35e142202b14fa12f8edbd7e58b33c39d3c03c62    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Jul 2020 14:52:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Jul 2020 14:52:36 +0900    

Click here for diff

A compressed stream may end with an empty packet, and PGP decompression  
finished before reading this empty packet in the remaining stream.  This  
caused a failure in pgcrypto, handling this case as corrupted data.  
This commit makes sure to consume such extra data, avoiding a failure  
when decompression the entire stream.  This corner case was reproducible  
with a data length of 16kB, and existed since its introduction in  
e94dd6a.  A cheap regression test is added to cover this case.  
  
Thanks to Jeff Janes for the extra investigation.  
  
Reported-by: Frank Gagnepain  
Author: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M contrib/pgcrypto/expected/pgp-compression.out
M contrib/pgcrypto/pgp-compress.c
M contrib/pgcrypto/sql/pgp-compression.sql

neqjoinsel must now pass through collation to eqjoinsel.

commit   : cc4dd2a7af13b4759cd76074a932c8cf24e32bb2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2020 19:40:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2020 19:40:44 -0400    

Click here for diff

Since commit 044c99bc5, eqjoinsel passes the passed-in collation  
to any operators it invokes.  However, neqjoinsel failed to pass  
on whatever collation it got, so that if we invoked a  
collation-dependent operator via that code path, we'd get "could not  
determine which collation to use for string comparison" or the like.  
  
Per report from Justin Pryzby.  Back-patch to v12, like the previous  
commit.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Minor glossary tweaks

commit   : ac25e7b039d5eacb8eb8fcc856a7ba4f14136b50    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Jul 2020 13:08:16 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Jul 2020 13:08:16 -0400    

Click here for diff

Add "(process)" qualifier to two terms, remove self-reference in one  
term.  
  
Author: Jürgen Purtz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/glossary.sgml

Assert that we don't insert nulls into attnotnull catalog columns.

commit   : bca409e5b160f81ccd980bef2aeb32f8b731b0fd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2020 12:38:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jul 2020 12:38:08 -0400    

Click here for diff

The executor checks for this error, and so does the bootstrap catalog  
loader, but we never checked for it in retail catalog manipulations.  
The folly of that has now been exposed, so let's add assertions  
checking it.  Checking in CatalogTupleInsert[WithInfo] and  
CatalogTupleUpdate[WithInfo] should be enough to cover this.  
  
Back-patch to v10; the aforesaid functions didn't exist before that,  
and it didn't seem worth adapting the patch to the oldest branches.  
But given the risk of JIT crashes, I think we certainly need this  
as far back as v11.  
  
Pre-v13, we have to explicitly exclude pg_subscription.subslotname  
and pg_subscription_rel.srsublsn from the checks, since they are  
mismarked.  (Even if we change our mind about applying BKI_FORCE_NULL  
in the branch tips, it doesn't seem wise to have assertions that  
would fire in existing databases.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bki.sgml
M src/backend/catalog/indexing.c

Correctly mark pg_subscription_rel.srsublsn as nullable.

commit   : e5372b48b94f17dcce5d8f3b26d55b0f182e4306    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Jul 2020 14:55:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Jul 2020 14:55:56 -0400    

Click here for diff

The code has always set this column to NULL when it's not valid,  
but the catalog header's description failed to reflect that,  
as did the SGML docs, as did some of the code.  To prevent future  
coding errors of the same ilk, let's hide the field from C code  
as though it were variable-length (which, in a sense, it is).  
  
As with commit 72eab84a5, we can only fix this cleanly in HEAD  
and v13; the problem extends further back but we'll need some  
klugery in the released branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_subscription.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription_rel.h

Fix construction of updated-columns bitmap in logical replication.

commit   : 2f1f189cf8806a02987dfa1759257b154162fac2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Jul 2020 13:40:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Jul 2020 13:40:16 -0400    

Click here for diff

Commit b9c130a1f failed to apply the publisher-to-subscriber column  
mapping while checking which columns were updated.  Perhaps less  
significantly, it didn't exclude dropped columns either.  This could  
result in an incorrect updated-columns bitmap and thus wrong decisions  
about whether to fire column-specific triggers on the subscriber while  
applying updates.  In HEAD (since commit 9de77b545), it could also  
result in accesses off the end of the colstatus array, as detected by  
buildfarm member skink.  Fix the logic, and adjust 003_constraints.pl  
so that the problem is exposed in unpatched code.  
  
In HEAD, also add some assertions to check that we don't access off  
the ends of these newly variable-sized arrays.  
  
Back-patch to v10, as b9c130a1f was.  
  
Discussion: https://postgr.es/m/CAH2-Wz=79hKQ4++c5A060RYbjTHgiYTHz=fw6mptCtgghH2gJA@mail.gmail.com  

M src/backend/replication/logical/worker.c
M src/test/subscription/t/003_constraints.pl

Rename wal_keep_segments to wal_keep_size.

commit   : f5dff45962ec0a0daad443e45811d6c426be1237    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 20 Jul 2020 13:30:18 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 20 Jul 2020 13:30:18 +0900    

Click here for diff

max_slot_wal_keep_size that was added in v13 and wal_keep_segments are  
the GUC parameters to specify how much WAL files to retain for  
the standby servers. While max_slot_wal_keep_size accepts the number of  
bytes of WAL files, wal_keep_segments accepts the number of WAL files.  
This difference of setting units between those similar parameters could  
be confusing to users.  
  
To alleviate this situation, this commit renames wal_keep_segments to  
wal_keep_size, and make users specify the WAL size in it instead of  
the number of WAL files.  
  
There was also the idea to rename max_slot_wal_keep_size to  
max_slot_wal_keep_segments, in the discussion. But we have been moving  
away from measuring in segments, for example, checkpoint_segments was  
replaced by max_wal_size. So we concluded to rename wal_keep_segments  
to wal_keep_size.  
  
Back-patch to v13 where max_slot_wal_keep_size was added.  
  
Author: Fujii Masao  
Reviewed-by: Álvaro Herrera, Kyotaro Horiguchi, David Steele  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/xlog.c
M src/backend/replication/slotfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_rewind/t/RewindTest.pm
M src/include/access/xlog.h
M src/test/recovery/t/019_replslot_limit.pl

Fix minor typo in nodeIncrementalSort.c.

commit   : 4a1ae21750cbf23d8317d565c55ac7bce46bf0f6    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 20 Jul 2020 07:54:04 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 20 Jul 2020 07:54:04 +0530    

Click here for diff

Author: Vignesh C  
Reviewed-by: James Coleman  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/CALDaNm0WjZqRvdeL59ZfYH0o4mLbKQ23jm-bnjXcFzgpANx55g@mail.gmail.com  

M src/backend/executor/nodeIncrementalSort.c

Correctly mark pg_subscription.subslotname as nullable.

commit   : 914d2383ae91918b359311a90d23c0d5862781ac    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Jul 2020 12:37:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Jul 2020 12:37:23 -0400    

Click here for diff

Due to the layout of this catalog, subslotname has to be explicitly  
marked BKI_FORCE_NULL, else initdb will default to the assumption  
that it's non-nullable.  Since, in fact, CREATE/ALTER SUBSCRIPTION  
will store null values there, the existing marking is just wrong,  
and has been since this catalog was invented.  
  
We haven't noticed because not much in the system actually depends  
on attnotnull being truthful.  However, JIT'ed tuple deconstruction  
does depend on that in some cases, allowing crashes or wrong answers  
in queries that inspect pg_subscription.  Commit 9de77b545 quite  
accidentally exposed this on the buildfarm members that force JIT  
activation.  
  
Back-patch to v13.  The problem goes further back, but we cannot  
force initdb in released branches, so some klugier solution will  
be needed there.  Before working on that, push this simple fix  
to try to get the buildfarm back to green.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

doc: Refresh more URLs in the docs

commit   : f2b65519e17d6de4cd95dfe1570ab1aca187b24d    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 18 Jul 2020 22:43:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 18 Jul 2020 22:43:41 +0900    

Click here for diff

This updates some URLs that are redirections, mostly to an equivalent  
using https.  One URL referring to generalized partial indexes was  
outdated.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/biblio.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/cube.sgml
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/geqo.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/intro.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/textsearch.sgml

doc: Fix description of \copy for psql

commit   : 580d8ac9b1ef2803f39b1e23d9da68fff9109c42    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 18 Jul 2020 10:42:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 18 Jul 2020 10:42:46 +0900    

Click here for diff

The WHERE clause introduced by 31f3817 was not described.  While on it,  
split the grammar of \copy FROM and TO into two distinct parts for  
clarity as they support different set of options.  
  
Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm3zWr=OmxeNqOqfT=uZTSdam_j-gkX94CL8eTNfgUtf6A@mail.gmail.com  
Backpatch-through: 12  

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

Cope with data-offset-less archive files during out-of-order restores.

commit   : 71e8e66f783c143b04d381566d7a2a61e8d7598f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2020 13:03:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2020 13:03:50 -0400    

Click here for diff

pg_dump produces custom-format archive files that lack data offsets  
when it is unable to seek its output.  Up to now that's been a hazard  
for pg_restore.  But if pg_restore is able to seek in the archive  
file, there is no reason to throw up our hands when asked to restore  
data blocks out of order.  Instead, whenever we are searching for a  
data block, record the locations of the blocks we passed over (that  
is, fill in the missing data-offset fields in our in-memory copy of  
the TOC data).  Then, when we hit a case that requires going  
backwards, we can just seek back.  
  
Also track the furthest point that we've searched to, and seek back  
to there when beginning a search for a new data block.  This avoids  
possible O(N^2) time consumption, by ensuring that each data block  
is examined at most twice.  (On Unix systems, that's at most twice  
per parallel-restore job; but since Windows uses threads here, the  
threads can share block location knowledge, reducing the amount of  
duplicated work.)  
  
We can also improve the code a bit by using fseeko() to skip over  
data blocks during the search.  
  
This is all of some use even in simple restores, but it's really  
significant for parallel pg_restore.  In that case, we require  
seekability of the input already, and we will very probably need  
to do out-of-order restores.  
  
Back-patch to v12, as this fixes a regression introduced by commit  
548e50976.  Before that, parallel restore avoided requesting  
out-of-order restores, so it would work on a data-offset-less  
archive.  Now it will again.  
  
Ideally this patch would include some test coverage, but there are  
other open bugs that need to be fixed before we can extend our  
coverage of parallel restore very much.  Plan to revisit that later.  
  
David Gilman and Tom Lane; reviewed by Justin Pryzby  
  
Discussion: https://postgr.es/m/CALBH9DDuJ+scZc4MEvw5uO-=vRyR2=QF9+Yh=3hPEnKHWfS81A@mail.gmail.com  

M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_backup_custom.c

Remove manual tracking of file position in pg_dump/pg_backup_custom.c.

commit   : 447cf2f8e9dcf9fd89c935f2daee13326a91630a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2020 12:14:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2020 12:14:28 -0400    

Click here for diff

We do not really need to track the file position by hand.  We were  
already relying on ftello() whenever the archive file is seekable,  
while if it's not seekable we don't need the file position info  
anyway because we're not going to be able to re-write the TOC.  
  
Moreover, that tracking was buggy since it failed to account for  
the effects of fseeko().  Somewhat remarkably, that seems not to  
have made for any live bugs up to now.  We could fix the oversights,  
but it seems better to just get rid of the whole error-prone mess.  
  
In itself this is merely code cleanup.  However, it's necessary  
infrastructure for an upcoming bug-fix patch (because that code  
*does* need valid file position after fseeko).  The bug fix  
needs to go back as far as v12; hence, back-patch that far.  
  
Discussion: https://postgr.es/m/CALBH9DDuJ+scZc4MEvw5uO-=vRyR2=QF9+Yh=3hPEnKHWfS81A@mail.gmail.com  

M src/bin/pg_dump/pg_backup_custom.c

Avoid CREATE INDEX unique index deduplication.

commit   : 49eb96852b02069600a4f6997dfb388fc37a2778    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 17 Jul 2020 09:50:46 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 17 Jul 2020 09:50:46 -0700    

Click here for diff

There is no advantage to attempting deduplication for a unique index  
during CREATE INDEX, since there cannot possibly be any duplicates.  
Doing so wastes cycles due to unnecessary copying.  Make sure that we  
avoid it consistently.  
  
We already avoided unique index deduplication in the case where there  
were some spool2 tuples to merge.  That didn't account for the fact that  
spool2 is removed early/unset in the common case where it has no tuples  
that need to be merged (i.e. it failed to account for the "spool2 turns  
out to be unnecessary" optimization in _bt_spools_heapscan()).  
  
Oversight in commit 0d861bbb, which added nbtree deduplication  
  
Backpatch: 13-, where nbtree deduplication was introduced.  

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

Ensure that distributed timezone abbreviation files are plain ASCII.

commit   : a220e345c87d5224d810584a7c4ef29ea7a6c1f1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2020 11:03:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jul 2020 11:03:55 -0400    

Click here for diff

We had two occurrences of "Mitteleuropäische Zeit" in Europe.txt,  
though the corresponding entries in Default were spelled  
"Mitteleuropaeische Zeit".  Standardize on the latter spelling to  
avoid questions of which encoding to use.  
  
While here, correct a couple of other trivial inconsistencies between  
the Default file and the supposedly-matching entries in the *.txt  
files, as exposed by some checking with comm(1).  Also, add BDST to  
the Europe.txt file; it previously was only listed in Default.  
None of this has any direct functional effect.  
  
Per complaint from Christoph Berg.  As usual for timezone data patches,  
apply to all branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/tznames/Antarctica.txt
M src/timezone/tznames/Australia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Europe.txt

Fix whitespace

commit   : 6bab40bf605665fc01b84a434127cbaec3b3d1de    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Jul 2020 15:16:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Jul 2020 15:16:13 +0200    

Click here for diff

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

Resolve gratuitous tabs in SQL file

commit   : e7240ccecd3001892880fd076a7ffd107b533afc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Jul 2020 15:07:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Jul 2020 15:07:54 +0200    

Click here for diff

M src/backend/catalog/system_views.sql

Fix signal handler setup for SIGHUP in the apply launcher process.

commit   : 35647ea9d214c8745922cb757424f11d791ed733    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 17 Jul 2020 08:43:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 17 Jul 2020 08:43:06 +0530    

Click here for diff

Commit 1e53fe0e70 has unified the usage of the config-file reload flag by  
using the same signal handler function for the SIGHUP signal at many places  
in the code.  By mistake, it used the wrong SIGNAL in apply launcher  
process for the SIGHUP signal handler function.  
  
Author: Bharath Rupireddy  
Reviewed-by: Dilip Kumar  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/CALj2ACVzHCRnS20bOiEHaLtP5PVBENZQn4khdsSJQgOv_GM-LA@mail.gmail.com  

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

Switch pg_test_fsync to use binary mode on Windows

commit   : beebbb39d932289b73fa7cab4037895675615a8d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Jul 2020 15:52:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Jul 2020 15:52:54 +0900    

Click here for diff

pg_test_fsync has always opened files using the text mode on Windows, as  
this is the default mode used if not enforced by _setmode().  
  
This fixes a failure when running pg_test_fsync down to 12 because  
O_DSYNC and the text mode are not able to work together nicely.  We  
fixed the handling of O_DSYNC in 12~ for the tool by switching to the  
concurrent-safe version of fopen() in src/port/ with 0ba06e0.  And  
40cfe86, by enforcing the text mode for compatibility reasons if O_TEXT  
or O_BINARY are not specified by the caller, broke pg_test_fsync.  For  
all versions, this avoids any translation overhead, and pg_test_fsync  
should test binary writes, so it is a gain in all cases.  
  
Note that O_DSYNC is still not handled correctly in ~11, leading to  
pg_test_fsync to show insanely high numbers for open_datasync() (using  
this property it is easy to notice that the binary mode is much  
faster).  This would require a backpatch of 0ba06e0 and 40cfe86, which  
could potentially break existing applications, so this is left out.  
  
There are no TAP tests for this tool yet, so I have checked all builds  
manually using MSVC.  We could invent a new option to run a single  
transaction instead of using a duration of 1s to make the tests a  
maximum short, but this is left as future work.  
  
Thanks to Bruce Momjian for the discussion.  
  
Reported-by: Jeff Janes  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/bin/pg_test_fsync/pg_test_fsync.c

doc: Fix typo

commit   : 6b5ca893f737184a8113aee33c6c10b1c3bbcd39    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Jul 2020 21:01:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Jul 2020 21:01:29 +0200    

Click here for diff

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

Fix handling of missing files when using pg_rewind with online source

commit   : 5f89bb4cf0109bdb36eb8f78943f5b0f141c614a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Jul 2020 15:17:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Jul 2020 15:17:32 +0900    

Click here for diff

When working with an online source cluster, pg_rewind gets a list of all  
the files in the source data directory using a WITH RECURSIVE query,  
returning a NULL result for a file's metadata if it gets removed between  
the moment it is listed in a directory and the moment its metadata is  
obtained with pg_stat_file() (say a recycled WAL segment).  The query  
result was processed in such a way that for each tuple we checked only  
that the first file's metadata was NULL.  This could have two  
consequences, both resulting in a failure of the rewind:  
- If the first tuple referred to a removed file, all files from the  
source would be ignored.  
- Any file actually missing would not be considered as such.  
  
While on it, rework slightly the code so as no values are saved if we  
know that a file is going to be skipped.  
  
Issue introduced by b36805f, so backpatch down to 9.5.  
  
Author: Justin Pryzby, Michael Paquier  
Reviewed-by: Daniel Gustafsson, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/bin/pg_rewind/libpq_fetch.c

Fix bitmap AND/OR scans on the inside of a nestloop partition-wise join.

commit   : e38705b5c7635644a70cf7c9eadb7a90bb8ea13b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Jul 2020 18:56:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Jul 2020 18:56:49 -0400    

Click here for diff

reparameterize_path_by_child() failed to reparameterize BitmapAnd  
and BitmapOr paths.  This matters only if such a path is chosen as  
the inside of a nestloop partition-wise join, where we have to pass  
in parameters from the outside of the nestloop.  If that did happen,  
we generated a bad plan that would likely lead to crashes at execution.  
  
This is not entirely reparameterize_path_by_child()'s fault though;  
it's the victim of an ancient decision (my ancient decision, I think)  
to not bother filling in param_info in BitmapAnd/Or path nodes.  That  
caused the function to believe that such nodes and their children  
contain no parameter references and so need not be processed.  
  
In hindsight that decision looks pretty penny-wise and pound-foolish:  
while it saves a few cycles during path node setup, we do commonly  
need the information later.  In particular, by reversing the decision  
and requiring valid param_info data in all nodes of a bitmap path  
tree, we can get rid of indxpath.c's get_bitmap_tree_required_outer()  
function, which computed the data on-demand.  It's not unlikely that  
that nets out as a savings of cycles in many scenarios.  A couple  
of other things in indxpath.c can be simplified as well.  
  
While here, get rid of some cases in reparameterize_path_by_child()  
that are visibly dead or useless, given that we only care about  
reparameterizing paths that can be on the inside of a parameterized  
nestloop.  This case reminds one of the maxim that untested code  
probably does not work, so I'm unwilling to leave unreachable code  
in this function.  (I did leave the T_Gather case in place even  
though it's not reached in the regression tests.  It's not very  
clear to me when the planner might prefer to put Gather below  
rather than above a nestloop, but at least in principle the case  
might be interesting.)  
  
Per bug #16536, originally from Arne Roland but with a test case  
by Andrew Gierth.  Back-patch to v11 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Fix timing issue with ALTER TABLE's validate constraint

commit   : b827304291aff8019cdd0cee68219fe43f064380    
  
author   : David Rowley <[email protected]>    
date     : Tue, 14 Jul 2020 16:57:41 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 14 Jul 2020 16:57:41 +1200    

Click here for diff

An ALTER TABLE to validate a foreign key in which another subcommand  
already caused a pending table rewrite could fail due to ALTER TABLE  
attempting to validate the foreign key before the actual table rewrite  
takes place.  This situation could result in an error such as:  
  
ERROR:  could not read block 0 in file "base/nnnnn/nnnnn": read only 0 of 8192 bytes  
  
The failure here was due to the SPI call which validates the foreign key  
trying to access an index which is yet to be rebuilt.  
  
Similarly, we also incorrectly tried to validate CHECK constraints before  
the heap had been rewritten.  
  
The fix for both is to delay constraint validation until phase 3, after  
the table has been rewritten.  For CHECK constraints this means a slight  
behavioral change.  Previously ALTER TABLE VALIDATE CONSTRAINT on  
inheritance tables would be validated from the bottom up.  This was  
different from the order of evaluation when a new CHECK constraint was  
added.  The changes made here aligns the VALIDATE CONSTRAINT evaluation  
order for inheritance tables to be the same as ADD CONSTRAINT, which is  
generally top-down.  
  
Reported-by: Nazli Ugur Koyluoglu, using SQLancer  
Discussion: https://postgr.es/m/CAApHDvp%3DZXv8wiRyk_0rWr00skhGkt8vXDrHJYXRMft3TjkxCA%40mail.gmail.com  
Backpatch-through: 9.5 (all supported versions)  

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

commit   : 9678c08184a82deafac9297b9af0fc5cb07ab347    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 14 Jul 2020 13:17:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 14 Jul 2020 13:17:31 +0900    

Click here for diff

Incorrect function names were referenced.  As this fixes some portions  
of tableam.h, that is mentioned in the docs as something to look at when  
implementing a table AM, backpatch down to 12 where this has been  
introduced.  
  
Author: Hironobu Suzuki  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Cope with lateral references in the quals of a subquery RTE.

commit   : 0734dbc45034540fec1d98b15c9f173ad1d4af02    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Jul 2020 20:38:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Jul 2020 20:38:20 -0400    

Click here for diff

The qual pushdown logic assumed that all Vars in a restriction clause  
must be Vars referencing subquery outputs; but since we introduced  
LATERAL, it's possible for such a Var to be a lateral reference instead.  
This led to an assertion failure in debug builds.  In a non-debug  
build, there might be no ill effects (if qual_is_pushdown_safe decided  
the qual was unsafe anyway), or we could get failures later due to  
construction of an invalid plan.  I've not gone to much length to  
characterize the possible failures, but at least segfaults in the  
executor have been observed.  
  
Given that this has been busted since 9.3 and it took this long for  
anybody to notice, I judge that the case isn't worth going to great  
lengths to optimize.  Hence, fix by just teaching qual_is_pushdown_safe  
that such quals are unsafe to push down, matching the previous behavior  
when it accidentally didn't fail.  
  
Per report from Tom Ellis.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Fix uninitialized value in segno calculation

commit   : 794e8e32bb5ae1b38a90cbae2a88895633797599    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 Jul 2020 13:49:50 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 Jul 2020 13:49:50 -0400    

Click here for diff

Remove previous hack in KeepLogSeg that added a case to deal with a  
(badly represented) invalid segment number.  This was added for the sake  
of GetWALAvailability.  But it's not needed if in that function we  
initialize the segment number to be retreated to the currently being  
written segment, so do that instead.  
  
Per valgrind-running buildfarm member skink, and some sparc64 animals.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix bugs in libpq's management of GSS encryption state.

commit   : 8e6f134a9a8db52cbd2818ce8a60b9e5cdadfc8f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Jul 2020 11:57:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Jul 2020 11:57:55 -0400    

Click here for diff

GSS-related resources should be cleaned up in pqDropConnection,  
not freePGconn, else the wrong things happen when resetting  
a connection or trying to switch to a different server.  
It's also critical to reset conn->gssenc there.  
  
During connection setup, initialize conn->try_gss at the correct  
place, else switching to a different server won't work right.  
  
Remove now-redundant cleanup of GSS resources around one (and, for  
some reason, only one) pqDropConnection call in connectDBStart.  
  
Per report from Kyotaro Horiguchi that psql would freeze up,  
rather than successfully resetting a GSS-encrypted connection  
after a server restart.  
  
This is YA oversight in commit b0b39f72b, so back-patch to v12.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improvements to psql \dAo and \dAp commands

commit   : ae290059e1aa5bc2272a0345184bcf05407f69a4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 11 Jul 2020 14:14:49 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 11 Jul 2020 14:14:49 +0300    

Click here for diff

 * Strategy number and purpose are essential information for opfamily operator.  
   So, show those columns in non-verbose output.  
 * "Left/right arg type" \dAp column names are confusing, because those type  
   don't necessary match to function arguments.  Rename them to "Registered  
   left/right type".  
 * Replace manual assembling of operator/procedure names with casts to  
   regoperator/regprocedure.  
 * Add schema-qualification for pg_catalog functions and tables.  
  
Reported-by: Peter Eisentraut, Tom Lane  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/2edc7b27-031f-b2b6-0db2-864241c91cb9%402ndquadrant.com  
Backpatch-through: 13  

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

HashAgg: before spilling tuples, set unneeded columns to NULL.

commit   : d8a7ce245095e3a70a2ad738c17be95593f68996    
  
author   : Jeff Davis <[email protected]>    
date     : Sun, 12 Jul 2020 17:48:49 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sun, 12 Jul 2020 17:48:49 -0700    

Click here for diff

This is a replacement for 4cad2534. Instead of projecting all tuples  
going into a HashAgg, only remove unnecessary attributes when actually  
spilling. This avoids the regression for the in-memory case.  
  
Discussion: https://postgr.es/m/a2fb7dfeb4f50aa0a123e42151ee3013933cb802.camel%40j-davis.com  
Backpatch-through: 13  

M src/backend/executor/nodeAgg.c
M src/include/nodes/execnodes.h

Revert "Use CP_SMALL_TLIST for hash aggregate"

commit   : 926ecf83c0bab7e985eaf5727bb69cdf8ce6b067    
  
author   : Jeff Davis <[email protected]>    
date     : Sun, 12 Jul 2020 16:46:19 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sun, 12 Jul 2020 16:46:19 -0700    

Click here for diff

This reverts commit 4cad2534da6d17067d98cf04be2dfc1bda8f2cd0 due to a  
performance regression. It will be replaced by a new approach in an  
upcoming commit.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/plan/createplan.c

Revert "Track statistics for spilling of changes from ReorderBuffer".

commit   : b074813d48bcd2a7e224b56a3aff6db9df745237    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Jul 2020 08:27:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Jul 2020 08:27:40 +0530    

Click here for diff

The stats with this commit was available only for WALSenders, however,  
users might want to see for backends doing logical decoding via SQL API.  
Then, users might want to reset and access these stats across server  
restart which was not possible with the current patch.  
  
List of commits reverted:  
  
caa3c4242c   Don't call elog() while holding spinlock.  
e641b2a995   Doc: Update the documentation for spilled transaction  
statistics.  
5883f5fe27   Fix unportable printf format introduced in commit 9290ad198.  
9290ad198b   Track statistics for spilling of changes from ReorderBuffer.  
  
Additionaly, remove the release notes entry for this feature.  
  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/CA+fd4k5_pPAYRTDrO2PbtTOe0eHQpBvuqmCr8ic39uTNmR49Eg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/release-13.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walsender.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/reorderbuffer.h
M src/include/replication/walsender_private.h
M src/test/regress/expected/rules.out

Avoid trying to restore table ACLs and per-column ACLs in parallel.

commit   : bc9aaac1a188cac11b1ebb04047de3db71257785    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Jul 2020 13:36:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Jul 2020 13:36:50 -0400    

Click here for diff

Parallel pg_restore has always supposed that ACL items for different  
objects are independent and can be restored in parallel without  
conflicts.  However, there is one case where this fails: because  
REVOKE on a table is defined to also revoke the privilege(s) at  
column level, we can't restore per-column ACLs till after we restore  
any table-level privileges on their table.  Failure to honor this  
restriction can lead to "tuple concurrently updated" errors during  
parallel restore, or even to the per-column ACLs silently disappearing  
because the table-level REVOKE is executed afterwards.  
  
To fix, add a dependency from each column-level ACL item to its table's  
ACL item, if there is one.  Note that this doesn't fix the hazard  
for pre-existing archive files, only for ones made with a corrected  
pg_dump.  Given that the bug's been there quite awhile without  
field reports, I think this is acceptable.  
  
This requires changing the API of pg_dump's dumpACL() function.  
To keep its argument list from getting even longer, I removed the  
"CatalogId objCatId" argument, which has been unused for ages.  
  
Per report from Justin Pryzby.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Forbid numeric NaN in jsonpath

commit   : 89a0b1a7ca0af36818ed7076c12ac00bcf4f007d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 11 Jul 2020 03:21:00 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 11 Jul 2020 03:21:00 +0300    

Click here for diff

SQL standard doesn't define numeric Inf or NaN values.  It appears even more  
ridiculous to support then in jsonpath assuming JSON doesn't support these  
values as well.  This commit forbids returning NaN from .double(), which was  
previously allowed.  NaN can't be result of inner-jsonpath computation over  
non-NaNs.  So, we can not expect NaN in the jsonpath output.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/203949.1591879542%40sss.pgh.pa.us  
Author: Alexander Korotkov  
Reviewed-by: Tom Lane  
Backpatch-through: 12  

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

Improve error reporting for jsonpath .double() method

commit   : b9a04a9bc6653183ed23532145325694fbc46002    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 11 Jul 2020 03:20:46 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 11 Jul 2020 03:20:46 +0300    

Click here for diff

When jsonpath .double() method detects that numeric or string can't be  
converted to double precision, it throws an error.  This commit makes these  
errors explicitly express the reason of failure.  
  
Discussion: https://postgr.es/m/CAPpHfdtqJtiSXkP7tOXez18NxhLUH_-75bL8%3DOce4Ki%2Bbv7V6Q%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Tom Lane  
Backpatch-through: 12  

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

Doc: update or remove dead external links.

commit   : 763a0b63a25c13ac940ce2c64b37b8446ccbf895    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Jul 2020 13:16:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Jul 2020 13:16:00 -0400    

Click here for diff

Re-point comp.ai.genetic FAQ link to a more stable address.  
  
Remove stale links to AIX documentation; we don't really need to  
tell AIX users how to use their systems.  
  
Remove stale links to HP documentation about SSL.  We've had to  
update those twice before, making it increasingly obvious that  
HP does not intend them to be stable landing points.  They're  
not particularly authoritative, either.  (This change effectively  
reverts bbd3bdba3.)  
  
Daniel Gustafsson and Álvaro Herrera, per a gripe from  
Kyotaro Horiguchi.  Back-patch, since these links are  
just as dead in the back branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/geqo.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/runtime.sgml

Log the location field before any backtrace

commit   : 8ff4d1277b8660de85e4a7d796ccc1b64187d80f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Jul 2020 08:27:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Jul 2020 08:27:00 +0200    

Click here for diff

This order makes more sense because the location is effectively at the  
lowest level of the backtrace.  
  
Discussion: https://www.postgresql.org/message-id/flat/90f5fa04-c410-a54e-9449-aa3749fb7972%402ndquadrant.com  

M src/backend/utils/error/elog.c

Remove WARNING message from brin_desummarize_range

commit   : c3a79e71929a6b5cdd2416ab4976dab59736c937    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 9 Jul 2020 20:13:25 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 9 Jul 2020 20:13:25 -0400    

Click here for diff

This message was being emitted on the grounds that only crashed  
summarization could cause it, but in reality even an aborted vacuum  
could do it ... which makes it way too noisy, particularly since it  
shows up in regression tests and makes them die.  
  
Reported by Tom Lane.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_revmap.c

Tighten up Windows CRLF conversion in our TAP test scripts.

commit   : 17b87b3049fa7e3ddc68bf9daaffa3b01d7b8be2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2020 17:38:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2020 17:38:52 -0400    

Click here for diff

Back-patch commits 91bdf499b and ffb4cee43, so that all branches  
agree on when and how to do Windows CRLF conversion.  
  
This should close the referenced thread.  Thanks to Andrew Dunstan  
for discussion/review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/t/RewindTest.pm
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm

Fix pg_current_logfile() to not emit a carriage return on Windows.

commit   : 601d419b2b5def62a1867169e67c7ef876f0b886    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2020 16:02:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jul 2020 16:02:23 -0400    

Click here for diff

Due to not having our signals straight about CRLF vs. LF line  
termination, the output of pg_current_logfile() included a trailing  
\r on Windows.  To fix, force the file descriptor it uses into text  
mode.  
  
While here, move a couple of local variable declarations to make  
the function's logic clearer.  
  
In v12 and v13, also back-patch the test added by 1c4e88e2f so that  
this function has some test coverage.  However, the 004_logrotate.pl  
test script doesn't exist before v12, and it didn't seem worth adding  
to older branches just for this.  
  
Per report from Thomas Kellerer.  Back-patch to v10 where this  
function was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/misc.c
M src/bin/pg_ctl/t/004_logrotate.pl

doc: Correct the description about the length of pg_stat_activity.query.

commit   : 331da659bedbad2c4d649d70cccf9d87ca1a0b7e    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Jul 2020 13:31:33 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Jul 2020 13:31:33 +0900    

Click here for diff

pg_stat_activity.query text is truncated at 1024 bytes. But previously  
the document described that it's truncated at 1024 characters.  
This was not accurate when considering multibyte characters.  
  
Back-patch to v10 where this inaccurate description was added.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Daniel Gustafsson, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Fix whitespace in HashAgg EXPLAIN ANALYZE

commit   : 285da44a69ddcbe8aa955b5f863e02121f41c189    
  
author   : David Rowley <[email protected]>    
date     : Thu, 9 Jul 2020 10:07:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 9 Jul 2020 10:07:00 +1200    

Click here for diff

The Sort node does not put a space between the number of kilobytes and  
the "kB" of memory or disk space used, but HashAgg does.  Here we align  
HashAgg to do the same as Sort.  Sort has been displaying this  
information for longer than HashAgg, so it makes sense to align HashAgg  
to Sort rather than the other way around.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13, where the hashagg started showing these details  

M src/backend/commands/explain.c

Fix incorrect variable datatype.

commit   : a2b94693beb1d052f2b4935384dd6f7f47143669    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Jul 2020 21:24:34 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Jul 2020 21:24:34 +0900    

Click here for diff

Since slot_keep_segs indicates the number of WAL segments not LSN,  
its datatype should not be XLogRecPtr.  
  
Back-patch to v13 where this issue was added.  
  
Reported-by: Atsushi Torikoshi  
Author: Atsushi Torikoshi, tweaked by Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Fix inconsistencies in GIN, BRIN and SP-GiST for optional opclass methods

commit   : ea5737889f0586c2d46738bc52b97b86369f03e2    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Jul 2020 10:42:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Jul 2020 10:42:15 +0900    

Click here for diff

The GIN and SP-GiST parts were out-of-sync since the changes of 14903f2,  
and the BRIN part was wrong since its introduction in 15cb2bd.  
  
Author: Guillaume Lelarge  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAECtzeXKvEPEr967h0PRYRi39uTmdEms=oUtc_PWGjZRNN1prw@mail.gmail.com  
Backpatch-through: 13  

M doc/src/sgml/brin.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/spgist.sgml

Morph pg_replication_slots.min_safe_lsn to safe_wal_size

commit   : c54b5891f415df36809de1aeb97e4574d5456d69    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jul 2020 13:08:00 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jul 2020 13:08:00 -0400    

Click here for diff

The previous definition of the column was almost universally disliked,  
so provide this updated definition which is more useful for monitoring  
purposes: a large positive value is good, while zero or a negative value  
means danger.  This should be operationally more convenient.  
  
Backpatch to 13, where the new column to pg_replication_slots (and the  
feature it represents) were added.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Reported-by: Fujii Masao <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/slotfuncs.c
M src/include/access/xlog_internal.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/recovery/t/019_replslot_limit.pl
M src/test/regress/expected/rules.out

doc: Add note about possible performance overhead by enabling track_planning.

commit   : da6b6ff95bcaadc109ab248471527a2511e853d5    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 6 Jul 2020 14:27:09 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 6 Jul 2020 14:27:09 +0900    

Click here for diff

Enabling pg_stat_statements.track_plaanning may incur a noticeable  
performance penalty, especially when a fewer kinds of queries are executed  
on many concurrent connections. This commit documents this note.  
  
Back-patch to v13 where pg_stat_statements.track_plaanning was added.  
  
Suggested-by: Pavel Stehule  
Author: Fujii Masao  
Reviewed-by: Pavel Stehule  
Discussion: https://postgr.es/m/CAFj8pRC9Jxa8r5i0TNBWLb8mzuaYzEoLq3QOvip0jVpHPOLbVA@mail.gmail.com  

M doc/src/sgml/pgstatstatements.sgml

Remove extra whitespace in comments atop ReorderBufferCheckMemoryLimit.

commit   : e163f3a2b1d987f83e291e86969ed4a91ded6abb    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 6 Jul 2020 08:36:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 6 Jul 2020 08:36:58 +0530    

Click here for diff

Backpatch-through: 13, where it was introduced  

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

Remove unused function parameter in end_parallel_vacuum.

commit   : f92c24ec9f61b3502007e2a9a6de4c236844254d    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 6 Jul 2020 08:24:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 6 Jul 2020 08:24:12 +0530    

Click here for diff

Author: Vignesh C  
Reviewed-by: Sawada Masahiko  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/CALDaNm3Ppt71NafGY5mk3V2i3Q+mm93pVibDq-0NpW7WU67Jcg@mail.gmail.com  

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

doc: Spell checking

commit   : ffb23488af5e6776935c46370465dcc1704e7540    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 5 Jul 2020 15:37:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 5 Jul 2020 15:37:57 +0200    

Click here for diff

M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/backup-manifest.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_verifybackup.sgml
M doc/src/sgml/ref/pgbench.sgml

doc: Fix incorrect reference to textout in plpgsql examples

commit   : 45f165b18b72abb1e4579a3cca0862a4e5cb8b6b    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 5 Jul 2020 19:36:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 5 Jul 2020 19:36:12 +0900    

Click here for diff

This error has survived for 22 years, and has been introduced by  
da63386.  
  
Reported-by: Erwin Brandstetter  
Discussion: https://postgr.es/m/CAGHENJ57wogGOvGXo5LgWYcqswxafLck8ELqHDR+zrkTPgs_OQ@mail.gmail.com  
Backpatch-through: 9.5  

M doc/src/sgml/plpgsql.sgml

Rename enable_incrementalsort for clarity

commit   : 94e454cddfbae5e32ae7bb70fedd24f243cd486a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 5 Jul 2020 11:41:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 5 Jul 2020 11:41:52 +0200    

Click here for diff

Author: James Coleman <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/df652910-e985-9547-152c-9d4357dc3979%402ndquadrant.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/release-13.sgml
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/optimizer/cost.h
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/incremental_sort.sql
M src/test/regress/sql/partition_aggregate.sql

Fix "ignoring return value" complaints from commit 96d1f423f9

commit   : c536da177cbbc9e30de17a0a445b53d79a5bbe7f    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 4 Jul 2020 13:47:07 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 4 Jul 2020 13:47:07 -0400    

Click here for diff

The cfbot and some BF animals are complaining about the previous  
read_binary_file commit because of ignoring return value of ‘fread’.  
So let's make everyone happy by testing the return value even though  
not strictly needed.  
  
Reported by Justin Pryzby, and suggested patch by Tom Lane. Backpatched  
to v11 same as the previous commit.  
  
Reported-By: Justin Pryzby  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/flat/969b8d82-5bb2-5fa8-4eb1-f0e685c5d736%40joeconway.com  
Backpatch-through: 11  

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

Read until EOF vice stat-reported size in read_binary_file

commit   : 0025c3a2c295459002711e0b37e48e3b067a83ba    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 4 Jul 2020 06:28:21 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 4 Jul 2020 06:28:21 -0400    

Click here for diff

read_binary_file(), used by SQL functions pg_read_file() and friends,  
uses stat to determine file length to read, when not passed an explicit  
length as an argument. This is problematic, for example, if the file  
being read is a virtual file with a stat-reported length of zero.  
Arrange to read until EOF, or StringInfo data string lenth limit, is  
reached instead.  
  
Original complaint and patch by me, with significant review, corrections,  
advice, and code optimizations by Tom Lane. Backpatched to v11. Prior to  
that only paths relative to the data and log dirs were allowed for files,  
so no "zero length" files were reachable anyway.  
  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/flat/969b8d82-5bb2-5fa8-4eb1-f0e685c5d736%40joeconway.com  
Backpatch-through: 11  

M contrib/adminpack/expected/adminpack.out
M src/backend/utils/adt/genfile.c

Clamp total-tuples estimates for foreign tables to ensure planner sanity.

commit   : 9233624b128b41fd410712a7223821878f1943b0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jul 2020 19:01:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jul 2020 19:01:21 -0400    

Click here for diff

After running GetForeignRelSize for a foreign table, adjust rel->tuples  
to be at least as large as rel->rows.  This prevents bizarre behavior  
in estimate_num_groups() and perhaps other places, especially in the  
scenario where rel->tuples is zero because pg_class.reltuples is  
(suggesting that ANALYZE has never been run for the table).  As things  
stood, we'd end up estimating one group out of any GROUP BY on such a  
table, whereas the default group-count estimate is more likely to result  
in a sane plan.  
  
Also, clarify in the documentation that GetForeignRelSize has the option  
to override the rel->tuples value if it has a better idea of what to use  
than what is in pg_class.reltuples.  
  
Per report from Jeff Janes.  Back-patch to all supported branches.  
  
Patch by me; thanks to Etsuro Fujita for review  
  
Discussion: https://postgr.es/m/CAMkU=1xNo9cnan+Npxgz0eK7394xmjmKg-QEm8wYG9P5-CcaqQ@mail.gmail.com  

M doc/src/sgml/fdwhandler.sgml
M src/backend/optimizer/path/allpaths.c

Fix temporary tablespaces for shared filesets some more.

commit   : cfe89f5e6b7874e89dac7d9511b1894a7d033870    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jul 2020 17:01:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jul 2020 17:01:34 -0400    

Click here for diff

Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted  
side-effects on the behavior of GetNextTempTableSpace().  Instead,  
let's make SharedFileSetInit() responsible for subbing in the value  
of MyDatabaseTableSpace when the default tablespace is called for.  
  
The convention about what is in the tempTableSpaces[] array is  
evidently insufficiently documented, so try to improve that.  
  
It also looks like SharedFileSetInit() is doing the wrong thing in the  
case where temp_tablespaces is empty.  It was hard-wiring use of the  
pg_default tablespace, but it seems like using MyDatabaseTableSpace  
is more consistent with what happens for other temp files.  
  
Back-patch the reversion of PrepareTempTablespaces()'s behavior to  
9.5, as ecd9e9f0b was.  The changes in SharedFileSetInit() go back  
to v11 where that was introduced.  (Note there is net zero code change  
before v11 from these two patch sets, so nothing to release-note.)  
  
Magnus Hagander and Tom Lane  
  
Discussion: https://postgr.es/m/CABUevExg5YEsOvqMxrjoNvb3ApVyH+9jggWGKwTDFyFCVWczGQ@mail.gmail.com  

M src/backend/commands/tablespace.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/sharedfileset.c

Fix temporary tablespaces for shared filesets

commit   : 1d94c3965450417ebb0e0fd73ea636df823feeed    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 3 Jul 2020 15:09:06 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 3 Jul 2020 15:09:06 +0200    

Click here for diff

A likely copy/paste error in 98e8b480532 from  back in 2004 would  
cause temp tablespace to be reset to InvalidOid if temp_tablespaces  
was set to the same value as the primary tablespace in the database.  
This would cause shared filesets (such as for parallel hash joins)  
to ignore them, putting the temporary files in the default tablespace  
instead of the configured one. The bug is in the old code, but it  
appears to have been exposed only once we had shared filesets.  
  
Reviewed-By: Daniel Gustafsson  
Discussion: https://postgr.es/m/CABUevExg5YEsOvqMxrjoNvb3ApVyH+9jggWGKwTDFyFCVWczGQ@mail.gmail.com  
Backpatch-through: 9.5  

M src/backend/commands/tablespace.c

doc: Correct description of restart_lsn in pg_replication_slots

commit   : 95a604eaebd145729d9f8c936b37703a212f27fd    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Jul 2020 12:08:35 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Jul 2020 12:08:35 +0900    

Click here for diff

Previously the document explained that restart_lsn indicates the LSN of  
oldest WAL won't be automatically removed during checkpoints. But  
since v13 this was no longer true thanks to max_slot_wal_keep_size.  
  
Back-patch to v13 where max_slot_wal_keep_size was added.  
  
Author: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml

Change default of pg_stat_statements.track_planning to off.

commit   : 8d459762b10372e48845a49b305f4e1e165fe173    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Jul 2020 11:35:22 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Jul 2020 11:35:22 +0900    

Click here for diff

Since v13 pg_stat_statements is allowed to track the planning time of  
statements when track_planning option is enabled. Its default was on.  
  
But this feature could cause more terrible spinlock contentions in  
pg_stat_statements. As a result of this, Robins Tharakan reported that  
v13 beta1 showed ~45% performance drop at high DB connection counts  
(when compared with v12.3) during fully-cached SELECT-only test using  
pgbench.  
  
To avoid this performance regression by the default setting,  
this commit changes default of pg_stat_statements.track_planning to off.  
  
Back-patch to v13 where pg_stat_statements.track_planning was introduced.  
  
Reported-by: Robins Tharakan  
Author: Fujii Masao  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
M doc/src/sgml/pgstatstatements.sgml

Improve vacuum error context handling.

commit   : 83fa48c8cd26c9a8171a85e786bb6ae1c5b04139    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 1 Jul 2020 08:06:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 1 Jul 2020 08:06:00 +0530    

Click here for diff

Use separate functions to save and restore error context information as  
that made code easier to understand.  Also, make it clear that the index  
information required for error context is sane.  
  
Author: Andres Freund, Justin Pryzby, Amit Kapila  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/CAA4eK1LWo+v1OWu=Sky27GTGSCuOmr7iaURNbc5xz6jO+SaPeA@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/tools/pgindent/typedefs.list

Fix removal of files generated by TAP tests for SSL

commit   : 48d50ee9aff9be0817a175418e100b7d7fa55a0f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Jul 2020 10:47:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Jul 2020 10:47:29 +0900    

Click here for diff

001_ssltests.pl and 002_scram.pl both generated an extra file for a  
client key used in the tests that were not removed.  In Debian, this  
causes repeated builds to fail.  
  
The code refactoring done in 4dc6355 broke the cleanup done in  
001_ssltests.pl, and the new tests added in 002_scram.pl via d6e612f  
forgot the removal of one file.  While on it, fix a second issue  
introduced in 002_scram.pl where we use the same file name in 001 and  
002 for the temporary client key whose permissions are changed in the  
test, as using the same file name in both tests could cause failures  
with parallel jobs of src/test/ssl/ if one test removes a file still  
needed by the second test.  
  
Reported-by: Felix Lechner  
Author: Daniel Gustafsson, Felix Lechner  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CAFHYt543sjX=Cm_aEeoejStyP47C+Y3+Wh6WbirLXsgUMaw7iw@mail.gmail.com  
Backpatch-through: 13  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl

Further adjustments to Hashagg EXPLAIN ANALYZE output

commit   : d73e9a57bf5bd977d9bf36bc07c77a1acf45e35b    
  
author   : David Rowley <[email protected]>    
date     : Wed, 1 Jul 2020 12:16:42 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 1 Jul 2020 12:16:42 +1200    

Click here for diff

The "Disk Usage" and "HashAgg Batches" properties in the EXPLAIN ANALYZE  
output for HashAgg were previously only shown if the number of batches  
was greater than 0.  Here we change this so that these properties are  
always shown for EXPLAIN ANALYZE formats other than "text".  The idea here  
is that since the HashAgg could have spilled to disk if there had been  
more data or groups to aggregate, then it's relevant that we're clear in  
the EXPLAIN ANALYZE output when no spilling occurred in this particular  
execution of the given plan.  
  
For the "text" EXPLAIN format, we still hide these properties when no  
spilling occurs.  This EXPLAIN format is designed to be easy for humans  
to read.  To maintain the readability we have a higher threshold for which  
properties we display for this format.  
  
Discussion: https://postgr.es/m/CAApHDvo_dmNozQQTmN-2jGp1vT%3Ddxx7Q0vd%2BMvD1cGpv2HU%3DSg%40mail.gmail.com  
Backpatch-through: 13, where the hashagg spilling code was added.  

M src/backend/commands/explain.c

Fix ecpg crash with bytea and cursor variables.

commit   : 70dc45e8cb76e0c612648ccefc433b7fb2b16c2b    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 30 Jun 2020 17:31:08 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 30 Jun 2020 17:31:08 +0200    

Click here for diff

Author: Jehan-Guillaume de Rorthais <[email protected]>  

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

doc: clarify that storage parameter values are optional

commit   : 0bddb3a95995008ed116858ddde9a89e01659dae    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 30 Jun 2020 12:26:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 30 Jun 2020 12:26:51 -0400    

Click here for diff

In a few cases, the documented syntax specified storage parameter values  
as required.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_index.sgml

doc: change pg_upgrade wal_level to be not minimal

commit   : c7ff80ffaa933d26298ce2d4eb7bd90d56c16668    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 30 Jun 2020 11:55:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 30 Jun 2020 11:55:53 -0400    

Click here for diff

Previously it was specified to be only replica.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

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

Remove support for timezone "posixrules" file.

commit   : 21aac2ff96e37c75cc6814b86d4b55172090413c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jun 2020 18:55:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jun 2020 18:55:01 -0400    

Click here for diff

The IANA tzcode library has a feature to read a time zone file named  
"posixrules" and apply the daylight-savings transition dates and times  
therein, when it is given a POSIX-style time zone specification that  
lacks an explicit transition rule.  However, there's a problem with  
that code: it doesn't work for dates past the Y2038 time_t rollover.  
(Effectively, all times beyond that point are treated as standard  
time.)  The IANA crew regard this feature as legacy, so their plan is  
to remove it not fix it.  The time frame in which that will happen  
is unclear, but presumably it'll happen well before 2038.  
  
Moreover, effective with the next IANA data update (probably this  
fall), the recommended default will be to not install a "posixrules"  
file in the first place.  The time frame in which tzdata packagers  
might adopt that suggestion is likewise unclear, but at least some  
platforms will probably do it in the next year or so.  While we could  
ignore that recommendation so far as PG-supplied tzdata trees are  
concerned, builds using --with-system-tzdata will be subject to  
whatever the platform's tzdata packager decides to do.  
  
Thus, whether or not we do anything, some increasing fraction of  
Postgres users will be exposed to the behavior observed when there  
is no "posixrules" file; and if we do nothing, we'll have essentially  
no control over the timing of that change.  
  
The best thing to do to ameliorate the uncertainty seems to be to  
proactively remove the posixrules-reading feature.  If we do that in  
a scheduled release then at least we can release-note the behavioral  
change, rather than having users be surprised by it after a routine  
tzdata update.  
  
The change in question is fairly minor anyway: to be affected,  
you have to be using a POSIX-style timezone spec, it has to not  
have an explicit rule, and it has to not be one of the four traditional  
continental-USA zone names (EST5EDT, CST6CDT, MST7MDT, or PST8PDT),  
as those are special-cased.  Since the default "posixrules" file  
provides USA DST rules, the number of people who are likely to find  
such a zone spec useful is probably quite small.  Moreover, the  
fallback behavior with no explicit rule and no "posixrules" file is to  
apply current USA rules, so the only thing that really breaks is the  
DST transitions in years before 2007 (and you get the countervailing  
fix that transitions after 2038 will be applied).  
  
Now, some installations might have replaced the "posixrules" file,  
allowing e.g. EU rules to be applied to a POSIX-style timezone spec.  
That won't work anymore.  But it's not exactly clear why this solution  
would be preferable to using a regular named zone.  In any case, given  
the Y2038 issue, we need to be pushing users to stop depending on this.  
  
Back-patch into v13; it hasn't been released yet, so it seems OK to  
change its behavior.  (Personally I think we ought to back-patch  
further, but I've been outvoted.)  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datetime.sgml
M src/timezone/Makefile
M src/timezone/README
M src/timezone/localtime.c
M src/tools/msvc/Install.pm

Fix documentation of "must be vacuumed within" warning.

commit   : b86be844a40c439e44ea6fc974df37b7c2c9c832    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 27 Jun 2020 22:05:04 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 27 Jun 2020 22:05:04 -0700    

Click here for diff

Warnings start 10M transactions before xidStopLimit, which is 11M  
transactions before wraparound.  The sample WARNING output showed a  
value greater than 11M, and its HINT message predated commit  
25ec228ef760eb91c094cc3b6dea7257cc22ffb5.  Hence, the sample was  
impossible.  Back-patch to 9.5 (all supported versions).  

M doc/src/sgml/maintenance.sgml

Fix list of SSL error codes for older OpenSSL versions.

commit   : e5f63db995514473f7b3421bc80f8e7715cd6d35    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Jun 2020 13:26:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Jun 2020 13:26:17 -0400    

Click here for diff

Apparently 1.0.1 lacks SSL_R_VERSION_TOO_HIGH and  
SSL_R_VERSION_TOO_LOW.  Per buildfarm.  

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

commit   : e2bcd99be18c67fea575a9789ebafd650e6e1076    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Jun 2020 12:47:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Jun 2020 12:47:58 -0400    

Click here for diff

OpenSSL's native reports about problems related to protocol version  
restrictions are pretty opaque and inconsistent.  When we get an  
SSL error that is plausibly due to this, emit a hint message that  
includes the range of SSL protocol versions we (think we) are  
allowing.  This should at least get the user thinking in the right  
direction to resolve the problem, even if the hint isn't totally  
accurate, which it might not be for assorted reasons.  
  
Back-patch to v13 where we increased the default minimum protocol  
version, thereby increasing the risk of this class of failure.  
  
Patch by me, reviewed by Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

Change libpq's default ssl_min_protocol_version to TLSv1.2.

commit   : 16412c78403e8ebcb06e34ac1eb74ff8dd299495    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Jun 2020 12:20:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Jun 2020 12:20:33 -0400    

Click here for diff

When we initially created this parameter, in commit ff8ca5fad, we left  
the default as "allow any protocol version" on grounds of backwards  
compatibility.  However, that's inconsistent with the backend's default  
since b1abfec82; protocol versions prior to 1.2 are not considered very  
secure; and OpenSSL has had TLSv1.2 support since 2012, so the number  
of PG servers that need a lesser minimum is probably quite small.  
  
On top of those things, it emerges that some popular distros (including  
Debian and RHEL) set MinProtocol=TLSv1.2 in openssl.cnf.  Thus, far  
from having "allow any protocol version" behavior in practice, what  
we actually have as things stand is a platform-dependent lower limit.  
  
So, change our minds and set the min version to TLSv1.2.  Anybody  
wanting to connect with a new libpq to a pre-2012 server can either  
set ssl_min_protocol_version=TLSv1 or accept the fallback to non-SSL.  
  
Back-patch to v13 where the aforementioned patches appeared.  
  
Patch by me, reviewed by Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

Persist slot invalidation correctly

commit   : 3b4b541777f0b85df7626623ef78df0ea48ca5dc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jun 2020 20:41:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jun 2020 20:41:29 -0400    

Click here for diff

We failed to save slot to disk after invalidating it, so the state was  
lost in case of server restart or crash.  Fix by marking it dirty and  
flushing.  
  
Also, if the slot is known invalidated we don't need to reason about the  
LSN at all -- it's known invalidated.  Only test the LSN if the slot is  
known not invalidated.  
  
Author: Fujii Masao <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c

doc: PG 13 relnotes; remove FOREIGN keyword item and clarify

commit   : 1f601b14e3a7c5ca035cfb59575462004a8c3125    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 26 Jun 2020 18:24:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 26 Jun 2020 18:24:12 -0400    

Click here for diff

Clarify --include-foreign-data option addition.  
  
Reported-by:  Masahiko Sawada, Alvaro Herrera  
  
Discussion: https://postgr.es/m/CA+fd4k62hYtce8VrEMGm6Y+1c24QBgCksXvOaH5kE8PbY+68sA@mail.gmail.com  
  
Backpatch-through: 13 only  

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

Doc: explain that "timestamp - timestamp" applies justify_hours().

commit   : 098868b57687ef9c5e3cd9dff469594c6a1c6d10    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jun 2020 13:54:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jun 2020 13:54:01 -0400    

Click here for diff

Back-patch to v13; before that, there's not really space for this  
kind of detail.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

doc: mention trigger helper functions in CREATE TRIGGER docs

commit   : 08671057e025b48136d4eed5477f287ffce217b0    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 25 Jun 2020 18:33:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 25 Jun 2020 18:33:28 -0400    

Click here for diff

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

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

docs: clarify that CREATE DATABASE does not copy db permissions

commit   : 563ed36d5b4819066e13f5272bf1a02cf5dac0bf    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 25 Jun 2020 18:22:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 25 Jun 2020 18:22:44 -0400    

Click here for diff

That is, those database permissions set by GRANT.  
  
Diagnosed-by: Joseph Nahmias  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

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

Fix misuse of table_index_fetch_tuple_check().

commit   : 8c2010f12344ed8834c6f63406a78e5843ebec69    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 25 Jun 2020 10:55:26 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 25 Jun 2020 10:55:26 -0700    

Click here for diff

Commit 0d861bbb, which added deduplication to nbtree, had  
_bt_check_unique() pass a TID to table_index_fetch_tuple_check() that  
isn't safe to mutate.  table_index_fetch_tuple_check()'s tid argument is  
modified when the TID in question is not the latest visible tuple in a  
hot chain, though this wasn't documented.  
  
To fix, go back to using a local copy of the TID in _bt_check_unique(),  
and update comments above table_index_fetch_tuple_check().  
  
Backpatch: 13-, where B-Tree deduplication was introduced.  

M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/table/tableam.c
M src/include/access/tableam.h

Doc: correct nitpicky mistakes in array_position/array_positions examples.

commit   : 185c6bc4aef1201b7d0f2c4e9c8893c4a663dfd4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jun 2020 13:28:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jun 2020 13:28:30 -0400    

Click here for diff

Daniel Gustafsson and Erik Rijkers, per report from nick@cleaton  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/array.sgml

Remove erroneous assertion from pg_copy_logical_replication_slot().

commit   : 126c8fcec790652dd0cb755fdeedf2c02c8d8079    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 25 Jun 2020 11:13:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 25 Jun 2020 11:13:13 +0900    

Click here for diff

If restart_lsn of logical replication slot gets behind more than  
max_slot_wal_keep_size from the current LSN, the logical replication slot  
would be invalidated and its restart_lsn is reset to an invalid LSN.  
If this logical replication slot with an invalid restart_lsn was specified as  
the source slot in pg_copy_logical_replication_slot(), the function caused  
the assertion failure unexpectedly.  
  
This assertion was added because restart_lsn should not be invalid before.  
But in v13, it can be invalid thanks to max_slot_wal_keep_size. So since this  
assertion is no longer useful, this commit removes it.  
  
This commit also changes the errcode in the error message that  
pg_copy_logical_replication_slot() emits when the slot with an invalid  
restart_lsn is specified, to more appropriate one.  
  
Back-patch to v13 where max_slot_wal_keep_size was added and  
the assertion was no longer valid.  
  
Author: Fujii Masao  
Reviewed-by: Alvaro Herrera, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slotfuncs.c

Fix compiler warning induced by commit d8b15eeb8.

commit   : 086bef8ac8b3635e7af94ac41e92dfc016b87e90    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Jun 2020 15:47:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Jun 2020 15:47:30 -0400    

Click here for diff

I forgot that INT64_FORMAT can't be used with sscanf on Windows.  
Use the same trick of sscanf'ing into a temp variable as we do in  
some other places in zic.c.  
  
The upstream IANA code avoids the portability problem by relying on  
<inttypes.h>'s SCNdFAST64 macro.  Once we're requiring C99 in all  
branches, we should do likewise and drop this set of diffs from  
upstream.  For now, though, a hack seems fine, since we do not  
actually care about leapseconds anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/zic.c

Adjust max_slot_wal_keep_size behavior per review

commit   : 6f7a862bed3a49283c74c0adf207172002e3e03c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jun 2020 14:23:39 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jun 2020 14:23:39 -0400    

Click here for diff

In pg_replication_slot, change output from normal/reserved/lost to  
reserved/extended/unreserved/ lost, which better expresses the possible  
states particularly near the time where segments are no longer safe but  
checkpoint has not run yet.  
  
Under the new definition, reserved means the slot is consuming WAL  
that's still under the normal WAL size constraints; extended means it's  
consuming WAL that's being protected by wal_keep_segments or the slot  
itself, whose size is below max_slot_wal_keep_size; unreserved means the  
WAL is no longer safe, but checkpoint has not yet removed those files.  
Such as slot is in imminent danger, but can still continue for a little  
while and may catch up to the reserved WAL space.  
  
Also, there were some bugs in the calculations used to report the  
status; fixed those.  
  
Backpatch to 13.  
  
Reported-by: Fujii Masao <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Fujii Masao <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/access/transam/xlog.c
M src/backend/replication/slotfuncs.c
M src/include/access/xlog.h
M src/test/recovery/t/019_replslot_limit.pl

Save slot's restart_lsn when invalidated due to size

commit   : 12e52ba5a76e56aacdfbbb269e6b45c53d80c477    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jun 2020 14:15:17 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jun 2020 14:15:17 -0400    

Click here for diff

We put it aside as invalidated_at, which let us show "lost" in  
pg_replication slot.  Prior to this change, the state value was reported  
as NULL.  
  
Backpatch to 13.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Add parens to ConvertToXSegs macro

commit   : 411493d701e2f97e778dc1ff14fb7169eea2e94c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jun 2020 14:00:37 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jun 2020 14:00:37 -0400    

Click here for diff

The current definition is dangerous.  No bugs exist in our code at  
present, but backpatch to 11 nonetheless where it was introduced.  
  
Author: Álvaro Herrera <[email protected]>  

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

Stamp 13beta2.

commit   : bc4d7817e0cbd26998ebaa682772bf6bc579c302    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Jun 2020 17:16:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Jun 2020 17:16:25 -0400    

Click here for diff

M configure
M configure.in

Doc fixup for hashagg_avoid_disk_plan GUC.

commit   : d33f33539d7f90d024a1dcb73b74c15b07349be8    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 22 Jun 2020 12:14:55 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 22 Jun 2020 12:14:55 -0700    

Click here for diff

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

M doc/src/sgml/config.sgml

Undo double-quoting of index names in non-text EXPLAIN output formats.

commit   : 57f8b9913b912f2bdfe24b73d44b9713e328ee2e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Jun 2020 11:46:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Jun 2020 11:46:41 -0400    

Click here for diff

explain_get_index_name() applied quote_identifier() to the index name.  
This is fine for text output, but the non-text output formats all have  
their own quoting conventions and would much rather start from the  
actual index name.  For example in JSON you'd get something like  
  
       "Index Name": "\"My Index\"",  
  
which is surely not desirable, especially when the same does not  
happen for table names.  Hence, move the responsibility for applying  
quoting out to the callers, where it can go into already-existing  
special code paths for text format.  
  
This changes the API spec for users of explain_get_index_name_hook:  
before, they were supposed to apply quote_identifier() if necessary,  
now they should not.  Research suggests that the only publicly  
available user of the hook is hypopg, and it actually forgot to  
apply quoting anyway, so it's fine.  (In any case, there's no  
behavioral change for the output of a hook as seen in non-text  
EXPLAIN formats, so this won't break any case that programs should  
be relying on.)  
  
Digging in the commit logs, it appears that quoting was included in  
explain_get_index_name's duties when commit 604ffd280 invented it;  
and that was fine at the time because we only had text output format.  
This should have been rethought when non-text formats were invented,  
but it wasn't.  
  
This is a fairly clear bug for users of non-text EXPLAIN formats,  
so back-patch to all supported branches.  
  
Per bug #16502 from Maciek Sakrejda.  Patch by me (based on  
investigation by Euler Taveira); thanks to Julien Rouhaud for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c

Translation updates

commit   : 793e5ad3cb7f8a8345881c7057618228546de3c6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jun 2020 14:08:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jun 2020 14:08:30 +0200    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/sv.po
M src/bin/initdb/po/es.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_rewind/po/sv.po
M src/bin/psql/po/de.po
M src/bin/psql/po/sv.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/sv.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/sv.po
M src/pl/plpgsql/src/po/de.po
M src/pl/plpgsql/src/po/sv.po

commit   : 70004a2a0c52e05f4aa67541fb165715a3981204    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jun 2020 04:48:03 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jun 2020 04:48:03 +0300    

Click here for diff

Discussion: https://postgr.es/m/20200620232145.GB17995%40telsasoft.com  
Author: Justin Pryzby  
Backpatch-through: 13  

M doc/src/sgml/brin.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/xindex.sgml

Doc: Tweak description of B-Tree duplicate tuples.

commit   : f7e4989d1c65c376ca4aba2d39dc81cd1eaefe67    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 20 Jun 2020 17:34:06 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 20 Jun 2020 17:34:06 -0700    

Click here for diff

Defining duplicates as "close by" to each other was unclear.  Simplify  
the definition.  
  
Backpatch: 13-, where deduplication was introduced (by commit 0d861bbb)  

M doc/src/sgml/btree.sgml

commit   : b56d91ebd2bef20f9adbcc61c1279083a91bdf3e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jun 2020 00:35:42 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jun 2020 00:35:42 +0300    

Click here for diff

Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-WzmwhYbxuoL0WjTLaiCxW3gj6qadeNpBhWAo_KZsE5-FGw%40mail.gmail.com  

M doc/src/sgml/btree.sgml
M doc/src/sgml/spgist.sgml

Fix masking of SP-GiST pages during xlog consistency check

commit   : 39aafc88c4b4ac281df8b2c2b8be72d4e4d99e9f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 20 Jun 2020 17:34:51 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 20 Jun 2020 17:34:51 +0300    

Click here for diff

spg_mask() didn't take into account that pd_lower equal to SizeOfPageHeaderData  
is still valid value.  This commit fixes that.  Backpatch to 11, where  
spg_mask() pg_lower check was introduced.  
  
Reported-by: Michael Paquier  
Discussion: https://postgr.es/m/20200615131405.GM52676%40paquier.xyz  
Backpatch-through: 11  

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

Add documentation for opclass options

commit   : e6c6f427e356e3706ce2f0ae7e7e94e5501bbc13    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 20 Jun 2020 13:34:54 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 20 Jun 2020 13:34:54 +0300    

Click here for diff

911e7020770 added opclass options and adjusted documentation for each  
particular affected opclass.  However, documentation for extendability was  
not adjusted.  This commit adjusts documentation for interfaces of index AMs  
and opclasses.  
  
Discussion: https://postgr.es/m/CAH2-WzmQnW6%2Bz5F9AW%2BSz%2BzEcEvXofTwh_A9J3%3D_WA-FBP0wYg%40mail.gmail.com  
Author: Alexander Korotkov  
Reported-by: Peter Geoghegan  
Reviewed-by: Peter Geoghegan  

M doc/src/sgml/brin.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/xindex.sgml

Ensure write failure reports no-disk-space

commit   : e74559c9763049ff4d3edd26817bad58c13113a1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jun 2020 16:46:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jun 2020 16:46:07 -0400    

Click here for diff

A few places calling fwrite and gzwrite were not setting errno to ENOSPC  
when reporting errors, as is customary; this led to some failures being  
reported as  
"could not write file: Success"  
which makes us look silly.  Make a few of these places in pg_dump and  
pg_basebackup use our customary pattern.  
  
Backpatch-to: 9.5  
Author: Justin Pryzby <[email protected]>  
Author: Tom Lane <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_directory.c

Future-proof regression tests against possibly-missing posixrules file.

commit   : 577dcf890cdb2621cf21ded1a2b6c96c40441f3d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Jun 2020 13:55:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Jun 2020 13:55:21 -0400    

Click here for diff

The IANA time zone folk have deprecated use of a "posixrules" file in  
the tz database.  While for now it's our choice whether to keep  
supplying one in our own builds, installations built with  
--with-system-tzdata will soon be needing to cope with that file not  
being present, at least on some platforms.  
  
This causes a problem for the horology test, which expected the  
nonstandard POSIX zone spec "CST7CDT" to apply pre-2007 US daylight  
savings rules.  That does happen if the posixrules file supplies such  
information, but otherwise the test produces undesired results.  
To fix, add an explicit transition date rule that matches 2005 practice.  
(We could alternatively have switched the test to use some real time  
zone, but it seems useful to have coverage of this type of zone spec.)  
  
While at it, update a documentation example that also relied on  
"CST7CDT"; use a real-world zone name instead.  Also, document why  
the zone names EST5EDT, CST6CDT, MST7MDT, PST8PDT aren't subject to  
similar failures when "posixrules" is missing.  
  
Back-patch to all supported branches, since the hazard is the same  
for all.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datetime.sgml
M doc/src/sgml/func.sgml
M src/test/regress/expected/horology.out
M src/test/regress/sql/horology.sql

Adjust some glossary terms

commit   : 91a890bd7fef1cd8bfe3c8832eea114290f16b02    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jun 2020 12:55:43 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 19 Jun 2020 12:55:43 -0400    

Click here for diff

Mostly in response to Jürgen Purtz critique of previous definitions,  
though I added many other changes.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Jürgen Purtz <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Erik Rijkers <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/glossary.sgml

Fix deduplication "single value" strategy bug.

commit   : dedb92d4a3adc6b5165a619383739ab05d24b24d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 19 Jun 2020 08:57:23 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 19 Jun 2020 08:57:23 -0700    

Click here for diff

It was possible for deduplication's single value strategy to mistakenly  
believe that a very small duplicate tuple counts as one of the six large  
tuples that it aims to leave behind after the page finally splits.  This  
could cause slightly suboptimal space utilization with very low  
cardinality indexes, though only under fairly narrow conditions.  
  
To fix, be particular about what kind of tuple counts as a  
maxpostingsize-capped tuple.  This avoids confusion in the event of a  
small tuple that gets "wedged" between two large tuples, where all  
tuples on the page are duplicates of the same value.  
  
Discussion: https://postgr.es/m/CAH2-Wz=Y+sgSFc-O3LpiZX-POx2bC+okec2KafERHuzdVa7-rQ@mail.gmail.com  
Backpatch: 13-, where deduplication was introduced (by commit 0d861bbb)  

M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/nbtree.h

Fix issues in invalidation of obsolete replication slots.

commit   : 08aa3151e7308556130c644c237fa4b20dfd6eba    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 19 Jun 2020 17:15:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 19 Jun 2020 17:15:52 +0900    

Click here for diff

This commit fixes the following issues.  
  
1. There is the case where the slot is dropped while trying to invalidate it.  
    InvalidateObsoleteReplicationSlots() did not handle this case, and  
    which could cause checkpoint to fail.  
  
2. InvalidateObsoleteReplicationSlots() could emit the same log message  
    multiple times unnecessary. It should be logged only once.  
  
3. When marking the slot as used, we always searched the target slot from  
    all the replication slots even if we already found it. This could cause  
    useless waste of cycles.  
  
Back-patch to v13 where these issues were added as a part of  
max_slot_wal_keep_size code.  
  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, Alvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c

Fix EXPLAIN ANALYZE for parallel HashAgg plans

commit   : bdee4af8e07648008fe522fc5a562db453be5ad7    
  
author   : David Rowley <[email protected]>    
date     : Fri, 19 Jun 2020 17:25:07 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 19 Jun 2020 17:25:07 +1200    

Click here for diff

Since 1f39bce02, HashAgg nodes have had the ability to spill to disk when  
memory consumption exceeds work_mem. That commit added new properties to  
EXPLAIN ANALYZE to show the maximum memory usage and disk usage, however,  
it didn't quite go as far as showing that information for parallel  
workers.  Since workers may have experienced something very different from  
the main process, we should show this information per worker, as is done  
in Sort.  
  
Reviewed-by: Justin Pryzby  
Reviewed-by: Jeff Davis  
Discussion: https://postgr.es/m/CAApHDvpEKbfZa18mM1TD7qV6PG+w97pwCWq5tVD0dX7e11gRJw@mail.gmail.com  
Backpatch-through: 13, where the hashagg spilling code was added.  

M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeAgg.c
M src/include/executor/nodeAgg.h
M src/include/nodes/execnodes.h

Fix deadlock danger when atomic ops are done under spinlock.

commit   : 5fffa8fce37b981e1a5bb79affce9a856e021265    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2020 16:50:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2020 16:50:37 -0700    

Click here for diff

This was a danger only for --disable-spinlocks in combination with  
atomic operations unsupported by the current platform.  
  
While atomics.c was careful to signal that a separate semaphore ought  
to be used when spinlock emulation is active, spin.c didn't actually  
implement that mechanism. That's my (Andres') fault, it seems to have  
gotten lost during the development of the atomic operations support.  
  
Fix that issue and add test for nesting atomic operations inside a  
spinlock.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-  

M src/backend/storage/lmgr/spin.c
M src/test/regress/regress.c

Add basic spinlock tests to regression tests.

commit   : 59225dcefef278415aef64c3b96f84616b95661e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2020 16:36:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2020 16:36:51 -0700    

Click here for diff

As s_lock_test, the already existing test for spinlocks, isn't run in  
an automated fashion (and doesn't test a normal backend environment),  
adding tests that are run as part of a normal regression run is a good  
idea. Particularly in light of several recent and upcoming spinlock  
related fixes.  
  
Currently the new tests are run as part of the pre-existing  
test_atomic_ops() test. That perhaps can be quibbled about, but for  
now seems ok.  
  
The only operations that s_lock_test tests but the new tests don't are  
the detection of a stuck spinlock and S_LOCK_FREE (which is otherwise  
unused, not implemented on all platforms, and will be removed).  
  
This currently contains a test for more than INT_MAX spinlocks (only  
run with --disable-spinlocks), to ensure the recent commit fixing a  
bug with more than INT_MAX spinlock initializations is correct. That  
test is somewhat slow, so we might want to disable it after a few  
days.  
  
It might be worth retiring s_lock_test after this. The added coverage  
of a stuck spinlock probably isn't worth the added complexity?  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/regress.c

Doc: document POSIX-style time zone specifications in full.

commit   : c10dc2d11791cc18ceea78caa94eb4b651090259    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Jun 2020 16:27:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Jun 2020 16:27:18 -0400    

Click here for diff

We'd glossed over most of this complexity for years, but it's hard  
to avoid writing it all down now, so that we can explain what happens  
when there's no "posixrules" file in the IANA time zone database.  
That was at best a tiny minority situation till now, but it's likely  
to become quite common in the future, so we'd better explain it.  
  
Nonetheless, we don't really encourage people to use POSIX zone specs;  
picking a named zone is almost always what you really want, unless  
perhaps you're stuck with an out-of-date zone database.  Therefore,  
let's shove all this detail into an appendix.  
  
Patch by me; thanks to Robert Haas for help with some awkward wording.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/datetime.sgml

Fix oldest xmin and LSN computation across repslots after advancing

commit   : 43e70addf5a65f1b99c286f82e2e4970b0c2fda7    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jun 2020 16:35:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jun 2020 16:35:29 +0900    

Click here for diff

Advancing a replication slot did not recompute the oldest xmin and LSN  
values across replication slots, preventing resource removal like  
segments not recycled at checkpoint time.  The original commit that  
introduced the slot advancing in 9c7d06d never did the update of those  
oldest values, and b0afdca removed this code.  
  
This commit adds a TAP test to check segment recycling with advancing  
for physical slots, enforcing an extra segment switch before advancing  
to check if the segment gets correctly recycled after a checkpoint.  
  
Reported-by: Andres Freund  
Reviewed-by: Alexey Kondratov, Kyptaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/replication/slotfuncs.c
M src/test/recovery/t/001_stream_rep.pl

doc: Fix formatting typo

commit   : f2236d087eb8df9f15c016c02c92aa2bed7c2889    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jun 2020 03:22:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jun 2020 03:22:26 +0200    

Click here for diff

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

Sync our copy of the timezone library with IANA release tzcode2020a.

commit   : 484a57643e02b7df2bb9085603772b33511c6668    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jun 2020 18:29:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jun 2020 18:29:29 -0400    

Click here for diff

This absorbs a leap-second-related bug fix in localtime.c, and  
teaches zic to handle an expiration marker in the leapseconds file.  
Neither are of any interest to us (for the foreseeable future  
anyway), but we need to stay more or less in sync with upstream.  
  
Also adjust some over-eager changes in the README from commit 957338418.  
I have no intention of making changes that require C99 in this code,  
until such time as all the live back branches require C99.  Otherwise  
back-patching will get too exciting.  
  
For the same reason, absorb assorted whitespace and other cosmetic  
changes from HEAD into the back branches; mostly this reflects use of  
improved versions of pgindent.  
  
All in all then, quite a boring update.  But I figured I'd get it  
done while I was looking at this code.  

M src/timezone/README
M src/timezone/localtime.c
M src/timezone/zic.c

Fix nbtree.h dedup state comment.

commit   : 6b296102920323f360d53457ecda5179284cca8c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 17 Jun 2020 15:23:54 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 17 Jun 2020 15:23:54 -0700    

Click here for diff

Oversight in commit 0d861bbb.  

M src/include/access/nbtree.h

spinlock emulation: Fix bug when more than INT_MAX spinlocks are initialized.

commit   : 276bdc93924afb2bd793627f49a9e7edd4172b63    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2020 15:25:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2020 15:25:49 -0700    

Click here for diff

Once the counter goes negative we ended up with spinlocks that errored  
out on first use (due to check in tas_sema).  
  
Author: Andres Freund  
Reviewed-By: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-  

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

Avoid potential spinlock in a signal handler as part of global barriers.

commit   : 09bff91b316e90bf7f523593c1e8000c772cbe52    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 15 Jun 2020 18:23:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 15 Jun 2020 18:23:10 -0700    

Click here for diff

On platforms without support for 64bit atomic operations where we also  
cannot rely on 64bit reads to have single copy atomicity, such atomics  
are implemented using a spinlock based fallback. That means it's not  
safe to even read such atomics from within a signal handler (since the  
signal handler might run when the spinlock already is held).  
  
To avoid this issue defer global barrier processing out of the signal  
handler. Instead of checking local / shared barrier generation to  
determine whether to set ProcSignalBarrierPending, introduce  
PROCSIGNAL_BARRIER and always set ProcSignalBarrierPending when  
receiving such a signal. Additionally avoid redundant work in  
ProcessProcSignalBarrier if ProcSignalBarrierPending is unnecessarily.  
  
Also do a small amount of other polishing.  
  
Author: Andres Freund  
Reviewed-By: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 13-, where the code was introduced.  

M src/backend/storage/ipc/procsignal.c
M src/include/storage/procsignal.h

Doc: fix copy-and-pasteo in ecpg docs.

commit   : 7f932f77c7eb068772355c76cfa48bc5d0260e2f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Jun 2020 16:41:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Jun 2020 16:41:11 -0400    

Click here for diff

The synopsis for PGTYPESinterval_free() used the wrong name.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ecpg.sgml

Fix file reference in nls.mk

commit   : 9c25a873d631036a92036394863eba1f4a3f3cd5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jun 2020 17:25:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jun 2020 17:25:20 +0200    

Click here for diff

Broken by move of fe_archive.c to fe_utils.  

M src/bin/pg_rewind/nls.mk

Fix buffile.c error handling.

commit   : 3e0b08c404b2a7d799db78eb942a01534ac7926b    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 16 Jun 2020 13:50:56 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 16 Jun 2020 13:50:56 +1200    

Click here for diff

Convert buffile.c error handling to use ereport.  This fixes cases where  
I/O errors were indistinguishable from EOF or not reported.  Also remove  
"%m" from error messages where errno would be bogus.  While we're  
modifying those strings, add block numbers and short read byte counts  
where appropriate.  
  
Back-patch to all supported releases.  
  
Reported-by: Amit Khandekar <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Ibrar Ahmed <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJE04G%3D8TLK0DLypT_27D9dR8F1RQgNp0jK6qR0tZGWOw%40mail.gmail.com  

M src/backend/access/gist/gistbuildbuffers.c
M src/backend/executor/nodeHashjoin.c
M src/backend/replication/backup_manifest.c
M src/backend/storage/file/buffile.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/tuplestore.c

pg_upgrade: set vacuum_defer_cleanup_age to zero

commit   : a2c72851a898170ee1f2e7c21c1bf9086dec2d5c    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 15 Jun 2020 20:59:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 15 Jun 2020 20:59:40 -0400    

Click here for diff

Non-zero vacuum_defer_cleanup_age values cause pg_upgrade freezing of  
the system catalogs to be incomplete, or do nothing.  This will cause  
the upgrade to fail in confusing ways.  
  
Reported-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M src/bin/pg_upgrade/server.c

Doc: Add references for SI and SSI.

commit   : 4701efa9f741aa0ca38cfe922dfcaef1749b5b02    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 15 Jun 2020 11:33:13 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 15 Jun 2020 11:33:13 +1200    

Click here for diff

Our documentation failed to point out that REPEATABLE READ is really  
snapshot isolation, which might be important to some users.  Point to  
the standard reference paper for this complicated topic.  
  
Likewise, add a reference to the VLDB paper about PostgreSQL SSI, for  
technical information about our SSI implementation and how it compares  
to S2PL.  
  
While here, add a note about catalog access using a lower isolation  
level, per recent user complaint.  
  
Back-patch to all releases.  
  
Reported-by: Kyle Kingsbury <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Tatsuo Ishii <[email protected]>  
Discussion: https://postgr.es/m/db7b729d-0226-d162-a126-8a8ab2dc4443%40jepsen.io  
Discussion: https://postgr.es/m/16454-9408996bb1750faf%40postgresql.org  

M doc/src/sgml/biblio.sgml
M doc/src/sgml/mvcc.sgml

Fix behavior of float aggregates for single Inf or NaN inputs.

commit   : 33dd9bb3b0a88981f18a10d89720b4e40d8876ba    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Jun 2020 13:43:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Jun 2020 13:43:24 -0400    

Click here for diff

When there is just one non-null input value, and it is infinity or NaN,  
aggregates such as stddev_pop and covar_pop should produce a NaN  
result, because the calculation is not well-defined.  They used to do  
so, but since we adopted Youngs-Cramer aggregation in commit e954a727f,  
they produced zero instead.  That's an oversight, so fix it.  Add tests  
exercising these edge cases.  
  
Affected aggregates are  
  
 var_pop(double precision)  
 stddev_pop(double precision)  
 var_pop(real)  
 stddev_pop(real)  
 regr_sxx(double precision,double precision)  
 regr_syy(double precision,double precision)  
 regr_sxy(double precision,double precision)  
 regr_r2(double precision,double precision)  
 regr_slope(double precision,double precision)  
 regr_intercept(double precision,double precision)  
 covar_pop(double precision,double precision)  
 corr(double precision,double precision)  
  
Back-patch to v12 where the behavior change was accidentally introduced.  
  
Report and patch by me; thanks to Dean Rasheed for review.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Silence _bt_check_unique compiler warning.

commit   : e745bcc00149fe3c35ba1123800e0beb948e3678    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 13 Jun 2020 09:33:31 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 13 Jun 2020 09:33:31 -0700    

Click here for diff

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

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

Add missing extern keyword for a couple of numutils functions

commit   : 095f2d95c92704747d84d499a33b527af42bb08e    
  
author   : David Rowley <[email protected]>    
date     : Sat, 13 Jun 2020 11:28:12 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 13 Jun 2020 11:28:12 +1200    

Click here for diff

In passing, also remove a few surplus empty lines from pg_ltoa and  
pg_ulltoa_n in numutils.c  
  
Reported-by: Andrew Gierth  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13, where these changes were introduced  

M src/backend/utils/adt/numutils.c
M src/include/utils/builtins.h

Improve comments for [Heap]CheckForSerializableConflictOut().

commit   : 44eff28410598ef86d3d8bd812439aabf19f7ee0    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 12 Jun 2020 10:44:32 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 12 Jun 2020 10:44:32 +1200    

Click here for diff

Rewrite the documentation of these functions, in light of recent bug fix  
commit 5940ffb2.  
  
Back-patch to 13 where the check-for-conflict-out code was split up into  
AM-specific and generic parts, and new documentation was added that now  
looked wrong.  
  
Reviewed-by: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/db7b729d-0226-d162-a126-8a8ab2dc4443%40jepsen.io  

M src/backend/access/heap/heapam.c
M src/backend/storage/lmgr/predicate.c

doc: remove xreflabels used in PG 13 relnotes

commit   : db680fd82ede99d9a5224a1d316a64d763be1acc    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2020 18:27:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2020 18:27:59 -0400    

Click here for diff

xreflabels were removed in a previous commit  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 13 only  

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

doc: remove xreflabels from commits 75fcdd2ae2 and 85af628da5

commit   : c04612040165582f60cbcfe8ca1771598c9f3a05    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2020 18:25:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Jun 2020 18:25:46 -0400    

Click here for diff

xreflabels prevent references to the chapter numbers of sections id's.  
It should only be used in specific cases.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/geqo.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/vacuumlo.sgml

Fix doc build, broken by 13e0fa7a.

commit   : 6fbfa4eb244eab47d67fba4258c4af777729f119    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 11 Jun 2020 14:44:31 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 11 Jun 2020 14:44:31 -0700    

Click here for diff

Reported-by: Peter Geoghegan  

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

Fix mishandling of NaN counts in numeric_[avg_]combine.

commit   : ee788ba99011c9d1e8f6f352acc0b0d19350fff6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Jun 2020 17:38:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Jun 2020 17:38:42 -0400    

Click here for diff

When merging two NumericAggStates, the code missed adding the new  
state's NaNcount unless its N was also nonzero; since those counts  
are independent, this is wrong.  
  
This would only have visible effect if some partial aggregate scans  
found only NaNs while earlier ones found only non-NaNs; then we could  
end up falsely deciding that there were no NaNs and fail to return a  
NaN final result as expected.  That's pretty improbable, so it's no  
surprise this hasn't been reported from the field.  Still, it's a bug.  
  
I didn't try to produce a regression test that would show the bug,  
but I did notice that these functions weren't being reached at all  
in our regression tests, so I improved the tests to at least  
exercise them.  With these additions, I see pretty complete code  
coverage on the aggregation-related functions in numeric.c.  
  
Back-patch to 9.6 where this code was introduced.  (I only added  
the improved test case as far back as v10, though, since the  
relevant part of aggregates.sql isn't there at all in 9.6.)  

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

Rework HashAgg GUCs.

commit   : 13e0fa7ae50cd0e91158877dba37098492b234e8    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 11 Jun 2020 11:58:16 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 11 Jun 2020 11:58:16 -0700    

Click here for diff

Eliminate enable_groupingsets_hash_disk, which was primarily useful  
for testing grouping sets that use HashAgg and spill. Instead, hack  
the table stats to convince the planner to choose hashed aggregation  
for grouping sets that will spill to disk. Suggested by Melanie  
Plageman.  
  
Rename enable_hashagg_disk to hashagg_avoid_disk_plan, and invert the  
meaning of on/off. The new name indicates more strongly that it only  
affects the planner. Also, the word "avoid" is less definite, which  
should avoid surprises when HashAgg still needs to use the  
disk. Change suggested by Justin Pryzby, though I chose a different  
GUC name.  
  
Discussion: https://postgr.es/m/CAAKRu_aisiENMsPM2gC4oUY1hHG3yrCwY-fXUg22C6_MJUwQdA%40mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc.c
M src/include/optimizer/cost.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/groupingsets.sql

Avoid update conflict out serialization anomalies.

commit   : 6df7105e5d50460623421d00f24aaa46b66fa570    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 11 Jun 2020 10:09:45 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 11 Jun 2020 10:09:45 -0700    

Click here for diff

SSI's HeapCheckForSerializableConflictOut() test failed to correctly  
handle conditions involving a concurrently inserted tuple which is later  
concurrently updated by a separate transaction .  A SELECT statement  
that called HeapCheckForSerializableConflictOut() could end up using the  
same XID (updater's XID) for both the original tuple, and the successor  
tuple, missing the XID of the xact that created the original tuple  
entirely.  This only happened when neither tuple from the chain was  
visible to the transaction's MVCC snapshot.  
  
The observable symptoms of this bug were subtle.  A pair of transactions  
could commit, with the later transaction failing to observe the effects  
of the earlier transaction (because of the confusion created by the  
update to the non-visible row).  This bug dates all the way back to  
commit dafaa3ef, which added SSI.  
  
To fix, make sure that we check the xmin of concurrently inserted tuples  
that happen to also have been updated concurrently.  
  
Author: Peter Geoghegan  
Reported-By: Kyle Kingsbury  
Reviewed-By: Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: All supported versions  

M src/backend/access/heap/heapam.c
A src/test/isolation/expected/update-conflict-out.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/update-conflict-out.spec

Fix typos.

commit   : c4d5706db298f5a02ffd321c4605a7f8746b5428    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 11 Jun 2020 14:10:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 11 Jun 2020 14:10:43 +0530    

Click here for diff

Reported-by: John Naylor  
Author: John Naylor  
Backpatch-through: 9.5  
Discussion: https://postgr.es/m/CACPNZCtRuvs6G+EYqejhVJgBq2AKeZdXRVJsbX4syhO9gn5SNQ@mail.gmail.com  

M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source

Move frontend-side archive APIs from src/common/ to src/fe_utils/

commit   : 8d8b89266ca0328d78df319bacd1e809631f2acc    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 11 Jun 2020 15:48:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 11 Jun 2020 15:48:56 +0900    

Click here for diff

fe_archive.c was compiled only for the frontend in src/common/, but as  
it will never share anything with the backend, it makes most sense to  
move this file to src/fe_utils/.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/bin/pg_rewind/parsexlog.c
M src/common/Makefile
M src/fe_utils/Makefile
R094 src/common/fe_archive.c src/fe_utils/archive.c
R091 src/include/common/fe_archive.h src/include/fe_utils/archive.h
M src/tools/msvc/Mkvcbuild.pm

Update description of parameter password_encryption

commit   : d6d3f8bc8433f00a43eaf936e75c757bfd743702    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2020 11:57:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Jun 2020 11:57:41 +0200    

Click here for diff

The previous description string still described the pre-PostgreSQL  
10 (pre eb61136dc75a76caef8460fa939244d8593100f2) behavior of  
selecting between encrypted and unencrypted, but it is now choosing  
between encryption algorithms.  

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

Fix ReorderBuffer memory overflow check.

commit   : 16a8d5cf0337724affc4bbb3e8ba07f748f00898    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 10 Jun 2020 10:20:10 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 10 Jun 2020 10:20:10 +0530    

Click here for diff

Commit cec2edfa78 introduced logical_decoding_work_mem to limit  
ReorderBuffer memory usage. We spill the changes once the memory occupied  
by changes exceeds logical_decoding_work_mem.  There was an assumption  
in the code that by evicting the largest (sub)transaction we will come  
under the memory limit as the selected transaction will be at least as  
large as the most recent change (which caused us to go over the memory  
limit).  However, that is not true because a user can reduce the  
logical_decoding_work_mem to a smaller value before the most recent  
change.  
  
We fix it by allowing to evict the transactions until we reach under the  
memory limit.  
  
Reported-by: Fujii Masao  
Author: Amit Kapila  
Reviewed-by: Fujii Masao  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/[email protected]  

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

Spelling adjustments

commit   : a5202889b4c78e8ffcdd8be35d59f0a7aa644f64    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Jun 2020 10:41:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Jun 2020 10:41:41 +0200    

Click here for diff

similar to 0fd2a79a637f9f96b9830524823df0454e962f96  

M contrib/pg_trgm/trgm_regexp.c
M src/backend/commands/explain.c
M src/backend/optimizer/plan/planner.c
M src/pl/plpgsql/src/expected/plpgsql_control.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h

Fix invalid function references in a few comments

commit   : 4d655f154565662cbd11f1ce5c0e6a90cd6a8f56    
  
author   : David Rowley <[email protected]>    
date     : Tue, 9 Jun 2020 18:43:58 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 9 Jun 2020 18:43:58 +1200    

Click here for diff

These appear to have been forgotten when the functions were renamed in  
1fd687a03.  
  
Backpatch-through: 13, where the functions were renamed  

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

Repair unstable regression test.

commit   : 6df8fb391b0b98efc917b5cc43de77cba785864a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jun 2020 01:17:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jun 2020 01:17:59 -0400    

Click here for diff

Commit 0c882e52a tried to force table atest12 to have more-accurate-  
than-default statistics; but transiently setting default_statistics_target  
isn't enough for that, because autovacuum could come along and overwrite  
the stats later.  This evidently explains some intermittent buildfarm  
failures we've seen since then.  Repair by disabling autovac on this table.  
  
Thanks to David Rowley for correctly diagnosing the cause.  
  
Discussion: https://postgr.es/m/CA+hUKG+OUkQSOUTg=qo=S=fWa_tbm99i7rB7mfbHz1SYm4v-jQ@mail.gmail.com  

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

Fix HashAgg regression from choosing too many initial buckets.

commit   : 2174d40117f62099c7b11a2d43d163b7b9271d39    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 8 Jun 2020 20:59:45 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 8 Jun 2020 20:59:45 -0700    

Click here for diff

Diagnosis by Andres.  
  
Reported-by: Pavel Stehule  
Discussion: https://postgr.es/m/CAFj8pRDLVakD5Aagt3yZeEQeTeEWaS3YE5h8XC3Q3qJ6TYkc2Q%40mail.gmail.com  
Backpatch-through: 13  

M src/backend/executor/nodeAgg.c

Avoid need for valgrind suppressions for pg_atomic_init_u64 on some platforms.

commit   : de4a25989611d960360d0513d00b970d3b6c52c7    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2020 19:52:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 8 Jun 2020 19:52:19 -0700    

Click here for diff

Previously we used pg_atomic_write_64_impl inside  
pg_atomic_init_u64. That works correctly, but on platforms without  
64bit single copy atomicity it could trigger spurious valgrind errors  
about uninitialized memory, because we use compare_and_swap for atomic  
writes on such platforms.  
  
I previously suppressed one instance of this problem (6c878edc1df),  
but as Tom reports that wasn't enough. As the atomic variable cannot  
yet be concurrently accessible during initialization, it seems better  
to have pg_atomic_init_64_impl set the value directly.  
  
Change pg_atomic_init_u32_impl for symmetry.  
  
Reported-By: Tom Lane  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-  

M src/include/port/atomics/generic.h
M src/tools/valgrind.supp

Fix locking bugs that could corrupt pg_control.

commit   : acefa2cca6a2c2b9c0fd9f25d0c003595bed689e    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 8 Jun 2020 13:57:24 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 8 Jun 2020 13:57:24 +1200    

Click here for diff

The redo routines for XLOG_CHECKPOINT_{ONLINE,SHUTDOWN} must acquire  
ControlFileLock before modifying ControlFile->checkPointCopy, or the  
checkpointer could write out a control file with a bad checksum.  
  
Likewise, XLogReportParameters() must acquire ControlFileLock before  
modifying ControlFile and calling UpdateControlFile().  
  
Back-patch to all supported releases.  
  
Author: Nathan Bossart <[email protected]>  
Author: Fujii Masao <[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/70BF24D6-DC51-443F-B55A-95735803842A%40amazon.com  

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

Doc: Update example symptom of systemd misconfiguration.

commit   : a1c940cc58828b81cd72e04dd264fbc65e46f0de    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 8 Jun 2020 13:20:46 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 8 Jun 2020 13:20:46 +1200    

Click here for diff

In PostgreSQL 10, we stopped using System V semaphores on Linux  
systems.  Update the example we give of an error message from a  
misconfigured system to show what people are most likely to see these  
days.  
  
Back-patch to 10, where PREFERRED_SEMAPHORES=UNNAMED_POSIX arrived.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLmJUSwybaPQv39rB8ABpqJq84im2UjZvyUY4feYhpWMw%40mail.gmail.com  

M doc/src/sgml/runtime.sgml

Fix crash in WAL sender when starting physical replication

commit   : 10ffe0fa72ed895a3c18aef2d3950b480e810e13    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Jun 2020 10:12:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Jun 2020 10:12:31 +0900    

Click here for diff

Since database connections can be used with WAL senders in 9.4, it is  
possible to use physical replication.  This commit fixes a crash when  
starting physical replication with a WAL sender using a database  
connection, caused by the refactoring done in 850196b.  
  
There have been discussions about forbidding the use of physical  
replication in a database connection, but this is left for later,  
taking care only of the crash new to 13.  
  
While on it, add a test to check for a failure when attempting logical  
replication if the WAL sender does not have a database connection.  This  
part is extracted from a larger patch by Kyotaro Horiguchi.  
  
Reported-by: Vladimir Sitnikov  
Author: Michael Paquier, Kyotaro Horiguchi  
Reviewed-by: Kyotaro Horiguchi, Álvaro Herrera  
Discussion: https://postgr.es/m/CAB=Je-GOWMj1PTPkeUhjqQp-4W3=nW-pXe2Hjax6rJFffB5_Aw@mail.gmail.com  
Backpatch-through: 13  

M src/backend/access/transam/xlogreader.c
M src/backend/replication/walsender.c
M src/include/access/xlogreader.h
M src/test/recovery/t/006_logical_decoding.pl

MSVC: Avoid warning when testing a TAP suite without PROVE_FLAGS.

commit   : 9b5f85fb0a3e27040bc72451893d2dc35bb5d8bd    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 7 Jun 2020 16:27:13 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 7 Jun 2020 16:27:13 -0700    

Click here for diff

Commit 7be5d8df1f74b78620167d3abf32ee607e728919 surfaced the logic  
error, which had no functional implications, by adding "use warnings".  
The buildfarm always customizes PROVE_FLAGS, so the warning did not  
appear there.  Back-patch to 9.5 (all supported versions).  

M src/tools/msvc/vcregress.pl

pgindent run prior to branching v13.

commit   : b5d69b7c22ee4c44b8bb99cfa0466ffaf3b5fab9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Jun 2020 16:57:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Jun 2020 16:57:08 -0400    

Click here for diff

pgperltidy and reformat-dat-files too, though those didn't  
find anything to change.  

M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/optimizer/plan/createplan.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/sort/logtape.c
M src/include/access/tableam.h
M src/tools/pgindent/typedefs.list

Try to read data from the socket in pqSendSome's write_failed paths.

commit   : 7247e243a803044a79a2828ced51b05765e049a0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Jun 2020 13:44:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Jun 2020 13:44:13 -0400    

Click here for diff

Even when we've concluded that we have a hard write failure on the  
socket, we should continue to try to read data.  This gives us an  
opportunity to collect any final error message that the backend might  
have sent before closing the connection; moreover it is the job of  
pqReadData not pqSendSome to close the socket once EOF is detected.  
  
Due to an oversight in 1f39a1c06, pqSendSome failed to try to collect  
data in the case where we'd already set write_failed.  The problem was  
masked for ordinary query operations (which really only make one write  
attempt anyway), but COPY to the server would continue to send data  
indefinitely after a mid-COPY connection loss.  
  
Hence, add pqReadData calls into the paths where pqSendSome drops data  
because of write_failed.  If we've lost the connection, this will  
eventually result in closing the socket and setting CONNECTION_BAD,  
which will cause PQputline and siblings to report failure, allowing  
the application to terminate the COPY sooner.  (Basically this restores  
what happened before 1f39a1c06.)  
  
There are related issues that this does not solve; for example, if the  
backend sends an error but doesn't drop the connection, we did and  
still will keep pumping COPY data as long as the application sends it.  
Fixing that will require application-visible behavior changes though,  
and anyway it's an ancient behavior that we've had few complaints about.  
For now I'm just trying to fix the regression from 1f39a1c06.  
  
Per a complaint from Andres Freund.  Back-patch into v12 where  
1f39a1c06 came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rethink definition of cancel.c's CancelRequested flag.

commit   : 92f33bb7afd373ed562e23077c14831944d1b0d4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Jun 2020 13:07:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Jun 2020 13:07:31 -0400    

Click here for diff

As it stands, this flag is only set when we've successfully sent a  
cancel request, not if we get SIGINT and then fail to send a cancel.  
However, for almost all callers, that's the Wrong Thing: we'd prefer  
to abort processing after control-C even if no cancel could be sent.  
  
As an example, since commit 1d468b9ad "pgbench -i" fails to give up  
sending COPY data even after control-C, if the postmaster has been  
stopped, which is clearly not what the code intends and not what anyone  
would want.  (The fact that it keeps going at all is the fault of a  
separate bug in libpq, but not letting CancelRequested become set is  
clearly not what we want here.)  
  
The sole exception, as far as I can find, is that scripts_parallel.c's  
ParallelSlotsGetIdle tries to consume a query result after issuing a  
cancel, which of course might not terminate quickly if no cancel  
happened.  But that behavior was poorly thought out too.  No user of  
ParallelSlotsGetIdle tries to continue processing after a cancel,  
so there is really no point in trying to clear the connection's state.  
Moreover this has the same defect as for other users of cancel.c,  
that if the cancel request fails for some reason then we end up with  
control-C being completely ignored.  (On top of that, select_loop failed  
to distinguish clearly between SIGINT and other reasons for select(2)  
failing, which means that it's possible that the existing code would  
think that a cancel has been sent when it hasn't.)  
  
Hence, redefine CancelRequested as simply meaning that SIGINT was  
received.  We could add a second flag with the other meaning, but  
in the absence of any compelling argument why such a flag is needed,  
I think it would just offer an opportunity for future callers to  
get it wrong.  Also remove the consumeQueryResult call in  
ParallelSlotsGetIdle's failure exit.  In passing, simplify the  
API of select_loop.  
  
It would now be possible to re-unify psql's cancel_pressed with  
CancelRequested, partly undoing 5d43c3c54.  But I'm not really  
convinced that that's worth the trouble, so I left psql alone,  
other than fixing a misleading comment.  
  
This code is new in v13 (cf a4fd3aa71), so no need for back-patch.  
  
Per investigation of a complaint from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/common.c
M src/bin/scripts/scripts_parallel.c
M src/fe_utils/cancel.c

Fix platform-specific performance regression in logtape.c.

commit   : 1fbb6c93df30801f83c6804ab7befde3cdefe677    
  
author   : Jeff Davis <[email protected]>    
date     : Sun, 7 Jun 2020 09:14:24 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sun, 7 Jun 2020 09:14:24 -0700    

Click here for diff

Commit 24d85952 made a change that indirectly caused a performance  
regression by triggering a change in the way GCC optimizes memcpy() on  
some platforms.  
  
The behavior seemed to contradict a GCC document, so I filed a report:  
  
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95556  
  
This patch implements a narrow workaround which eliminates the  
regression I observed. The workaround is benign enough that it seems  
unlikely to cause a different regression on another platform.  
  
Discussion: https://postgr.es/m/[email protected]  

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

psql: Format \? output a little better

commit   : aa7927698acb813283d21aa6a47a67cd3c5a8b0c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 16:12:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 16:12:05 +0200    

Click here for diff

M src/bin/psql/help.c

Fix message translatability

commit   : 1e8ada0c8a448891971faf71f48125439ee07023    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 15:11:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 15:11:51 +0200    

Click here for diff

Two parts of the same message shouldn't be split across two function  
calls.  

M src/bin/psql/help.c

Spelling adjustments

commit   : 0fd2a79a637f9f96b9830524823df0454e962f96    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 15:06:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 15:06:51 +0200    

Click here for diff

M doc/src/sgml/config.sgml
M src/backend/commands/async.c
M src/backend/commands/vacuum.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lock.c
M src/backend/tcop/postgres.c
M src/backend/utils/cache/relfilenodemap.c
M src/include/access/tableam.h
M src/include/access/xact.h
M src/include/replication/slot.h
M src/include/storage/condition_variable.h
M src/include/storage/procsignal.h
M src/test/modules/test_shm_mq/setup.c

doc: Fix man page whitespace issues

commit   : a02b8bdd9878ae1d1ead87aabb673d60432500ea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 14:54:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 14:54:28 +0200    

Click here for diff

Whitespace between tags is significant, and in some cases it creates  
extra vertical space in man pages.  The fix is either to remove some  
newlines or in some cases to reword slightly to avoid the awkward  
markup layout.  

M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/create_extension.sgml
M doc/src/sgml/ref/create_language.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/drop_function.sgml
M doc/src/sgml/ref/drop_procedure.sgml
M doc/src/sgml/ref/drop_routine.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_verifybackup.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/spi.sgml

Formatting and punctuation improvements in postgresql.conf.sample

commit   : f4c88ce1a20e8e944d74cb964926781d6ca4cb18    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 14:35:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 14:35:12 +0200    

Click here for diff

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

doc: Move options on man pages into more alphabetical order

commit   : b25da866152347109943f998b66b1a320a9de3e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 14:07:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 14:07:33 +0200    

Click here for diff

M doc/src/sgml/ref/dropdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml

doc: Fix up spacing around verbatim DocBook elements

commit   : 9ac0a26210901a5869fd7ea83ab1c59489c1aeef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:34:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:34:37 +0200    

Click here for diff

M doc/src/sgml/hstore.sgml
M doc/src/sgml/release-13.sgml

doc: Language review

commit   : 4c6f70cd33ac395dea1acca7dabf4cb8556235e7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:27:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:27:57 +0200    

Click here for diff

M doc/src/sgml/libpq.sgml

doc: Trim trailing whitespace

commit   : b79cb8a919c2614c81ae7578b863b7f582a9baf2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:24:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:24:40 +0200    

Click here for diff

M doc/src/sgml/ref/drop_database.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_verifybackup.sgml
M doc/src/sgml/release-13.sgml

doc: Clean up title case use

commit   : b3c2412e70f2be25ac70f7e9b2f12dbe4efd2a8b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:18:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:18:36 +0200    

Click here for diff

M doc/src/sgml/features.sgml

doc: Remove line breaks after <title>

commit   : ab5b55505ec4bf08a9f93810e1bfada93bc63bb5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:10:18 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 13:10:18 +0200    

Click here for diff

This creates unnecessary rendering problem risks, and it's  
inconsistent and gets copied around.  

M doc/src/sgml/features.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_verifybackup.sgml
M doc/src/sgml/xplang.sgml

Doc: Clean up references to obsolete OS versions.

commit   : c8be915aa9fcc4c0cba563ddbb2e5af7a2dadd12    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 7 Jun 2020 21:36:43 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 7 Jun 2020 21:36:43 +1200    

Click here for diff

Remove obsolete instructions for old operating system versions, and  
update the text to reflect the defaults on modern systems.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Magnus Hagander <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLmJUSwybaPQv39rB8ABpqJq84im2UjZvyUY4feYhpWMw%40mail.gmail.com  

M doc/src/sgml/runtime.sgml

commit   : c14a98032b17d514a195e4e76073ebc98a6521be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 11:16:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Jun 2020 11:16:51 +0200    

Click here for diff

M doc/src/sgml/func.sgml

Add missing source files to nls.mk

commit   : 35b527428d6110dd0de585223a4783fe996a0020    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jun 2020 19:56:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jun 2020 19:56:21 +0200    

Click here for diff

M src/bin/pg_basebackup/nls.mk
M src/bin/pg_rewind/nls.mk
M src/bin/psql/nls.mk
M src/bin/scripts/nls.mk

Fix reference to wrong view in release notes

commit   : 6e2f11b631b712d691aecdbbcaa7a75b391c1e98    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 6 Jun 2020 15:35:42 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 6 Jun 2020 15:35:42 +0200    

Click here for diff

The estimate of total backup size effects the view  
pg_stat_progress_basebackup, not pg_stat_progress_analyze.  

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

Refresh function name in CRC-associated Valgrind suppressions.

commit   : 26056b3ba84d6cb51eea5d6c83fefae19919a56b    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 5 Jun 2020 20:10:53 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 5 Jun 2020 20:10:53 -0700    

Click here for diff

Back-patch to 9.5, where commit 4f700bcd20c087f60346cb8aefd0e269be8e2157  
first appeared.  
  
Reviewed by Tom Lane.  Reported by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/valgrind.supp

Doc: remove annotations about multi-row output of set-returning functions.

commit   : ec5d6fc4ae8c75391d99993cd030a8733733747d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2020 18:04:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2020 18:04:37 -0400    

Click here for diff

I thought this added clarity, or at least was consistent with the way  
these entries looked before v13 ... but apparently I'm in the minority.  
  
Discussion: https://postgr.es/m/CAFj8pRAXuetiHUfs73zjsJD6B78FWcUsBS-j23sdCMFXkgx5Fg@mail.gmail.com  

M doc/src/sgml/func.sgml

Improve ineq_histogram_selectivity's behavior for non-default orderings.

commit   : 0c882e52a8660114234a0c4a29db919bb727e552    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2020 16:55:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2020 16:55:16 -0400    

Click here for diff

ineq_histogram_selectivity() can be invoked in situations where the  
ordering we care about is not that of the column's histogram.  We could  
be considering some other collation, or even more drastically, the  
query operator might not agree at all with what was used to construct  
the histogram.  (We'll get here for anything using scalarineqsel-based  
estimators, so that's quite likely to happen for extension operators.)  
  
Up to now we just ignored this issue and assumed we were dealing with  
an operator/collation whose sort order exactly matches the histogram,  
possibly resulting in junk estimates if the binary search gets confused.  
It's past time to improve that, since the use of nondefault collations  
is increasing.  What we can do is verify that the given operator and  
collation match what's recorded in pg_statistic, and use the existing  
code only if so.  When they don't match, instead execute the operator  
against each histogram entry, and take the fraction of successes as our  
selectivity estimate.  This gives an estimate that is probably good to  
about 1/histogram_size, with no assumptions about ordering.  (The quality  
of the estimate is likely to degrade near the ends of the value range,  
since the two orderings probably don't agree on what is an extremal value;  
but this is surely going to be more reliable than what we did before.)  
  
At some point we might further improve matters by storing more than one  
histogram calculated according to different orderings.  But this code  
would still be good fallback logic when no matches exist, so that is  
not an argument for not doing this.  
  
While here, also improve get_variable_range() to deal more honestly  
with non-default collations.  
  
This isn't back-patchable, because it requires adding another argument  
to ineq_histogram_selectivity, and because it might have significant  
impact on the estimation results for extension operators relying on  
scalarineqsel --- mostly for the better, one hopes, but in any case  
destabilizing plan choices in back branches is best avoided.  
  
Per investigation of a report from James Lucas.  
  
Discussion: https://postgr.es/m/CAAFmbbOvfi=wMM=3qRsPunBSLb8BFREno2oOzSBS=mzfLPKABw@mail.gmail.com  

M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Add unlikely() to CHECK_FOR_INTERRUPTS()

commit   : 87fb04af1e705b615ac01feba958f841ea4a71a6    
  
author   : Joe Conway <[email protected]>    
date     : Fri, 5 Jun 2020 16:49:25 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Fri, 5 Jun 2020 16:49:25 -0400    

Click here for diff

Add the unlikely() branch hint macro to CHECK_FOR_INTERRUPTS().  
Backpatch to REL_10_STABLE where we first started using unlikely().  
  
Discussion: https://www.postgresql.org/message-id/flat/8692553c-7fe8-17d9-cbc1-7cddb758f4c6%40joeconway.com  

M src/include/miscadmin.h

Use query collation, not column's collation, while examining statistics.

commit   : 044c99bc567ac5d44dff0af7aebb81737dc36a69    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2020 16:18:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jun 2020 16:18:50 -0400    

Click here for diff

Commit 5e0928005 changed the planner so that, instead of blindly using  
DEFAULT_COLLATION_OID when invoking operators for selectivity estimation,  
it would use the collation of the column whose statistics we're  
considering.  This was recognized as still being not quite the right  
thing, but it seemed like a good incremental improvement.  However,  
shortly thereafter we introduced nondeterministic collations, and that  
creates cases where operators can fail if they're passed the wrong  
collation.  We don't want planning to fail in cases where the query itself  
would work, so this means that we *must* use the query's collation when  
invoking operators for estimation purposes.  
  
The only real problem this creates is in ineq_histogram_selectivity, where  
the binary search might produce a garbage answer if we perform comparisons  
using a different collation than the column's histogram is ordered with.  
However, when the query's collation is significantly different from the  
column's default collation, the estimate we previously generated would be  
pretty irrelevant anyway; so it's not clear that this will result in  
noticeably worse estimates in practice.  (A follow-on patch will improve  
this situation in HEAD, but it seems too invasive for back-patch.)  
  
The patch requires changing the signatures of mcv_selectivity and allied  
functions, which are exported and very possibly are used by extensions.  
In HEAD, I just did that, but an API/ABI break of this sort isn't  
acceptable in stable branches.  Therefore, in v12 the patch introduces  
"mcv_selectivity_ext" and so on, with signatures matching HEAD, and makes  
the old functions into wrappers that assume DEFAULT_COLLATION_OID should  
be used.  That does not match the prior behavior, but it should avoid risk  
of failure in most cases.  (In practice, I think most extension datatypes  
aren't collation-aware, so the change probably doesn't matter to them.)  
  
Per report from James Lucas.  Back-patch to v12 where the problem was  
introduced.  
  
Discussion: https://postgr.es/m/CAAFmbbOvfi=wMM=3qRsPunBSLb8BFREno2oOzSBS=mzfLPKABw@mail.gmail.com  

M contrib/ltree/ltree_op.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

OpenSSL 3.0.0 compatibility in tests

commit   : f0d2c65f17cab8cfaf4d39f7f8e2254824cd4092    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Jun 2020 11:18:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Jun 2020 11:18:11 +0200    

Click here for diff

DES has been deprecated in OpenSSL 3.0.0 which makes loading keys  
encrypted with DES fail with "fetch failed".  Solve by changing the  
cipher used to aes256 which has been supported since 1.0.1 (and is  
more realistic to use anyways).  
  
Note that the minimum supported OpenSSL version is 1.0.1 as of  
7b283d0e1d1d79bf1c962d790c94d2a53f3bb38a, so this does not introduce  
any new version requirements.  
  
Author: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/FEF81714-D479-4512-839B-C769D2605F8A%40yesql.se  

M src/test/ssl/Makefile
M src/test/ssl/ssl/server-password.key

Preserve pg_index.indisreplident across REINDEX CONCURRENTLY

commit   : 1127f0e392c757fc4fbbeffd7d0202bb02670e9c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Jun 2020 10:26:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Jun 2020 10:26:02 +0900    

Click here for diff

If the flag value is lost, logical decoding would work the same way as  
REPLICA IDENTITY NOTHING, meaning that no old tuple values would be  
included in the changes anymore produced by logical decoding.  
  
Author: Michael Paquier  
Reviewed-by: Euler Taveira  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/catalog/index.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Reject "23:59:60.nnn" in datetime input.

commit   : a9632830bb05dc98ae24017cafc652e4a66d44a8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2020 16:42:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jun 2020 16:42:08 -0400    

Click here for diff

It's intentional that we don't allow values greater than 24 hours,  
while we do allow "24:00:00" as well as "23:59:60" as inputs.  
However, the range check was miscoded in such a way that it would  
accept "23:59:60.nnn" with a nonzero fraction.  For time or timetz,  
the stored result would then be greater than "24:00:00" which would  
fail dump/reload, not to mention possibly confusing other operations.  
  
Fix by explicitly calculating the result and making sure it does not  
exceed 24 hours.  (This calculation is redundant with what will happen  
later in tm2time or tm2timetz.  Maybe someday somebody will find that  
annoying enough to justify refactoring to avoid the duplication; but  
that seems too invasive for a back-patched bug fix, and the cost is  
probably unmeasurable anyway.)  
  
Note that this change also rejects such input as the time portion  
of a timestamp(tz) value.  
  
Back-patch to v10.  The bug is far older, but to change this pre-v10  
we'd need to ensure that the logic behaves sanely with float timestamps,  
which is possibly nontrivial due to roundoff considerations.  
Doesn't really seem worth troubling with.  
  
Per report from Christoph Berg.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/date.h
M src/test/regress/expected/time.out
M src/test/regress/expected/timetz.out
M src/test/regress/sql/time.sql
M src/test/regress/sql/timetz.sql

psql: Clean up terminology in \dAp command

commit   : f5067049cde38cd0d6333a5e3bf1bed8d99e6f44    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jun 2020 22:09:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jun 2020 22:09:41 +0200    

Click here for diff

The preferred terminology has been support "function", not procedure,  
for some time, so change that over.  The command stays \dAp, since  
\dAf is already something else.  

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

Fix comment in be-secure-openssl.c

commit   : 3fa44a30049826bfe2fd58eec0e8acabd5757411    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Jun 2020 13:02:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Jun 2020 13:02:59 +0900    

Click here for diff

Since 573bd08, hardcoded DH parameters have been moved to a different  
file, making the comment on top of load_dh_buffer() incorrect.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

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

Fix instance of elog() called while holding a spinlock

commit   : c1669fd5812a02daac58778e2708ede11edd36a3    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Jun 2020 10:17:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Jun 2020 10:17:49 +0900    

Click here for diff

This broke the project rule to not call any complex code while a  
spinlock is held.  Issue introduced by b89e151.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

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

Don't call palloc() while holding a spinlock, either.

commit   : f88bd3139f3e2a557c086215c6b15d7f66bee845    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jun 2020 12:36:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jun 2020 12:36:00 -0400    

Click here for diff

Fix some more violations of the "only straight-line code inside a  
spinlock" rule.  These are hazardous not only because they risk  
holding the lock for an excessively long time, but because it's  
possible for palloc to throw elog(ERROR), leaving a stuck spinlock  
behind.  
  
copy_replication_slot() had two separate places that did pallocs  
while holding a spinlock.  We can make the code simpler and safer  
by copying the whole ReplicationSlot struct into a local variable  
while holding the spinlock, and then referencing that copy.  
(While that's arguably more cycles than we really need to spend  
holding the lock, the struct isn't all that big, and this way seems  
far more maintainable than copying fields piecemeal.  Anyway this  
is surely much cheaper than a palloc.)  That bug goes back to v12.  
  
InvalidateObsoleteReplicationSlots() not only did a palloc while  
holding a spinlock, but for extra sloppiness then leaked the memory  
--- probably for the lifetime of the checkpointer process, though  
I didn't try to verify that.  Fortunately that silliness is new  
in HEAD.  
  
pg_get_replication_slots() had a cosmetic violation of the rule,  
in that it only assumed it's safe to call namecpy() while holding  
a spinlock.  Still, that's a hazard waiting to bite somebody, and  
there were some other cosmetic coding-rule violations in the same  
function, so clean it up.  I back-patched this as far as v10; the  
code exists before that but it looks different, and this didn't  
seem important enough to adapt the patch further back.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/replication/slot.h

commit   : 4d685f6d7b65fa1ca5afb5138e610cd08a3c1e12    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 2 Jun 2020 22:11:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 2 Jun 2020 22:11:47 -0400    

Click here for diff

Use "guc-enable-groupingsets-hash-disk".  
  
Reported-by: TAKATSUKA Haruka  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

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

doc: Move wal_init_zero and wal_recycle descriptions to proper section.

commit   : 43e592c706f8ce073d166f541687ad8f02dc22c0    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 3 Jun 2020 09:59:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 3 Jun 2020 09:59:43 +0900    

Click here for diff

The group of wal_init_zero and wal_recycle is WAL_SETTINGS in guc.c,  
but previously their documents were located in  
"Replication"/"Sending Servers" section. This commit moves them to  
the proper section "Write Ahead Log"/"Settings".  
  
Back-patch to v12 where wal_init_zero and wal_recycle parameters  
were introduced.  
  
Author: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Don't call elog() while holding spinlock.

commit   : caa3c4242cf86322e2ed0c86199e6462a2c41565    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 2 Jun 2020 19:18:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 2 Jun 2020 19:18:13 +0900    

Click here for diff

Previously UpdateSpillStats() called elog(DEBUG2) while holding  
the spinlock even though the local variables that the elog() accesses  
don't need to be protected by the lock. Since spinlocks are intended  
for very short-term locks, they should not be used when calling  
elog(DEBUG2). So this commit moves that elog() out of spinlock period.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Amit Kapila and Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Doc: Update the documentation for spilled transaction statistics.

commit   : e641b2a995abfa0dd7039863e2597feb3abf2b1e    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Jun 2020 11:11:25 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Jun 2020 11:11:25 +0530    

Click here for diff

Reported-by: Sawada Masahiko  
Author: Sawada Masahiko, Amit Kapila  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CA+fd4k4vNg7dRO5ECHdtQXXf1=Q4M98pfLW0dU7BKD8h79pkqA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Make ssl certificate for ssl_passphrase_callback test via Makefile

commit   : b846091fd0a7a747933232016f0a52aa764398b8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 1 Jun 2020 17:32:32 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 1 Jun 2020 17:32:32 -0400    

Click here for diff

The recipe was previously given in comments in the module's test  
script, but now we have an explicit recipe in the Makefile. The now  
redundant comments in the script are removed.  
  
This recipe shouldn't be needed in normal use, as the certificate and  
key are in git and don't need to be regenerated.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/ssl_passphrase_callback/Makefile
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl

Use correct and consistent unit abbreviation

commit   : 42181b1015b18e877e65be66ac5a2e90b731ac8b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jun 2020 21:18:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jun 2020 21:18:36 +0200    

Click here for diff

M src/backend/storage/sync/sync.c

Fix use-after-release mistake in currtid() and currtid2() for views

commit   : ce1c5b9ae87b6153d3f40a4f7806f2effef12363    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jun 2020 14:41:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jun 2020 14:41:18 +0900    

Click here for diff

This issue has been present since the introduction of this code as of  
a3519a2 from 2002, and has been found by buildfarm member prion that  
uses RELCACHE_FORCE_RELEASE via the tests introduced recently in  
e786be5.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

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

Fix crashes with currtid() and currtid2()

commit   : e786be5fcb257a09b05bd8e509c8d1b82e626352    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jun 2020 10:32:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jun 2020 10:32:06 +0900    

Click here for diff

A relation that has no storage initializes rd_tableam to NULL, which  
caused those two functions to crash because of a pointer dereference.  
Note that in 11 and older versions, this has always failed with a  
confusing error "could not open file".  
  
These two functions are used by the Postgres ODBC driver, which requires  
them only when connecting to a backend strictly older than 8.1.  When  
connected to 8.2 or a newer version, the driver uses a RETURNING clause  
instead whose support has been added in 8.2, so it should be possible to  
just remove both functions in the future.  This is left as an issue to  
address later.  
  
While on it, add more regression tests for those functions as we never  
really had coverage for them, and for aggregates of TIDs.  
  
Reported-by: Jaime Casanova, via sqlsmith  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CAJGNTeO93u-5APMga6WH41eTZ3Uee9f3s8dCpA-GSSqNs1b=Ug@mail.gmail.com  
Backpatch-through: 12  

M src/backend/utils/adt/tid.c
A src/test/regress/expected/tid.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/tid.sql

Make install-tests target work with vpath builds

commit   : af4ea507c3d9217579a8d75fc17f4796a9bab0bb    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 31 May 2020 18:33:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 31 May 2020 18:33:00 -0400    

Click here for diff

Also add a top-level install-tests target.  
  
Backpatch to all live branches.  
  
Craig Ringer, tweaked by me.  

M GNUmakefile.in
M src/test/regress/GNUmakefile

Use CP_SMALL_TLIST for hash aggregate

commit   : 4cad2534da6d17067d98cf04be2dfc1bda8f2cd0    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 31 May 2020 14:43:13 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 31 May 2020 14:43:13 +0200    

Click here for diff

Commit 1f39bce021 added disk-based hash aggregation, which may spill  
incoming tuples to disk. It however did not request projection to make  
the tuples as narrow as possible, which may mean having to spill much  
more data than necessary (increasing I/O, pushing other stuff from page  
cache, etc.).  
  
This adds CP_SMALL_TLIST in places that may use hash aggregation - we do  
that only for AGG_HASHED. It's unnecessary for AGG_SORTED, because that  
either uses explicit Sort (which already does projection) or pre-sorted  
input (which does not need spilling to disk).  
  
Author: Tomas Vondra  
Reviewed-by: Jeff Davis  
Discussion: https://postgr.es/m/20200519151202.u2p2gpiawoaznsv2%40development  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/plan/createplan.c

Doc: Mention about caveats of --concurrently on reindexdb page

commit   : 9b60c4b979bce060495e2b05ba01d1cc6bffdd2d    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 31 May 2020 10:48:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 31 May 2020 10:48:21 +0900    

Click here for diff

The documentation of REINDEX includes a complete description of  
CONCURRENTLY and its advantages as well as its disadvantages, but  
reindexdb was not really clear about all that.  
  
From discussion with Tom Lane, based on a report from Andrey Klychkov.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M doc/src/sgml/ref/reindexdb.sgml

doc: Update the layout of "Viewing Statistics" section.

commit   : 92f9468657f0916ce8589e13d5ebda60c7973c31    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 29 May 2020 17:14:33 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 29 May 2020 17:14:33 +0900    

Click here for diff

This commit updates the "Viewing Statistics" section more like  
the existing catalogs chapter.  
  
- Change its layout so that an introductory paragrap is put above  
   the table for each statistics view. Previously the explanations  
   were below the tables.  
  
- Separate each view to different section and add index terms for them.  
  
Author: Fujii Masao  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/sslinfo.sgml

llvmjit: Fix building against LLVM 11 by removing unnecessary include.

commit   : 6a4a335b841520739b7b2f0e608acdf3b814daad    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 May 2020 15:08:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 May 2020 15:08:12 -0700    

Click here for diff

LLVM has removed this header, in the branch that will become llvm  
11. But as it turns out we didn't actually need it, so just remove it.  
  
Author: Jesse Zhang <[email protected]>  
Discussion: https://postgr.es/m/CAGf+fX7bvtP0YXMu7pOsu_NwhxW6dArTkxb=jt7M2-UJkyJ_3g@mail.gmail.com  
Backpatch: 11, where JIT support using llvm was introduced.  

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

commit   : 9003b76e169e8524f8d7c7547aded4749b9c39a1    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 28 May 2020 13:44:54 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 28 May 2020 13:44:54 -0400    

Click here for diff

Two of the members of rconn were left uninitialized. When  
dblink_open() is called without an outer transaction it  
handles the initialization for us, but with an outer  
transaction it does not. Arrange for initialization  
in all cases. Backpatch to all supported versions.  
  
Reported-by: Alexander Lakhin  
Discussion: https://www.postgresql.org/message-id/flat/9bd0744f-5f04-c778-c5b3-809efe9c30c7%40joeconway.com#c545909a41664991aca60c4d70a10ce7  

M contrib/dblink/dblink.c

Add CHECK_FOR_INTERRUPTS() to the repeat() function

commit   : 887cdff4dcbdfbfdbf9a29dfad0edc09c6ec3398    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 28 May 2020 13:16:47 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 28 May 2020 13:16:47 -0400    

Click here for diff

The repeat() function loops for potentially a long time without  
ever checking for interrupts. This prevents, for example, a query  
cancel from interrupting until the work is all done. Fix by  
inserting a CHECK_FOR_INTERRUPTS() into the loop.  
  
Backpatch to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/flat/8692553c-7fe8-17d9-cbc1-7cddb758f4c6%40joeconway.com  

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

Add missing error code to "cannot attach index ..." error.

commit   : 5b1c61e8b8f98f4a1c42856819b6dea600669f47    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 28 May 2020 12:37:00 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 28 May 2020 12:37:00 +0300    

Click here for diff

ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE was used in an ereport with the  
same message but different errdetail a few lines earlier, so use that  
here as well.  
  
Backpatch-through: 11  

M src/backend/commands/tablecmds.c

Fix typo in test comment.

commit   : 0099db4ce1a19038d0d837bf82a35c989332cc58    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 28 May 2020 12:35:18 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 28 May 2020 12:35:18 +0300    

Click here for diff

The same comment was copied to a few different places, with the same typo.  
Backpatch down to v11, where this typo was introduced.  

M src/test/regress/expected/alter_table.out
M src/test/regress/expected/hash_part.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/hash_part.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/partition_prune.sql

Fix some comments in xlogreader.h

commit   : f93bb0ce64005c84e1d1d431eed31e0da4835078    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 May 2020 16:40:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 May 2020 16:40:07 +0900    

Click here for diff

segment_open and segment_close were mentioned with incorrect names.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/xlogreader.h

Fix some mentions to memory units in postgresql.conf.sample

commit   : 55ca50deb8ffaec3b81d83c9f54c94f7e519f3a6    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 May 2020 15:39:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 May 2020 15:39:05 +0900    

Click here for diff

The default unit for max_slot_wal_keep_size is megabytes.  While on it,  
also change temp_file_limit to use a more consistent wording.  
  
Reported-by: Jeff Janes, Fujii Masao  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CAMkU=1wWZhhjpwRFKJ9waQGxxROeC0P6UqPvb90fAaGz7dhoHA@mail.gmail.com  

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

Remove some tabs in SQL code in C string literals

commit   : 0a737be03cf7708e8e27f9596be3406275ec3d49    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 May 2020 16:07:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 May 2020 16:07:55 +0200    

Click here for diff

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

M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c

Avoid fragmentation of logical tapes when writing concurrently.

commit   : 896ddf9b3cd7dcf70e43f733ae8fec5dfe6e31af    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 26 May 2020 16:06:30 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 26 May 2020 16:06:30 -0700    

Click here for diff

Disk-based HashAgg relies on writing to multiple tapes  
concurrently. Avoid fragmentation of the tapes' blocks by  
preallocating many blocks for a tape at once. No file operations are  
performed during preallocation; only the block numbers are reserved.  
  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/20200519151202.u2p2gpiawoaznsv2%40development  

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

Message wording tweaks

commit   : 49223e106b0a43452d64b4e52719532012c81e25    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 May 2020 15:58:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 May 2020 15:58:39 +0200    

Click here for diff

Make the wording of new libpq messages more similar to existing  
messages in the backend.  

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

Add lcov exclusion markers to jsonpath scanner

commit   : add4211600bfece1efb3d62befbc55b521790d76    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 May 2020 14:09:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 May 2020 14:09:36 +0200    

Click here for diff

This was done for all scanners in  
421167362242ce1fb46d6d720798787e7cd65aad but not added to the new one.  

M src/backend/utils/adt/jsonpath_scan.l

doc: PG 13 relnotes: update bool_plperl item

commit   : d9101e9806e446a413bcef16d3ab65602ed028ad    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 May 2020 21:53:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 May 2020 21:53:53 -0400    

Click here for diff

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

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

gss: add missing references to hostgssenc and hostnogssenc

commit   : ac5852fb3042a4562e8a8bab26aaa00fa8183068    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 25 May 2020 20:19:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 25 May 2020 20:19:28 -0400    

Click here for diff

These were missed when these were added to pg_hba.conf in PG 12;  
updates docs and pg_hba.conf.sample.  
  
Reported-by: Arthur Nascimento  
  
Bug: 16380  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 12  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/pg_hba.conf.sample

Reconcile nodes/*funcs.c.

commit   : 587322de36921557fcfcfdd40291669c8ee46968    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 25 May 2020 16:23:48 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 25 May 2020 16:23:48 -0700    

Click here for diff

The stmt_len changes do not affect behavior.  LimitPath has no other  
support functions, so that part changes only debugging output.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

Add a temp-install prerequisite to top-level "check-tests".

commit   : 650eac8d7b6df7147ff4bb29b354510fe1929671    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 25 May 2020 16:21:04 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 25 May 2020 16:21:04 -0700    

Click here for diff

The target failed, tested $PATH binaries, or tested a stale temporary  
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed  
this.  Back-patch to 9.5 (all supported versions).  

M GNUmakefile.in

Doc: Fix order of pg_shmem_allocations in system view list

commit   : 5832396432b1ce8349a0028b52295a9874014416    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 25 May 2020 15:18:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 25 May 2020 15:18:11 +0900    

Click here for diff

pg_shmem_allocations was in the wrong position with pg_stats.  
  
Author: Ian Barwick  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml

Add missing invocations to object access hooks

commit   : a995b371ae29de2d38c4b7881cf414b1560e9746    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 23 May 2020 14:03:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 23 May 2020 14:03:04 +0900    

Click here for diff

The following commands have been missing calls to object access hooks  
InvokeObjectPost{Create|Alter}Hook normally applied to all commands:  
- ALTER RULE RENAME TO  
- ALTER USER MAPPING  
- CREATE ACCESS METHOD  
- CREATE STATISTICS  
  
Thanks also to Robert Haas for the discussion.  
  
Author: Mark Dilger  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/amcmds.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/statscmds.c
M src/backend/rewrite/rewriteDefine.c

Fix two typos in a comment

commit   : c99cec96b8b1e067744b8a70961a3447a2293de0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 May 2020 17:39:16 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 May 2020 17:39:16 -0400    

Click here for diff

They were introduced in 898e5e3290a7; backpatch to 12.  

M src/backend/partitioning/partdesc.c

doc: Add note about I/O timing information in EXPLAIN and pg_stat_database.

commit   : eaae947e2b99a84c8f321fe084d87daff0f77d02    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 22 May 2020 23:33:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 22 May 2020 23:33:58 +0900    

Click here for diff

Explain that the followings are tracked only when track_io_timing GUC  
is enabled.  
  
- blk_read_time and blk_write_time in pg_stat_database  
- time spent reading and writing data file blocks in EXPLAIN output  
   with BUFFERS option  
  
Whther track_io_timing is enabled affects also blk_read_time and  
blk_write_time in pg_stat_statements, but which was already documented.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CACZ0uYHo_NwbxpLH76OGF-O=13tkR0ZM0zeyGEhZ+JEXZVRyCA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/explain.sgml

Remove unnecessary cast

commit   : 574925bfd0a8175f6e161936ea11d9695677ba09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 May 2020 10:36:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 May 2020 10:36:49 +0200    

Click here for diff

Probably copied from nearby calls where it is necessary.  But this one  
also casts away constness, so it was doubly annoying.  

M src/backend/replication/backup_manifest.c

Adjust indentation in src/backend/optimizer/README.

commit   : bb2ae6fa47e5d84b6c5a9e3845021e7df031ec32    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 22 May 2020 15:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 22 May 2020 15:45:00 +0900    

Click here for diff

The previous indentation of optimizer functions was unclear; adjust the  
indentation dashes so that a deeper level of indentation indicates that  
the outer optimizer function calls the inner one.  
  
Author: Richard Guo, with additional change by me  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CAMbWs4-U-ogzpchGsP2BBMufCss1hktm%2B%2BeTJK_dUC196pw0cQ%40mail.gmail.com  

M src/backend/optimizer/README

doc: PG 13 relnotes: Improve FETCH link

commit   : 10e1521f5c29da2dbe331462feb5408d5ef16915    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 May 2020 22:07:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 May 2020 22:07:17 -0400    

Click here for diff

Reported-by: Erwin Brandstetter  
  
Discussion: https://postgr.es/m/CAGHENJ4X626ZfYhondXSP4sQgC5zDtsp_LNg1QaD+U7vfgYXQQ@mail.gmail.com  
  
Backpatch-through: head  

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

doc: PG 13 relnotes: fix FETCH FIRST ... WITH TIES xreflabel

commit   : 6ed02e6ac3aac86e8f527e111064012e7911cf43    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 May 2020 20:34:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 May 2020 20:34:37 -0400    

Click here for diff

Reported-by: Erwin Brandstetter  
  
Discussion: https://postgr.es/m/CAGHENJ4X626ZfYhondXSP4sQgC5zDtsp_LNg1QaD+U7vfgYXQQ@mail.gmail.com  
  
Backpatch-through: head  

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

doc: suggest 1.1 as a random_page_cost value for SSDs

commit   : 1c2ff3ef07d25ca4d291d35f8a31fe513fde58ab    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 May 2020 20:28:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 May 2020 20:28:38 -0400    

Click here for diff

Reported-by: yigong hu  
  
Discussion: https://postgr.es/m/CAOxFffcourucFqSk+tZA13ErS3XRYkDy6EeaPff4AvHGiEEuug@mail.gmail.com  
  
Backpatch-through: 9.5  

M doc/src/sgml/config.sgml

doc: Simplify mention of unique indexes for NULL control

commit   : c20fd088f1c5fb5e492f40d427c45b8de38c879c    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 May 2020 19:49:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 May 2020 19:49:30 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/indices.sgml

Doc: Describe CREATE INDEX deduplication strategy.

commit   : 449e14a5618432f01066c33055229b96666bd925    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 21 May 2020 13:36:45 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 21 May 2020 13:36:45 -0700    

Click here for diff

The B-Tree index deduplication strategy used during CREATE INDEX and  
REINDEX differs from the lazy strategy used by retail inserts.  Make  
that clear by adding a new paragraph to the B-Tree implementation  
section of the documentation.  
  
In passing, do some copy-editing of nearby deduplication documentation.  

M doc/src/sgml/btree.sgml

Clear some style deviations.

commit   : 3350fb5d1f9d73de15428e9bfa83dce96421fc14    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 21 May 2020 08:31:16 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 21 May 2020 08:31:16 -0700    

Click here for diff

M contrib/pgcrypto/pgp-mpi-internal.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/smgr/md.c
M src/backend/utils/misc/queryenvironment.c
M src/interfaces/libpq/fe-misc.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_planobject.c
M src/pl/plpython/plpy_resultobject.c
M src/pl/plpython/plpy_subxactobject.c
M src/port/random.c

Use explicit_bzero() when clearing sslpassword in libpq

commit   : e4db972ed5f12c09403ff0be24e12e5d4032aaaa    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 21 May 2020 15:49:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 21 May 2020 15:49:20 +0900    

Click here for diff

Since 74a308c, any security-sensitive information gets cleared from  
memory this way.  This was forgotten in 4dc6355.  
  
Author: Daniel Gustafsson  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Fix MSVC installations with multiple "configure" files detected

commit   : d2a9959907a03682f4fe182086f9936aca6b2a4f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 21 May 2020 14:41:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 21 May 2020 14:41:15 +0900    

Click here for diff

When installing binaries and libraries using the MSVC installation  
routines, the operation gets done after moving to the root folder, whose  
location is detected by checking if "configure" exists two times in a  
row.  So, calling the installation script from src/tools/msvc/ with an  
extra "configure" file four levels up the root path of the code tree  
causes the execution to go further up, leading to a failure in finding  
the builds.  This commit fixes the issue by moving to the root folder of  
the code tree only once, when necessary.  
  
Author: Arnold Müller  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/tools/msvc/Install.pm

doc: Adding a partition does not require Access Exclusive lock

commit   : e1218f59ea4c0605e72298fa121d5aef4c66def2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 May 2020 14:35:39 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 May 2020 14:35:39 -0400    

Click here for diff

This doc update was missed in 898e5e3290a7.  Backpatch to 12.  
  
Pointed out by Pavel Luzanov  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Doc: Fix description of pg_class.relreplident

commit   : 39cb2ee09cf900454c1bf14f56048b40c840a490    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 May 2020 14:20:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 May 2020 14:20:50 +0900    

Click here for diff

The description missed a comma and lacked an explanation of what happens  
with REPLICA IDENTITY USING INDEX when the dependent index is dropped.  
  
Author: Marina Polyakova  
Reviewed-by: Daniel Gustafsson, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M doc/src/sgml/catalogs.sgml

Doc: Replace reference to pg_stat_wal_receiver.received_lsn by flushed_lsn

commit   : a56e7046d6f2a2ad23ffb9083eba9bc822f18881    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 May 2020 09:12:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 May 2020 09:12:52 +0900    

Click here for diff

Oversight in 2c8dd05d, where the view's column has been renamed.  
  
Reported-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/high-availability.sgml

part_strategy does not need its very own keyword classification.

commit   : c7d65a252cdb7219deb48899fa643c5fd2cc3877    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 May 2020 20:09:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 May 2020 20:09:59 -0400    

Click here for diff

This should be plain old ColId.  Making it so makes the grammar less  
complicated, and makes the compiled tables a kilobyte or so smaller  
(likely because they don't have to deal with a keyword classification  
that's not used anyplace else).  

M src/backend/parser/gram.y

Reconsider nbtree page deletion assertion.

commit   : 67b0b2dbf947c2308050e49b4591a4bb0e9650fd    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 19 May 2020 15:04:34 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 19 May 2020 15:04:34 -0700    

Click here for diff

Commit 624686abcf8 added an assertion that verified that _bt_search  
successfully relocated the leaf page undergoing deletion.  Page deletion  
cannot deal with the case where the descent stack is to the right of the  
page, so this seemed critical (deletion can only handle the case where  
the descent stack is to the left of the leaf/target page).  However, the  
assertion went a bit too far.  
  
Since only a buffer pin is held on the leaf page throughout the call to  
_bt_search, nothing guarantees that it can't have split during this  
small window.  And if does actually split, _bt_search may end up  
"relocating" a page to the right of the original target leaf page.  This  
scenario seems extremely unlikely, but it must still be considered.  
Remove the assertion, and document how we cope in this scenario.  

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

WITH TIES: number of rows is optional and defaults to one

commit   : c301c2e739c642199f9e4c62d867dc7bd5ef0fd1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 18 May 2020 19:28:46 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 18 May 2020 19:28:46 -0400    

Click here for diff

FETCH FIRST .. ONLY implements this correctly, but we missed to include  
it for FETCH FIRST .. WITH TIES in commit 357889eb17bb.  
  
Author: Vik Fearing  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/gram.y
M src/test/regress/expected/limit.out
M src/test/regress/sql/limit.sql

Stamp 13beta1.

commit   : 7966b7980138ebcee7ae986ebcc393aea38a35c0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 May 2020 16:09:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 May 2020 16:09:19 -0400    

Click here for diff

M configure
M configure.in

Remove unused variables.

commit   : fe0062c900efa5618197a8e3c88b027e93248db4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 May 2020 13:21:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 May 2020 13:21:36 -0400    

Click here for diff

g_comment_start and g_comment_end have been unused since commit  
30ab5bd43d8f2082659191de8ae19be98c960ad7.  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: PG 13 relnotes: fix typos

commit   : b31d6efe3d06ca5983bbe63084322b5494b7c3ef    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 18 May 2020 10:20:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 18 May 2020 10:20:09 -0400    

Click here for diff

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

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

Translation updates

commit   : ac449d88016080663dbc1cd48004b5a481c034ce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 May 2020 12:49:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 May 2020 12:49:30 +0200    

Click here for diff

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

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

Fix typos in README

commit   : a01debe3db3d7f09797460500f217530b502c2de    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 18 May 2020 11:55:11 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 18 May 2020 11:55:11 +0200    

Click here for diff

Author: Daniel Gustafsson  

M src/backend/optimizer/README

Fix comment in slot.c.

commit   : 7e041b0c1d13b243b595d0b00145cb1116e4c327    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 18 May 2020 07:53:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 18 May 2020 07:53:26 +0530    

Click here for diff

Reported-by: Sawada Masahiko  
Author: Sawada Masahiko  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.5  
Discussion: https://postgr.es/m/CA+fd4k4Ws7M7YQ8PqSym5WB1y75dZeBTd1sZJUQdfe0KJQ-iSA@mail.gmail.com  

M src/backend/replication/slot.c

commit   : 18b9d22cef988c4a67d440f6cafc160d9c05871b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 17 May 2020 13:02:16 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 17 May 2020 13:02:16 +0300    

Click here for diff

 * Rename column "Opfamily Name" to "Operator family" for uniformity.  
 * Rename column alias from "t1" to "t".  

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

commit   : 29b6ddd38d0914340c3c4bb4bb4bd5c4a3c02dca    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 17 May 2020 12:53:34 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 17 May 2020 12:53:34 +0300    

Click here for diff

Make number of translate_columns elements match the number of output columns.  
The only "true" value, which was previously specified, seems to be intended  
for opfamily operator "purpose" column.  But that column has already translated  
values substituted.  So, all elements in translate_columns[] should be "false".  

M src/bin/psql/describe.c

Improve ordering for \dAo and \dAp psql commands

commit   : b1953e67e4c481f8d3844dcdd8fdd4054d7e7604    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 17 May 2020 12:41:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 17 May 2020 12:41:19 +0300    

Click here for diff

This commit changes ORDER BY clause for \dAo and \dAp psql commands in  
the following way.  
 * Operators for the same types are grouped together.  
 * Same-class operators and procedures are listed before cross-class operators  
   and procedures.  
  
Modification of ORDER BY clause for \dAp required removing DISTINCT clause,  
which doesn't seem to affect anything.  
  
Discussion: https://postgr.es/m/20200511210856.GA18368%40alvherre.pgsql  
Author: Alvaro Herrera revised by me  
Reviewed-by: Alexander Korotkov, Nikita Glukhov  

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

Fix more typos and grammar problems in the glossary

commit   : eeba6c7e4366057a09c53efe11f144db55e68c5e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 16 May 2020 22:19:02 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 16 May 2020 22:19:02 -0400    

Click here for diff

Author: Erik Rijkers <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/glossary.sgml

Mop-up for wait event naming issues.

commit   : 3048898e73c75f54bb259323382e0e7f6368cb6f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 May 2020 21:00:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 May 2020 21:00:05 -0400    

Click here for diff

Synchronize the event names for parallel hash join waits with other  
event names, by getting rid of the slashes and dropping "-ing"  
suffixes.  Rename ClogGroupUpdate to XactGroupUpdate, to match the  
new SLRU name.  Move the ProcSignalBarrier event to the IPC category;  
it doesn't belong under IO.  
  
Also a bit more wordsmithing in the wait event documentation tables.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/clog.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Make pg_stat_wal_receiver consistent with the WAL receiver's shmem info

commit   : 2c8dd05d6cbc86b7ad21cfd7010e041bb4c3950b    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 17 May 2020 09:22:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 17 May 2020 09:22:07 +0900    

Click here for diff

d140f2f3 has renamed receivedUpto to flushedUpto, and has added  
writtenUpto to the WAL receiver's shared memory information, but  
pg_stat_wal_receiver was not consistent with that.  This commit renames  
received_lsn to flushed_lsn, and adds a new column called written_lsn.  
  
Bump catalog version.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/walreceiver.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out

Fix bugs in OpenSSL hook renaming.

commit   : e78b93094518b1e262cba8115470f252dde6f446    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 May 2020 19:44:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 May 2020 19:44:49 -0400    

Click here for diff

libpq's exports.txt was overlooked in commit 36d108761, which the  
buildfarm is quite unhappy about.  
  
Also, I'd gathered that the plan included renaming PQgetSSLKeyPassHook  
to PQgetSSLKeyPassHook_OpenSSL, but that didn't happen in the patch  
as committed.  I'm taking it on my own authority to do so now, since  
the window before beta1 is closing fast.  

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

Rename PQsetSSLKeyPassHook and friends

commit   : 36d1087611bf96b0cd716666fc8c4a2d168fa501    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 16 May 2020 16:20:43 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 16 May 2020 16:20:43 -0400    

Click here for diff

4dc6355210 provided a way for libraries and clients to modify how libpq  
handles client certificate passphrases, by installing a hook. However,  
these routines are quite specific to how OpenSSL works, so it's  
misleading and not future-proof to have these names not refer to OpenSSL.  
Change all the names to add "_OpenSSL" after "Hook", and fix the docs  
accordingly.  
  
Author: Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo in glossary

commit   : 1cbc143f06113cbd1b94790c0781aa4b410cffc2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 16 May 2020 15:10:36 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 16 May 2020 15:10:36 -0400    

Click here for diff

Reported privately by Justin Pryzby  

M doc/src/sgml/glossary.sgml

Run pgindent with new pg_bsd_indent version 2.1.1.

commit   : fa27dd40d5c5f56a1ee837a75c97549e992e32a4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 May 2020 11:54:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 May 2020 11:54:51 -0400    

Click here for diff

Thomas Munro fixed a longstanding annoyance in pg_bsd_indent, that  
it would misformat lines containing IsA() macros on the assumption  
that the IsA() call should be treated like a cast.  This improves  
some other cases involving field/variable names that match typedefs,  
too.  The only places that get worse are a couple of uses of the  
OpenSSL macro STACK_OF(); we'll gladly take that trade-off.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeProjectSet.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/psql/tab-complete.c
M src/common/jsonapi.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/pl/plpgsql/src/pl_exec.c
M src/timezone/localtime.c
M src/timezone/strftime.c
M src/timezone/zic.c
M src/tools/pgindent/pgindent

Final pgindent run with pg_bsd_indent version 2.1.

commit   : e02ad575d8ab6b44500d2a3fd8c3212345e3aa2b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 May 2020 11:49:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 May 2020 11:49:14 -0400    

Click here for diff

This is just to provide a clean basis for comparison of the results  
of the new version.  I did fix a typo that crept into 242dfcbaf.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/nbtree/nbtutils.c
M src/tools/pgindent/typedefs.list

Fix assertion with relation using REPLICA IDENTITY FULL in subscriber

commit   : 7ccb2f54d9f3f3c5b4ac092d62c846b02a47f8d5    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 16 May 2020 18:15:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 16 May 2020 18:15:18 +0900    

Click here for diff

In a logical replication subscriber, a table using REPLICA IDENTITY FULL  
which has a primary key would try to use the primary key's index  
available to scan for a tuple, but an assertion only assumed as correct  
the case of an index associated to REPLICA IDENTITY USING INDEX.  This  
commit corrects the assertion so as the use of a primary key index is a  
valid case.  
  
Reported-by: Dilip Kumar  
Analyzed-by: Dilip Kumar  
Author: Euler Taveira  
Reviewed-by: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/CAFiTN-u64S5bUiPL1q5kwpHNd0hRnf1OE-bzxNiOs5zo84i51w@mail.gmail.com  
Backpatch-through: 10  

M src/backend/executor/execReplication.c
M src/test/subscription/t/001_rep_changes.pl

Change locktype "speculative token" to "spectoken".

commit   : 474e7da6485687425d216eda1685d7e530b24fd6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 21:47:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 21:47:21 -0400    

Click here for diff

It's just weird that this name wasn't chosen to look like an  
identifier.  The suspicion that it wasn't thought about too  
hard is reinforced by the fact that it wasn't documented in  
the pg_locks view (until I did so, a day or two back).  
  
Update, and add a comment reminding future adjusters of this  
array to fix the docs too.  
  
Do some desultory wordsmithing on various entries in the wait  
events tables.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/utils/adt/lockfuncs.c
M src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/specs/insert-conflict-specconflict.spec

Fix walsender error cleanup code

commit   : 1d3743023ef8fa665902e791b0d52e9a1ab419cb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2020 19:59:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2020 19:59:29 -0400    

Click here for diff

In commit 850196b610d2 I (Álvaro) failed to handle the case of walsender  
shutting down on an error before setting up its 'xlogreader' pointer;  
the error handling code dereferences the pointer, causing a crash.  
Fix by testing the pointer before trying to dereference it.  
  
Kyotaro authored the code fix; I adopted Nathan's test case to be used  
by the TAP tests and added the necessary PostgresNode change.  
  
Reported-by: Nathan Bossart <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c
M src/test/perl/PostgresNode.pm
M src/test/recovery/t/006_logical_decoding.pl

Drop the redundant "Lock" suffix from LWLock wait event names.

commit   : 14a91010912632cae322b06fce0425faedcf7353    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 19:55:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 19:55:56 -0400    

Click here for diff

This was mostly confusing, especially since some wait events in  
this class had the suffix and some did not.  
  
While at it, stop exposing MainLWLockNames[] as a globally visible  
name; any code using that directly is almost certainly wrong, as  
its name has been misleading for some time.  
(GetLWLockIdentifier() is what to use instead.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Fix bogus initialization of replication origin shared memory state.

commit   : 8048404939bb0fcef80b0ab57910b6e10d4289a3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 19:05:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 19:05:39 -0400    

Click here for diff

The previous coding zeroed out offsetof(ReplicationStateCtl, states)  
more bytes than it was entitled to, as a consequence of starting the  
zeroing from the wrong pointer (or, if you prefer, using the wrong  
calculation of how much to zero).  
  
It's unsurprising that this has not caused any reported problems,  
since it can be expected that the newly-allocated block is at the end  
of what we've used in shared memory, and we always make the shmem  
block substantially bigger than minimally necessary.  Nonetheless,  
this is wrong and it could bite us someday; plus it's a dangerous  
model for somebody to copy.  
  
This dates back to the introduction of this code (commit 5aa235042),  
so back-patch to all supported branches.  

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

Rename assorted LWLock tranches.

commit   : 36ac359d3621578cefc2156a3917024cdd3b1829    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 18:11:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 18:11:03 -0400    

Click here for diff

Choose names that fit into the conventions for wait event names  
(particularly, that multi-word names are in the style MultiWordName)  
and hopefully convey more information to non-hacker users than the  
previous names did.  
  
Also rename SerializablePredicateLockListLock to  
SerializablePredicateListLock; the old name was long enough to cause  
table formatting problems, plus the double occurrence of "Lock" seems  
confusing/error-prone.  
  
Also change a couple of particularly opaque LWLock field names.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/common/session.c
M src/backend/nodes/tidbitmap.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/cache/typcache.c
M src/include/storage/lwlock.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h

Add comments linking pg_strftime to timestamptz_to_str

commit   : a0ab4f4909a3f52e8b8243d2ae2dbb6f5027136c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2020 18:05:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2020 18:05:34 -0400    

Click here for diff

M src/backend/utils/adt/timestamp.c
M src/timezone/strftime.c

Avoid killing btree items that are already dead

commit   : 242dfcbafac592a3f097ec2e4e36fe1b739f7f29    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2020 16:50:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2020 16:50:34 -0400    

Click here for diff

_bt_killitems marks btree items dead when a scan leaves the page where  
they live, but it does so with only share lock (to improve concurrency).  
This was historicall okay, since killing a dead item has no  
consequences.  However, with the advent of data checksums and  
wal_log_hints, this action incurs a WAL full-page-image record of the  
page.  Multiple concurrent processes would write the same page several  
times, leading to WAL bloat.  The probability of this happening can be  
reduced by only killing items if they're not already dead, so change the  
code to do that.  
  
The problem could eliminated completely by having _bt_killitems upgrade  
to exclusive lock upon seeing a killable item, but that would reduce  
concurrency so it's considered a cure worse than the disease.  
  
Backpatch all the way back to 9.5, since wal_log_hints was introduced in  
9.4.  
  
Author: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CA+fd4k6PeRj2CkzapWNrERkja5G0-6D-YQiKfbukJV+qZGFZ_Q@mail.gmail.com  

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

Rename SLRU structures and associated LWLocks.

commit   : 5da14938f7bfb96b648ee3c47e7ea2afca5bcc4a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 14:28:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 May 2020 14:28:19 -0400    

Click here for diff

Originally, the names assigned to SLRUs had no purpose other than  
being shmem lookup keys, so not a lot of thought went into them.  
As of v13, though, we're exposing them in the pg_stat_slru view and  
the pg_stat_reset_slru function, so it seems advisable to take a bit  
more care.  Rename them to names based on the associated on-disk  
storage directories (which fortunately we *did* think about, to some  
extent; since those are also visible to DBAs, consistency seems like  
a good thing).  Also rename the associated LWLocks, since those names  
are likewise user-exposed now as wait event names.  
  
For the most part I only touched symbols used in the respective modules'  
SimpleLruInit() calls, not the names of other related objects.  This  
renaming could have been taken further, and maybe someday we will do so.  
But for now it seems undesirable to change the names of any globally  
visible functions or structs, so some inconsistency is unavoidable.  
  
(But I *did* terminate "oldserxid" with prejudice, as I found that  
name both unreadable and not descriptive of the SLRU's contents.)  
  
Table 27.12 needs re-alphabetization now, but I'll leave that till  
after the other LWLock renamings I have in mind.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/varsup.c
M src/backend/commands/async.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/xid8funcs.c
M src/bin/pg_rewind/filemap.c
M src/include/access/multixact.h
M src/include/access/transam.h
M src/include/commands/async.h
M src/include/storage/lwlock.h
M src/include/storage/predicate.h

Review of the glossary

commit   : 756abe2bc7608b38c579c510eb66f2bd80d10785    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2020 13:24:22 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 May 2020 13:24:22 -0400    

Click here for diff

Add some more terms, clarify some definitions, remove redundant terms,  
move a couple of terms to keep alphabetical order.  
  
Co-authored-by: Jürgen Purtz <[email protected]>  
Co-authored-by: Erik Rijkers <[email protected]>  
Co-authored-by: Laurenz Albe <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/glossary.sgml

doc: PG 13 rels: use xref labels referencing ref/*.sgml files

commit   : 6755b618997424b9e651126f59bf4109d680fffe    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 12:47:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 12:47:07 -0400    

Click here for diff

This avoids using <link> and supplied text.  

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

docs: add xreflabel entries for autovacuum, SP-GiST, and TOAST

commit   : 85af628da5e8dfea068559d076ad26b9a3378bfc    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 12:38:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 12:38:40 -0400    

Click here for diff

This is for use by the PG 13 release notes, but might be used for minor  
release notes in the future.  
  
Backpatch-through: 9.5  

M doc/src/sgml/maintenance.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/storage.sgml

doc: add missing xreflabels to the main docs (not refs)

commit   : 75fcdd2ae2174c49a56acb4d10c920a6a45570f7    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 12:05:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 12:05:43 -0400    

Click here for diff

Add missing xreflabels for index types, geqo, libpq, spi, server-side  
languages, ecpg, and vaacuumlo.  
  
Backpatch-through: 9.5  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/geqo.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/vacuumlo.sgml

doc: PG 13 relnotes: adjust UUID item, again

commit   : bc1c1de2cc30411bc5551ce1c7443914efa1fb86    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 11:21:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 11:21:43 -0400    

Click here for diff

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

doc: PG 13 relnotes: fix uuid item

commit   : 065ea0c30d2c8290af368721708bd369b5020996    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 10:57:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 10:57:14 -0400    

Click here for diff

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

doc: PG 13 relnotes: final SGML indenting adjustments

commit   : e90807085c7f398c52a1567daf9cacff578031cf    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 10:40:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 10:40:09 -0400    

Click here for diff

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

doc: remove extra blank line at the top of SGML files

commit   : e936fcb54d22561ad49c6c18f91dcb7566a58da1    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 09:55:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 09:55:43 -0400    

Click here for diff

Backpatch-through: 9.5  

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

doc: make ref/*.sgml file header comment layout consistent

commit   : 8d4b23fcae1f368122eb900489d6d24df75cff13    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 08:52:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 08:52:24 -0400    

Click here for diff

M doc/src/sgml/ref/checkpoint.sgml
M doc/src/sgml/ref/create_cast.sgml
M doc/src/sgml/ref/create_collation.sgml
M doc/src/sgml/ref/create_conversion.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_procedure.sgml
M doc/src/sgml/ref/create_transform.sgml
M doc/src/sgml/ref/drop_cast.sgml
M doc/src/sgml/ref/drop_collation.sgml
M doc/src/sgml/ref/drop_conversion.sgml
M doc/src/sgml/ref/drop_foreign_table.sgml
M doc/src/sgml/ref/drop_transform.sgml
M doc/src/sgml/ref/load.sgml
M doc/src/sgml/ref/pg_config-ref.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/pgtesttiming.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/set_constraints.sgml
M doc/src/sgml/ref/set_session_auth.sgml
M doc/src/sgml/ref/set_transaction.sgml

commit   : ec5afb0a4e050616fe6953e597fd1f61d47edc3a    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 08:29:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 15 May 2020 08:29:57 -0400    

Click here for diff

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

Make COPY TO keep locks until the transaction end.

commit   : a9cf48a4cf0c878684a2f52a3a88e29399b2065e    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 15 May 2020 08:10:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 15 May 2020 08:10:00 +0530    

Click here for diff

COPY TO released the ACCESS SHARE lock immediately when it was done rather  
than holding on to it until the end of the transaction.  
  
This breaks the case where a REPEATABLE READ transaction could see an  
empty table if it repeats a COPY statement and somebody truncated the  
table in the meantime.  
  
Before 4dded12faad the lock was also released after COPY FROM, but the  
commit failed to notice the irregularity in COPY TO.  
  
This is old behavior but doesn't seem important enough to backpatch.  
  
Author: Laurenz Albe, based on suggestion by Robert Haas and Tom Lane  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c

commit   : 39e7bcbbff82e25441529349134bf41fc336169b    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 May 2020 22:36:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 May 2020 22:36:21 -0400    

Click here for diff

M doc/src/sgml/README.links
M doc/src/sgml/release-13.sgml
M doc/src/sgml/release.sgml

Remove duplicated comment block in event_trigger.c

commit   : ff87fabef20ef40c8438e25fe28e9159f874183d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 15 May 2020 08:19:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 15 May 2020 08:19:30 +0900    

Click here for diff

The reasons why event triggers are disabled in standalone mode are  
documented in the code path of ddl_command_start, and other places  
checking if standalone mode is enabled or not mention to refer to the  
comment for ddl_command_start, except for table_rewrite that duplicated  
the same explanation.  
  
Reported-by: David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwYqHtXpvr2mBJRwH9f+Y5y1GXw3rhbaAu0Dk2MoNevsmA@mail.gmail.com  

M src/backend/commands/event_trigger.c

Doc: hack on table 26.1 till it fits in PDF format.

commit   : 2e619f86a96c32a710a09a4ff555952746813ba8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2020 18:44:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2020 18:44:18 -0400    

Click here for diff

I abbreviated the heck out of the column headings, and made a few  
small wording changes, to get it to build warning-free.  I can't  
say that the result is pretty, but it's probably better than  
removing this table entirely.  
  
As of this commit, we have zero "exceed the available area" warnings  
in a US-letter PDF build, and one such warning (about an 863-millipoint  
overrun) in an A4 build.  I expect to get rid of that one by renaming  
wait events, so I'm not doing anything about it at the formatting  
level.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/high-availability.sgml

Doc: tweak examples to silence line-too-long PDF build warnings.

commit   : 3d14c174cbbb6f83d8ac63fa7d0e1f42e0ae8d30    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2020 18:13:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2020 18:13:08 -0400    

Click here for diff

In one or two places it seemed reasonable to modify the example so as  
to shorten its output slightly; but for the most part I just added a  
&zwsp; after 67 characters, which is the most we can fit on a line  
of monospace text in A4 format.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bloom.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/jit.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/start.sgml
M doc/src/sgml/syntax.sgml

Initial pgindent and pgperltidy run for v13.

commit   : 5cbfce562f7cd2aab0cdc4694ce298ec3567930e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2020 13:06:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2020 13:06:38 -0400    

Click here for diff

Includes some manual cleanup of places that pgindent messed up,  
most of which weren't per project style anyway.  
  
Notably, it seems some people didn't absorb the style rules of  
commit c9d297751, because there were a bunch of new occurrences  
of function calls with a newline just after the left paren, all  
with faulty expectations about how the rest of the call would get  
indented.  

M contrib/adminpack/adminpack.c
M contrib/intarray/_int_bool.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/ltree.h
M contrib/ltree/ltree_gist.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_visibility/pg_visibility.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/option.c
M doc/src/sgml/mk_feature_tables.pl
M src/backend/access/common/detoast.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/pg_cast.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/storage.c
M src/backend/commands/alter.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execSRF.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeTidscan.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/crypt.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/backup_manifest.c
M src/backend/replication/logical/relation.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/smgr/smgr.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/error/elog.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplesort.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_verifybackup/parse_manifest.h
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/psql/common.c
M src/bin/psql/describe.c
M src/bin/psql/mainloop.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/createuser.c
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/common/jsonapi.c
M src/common/pg_lzcompress.c
M src/common/scram-common.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_combining_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/common/unicode_norm.c
M src/include/access/tableam.h
M src/include/access/visibilitymap.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_statistic_ext.h
M src/include/commands/dbcommands_xlog.h
M src/include/common/scram-common.h
M src/include/common/unicode_normprops_table.h
M src/include/executor/nodeAgg.h
M src/include/lib/simplehash.h
M src/include/libpq/libpq-be.h
M src/include/libpq/scram.h
M src/include/nodes/execnodes.h
M src/include/nodes/params.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/port.h
M src/include/port/win32.h
M src/include/replication/backup_manifest.h
M src/include/replication/logicalrelation.h
M src/include/replication/walreceiver.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/shmem.h
M src/include/utils/lsyscache.h
M src/include/utils/rangetypes.h
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
M src/pl/tcl/pltcl.c
M src/port/explicit_bzero.c
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/013_partition.pl
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/vcregress.pl
M src/tools/pgindent/typedefs.list
M src/tools/version_stamp.pl

doc: PG 13 relnotes: move docbook version change to doc sect.

commit   : 1255466f8358ecac29581aa5ecec76628dc2e33c    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 May 2020 11:51:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 May 2020 11:51:09 -0400    

Click here for diff

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

Collect built-in LWLock tranche names statically, not dynamically.

commit   : 29c3e2dd5a6aeaf1a23d7d83d665501e2dcc6955    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 May 2020 11:10:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 May 2020 11:10:31 -0400    

Click here for diff

There is little point in using the LWLockRegisterTranche mechanism for  
built-in tranche names.  It wastes cycles, it creates opportunities for  
bugs (since failing to register a tranche name is a very hard-to-detect  
problem), and the lack of any centralized list of names encourages  
sloppy nonconformity in name choices.  Moreover, since we have a  
centralized list of the tranches anyway in enum BuiltinTrancheIds, we're  
certainly not buying any flexibility in return for these disadvantages.  
  
Hence, nuke all the backend-internal LWLockRegisterTranche calls,  
and instead provide a const array of the builtin tranche names.  
  
(I have in mind to change a bunch of these names shortly, but this  
patch is just about getting them into one place.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/slru.c
M src/backend/access/transam/xlog.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlock.c

Doc: Fix some inconsistencies with markups

commit   : 07451e1f1adc4ff832196f1f47def13e49d2ed38    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 May 2020 20:14:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 May 2020 20:14:58 +0900    

Click here for diff

This addresses some whitespace issues with programlisting, and corrects  
the spelling of "Enter PEM pass phrase" to be consistent with the code.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo in comment on OpenSSL PEM password callback type name.

commit   : 267cc6ed29668fcf2e527f514f0fbbeaa73c388e    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 14 May 2020 13:53:16 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 14 May 2020 13:53:16 +0300    

Click here for diff

The type is called "pem_password_cb", not "pem_passwd_cb".  
  
Author: Daniel Gustafsson  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix amcheck for page checks concurrent to replay of btree page deletion

commit   : 34dae902ca1c7d32a24b711131911e3045c0097d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 14 May 2020 12:44:44 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 14 May 2020 12:44:44 +0300    

Click here for diff

amcheck expects at least hikey to always exist on leaf page even if it is  
deleted page.  But replica reinitializes page during replay of page deletion,  
causing deleted page to have no items.  Thus, replay of page deletion can  
cause an error in concurrent amcheck run.  
  
This commit relaxes amcheck expectation making it tolerate deleted page with  
no items.  
  
Reported-by: Konstantin Knizhnik  
Discussion: https://postgr.es/m/CAPpHfdt_OTyQpXaPJcWzV2N-LNeNJseNB-K_A66qG%3DL518VTFw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Peter Geoghegan  
Backpatch-through: 11  

M contrib/amcheck/verify_nbtree.c

Move check for fsync=off so that pendingOps still gets cleared.

commit   : e8abf585ab453ca9c2f66f2138baf6d3c9c8fbf0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 14 May 2020 08:39:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 14 May 2020 08:39:26 +0300    

Click here for diff

Commit 3eb77eba5a moved the loop and refactored it, and inadvertently  
changed the effect of fsync=off so that it also skipped removing entries  
from the pendingOps table. That was not intentional, and leads to an  
assertion failure if you turn fsync on while the server is running and  
reload the config.  
  
Backpatch-through: 12-  
Reviewed-By: Thomas Munro  
Discussion: https://www.postgresql.org/message-id/3cbc7f4b-a5fa-56e9-9591-c886deb07513%40iki.fi  

M src/backend/storage/sync/sync.c

Fix the MSVC build for versions 2015 and later.

commit   : a169155453e3d1c40c729a5318fd5298a990e5b0    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 14 May 2020 09:23:56 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 14 May 2020 09:23:56 +0530    

Click here for diff

Visual Studio 2015 and later versions should still be able to do the same  
as Visual Studio 2012, but the declaration of locale_name is missing in  
_locale_t, causing the code compilation to fail, hence this falls back  
instead on to enumerating all system locales by using EnumSystemLocalesEx  
to find the required locale name.  If the input argument is in Unix-style  
then we can get ISO Locale name directly by using GetLocaleInfoEx() with  
LCType as LOCALE_SNAME.  
  
In passing, change the documentation references of the now obsolete links.  
  
Note that this problem occurs only with NLS enabled builds.  
  
Author: Juan José Santamaría Flecha, Davinder Singh and Amit Kapila  
Reviewed-by: Ranier Vilela and Amit Kapila  
Backpatch-through: 9.5  
Discussion: https://postgr.es/m/CAHzhFSFoJEWezR96um4-rg5W6m2Rj9Ud2CNZvV4NWc9tXV7aXQ@mail.gmail.com  

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

Fix pg_recvlogical avoidance of superfluous Standby Status Update.

commit   : cee9cadb592fed6a6cb126f02002aba029544bd8    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 13 May 2020 20:42:09 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 13 May 2020 20:42:09 -0700    

Click here for diff

The defect suppressed a Standby Status Update message when bytes flushed  
to disk had changed but bytes received had not changed.  If  
pg_recvlogical then exited with no intervening Standby Status Update,  
the next pg_recvlogical repeated already-flushed records.  The defect  
could also cause superfluous messages, which are functionally harmless.  
Back-patch to 9.5 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_recvlogical.c

In successful pg_recvlogical, end PGRES_COPY_OUT cleanly.

commit   : 8222a9d9a12356349114ec275b01a1a58da2b941    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 13 May 2020 20:42:09 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 13 May 2020 20:42:09 -0700    

Click here for diff

pg_recvlogical merely called PQfinish(), so the backend sent messages  
after the disconnect.  When that caused EPIPE in internal_flush(),  
before a LogicalConfirmReceivedLocation(), the next pg_recvlogical would  
repeat already-acknowledged records.  Whether or not the defect causes  
EPIPE, post-disconnect messages could contain an ErrorResponse that the  
user should see.  One properly ends PGRES_COPY_OUT by repeating  
PQgetCopyData() until it returns a negative value.  Augment one of the  
tests to cover the case of WAL past --endpos.  Back-patch to v10, where  
commit 7c030783a5bd07cadffc2a1018bc33119a4c7505 first appeared.  Before  
that commit, pg_recvlogical never reached PGRES_COPY_OUT.  
  
Reported by Thomas Munro.  
  
Discussion: https://postgr.es/m/CAEepm=1MzM2Z_xNe4foGwZ1a+MO_2S9oYDq3M5D11=JDU_+0Nw@mail.gmail.com  

M src/bin/pg_basebackup/pg_recvlogical.c
M src/test/recovery/t/006_logical_decoding.pl

Doc: split up wait_event table.

commit   : 4fa8bd392d02637b4e4f27b79c06079e47765cbc    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 May 2020 23:36:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 May 2020 23:36:58 -0400    

Click here for diff

The previous design for this table didn't really work in narrow views,  
such as PDF output; besides which its reliance on large morerows  
values made it a pain to maintain (cf ab3e4fbd5, for example).  
  
I experimented with a couple of ways to fix it, but the best and  
simplest is to split it up into a separate table for each event  
type category.  
  
I also rearranged the event ordering to be strictly alphabetical,  
as nobody would ever be able to find entries otherwise.  
  
There is work afoot to revise the set of event names described  
in this table, but this commit just changes the layout, not the  
contents.  
  
In passing, add a missing entry to pg_locks.locktype,  
and cross-reference that to the related wait event list.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/monitoring.sgml

Doc: reformat catalog/view description tables.

commit   : a042750646db7ea28ff722855cf163401761937f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 May 2020 23:03:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 May 2020 23:03:39 -0400    

Click here for diff

This changes our catalog and view descriptions to use a style inspired  
by the new format for function/operator tables: each table entry is  
formatted roughly like a <varlistentry>, with the column name and type  
on the first line and then an indented description.  This provides much  
more room for expansive descriptions than we had before, and thereby  
eliminates a passel of PDF build warnings.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/stylesheet.css

Fix async.c to not register any SLRU stats counts in the postmaster.

commit   : 7fd89f4d7a51af77175a876613cffb490b9e5df1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 May 2020 22:48:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 May 2020 22:48:09 -0400    

Click here for diff

Previously, AsyncShmemInit forcibly initialized the first page of the  
async SLRU, to save dealing with that case in asyncQueueAddEntries.  
But this is a poor tradeoff, since many installations do not ever use  
NOTIFY; for them, expending those cycles in AsyncShmemInit is a  
complete waste.  Besides, this only saves a couple of instructions  
in asyncQueueAddEntries, which hardly seems likely to be measurable.  
  
The real reason to change this now, though, is that now that we track  
SLRU access stats, the existing code is causing the postmaster to  
accumulate some access counts, which then get inherited into child  
processes by fork(), messing up the statistics.  Delaying the  
initialization into the first child that does a NOTIFY fixes that.  
  
Hence, we can revert f3d23d83e, which was an incorrect attempt at  
fixing that issue.  Also, add an Assert to pgstat.c that should  
catch any future errors of the same sort.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: PG 13 relnotes: adjust wal_skip_threshold wording

commit   : d82a5058fdb5905abc9867da302000c39aa30f01    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 13 May 2020 22:48:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 13 May 2020 22:48:11 -0400    

Click here for diff

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

Dial back -Wimplicit-fallthrough to level 3

commit   : 17cc133f017cb13737e23ce0da4415daf2c34cc3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 May 2020 15:31:14 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 May 2020 15:31:14 -0400    

Click here for diff

The additional pain from level 4 is excessive for the gain.  
  
Also revert all the source annotation changes to their original  
wordings, to avoid back-patching pain.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M contrib/pgcrypto/pgp-info.c
M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/dependency.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeLimit.c
M src/backend/libpq/auth.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partprune.c
M src/backend/postmaster/postmaster.c
M src/backend/regex/regc_pg_locale.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/common/hashfn.c
M src/common/wchar.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/libpq/fe-secure.c
M src/pl/plpgsql/src/pl_exec.c
M src/port/snprintf.c
M src/timezone/Makefile

Improve management of SLRU statistics collection.

commit   : 81ca8686305c4c62d723ab224ad5c414f350a3a0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 May 2020 13:08:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 May 2020 13:08:12 -0400    

Click here for diff

Instead of re-identifying which statistics bucket to use for a given  
SLRU on every counter increment, do it once during shmem initialization.  
This saves a fair number of cycles, and there's no real cost because  
we could not have a bucket assignment that varies over time or across  
backends anyway.  
  
Also, get rid of the ill-considered decision to let pgstat.c pry  
directly into SLRU's shared state; it's cleaner just to have slru.c  
pass the stats bucket number.  
  
In consequence of these changes, there's no longer any need to store  
an SLRU's LWLock tranche info in shared memory, so get rid of that,  
making this a net reduction in shmem consumption.  (That partly  
reverts fe702a7b3.)  
  
This is basically code review for 28cac71bd, so I also cleaned up  
some comments, removed a dangling extern declaration, fixed some  
things that should be static and/or const, etc.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/slru.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/access/slru.h
M src/include/pgstat.h

Adjust walsender usage of xlogreader, simplify APIs

commit   : 850196b610d2a1802b4ed7f9f608153a949eda34    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 May 2020 12:17:08 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 May 2020 12:17:08 -0400    

Click here for diff

* Have both physical and logical walsender share a 'xlogreader' state  
  struct for tracking state.  This replaces the existing globals sendSeg  
  and sendCxt.  
  
* Change WALRead not to receive XLogReaderState->seg and ->segcxt as  
  separate arguments anymore; just use the ones from 'state'.  This is  
  made possible by the above change.  
  
* have the XLogReader segment_open contract require the callbacks to  
  install the file descriptor in the state struct themselves instead of  
  returning it.  xlogreader was already ignoring any possible failed  
  return from the callbacks, relying solely on them never returning.  
  
  (This point is not altogether excellent, as it means the callbacks  
  have to know more of XLogReaderState; but to really improve on that  
  we would have to pass back error info from the callbacks to  
  xlogreader.  And the complexity would not be saved but instead just  
  transferred to the callers of WALRead, which would have to learn how  
  to throw errors from the open_segment callback in addition of, as  
  currently, from pg_pread.)  
  
* segment_open no longer receives the 'segcxt' as a separate argument,  
  since it's part of the XLogReaderState argument.  
  
Per comments from Kyotaro Horiguchi.  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/walsender.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h

Use proper GetDatum function in pg_stat_get_slru().

commit   : 043e3e04016077735f986726a3a74192c295ace7    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 13 May 2020 22:20:37 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 13 May 2020 22:20:37 +0900    

Click here for diff

This commit changes pg_stat_get_slru() so that it uses  
TimestampTzGetDatum() for stats_reset field because that field  
stores the timestamp with time zone value. Previously  
Int64GetDatum() was used.  
  
Author: Fujii Masao  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

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

Initialize SLRU stats entries to zero.

commit   : f3d23d83ef9a33344391acbaa92a6235a4350791    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 13 May 2020 22:19:25 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 13 May 2020 22:19:25 +0900    

Click here for diff

Previously since SLRUStats was not initialized, SLRU stats counters  
could begin with non-zero value. Which could lead to incorrect results  
in pg_stat_slru view.  
  
Author: Fujii Masao  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

docs: PG 13 relnotes: adjust wal_skip_threshold and UTF8 items

commit   : ac3a4866c0bf1d7a14009f18d3b42ffcb063a7e9    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 12 May 2020 17:17:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 12 May 2020 17:17:12 -0400    

Click here for diff

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

Fix straggler

commit   : 87c291e29d6bf403c6adefd81ddafa134c254a3e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 May 2020 16:15:55 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 May 2020 16:15:55 -0400    

Click here for diff

contrib/pgcrypto did contain an unedited fall-through marker after all.  

M contrib/pgcrypto/pgp-info.c

Add -Wimplicit-fallthrough to CFLAGS and CXXFLAGS

commit   : 3e9744465dbe51822c7d76baca1f934d54ba9452    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 May 2020 16:01:52 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 May 2020 16:01:52 -0400    

Click here for diff

Use it at level 4, a bit more restrictive than the default level, and  
tweak our commanding comments to FALLTHROUGH.  
  
(However, leave zic.c alone, since it's external code; to avoid the  
warnings that would appear there, change CFLAGS for that file in the  
Makefile.)  
  
Author: Julien Rouhaud <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/20200412081825.qyo5vwwco3fv4gdo@nol  
Discussion: https://postgr.es/m/flat/[email protected]  

M configure
M configure.in
M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/dependency.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeLimit.c
M src/backend/libpq/auth.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partprune.c
M src/backend/postmaster/postmaster.c
M src/backend/regex/regc_pg_locale.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/common/hashfn.c
M src/common/wchar.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/libpq/fe-secure.c
M src/pl/plpgsql/src/pl_exec.c
M src/port/snprintf.c
M src/timezone/Makefile

Rework EXPLAIN format for incremental sort

commit   : 6a918c3ac8a6b1d8b53cead6fcb7cbd84eee5750    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 12 May 2020 20:04:39 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 12 May 2020 20:04:39 +0200    

Click here for diff

The explain format used by incremental sort was somewhat inconsistent  
with other nodes, making it harder to parse and understand. This commit  
addresses that by  
  
 - adding an extra space to better separate groups of values  
  
 - using colons instead of equal signs to separate key/value  
  
 - properly capitalizing first letter of a key  
  
 - using separate lines for full and pre-sorted groups  
  
These changes were proposed by Justin Pryzby and mostly copy the final  
explain format used to report WAL usage.  
  
Author: Justin Pryzby  
Reviewed-by: James Coleman  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typos and improve incremental sort comments

commit   : 1a40d37a9faff562a36bd255a993fd3503bdf2b1    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 12 May 2020 19:37:13 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 12 May 2020 19:37:13 +0200    

Click here for diff

Author: Justin Pryzby, James Coleman  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/utils/sort/tuplesort.c

Do pre-release housekeeping on catalog data.

commit   : 7b48f1b490978a8abca61e9a9380f8de2a56f266    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 May 2020 13:03:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 May 2020 13:03:43 -0400    

Click here for diff

Run renumber_oids.pl to move high-numbered OIDs down, as per pre-beta  
tasks specified by RELEASE_CHANGES.  For reference, the command was  
./renumber_oids.pl --first-mapped-oid=8000 --target-oid=5032  
  
Also run reformat_dat_file.pl while I'm here.  
  
Renumbering recently-added types changed some results in the opr_sanity  
test.  To make those a bit easier to eyeball-verify, change the queries  
to show regtype not just bare type OIDs.  (I think we didn't have  
regtype when these queries were written.)  

M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Remove unnecessary #include.

commit   : 2793bbe75e276476877ff9af6bb7effe92eff782    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 12 May 2020 19:55:55 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 12 May 2020 19:55:55 +0900    

Click here for diff

My oversight in commit c8434d64c.  

M src/backend/optimizer/util/relnode.c

Fix comment in xlogutils.c

commit   : 078c9cd258e5ad8f54081c971b7b927f845e7505    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 May 2020 14:43:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 May 2020 14:43:57 +0900    

Click here for diff

The existing callers of XLogReadDetermineTimeline() performing recovery  
need to check a replay LSN position when determining on which timeline  
to read a WAL page.  A portion of the comment describing this function  
said exactly that, while referring to a routine for fetching a write  
LSN, something not available in recovery.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

Correct standbycheck regression test output.

commit   : 81ec990a23b9cbfaa5684e90091164f1d85f24d3    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 May 2020 13:56:19 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 May 2020 13:56:19 +0900    

Click here for diff

Commit 2eb34ac369 changed error messages emit when commands are  
rejected during recovery. But it forgot to update the standbycheck  
regression test output with those error message changes.  
  
Reported-by: Michail Nikolaev  
Author: Michail Nikolaev  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CANtu0ojFPgcspH=0nNZ+qmu0XD69sXKtVttuSoYKHawRADSQGg@mail.gmail.com  

M src/test/regress/expected/hs_standby_disallowed.out

doc: PG 13 relnotes: add documentation section and reformat

commit   : b89d90b051a1da7a447b25dc749ce42ccb4dc5bd    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2020 22:58:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2020 22:58:47 -0400    

Click here for diff

Add section about function table reformatting.  

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

Doc: hack table 13.2 "Conflicting Lock Modes" till it fits in PDF.

commit   : 57775e82b235b2c815d9fd85cea53d77373a9203    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 May 2020 20:41:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 May 2020 20:41:06 -0400    

Click here for diff

I can't see any way to make this table fit in PDF column width  
without either a fundamental redesign or abbreviating EXCLUSIVE.  
So I did the latter.  
  
It'd be nicer if the abbreviating didn't leak into the HTML output  
as well; but the hackery required to make the output different  
seems like more trouble than it's really worth.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/mvcc.sgml

doc: PG 13 relnotes: add duplicate btree optimization details

commit   : aa976d3b9004bd2c275e4ad17fa897ce5fe5127e    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2020 21:24:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2020 21:24:08 -0400    

Click here for diff

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

doc: PG 13 relnotes: cumulative fixes from email feedback

commit   : ca4599b0dcc4ed44e24cc4f2cd39677a19356324    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2020 21:19:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 May 2020 21:19:57 -0400    

Click here for diff

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

Doc: fix remaining over-length entries in SQL keywords table.

commit   : 4d1563717fb1860168a40b852e1d61a33ecdd62f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 May 2020 20:03:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 May 2020 20:03:55 -0400    

Click here for diff

Even after the tweaking I did in commit 5545b69ae, some of the  
longer keywords mentioned in the SQL standard don't fit the  
available space in PDF output.  
  
I experimented with various solutions like putting such keywords  
on their own table lines, but everything looked ugly or confusing  
or both; worse, the weirdness also appeared in the HTML version,  
which (normally) doesn't need it.  
  
The best answer seems to be to insert &zwsp; into long keywords  
so that they can be broken into two lines when, and only when,  
needed.  It doesn't look too awful if the break happens after  
an underscore --- and fortunately, all the problematic keywords  
have underscores.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/generate-keywords-table.pl

Doc: fix "Unresolved ID reference" warnings, clean up man page cross-refs.

commit   : 60c90c16c1885bb9aa2047b66f958b865c5d397e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 May 2020 14:15:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 May 2020 14:15:49 -0400    

Click here for diff

Use xreflabel attributes instead of endterm attributes to control the  
appearance of links to subsections of SQL command reference pages.  
This is simpler, it matches what we do elsewhere (e.g. for GUC variables),  
and it doesn't draw "Unresolved ID reference" warnings from the PDF  
toolchain.  
  
Fix some places where the text was absolutely dependent on an <xref>  
rendering exactly so, by using a <link> around the required text  
instead.  At least one of those spots had already been turned into  
bad grammar by subsequent changes, and the whole idea is just too  
fragile for my taste.  <xref> does NOT have fixed output, don't write  
as if it does.  
  
Consistently include a page-level link in cross-man-page references,  
because otherwise they are useless/nonsensical in man-page output.  
Likewise, be consistent about mentioning "below" or "above" in same-page  
references; we were doing that in about 90% of the cases, but now it's  
100%.  
  
Also get rid of another nonfunctional-in-PDF idea, of making  
cross-references to functions by sticking ID tags on <row> constructs.  
We can put the IDs on <indexterm>s instead --- which is probably not any  
more sensible in abstract terms, but it works where the other doesn't.  
(There is talk of attaching cross-reference IDs to most or all of  
the docs' function descriptions, but for now I just fixed the two  
that exist.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_materialized_view.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_table_as.sgml
M doc/src/sgml/ref/declare.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/execute.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/ref/update.sgml
M doc/src/sgml/ref/values.sgml

Adjust "root of to-be-deleted subtree" function.

commit   : 624686abcf87d26fe7c03543c4a54aad2237cb93    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 11 May 2020 11:01:07 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 11 May 2020 11:01:07 -0700    

Click here for diff

Restructure the function that locates the root of the to-be-deleted  
subtree during nbtree page deletion.  Handle the conditions that make  
page deletion unsafe in a slightly more uniform way, and acknowledge the  
fact that the behavior with incomplete splits on internal pages is  
different (as pointed out in the nbtree README as of commit 35bc0ec7).  
Also invent new terminology that avoids ambiguity around which pages are  
about to be deleted.  Consistently use the term "to-be-deleted subtree",  
not the ambiguous term "branch".  
  
We were calling the subtree parent page the "top parent page", but that  
was quite misleading.  The top parent page usually refers to a page  
unlinked from its siblings and marked deleted (during the second stage  
of page deletion).  There was one kind of top parent page that we merely  
removed a downlink from, and another kind of top parent page that we  
actually marked deleted.  Eliminate the ambiguity by inventing a new  
term ("subtree parent page") that refers to the former kind of page  
only.  

M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/nbtxlog.h

Fix obsolete references to "XLogRead"

commit   : a8be5364ac1678e35029f547632d4002552f943c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 May 2020 12:46:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 May 2020 12:46:41 -0400    

Click here for diff

The one in xlogreader.h was pointed out by Antonin Houska; I (Álvaro) noticed the  
others by grepping.  
  
Author: Antonin Houska <[email protected]>  
Discussion: https://postgr.es/m/28250.1589186654@antos  

M src/backend/replication/walsender.c
M src/include/access/xlogreader.h

Translation updates

commit   : 7a9c9ce6411720c2bbeaf6e64855d4263c47ea80    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 May 2020 13:14:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 May 2020 13:14:32 +0200    

Click here for diff

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

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

Doc: marginal hacking to remove some PDF build warnings.

commit   : 336aa51b70e9cf7da3969a3f102ff4913717083d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 May 2020 16:20:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 May 2020 16:20:28 -0400    

Click here for diff

This patch eliminates a few more "exceed the available area" warnings  
whose causes aren't particularly connected to anything else.  
  
The only one really worthy of comment is that I increased the space  
allowed for an <orderedlist>'s numbers, because the default of 1em  
doesn't quite work for more than one digit.  The rest are one-off  
insertions of &zwsp; and suchlike tweaks, in places where they  
shouldn't do any damage to the material.  (In particular, although  
I split some long identifiers with zwsp's, there are other nearby  
occurrences of each one; so those changes shouldn't hurt greppability  
of the document sources.)  

M doc/src/sgml/bgworker.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/textsearch.sgml

commit   : e111c9f90ab6090859127cbb22156f4858b6a40c    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 10 May 2020 10:58:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 10 May 2020 10:58:54 +0900    

Click here for diff

The last caller of this routine was removed in b416691, and as a wise  
man said one day, dead code tends to silently break.  
  
Per discussion between Fujii Masao, Peter Geoghegan, Vignesh C and me.  
  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wz=sg5H8-vG4d5UmAofdcRMpeTDt2K-NUWp4GSfhenRGAQ@mail.gmail.com  

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

Doc: fix assorted misstatements of fact in catalog & system view docs.

commit   : 9356e43544287f1b727e6cb3350f98e35ecea752    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 May 2020 19:09:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 May 2020 19:09:44 -0400    

Click here for diff

I made up a very crude hack to compare the docs with reality (as  
embodied in the system catalogs) ... and indeed they don't match  
everywhere.  Missing oid columns, wrong data types, wrong "references"  
links, columns listed in the wrong order.  None of this seems quite  
important enough to back-patch.  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/monitoring.sgml

Fix findoidjoins to recognize oidvector columns.

commit   : 96d175e3e2ea1bbf734f21444126a711da12108b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 May 2020 16:28:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 May 2020 16:28:09 -0400    

Click here for diff

Somehow we'd never noticed this oversight, even though it means  
that such basic columns as pg_proc.proargtypes were not being  
validated by the oidjoins test.  Correct the query and update  
the test script with the newly-found dependencies.  

M src/test/regress/expected/oidjoins.out
M src/test/regress/sql/oidjoins.sql
M src/tools/findoidjoins/README
M src/tools/findoidjoins/findoidjoins.c

Simplify show_incremental_sort_info a bit

commit   : ebeb3dea772652887b67a7549906f5a9ec8a487f    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 9 May 2020 19:41:42 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 9 May 2020 19:41:42 +0200    

Click here for diff

Incremental sort always processes at least one full group group before  
switching to prefix groups, so it's enough to check just the number of  
full groups. There was no risk of division by zero due to the extra  
condition, but it made the code harder to understand.  
  
Reported-by: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAp+7qoS92-4V1vLChpdY3vEkLCbf+gye6P-4cirE-0z0A@mail.gmail.com  

M src/backend/commands/explain.c

Do no reset bounded before incremental sort rescan

commit   : 9155b4be9a13038d59a7a09a27b7fbce3819eb08    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 9 May 2020 19:41:36 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 9 May 2020 19:41:36 +0200    

Click here for diff

ExecReScanIncrementalSort was resetting bounded=false, which means the  
optimization would be disabled on all rescans. This happens because  
ExecSetTupleBound is called before the rescan, not after it.  
  
Author: James Coleman  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeIncrementalSort.c

Fix handling of REWIND/MARK/BACKWARD in incremental sort

commit   : c4427226483c78618ba45eff34917400a77718a5    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 9 May 2020 19:41:18 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 9 May 2020 19:41:18 +0200    

Click here for diff

The executor flags were not handled entirely correctly, although the  
bugs were mostly harmless and it was mostly comment inaccuracy. We don't  
need to strip any of the flags for child nodes.  
  
Incremental sort does not support backward scans of mark/restore, so  
MARK/BACKWARDS flags should not be possible. So we simply ensure this  
using an assert, and we don't bother removing them when initializing  
the child node.  
  
With REWIND it's a bit less clear - incremental sort does not support  
REWIND, but there is no way to signal this - it's legal to just ignore  
the flag. We however continue passing the flag to child nodes, because  
they might be useful to leverage that.  
  
Reported-by: Michael Paquier  
Author: James Coleman  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeIncrementalSort.c

Update oidjoins regression test for v13.

commit   : 6c298881c20797ac424558b9ff68d9781e03f6c4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 May 2020 13:05:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 May 2020 13:05:08 -0400    

Click here for diff

We seem to have forgotten to do this in the v12 cycle, so add it as  
a task in the RELEASE_CHANGES list, in hopes we won't forget again.  
  
While here, fix findoidjoins.c so that it actually works in the  
new dispensation where OID is a regular column, and change it to only  
consider system relations (this avoids being fooled by the OID column  
in the brintest test table).  
  
Also tweak the largeobject test so that the somewhat-recently-added  
manual creation of a LO with an OID in the system range doesn't  
fool findoidjoins.c.  For the moment I just made that use an unused  
OID, but we might have to find a more robust solution someday.  

M src/test/regress/expected/oidjoins.out
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/test/regress/sql/oidjoins.sql
M src/tools/RELEASE_CHANGES
M src/tools/findoidjoins/README
M src/tools/findoidjoins/findoidjoins.c

pg_restore: Provide file name with one failure message

commit   : 89a7d21dfc9d891d2b3dcfea161b58d4ea458af6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 May 2020 19:38:46 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 May 2020 19:38:46 -0400    

Click here for diff

Almost all error messages already include file name where relevant, but  
this one had been overlooked.  Repair.  
  
Backpatch to 9.5.  
  
Author: Euler Taveira <[email protected]>  
Discussion: https://postgr.es/m/CAH503wA_VOrcKL_43p9atRejCDYmOZ8MzfK9S6TJrQqBqNeAXA@mail.gmail.com  
Reviewed-by: Álvaro Herrera <[email protected]>  

M src/bin/pg_dump/pg_backup_directory.c

Rework XLogReader callback system

commit   : b060dbe0001a1d6bf26cd294710f3cb203868d46    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 May 2020 15:30:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 May 2020 15:30:34 -0400    

Click here for diff

Code review for 0dc8ead46363, prompted by a bug closed by 91c40548d5f7.  
  
XLogReader's system for opening and closing segments had gotten too  
complicated, with callbacks being passed at both the XLogReaderAllocate  
level (read_page) as well as at the WALRead level (segment_open).  This  
was confusing and hard to follow, so restructure things so that these  
callbacks are passed together at XLogReaderAllocate time, and add  
another callback to the set (segment_close) to make it a coherent whole.  
Also, ensure XLogReaderState is an argument to all the callbacks, so  
that they can grab at the ->private data if necessary.  
  
Document the whole arrangement more clearly.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h
M src/include/replication/logical.h

Improve use of prepositions in messages

commit   : 871696ba20e0251e86041576373809d1c7ca161d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 May 2020 20:35:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 May 2020 20:35:03 +0200    

Click here for diff

*in* database, *in* cluster, *on* server; and some related fixes  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/scripts/reindexdb.c

Unify find_other_exec() error messages

commit   : 7666ef313dcc22c8716ee74dfefab8e5ea628678    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 May 2020 13:33:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 May 2020 13:33:00 +0200    

Click here for diff

There were a few different ways to line-wrap the error messages.  Make  
them all the same, and use placeholders for the actual program names,  
to save translation work.  

M src/bin/initdb/initdb.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_verifybackup/pg_verifybackup.c

Fix several DDL issues of generated columns versus inheritance

commit   : 086ffddf3656fb3d24d9a73ce36cb1102e42cc90    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 May 2020 16:25:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 May 2020 16:25:54 +0200    

Click here for diff

Several combinations of generated columns and inheritance in CREATE  
TABLE were not handled correctly.  Specifically:  
  
- Disallow a child column specifying a generation expression if the  
  parent column is a generated column.  The child column definition  
  must be unadorned and the parent column's generation expression will  
  be copied.  
  
- Prohibit a child column of a generated parent column specifying  
  default values or identity.  
  
- Allow a child column of a not-generated parent column specifying  
  itself as a generated column.  This previously did not work, but it  
  was possible to arrive at the state via other means (involving ALTER  
  TABLE), so it seems sensible to support it.  
  
Add tests for each case.  Also add documentation about the rules  
involving generated columns and inheritance.  
  
Discussion:  
    https://www.postgresql.org/message-id/flat/15830.1575468847%40sss.pgh.pa.us  
    https://www.postgresql.org/message-id/flat/2678bad1-048f-519a-ef24-b12962f41807%40enterprisedb.com  
    https://www.postgresql.org/message-id/flat/CAJvUf_u4h0DxkCMCeEKAWCuzGUTnDP-G5iVmSwxLQSXn0_FWNQ%40mail.gmail.com  

M doc/src/sgml/ddl.sgml
M src/backend/commands/tablecmds.c
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Propagate ALTER TABLE ... SET STORAGE to indexes

commit   : 501e41dd3cb945287fdcfe25e8906e79872fcc44    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Apr 2020 14:10:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Apr 2020 14:10:01 +0200    

Click here for diff

When creating a new index, the attstorage setting of the table column  
is copied to regular (non-expression) index columns.  But a later  
ALTER TABLE ... SET STORAGE is not propagated to indexes, thus  
creating an inconsistent and undumpable state.  
  
Discussion: https://www.postgresql.org/message-id/flat/9765d72b-37c0-06f5-e349-2a580aafd989%402ndquadrant.com  

M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/sql/toast.sql
M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/vacuum.sql

Fix inconsistency in pg_buffercache docs.

commit   : f9463d2a903da930531d124ea8bbbff8c097d86b    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 8 May 2020 08:33:05 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 8 May 2020 08:33:05 +0530    

Click here for diff

Commit 6e654546fb avoids locking bufmgr partitions to make pg_buffercache  
less disruptive on production systems but forgot to update the docs.  
  
Reported-by: Sawada Masahiko  
Author: Sawada Masahiko  
Reviewed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CA+fd4k6sD8oeP1qJbFAor=rCpYckU9DsywHiYx3x5Hz5Z8Ua_w@mail.gmail.com  

M doc/src/sgml/pgbuffercache.sgml

Report missing wait event for timeline history file.

commit   : f2ff2035962cd2ddd56c1593709d48ca0d3a78c5    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 8 May 2020 10:36:40 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 8 May 2020 10:36:40 +0900    

Click here for diff

TimelineHistoryRead and TimelineHistoryWrite wait events are reported  
during waiting for a read and write of a timeline history file, respectively.  
However, previously, TimelineHistoryRead wait event was not reported  
while readTimeLineHistory() was reading a timeline history file. Also  
TimelineHistoryWrite was not reported while writeTimeLineHistory() was  
writing one line with the details of the timeline split, at the end.  
This commit fixes these issues.  
  
Back-patch to v10 where wait events for a timeline history file was added.  
  
Author: Masahiro Ikeda  
Reviewed-by: Michael Paquier, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor nbtree deletion INCOMPLETE_SPLIT check.

commit   : cd8c73a38a23c364e71973d6832a585616d24756    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 7 May 2020 16:08:54 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 7 May 2020 16:08:54 -0700    

Click here for diff

Factor out code common to _bt_lock_branch_parent() and _bt_pagedel()  
into a new utility function.  This new function is used to check that  
the left sibling of a deletion target page does not have the  
INCOMPLETE_SPLIT page flag set.  If it is set then deletion is unsafe;  
there won't be a usable pivot tuple (with a downlink) in the parent page  
that points to the deletion target page.  The page deletion algorithm is  
not prepared to deal with that.  Also restructure an existing, related  
utility function that checks if the right sibling of the target page has  
the ISHALFDEAD page flag set.  
  
This organization highlights the symmetry between the two cases.  The  
goal is to make the design of page deletion clearer.  Both functions  
involve a sibling page with a flag that indicates that there was an  
interrupted operation (a page split or a page deletion) that resulted in  
a page pointed to by sibling pages, but not pointed to in the parent.  
And, both functions indicate if page deletion is unsafe due to the  
absence of a particular downlink in the parent page.  

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

Fix YA text phrase search bug.

commit   : db89f0e3a45e98c1065355af75f41b5652333111    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 May 2020 15:59:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 May 2020 15:59:51 -0400    

Click here for diff

checkcondition_str() failed to report multiple matches for a prefix  
pattern correctly: it would dutifully merge the match positions, but  
then after exiting that loop, if the last prefix-matching word had  
had no suitable positions, it would report there were no matches.  
The upshot would be failing to recognize a match that the query  
should match.  
  
It looks like you need all of these conditions to see the bug:  
* a phrase search (else we don't ask for match position details)  
* a prefix search item (else we don't get to this code)  
* a weight restriction (else checkclass_str won't fail)  
  
Noted while investigating a problem report from Pavel Borisov,  
though this is distinct from the issue he was on about.  
  
Back-patch to 9.6 where phrase search was added.  

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

Doc: update remaining tables of functions/operators for new layout.

commit   : b2fd8ebe239f726b99923f827e908a92f6f4f232    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 May 2020 14:25:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 May 2020 14:25:18 -0400    

Click here for diff

This converts the contrib documentation to the new style, and mops up  
a couple of function tables that were outside chapter 9 in the main  
docs.  
  
A few contrib modules choose not to present their functions in the  
standard tabular format.  There might be room to rethink those decisions  
now that the standard format is more friendly to verbose descriptions.  
But I have not undertaken to do that here; I just converted existing  
tables.  

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/cube.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/intarray.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/tablefunc.sgml
M doc/src/sgml/uuid-ossp.sgml
M doc/src/sgml/xml2.sgml

doc: PG 13 relnotes: adjust partitioning items

commit   : c265ed9b355fdd2a80e7af64e88cddabd3d39151    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 May 2020 13:06:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 May 2020 13:06:31 -0400    

Click here for diff

Reported-by: Amit Langote  

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

doc: PG 13 relnotes: adjust wording and Unicode item

commit   : db9e99da2c61f46bfe37032bab1ee602e5c8335c    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 May 2020 10:01:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 May 2020 10:01:22 -0400    

Click here for diff

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

doc: PG 13 relnotes: adjust partition items and attributions

commit   : 545a065880be8ccddfb116a0915bfdac0cd41902    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 May 2020 09:00:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 May 2020 09:00:24 -0400    

Click here for diff

This merges three partition publication items into two.  

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

doc: PG 13 relnotes, update TOAST item to mention decompression

commit   : fb544735f11480a697fcab791c058adc166be1fa    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 6 May 2020 19:34:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 6 May 2020 19:34:22 -0400    

Click here for diff

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

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

pgbench: document that the default data loading is client-side

commit   : c3d1fdb59891e78df9ffb89b3e8bea780bd90568    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 6 May 2020 19:07:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 6 May 2020 19:07:29 -0400    

Click here for diff

Reported-by: Fabien COELHO  
  
Discussion: https://postgr.es/m/alpine.DEB.2.22.394.2005051811320.2183756@pseudo  

M doc/src/sgml/ref/pgbench.sgml

Doc: remove now-redundant align specifications in colspecs.

commit   : 90be091480d439db6876f6cbebf9ea42ccb79496    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 May 2020 15:58:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 May 2020 15:58:23 -0400    

Click here for diff

In the wake of commit f21599311, we don't need to set table columns'  
align specs retail.  Undo a few such settings I'd added in commit  
5545b69ae.  (The column width adjustments stay, though.)  

M doc/src/sgml/charset.sgml
M doc/src/sgml/errcodes.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/generate-keywords-table.pl

Heed lock protocol in DROP OWNED BY

commit   : 5be594caf818e0b5e33f8dec191f2707394a6d95    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 6 May 2020 12:29:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 6 May 2020 12:29:41 -0400    

Click here for diff

We were acquiring object locks then deleting objects one by one, instead  
of acquiring all object locks first, ignoring those that did not exist,  
and then deleting all objects together.   The latter is the correct  
protocol to use, and what this commits changes to code to do.  Failing  
to follow that leads to "cache lookup failed for relation XYZ" error  
reports when DROP OWNED runs concurrently with other DDL -- for example,  
a session termination that removes some temp tables.  
  
Author: Álvaro Herrera  
Reported-by: Mithun Chicklore Yogendra (Mithun CY)  
Reviewed-by: Ahsan Hadi, Tom Lane  
Discussion: https://postgr.es/m/CADq3xVZTbzK4ZLKq+dn_vB4QafXXbmMgDP3trY-GuLnib2Ai1w@mail.gmail.com  

M src/backend/catalog/dependency.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/subscriptioncmds.c
M src/include/catalog/dependency.h

Doc: further fooling-about with rendering of tables in PDF output.

commit   : f21599311e50a43c90a3d33ef4f60193a774321a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 May 2020 12:23:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 May 2020 12:23:43 -0400    

Click here for diff

I concluded that we really just ought to force all tables in PDF output  
to default to "left" alignment (instead of "justify"); that is what the  
HTML toolchain does and that's what most people have been designing the  
tables to look good with.  There are few if any places where "justify"  
produces better-looking output, and there are many where it looks  
horrible.  So change stylesheet-fo.xsl to make that true.  
  
Also tweak column widths in a few more tables to make them look better  
and avoid "exceed the available area" warnings.  This commit fixes  
basically everything that can be fixed through that approach.  The  
remaining tables that give warnings either are scheduled for redesign  
as per recent discussions, or need a fundamental rethink because they  
Just Don't Work in a narrow view.  

M doc/src/sgml/brin.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/syntax.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/user-manag.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xindex.sgml

Handle spaces for Python install location in MSVC scripts

commit   : beb2516e961490723fb1a2f193406afb3d71ea9c    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 May 2020 21:08:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 May 2020 21:08:15 +0900    

Click here for diff

Attempting to use an installation path of Python that includes spaces  
caused the MSVC builds to fail.  This fixes the issue by using the same  
quoting method as ad7595b for OpenSSL.  
  
Author: Victor Wagner  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/tools/msvc/Mkvcbuild.pm

doc: PG 13 relnotes, fix markup

commit   : 7dc37ccea8599f460ec95b8a0208e2047a6fb4bf    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 17:45:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 17:45:34 -0400    

Click here for diff

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

doc: PG 13 renotes: adjust attribution and pgbench item

commit   : d08ac7d85fc844bb5b2cb456a858e9f4d344722c    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 17:43:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 17:43:27 -0400    

Click here for diff

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

Normalize _bt_findsplitloc() argument names.

commit   : 0025a90f732b06027f6eaa6d35dbb303baffef10    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 5 May 2020 14:42:10 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 5 May 2020 14:42:10 -0700    

Click here for diff

Oversight in commit bc3087b626d.  

M src/include/access/nbtree.h

Remove obsolete amcheck comment.

commit   : 18c117cc56269f064d1b81674771d1559cf88b3d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 5 May 2020 14:36:54 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 5 May 2020 14:36:54 -0700    

Click here for diff

Oversight in commit d114cc53.  

M contrib/amcheck/verify_nbtree.c

doc: PG 13 relnotes, add pgbench script item

commit   : e0acac67da46951bf00d4d0df33a8020cac7308c    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 17:21:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 17:21:57 -0400    

Click here for diff

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

doc: PG 13 relnotes, add attributions and wording changes

commit   : b0e02f47cdb0be44a229e261e932221575381269    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 16:31:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 16:31:44 -0400    

Click here for diff

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

Doc: warn that timezone abbreviations don't work in recovery_target_time.

commit   : bb20f2c80d81377b036b1a673261ca842282ee10    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 May 2020 16:06:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 May 2020 16:06:49 -0400    

Click here for diff

Moving this setting into the main configuration file was ill-considered,  
perhaps, because that typically causes it to be set before  
timezone_abbreviations has been set.  Which in turn means that zone  
abbreviations don't work, only full zone names.  
  
We could imagine hacking things so that such cases do work, but the  
stability of the hack would be questionable, and the value isn't really  
that high.  Instead just document that you should use a numeric zone  
offset or a full zone name.  
  
Per bug #16404 from Reijo Suhonen.  
Back-patch to v12 where this was changed.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

doc: PG 13 release note adjustments, Justin Pryzby v2

commit   : 98c017c5760c1107a846c85eb20a1b3b80cad8c7    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 14:40:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 14:40:27 -0400    

Click here for diff

Reported-by: Justin Pryzby  

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

doc: PG 13 retnote adjustments

commit   : ab3f2f45d28235ee60ac2426f2282f401a0b0c12    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 13:18:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 13:18:05 -0400    

Click here for diff

Reported-by: Justin Pryzby  

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

Fix severe memory leaks in GSSAPI encryption support.

commit   : 46da7bf671c002659d48dad72d325167db8df84b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 May 2020 13:10:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 May 2020 13:10:09 -0400    

Click here for diff

Both the backend and libpq leaked buffers containing encrypted data  
to be transmitted, so that the process size would grow roughly as  
the total amount of data sent.  
  
There were also far-less-critical leaks of the same sort in GSSAPI  
session establishment.  
  
Oversight in commit b0b39f72b, which I failed to notice while  
reviewing the code in 2c0cdc818.  
  
Per complaint from pmc@citylink.  
Back-patch to v12 where this code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: normalize contributor names in PG 13 release notes

commit   : d4329a60d5708382957e61d1036a03929f75c9fc    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 12:42:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 12:42:55 -0400    

Click here for diff

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

doc: update PG 13 release notes for glossary and NO DEPENDS

commit   : 61dfa727494ffa337cadde51a01d3a1813c1f6d2    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 11:42:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 11:42:28 -0400    

Click here for diff

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

doc: Fix PG 13 release note markup

commit   : 3114d26bfb93962e503df19210086abe67f2044e    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 10:33:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 10:33:50 -0400    

Click here for diff

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

doc: update PG 13 release notes after first draft

commit   : 41297fa7d86d0410efc90aebdd39f686b81bf09e    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 10:32:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 May 2020 10:32:50 -0400    

Click here for diff

Minor corrections from individuals.  

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

Fix capitalization of messages, per style guide

commit   : d5627f3cd0ba191f1e647d66f6d5bb09ff95b786    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 May 2020 08:49:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 May 2020 08:49:52 +0200    

Click here for diff

M src/interfaces/libpq/fe-auth.c
M src/test/ssl/t/002_scram.pl

Doc: Outline REPLICATION before SUPERUSER privilege

commit   : c5114e42fa1ddd2c44a03339ffa436e732477397    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 May 2020 14:16:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 May 2020 14:16:01 +0900    

Click here for diff

The following docs are updated:  
- High-availaility section  
- pg_basebackup  
- pg_receivewal  
  
Per the principle of least privilege, we want to encourage users to  
interact with those areas using roles that have replication rights, but  
superusers were mentioned first.  
  
Author: Daniel Gustafsson  
Reviewed-by: Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_receivewal.sgml

doc: first draft of PG 13 release notes

commit   : 849ac3581329bdcbcfdba4452fa9c1ec6e10c24c    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 4 May 2020 23:09:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 4 May 2020 23:09:45 -0400    

Click here for diff

This still needs markup, indenting, and word wrap.  

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

Change the display of WAL usage statistics in Explain.

commit   : 69bfaf2e1de49de76d7dec1c45511932a5ef502b    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 5 May 2020 08:00:53 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 5 May 2020 08:00:53 +0530    

Click here for diff

In commit 33e05f89c5, we have added the option to display WAL usage  
statistics in Explain and auto_explain.  The display format used two spaces  
between each field which is inconsistent with Buffer usage statistics which  
is using one space between each field.  Change the format to make WAL usage  
statistics consistent with Buffer usage statistics.  
  
This commit also changed the usage of "full page writes" to  
"full page images" for WAL usage statistics to make it consistent with  
other parts of code and docs.  
  
Author: Julien Rouhaud, Amit Kapila  
Reviewed-by: Justin Pryzby, Kyotaro Horiguchi and Amit Kapila  
Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements–1.7–1.8.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/ref/explain.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/include/access/xlog.h
M src/include/executor/instrument.h

Doc: improve PDF presentation of some tables by adjusting column widths.

commit   : 5545b69ae65f27ba1f4ceaf24486e98c186e9412    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 May 2020 16:16:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 May 2020 16:16:42 -0400    

Click here for diff

The PDF toolchain defaults to laying out all columns of a table with  
equal widths, in contrast to the HTML rendering which automatically  
varies the column widths to fit the data.  In many places, this  
results in very badly laid-out tables, with lots of useless whitespace  
in some places and text that overruns its cell in other places.  
  
For tables that have reasonably static content, we can improve  
matters by adding <colspec> entries to hand-assign the column widths.  
This commit does that for a few of the tables that were worst off;  
it eliminates close to 200 "contents ... exceed the available area"  
warnings in an A4 PDF build.  
  
I also forced align="left" in these tables, overriding the PDF  
toolchain's default which is evidently "justify".  (The HTML toolchain  
seems to default to that already.)  Anyplace where things are tight  
enough that we need to worry about this, forced justification tends to  
look truly awful.  

M doc/src/sgml/charset.sgml
M doc/src/sgml/errcodes.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/generate-keywords-table.pl

Add posting list tuple amcheck test case.

commit   : 20c6905dee43a8888090674cb3db9f953ae7f646    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 4 May 2020 11:23:44 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 4 May 2020 11:23:44 -0700    

Click here for diff

Add a test case to contrib/amcheck that creates coverage of code paths  
that are used to verify posting list tuples (tuples created when  
deduplication merges together existing tuples to avoid a leaf page  
split).  

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

Doc: standardize markup a bit more.

commit   : 47046763c3ed1f16b81a389df7e44be5f3dba83c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 May 2020 13:48:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 May 2020 13:48:30 -0400    

Click here for diff

We had a mishmash of <replaceable>, <replaceable class="parameter">,  
and <parameter> markup for operator/function arguments.  Use <parameter>  
consistently for things that are in fact names of parameters (including  
OUT parameters), reserving <replaceable> for things that aren't.  The  
latter class includes some made-up-by-the-docs type class names, like  
"numeric_type", as well as placeholders for arguments that don't have  
well-defined types.  Possibly we could do better with those categories  
as well, but for the moment I'm content not to have parameter names  
marked up in different ways in different places.  
  
(This commit aligns the earlier sections of chapter 9 with a policy  
that I'd arrived at while working on commit 1ad23335f, which is why  
the last few sections need no changes.)  

M doc/src/sgml/func.sgml

Doc: update sections 9.22 - 9.30 for new function table layout.

commit   : 1ad23335f36b07f4574906a8dc66a3d62af7c40c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 May 2020 12:18:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 May 2020 12:18:06 -0400    

Click here for diff

With the usual quota of minor and less-minor editorial changes.  

M doc/src/sgml/func.sgml

Fix typo in comment

commit   : 9f87ae38eaffcc7f72c45bfeb79e09dd6e8c2f48    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 3 May 2020 12:19:31 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 3 May 2020 12:19:31 +0300    

Click here for diff

Reported-by: Oleg Bartunov  

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

Add missing newlines in error messages

commit   : 7dd777938bbeae8113f73849920a5b19bef723d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 3 May 2020 10:45:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 3 May 2020 10:45:52 +0200    

Click here for diff

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

Refactor btvacuumpage().

commit   : 9dc72514179d85e81ea594130ff0eb655188f225    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 2 May 2020 14:04:33 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 2 May 2020 14:04:33 -0700    

Click here for diff

Remove one of the arguments to btvacuumpage(), and give up on the idea  
that it's a recursive function.  We now use the term "backtracking" to  
refer to the case where an earlier block must be visited to make sure no  
tuples that need to be removed were missed.  
  
Advertising btvacuumpage() as a recursive function was unhelpful.  In  
reality the function always simulates recursion with a loop (it doesn't  
actually call itself).  This wasn't just necessary as a precaution (per  
the comments mentioning tail recursion), though.  There is no reliable  
natural limit on the number of times we can backtrack.  
  
There are important behavioral difference when "recursing"/backtracking,  
mostly related to page deletion.  We don't perform page deletion when  
backtracking due to the extra complexity.  And when we recurse, we're  
not performing a physical order scan anymore, so we expect fairly  
different conditions to hold for the page.  Structuring the code like  
this makes it clearer how _bt_pagedel() cooperates with btvacuumpage()  
and btvacuumscan() (as established in commit b0229f26 and commit  
73a076b0).  
  
Author: Peter Geoghegan  
Reviewed-By: Masahiko Sawada  
Discussion: https://postgr.es/m/CAH2-WzmRGMDWiLMcb+zagG9652PboNN4Gfcq1Gc_wJL6A716MA@mail.gmail.com  

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

Fix GSS client to non-GSS server connection

commit   : b68a560f8ebfc7eed679d09facdce5512a38c9c2    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 2 May 2020 11:39:26 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 2 May 2020 11:39:26 -0400    

Click here for diff

If the client is compiled with GSSAPI support and tries to start up GSS  
with the server, but the server is not compiled with GSSAPI support, we  
would mistakenly end up falling through to call ProcessStartupPacket  
with secure_done = true, but the client might then try to perform SSL,  
which the backend wouldn't understand and we'd end up failing the  
connection with:  
  
FATAL:  unsupported frontend protocol 1234.5679: server supports 2.0 to 3.0  
  
Fix by arranging to track ssl_done independently from gss_done, instead  
of trying to use the same boolean for both.  
  
Author: Andrew Gierth  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where GSSAPI encryption was added.  

M src/backend/postmaster/postmaster.c

Remove superfluous memset from pgstat_recv_resetslrucounter

commit   : d5d09692ea6b96944d24c44db1451f085b64ba09    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 2 May 2020 15:30:10 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 2 May 2020 15:30:10 +0200    

Click here for diff

The extra memset meant pg_stat_reset_slru() always reset all the entries  
even when reset of a single entry was requested, but the timestamp was  
left uninitialized.  
  
Reported-by: Atsushi Torikoshi  
Discussion: https://postgr.es/m/CACZ0uYFe16pjZxQYaTn53mspyM7dgMPYL3DJLjjPw69GMCC2Ow%40mail.gmail.com  

M src/backend/postmaster/pgstat.c

Remove pg_xact from pg_stat_reset_slru docs

commit   : e685ca63ca4f5d6c9c27499d94fc71d2065b55d9    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 2 May 2020 15:26:47 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 2 May 2020 15:26:47 +0200    

Click here for diff

This should have been included in 2e08d314ed.  
  
Reported-by: Fujii Masao  
Discussion: https://postgr.es/m/20200119143707.gyinppnigokesjok@development  

M doc/src/sgml/monitoring.sgml

Add NLS to pg_verifybackup

commit   : 747134838870b842c5aae673065da7227517e5b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 2 May 2020 10:33:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 2 May 2020 10:33:10 +0200    

Click here for diff

A src/bin/pg_verifybackup/nls.mk
M src/bin/pg_verifybackup/parse_manifest.h
M src/bin/pg_verifybackup/pg_verifybackup.c

Simplify cost_incremental_sort a bit

commit   : 60fbb4d762506c352c1af1229288a0753742cd95    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 2 May 2020 01:25:00 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 2 May 2020 01:25:00 +0200    

Click here for diff

Commit de0dc1a847 added code to cost_incremental_sort to handle varno 0.  
Explicitly removing the RelabelType is not really necessary, because the  
pull_varnos handles that just fine, which simplifies the code a bit.  
  
Author: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs4_3_D2J5XxOuw68hvn0-gJsw9FXNSGcZka9aTymn9UJ8A%40mail.gmail.com  
Discussion: https://postgr.es/m/20200411214639.GK2228%40telsasoft.com  

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

Remove pg_xact entry from SLRU stats

commit   : 2e08d314ed07363636a5da65f2a3abf7135f8ba8    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 2 May 2020 00:36:25 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 2 May 2020 00:36:25 +0200    

Click here for diff

The "pg_xact" entry was duplicate with "clog" and was added by mistake.  
  
Reported-by: Fujii Masao  
Discussion: https://postgr.es/m/20200119143707.gyinppnigokesjok@development  

M src/backend/postmaster/pgstat.c

Get rid of trailing semicolons in C macro definitions.

commit   : 0da06d9faf9e865c7d16a358a30ebe1a0014a709    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 May 2020 17:28:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 May 2020 17:28:00 -0400    

Click here for diff

Writing a trailing semicolon in a macro is almost never the right thing,  
because you almost always want to write a semicolon after each macro  
call instead.  (Even if there was some reason to prefer not to, pgindent  
would probably make a hash of code formatted that way; so within PG the  
rule should basically be "don't do it".)  Thus, if we have a semi inside  
the macro, the compiler sees "something;;".  Much of the time the extra  
empty statement is harmless, but it could lead to mysterious syntax  
errors at call sites.  In perhaps an overabundance of neatnik-ism, let's  
run around and get rid of the excess semicolons whereever possible.  
  
The only thing worse than a mysterious syntax error is a mysterious  
syntax error that only happens in the back branches; therefore,  
backpatch these changes where relevant, which is most of them because  
most of these mistakes are old.  (The lack of reported problems shows  
that this is largely a hypothetical issue, but still, it could bite  
us in some future patch.)  
  
John Naylor and Tom Lane  
  
Discussion: https://postgr.es/m/CACPNZCs0qWTqJ2QUSGJ07B7uvAvzMb-KbG2q+oo+J3tsWN5cqw@mail.gmail.com  

M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.h
M contrib/pg_trgm/trgm.h
M contrib/pgcrypto/crypt-blowfish.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/sort/gen_qsort_tuple.pl
M src/bin/pg_dump/pg_backup_archiver.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/port/qsort.c
M src/port/qsort_arg.c

Doc: update sections 9.17 - 9.21 for new function table layout.

commit   : d66935448f41b1e0af11a939b6c5aaa9a619524a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 May 2020 16:16:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 May 2020 16:16:28 -0400    

Click here for diff

With the usual quota of minor editorial changes.  

M doc/src/sgml/func.sgml

Clear up issue with FSM and oldest bpto.xact.

commit   : 69cf853fe798c6d590db892d80677e45609e3395    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 1 May 2020 12:19:44 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 1 May 2020 12:19:44 -0700    

Click here for diff

On further reflection, code comments added by commit b0229f26 slightly  
misrepresented how we determine the oldest bpto.xact for the index.  
btvacuumpage() does not treat the bpto.xact of a page that it put in the  
FSM as a candidate to be the oldest deleted page (the delete-marked page  
that has the oldest bpto.xact XID among all pages encountered).  
  
The definition of a deleted page for the purposes of the bpto.xact  
calculation is different from the definition used by the bulk delete  
statistics.  The bulk delete statistics don't distinguish between pages  
that were deleted by the current VACUUM, pages deleted by a previous  
VACUUM operation but not yet recyclable/reusable, and pages that are  
reusable (though reusable pages are counted separately).  
  
Backpatch: 11-, just like commit b0229f26.  

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

Reorder function prototypes for consistency.

commit   : 4e21f8b63354323897fa2ab778bfe003c44df75b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 1 May 2020 10:03:38 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 1 May 2020 10:03:38 -0700    

Click here for diff

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

Fix undercounting in VACUUM VERBOSE output.

commit   : 73a076b03f1cf0761329ace55ec3601d47f04075    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 1 May 2020 09:51:09 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 1 May 2020 09:51:09 -0700    

Click here for diff

The logic for determining how many nbtree pages in an index are deleted  
pages sometimes undercounted pages.  Pages that were deleted by the  
current VACUUM operation (as opposed to some previous VACUUM operation  
whose deleted pages have yet to be reused) were sometimes overlooked.  
The final count is exposed to users through VACUUM VERBOSE's "%u index  
pages have been deleted" output.  
  
btvacuumpage() avoided double-counting when _bt_pagedel() deleted more  
than one page by assuming that only one page was deleted, and that the  
additional deleted pages would get picked up during a future call to  
btvacuumpage() by the same VACUUM operation.  _bt_pagedel() can  
legitimately delete pages that the btvacuumscan() scan will not visit  
again, though, so that assumption was slightly faulty.  
  
Fix the accounting by teaching _bt_pagedel() about its caller's  
requirements.  It now only reports on pages that it knows btvacuumscan()  
won't visit again (including the current btvacuumpage() page), so  
everything works out in the end.  
  
This bug has been around forever.  Only backpatch to v11, though, to  
keep _bt_pagedel() is sync on the branches that have today's bugfix  
commit b0229f26da.  Note that this commit changes the signature of  
_bt_pagedel(), just like commit b0229f26da.  
  
Author: Peter Geoghegan  
Reviewed-By: Masahiko Sawada  
Discussion: https://postgr.es/m/CAH2-WzkrXBcMQWAYUJMFTTvzx_r4q=pYSjDe07JnUXhe+OZnJA@mail.gmail.com  
Backpatch: 11-  

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

Fix bug in nbtree VACUUM "skip full scan" feature.

commit   : b0229f26da753688af586580707facc29616f97c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 1 May 2020 08:39:52 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 1 May 2020 08:39:52 -0700    

Click here for diff

Commit 857f9c36cda (which taught nbtree VACUUM to skip a scan of the  
index from btcleanup in situations where it doesn't seem worth it) made  
VACUUM maintain the oldest btpo.xact among all deleted pages for the  
index as a whole.  It failed to handle all the details surrounding pages  
that are deleted by the current VACUUM operation correctly (though pages  
deleted by some previous VACUUM operation were processed correctly).  
  
The most immediate problem was that the special area of the page was  
examined without a buffer pin at one point.  More fundamentally, the  
handling failed to account for the full range of _bt_pagedel()  
behaviors.  For example, _bt_pagedel() sometimes deletes internal pages  
in passing, as part of deleting an entire subtree with btvacuumpage()  
caller's page as the leaf level page.  The original leaf page passed to  
_bt_pagedel() might not be the page that it deletes first in cases where  
deletion can take place.  
  
It's unclear how disruptive this bug may have been, or what symptoms  
users might want to look out for.  The issue was spotted during  
unrelated code review.  
  
To fix, push down the logic for maintaining the oldest btpo.xact to  
_bt_pagedel().  btvacuumpage() is now responsible for pages that were  
fully deleted by a previous VACUUM operation, while _bt_pagedel() is now  
responsible for pages that were deleted by the current VACUUM operation  
(this includes half-dead pages from a previous interrupted VACUUM  
operation that become fully deleted in _bt_pagedel()).  Note that  
_bt_pagedel() should never encounter an existing deleted page.  
  
This commit theoretically breaks the ABI of a stable release by changing  
the signature of _bt_pagedel().  However, if any third party extension  
is actually affected by this, then it must already be completely broken  
(since there are numerous assumptions made in _bt_pagedel() that cannot  
be met outside of VACUUM).  It seems highly unlikely that such an  
extension actually exists, in any case.  
  
Author: Peter Geoghegan  
Reviewed-By: Masahiko Sawada  
Discussion: https://postgr.es/m/CAH2-WzkrXBcMQWAYUJMFTTvzx_r4q=pYSjDe07JnUXhe+OZnJA@mail.gmail.com  
Backpatch: 11-, where the "skip full scan" feature was introduced.  

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

Put new command-line options into alphabetical order in help output

commit   : 3c800ae0b931c85f6ae949bc468fa3e51f9d5716    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 May 2020 11:49:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 May 2020 11:49:52 +0200    

Click here for diff

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pgbench/pgbench.c
M src/bin/scripts/dropdb.c

Improve various aspects of pg_rewind documentation

commit   : 78bad97faa160c292ea91a0ea8f081907903ee79    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 May 2020 17:40:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 May 2020 17:40:41 +0900    

Click here for diff

The pg_rewind docs currently assert that the state of the target's  
data directory after rewind is equivalent to the source's data  
directory.  This clarifies the documentation to describe that the base  
state is further back in time and that the target's data directory will  
include the current state from the source of any copied blocks since the  
point of divergence.  
  
This commit also improves the section "How It Works":  
- Describe the update of the pg_control file.  
- Reorganize the list of files and directories ignored during the  
rewind.  
  
Author: James Coleman  
Discussion: https://postgr.es/m/CAAaqYe-sgqCos7MXF4XiY8rUPy3CEmaCY9EvfhX-DhPhPBF5_A@mail.gmail.com  

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

Add nbtree ScalarArrayOpExpr tests.

commit   : d9c501da70b079a7138f8b339339169d5bd24143    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 30 Apr 2020 14:33:13 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 30 Apr 2020 14:33:13 -0700    

Click here for diff

Add test coverage for the nbtutils.c routines concerned with IndexScans  
that have native ScalarArrayOpExpr quals.  The ScalarArrayOpExpr  
specialized mark and restore routines, and the "find extreme element"  
routine now have some test coverage.  
  
These functions are probably infrequently exercised by real world  
queries, so having some coverage seems like a good idea.  The mark and  
restore routines were originally added by a bugfix that came several  
weeks after the first stable release of Postgres 9.2 (see commit  
70bc5833195).  

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

Fix AddressSanitizer use-after-scope complaint.

commit   : dd1f645cc8831f55591e466c56b3953b9d100993    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 30 Apr 2020 12:31:56 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 30 Apr 2020 12:31:56 -0700    

Click here for diff

XLogRegisterBufData() does not copy data pointed to by caller's pointer  
argument.  
  
Oversight in commit 0d861bbb702.  
  
Author: Peter Eisentraut  
Reported-By: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: update sections 9.14 - 9.16 for new function table layout.

commit   : 30e82f1bc9888d7f84bdcad33f460dd8db752b08    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Apr 2020 12:53:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Apr 2020 12:53:44 -0400    

Click here for diff

Minor editorial changes in the first two sections; larger ones  
in the JSON section.  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

Make SQL/JSON error code names match SQL standard

commit   : eb892102e01a2073df9250d65e33ec1ed21798df    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Apr 2020 09:34:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Apr 2020 09:34:54 +0200    

Click here for diff

see also a00c53b0cb  

M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/errcodes.txt

Update config.guess and config.sub

commit   : 7462c1d78cd8bc1cfca352cef0e3e234b9d3b62b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Apr 2020 09:06:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Apr 2020 09:06:49 +0200    

Click here for diff

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

Rename connection parameters to control min/max SSL protocol version in libpq

commit   : 401aad67045b2d467571b54abe229fdd115a228c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 30 Apr 2020 13:39:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 30 Apr 2020 13:39:10 +0900    

Click here for diff

The libpq parameters ssl{max|min}protocolversion are renamed to use  
underscores, to become ssl_{max|min}_protocol_version.  The related  
environment variables still use the names introduced in commit ff8ca5f  
that added the feature.  
  
Per complaint from Peter Eisentraut (this was also mentioned by me in  
the original patch review but the issue got discarded).  
  
Author: Daniel Gustafsson  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/t/001_ssltests.pl

Doc: re-re-revise markup for tables of functions.

commit   : 4ad047a6eac356436b88681a9383a52cde2ffe9c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Apr 2020 00:34:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Apr 2020 00:34:05 -0400    

Click here for diff

Make the markup a bit less ad-hoc.  A function-table cell now contains  
several <para> units, and we label the ones that contain function  
signatures with role="func_signature".  The CSS or FO stylesheets then  
key off of that to decide how to set the indentation.  A very useful  
win from this approach is that we can have more than one signature  
entry per table cell, simplifying the documentation of closely-related  
operators and functions.  
  
This patch mostly just replaces the markup in the tables I converted so  
far.  But I did alter a couple of places where multiple signatures were  
helpful.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/stylesheet-common.xsl
M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/stylesheet.css

Remove redundant _bt_killitems() buffer check.

commit   : ab2343d4cb806c43e8a7269d38b3bdddea185213    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 29 Apr 2020 18:17:49 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 29 Apr 2020 18:17:49 -0700    

Click here for diff

_bt_getbuf() cannot return an invalid buffer.  
  
Oversight in commit 2ed5b87f96d.  

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

Fix check for conflicting SSL min/max protocol settings

commit   : e30b0b5cfaeb4f1f739f82c34c5ae2773852a088    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 30 Apr 2020 08:14:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 30 Apr 2020 08:14:02 +0900    

Click here for diff

Commit 79dfa8a has introduced a check to catch when the minimum protocol  
version was set higher than the maximum version, however an error was  
getting generated when both bounds are set even if they are able to  
work, causing a backend to not use a new SSL context but keep the old  
one.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

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

Fix checkpoint signalling

commit   : 1816a1c6ffe46782eee9a16a974b4aa3f4b8457b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 29 Apr 2020 18:46:42 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 29 Apr 2020 18:46:42 -0400    

Click here for diff

Checkpointer uses its MyLatch to wake up when a checkpoint request is  
received.  But before commit c6550776394e the latch was not used for  
anything else, so the code could just go to sleep after each loop  
without rechecking the sleeping condition.  That commit added a separate  
ResetLatch in its code path[1], which can cause a checkpoint to go  
unnoticed for potentially a long time.  
  
Fix by skipping sleep if any checkpoint flags are set.  Also add a test  
to verify this; authored by Kyotaro Horiguchi.  
  
[1] CreateCheckPoint -> InvalidateObsoleteReplicationSlots ->  
ConditionVariableTimeSleep  
  
Report and diagnosis by Kyotaro Horiguchi.  
Co-authored-by: Kyotaro Horiguchi <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/checkpointer.c
M src/test/recovery/t/019_replslot_limit.pl

Fix typo

commit   : fef819ac534d6efb9608fa0bbb93c6fe6c87440e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Apr 2020 10:13:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Apr 2020 10:13:25 +0200    

Click here for diff

from 927474ce1a2  

M src/bin/pg_rewind/pg_rewind.c

Check slot->restart_lsn validity in a few more places

commit   : d0abe78d84274cc203f3d117b8006dc2164ca31a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 28 Apr 2020 20:39:04 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 28 Apr 2020 20:39:04 -0400    

Click here for diff

Lack of these checks could cause visible misbehavior, including  
assertion failures.  This was missed in commit c6550776394e, whereby  
restart_lsn becomes invalid when the size limit is exceeded.  
  
Also reword some existing error messages, and add errdetail(), so that  
the reported errors all match in spirit.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/slot.out
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c

Add LP_DEAD deletion of a posting list tuple test.

commit   : 52b164c5a00095a34685e66bf64b009578b9cfda    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 28 Apr 2020 16:12:56 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 28 Apr 2020 16:12:56 -0700    

Click here for diff

Make sure that we have test coverage of the posting list tuple path  
within _bt_xid_horizon().  
  
Per off-list complaint from Andres Freund.  

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

Add missing gettext triggers

commit   : 6baa17fbd1a76cd4056168fa718b7e7fd65748ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Apr 2020 13:35:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Apr 2020 13:35:40 +0200    

Click here for diff

Some translatable strings have been moved to scanner_yyerror(), so we  
need to add that, too.  

M src/backend/nls.mk

Fix definition of pg_statio_all_tables view

commit   : ef11051bbe96ea2d06583e4b3b9daaa02657dd42    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 28 Apr 2020 11:07:56 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 28 Apr 2020 11:07:56 +0300    

Click here for diff

pg_statio_all_tables view appears to have a wrong grouping.  As the result  
numbers of toast index blocks read and hit were multiplied to the number of  
table indexes.  This commit fixes the view definition.  
  
Backpatching this appears difficult.  We don't have a mechanism to patch a  
system catalog of existing instances in minor upgrade.  We can write a  
release notes instruction to do this manually.  But per discussion this is  
probably not so critical bug for doing such an intrusive fix.  
  
Reported-by: Andrei Zubkov  
Discussion: https://postgr.es/m/CAPpHfdtMYkkNudLMG9G0dxX_B%3Dn5sfKzOyxxrvWYtSicaGW0Lw%40mail.gmail.com  

M src/backend/catalog/system_views.sql
M src/test/regress/expected/rules.out

Add more TAP coverage for archive status with crash recovery of standbys

commit   : ebf6de8692766177a36e7f5fb7545a52a0d5d881    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Apr 2020 07:55:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Apr 2020 07:55:51 +0900    

Click here for diff

This part of the test was included originally in 4e87c48, but got  
reverted as of f9c1b8d because of timing issues in the test, where,  
after more analysis, we found that the standbys may not have recovered  
from the archives all the segments needed by the test.  This stabilizes  
the test by making sure that standbys replay up to the position returned  
by pg_switch_wal(), meaning that all segments are recovered before the  
manual checkpoint that tests WAL segment recycling and its interactions  
with archive status files.  
  
Author: Jehan-Guillaume de Rorthais  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/020_archive_status.pl

Fix bogus tar-file padding logic for standby.signal.

commit   : 0278d3f79a30cd9ccd6646b8447b25c60ae7d01d    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Apr 2020 13:04:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Apr 2020 13:04:35 -0400    

Click here for diff

When pg_basebackup -R is used, we inject standby.signal into the  
tar file for the main tablespace. The proper thing to do is to pad  
each file injected into the tar file out to a 512-byte boundary  
by appending nulls, but here the file is of length 0 and we add  
511 zero bytes.  Since 0 is already a multiple of 512, we should  
not add any zero bytes. Do that instead.  
  
Patch by me, reviewed by Tom Lane.  
  
Discussion: http://postgr.es/m/CA+TgmobWbfReO9-XFk8urR1K4wTNwqoHx_v56t7=T8KaiEoKNw@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Fix full text search to handle NOT above a phrase search correctly.

commit   : e81e5741a6c5d2000b70ea4d5aeceb7669fbccbf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Apr 2020 12:21:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Apr 2020 12:21:04 -0400    

Click here for diff

Queries such as '!(foo<->bar)' failed to find matching rows when  
implemented as a GiST or GIN index search.  That's because of  
failing to handle phrase searches as tri-valued when considering  
a query without any position information for the target tsvector.  
We can only say that the phrase operator might match, not that it  
does match; and therefore its NOT also might match.  The previous  
coding incorrectly inverted the approximate phrase result to  
decide that there was certainly no match.  
  
To fix, we need to make TS_phrase_execute return a real ternary result,  
and then bubble that up accurately in TS_execute.  As long as we have  
to do that anyway, we can simplify the baroque things TS_phrase_execute  
was doing internally to manage tri-valued searching with only a bool  
as explicit result.  
  
For now, I left the externally-visible result of TS_execute as a plain  
bool.  There do not appear to be any outside callers that need to  
distinguish a three-way result, given that they passed in a flag  
saying what to do in the absence of position data.  This might need  
to change someday, but we wouldn't want to back-patch such a change.  
  
Although tsginidx.c has its own TS_execute_ternary implementation for  
use at upper index levels, that sadly managed to get this case wrong  
as well :-(.  Fixing it is a lot easier fortunately.  
  
Per bug #16388 from Charles Offenbacher.  Back-patch to 9.6 where  
phrase search was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsvector_op.c
M src/test/regress/data/tsearch.data
M src/test/regress/expected/tsearch.out
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tsearch.sql
M src/test/regress/sql/tstypes.sql

Doc: render &pi; more nicely in PDF output.

commit   : 5ac24755485a5c1cc1cef084f08706246ee4f66c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Apr 2020 11:00:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Apr 2020 11:00:28 -0400    

Click here for diff

We need to select symbol font explicitly, or it comes out misaligned.  
  
Alexander Lakhin, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/stylesheet-fo.xsl

pg_dump: Replace can't-happen error with assertion

commit   : d51f704fd8cbae03cd9b29fe103dd027d521ff04    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Apr 2020 14:24:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Apr 2020 14:24:20 +0200    

Click here for diff

M src/bin/pg_dump/pg_backup_tar.c

Fix some typos

commit   : 641b76d9d12fd728f71f61e8a2b2bb2bedab021b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Apr 2020 14:59:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Apr 2020 14:59:36 +0900    

Click here for diff

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

M src/backend/access/transam/multixact.c
M src/backend/partitioning/partbounds.c

Doc: improve documentation of websearch_to_tqsuery().

commit   : 459f4076c87ac953aa0efa7ddf84df08f8fafe7c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Apr 2020 11:45:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Apr 2020 11:45:54 -0400    

Click here for diff

It wasn't totally clear about punctuation other than what's  
specified being ignored.  
  
Pavel Borisov and Tom Lane  
  
Discussion: https://postgr.es/m/CALT9ZEFsBdsogVjG40Z4KfM1Um=wj1FE9hJ00GK3oVfzz0sFNg@mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/textsearch.sgml

Fix typo

commit   : f057980149ddccd4b862d2c6b3920ed498b0d7ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 Apr 2020 13:48:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 Apr 2020 13:48:33 +0200    

Click here for diff

from 303640199d0  

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

Raise a timeout to 180s, in test 003_recovery_targets.pl.

commit   : 896135512ef67cc084f5e058cfa9b4954ca26861    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 25 Apr 2020 18:45:27 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 25 Apr 2020 18:45:27 -0700    

Click here for diff

Buildfarm member chipmunk has failed twice due to taking >30s, and  
twenty-four runs of other members have used >5s.  The test is new in  
v13, so no back-patch.  

M src/test/recovery/t/003_recovery_targets.pl

Fix another minor page deletion buffer lock issue.

commit   : 7154aa16a64dd4afc2cbf02e7ce86dc6711a1087    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 25 Apr 2020 16:45:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 25 Apr 2020 16:45:20 -0700    

Click here for diff

Avoid accessing the leaf page's top parent tuple without a buffer lock  
held during the second phase of nbtree page deletion.  The old approach  
was safe, though only because VACUUM never drops its buffer pin (and  
because only VACUUM itself can modify a half-dead page).  Even still, it  
seems like a good idea to be strict here.  Tighten things up by copying  
the top parent page's block number to a local variable before releasing  
the buffer lock on the leaf page -- not after.  
  
This is a follow-up to commit fa7ff642, which fixed a similar issue in  
the first phase of nbtree page deletion.  
  
Update some related comments in passing.  
  
Discussion: https://postgr.es/m/CAH2-WzkLgyN3zBvRZ1pkNJThC=xi_0gpWRUb_45eexLH1+k2_Q@mail.gmail.com  

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

Fix minor nbtree page deletion buffer lock issue.

commit   : fa7ff642c22ceccad869af5add00c2661d4d091e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 25 Apr 2020 14:17:02 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 25 Apr 2020 14:17:02 -0700    

Click here for diff

Avoid accessing the deletion target page's special area during nbtree  
page deletion at a point where there is no buffer lock held.  This issue  
was detected by a patch that extends Valgrind's memcheck tool to mark  
nbtree pages that are unsafe to access (due to not having a buffer lock  
or buffer pin) as NOACCESS.  
  
We do hold a buffer pin at this point, and only access the special area,  
so the old approach was safe.  Even still, it seems like a good idea to  
tighten up the rules in this area.  There is no reason to not simply  
insist on always holding a buffer lock (not just a pin) when accessing  
nbtree pages.  
  
Update some related comments in passing.  
  
Discussion: https://postgr.es/m/CAH2-WzkLgyN3zBvRZ1pkNJThC=xi_0gpWRUb_45eexLH1+k2_Q@mail.gmail.com  

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

In caught-up logical walsender, sleep only in WalSndWaitForWal().

commit   : f246ea3b2a5e0b75e44f0f18157c4b5e10b5547f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 25 Apr 2020 10:18:12 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 25 Apr 2020 10:18:12 -0700    

Click here for diff

Before sleeping, WalSndWaitForWal() sends a keepalive if MyWalSnd->write  
< sentPtr.  When the latest physical LSN yields no logical replication  
messages (a common case), that keepalive elicits a reply.  Processing  
the reply updates pg_stat_replication.replay_lsn.  WalSndLoop() lacks  
that; when WalSndLoop() slept, replay_lsn advancement could stall until  
wal_receiver_status_interval elapsed.  This sometimes stalled  
src/test/subscription/t/001_rep_changes.pl for up to 10s.  
  
Reviewed by Fujii Masao and Michael Paquier.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Revert "When WalSndCaughtUp, sleep only in WalSndWaitForWal()."

commit   : 72a3dc321d76c93842d502793f93b9dc2d2305b2    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 25 Apr 2020 10:17:26 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 25 Apr 2020 10:17:26 -0700    

Click here for diff

This reverts commit 421685812290406daea58b78dfab0346eb683bbb.  It caused  
idle physical walsenders to busy-wait, as reported by Fujii Masao.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Fix error case for CREATE ROLE ... IN ROLE.

commit   : d9a4cce29d563e4e6f6eec8b807736d98b1ad553    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 25 Apr 2020 05:09:30 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 25 Apr 2020 05:09:30 +0100    

Click here for diff

CreateRole() was passing a Value node, not a RoleSpec node, for the  
newly-created role name when adding the role as a member of existing  
roles for the IN ROLE syntax.  
  
This mistake went unnoticed because the node in question is used only  
for error messages and is not accessed on non-error paths.  
  
In older pg versions (such as 9.5 where this was found), this results  
in an "unexpected node type" error in place of the real error. That  
node type check was removed at some point, after which the code would  
accidentally fail to fail on 64-bit platforms (on which accessing the  
Value node as if it were a RoleSpec would be mostly harmless) or give  
an "unexpected role type" error on 32-bit platforms.  
  
Fix the code to pass the correct node type, and add an lfirst_node  
assertion just in case.  
  
Per report on irc from user m1chelangelo.  
  
Backpatch all the way, because this error has been around for a long  
time.  

M src/backend/commands/user.c

Update Windows timezone name list to include currently-known zones.

commit   : 6c5f9161682697418156b6391038318d130fe6e4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 17:53:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 17:53:23 -0400    

Click here for diff

Thanks to Juan José Santamaría Flecha.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/findtimezone.c
M src/tools/win32tzlist.pl

Improve placement of "display name" comment in win32_tzmap[] entries.

commit   : bd8c5cee961af86e65b873e9debba13cfcb3cb89    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 17:21:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 17:21:44 -0400    

Click here for diff

Sticking this comment at the end of the last line was a bad idea: it's  
not particularly readable, and it tempts pgindent to mess with line  
breaks within the comment, which in turn reveals that win32tzlist.pl's  
clean_displayname() does the wrong thing to clean up such line breaks.  
While that's not hard to fix, there's basically no excuse for this  
arrangement to begin with, especially since it makes the table layout  
needlessly vary across back branches with different pgindent rules.  
Let's just put the comment inside the braces, instead.  
  
This commit just moves and reformats the comments, and updates  
win32tzlist.pl to match; there's no actual data change.  
  
Per odd-looking results from Juan José Santamaría Flecha.  
Back-patch, since the point is to make win32_tzmap[] look the  
same in all supported branches again.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/findtimezone.c
M src/tools/win32tzlist.pl

Doc: update section 9.13 for new function table layout.

commit   : f8d3e2ab27d22c1f032b0541fd7650e02e8907f7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 15:51:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 15:51:35 -0400    

Click here for diff

This includes the usual amount of editorial cleanup, such as  
correcting wrong or less-helpful-than-they-could-be examples.  
  
I moved the two tsvector-updating triggers into "9.28 Trigger  
Functions", which seems like a better home for them.  (I believe  
that section didn't exist when this text was originally written.)  

M doc/src/sgml/func.sgml
M doc/src/sgml/textsearch.sgml

git_changelog: use modern format for rel branch names in example

commit   : 395a9a124877d3c41328fcfebcf0c68df86d9bfd    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 24 Apr 2020 15:16:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 24 Apr 2020 15:16:04 -0400    

Click here for diff

e.g., REL_12_STABLE  

M src/tools/git_changelog

Try to avoid compiler warnings in optimized builds.

commit   : 05021a2c0cd212dbe9d7883e2d1677ba739653d5    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Apr 2020 14:08:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Apr 2020 14:08:29 -0400    

Click here for diff

Per report from Andres Freund, who also says that this fix  
works for him.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_verifybackup/parse_manifest.h

Repair performance regression in information_schema.triggers view.

commit   : baf17ad9dff4552b7e494d3f574972c21d9f90bc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 12:02:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 12:02:36 -0400    

Click here for diff

Commit 32ff26911 introduced use of rank() into the triggers view to  
calculate the spec-mandated action_order column.  As written, this  
prevents query constraints on the table-name column from being pushed  
below the window aggregate step.  That's bad for performance of this  
typical usage pattern, since the view now has to be evaluated for all  
tables not just the one(s) the user wants to see.  It's also the cause  
of some recent buildfarm failures, in which trying to evaluate the view  
rows for triggers in process of being dropped resulted in "cache lookup  
failed for function NNN" errors.  Those rows aren't of interest to the  
test script doing the query, but the filter that would eliminate them  
is being applied too late.  None of this happened before the rank()  
call was there, so it's a regression compared to v10 and before.  
  
We can improve matters by changing the rank() call so that instead of  
partitioning by OIDs, it partitions by nspname and relname, casting  
those to sql_identifier so that they match the respective view output  
columns exactly.  The planner has enough intelligence to know that  
constraints on partitioning columns are safe to push down, so this  
eliminates the performance problem and the regression test failure  
risk.  We could make the other partitioning columns match view outputs  
as well, but it'd be more complicated and the performance benefits  
are questionable.  
  
Side note: as this stands, the planner will push down constraints on  
event_object_table and trigger_schema, but not on event_object_schema,  
because it checks for ressortgroupref matches not expression  
equivalence.  That might be worth improving someday, but it's not  
necessary to fix the immediate concern.  
  
Back-patch to v11 where the rank() call was added.  Ordinarily we'd not  
change information_schema in released branches, but the test failure has  
been seen in v12 and presumably could happen in v11 as well, so we need  
to do this to keep the buildfarm happy.  The change is harmless so far  
as users are concerned.  Some might wish to apply it to existing  
installations if performance of this type of query is of concern,  
but those who don't are no worse off.  
  
I bumped catversion in HEAD as a pro forma matter (there's no  
catalog incompatibility that would really require a re-initdb).  
Obviously that can't be done in the back branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/information_schema.sql
M src/include/catalog/catversion.h

Update time zone data files to tzdata release 2020a.

commit   : 4cac3a49e691040ddb3f7776ea1f0d63383cbe15    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 10:54:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Apr 2020 10:54:47 -0400    

Click here for diff

DST law changes in Morocco and the Canadian Yukon.  
Historical corrections for Shanghai.  
  
The America/Godthab zone is renamed to America/Nuuk to reflect  
current English usage; however, the old name remains available as a  
compatibility link.  

M src/timezone/data/tzdata.zi

Update Unicode data to Unicode 13.0.0 and CLDR 37

commit   : 3a8961577677dd4e910ed239047ad6c02cb2591b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Apr 2020 09:33:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Apr 2020 09:33:22 +0200    

Click here for diff

M contrib/unaccent/unaccent.rules
M src/Makefile.global.in
M src/include/common/unicode_combining_table.h
M src/include/common/unicode_norm_table.h
M src/include/common/unicode_normprops_table.h

Remove some unstable parts from new TAP test for archive status check

commit   : f9c1b8dba4da4c17bc6b7c76dec476de6725660b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 Apr 2020 11:33:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 Apr 2020 11:33:41 +0900    

Click here for diff

The test is proving to have timing issues when looking at archive status  
files on standbys after crash recovery, while other parts of the test  
rely on pg_stat_archiver as a wait point to make sure that a given state  
of the archiving is reached.  The coverage is not heavily impacted by  
the removal those extra tests.  
  
Per reports from several buildfarm animals, like crake, piculet,  
culicidae and francolin.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/test/recovery/t/020_archive_status.pl

Fix handling of WAL segments ready to be archived during crash recovery

commit   : 4e87c4836ab9059cdec17b0a288db3622a42ac18    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 Apr 2020 08:48:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 Apr 2020 08:48:28 +0900    

Click here for diff

78ea8b5 has fixed an issue related to the recycling of WAL segments on  
standbys depending on archive_mode.  However, it has introduced a  
regression with the handling of WAL segments ready to be archived during  
crash recovery, causing those files to be recycled without getting  
archived.  
  
This commit fixes the regression by tracking in shared memory if a live  
cluster is either in crash recovery or archive recovery as the handling  
of WAL segments ready to be archived is different in both cases (those  
WAL segments should not be removed during crash recovery), and by using  
this new shared memory state to decide if a segment can be recycled or  
not.  Previously, it was not possible to know if a cluster was in crash  
recovery or archive recovery as the shared state was able to track only  
if recovery was happening or not, leading to the problem.  
  
A set of TAP tests is added to close the gap here, making sure that WAL  
segments ready to be archived are correctly handled when a cluster is in  
archive or crash recovery with archive_mode set to "on" or "always", for  
both standby and primary.  
  
Reported-by: Benoît Lobréau  
Author: Jehan-Guillaume de Rorthais  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/20200331172229.40ee00dc@firost  
Backpatch-through: 9.5  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/include/access/xlog.h
A src/test/recovery/t/020_archive_status.pl
M src/tools/pgindent/typedefs.list

Remove ACLDEBUG #define and associated code.

commit   : 3436c5e28374d4e0587634fda09faf4a38a9d848    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Apr 2020 15:38:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Apr 2020 15:38:04 -0400    

Click here for diff

In the footsteps of aaf069aa3, remove ACLDEBUG, which was the only  
other remaining undocumented symbol in pg_config_manual.h.  The fact  
that nobody had bothered to document it in seventeen years is a good  
clue to its usefulness.  In practice, none of the tracing logic it  
enabled would be of any value without additional effort.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/aclchk.c
M src/backend/utils/adt/acl.c
M src/include/pg_config_manual.h

Remove useless (and broken) logging logic in memory context functions.

commit   : ee88ef55dbacfca15ad425e849280669e3d6ee4d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Apr 2020 15:27:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Apr 2020 15:27:37 -0400    

Click here for diff

Nobody really uses this stuff, especially not since we created  
valgrind-based infrastructure that does the same thing better.  
It is thus unsurprising that the generation.c and slab.c versions  
were actually broken.  Rather than fix 'em, let's just remove 'em.  
  
Alexander Lakhin  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: update section 9.12 for new function table layout.

commit   : 5b0aa112a8f74e93d28c2dc002cfdaea5c40eeda    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Apr 2020 15:12:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Apr 2020 15:12:42 -0400    

Click here for diff

Also rearrange that page a bit for more consistency and less  
duplication.  
  
In passing, fix erroneous examples of the results of abbrev(cidr)  
in datatype.sgml, and do a bit of copy-editing there.  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml

Also rename 'struct manifest_info'.

commit   : ab7646ff92c799303b9ee70ce88b89e07dae717c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Apr 2020 09:47:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Apr 2020 09:47:50 -0400    

Click here for diff

The previous commit renamed the struct's typedef, but not the struct  
name itself.  

M src/include/replication/backup_manifest.h
M src/include/replication/basebackup.h

Rename exposed identifiers to say "backup manifest".

commit   : 3989dbdf1293ecc16991065a3d84857a945ea853    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 23 Apr 2020 08:44:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 23 Apr 2020 08:44:06 -0400    

Click here for diff

Function names declared "extern" now use BackupManifest in the name  
rather than just Manifest, and data types use backup_manifest  
rather than just manifest.  
  
Per note from Michael Paquier.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/replication/backup_manifest.c
M src/backend/replication/basebackup.c
M src/include/replication/backup_manifest.h

Fix transient memory leak for SRFs in FROM.

commit   : 299298bc873374ed49fa2f39944c09ac62bd75e3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 22 Apr 2020 19:52:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 22 Apr 2020 19:52:07 -0700    

Click here for diff

In a9c35cf85ca I changed ExecMakeTableFunctionResult() to dynamically  
allocate the FunctionCallInfo used to call the SRF. Unfortunately I  
did not account for the fact that the surrounding memory context has  
query lifetime, leading to a leak till the end of the query.  
  
In most cases the leak is fairly inconsequential, but if the  
FunctionScan is done many times in the query, the leak can add  
up. This happens e.g. if the function scan is on the inner side of a  
nested loop, due to a lateral join.  
EXPLAIN SELECT sum(f) FROM generate_series(1, 100000000) g(i), generate_series(i, i+1) f;  
quickly shows the leak.  
  
Instead of explicitly freeing the FunctionCallInfo it seems better to  
make sure all the per-set temporary state in  
ExecMakeTableFunctionResult() is cleaned up wholesale. Currently  
that's probably just the FunctionCallInfo allocation, but since  
there's some initialization work, and since there's already an  
appropriate context, this seems like a more robust approach.  
  
Bug: #16112  
Reported-By: Ben Cornett  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/16112-4448bbf55a404189%40postgresql.org  
Backpatch: 12, a9c35cf85ca  

M src/backend/executor/execSRF.c

commit   : 0a89e93bfaa6f2b0a37c19c92943207e3f600098    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 23 Apr 2020 11:32:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 23 Apr 2020 11:32:17 +0900    

Click here for diff

This commit does:  
  
- get rid of the garbage code for unused --print-parse-wal option.  
- add help message for --quiet option into usage().  
- fix typo of option name in help message.  
  
Author: Fujii Masao  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_verifybackup/pg_verifybackup.c

Doc: improve description of geometric multiplication/division.

commit   : 1cc34640cabcb32b4f062673cce1d6b1819d492d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Apr 2020 21:32:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Apr 2020 21:32:38 -0400    

Click here for diff

David Johnston reminded me that the per-point calculations being done  
by these operators are equivalent to complex multiplication/division.  
(Once I would've recognized that immediately, but it's been too long  
since I did any of that sort of math.)  
  
Also put in a footnote mentioning that "rotation" of a box doesn't do  
what you might expect, as I'd griped about in the referenced thread.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

nbtree: Rename BT_RESERVED_OFFSET_MASK.

commit   : 48107e396f75ea65192153707a8c476f66b59061    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 22 Apr 2020 16:09:55 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 22 Apr 2020 16:09:55 -0700    

Click here for diff

The mask was added by commit 8224de4f, which introduced INCLUDE nbtree  
indexes.  The status bits really were reserved initially.  We now use 2  
out of 4 of the bits for additional tuple metadata, though.  Rename the  
mask to BT_STATUS_OFFSET_MASK.  
  
Also consolidate related nbtree.h code comments about the format of  
pivot tuples and posting list tuples.  

M src/include/access/nbtree.h

Fix cost_incremental_sort for expressions with varno 0

commit   : de0dc1a84710f127fdd40f87e783797cc2d69a77    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 23 Apr 2020 00:15:24 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 23 Apr 2020 00:15:24 +0200    

Click here for diff

When estimating the number of pre-sorted groups in cost_incremental_sort  
we must not pass Vars with varno 0 to estimate_num_groups, which would  
cause failues in find_base_rel. This may happen when sorting output of  
set operations, thanks to generate_append_tlist.  
  
Unlike recurse_set_operations we can't easily access the original target  
list, so if we find any Vars with varno 0, we fall back to the default  
estimate DEFAULT_NUM_DISTINCT.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20200411214639.GK2228%40telsasoft.com  

M src/backend/optimizer/path/costsize.c
M src/test/regress/expected/incremental_sort.out
M src/test/regress/sql/incremental_sort.sql

docs: land height is "elevation", not "altitude"

commit   : 92c12e46d5f1e25fc85608a6d6a19b8f5ea02600    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 Apr 2020 16:23:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 Apr 2020 16:23:19 -0400    

Click here for diff

See https://mapscaping.com/blogs/geo-candy/what-is-the-difference-between-elevation-relief-and-altitude  
No patching of regression tests.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/advanced.sgml
M doc/src/sgml/ddl.sgml

Sync up some inconsistent comments in config/c-compiler.m4.

commit   : 748507c780a39c8e31276bf29dd18d7b32a91b34    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Apr 2020 15:27:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Apr 2020 15:27:43 -0400    

Click here for diff

Make header/trailer comments agree with the actual names of some macros.  
These seem like legit names in earlier iterations of respective patches  
(commit b779168ff "Detect PG_PRINTF_ATTRIBUTE automatically." and  
commit 6869b4f25 "Add C++ support to configure.") but the macro had  
been renamed out of sync with the header / trailer comment in the final  
committed patch.  
  
Even more nitpickily, make the dashed underlines agree with the lengths  
of the macro names everyplace.  There doesn't seem to have been any  
meeting of the minds previously on whether those should match or not,  
but at least some people have been trying to make 'em match.  
  
Jesse Zhang, Tom Lane  
  
Discussion: https://postgr.es/m/CAGf+fX7DDyq6WfCy6X_KtD28MkbNBE6NkRi26fSf25dfUwX0zw@mail.gmail.com  

M config/c-compiler.m4

Doc: update section 9.11 for new function table layout.

commit   : 791090bd775b6a2b488ae2078c8479fcd3324a2c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 Apr 2020 14:43:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 Apr 2020 14:43:26 -0400    

Click here for diff

This also makes an attempt to flesh out the docs for some of the more  
severely underdocumented geometric operators and functions.  
  
This effort exposed that the point <^ point (point_below) and  
point >^ point (point_above) operators are misnamed; they should be  
<<| and |>>, because they act like the other operators named that  
way and not like the other operators named <^ and >^.  But I just  
documented them that way; fixing it is matter for another patch.  
  
The haphazard datatype coverage of many of the operators is also  
now depressingly obvious.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Remove bogus Assert in foreign key cloning code

commit   : 9f2c4edec2e2182a2fef8495efdaf90a65d64e6c    
  
author   : David Rowley <[email protected]>    
date     : Wed, 22 Apr 2020 22:12:19 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 22 Apr 2020 22:12:19 +1200    

Click here for diff

This Assert was trying to ensure that the number of columns in the foreign  
key being cloned was the same number of attributes in the parentRel.  Of  
course, it's perfectly valid to have columns in the table which are not  
part of the foreign key constraint. It appears that this Assert was  
misunderstanding that.  
  
Reported-by: Rajkumar Raghuwanshi  
Reviewed-by: amul sul  
Discussion: https://postgr.es/m/CAKcux6=z1dtiWw5BOpqDx-U6KTiq+zD0Y2m810zUtWL+giVXWA@mail.gmail.com  

M src/backend/commands/tablecmds.c

Remove HEAPDEBUGALL

commit   : aaf069aa345231823464f65b33c479a0958fe147    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Apr 2020 19:57:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Apr 2020 19:57:33 +0200    

Click here for diff

This has been broken since PostgreSQL 12 and was probably never really  
used.  PostgreSQL 12 added an analogous HEAPAMSLOTDEBUGALL, which  
still works right now, but it's also not very useful, so remove that  
as well.  
  
Discussion: https://www.postgresql.org/message-id/flat/645c0646-4218-d4c3-409a-a7003a0c108d%402ndquadrant.com  

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

Fix single-record reads to use restore_command if available in pg_rewind

commit   : cd123234404ef9a45415060633d3be31329820b2    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Apr 2020 08:08:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Apr 2020 08:08:28 +0900    

Click here for diff

readOneRecord() is used now when looking for a checkpoint record to  
check if the target server is an ancestor of the source across multiple  
timelines, and using a restore_command if available improves the  
stability of the operation.  This part was missed in a7e8ece.  
  
Reported-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h

psql \d: Display table where trigger is defined, if inherited

commit   : c33869cc3bfc42bce822251f2fa1a2a346f86cc5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Apr 2020 18:37:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Apr 2020 18:37:26 -0400    

Click here for diff

It's important to know that a trigger is cloned from a parent table,  
because of the behavior that the trigger is dropped on detach.  Make  
psql's \d display it.  
  
We'd like to backpatch, but lack of the pg_trigger.tgparentid column  
makes it more difficult.  Punt for now.  If somebody wants to volunteer  
an implementation that reads pg_depend on older versions, that can  
probably be backpatched.  
  
Authors: Justin Pryzby, Amit Langote, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Fix memory leak in libpq when using sslmode=verify-full

commit   : 27dbe1a18423f2f80c10d191844a0ba4dea650ff    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Apr 2020 07:27:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Apr 2020 07:27:03 +0900    

Click here for diff

Checking if Subject Alternative Names (SANs) from a certificate match  
with the hostname connected to leaked memory after each lookup done.  
  
This is broken since acd08d7 that added support for SANs in SSL  
certificates, so backpatch down to 9.5.  
  
Author: Roman Peshkurov  
Reviewed-by: Hamid Akhtar, Michael Paquier, David Steele  
Discussion: https://postgr.es/m/CALLDf-pZ-E3mjxd5=bnHsDu9zHEOnpgPgdnO84E2RuwMCjjyPw@mail.gmail.com  
Backpatch-through: 9.5  

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

Document partitiong tables ancillary object handling some more

commit   : 8803506c411e457adc2531c6ecb69e002e8a83c6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Apr 2020 17:14:18 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Apr 2020 17:14:18 -0400    

Click here for diff

Add a couple of lines to make it explicit that indexes, constraints,  
triggers are added, removed, or left alone.  
  
Backpatch to pg11.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix possible crash during FATAL exit from reindexing.

commit   : d12bdba77b0fce9df818bc84ad8b1d8e7a96614b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 15:58:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 15:58:42 -0400    

Click here for diff

index.c supposed that it could just use a PG_TRY block to clean up the  
state associated with an active REINDEX operation.  However, that code  
doesn't run if we do a FATAL exit --- for example, due to a SIGTERM  
shutdown signal --- while the REINDEX is happening.  And that state does  
get consulted during catalog accesses, which makes it problematic if we  
do any catalog accesses during shutdown --- for example, to clean up any  
temp tables created in the session.  
  
If this combination of circumstances occurred, we could find ourselves  
trying to access already-freed memory.  In debug builds that'd fairly  
reliably cause an assertion failure.  In production we might often  
get away with it, but with some bad luck it could cause a core dump.  
  
Another possible bad outcome is an erroneous conclusion that an  
index-to-be-accessed is being reindexed; but it looks like that would  
be unlikely to have any consequences worse than failing to drop temp  
tables right away.  (They'd still get dropped by the next session that  
uses that temp schema.)  
  
To fix, get rid of the use of PG_TRY here, and instead hook into  
the transaction abort mechanisms to clean up reindex state.  
  
Per bug #16378 from Alexander Lakhin.  This has been wrong for a  
very long time, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/catalog/index.c
M src/include/catalog/index.h

Fix minor violations of FunctionCallInvoke usage protocol.

commit   : 5836d326552cd0bada1b63281892a8515f07af0f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 14:23:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 14:23:42 -0400    

Click here for diff

Working on commit 1c455078b led me to check through FunctionCallInvoke  
call sites to see if every one was being honest about (a) making sure  
that fcinfo.isnull is initially false, and (b) checking its state after  
the call.  Sure enough, I found some violations.  
  
The main one is that finalize_partialaggregate re-used serialfn_fcinfo  
without resetting isnull, even though it clearly intends to cater for  
serialfns that return NULL.  There would only be an issue with a  
non-strict serialfn, since it's unlikely that a serialfn would return  
NULL for non-null input.  We have no non-strict serialfns in core, and  
there may be none in the wild either, which would account for the lack  
of complaints.  Still, it's clearly wrong, so back-patch that fix to  
9.6 where finalize_partialaggregate was introduced.  
  
Also, arrayfuncs.c and rowtypes.c contained various callers that were  
not bothering to check for result nulls.  While what's being called is  
a comparison or hash function that probably *shouldn't* return null,  
that's a lousy excuse for not having any check at all.  There are  
existing places that just Assert(!fcinfo->isnull) in comparable  
situations, so I added that to the places that were calling btree  
comparison or hash support functions.  In the places calling  
boolean-returning equality functions, it's quite cheap to have them  
treat isnull as FALSE, so make those places do that.  Also remove some  
"locfcinfo->isnull = false" assignments that are unnecessary given the  
assumption that no previous call returned null.  These changes seem like  
mostly neatnik-ism or debugging support, so I didn't back-patch.  

M src/backend/executor/nodeAgg.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/rowtypes.c
M src/include/fmgr.h

Fix detaching partitions with cloned row triggers

commit   : afccd76f1ccef73a341e9b0c6efb29a429f35aa4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Apr 2020 13:57:00 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Apr 2020 13:57:00 -0400    

Click here for diff

When a partition is detached, any triggers that had been cloned from its  
parent were not properly disentangled from its parent triggers.  
This resulted in triggers that could not be dropped because they  
depended on the trigger in the trigger in the no-longer-parent table:  
  ALTER TABLE t DETACH PARTITION t1;  
  DROP TRIGGER trig ON t1;  
    ERROR:  cannot drop trigger trig on table t1 because trigger trig on table t requires it  
    HINT:  You can drop trigger trig on table t instead.  
  
Moreover the table can no longer be re-attached to its parent, because  
the trigger name is already taken:  
  ALTER TABLE t ATTACH PARTITION t1 FOR VALUES FROM (1)TO(2);  
    ERROR:  trigger "trig" for relation "t1" already exists  
  
The former is a bug introduced in commit 86f575948c77.  (The latter is  
not necessarily a bug, but it makes the bug more uncomfortable.)  
  
To avoid the complexity that would be needed to tell whether the trigger  
has a local definition that has to be merged with the one coming from  
the parent table, establish the behavior that the trigger is removed  
when the table is detached.  
  
Backpatch to pg11.  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/create_trigger.sgml
M src/backend/commands/tablecmds.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Consider outliers in split interval calculation.

commit   : 1542e16f2ca257656717ab8ea263bc310f1b6d51    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 21 Apr 2020 09:59:24 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 21 Apr 2020 09:59:24 -0700    

Click here for diff

Commit 0d861bbb, which introduced deduplication to nbtree, added some  
logic to take large posting list tuples into account when choosing a  
split point.  We subtract firstright posting list overhead from the  
projected new high key size when calculating leftfree/rightfree values  
for an affected candidate split point.  Posting list tuples aren't  
special to nbtsplitloc.c, but taking them into account like this makes a  
huge difference in practice.  Posting list tuples are frequently tuple  
size outliers.  
  
However, commit 0d861bbb missed a closely related issue: split interval  
itself is calculated based on the assumption that tuples on the page  
being split are roughly equisized.  That assumption was acceptable back  
when commit fab25024 taught the logic for choosing a split point about  
suffix truncation, but it's pretty questionable now that very large  
tuple sizes are common.  This oversight led to unbalanced page splits in  
low cardinality multi-column indexes when deduplication was used: page  
splits that don't give sufficient weight to how unbalanced the split is  
when the interval happens to include some large posting list tuples (and  
when most other tuples on the page are not so large).  
  
Nail this down by calculating an initial split interval in a way that's  
attuned to the actual cost that we want to keep under control (not a  
fuzzy proxy for the cost): apply a leftfree + rightfree evenness test to  
each candidate split point that actually gets included in the split  
interval (for the default strategy).  This replaces logic that used a  
percentage of all legal split points for the page as the basis of the  
initial split interval.  
  
Discussion: https://postgr.es/m/CAH2-WznJt5aT2uUB2Bs+JBLdwe0XTX67+xeLFcaNvCKxO=QBVQ@mail.gmail.com  

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

Allow matchingsel() to be used with operators that might return NULL.

commit   : 1c455078b0950cb6bad83198d818a55f02649fd4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 12:56:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 12:56:55 -0400    

Click here for diff

Although selfuncs.c will never call a target operator with null inputs,  
some functions might return null anyway.  The existing coding will fail  
if that happens (since FunctionCall2Coll will punt), which seems  
undesirable given that matchingsel() has such a broad range of potential  
applicability --- in fact, we already have a problem because we apply it  
to jsonb_path_exists_opr, which can return null.  Hence, rejigger the  
underlying functions mcv_selectivity and histogram_selectivity to cope,  
treating a null result as false.  
  
While we are at it, we can move the InitFunctionCallInfoData overhead  
out of the inner loops, which isn't a huge number of cycles but might  
save something considering we are likely calling functions as cheap  
as int4eq().  Plus, the number of loop cycles to be expected is much  
more than it was when this code was written, since typical settings  
of default_statistics_target are higher.  
  
In view of that consideration, let's apply the same change to  
var_eq_const, eqjoinsel_inner, and eqjoinsel_semi.  We do not expect  
equality functions to ever return null for non-null inputs (and  
certainly that code has been that way a long time without complaints),  
but the cycle savings seem attractive, especially in the eqjoinsel loops  
where there's potentially an O(N^2) savings.  
  
Similar code exists in ineq_histogram_selectivity and  
get_variable_range, but I forebore from changing those for now.  
The performance argument for changing ineq_histogram_selectivity  
is really weak anyway, since that will only iterate log2(N) times.  
  
Nikita Glukhov and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

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

Clean up cpluspluscheck violation.

commit   : 9d25e1aa311c0f0c77155382e6608545b7bf579c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 11:21:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 11:21:15 -0400    

Click here for diff

"operator" is a reserved word in C++, so per project conventions,  
don't use it as an identifier in header files.  
  
My oversight in commit a80818605.  

M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Fix duplicate typedef from commit 0d8c9c121.

commit   : 2117c3cb3d51e73290f464ad725fe829c96b9213    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 11:13:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Apr 2020 11:13:05 -0400    

Click here for diff

Older gcc versions don't like duplicate typedefs, so get rid of  
that in favor of doing it like we do it elsewhere, ie just use  
a "struct" declaration when trying to avoid importing a whole  
header file.  
  
Also, there seems no reason to include stringinfo.h here at all,  
so get rid of that addition too.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/replication/basebackup.h

Mention pg_promote() as a method to trigger promotion in documentation.

commit   : 67f82e966b524fc0eb44024976c5178612a77fc8    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 21 Apr 2020 14:05:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 21 Apr 2020 14:05:43 +0900    

Click here for diff

Previously in the "Standby Server Operation" section, pg_ctl promote and  
protmote_trigger_file were documented as a method to trigger standby  
promotion, but pg_promote() function not.  
  
This commit also adds parentheses into <function>pg_promote</function>  
in some docs to make it clearer that a function is being referred to.  
  
Author: Masahiro Ikeda  
Reviewed-by: Michael Paquier, Laurenz Albe, Tom Lane, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml

doc: change SGML markup "figure" to "example"

commit   : f192312dc07601c5abb2e04126b434c70f7c8e50    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 20 Apr 2020 21:41:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 20 Apr 2020 21:41:13 -0400    

Click here for diff

Reported-by: Jürgen Purtz  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Jürgen Purtz  
  
Backpatch-through: 9.5  

M doc/src/sgml/func.sgml

Doc: update sections 9.7 and 9.8 for new function table layout.

commit   : 1ec42696bed5709e4ff885c109d1e48d92b2b331    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Apr 2020 18:44:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Apr 2020 18:44:12 -0400    

Click here for diff

Also some mop-up in section 9.9.  

M doc/src/sgml/func.sgml

Move the server's backup manifest code to a separate file.

commit   : 079ac29d4dafe581748ceca523aa90c8ce8b035b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 20 Apr 2020 14:37:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 20 Apr 2020 14:37:38 -0400    

Click here for diff

basebackup.c is already a pretty big and complicated file, so it  
makes more sense to keep the backup manifest support routines  
in a separate file, for clarity and ease of maintenance.  
  
Discussion: http://postgr.es/m/CA+TgmoavRak5OdP76P8eJExDYhPEKWjMb0sxW7dF01dWFgE=uA@mail.gmail.com  

M src/backend/replication/Makefile
A src/backend/replication/backup_manifest.c
M src/backend/replication/basebackup.c
A src/include/replication/backup_manifest.h

Add tab-completion for ALTER INDEX .. [NO] DEPENDS ON

commit   : 1e324cb0e7613dc035a403c4201c7dc004e7dedb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Apr 2020 13:42:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Apr 2020 13:42:41 -0400    

Click here for diff

... as added in the prior commit.  
  
(We'd like to have tab-completion for the other object types too, but  
they don't have sub-command completion yet.)  
  
Author: Ibrar Ahmed <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CALtqXTcogrFEVP9uou5vFtnGsn+vHZUu9+9a0inarfYVOHScYQ@mail.gmail.com  

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

Add ALTER .. NO DEPENDS ON

commit   : 5fc703946bf3b18642ce83b937671d254a8ac5b5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Apr 2020 13:42:12 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Apr 2020 13:42:12 -0400    

Click here for diff

Commit f2fcad27d59c (9.6 era) added the ability to mark objects as  
dependent an extension, but forgot to add a way for such dependencies to  
be removed.  This commit fixes that oversight.  
  
Strictly speaking this should be backpatched to 9.6, but due to lack of  
demand we're not doing so at this time.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: ahsan hadi <[email protected]>  
Reviewed-by: Ibrar Ahmed <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_materialized_view.sgml
M doc/src/sgml/ref/alter_trigger.sgml
M src/backend/catalog/pg_depend.c
M src/backend/commands/alter.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/catalog/dependency.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_extensions/expected/test_extdepend.out
M src/test/modules/test_extensions/sql/test_extdepend.sql

Doc: update sections 9.5 and 9.6 for new function table layout.

commit   : 4157f73b4ba7fa0c6fb117cb9b5a771875850c83    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Apr 2020 12:29:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Apr 2020 12:29:28 -0400    

Click here for diff

Along the way, update the older examples for bytea to use "hex"  
output format.  That lets us get rid of the lame disclaimer about  
how the examples assume bytea_output = escape, which was only half  
true anyway because none of the more-recently-added examples had  
paid any attention to that.  

M doc/src/sgml/func.sgml

Allow pg_read_all_stats to access all stats views again

commit   : 7e4e574744c13aac613909a59bf38ef5aae5bd8c    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 20 Apr 2020 12:53:40 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 20 Apr 2020 12:53:40 +0200    

Click here for diff

The views pg_stat_progress_* had not gotten the memo that  
pg_read_all_stats is supposed to be able to read all statistics. Also  
make a pass over all text-returning pg_stat_xyz functions that could  
return "insufficient privilege" and make sure they also respect  
pg_read_all_status.  
  
Reported-by: Andrey M. Borodin  
Reviewed-by: Andrey M. Borodin, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: update the rest of section 9.4 for new function table layout.

commit   : 9aece5cd05f1b21b67eac0dc4f105853eec3e4eb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Apr 2020 17:44:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Apr 2020 17:44:28 -0400    

Click here for diff

Notably, this replaces the previous handwaving about these functions'  
behavior with "character"-type inputs with some actual facts.  

M doc/src/sgml/func.sgml

Fix missing pfree() in logtape.c, missed by 24d85952.

commit   : 0cacb2b79d8fa1aeec34cd956544f0c96e7915ed    
  
author   : Jeff Davis <[email protected]>    
date     : Sun, 19 Apr 2020 10:32:26 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sun, 19 Apr 2020 10:32:26 -0700    

Click here for diff

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

Doc: update sections 9.1-9.3 for new function table layout.

commit   : 81e83216d5b6826167d5116bd084b7b3a364b0b3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Apr 2020 12:17:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Apr 2020 12:17:02 -0400    

Click here for diff

I took the opportunity to do some copy-editing in this area as well,  
and to add some new material such as a note about BETWEEN's syntactical  
peculiarities.  
  
Of note is that quite a few of the examples of transcendental functions  
needed to be updated, because the displayed output no longer matched  
what you get on a modern server.  I believe some of these cases are  
side-effects of the new Ryu algorithm in float8out.  Others appear to be  
because the examples predate the addition of type numeric, and were  
expecting that float8 calculations would be done although the given  
syntax would actually lead to calling the numeric function nowadays.  

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

Fix update-unicode target

commit   : 73afabcdc20e227beb8094efb44753b4de1c5c0a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 19 Apr 2020 14:59:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 19 Apr 2020 14:59:29 +0200    

Click here for diff

The normalization-check target needs to be run last, after moving the  
newly generated files into place.  Also, we need an additional  
dependency so that unicode_norm.o is rebuilt first.  Otherwise,  
norm_test will still test the old files but against the new expected  
results, which will probably fail.  

M src/common/unicode/Makefile

Doc: sync functableentry markup choices with website style.

commit   : 00f4aba46d537452da41e6d398f8f4c915de586d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Apr 2020 15:36:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Apr 2020 15:36:43 -0400    

Click here for diff

Jonathan Katz felt that slightly different indentation settings made  
for a better-looking result, so sync stylesheet-fo.xsl (for PDF) and  
stylesheet.css (for non-website-style HTML) with those choices.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/stylesheet.css

Fix race conditions in synchronous standby management.

commit   : f332241a60aa9c0945d74642cb3dbcbc11621154    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Apr 2020 14:02:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Apr 2020 14:02:44 -0400    

Click here for diff

We have repeatedly seen the buildfarm reach the Assert(false) in  
SyncRepGetSyncStandbysPriority.  This apparently is due to failing to  
consider the possibility that the sync_standby_priority values in  
shared memory might be inconsistent; but they will be whenever only  
some of the walsenders have updated their values after a change in  
the synchronous_standby_names setting.  That function is vastly too  
complex for what it does, anyway, so rewriting it seems better than  
trying to apply a band-aid fix.  
  
Furthermore, the API of SyncRepGetSyncStandbys is broken by design:  
it returns a list of WalSnd array indexes, but there is nothing  
guaranteeing that the contents of the WalSnd array remain stable.  
Thus, if some walsender exits and then a new walsender process  
takes over that WalSnd array slot, a caller might make use of  
WAL position data that it should not, potentially leading to  
incorrect decisions about whether to release transactions that  
are waiting for synchronous commit.  
  
To fix, replace SyncRepGetSyncStandbys with a new function  
SyncRepGetCandidateStandbys that copies all the required data  
from shared memory while holding the relevant mutexes.  If the  
associated walsender process then exits, this data is still safe to  
make release decisions with, since we know that that much WAL *was*  
sent to a valid standby server.  This incidentally means that we no  
longer need to treat sync_standby_priority as protected by the  
SyncRepLock rather than the per-walsender mutex.  
  
SyncRepGetSyncStandbys is no longer used by the core code, so remove  
it entirely in HEAD.  However, it seems possible that external code is  
relying on that function, so do not remove it from the back branches.  
Instead, just remove the known-incorrect Assert.  When the bug occurs,  
the function will return a too-short list, which callers should treat  
as meaning there are not enough sync standbys, which seems like a  
reasonably safe fallback until the inconsistent state is resolved.  
Moreover it's bug-compatible with what has been happening in non-assert  
builds.  We cannot do anything about the walsender-replacement race  
condition without an API/ABI break.  
  
The bogus assertion exists back to 9.6, but 9.6 is sufficiently  
different from the later branches that the patch doesn't apply at all.  
I chose to just remove the bogus assertion in 9.6, feeling that the  
probability of a bad outcome from the walsender-replacement race  
condition is too low to justify rewriting the whole patch for 9.6.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/syncrep.c
M src/backend/replication/walsender.c
M src/include/replication/syncrep.h
M src/include/replication/walsender_private.h

Fix possible crash with GENERATED ALWAYS columns

commit   : 3cb02e307e350caf3c9099c6f661a95fd00e7e4c    
  
author   : David Rowley <[email protected]>    
date     : Sat, 18 Apr 2020 14:10:37 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 18 Apr 2020 14:10:37 +1200    

Click here for diff

In some corner cases, this could also lead to corrupted values being  
included in the tuple.  
  
Users who are concerned that they are affected by this should first  
upgrade and then perform a base backup of their database and restore onto  
an off-line server. They should then query each table with generated  
columns to ensure there are no rows where the generated expression does  
not match a newly calculated version of the GENERATED ALWAYS expression.  
If no crashes occur and no rows are returned then you're not affected.  
  
Fixes bug #16369.  
  
Reported-by: Cameron Ezell  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12 (where GENERATED ALWAYS columns were added.)  

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

Doc: revise formatting of function/operator tables.

commit   : 737d69ffc3cfb2e093975411c1becd65ad029478    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Apr 2020 20:50:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Apr 2020 20:50:26 -0400    

Click here for diff

The table layout ideas proposed in commit e894c6183 were not as widely  
popular as I'd hoped.  After discussion, we've settled on a layout  
that's effectively a single-column table with cell contents much like a  
<varlistentry> description of the function or operator; though we're not  
actually using <varlistentry>, because it'd add way too much vertical  
space.  Instead the effect is accomplished using line-break processing  
instructions to separate the description and example(s), plus CSS or FO  
customizations to produce indentation of all but the first line in each  
cell.  While technically this is a bit grotty, it does have the  
advantage that we won't need to write nearly as much boilerplate markup.  
  
This patch updates tables 9.30, 9.31, and 9.33 (which were touched by  
the previous patch) to the revised style, and additionally converts  
table 9.10.  A lot of work still remains to do, but hopefully it won't  
be too controversial.  
  
Thanks to Andrew Dunstan, Pierre Giraud, Robert Haas, Alvaro Herrera,  
David Johnston, Jonathan Katz, Isaac Morland for valuable ideas.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/stylesheet-common.xsl
M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/stylesheet.css

Revert "Only provide new libpq sslpasskey hook for openssl-enabled builds"

commit   : 6741cfa5964768279a13e01e46931664fe0903a4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Apr 2020 16:53:01 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Apr 2020 16:53:01 -0400    

Click here for diff

This reverts commit 9e24109f1a4e4d8d1d372b004d6a0dd06e673fe7.  
  
This caused build errors when building without openssl, and it's  
simplest just to revert it.  

M src/interfaces/libpq/libpq-fe.h

Only provide openssl_tls_init_hook if building with openssl

commit   : f342d7ad03e61a1cea0339cf0c5aea0d01c3b43e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Apr 2020 15:57:19 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Apr 2020 15:57:19 -0400    

Click here for diff

This should have been protected by #ifdef USE_OPENSSL in commit  
896fcdb230.  
  
Per the real complaint this time from Daniel Gustafsson.  

M src/include/libpq/libpq-be.h

Use a slightly more liberal regex to detect Visual Studio version

commit   : a9659fb65497af8d2db66101f2ff7233d02997f1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Apr 2020 14:44:33 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Apr 2020 14:44:33 -0400    

Click here for diff

Apparently in some language versions of Visual Studio nmake outputs some  
material after the version number and before the end of the line. This  
has been seen in Chinese versions. Therefore, we no longer demand that  
the version string comes at the end of a line.  
  
Per complaint from Cuiping Lin.  
  
Backpatch to all live branches.  

M src/tools/msvc/VSObjectFactory.pm

Only provide new libpq sslpasskey hook for openssl-enabled builds

commit   : 9e24109f1a4e4d8d1d372b004d6a0dd06e673fe7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Apr 2020 14:11:18 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Apr 2020 14:11:18 -0400    

Click here for diff

In commit 4dc6355210 I neglected to put #ifdef USE_OPENSSL around the  
declarations of the new items. This is remedied here.  
  
Per complaint from Daniel Gustafsson.  

M src/interfaces/libpq/libpq-fe.h

Fix possible future cache reference leak in ALTER EXTENSION ADD/DROP.

commit   : 3125a5baec1cf6d3aaeb8964bc3b3c49835e0452    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Apr 2020 13:41:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Apr 2020 13:41:59 -0400    

Click here for diff

recordExtObjInitPriv and removeExtObjInitPriv were sloppy about  
calling ReleaseSysCache.  The cases cannot occur given current usage  
in ALTER EXTENSION ADD/DROP, since we wouldn't get here for these  
relkinds; but it seems wise to clean up better.  
  
In passing, extend test logic in test_pg_dump to exercise the  
dropped-column code paths here.  
  
Since the case is unreachable at present, there seems no great  
need to back-patch; hence fix HEAD only.  
  
Kyotaro Horiguchi, with test case and comment adjustments by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/aclchk.c
M src/test/modules/test_pg_dump/README
M src/test/modules/test_pg_dump/expected/test_pg_dump.out
M src/test/modules/test_pg_dump/sql/test_pg_dump.sql

Add index term for backup manifest in documentation.

commit   : 4db819ba403901d38c4e4328883412c59061bb58    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 17 Apr 2020 18:37:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 17 Apr 2020 18:37:38 +0900    

Click here for diff

Author: Fujii Masao  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/backup-manifest.sgml

Fix minor memory leak in pg_basebackup and pg_receivewal

commit   : 198efe774b0d2065d828cf7822376a2871c671fc    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Apr 2020 10:45:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Apr 2020 10:45:08 +0900    

Click here for diff

The result of the query used to retrieve the WAL segment size from the  
backend was not getting freed in two code paths.  Both pg_basebackup and  
pg_receivewal exit immediately if a failure happened on this query, so  
this was not an actual problem, but it could be an issue if this code  
gets used for other tools in different ways, be they future tools in  
this code tree or external, existing, ones.  
  
Oversight in commit fc49e24, so backpatch down to 11.  
  
Author: Jie Zhang  
Discussion: https://postgr.es/m/970ad9508461469b9450b64027842331@G08CNEXMBPEKD06.g08.fujitsu.local  
Backpatch-through: 11  

M src/bin/pg_basebackup/streamutil.c

Remove unneeded constraint dependency tracking

commit   : 5b736e9cf95793ca6a4c00d291a06dfe3559c8ec    
  
author   : David Rowley <[email protected]>    
date     : Fri, 17 Apr 2020 10:29:49 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 17 Apr 2020 10:29:49 +1200    

Click here for diff

It was previously thought that remove_useless_groupby_columns() needed to  
keep track of which constraints the generated plan depended upon, however,  
this is unnecessary. The confusion likely arose regarding this because of  
check_functional_grouping(), which does need to track the dependency to  
ensure VIEWs with columns which are functionally dependant on the GROUP BY  
remain so. For remove_useless_groupby_columns(), cached plans will just  
become invalidated when the primary key's underlying index is removed  
through the normal relcache invalidation code.  
  
Here we just remove the unneeded code which records the dependency and  
updates the comments. The previous comments claimed that we could not use  
UNIQUE constraints for the same optimization due to lack of a  
pg_constraint record for NOT NULL constraints (which are required because  
NULLs can be duplicated in a unique index). Since we don't actually need a  
pg_constraint record to handle the invalidation, it looks like we could  
add code to do this in the future. But not today.  
  
We're not really fixing any bug in the code here, this fix is just to set  
the record straight on UNIQUE constraints. This code was added back in  
9.6, but due to lack of any bug, we'll not be backpatching this.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAApHDvrdYa=VhOoMe4ZZjZ-G4ALnD-xuAeUNCRTL+PYMVN8OnQ@mail.gmail.com  

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

Fix cache reference leak in contrib/sepgsql.

commit   : fc576b7c4f3a5f045d443fc771d9e0f54b33e72b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Apr 2020 14:45:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Apr 2020 14:45:54 -0400    

Click here for diff

fixup_whole_row_references() did the wrong thing with a dropped column,  
resulting in a commit-time warning about a cache reference leak.  
  
I (tgl) added a test case exercising this, but back-patched the test  
only as far as v10; the patch didn't apply cleanly to 9.6 and it  
didn't seem worth the trouble to adapt it.  The bug is pretty old  
though, so apply the code change all the way back.  
  
Michael Luo, with cosmetic improvements by me  
  
Discussion: https://postgr.es/m/BYAPR08MB5606D1453D7F50E2AF4D2FD29AD80@BYAPR08MB5606.namprd08.prod.outlook.com  

M contrib/sepgsql/dml.c
M contrib/sepgsql/expected/dml.out
M contrib/sepgsql/sql/dml.sql

Fix the usage of parallel and full options of vacuum command.

commit   : 24d2d38b1eb86c0b410ad0f07f66566a83c6f05c    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 16 Apr 2020 10:44:03 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 16 Apr 2020 10:44:03 +0530    

Click here for diff

Earlier we were inconsistent in allowing the usage of parallel and  
full options.  Change it such that we disallow them only when they are  
combined in a way that we don't support.  
  
In passing, improve the comments in some of the existing tests of parallel  
vacuum.  
  
Reported-by: Tushar Ahuja  
Author: Justin Pryzby, Amit Kapila  
Reviewed-by: Sawada Masahiko, Michael Paquier, Mahendra Singh Thalor and  
Amit Kapila  
Discussion: https://postgr.es/m/58c8d171-e665-6fa3-a9d3-d9423b694dae%40enterprisedb.com  

M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuum.c
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Disable silently generation of manifests with servers <= 12 in pg_basebackup

commit   : 542d7817f774ea9d94798eb95cdf250d4f1527d9    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Apr 2020 13:57:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Apr 2020 13:57:07 +0900    

Click here for diff

Since 0d8c9c1, pg_basebackup would generate an error if connected to a  
backend version older than 12 where backup manifests are not supported.  
Avoiding this error is possible by using the --no-manifest option.  
  
This error handling could be confusing for some users, where patching a  
backup script that interacts with multiple backend versions would cause  
the addition of --no-manifest to potentially not generate a backup  
manifest even for Postgres 13 and newer versions.  As we want to  
encourage the use of backup manifests as much as possible, this commit  
silently disables manifests where not supported, instead of generating  
an error.  
  
While on it, rework a bit the code to make it more consistent with the  
surroundings when generating the BASE_BACKUP command.  
  
Per discussion with Andres Freund, Stephen Frost, Robert Haas, Álvaro  
Herrera, Kyotaro Horiguchi, Tom Lane, David Steele, and me.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c

Slightly simplify nbtree split point choice loop.

commit   : f0ca378d4c139eda99ef14998115c1674dac3fc5    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 15 Apr 2020 15:47:26 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 15 Apr 2020 15:47:26 -0700    

Click here for diff

Spotted during post-commit review of the nbtree deduplication commit  
(commit 0d861bbb).  

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

Fix minor memory leak in pg_dump

commit   : 8f4ee44bcdbcd437f860f2d048125a118335b088    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Apr 2020 15:56:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Apr 2020 15:56:01 +0900    

Click here for diff

A query used to read default ACL information from the catalogs did not  
free a set of PQExpBuffer.  
  
Oversight in commit e2090d9, so backpatch down to 9.6.  
  
Author: Jie Zhang  
Reviewed-by: Sawada Masahiko  
Discussion: https://postgr.es/m/05bcbc5857f948efa0b451b85a48ae10@G08CNEXMBPEKD06.g08.fujitsu.local  
Backpatch-through: 9.6  

M src/bin/pg_dump/pg_dump.c

Code review for backup manifest.

commit   : a2ac73e7be7adf2a9248d14322d3a5e055ea4fd0    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 15 Apr 2020 11:15:12 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 15 Apr 2020 11:15:12 +0900    

Click here for diff

This commit prevents pg_basebackup from receiving backup_manifest file  
when --no-manifest is specified. Previously, when pg_basebackup was  
writing a tarfile to stdout, it tried to receive backup_manifest file even  
when --no-manifest was specified, and reported an error.  
  
Also remove unused -m option from pg_basebackup.  
  
Also fix typo in BASE_BACKUP command documentation.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M src/bin/pg_basebackup/pg_basebackup.c

Remove obsolete "hole in center of page" comment.

commit   : 4a05a6409567719829ec84d7689b41c55009d75f    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 14 Apr 2020 14:38:28 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 14 Apr 2020 14:38:28 -0700    

Click here for diff

A comment from the Berkeley days incorrectly claimed that the page  
management code cares about the contents of the hole in the center of  
the page (at least in the case of the left half of an nbtree page  
split).  Commit 8fa30f906be added an addendum that stated that the  
original comment was "probably obsolete".  It's definitely obsolete,  
though, so remove the original comment plus the addendum.  

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

Account for collation when coercing the output of a SQL function.

commit   : 2d59643dbccaf73bc1f90875ea02dcad641379cd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Apr 2020 17:30:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Apr 2020 17:30:13 -0400    

Click here for diff

Commit 913bbd88d overlooked that the result of coerce_to_target_type  
might need collation fixups.  Per report from Andreas Joseph Krogh.  
  
Discussion: https://postgr.es/m/VisenaEmail.72.37d08ec2b8cb8fb5.17179940cd3@tc7-visena  

M src/backend/executor/functions.c
M src/test/regress/expected/collate.out
M src/test/regress/sql/collate.sql

Stop requiring an explicit return from perl subroutines

commit   : 0516f94d18c57cc5dce72ff8fb84a05d24a67063    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 14 Apr 2020 16:55:34 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 14 Apr 2020 16:55:34 -0400    

Click here for diff

The consensus of the project appears to be that this provides little  
benefit and is simply an annoyance.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/perlcheck/perlcriticrc

Set Perl search path more idiomatically

commit   : e60c6f6ea17b50833242653fe2781f6d47429540    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 14 Apr 2020 16:47:07 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 14 Apr 2020 16:47:07 -0400    

Click here for diff

Back in commits 1df92eeafe, f884a96819, and 592123efbb I used some  
hackish code to set the script search path, unaware despite decades of  
perl that there was a completely standard way to do this. This patch  
changes those cases to use the standard perl FindBin package.  

M src/backend/catalog/genbki.pl
M src/tools/msvc/build.pl
M src/tools/msvc/install.pl
M src/tools/msvc/mkvcbuild.pl
M src/tools/msvc/vcregress.pl

Document the backup manifest file format.

commit   : 149f2ae88ab0510be3239caf45699d7373f2c6e8    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 14 Apr 2020 13:41:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 14 Apr 2020 13:41:32 -0400    

Click here for diff

Patch by me, at the request of Andres Freund. Reviewed by  
Justin Pryzby, Erik Rijkers, Álvaro Herrera, and Andrew  
Dunstan.  
  
Discussion: http://postgr.es/m/[email protected]  

A doc/src/sgml/backup-manifest.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/postgres.sgml

Rearrange _bt_insertonpg() "update metapage" code.

commit   : 80634e3b181562015762b5846583ff67f8037a80    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 14 Apr 2020 09:33:18 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 14 Apr 2020 09:33:18 -0700    

Click here for diff

Nest the "update metapage as part of insert into root-like page" branch  
inside the broader "insert into internal page" branch.  This improves  
readability.  

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

Fix collection of typos and grammar mistakes in the tree, volume 2

commit   : 8128b0c152a67917535f50738ac26da4f984ddd9    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 14 Apr 2020 14:45:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 14 Apr 2020 14:45:43 +0900    

Click here for diff

This fixes some comments and documentation new as of Postgres 13, and is  
a follow-up of the work done in dd0f37e.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/pg_verifybackup.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/select.sgml
M src/backend/executor/nodeIncrementalSort.c
M src/backend/replication/logical/relation.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/tuplesort.h

Add defensive "split_only_page" nbtree assertion.

commit   : f762b2feba276a627585cb7e834fb7a1bf4c549d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 13 Apr 2020 21:11:03 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 13 Apr 2020 21:11:03 -0700    

Click here for diff

Clearly it's not okay for nbtree to split a page that is the only page  
on its level, and then find that it has to split the parent one level up  
in turn.  There is simply no code to handle the split_only_page case in  
the _bt_insertonpg() "newitem won't fit" branch (only the "newitem fits"  
branch handles split_only_page).  Add a defensive assertion that will  
fail if a split_only_page call to _bt_insertonpg() somehow ends up  
splitting the target/parent page.  
  
I (pgeoghegan) believe that we don't need split_only_page handling for  
the "newitem won't fit" branch because anybody calling _bt_insertonpg()  
like this would have to hold a lock on the same one and only child page.  

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

Comments and doc fixes for commit 40d964ec99.

commit   : a6fea120a7e3858e642bb5e96027f166a1a6f134    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 14 Apr 2020 08:10:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 14 Apr 2020 08:10:27 +0530    

Click here for diff

Reported-by: Justin Pryzby  
Author: Justin Pryzby, with few changes by me  
Reviewed-by: Amit Kapila and Sawada Masahiko  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/vacuum.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/parallel.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Make _bt_insertonpg() more like _bt_split().

commit   : 826ee1a019127d611bb0fd22ca878142bfb077ac    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 13 Apr 2020 19:26:41 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 13 Apr 2020 19:26:41 -0700    

Click here for diff

It seems like a good idea for nbtree's retail insert code to be  
absolutely consistent with nbtree's page split code for anything that  
naturally requires equivalent handling.  Anything that concerns  
inserting newitem (which is handled as part of the page split atomic  
action when a page split is required) should work in exactly the same  
way.  With that in mind, make _bt_insertonpg() handle 'cbuf' in a way  
that matches _bt_split().  

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

Add a wait_for_catchup() before immediate stop of a test master.

commit   : d60cfb6bf2b4812e97271e7b5ba3ad4713406b9d    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 13 Apr 2020 18:47:28 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 13 Apr 2020 18:47:28 -0700    

Click here for diff

Per buildfarm member hoverfly, a slow walsender could make the test  
fail.  Back-patch to v10, where the test was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/010_logical_decoding_timelines.pl

Silence Perl warning

commit   : e56d717d8a23c48e4ab27b6bd6815c50dc3a378a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 Apr 2020 19:54:09 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 Apr 2020 19:54:09 -0400    

Click here for diff

Now that warnings are enabled across the board, this code that tries to  
print an undef variable emits one.  Silently printing the empty string  
achieves the previous behavior.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/mk_feature_tables.pl

Harmonize nbtree page split point code.

commit   : bc3087b626d1073c9b7c9687b334785909ca2237    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 13 Apr 2020 16:39:55 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 13 Apr 2020 16:39:55 -0700    

Click here for diff

An nbtree split point can be thought of as a point between two adjoining  
tuples from an imaginary version of the page being split that includes  
the incoming/new item (in addition to the items that really are on the  
page).  These adjoining tuples are called the lastleft and firstright  
tuples.  
  
The variables that represent split points contained a field called  
firstright, which is an offset number of the first data item from the  
original page that goes on the new right page.  The corresponding tuple  
from origpage was usually the same thing as the actual firstright tuple,  
but not always: the firstright tuple is sometimes the new/incoming item  
instead.  This situation seems unnecessarily confusing.  
  
Make things clearer by renaming the origpage offset returned by  
_bt_findsplitloc() to "firstrightoff".  We now have a firstright tuple  
and a firstrightoff offset number which are comparable to the  
newitem/lastleft tuples and the newitemoff/lastleftoff offset numbers  
respectively.  Also make sure that we are consistent about how we  
describe nbtree page split point state.  
  
Push the responsibility for dealing with pg_upgrade'd !heapkeyspace  
indexes down to lower level code, relieving _bt_split() from dealing  
with it directly.  This means that we always have a palloc'd left page  
high key on the leaf level, no matter what.  This enables simplifying  
some of the code (and code comments) within _bt_split().  
  
Finally, restructure the page split code to make it clearer why suffix  
truncation (which only takes place during leaf page splits) is  
completely different to the first data item truncation that takes place  
during internal page splits.  Tuples are marked as having fewer  
attributes stored in both cases, and the firstright tuple is truncated  
in both cases, so it's easy to imagine somebody missing the distinction.  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/include/access/nbtxlog.h

Use perl's $/ more idiomatically

commit   : 8f00d84afc0dad577b65df5a313e5306cee3d11f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 13 Apr 2020 12:06:11 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 13 Apr 2020 12:06:11 -0400    

Click here for diff

This replaces a few occurrences of ugly code with a more clean and  
idiomatic usage. The problem was highlighted by perlcritic, but we're  
not enforcing the policy that led to the discovery.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Install.pm
M src/tools/msvc/Project.pm
M src/tools/win32tzlist.pl

Use perl warnings pragma consistently

commit   : 7be5d8df1f74b78620167d3abf32ee607e728919    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 13 Apr 2020 11:55:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 13 Apr 2020 11:55:45 -0400    

Click here for diff

We've had a mixture of the warnings pragma, the -w switch on the shebang  
line, and no warnings at all. This patch removes the -w swicth and add  
the warnings pragma to all perl sources missing it. It raises the  
severity of the TestingAndDebugging::RequireUseWarnings  perlcritic  
policy to level 5, so that we catch any future violations.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/seg/seg-validate.pl
M contrib/seg/sort-segments.pl
M doc/src/sgml/mk_feature_tables.pl
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/sort/gen_qsort_tuple.pl
M src/bin/psql/create_help.pl
M src/interfaces/libpq/test/regress.pl
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plperl_opmask.pl
M src/test/locale/sort-test.pl
M src/test/perl/SimpleTee.pm
M src/tools/fix-old-flex-code.pl
M src/tools/msvc/build.pl
M src/tools/msvc/pgbison.pl
M src/tools/msvc/pgflex.pl
M src/tools/msvc/vcregress.pl
M src/tools/perlcheck/perlcriticrc
M src/tools/pginclude/pgcheckdefines
M src/tools/version_stamp.pl

Print policy name in perlcritic messages

commit   : 8930e43ecd3f683c457865131d7a932401a2188f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 13 Apr 2020 11:46:18 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 13 Apr 2020 11:46:18 -0400    

Click here for diff

This makes it easier to do a web search for details of the policy that's  
been violated, as well as displaying the name that might be needed for a  
policy override.  
  
Various perlcritic settings changes are being discussed, but this one  
should be uncontroversial.  

M src/tools/perlcheck/perlcriticrc

Rename pg_validatebackup to pg_verifybackup some more.

commit   : 7a6b017b34783eb7ee4e93f93a52bde2bb017c8c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 13 Apr 2020 10:48:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 13 Apr 2020 10:48:23 -0400    

Click here for diff

The previous commit missed an instance.  
  
Noriyoshi Shinoda  
  
Discussion: http://postgr.es/m/TU4PR8401MB115291AE850BA7CF1AEB2F0BEEDD0@TU4PR8401MB1152.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/pg_verifybackup.sgml

Cosmetic fixups for WAL usage work.

commit   : ef08ca113fe302b9ddf298964756eadcd41e77a1    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Apr 2020 15:31:16 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Apr 2020 15:31:16 +0530    

Click here for diff

Reported-by: Justin Pryzby and Euler Taveira  
Author: Justin Pryzby and Julien Rouhaud  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements–1.7–1.8.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/ref/explain.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xlog.c
M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/include/executor/instrument.h

Improve error messages after LoadLibrary()

commit   : 0c620a5803afbb667da7ac4bcc91b245a214a80c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Apr 2020 10:21:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Apr 2020 10:21:15 +0200    

Click here for diff

Move the file name to a format parameter to ease translatability.  Add  
error code where missing.  Make the wording consistent.  

M src/backend/libpq/auth.c
M src/common/restricted_token.c

Doc: introduce new layout for tables of functions and operators.

commit   : e894c61836e4b967f7ec65358fdaed2ba86ed238    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Apr 2020 18:03:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Apr 2020 18:03:20 -0400    

Click here for diff

We've long fought with the draconian space limitations of our  
traditional table layout for describing SQL functions and operators.  
This commit introduces a new approach, though so far I've only applied  
it to a few of those tables.  The new way makes use of DocBook's support  
for different layouts in different rows of a table, and allows the  
descriptions and examples for a function or operator to run to several  
lines without as much ugliness and wasted space as before.  
  
The core layout concept is now  
  
     Name              Signature  
                      Description  
                 Example     Example Result  
  
so that a function or operator really has three table rows not one,  
but we group them to look like one row by having the name column  
have only one entry for all three rows.  (Actually, there could be  
four or more rows if you wanted to have more than one example, which  
is another thing that was painful before but works easily now.)  
This is handled by a "morerows" annotation on the name entry, which  
isn't perfect (notably, the toolchain is not smart enough to avoid  
breaking these row groups across PDF pages) but there seems no better  
solution in DocBook.  The name column is normally fairly narrow,  
allowing plenty of space for the other column(s), and not wasting too  
much space when one of the other components runs to multiple lines.  
  
The varying row layout is managed by defining named "spans" and then  
tagging entries with a "spanname" of "name", "sig", "desc", "example",  
or "exresult".  This provides a bit of semantic annotation to go with  
the formatting improvement, which seems like a good thing.  (It seems  
that we have to re-define these spans afresh for each table, which is  
annoying, but it's not any worse than the duplication involved in  
the table headers.  At least that gives us an opportunity to vary the  
relative column widths per-table, which is handy since function tables  
sometimes need much wider name columns than operator tables.)  
  
Signature entries should be written in the style  
    <function>fname</function>(<type>typename</type> ...)  
    <returnvalue>typename</returnvalue>  
The <returnvalue> tag produces a right arrow before the result type  
name.  (I'll document that convention in a user-visible place later.)  
  
While this provides significantly more horizontal space than before  
for examples, it's still true that PDF output is a lot narrower than  
typical webpage viewing windows, so some examples need to be broken  
in places where there is no whitespace.  I've added &zwsp; markers in  
suitable places to allow the tables to render warning-free in PDF.  
  
I've so far converted only the date/time operator, date/time function,  
and enum function tables in sections 9.9 and 9.10; these were chosen  
to provide a reasonable sample of the formatting problems that need  
to be solved.  Assuming that this looks good on the website and doesn't  
provoke howls of anguish, I'll work on the other similar tables in the  
near future.  
  
There's a moderate amount of new editorial content in this patch along  
with the raw formatting changes; for instance I had to write text  
descriptions for operators that lacked them.  I failed to resist the  
temptation to improve some other descriptions and examples, too.  
  
Patch by me, with thanks to Alexander Lakhin for assistance with  
figuring out some formatting issues.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/stylesheet-common.xsl
M doc/src/sgml/stylesheet-fo.xsl

Doc: introduce and document "&zwsp;" for allowing optional line breaks.

commit   : 88d934f0387a66ba372643913f99e845d0ea144a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Apr 2020 14:03:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Apr 2020 14:03:24 -0400    

Click here for diff

We already had a couple of places using zero-width spaces for formatting  
hackery, and we're going to need more if we ever want the PDF manuals to  
look decent.  But please let's not write hard-coded Unicode escapes.  
We can avoid that by using a custom entity, which also provides a place  
to put a teeny bit of documentation about what it is and how to use it.  
  
I'd previously posted a patch using "&break;" for this, but on reflection  
that would be horrible to grep for.  Instead let's use "&zwsp;", based  
on the name of the Unicode symbol ("zero width space").  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/postgres.sgml

Rename pg_validatebackup to pg_verifybackup.

commit   : dbc60c5593f26dc777a3be032bff4fb4eab1ddd1    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 12 Apr 2020 11:26:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 12 Apr 2020 11:26:05 -0400    

Click here for diff

Also, use "verify" rather than "validate" to refer to the process  
being undertaken here. Per discussion, that is a more appropriate  
term.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Discussion: http://postgr.es/m/CA+TgmobLgMh6p8FmLbj_rv9Uhd7tPrLnAyLgGd2SoSj=qD-bVg@mail.gmail.com  

M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
R082 doc/src/sgml/ref/pg_validatebackup.sgml doc/src/sgml/ref/pg_verifybackup.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
D src/bin/pg_validatebackup/.gitignore
A src/bin/pg_verifybackup/.gitignore
R053 src/bin/pg_validatebackup/Makefile src/bin/pg_verifybackup/Makefile
R099 src/bin/pg_validatebackup/parse_manifest.c src/bin/pg_verifybackup/parse_manifest.c
R096 src/bin/pg_validatebackup/parse_manifest.h src/bin/pg_verifybackup/parse_manifest.h
R089 src/bin/pg_validatebackup/pg_validatebackup.c src/bin/pg_verifybackup/pg_verifybackup.c
R055 src/bin/pg_validatebackup/t/001_basic.pl src/bin/pg_verifybackup/t/001_basic.pl
R085 src/bin/pg_validatebackup/t/002_algorithm.pl src/bin/pg_verifybackup/t/002_algorithm.pl
R095 src/bin/pg_validatebackup/t/003_corruption.pl src/bin/pg_verifybackup/t/003_corruption.pl
R074 src/bin/pg_validatebackup/t/004_options.pl src/bin/pg_verifybackup/t/004_options.pl
R097 src/bin/pg_validatebackup/t/005_bad_manifest.pl src/bin/pg_verifybackup/t/005_bad_manifest.pl
R079 src/bin/pg_validatebackup/t/006_encoding.pl src/bin/pg_verifybackup/t/006_encoding.pl
R081 src/bin/pg_validatebackup/t/007_wal.pl src/bin/pg_verifybackup/t/007_wal.pl

Doc: Fix contrib/amcheck tip.

commit   : 26640c40715c7f2045cf1b7c6753cac40b64d1e8    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 11 Apr 2020 21:07:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 11 Apr 2020 21:07:20 -0700    

Click here for diff

Fixes an oversight in commit 20fbb711.  

M doc/src/sgml/amcheck.sgml

Suppress -Wimplicit-fallthrough warning in new LIMIT WITH TIES code.

commit   : 35cb574aa84723f4661e9fc51340130e64cb5dfc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Apr 2020 15:02:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Apr 2020 15:02:38 -0400    

Click here for diff

The placement of the fall-through comment in this code appears not to  
work to suppress the warning in recent gcc.  Move it to the bottom of  
the case group, and add an assertion that we didn't get there through  
some other code path.  Also improve wording of nearby comments.  
  
Julien Rouhaud, comment hacking by me  
  
Discussion: https://postgr.es/m/CAOBaU_aLdPGU5wCpaowNLF-Q8328iR7mj1yJAhMOVsdLwY+sdg@mail.gmail.com  

M src/backend/executor/nodeLimit.c

Optimize RelationFindReplTupleSeq() for CLOBBER_CACHE_ALWAYS.

commit   : 328c70997bc3518a50bd9a8ff33de349a7223413    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 11 Apr 2020 10:30:12 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 11 Apr 2020 10:30:12 -0700    

Click here for diff

Specifically, remember lookup_type_cache() results instead of retrieving  
them once per comparison.  Under CLOBBER_CACHE_ALWAYS, this reduced  
src/test/subscription/t/001_rep_changes.pl elapsed time by an order of  
magnitude, which reduced check-world elapsed time by 9%.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execReplication.c

When WalSndCaughtUp, sleep only in WalSndWaitForWal().

commit   : 421685812290406daea58b78dfab0346eb683bbb    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 11 Apr 2020 10:30:00 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 11 Apr 2020 10:30:00 -0700    

Click here for diff

Before sleeping, WalSndWaitForWal() sends a keepalive if MyWalSnd->write  
< sentPtr.  That is important in logical replication.  When the latest  
physical LSN yields no logical replication messages (a common case),  
that keepalive elicits a reply, and processing the reply updates  
pg_stat_replication.replay_lsn.  WalSndLoop() lacks that; when  
WalSndLoop() slept, replay_lsn advancement could stall until  
wal_receiver_status_interval elapsed.  This sometimes stalled  
src/test/subscription/t/001_rep_changes.pl for up to 10s.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Make EXPLAIN report maximum hashtable usage across multiple rescans.

commit   : 969f9d0b4ba574bb8df65683dbf7a09c030f3e67    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Apr 2020 12:39:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Apr 2020 12:39:19 -0400    

Click here for diff

Before discarding the old hash table in ExecReScanHashJoin, capture  
its statistics, ensuring that we report the maximum hashtable size  
across repeated rescans of the hash input relation.  We can repurpose  
the existing code for reporting hashtable size in parallel workers  
to help with this, making the patch pretty small.  This also ensures  
that if rescans happen within parallel workers, we get the correct  
maximums across all instances.  
  
Konstantin Knizhnik and Tom Lane, per diagnosis by Thomas Munro  
of a trouble report from Alvaro Herrera.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/include/executor/nodeHash.h
M src/include/nodes/execnodes.h

Clear dangling pointer to avoid bogus EXPLAIN printout in a corner case.

commit   : 5c27bce7f39ded1f027475221b732bbbc31a2bfe    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Apr 2020 12:29:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Apr 2020 12:29:06 -0400    

Click here for diff

ExecReScanHashJoin will destroy the join's hash table if it expects  
that the inner relation will produce different rows on rescan.  
Up to now it's not bothered to clear the additional pointer to that  
hash table that exists in the child HashState node.  However, it's  
possible for the query to terminate without building a fresh hash  
table (this happens if the outer relation is found to be empty  
during the final rescan).  So we can end with a dangling pointer  
to a deleted hash table.  That was harmless originally, but since  
9.0 EXPLAIN ANALYZE has used that pointer to print hash table  
statistics.  In debug builds this reproducibly results in garbage  
statistics.  In non-debug builds there's frequently no ill effects,  
but in principle one could get wrong EXPLAIN ANALYZE output, or  
perhaps even a crash if free() has released the hashtable memory  
back to the OS.  
  
To fix, just make sure we clear the additional pointer when destroying  
the hash table.  In problematic cases, EXPLAIN ANALYZE will then print  
no hashtable statistics (reverting to its pre-9.0 behavior).  This isn't  
ideal, but since the problem manifests only in unusual corner cases,  
it's hard to justify taking any risks to do better in the back  
branches.  A follow-on patch will improve matters in HEAD.  
  
Konstantin Knizhnik and Tom Lane, per diagnosis by Thomas Munro  
of a trouble report from Alvaro Herrera.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeHashjoin.c

Fix RELCACHE_FORCE_RELEASE issue

commit   : 12fb189bfeaf03faea5b6f15544c1f71e9ef4677    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 11 Apr 2020 15:07:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 11 Apr 2020 15:07:25 +0200    

Click here for diff

Introduced by 83fd4532a72179c370e318075a10e0e2aa832024.  To fix, the  
tuple descriptors need to be copied into the current memory context.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/replication/pgoutput/pgoutput.c

Fix relcache reference leak

commit   : 5a1d0c9925fbda9ec434061dee74b1b5d9a16038    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 11 Apr 2020 09:44:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 11 Apr 2020 09:44:14 +0200    

Click here for diff

Introduced by 83fd4532a72179c370e318075a10e0e2aa832024  

M src/backend/catalog/pg_publication.c

doc: restore intentional typo

commit   : 8a47b775a16fb4f1e154c0f319a030498e123164    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 11 Apr 2020 08:04:57 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 11 Apr 2020 08:04:57 +0100    

Click here for diff

Commit ac8623760 "fixed" a typo in an example of what would happen in  
the event of a typo. Restore the original typo and add a comment about  
its intentionality. Backpatch to 12 where the error was introduced.  
  
Per report from irc user Nicolás Alvarez.  

M doc/src/sgml/protocol.sgml

Add contrib/amcheck debug message.

commit   : 20fbb711ef43ef70093378ff5efdf1b6e8cc10d8    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 10 Apr 2020 17:44:08 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 10 Apr 2020 17:44:08 -0700    

Click here for diff

Add a DEBUG1 message indicating that verification of the index structure  
is underway.  Also reduce the severity level of the existing "tree  
level" debug message to DEBUG1.  It should never have been made DEBUG2.  
Any B-Tree index with more than a couple of levels will generally also  
have so many pages that the per-page DEBUG2 messages will become  
completely unmanageable.  
  
In passing, add a new "Tip" to the docs that advises users that run into  
corruption that the debug messages might provide useful additional  
context.  

M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml

Doc: clarify locking requirements for ALTER TABLE ADD FOREIGN KEY.

commit   : f333d35428c1cba8d35065b6dbb2dd46e18bd929    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Apr 2020 13:12:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Apr 2020 13:12:58 -0400    

Click here for diff

The docs explained that a SHARE ROW EXCLUSIVE lock is needed on the  
referenced table, but failed to say the same about the table being  
altered.  Since the page says that ACCESS EXCLUSIVE lock is taken  
unless otherwise stated, this left readers with the wrong conclusion.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Suppress unused-variable warning.

commit   : 401418ca6a689f772cbfa1aedc7485cbbcde7a94    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Apr 2020 12:00:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Apr 2020 12:00:28 -0400    

Click here for diff

Ashutosh Bapat  
  
Discussion: https://postgr.es/m/CAG-ACPWPB8Lc_aFj25eiPFqi31YB5vmaZnb39mbHSf5Yej=miA@mail.gmail.com  

M src/backend/partitioning/partbounds.c

Doc: sync CREATE GROUP syntax synopsis with CREATE ROLE.

commit   : 7c91e9055d254524d76a72b35a919b8ff9931802    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Apr 2020 10:44:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Apr 2020 10:44:09 -0400    

Click here for diff

CREATE GROUP is an exact alias for CREATE ROLE, and CREATE USER is  
almost an exact alias, as can easily be confirmed by checking the  
code.  So the man page syntax descriptions ought to match up.  The  
last few additions of role options seem to have forgotten to update  
create_group.sgml, though.  Fix that, and add a naggy reminder to  
create_role.sgml in hopes of not forgetting again.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_group.sgml
M doc/src/sgml/ref/create_role.sgml

Fix collection of typos and grammar mistakes in the tree

commit   : dd0f37eccecc2db5c0ffafefbf697a2c916e8bc3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 Apr 2020 11:18:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 Apr 2020 11:18:39 +0900    

Click here for diff

This fixes some comments and documentation new as of Postgres 13.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/btree.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/ref/pg_validatebackup.sgml
M src/backend/commands/tablecmds.c
M src/backend/executor/execExpr.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/basebackup.c
M src/include/lib/simplehash.h

Further stabilize results of 019_replslot_limit.pl.

commit   : e083fa34ced0d53807a57482048bb4c135c3d006    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 17:28:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 17:28:58 -0400    

Click here for diff

Depending on specific values of restart_lsn or pg_current_wal_lsn()  
is obviously unsafe.  The previous coding tried to dodge this issue  
by rounding off, but that's not good enough, as shown by multiple  
buildfarm members.  Nuke all the uses of these values except for  
null-ness checks, pending some credible argument why we should think  
something else could be usefully stable.  
  
Kyotaro Horiguchi, further modified by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Further cleanup of ts_headline code.

commit   : 2e0e409e3cbab4f4ac01a6f70931817cfd2bdcb1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 15:38:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 15:38:43 -0400    

Click here for diff

Suppress a probably-meaningless uninitialized-variable warning  
(induced by my previous patch, I'm sorry to say).  
  
Improve mark_hl_fragments()'s test for overlapping cover strings:  
it failed to consider the possibility that the current string is  
strictly within another one.  That's unlikely given the preceding  
splitting into MaxWords fragments, but I don't think it's impossible.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/wparser_def.c

Doc: improve documentation about ts_headline() function.

commit   : a4d4f59196ea8745fe4c048085d6d2bd66e8e7d8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 15:11:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 15:11:08 -0400    

Click here for diff

Now that I've had my nose in that code, I thought the docs about  
it left something to be desired.  

M doc/src/sgml/textsearch.sgml

Fix default text search parser's ts_headline code for phrase queries.

commit   : c9b0c678d30aa3f6bbf996ea15af8acbfcfb2ac8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 13:19:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 13:19:23 -0400    

Click here for diff

This code could produce very poor results when asked to highlight a  
string based on a query using phrase-match operators.  The root cause  
is that hlCover(), which is supposed to find a minimal substring that  
matches the query, was written assuming that word position is not  
significant.  I'm only 95% convinced that its algorithm was correct even  
for plain AND/OR queries; but it definitely fails completely for phrase  
matches, causing it to possibly not identify a cover string at all.  
  
Hence, rewrite hlCover() with a less-tense algorithm that just tries  
all the possible substrings, earlier and shorter ones first.  (This is  
not as bad as it sounds performance-wise, because all of the string  
matching has been done already: the repeated tsquery match checks  
boil down to pointer comparisons.)  
  
Unfortunately, since that approach produces more candidate cover  
strings than before, it also exposes that there were bugs in the  
heuristics in mark_hl_words() for selecting a best cover string.  
Fixes there include:  
* Do not apply the ShortWord filter to words that appear in the query.  
* Remove a misguided optimization for quickly rejecting a cover.  
* Fix order-of-operation bug that could cause computation of a  
wrong figure of merit (poslen) when shortening a cover.  
* Change the preference rule so that candidate headlines that do not  
include their whole cover string (after MaxWords trimming) are lowest  
priority, since they may not actually satisfy the user's query.  
  
This results in some changes in existing regression test cases,  
but they all seem reasonable.  Note in particular that the tests  
involving strings like "1 2 3" were previously being affected by  
the ShortWord filter, masking the normal matching behavior.  
  
Per bug #16345 from Augustinas Jokubauskas; the new test cases are  
based on that example.  Back-patch to 9.6 where phrase search was  
added to tsquery.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Cosmetic improvements for default text search parser's ts_headline code.

commit   : b10f8bb9fd39da44efd411aec5c643b92bd23676    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 12:36:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Apr 2020 12:36:59 -0400    

Click here for diff

This code was woefully unreadable and under-commented.  Try to improve  
matters by adding comments, using some macros to make complicated  
if-tests more readable, using boolean type where appropriate, etc.  
There are a couple of tiny coding improvements too, but this commit  
includes (I hope) no behavioral change.  
  
Nonetheless, back-patch as far as 9.6, because a followup bug-fixing  
commit depends on this.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/wparser_def.c

Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue

commit   : e92e4a2b68fe877677278c1300db1780956c984e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Apr 2020 16:17:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Apr 2020 16:17:55 +0200    

Click here for diff

CREATE TABLE LIKE INCLUDING GENERATED would fail if a generated column  
referred to a column with a higher attribute number.  This is because  
the column mapping mechanism created the mapping incrementally as  
columns are added.  This was sufficient for previous uses of that  
mechanism (omitting dropped columns), and it also happened to work if  
generated columns only referred to columns with lower attribute  
numbers, but here it failed.  
  
This fix is to build the attribute mapping in a separate loop before  
processing the columns in detail.  
  
Bug: #16342  
Reported-by: Ethan Waldo <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/sql/create_table_like.sql

Fix typo in pg_validatebackup documentation.

commit   : c4f82a779d2676bfca1694a6f9b5499e6cc5f60f    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Apr 2020 22:38:24 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Apr 2020 22:38:24 +0900    

Click here for diff

Author: Fujii Masao  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_validatebackup.sgml

Exclude backup_manifest file that existed in database, from BASE_BACKUP.

commit   : 1ec50a81ec0acd452c7520de19e607a6de8fba5e    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Apr 2020 22:37:11 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Apr 2020 22:37:11 +0900    

Click here for diff

If there is already a backup_manifest file in the database cluster,  
it belongs to the past backup that was used to start this server.  
It is not correct for the backup being taken now. So this commit  
changes pg_basebackup so that it always skips such backup_manifest  
file. The backup_manifest file for the current backup will be injected  
separately if users want it.  
  
Author: Fujii Masao  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/basebackup.c
M src/bin/pg_rewind/filemap.c

Allow parallel create index to accumulate buffer usage stats.

commit   : 5c71362174eb56676f8b91c73ec066dd5513fd4b    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 9 Apr 2020 09:49:30 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 9 Apr 2020 09:49:30 +0530    

Click here for diff

Currently, we don't account for buffer usage incurred by parallel workers  
for parallel create index.  This commit allows each worker to record the  
buffer usage stats and leader backend to accumulate that stats at the  
end of the operation.  This will allow pg_stat_statements to display  
correct buffer usage stats for (parallel) create index command.  
  
Reported-by: Julien Rouhaud  
Author: Sawada Masahiko  
Reviewed-by: Dilip Kumar, Julien Rouhaud and Amit Kapila  
Backpatch-through: 11, where this was introduced  
Discussion: https://postgr.es/m/20200328151721.GB12854@nol  

M src/backend/access/nbtree/nbtsort.c
M src/backend/executor/instrument.c

Add note in pg_stat_statements documentation about planning statistics.

commit   : 58ad961f19f7eca26e6d60eb07adcffeafd0082e    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Apr 2020 12:56:36 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Apr 2020 12:56:36 +0900    

Click here for diff

The added note explains that the numbers of planning and execution in  
the statement are not always expected to match because their statistics are  
updated at their respective end phase, and only for successful operations.  
  
Author: Pascal Legrand, Julien Rouhaud, tweaked a bit by Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgstatstatements.sgml

Msys2 tweaks for pg_validatebackup corruption test

commit   : c3e4cbaab936a17b579d85c5ff28bcb2251736d0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 8 Apr 2020 17:50:55 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 8 Apr 2020 17:50:55 -0400    

Click here for diff

1. Tell Msys2 not to mangle the tablespace map parameter  
2. If rmdir doesn't work, fall back to trying unlink on the entry in  
   pg_tblspc.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_validatebackup/t/003_corruption.pl

createuser: Change a fprintf to pg_log_error

commit   : f45b8e51b6838ab820df13983c194f737be48778    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Apr 2020 19:19:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Apr 2020 19:19:45 +0200    

Click here for diff

M src/bin/scripts/createuser.c

Stabilize incremental_sort tests

commit   : cea09246e57821b8a97a6483a7df6c7345b055ef    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 8 Apr 2020 18:30:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 8 Apr 2020 18:30:11 +0200    

Click here for diff

The test never did ANALYZE on the test table, so the plans depended on  
various defaults (e.g. number of groups being 200). This worked most of  
the time, but with CLOBBER_CACHE_ALWAYS the autoanalyze often managed  
to build accurate stats, changing the  plan.  
  
Fixed by increasing the size of test tables a bit, making the Sort a bit  
more expensive than Incremental Sort. The tests were constructed to test  
transitions in the Incremental Sort algorithm, and this change does not  
break that.  
  
Reviewed-by: James Coleman  
Discussion: https://postgr.es/m/CAPpHfds1waRZ=NOmueYq0sx1ZSCnt+5QJvizT8ndT2=etZEeAQ@mail.gmail.com  

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

Fix pg_dump/pg_restore to restore event trigger comments later.

commit   : a9d70c108786712a1023c65e360602edf7bafbf4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Apr 2020 11:23:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Apr 2020 11:23:39 -0400    

Click here for diff

Repair an oversight in commit 8728b2c70: if we're postponing restore  
of event triggers to the end, we must also postpone restoring any  
comments on them, since of course we cannot create the comments first.  
(This opens yet another opportunity for an event trigger to bollix  
the restore, but there's no help for that.)  
  
Per bug #16346 from Alexander Lakhin.  
  
Like the previous commit, back-patch to all supported branches.  
  
Hamid Akhtar and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup_archiver.c

Rationalize GetWalRcv{Write,Flush}RecPtr().

commit   : d140f2f3e225ea53e2d92ab6833b8c186c90666c    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 8 Apr 2020 23:45:09 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 8 Apr 2020 23:45:09 +1200    

Click here for diff

GetWalRcvWriteRecPtr() previously reported the latest *flushed*  
location.  Adopt the conventional terminology used elsewhere in the tree  
by renaming it to GetWalRcvFlushRecPtr(), and likewise for some related  
variables that used the term "received".  
  
Add a new definition of GetWalRcvWriteRecPtr(), which returns the latest  
*written* value.  This will allow later patches to use the value for  
non-data-integrity purposes, without having to wait for the flush  
pointer to advance.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/replication/README
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/include/replication/walreceiver.h

Allow publishing partition changes via ancestors

commit   : 83fd4532a72179c370e318075a10e0e2aa832024    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Apr 2020 09:59:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Apr 2020 09:59:27 +0200    

Click here for diff

To control whether partition changes are replicated using their own  
identity and schema or an ancestor's, add a new parameter that can be  
set per publication named 'publish_via_partition_root'.  
  
This allows replicating a partitioned table into a different partition  
structure on the subscriber.  
  
Author: Amit Langote <[email protected]>  
Reviewed-by: Rafia Sabih <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_publication.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
M src/test/subscription/t/013_partition.pl

Revert 0f5ca02f53

commit   : 1aac32df89eb19949050f6f27c268122833ad036    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 8 Apr 2020 11:37:27 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 8 Apr 2020 11:37:27 +0300    

Click here for diff

0f5ca02f53 introduces 3 new keywords.  It appears to be too much for relatively  
small feature.  Given now we past feature freeze, it's already late for  
discussion of the new syntax.  So, revert.  
  
Discussion: https://postgr.es/m/28209.1586294824%40sss.pgh.pa.us  

M doc/src/sgml/ref/begin.sgml
M doc/src/sgml/ref/start_transaction.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/Makefile
D src/backend/commands/wait.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/misc.c
D src/include/commands/wait.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/utils/timestamp.h
D src/test/recovery/t/020_begin_wait.pl
M src/tools/pgindent/typedefs.list

Modify additional power 2 calculations to use new helper functions

commit   : 02a2e8b442002a698336954633b0ccc4e30061e6    
  
author   : David Rowley <[email protected]>    
date     : Wed, 8 Apr 2020 18:29:51 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 8 Apr 2020 18:29:51 +1200    

Click here for diff

2nd pass of modifying various places which obtain the next power  
of 2 of a number and make them use the new functions added in  
f0705bb62.  
  
In passing, also modify num_combinations(). This can be implemented  
using simple bitshifting rather than looping.  
  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/20200114173553.GE32763%40fetter.org  

M src/backend/access/gin/ginfast.c
M src/backend/executor/nodeHash.c
M src/backend/nodes/list.c
M src/backend/statistics/mvdistinct.c
M src/backend/utils/adt/arrayfuncs.c

Fix crash when using COLLATE in partition bound expressions

commit   : c0187869a0f6eb05135d388462522a593ced1b88    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Apr 2020 15:04:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Apr 2020 15:04:51 +0900    

Click here for diff

Attempting to use a COLLATE clause with a type that it not collatable in  
a partition bound expression could crash the server.  This commit fixes  
the code by adding more checks similar to what is done when computing  
index or partition attributes by making sure that there is a collation  
iff the type is collatable.  
  
Backpatch down to 12, as 7c079d7 introduced this problem.  
  
Reported-by: Alexander Lakhin  
Author: Dmitry Dolgov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Modify various power 2 calculations to use new helper functions

commit   : d025cf88ba5a64487ee4a17ef23e8f55b1536606    
  
author   : David Rowley <[email protected]>    
date     : Wed, 8 Apr 2020 16:55:03 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 8 Apr 2020 16:55:03 +1200    

Click here for diff

First pass of modifying various places that obtain the next power of 2 of  
a number and make them use the new functions added in pg_bitutils.h  
instead.  
  
This also removes the _hash_log2() function. There are no longer any  
callers in core. Other users can swap their _hash_log2(n) call to make use  
of pg_ceil_log2_32(n).  
  
Author: David Fetter, with some minor adjustments by me  
Reviewed-by: John Naylor, Jesse Zhang  
Discussion: https://postgr.es/m/20200114173553.GE32763%40fetter.org  

M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/utils/hash/dynahash.c
M src/include/access/hash.h
M src/include/lib/simplehash.h
M src/include/port/pg_bitutils.h

Create memory context for HashAgg with a reasonable maxBlockSize.

commit   : 50a38f65177ea7858bc97f71ba0757ba04c1c167    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 7 Apr 2020 20:42:04 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 7 Apr 2020 20:42:04 -0700    

Click here for diff

If the memory context's maxBlockSize is too big, a single block  
allocation can suddenly exceed work_mem. For Hash Aggregation, this  
can mean spilling to disk too early or reporting a confusing memory  
usage number for EXPLAN ANALYZE.  
  
Introduce CreateWorkExprContext(), which is like CreateExprContext(),  
except that it creates the AllocSet with a maxBlockSize that is  
reasonable in proportion to work_mem.  
  
Right now, CreateWorkExprContext() is only used by Hash Aggregation,  
but it may be generally useful in the future.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/include/executor/executor.h

Add functions to calculate the next power of 2

commit   : f0705bb6286d8a24e08ddd99641264ba947ebd03    
  
author   : David Rowley <[email protected]>    
date     : Wed, 8 Apr 2020 16:22:52 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 8 Apr 2020 16:22:52 +1200    

Click here for diff

There are many areas in the code where we need to determine the next  
highest power of 2 of a given number.  We tend to always do that in an  
ad-hoc way each time, generally with some tight for loop which performs a  
bitshift left once per loop and goes until it finds a number above the  
given number.  
  
Here we add two generic functions which make use of the existing  
pg_leftmost_one_pos* functions which, when available, will allow us to  
calculate the next power of 2 without any looping.  
  
Here we don't add any code which uses these new functions. That will be  
done in follow-up commits.  
  
Author: David Fetter, with some minor adjustments by me  
Reviewed-by: John Naylor, Jesse Zhang  
Discussion: https://postgr.es/m/20200114173553.GE32763%40fetter.org  

M src/include/port/pg_bitutils.h

Put back mistakenly removed #include.

commit   : 7a5d74b7dd4b1324e8a8fff4086d51d4f43b1721    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Apr 2020 00:10:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Apr 2020 00:10:16 -0400    

Click here for diff

In commit 4dbcb3f84 I removed some code from parse_coerce.c, and also  
removed some apparently-no-longer-needed #includes.  But removing  
datum.h broke some not-compiled-by-default code.  
  
Discussion: https://postgr.es/m/20200407205436.pyjhddw5bn5upvsu@development  

M src/backend/parser/parse_coerce.c

Remove testing for precise LSN/reserved bytes in new TAP test

commit   : 9e9abed746280086474e2191b8c399b5fd9b0678    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2020 19:16:37 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2020 19:16:37 -0400    

Click here for diff

Trying to ensure that a slot's restart_lsn or amount of reserved bytes  
exactly match some specific values seems unnecessary, and fragile as  
shown by failures in multiple buildfarm members.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Support PrefetchBuffer() in recovery.

commit   : 3985b600f57d75b9743d86430cb5c21370057a23    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 8 Apr 2020 13:36:45 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 8 Apr 2020 13:36:45 +1200    

Click here for diff

Provide PrefetchSharedBuffer(), a variant that takes SMgrRelation, for  
use in recovery.  Rename LocalPrefetchBuffer() to PrefetchLocalBuffer()  
for consistency.  
  
Add a return value to all of these.  In recovery, tolerate and report  
missing files, so we can handle relations unlinked before crash recovery  
began.  Also report cache hits and misses, so that callers can do faster  
buffer lookups and better I/O accounting.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com  

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

Allow partitionwise join to handle nested FULL JOIN USING cases.

commit   : 981643dcdb70b6ce70d8a08417f71f465f236cb5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2020 22:12:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2020 22:12:14 -0400    

Click here for diff

This case didn't work because columns merged by FULL JOIN USING are  
represented in the parse tree by COALESCE expressions, and the logic  
for recognizing a partitionable join failed to match upper-level join  
clauses to such expressions.  To fix, synthesize suitable COALESCE  
expressions and add them to the nullable_partexprs lists.  This is  
pretty ugly and brute-force, but it gets the job done.  (I have  
ambitions of rethinking the way outer-join output Vars are  
represented, so maybe that will provide a cleaner solution someday.  
For now, do this.)  
  
Amit Langote, reviewed by Justin Pryzby, Richard Guo, and myself  
  
Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com  

M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Allow partitionwise joins in more cases.

commit   : c8434d64ce03c32e0029417a82ae937f2055268f    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 8 Apr 2020 10:25:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 8 Apr 2020 10:25:00 +0900    

Click here for diff

Previously, the partitionwise join technique only allowed partitionwise  
join when input partitioned tables had exactly the same partition  
bounds.  This commit extends the technique to some cases when the tables  
have different partition bounds, by using an advanced partition-matching  
algorithm introduced by this commit.  For both the input partitioned  
tables, the algorithm checks whether every partition of one input  
partitioned table only matches one partition of the other input  
partitioned table at most, and vice versa.  In such a case the join  
between the tables can be broken down into joins between the matching  
partitions, so the algorithm produces the pairs of the matching  
partitions, plus the partition bounds for the join relation, to allow  
partitionwise join for computing the join.  Currently, the algorithm  
works for list-partitioned and range-partitioned tables, but not  
hash-partitioned tables.  See comments in partition_bounds_merge().  
  
Ashutosh Bapat and Etsuro Fujita, most of regression tests by Rajkumar  
Raghuwanshi, some of the tests by Mark Dilger and Amul Sul, reviewed by  
Dmitry Dolgov and Amul Sul, with additional review at various points by  
Ashutosh Bapat, Mark Dilger, Robert Haas, Antonin Houska, Amit Langote,  
Justin Pryzby, and Tomas Vondra  
  
Discussion: https://postgr.es/m/CAFjFpRdjQvaUEV5DJX3TW6pU5eq54NCkadtxHX2JiJG_GvbrCA@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/relnode.c
M src/backend/partitioning/partbounds.c
M src/include/nodes/pathnodes.h
M src/include/partitioning/partbounds.h
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Fix circle_in to accept "(x,y),r" as it's advertised to do.

commit   : 41a194f49177daf9348bfde2c42e85b806dcee31    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2020 20:50:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2020 20:50:02 -0400    

Click here for diff

Our documentation describes four allowed input syntaxes for circles,  
but the regression tests tried only three ... with predictable  
consequences.  Remarkably, this has been wrong since the circle  
datatype was added in 1997, but nobody noticed till now.  
  
David Zhang, with some help from me  
  
Discussion: https://postgr.es/m/[email protected]  

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

snapshot scalability: Move delayChkpt from PGXACT to PGPROC.

commit   : 75848bc74411130ede23995d0ab1aefb12c4c4b0    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Apr 2020 17:36:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Apr 2020 17:36:23 -0700    

Click here for diff

The goal of separating hotly accessed per-backend data from PGPROC  
into PGXACT is to make accesses fast (GetSnapshotData() in  
particular). But delayChkpt is not actually accessed frequently; only  
when starting a checkpoint. As it is frequently modified (multiple  
times in the course of a single transaction), storing it in the same  
cacheline as hotly accessed data unnecessarily dirties a contended  
cacheline.  
  
Therefore move delayChkpt to PGPROC.  
  
This is part of a larger series of patches intending to improve  
GetSnapshotData() scalability. It is committed and pushed separately,  
as it is independently beneficial (small but measurable win, limited  
by the other frequent modifications of PGXACT).  
  
Author: Andres Freund  
Reviewed-By: Robert Haas, Thomas Munro, David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xloginsert.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

Track SLRU page hits in SimpleLruReadPage_ReadOnly

commit   : 2b88fdde30d8e9bf833b75a014189e9148233b85    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 8 Apr 2020 02:06:00 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 8 Apr 2020 02:06:00 +0200    

Click here for diff

SLRU page hits were tracked only in SimpleLruReadPage, but that's not  
enough because we may hit the page in SimpleLruReadPage_ReadOnly in  
which case we don't call SimpleLruReadPage at all.  
  
Reported-by: Kuntal Ghosh  
Discussion: https://postgr.es/m/20200119143707.gyinppnigokesjok@development  

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

Fix XLogReader FD leak that makes backends unusable after 2PC usage.

commit   : 91c40548d5f7a9241d9fa344fae8069cfdb92bf2    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 6 Apr 2020 21:28:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 6 Apr 2020 21:28:55 -0700    

Click here for diff

Before the fix every 2PC commit/abort leaked a file descriptor. As the  
files are opened using BasicOpenFile(), that quickly leads to the  
backend running out of file descriptors.  
  
Once enough 2PC abort/commit have caused enough FDs to leak, any IO  
in the backend will fail with "Too many open files", as  
BasicOpenFilePerm() will have triggered all open files known to fd.c  
to be closed.  
  
The leak causing the problem at hand is a consequence of 0dc8ead46,  
but is only exascerbated by it. Previously most XLogPageReadCB  
callbacks used static variables to cache one open file, but after the  
commit the cache is private to each XLogReader instance. There never  
was infrastructure to close FDs at the time of XLogReaderFree, but the  
way XLogReader was used limited the leak to one FD.  
  
This commit just closes the during XLogReaderFree() if the FD is  
stored in XLogReaderState.seg.ws_segno. This may not be the way to  
solve this medium/long term, but at least unbreaks 2PC.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Appease perlcritic

commit   : 7e2ffb3885007183af7b161e046e126be2cfba12    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2020 18:58:19 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2020 18:58:19 -0400    

Click here for diff

Food for the gods must always be found somehow, even when the land starves.  

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

Remove nbtree BTreeTupleSetAltHeapTID() function.

commit   : 60cbd7751c1ec6ffdf2ffc520ddeb35cb2f2ed70    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 7 Apr 2020 15:56:52 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 7 Apr 2020 15:56:52 -0700    

Click here for diff

Since heap TID is supposed to be just another key attribute to the  
implementation, it doesn't make much sense to have separate  
BTreeTupleSetNAtts() and BTreeTupleSetAltHeapTID() functions.  Merge the  
two functions together.  This slightly simplifies _bt_truncate().  

M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Allow users to limit storage reserved by replication slots

commit   : c6550776394e25c1620bc8258427c8f1d448080d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2020 18:35:00 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2020 18:35:00 -0400    

Click here for diff

Replication slots are useful to retain data that may be needed by a  
replication system.  But experience has shown that allowing them to  
retain excessive data can lead to the primary failing because of running  
out of space.  This new feature allows the user to configure a maximum  
amount of space to be reserved using the new option  
max_slot_wal_keep_size.  Slots that overrun that space are invalidated  
at checkpoint time, enabling the storage to be released.  
  
Author: Kyotaro HORIGUCHI <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Jehan-Guillaume de Rorthais <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
A src/test/recovery/t/019_replslot_limit.pl
M src/test/regress/expected/rules.out

Allow psql's \g and \gx commands to transiently change \pset options.

commit   : b63c293bcbd7439f883cd4cf748f6755df0fbb3c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2020 17:46:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2020 17:46:29 -0400    

Click here for diff

We invented \gx to allow the "\pset expanded" flag to be forced on  
for the duration of one command output, but that turns out to not  
be nearly enough to satisfy the demand for variant output formats.  
Hence, make it possible to change any pset option(s) for the duration  
of a single command output, by writing "option=value ..." inside  
parentheses, for example  
	\g (format=csv csv_fieldsep='\t') somefile  
  
\gx can now be understood as a shorthand for including expanded=on  
inside the parentheses.  
  
Patch by me, expanding on a proposal by Pavel Stehule  
  
Discussion: https://postgr.es/m/CAFj8pRBx9OnBPRJVtfA5ycUpySge-XootAXAsv_4rrkHxJ8eRg@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Implement waiting for given lsn at transaction start

commit   : 0f5ca02f53ac2b211d8518f0882c49284c0c9610    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 7 Apr 2020 23:51:10 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 7 Apr 2020 23:51:10 +0300    

Click here for diff

This commit adds following optional clause to BEGIN and START TRANSACTION  
commands.  
  
  WAIT FOR LSN lsn [ TIMEOUT timeout ]  
  
New clause pospones transaction start till given lsn is applied on standby.  
This clause allows user be sure, that changes previously made on primary would  
be visible on standby.  
  
New shared memory struct is used to track awaited lsn per backend.  Recovery  
process wakes up backend once required lsn is applied.  
  
Author: Ivan Kartyshov, Anna Akenteva  
Reviewed-by: Craig Ringer, Thomas Munro, Robert Haas, Kyotaro Horiguchi  
Reviewed-by: Masahiko Sawada, Ants Aasma, Dmitry Ivanov, Simon Riggs  
Reviewed-by: Amit Kapila, Alexander Korotkov  
Discussion: https://postgr.es/m/0240c26c-9f84-30ea-fca9-93ab2df5f305%40postgrespro.ru  

M doc/src/sgml/ref/begin.sgml
M doc/src/sgml/ref/start_transaction.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/Makefile
A src/backend/commands/wait.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/misc.c
A src/include/commands/wait.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/utils/timestamp.h
A src/test/recovery/t/020_begin_wait.pl
M src/tools/pgindent/typedefs.list

Support FETCH FIRST WITH TIES

commit   : 357889eb17bb9c9336c4f324ceb1651da616fe57    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2020 16:22:13 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Apr 2020 16:22:13 -0400    

Click here for diff

WITH TIES is an option to the FETCH FIRST N ROWS clause (the SQL  
standard's spelling of LIMIT), where you additionally get rows that  
compare equal to the last of those N rows by the columns in the  
mandatory ORDER BY clause.  
  
There was a proposal by Andrew Gierth to implement this functionality in  
a more powerful way that would yield more features, but the other patch  
had not been finished at this time, so we decided to use this one for  
now in the spirit of incremental development.  
  
Author: Surafel Temesgen <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://postgr.es/m/CALAY4q9ky7rD_A4vf=FVQvCGngm3LOes-ky0J6euMrg=_Se+ag@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/select.sgml
M src/backend/catalog/sql_features.txt
M src/backend/executor/nodeLimit.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planmain.h
M src/include/parser/parse_clause.h
M src/test/regress/expected/limit.out
M src/test/regress/sql/limit.sql

Adjust bytea get_bit/set_bit to use int8 not int4 for bit numbering.

commit   : 26a944cf29ba67bb49f42656dd2be98fe2485f5f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2020 15:57:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Apr 2020 15:57:58 -0400    

Click here for diff

Since the existing bit number argument can't exceed INT32_MAX, it's  
not possible for these functions to manipulate bits beyond the first  
256MB of a bytea value.  Lift that restriction by redeclaring the  
bit number arguments as int8 (which requires a catversion bump,  
hence is not back-patchable).  
  
The similarly-named functions for bit/varbit don't really have a  
problem because we restrict those types to at most VARBITMAXLEN bits;  
hence leave them alone.  
  
While here, extend the encode/decode functions in utils/adt/encode.c  
to allow dealing with values wider than 1GB.  This is not a live bug  
or restriction in current usage, because no input could be more than  
1GB, and since none of the encoders can expand a string more than 4X,  
the result size couldn't overflow uint32.  But it might be desirable  
to support more in future, so make the input length values size_t  
and the potential-output-length values uint64.  
  
Also add some test cases to improve the miserable code coverage  
of these functions.  
  
Movead Li, editorialized some by me; also reviewed by Ashutosh Bapat  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove debugging elog from pgstat_recv_resetslrucounter

commit   : 9c74ceb20b991f786f71666d4b4d557d2744a567    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 7 Apr 2020 19:20:20 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 7 Apr 2020 19:20:20 +0200    

Click here for diff

Reported-by: Thomas Munro  

M src/backend/postmaster/pgstat.c

Minor improvements in Incremental Sort explain

commit   : d22782a5392f6a1cb6cfca34031b93eb9dd2aa03    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 7 Apr 2020 18:03:24 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 7 Apr 2020 18:03:24 +0200    

Click here for diff

Some places still used "Maximum" instead of "Peak" when displaying info  
about sort space, so fix that. Also, add a comment clarifying why it's  
correct to check the number of full/prefix sort groups.  
  
Author: James Coleman  
Discussion: https://postgr.es/m/CAPpHfds1waRZ=NOmueYq0sx1ZSCnt+5QJvizT8ndT2=etZEeAQ@mail.gmail.com  

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

Prevent archive recovery from scanning non-existent WAL files.

commit   : 4bd0ad9e44be9fbc3ad77747d7672dab1c3df7d9    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Apr 2020 00:49:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Apr 2020 00:49:29 +0900    

Click here for diff

Previously when there were multiple timelines listed in the history file  
of the recovery target timeline, archive recovery searched all of them,  
starting from the newest timeline to the oldest one, to find the segment  
to read. That is, archive recovery had to continuously fail scanning  
the segment until it reached the timeline that the segment belonged to.  
These scans for non-existent segment could be harmful on the recovery  
performance especially when archival area was located on the remote  
storage and each scan could take a long time.  
  
To address the issue, this commit changes archive recovery so that  
it skips scanning the timeline that the segment to read doesn't belong to.  
  
Author: Kyotaro Horiguchi, tweaked a bit by Fujii Masao  
Reviewed-by: David Steele, Pavel Suderevsky, Grigory Smolkin  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Consider Incremental Sort paths at additional places

commit   : ba3e76cc571eba3dea19c9465ff15ac3ac186576    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 7 Apr 2020 16:43:18 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 7 Apr 2020 16:43:18 +0200    

Click here for diff

Commit d2d8a229bc introduced Incremental Sort, but it was considered  
only in create_ordered_paths() as an alternative to regular Sort. There  
are many other places that require sorted input and might benefit from  
considering Incremental Sort too.  
  
This patch modifies a number of those places, but not all. The concern  
is that just adding Incremental Sort to any place that already adds  
Sort may increase the number of paths considered, negatively affecting  
planning time, without any benefit. So we've taken a more conservative  
approach, based on analysis of which places do affect a set of queries  
that did seem practical. This means some less common queries may not  
benefit from Incremental Sort yet.  
  
Author: Tomas Vondra  
Reviewed-by: James Coleman  
Discussion: https://postgr.es/m/CAPpHfds1waRZ=NOmueYq0sx1ZSCnt+5QJvizT8ndT2=etZEeAQ@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/planner.c
M src/include/optimizer/paths.h
M src/test/regress/expected/incremental_sort.out

Fix representation of SORT_TYPE_STILL_IN_PROGRESS.

commit   : c7654f6a37792ab9525ff98b710c23b27c7868a5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Apr 2020 22:22:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Apr 2020 22:22:13 -0400    

Click here for diff

It turns out that the code did indeed rely on a zeroed  
TuplesortInstrumentation.sortMethod field to indicate  
"this worker never did anything", although it seems the  
issue only comes up during certain race-condition-y cases.  
  
Hence, rearrange the TuplesortMethod enum to restore  
SORT_TYPE_STILL_IN_PROGRESS to having the value zero,  
and add some comments reinforcing that that isn't optional.  
  
Also future-proof a loop over the possible values of the enum.  
sizeof(bits32) happened to be the correct limit value,  
but only by purest coincidence.  
  
Per buildfarm and local investigation.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/include/utils/tuplesort.h

Introduce xid8-based functions to replace txid_XXX.

commit   : 4c04be9b05ad2ec5acd27c3417bf075c13cab134    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 7 Apr 2020 11:33:56 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 7 Apr 2020 11:33:56 +1200    

Click here for diff

The txid_XXX family of fmgr functions exposes 64 bit transaction IDs to  
users as int8.  Now that we have an SQL type xid8 for FullTransactionId,  
define a new set of functions including pg_current_xact_id() and  
pg_current_snapshot() based on that.  Keep the old functions around too,  
for now.  
  
It's a bit sneaky to use the same C functions for both, but since the  
binary representation is identical except for the signedness of the  
type, and since older functions are the ones using the wrong signedness,  
and since we'll presumably drop the older ones after a reasonable period  
of time, it seems reasonable to switch to FullTransactionId internally  
and share the code for both.  
  
Reviewed-by: Fujii Masao <[email protected]>  
Reviewed-by: Takao Fujii <[email protected]>  
Reviewed-by: Yoshikazu Imai <[email protected]>  
Reviewed-by: Mark Dilger <[email protected]>  
Discussion: https://postgr.es/m/20190725000636.666m5mad25wfbrri%40alap3.anarazel.de  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/expected/decoding_in_xact.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/specs/oldest_xmin.spec
M contrib/test_decoding/specs/ondisk_startup.spec
M contrib/test_decoding/specs/snapshot_transfer.spec
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/sql/decoding_in_xact.sql
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/utils/adt/Makefile
R054 src/backend/utils/adt/txid.c src/backend/utils/adt/xid8funcs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/sql/create_table.sql
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/011_crash_recovery.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/hs_standby_functions.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/txid.out
M src/test/regress/expected/update.out
M src/test/regress/expected/xid.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/hs_standby_functions.sql
M src/test/regress/sql/txid.sql
M src/test/regress/sql/update.sql
M src/test/regress/sql/xid.sql
M src/tools/pgindent/typedefs.list

Add SQL type xid8 to expose FullTransactionId to users.

commit   : aeec457de8a8820368e343e791accffe24dc7198    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 7 Apr 2020 11:08:14 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 7 Apr 2020 11:08:14 +1200    

Click here for diff

Similar to xid, but 64 bits wide.  This new type is suitable for use in  
various system views and administration functions.  
  
Reviewed-by: Fujii Masao <[email protected]>  
Reviewed-by: Takao Fujii <[email protected]>  
Reviewed-by: Yoshikazu Imai <[email protected]>  
Reviewed-by: Mark Dilger <[email protected]>  
Discussion: https://postgr.es/m/20190725000636.666m5mad25wfbrri%40alap3.anarazel.de  

M doc/src/sgml/datatype.sgml
M src/backend/access/hash/hashvalidate.c
M src/backend/utils/adt/xid.c
M src/fe_utils/print.c
M src/include/access/transam.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
A src/include/utils/xid8.h
M src/test/regress/expected/opr_sanity.out
A src/test/regress/expected/xid.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/xid.sql

Use INT64_FORMAT when formatting int64 values in explain

commit   : 4bea576b032d6e5435ef0946194aada314e67691    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 7 Apr 2020 01:16:57 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 7 Apr 2020 01:16:57 +0200    

Click here for diff

Per report from lapwing.  

M src/backend/commands/explain.c

Fix failures in incremental_sort due to number of workers

commit   : 23ba3b5ee278847e4fad913b80950edb2838fd35    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 6 Apr 2020 23:58:10 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 6 Apr 2020 23:58:10 +0200    

Click here for diff

The last test in incremental_sort suite prints a parallel plan, but some  
of the buildfarm animals have custom max_parallel_workers_per_gather  
values, causing failures. Fixed by setting the GUC to an explicit value.  
  
Discussion: https://postgr.es/m/CAPpHfds1waRZ=NOmueYq0sx1ZSCnt+5QJvizT8ndT2=etZEeAQ@mail.gmail.com  

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

Fix nbtree kill_prior_tuple posting list assert.

commit   : ce2cee0ade8a6a360322c51201fda1fc25be7773    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 6 Apr 2020 14:46:33 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 6 Apr 2020 14:46:33 -0700    

Click here for diff

An assertion added by commit 0d861bbb checked that _bt_killitems() only  
processes a BTScanPosItem whose heap TID is contained in a posting list  
tuple when its page offset number still matches what is on the page  
(i.e. when it matches the posting list tuple's current offset number).  
This was only correct in the common case where the page can't have  
changed since we first read it.  It was not correct in cases where we  
don't drop the buffer pin (and don't need to verify the page hasn't  
changed using its LSN).  The latter category includes scans involving  
unlogged tables, and scans that use a non-MVCC snapshot, per the logic  
originally introduced by commit 2ed5b87f.  
  
The assertion still seems helpful.  Fix it by taking cases where the  
page may have been concurrently modified into account.  
  
Reported-By: Anastasia Lubennikova, Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

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

Fix show_incremental_sort_info with force_parallel_mode

commit   : 7d6d82a52493ad47c57662d0ac6758da551e87a5    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 6 Apr 2020 23:19:13 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 6 Apr 2020 23:19:13 +0200    

Click here for diff

When executed with force_parallel_mode=regress, the function was exiting  
too early and thus failed to print the worker stats. Fixed by making it  
more like show_sort_info.  
  
Discussion: https://postgr.es/m/CAPpHfds1waRZ=NOmueYq0sx1ZSCnt+5QJvizT8ndT2=etZEeAQ@mail.gmail.com  

M src/backend/commands/explain.c

Implement Incremental Sort

commit   : d2d8a229bc58a2014dce1c7a4fcdb6c5ab9fb8da    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 6 Apr 2020 21:33:28 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 6 Apr 2020 21:33:28 +0200    

Click here for diff

Incremental Sort is an optimized variant of multikey sort for cases when  
the input is already sorted by a prefix of the requested sort keys. For  
example when the relation is already sorted by (key1, key2) and we need  
to sort it by (key1, key2, key3) we can simply split the input rows into  
groups having equal values in (key1, key2), and only sort/compare the  
remaining column key3.  
  
This has a number of benefits:  
  
- Reduced memory consumption, because only a single group (determined by  
  values in the sorted prefix) needs to be kept in memory. This may also  
  eliminate the need to spill to disk.  
  
- Lower startup cost, because Incremental Sort produce results after each  
  prefix group, which is beneficial for plans where startup cost matters  
  (like for example queries with LIMIT clause).  
  
We consider both Sort and Incremental Sort, and decide based on costing.  
  
The implemented algorithm operates in two different modes:  
  
- Fetching a minimum number of tuples without check of equality on the  
  prefix keys, and sorting on all columns when safe.  
  
- Fetching all tuples for a single prefix group and then sorting by  
  comparing only the remaining (non-prefix) keys.  
  
We always start in the first mode, and employ a heuristic to switch into  
the second mode if we believe it's beneficial - the goal is to minimize  
the number of unnecessary comparions while keeping memory consumption  
below work_mem.  
  
This is a very old patch series. The idea was originally proposed by  
Alexander Korotkov back in 2013, and then revived in 2017. In 2018 the  
patch was taken over by James Coleman, who wrote and rewrote most of the  
current code.  
  
There were many reviewers/contributors since 2013 - I've done my best to  
pick the most active ones, and listed them in this commit message.  
  
Author: James Coleman, Alexander Korotkov  
Reviewed-by: Tomas Vondra, Andreas Karlsson, Marti Raudsepp, Peter Geoghegan, Robert Haas, Thomas Munro, Antonin Houska, Andres Freund, Alexander Kuzmenkov  
Discussion: https://postgr.es/m/CAPpHfdscOX5an71nHd8WSUH6GNOCf=V7wgDaTXdDd9=goN-gfA@mail.gmail.com  
Discussion: https://postgr.es/m/CAPpHfds1waRZ=NOmueYq0sx1ZSCnt+5QJvizT8ndT2=etZEeAQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/perform.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
A src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeSort.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/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
M src/backend/utils/sort/tuplesort.c
M src/include/executor/execdebug.h
A src/include/executor/nodeIncrementalSort.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/include/optimizer/paths.h
M src/include/utils/tuplesort.h
M src/test/isolation/expected/drop-index-concurrently-1.out
A src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/sysviews.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/incremental_sort.sql
M src/test/regress/sql/partition_aggregate.sql

Re-stabilize infinite_recurse() test case.

commit   : 3c8553547b1493c4afdb80393f4a47dbfa019a79    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Apr 2020 12:00:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Apr 2020 12:00:37 -0400    

Click here for diff

Since commit 8f59f6b9c0, CLOBBER_CACHE_ALWAYS buildfarm members have  
been failing this test case because the error message now sometimes  
includes an error cursor position.  It seems largely just luck that  
that never happened before, and there are likely to be more ways it  
could happen in future.  Hence, rather than trying to prevent it,  
adjust the test script to suppress that component of the report.  
  
At some point we might need to back-patch this, but refrain until  
there's a demonstrated need.  (We'd need a different fix before v12,  
anyway, since VERBOSITY=sqlstate is a recent thing.)  
  
Tom Lane and Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add logical replication support to replicate into partitioned tables

commit   : f1ac27bfda6ce8a399d8001843e9aefff5814f9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Apr 2020 15:15:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Apr 2020 15:15:52 +0200    

Click here for diff

Mainly, this adds support code in logical/worker.c for applying  
replicated operations whose target is a partitioned table to its  
relevant partitions.  
  
Author: Amit Langote <[email protected]>  
Reviewed-by: Rafia Sabih <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Petr Jelinek <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M src/backend/executor/execReplication.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalrelation.h
M src/test/subscription/t/013_partition.pl

Allow autovacuum to log WAL usage statistics.

commit   : b7ce6de93b59852c55d09acdaeebbf5aaf89114e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 6 Apr 2020 16:24:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 6 Apr 2020 16:24:51 +0530    

Click here for diff

This commit allows autovacuum to log WAL usage statistics added by commit  
df3b181499.  
  
Author: Julien Rouhaud  
Reviewed-by: Dilip Kumar and Amit Kapila  
Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com  

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

Refactor cluster.c to use new routine get_index_isclustered()

commit   : 8ef9451f58ee92d1cdb910e72010dbe75e76f9b8    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Apr 2020 11:44:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Apr 2020 11:44:23 +0900    

Click here for diff

This new cache lookup routine has been introduced in a40caf5, and more  
code paths can directly use it.  
  
Note that in cluster_rel(), the code was returning immediately if the  
tuple's entry in pg_index for the clustered index was not valid.  This  
commit changes the code so as a lookup error is raised instead,  
something that could not happen from the start as we check for the  
existence of the index beforehand, while holding an exclusive lock on  
the parent table.  
  
Author: Justin Pryzby  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/cluster.c

Add the option to report WAL usage in EXPLAIN and auto_explain.

commit   : 33e05f89c53e5a1533d624046bb6fb0da7bb7141    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 6 Apr 2020 08:02:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 6 Apr 2020 08:02:15 +0530    

Click here for diff

This commit adds a new option WAL similar to existing option BUFFERS in the  
EXPLAIN command.  This option allows to include information on WAL record  
generation added by commit df3b181499 in EXPLAIN output.  
  
This also allows the WAL usage information to be displayed via  
the auto_explain module.  A new parameter auto_explain.log_wal controls  
whether WAL usage statistics are printed when an execution plan is logged.  
This parameter has no effect unless auto_explain.log_analyze is enabled.  
  
Author: Julien Rouhaud  
Reviewed-by: Dilip Kumar and Amit Kapila  
Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/bin/psql/tab-complete.c
M src/include/commands/explain.h

Preserve clustered index after rewrites with ALTER TABLE

commit   : a40caf5f862ca8b7e927b2ab2567e934868e9376    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Apr 2020 11:03:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Apr 2020 11:03:49 +0900    

Click here for diff

A table rewritten by ALTER TABLE would lose tracking of an index usable  
for CLUSTER.  This setting is tracked by pg_index.indisclustered and is  
controlled by ALTER TABLE, so some extra work was needed to restore it  
properly.  Note that ALTER TABLE only marks the index that can be used  
for clustering, and does not do the actual operation.  
  
Author: Amit Langote, Justin Pryzby  
Reviewed-by: Ibrar Ahmed, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/backend/commands/tablecmds.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Recompute stack base in forked postmaster children.

commit   : fc3f4453a2bc95549682e23600b22e658cb2d6d7    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 5 Apr 2020 18:23:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 5 Apr 2020 18:23:30 -0700    

Click here for diff

This is for the benefit of running postgres under the rr  
debugger. When using rr signal handlers running while a syscall is  
active use an alternative stack. As e.g. bgworkers are started from  
within signal handlers, the forked backend then has a different stack  
base than postmaster. Previously that subsequently lead to those  
processes triggering spurious "stack depth limit exceeded" errors.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c

Use TransactionXmin instead of RecentGlobalXmin in heap_abort_speculative().

commit   : f946069e6827e729857b9f2db06bf27a1c0563ee    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 5 Apr 2020 17:47:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 5 Apr 2020 17:47:30 -0700    

Click here for diff

There's a very low risk that RecentGlobalXmin could be far enough in  
the past to be older than relfrozenxid, or even wrapped  
around. Luckily the consequences of that having happened wouldn't be  
too bad - the page wouldn't be pruned for a while.  
  
Avoid that risk by using TransactionXmin instead. As that's announced  
via MyPgXact->xmin, it is protected against wrapping around (see code  
comments for details around relfrozenxid).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-  

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

Fix recently introduced typo.

commit   : 549a3e23c3d618103487161b19dbbf8fd2206a5c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 5 Apr 2020 12:03:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 5 Apr 2020 12:03:09 -0700    

Click here for diff

Reported-By: David Rowley  

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

Save errno across LWLockRelease() calls

commit   : a9d9bdd3ad21a73b481911f22279e004679d172e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 5 Apr 2020 10:02:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 5 Apr 2020 10:02:00 +0200    

Click here for diff

Fixup for "Drop slot's LWLock before returning from SaveSlotToPath()"  
  
Reported-by: Michael Paquier <[email protected]>  

M src/backend/replication/slot.c

Further improve stability fix for partition_aggregate test.

commit   : 18d85e9b8a2b784bcee350c59cf20c5c697a1c1f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Apr 2020 00:53:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Apr 2020 00:53:25 -0400    

Click here for diff

Commit 7cb0a423f overlooked that the multi-level partition test table  
pagg_tab_ml still had an exactly even row split at its upper level of  
partitioning, so that some of the sub-aggregation plan steps still had  
exactly equal costs, leading to plan instability.  Tweak the partition  
boundaries some more to make the row distribution unequal at both  
levels.  This leads to more changes in the "expected" plan order than  
the previous round, but it seems fine.  (Actually, I'm surprised that  
this didn't affect even more plans in this test: looking at the  
underlying costs shows that some of the parallel plan groups are  
*not* getting sorted by cost.  Bug?)  
  
Per buildfarm member lousyjack,  
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lousyjack&dt=2020-04-04%2021%3A03%3A04  
  
Discussion: https://postgr.es/m/[email protected]  

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

Allow pg_stat_statements to track WAL usage statistics.

commit   : 6b466bf5f2bea0c89fab54eef696bcfc7ecdafd7    
  
author   : Amit Kapila <[email protected]>    
date     : Sun, 5 Apr 2020 07:34:04 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sun, 5 Apr 2020 07:34:04 +0530    

Click here for diff

This commit adds three new columns in pg_stat_statements output to  
display WAL usage statistics added by commit df3b181499.  
  
This commit doesn't bump the version of pg_stat_statements as the  
same is done for this release in commit 17e0328224.  
  
Author: Kirill Bychik and Julien Rouhaud  
Reviewed-by: Julien Rouhaud, Fujii Masao, Dilip Kumar and Amit Kapila  
Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/pg_stat_statements–1.7–1.8.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
M doc/src/sgml/pgstatstatements.sgml

Add perl2host call missing from a new test file.

commit   : 70de4e950c3b9db620346317f30d31827ac6c3f1    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 4 Apr 2020 15:45:45 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 4 Apr 2020 15:45:45 -0700    

Click here for diff

Oversight in today's commit c6b92041d38512a4176ed76ad06f713d2e6c01a8.  
Per buildfarm member jacana.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/test/recovery/t/018_wal_optimize.pl

Remove bogus Assert, add some regression test cases showing why.

commit   : 07871d40c72e498b6e034eb674df5d8d206976bc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Apr 2020 18:03:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Apr 2020 18:03:30 -0400    

Click here for diff

Commit 77ec5affb added an assertion to enforce_generic_type_consistency  
that boils down to "if the function result is polymorphic, there must be  
at least one polymorphic argument".  This should be true for user-created  
functions, but there are built-in functions for which it's not true, as  
pointed out by Jaime Casanova.  Hence, go back to the old behavior of  
leaving the return type alone.  There's only a limited amount of stuff  
you can do with such a function result, but it does work to some extent;  
add some regression test cases to ensure we don't break that again.  
  
Discussion: https://postgr.es/m/CAJGNTeMbhtsCUZgJJ8h8XxAJbK7U2ipsX8wkHRtZRz-NieT8RA@mail.gmail.com  

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

Skip WAL for new relfilenodes, under wal_level=minimal.

commit   : c6b92041d38512a4176ed76ad06f713d2e6c01a8    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 4 Apr 2020 12:25:34 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 4 Apr 2020 12:25:34 -0700    

Click here for diff

Until now, only selected bulk operations (e.g. COPY) did this.  If a  
given relfilenode received both a WAL-skipping COPY and a WAL-logged  
operation (e.g. INSERT), recovery could lose tuples from the COPY.  See  
src/backend/access/transam/README section "Skipping WAL for New  
RelFileNode" for the new coding rules.  Maintainers of table access  
methods should examine that section.  
  
To maintain data durability, just before commit, we choose between an  
fsync of the relfilenode and copying its contents to WAL.  A new GUC,  
wal_skip_threshold, guides that choice.  If this change slows a workload  
that creates small, permanent relfilenodes under wal_level=minimal, try  
adjusting wal_skip_threshold.  Users setting a timeout on COMMIT may  
need to adjust that timeout, and log_min_duration_statement analysis  
will reflect time consumption moving to COMMIT from commands like COPY.  
  
Internally, this requires a reliable determination of whether  
RollbackAndReleaseCurrentSubTransaction() would unlink a relation's  
current relfilenode.  Introduce rd_firstRelfilenodeSubid.  Amend the  
specification of rd_createSubid such that the field is zero when a new  
rel has an old rd_node.  Make relcache.c retain entries for certain  
dropped relations until end of transaction.  
  
Bump XLOG_PAGE_MAGIC, since this introduces XLOG_GIST_ASSIGN_LSN.  
Future servers accept older WAL, so this bump is discretionary.  
  
Kyotaro Horiguchi, reviewed (in earlier, similar versions) by Robert  
Haas.  Heikki Linnakangas and Michael Paquier implemented earlier  
designs that materially clarified the problem.  Reviewed, in earlier  
designs, by Andrew Dunstan, Andres Freund, Alvaro Herrera, Tom Lane,  
Fujii Masao, and Simon Riggs.  Reported by Martijn van Oosterhout.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/sql/pg_visibility.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/perform.sgml
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/transam/README
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/storage.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/access/heapam.h
M src/include/access/rewriteheap.h
M src/include/access/tableam.h
M src/include/access/xlog_internal.h
M src/include/catalog/storage.h
M src/include/nodes/parsenodes.h
M src/include/storage/bufmgr.h
M src/include/storage/lock.h
M src/include/storage/smgr.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
A src/test/recovery/t/018_wal_optimize.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql

Revert "Improve handling of parameter differences in physical replication"

commit   : 552fcebff04699103cefd2efa71fae1274893dbe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 4 Apr 2020 09:08:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 4 Apr 2020 09:08:12 +0200    

Click here for diff

This reverts commit 246f136e76ecd26844840f2b2057e2c87ec9868d.  
  
That patch wasn't quite complete enough.  
  
Discussion: https://www.postgresql.org/message-id/flat/E1jIpJu-0007Ql-CL%40gemulon.postgresql.org  

M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lock.c
M src/include/access/xlog.h

Add infrastructure to track WAL usage.

commit   : df3b181499b40523bd6244a4e5eb554acb9020ce    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 4 Apr 2020 10:02:08 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 4 Apr 2020 10:02:08 +0530    

Click here for diff

This allows gathering the WAL generation statistics for each statement  
execution.  The three statistics that we collect are the number of WAL  
records, the number of full page writes and the amount of WAL bytes  
generated.  
  
This helps the users who have write-intensive workload to see the impact  
of I/O due to WAL.  This further enables us to see approximately what  
percentage of overall WAL is due to full page writes.  
  
In the future, we can extend this functionality to allow us to compute the  
the exact amount of WAL data due to full page writes.  
  
This patch in itself is just an infrastructure to compute WAL usage data.  
The upcoming patches will expose this data via explain, auto_explain,  
pg_stat_statements and verbose (auto)vacuum output.  
  
Author: Kirill Bychik, Julien Rouhaud  
Reviewed-by: Dilip Kumar, Fujii Masao and Amit Kapila  
Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/executor/execParallel.c
M src/backend/executor/instrument.c
M src/include/access/xlog.h
M src/include/executor/execParallel.h
M src/include/executor/instrument.h
M src/tools/pgindent/typedefs.list

Include chunk overhead in hash table entry size estimate.

commit   : 0588ee63aa2d8c5765d086991555cd9acdd4d86f    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 3 Apr 2020 19:52:16 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 3 Apr 2020 19:52:16 -0700    

Click here for diff

Don't try to be precise about it, just use a constant 16 bytes of  
chunk overhead. Being smarter would require knowing the memory context  
where the chunk will be allocated, which is not known by all callers.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAgg.c
M src/include/executor/nodeAgg.h

Fix resource management bug with replication=database.

commit   : 3e0d80fd8d3dd4f999e0d3aa3e591f480d8ad1fd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 22:28:37 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 22:28:37 -0400    

Click here for diff

Commit 0d8c9c1210c44b36ec2efcb223a1dfbe897a3661 allowed BASE_BACKUP to  
acquire a ResourceOwner without a transaction so that the backup  
manifest functionality could use a BufFile, but it overlooked the fact  
that when a walsender is used with replication=database, it might have  
a transaction in progress, because in that mode, SQL and replication  
commands can be mixed.  Try to fix things up so that the two cleanup  
mechanisms don't conflict.  
  
Per buildfarm member serinus, which triggered the problem when  
CREATE_REPLICATION_SLOT failed from inside a transaction.  It passed  
on the subsequent run, so evidently the failure doesn't happen every  
time.  

M src/backend/replication/walsender.c

Be more careful about time_t vs. pg_time_t in basebackup.c.

commit   : db1531cae00941bfe4f6321fdef1e1ef355b6bed    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 20:15:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 20:15:27 -0400    

Click here for diff

lapwing is complaining that about a call to pg_gmtime, saying that  
it "expected 'const pg_time_t *' but argument is of type 'time_t *'".  
I at first thought that the problem had someting to do with const,  
but Thomas Munro suggested that it might be just because time_t  
and pg_time_t are different identifers. lapwing is i686 rather than  
x86_64, and pg_time_t is always int64, so that seems like a good  
guess.  
  
There is other code that just casts time_t to pg_time_t without  
any conversion function, so try that approach here.  
  
Introduced in commit 0d8c9c1210c44b36ec2efcb223a1dfbe897a3661.  

M src/backend/replication/basebackup.c

pg_validatebackup: Fix 'make clean' to remove tmp_check.

commit   : 9f8f881caa0fabdf7ff46cc55a991ffeab39bd92    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 19:51:18 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 19:51:18 -0400    

Click here for diff

Report by Tom Lane.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_validatebackup/Makefile

pg_validatebackup: Adjust TAP tests to undo permissions change.

commit   : 19c0422ad012636d00ba221bd7052cb71448efca    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 19:01:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 19:01:59 -0400    

Click here for diff

It may be necessary to go further and remove this test altogether,  
but I'm going to try this fix first. It's not clear, at least to  
me, exactly how this is breaking buildfarm members, but it appears  
to be doing so.  

M src/bin/pg_validatebackup/t/003_corruption.pl

pg_validatebackup: Also use perl2host in TAP tests.

commit   : 460314db08e8688e1a54a0a26657941e058e45c5    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 17:16:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 17:16:31 -0400    

Click here for diff

Second try at getting the buildfarm to be happy with 003_corrution.pl  
as added by commit 0d8c9c1210c44b36ec2efcb223a1dfbe897a3661.  
  
Per suggestion from Álvaro Herrera.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_validatebackup/t/003_corruption.pl

commit   : 0568e7a2a4f133a7c16776bcae92c53fcf247b73    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2020 17:00:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2020 17:00:25 -0400    

Click here for diff

Move have_partkey_equi_join and match_expr_to_partition_keys to  
relnode.c, since they're used only there.  Refactor  
build_joinrel_partition_info to split out the code that fills the  
joinrel's partition key lists; this doesn't have any non-cosmetic  
impact, but it seems like a useful separation of concerns.  
Improve assorted nearby comments.  
  
Amit Langote, with a little further editorialization by me  
  
Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/paths.h

pg_validatebackup: Use tempdir_short in TAP tests.

commit   : 21dc48840c24e70b1b1f0f6478f3dba5343182dd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 15:40:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 15:40:35 -0400    

Click here for diff

The buildfarm is very unhappy right now because TAP test  
003_corruption.pl uses TestLib::tempdir to generate the name of  
a temporary directory that is used as a tablespace name, and  
this results in a 'symbolic link target too long' error message  
on many of the buildfarm machines, but not on my machine.  
  
It appears that other people have run into similar problems in  
the past and that TestLib::tempdir_short was the solution, so  
let's try using that instead.  

M src/bin/pg_validatebackup/t/003_corruption.pl

pg_validatebackup: Adjust TAP tests to placate perlcritic.

commit   : 87e300434058a157bbc4ef8d039937abdefa7610    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 15:28:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 15:28:59 -0400    

Click here for diff

It seems that we have a policy that every Perl subroutine should  
end with an explicit "return", so add explicit "return"  
statements to all the new subroutines added by my prior  
commit 0d8c9c1210c44b36ec2efcb223a1dfbe897a3661.  
  
Per buildfarm.  

M src/bin/pg_validatebackup/t/003_corruption.pl
M src/bin/pg_validatebackup/t/005_bad_manifest.pl

Generate backup manifests for base backups, and validate them.

commit   : 0d8c9c1210c44b36ec2efcb223a1dfbe897a3661    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 14:59:47 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 14:59:47 -0400    

Click here for diff

A manifest is a JSON document which includes (1) the file name, size,  
last modification time, and an optional checksum for each file backed  
up, (2) timelines and LSNs for whatever WAL will need to be replayed  
to make the backup consistent, and (3) a checksum for the manifest  
itself. By default, we use CRC-32C when checksumming data files,  
because we are trying to detect corruption and user error, not foil an  
adversary. However, pg_basebackup and the server-side BASE_BACKUP  
command now have options to select a different algorithm, so users  
wanting a cryptographic hash function can select SHA-224, SHA-256,  
SHA-384, or SHA-512. Users not wanting file checksums at all can  
disable them, or disable generating of the backup manifest altogether.  
Using a cryptographic hash function in place of CRC-32C consumes  
significantly more CPU cycles, which may slow down backups in some  
cases.  
  
A new tool called pg_validatebackup can validate a backup against the  
manifest. If no checksums are present, it can still check that the  
right files exist and that they have the expected sizes. If checksums  
are present, it can also verify that each file has the expected  
checksum. Additionally, it calls pg_waldump to verify that the  
expected WAL files are present and parseable. Only plain format  
backups can be validated directly, but tar format backups can be  
validated after extracting them.  
  
Robert Haas, with help, ideas, review, and testing from David Steele,  
Stephen Frost, Andrew Dunstan, Rushabh Lathia, Suraj Kharage, Tushar  
Ahuja, Rajkumar Raghuwanshi, Mark Dilger, Davinder Singh, Jeevan  
Chalke, Amit Kapila, Andres Freund, and Noah Misch.  
  
Discussion: http://postgr.es/m/CA+TgmoZV8dw1H2bzZ9xkKwdrk8+XYa+DC9H=F7heO2zna5T6qg@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
A doc/src/sgml/ref/pg_validatebackup.sgml
M doc/src/sgml/reference.sgml
M src/backend/access/transam/xlog.c
M src/backend/replication/basebackup.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/bin/Makefile
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
A src/bin/pg_validatebackup/.gitignore
A src/bin/pg_validatebackup/Makefile
A src/bin/pg_validatebackup/parse_manifest.c
A src/bin/pg_validatebackup/parse_manifest.h
A src/bin/pg_validatebackup/pg_validatebackup.c
A src/bin/pg_validatebackup/t/001_basic.pl
A src/bin/pg_validatebackup/t/002_algorithm.pl
A src/bin/pg_validatebackup/t/003_corruption.pl
A src/bin/pg_validatebackup/t/004_options.pl
A src/bin/pg_validatebackup/t/005_bad_manifest.pl
A src/bin/pg_validatebackup/t/006_encoding.pl
A src/bin/pg_validatebackup/t/007_wal.pl
M src/include/replication/basebackup.h
M src/include/replication/walsender.h

Include information on buffer usage during planning phase, in EXPLAIN output, take two.

commit   : ce77abe63cfc85fb0bc236deb2cc34ae35cb5324    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 4 Apr 2020 03:13:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 4 Apr 2020 03:13:17 +0900    

Click here for diff

When BUFFERS option is enabled, EXPLAIN command includes the information  
on buffer usage during each plan node, in its output. In addition to that,  
this commit makes EXPLAIN command include also the information on  
buffer usage during planning phase, in its output. This feature makes it  
easier to discern the cases where lots of buffer access happen during  
planning.  
  
This commit revives the original commit ed7a509571 that was reverted by  
commit 19db23bcbd. The original commit had to be reverted because  
it caused the regression test failure on the buildfarm members prion and  
dory. But since commit c0885c4c30 got rid of the caues of the test failure,  
the original commit can be safely introduced again.  
  
Author: Julien Rouhaud, slightly revised by Fujii Masao  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/include/commands/explain.h
M src/test/regress/expected/explain.out

Fix bugs in gin_fuzzy_search_limit processing.

commit   : e41955faf060f90918303ce0623df9d765144bf6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2020 13:15:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2020 13:15:30 -0400    

Click here for diff

entryGetItem()'s three code paths each contained bugs associated  
with filtering the entries for gin_fuzzy_search_limit.  
  
The posting-tree path failed to advance "advancePast" after having  
decided to filter an item.  If we ran out of items on the current  
page and needed to advance to the next, what would actually happen  
is that entryLoadMoreItems() would re-load the same page.  Eventually,  
the random dropItem() test would accept one of the same items it'd  
previously rejected, and we'd move on --- but it could take awhile  
with small gin_fuzzy_search_limit.  To add insult to injury, this  
case would inevitably cause entryLoadMoreItems() to decide it needed  
to re-descend from the root, making things even slower.  
  
The posting-list path failed to implement gin_fuzzy_search_limit  
filtering at all, so that all entries in the posting list would  
be returned.  
  
The bitmap-result path used a "gotitem" variable that it failed to  
update in the one place where it'd actually make a difference, ie  
at the one "continue" statement.  I think this was unreachable in  
practice, because if we'd looped around then it shouldn't be the  
case that the entries on the new page are before advancePast.  
Still, the "gotitem" variable was contributing nothing to either  
clarity or correctness, so get rid of it.  
  
Refactor all three loops so that the termination conditions are  
more alike and less unreadable.  
  
The code coverage report showed that we had no coverage at all for  
the re-descend-from-root code path in entryLoadMoreItems(), which  
seems like a very bad thing, so add a test case that exercises it.  
We also had exactly no coverage for gin_fuzzy_search_limit, so add a  
simplistic test case that at least hits those code paths a little bit.  
  
Back-patch to all supported branches.  
  
Adé Heyward and Tom Lane  
  
Discussion: https://postgr.es/m/CAEknJCdS-dE1Heddptm7ay2xTbSeADbkaQ8bU2AXRCVC2LdtKQ@mail.gmail.com  

M src/backend/access/gin/ginget.c
M src/test/regress/expected/gin.out
M src/test/regress/sql/gin.sql

Improve stability of explain regression test.

commit   : c0885c4c30698a1beef40a8df0edb253750d3b43    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 4 Apr 2020 01:25:44 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 4 Apr 2020 01:25:44 +0900    

Click here for diff

The explain regression test runs EXPLAIN commands via the function  
that filters unstable outputs. To produce more stable test output,  
this commit improves the function so that it also filters out text-mode  
Buffers lines. This is necessary because text-mode Buffers lines vary  
depending the system state.  
  
This improvement will get rid of the regression test failure that  
the commit ed7a509571 caused on the buildfarm members prion and  
dory because of the instability of Buffers lines.  
  
Author: Fujii Masao  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Add a glossary to the documentation

commit   : 347d2b07fcc250680f75b5f89ba49d4805782c6b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Apr 2020 13:23:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Apr 2020 13:23:20 -0300    

Click here for diff

More work is still needed, but this is a good start.  
  
Co-authored-by: Corey Huinker <[email protected]>  
Co-authored-by: Jürgen Purtz <[email protected]>  
Co-authored-by: Roger Harkavy <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/CADkLM=eP6HOeqDjn0FdXuGRusQu4oWH_LFsKjjafmhvWD=aSpQ@mail.gmail.com  

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

pg_waldump: Don't call XLogDumpDisplayStats() if -q is specified.

commit   : 3031440e9809bbf7cf279b85306df2e3b686539d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 11:58:58 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 11:58:58 -0400    

Click here for diff

Commit ac44367efbef198c57a18b96dbc6a39191720994 introduced this  
problem.  
  
Report and fix by Fujii Masao.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_waldump/pg_waldump.c

Add checksum helper functions.

commit   : c12e43a2e0d45a6b59f2cea53f1b82e52fdcff7a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 11:50:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 3 Apr 2020 11:50:38 -0400    

Click here for diff

These functions make it easier to write code that wants to compute a  
checksum for some data while allowing the user to configure the type  
of checksum that gets used.  
  
This is another piece of infrastructure for the upcoming patch to add  
backup manifests.  
  
Patch written from scratch by me, but it is similar to previous work  
by Rushabh Lathia and Suraj Kharage. Suraj also reviewed this version  
off-list. Advice on how not to break Windows from Davinder Singh.  
  
Discussion: http://postgr.es/m/CA+TgmoZV8dw1H2bzZ9xkKwdrk8+XYa+DC9H=F7heO2zna5T6qg@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoZRTBiPyvQEwV79PU1ePTtSEo2UeVncrkJMbn1sU1gnRA@mail.gmail.com  

M src/common/Makefile
A src/common/checksum_helper.c
A src/include/common/checksum_helper.h
M src/tools/msvc/Mkvcbuild.pm

Fix bogus CALLED_AS_TRIGGER() defenses.

commit   : 6dd9f357792545b626e28b2e1f73cb4c32c437f1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2020 11:24:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Apr 2020 11:24:56 -0400    

Click here for diff

contrib/lo's lo_manage() thought it could use  
trigdata->tg_trigger->tgname in its error message about  
not being called as a trigger.  That naturally led to a core dump.  
  
unique_key_recheck() figured it could Assert that fcinfo->context  
is a TriggerData node in advance of having checked that it's  
being called as a trigger.  That's harmless in production builds,  
and perhaps not that easy to reach in any case, but it's logically  
wrong.  
  
The first of these per bug #16340 from William Crowell;  
the second from manual inspection of other CALLED_AS_TRIGGER  
call sites.  
  
Back-patch the lo.c change to all supported branches, the  
other to v10 where the thinko crept in.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/lo/lo.c
M src/backend/commands/constraint.c

Revert "Include information on buffer usage during planning phase, in EXPLAIN output."

commit   : 19db23bcbda99e93321cb0636677ec9c6e121a2a    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2020 12:20:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2020 12:20:42 +0900    

Click here for diff

This reverts commit ed7a5095716ee498ecc406e1b8d5ab92c7662d10.  
  
Per buildfarm member prion.  

M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/include/commands/explain.h
M src/test/regress/expected/explain.out

Add wait events for recovery conflicts.

commit   : 18808f8c893d4f425f2d21b2a1ffc8e51f1bd0ba    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2020 12:15:56 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2020 12:15:56 +0900    

Click here for diff

This commit introduces new wait events RecoveryConflictSnapshot and  
RecoveryConflictTablespace. The former is reported while waiting for  
recovery conflict resolution on a vacuum cleanup. The latter is reported  
while waiting for recovery conflict resolution on dropping tablespace.  
  
Also this commit changes the code so that the wait event Lock is reported  
while waiting in ResolveRecoveryConflictWithVirtualXIDs() for recovery  
conflict resolution on a lock. Basically the wait event Lock is reported  
during that wait, but previously was not reported only when that wait  
happened in ResolveRecoveryConflictWithVirtualXIDs().  
  
Author: Masahiko Sawada  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CA+fd4k4mXWTwfQLS3RPwGr4xnfAEs1ysFfgYHvmmoUgv6Zxvmg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/pgstat.c
M src/backend/storage/ipc/standby.c
M src/include/pgstat.h

Add support for \aset in pgbench

commit   : 9d8ef98800bd291de145fb1be41f0868546e02ab    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 3 Apr 2020 11:45:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 3 Apr 2020 11:45:15 +0900    

Click here for diff

This option is similar to \gset, except that it is able to store all  
results from combined SQL queries into separate variables.  If a query  
returns multiple rows, the last result is stored and if a query returns  
no rows, nothing is stored.  
  
While on it, add a TAP test for \gset to check for a failure when a  
query returns multiple rows.  
  
Author: Fabien Coelho  
Reviewed-by: Ibrar Ahmed, Michael Paquier  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081914200.2529@lancre  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Include information on buffer usage during planning phase, in EXPLAIN output.

commit   : ed7a5095716ee498ecc406e1b8d5ab92c7662d10    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2020 11:27:09 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Apr 2020 11:27:09 +0900    

Click here for diff

When BUFFERS option is enabled, EXPLAIN command includes the information  
on buffer usage during each plan node, in its output. In addition to that,  
this commit makes EXPLAIN command include also the information on  
buffer usage during planning phase, in its output. This feature makes it  
easier to discern the cases where lots of buffer access happen during  
planning.  
  
Author: Julien Rouhaud, slightly revised by Fujii Masao  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/include/commands/explain.h
M src/test/regress/expected/explain.out

pg_waldump: Add a --quiet option.

commit   : ac44367efbef198c57a18b96dbc6a39191720994    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2020 20:25:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 Apr 2020 20:25:04 -0400    

Click here for diff

The primary motivation for this change is that it will be used by the  
upcoming patch to add backup manifests, but it also seems to have some  
potential more general use.  
  
Andres Freund and Robert Haas  
  
Discussion: http://postgr.es/m/[email protected]  

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

Improve stability fix for partition_aggregate test.

commit   : 7cb0a423f914af6936d13a8c7f2e35c0a4e4bd14    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Apr 2020 19:43:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Apr 2020 19:43:48 -0400    

Click here for diff

Instead of disabling autovacuum on these test tables, adjust the  
partition boundaries so that the child partitions are not all the  
same size.  That should cause the planner to use a predictable  
ordering of the per-partition scan nodes even in cases where  
autovacuum causes the rowcount estimates to be off a bit.  
Moreover, this also lets these tests show that the planner does  
properly order the tables in descending size order, something  
that wasn't being proven before.  
  
The pagg_tab1 and pagg_tab2 partitions are still all the same  
size, but that should be fine, because those tables are so small  
that (1) autovacuum won't fire on them, and (2) even if it did,  
it couldn't change the reltuples value --- with only one page,  
it can't see just part of the relation.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: remove unnecessary INNER keyword

commit   : 8da1538b39f2803fdc75de8505dd096e29e65a52    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 2 Apr 2020 17:42:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 2 Apr 2020 17:42:09 -0400    

Click here for diff

A join that was added in commit 9b2009c4cf that did not use the INNER  
keyword but the existing query used it.  It was cleaner to remove the  
existing INNER keyword.  
  
Reported-by: Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/pgbuffercache.sgml

commit   : c713dc2f7be314ee541f0abd170b69c90d8bfb14    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 2 Apr 2020 17:27:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 2 Apr 2020 17:27:43 -0400    

Click here for diff

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

M doc/src/sgml/func.sgml

Improve user control over truncation of logged bind-parameter values.

commit   : 0b34e7d307e6a142ee94800e6d5f3e73449eeffd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Apr 2020 15:04:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Apr 2020 15:04:51 -0400    

Click here for diff

This patch replaces the boolean GUC log_parameters_on_error introduced  
by commit ba79cb5dc with an integer log_parameter_max_length_on_error,  
adding the ability to specify how many bytes to trim each logged  
parameter value to.  (The previous coding hard-wired that choice at  
64 bytes.)  
  
In addition, add a new parameter log_parameter_max_length that provides  
similar control over truncation of query parameters that are logged in  
response to statement-logging options, as opposed to errors.  Previous  
releases always logged such parameters in full, possibly causing log  
bloat.  
  
For backwards compatibility with prior releases,  
log_parameter_max_length defaults to -1 (log in full), while  
log_parameter_max_length_on_error defaults to 0 (no logging).  
  
Per discussion, log_parameter_max_length is SUSET since the DBA should  
control routine logging behavior, but log_parameter_max_length_on_error  
is USERSET because it also affects errcontext data sent back to the  
client.  
  
Alexey Bashtanov, editorialized a little by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/nodes/params.c
M src/backend/tcop/postgres.c
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/include/utils/guc.h
M src/pl/plpgsql/src/pl_exec.c

Fix typo in SLRU stats documentation

commit   : 2c220ca46f3f6de0611367312bec0daef99b29eb    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 2 Apr 2020 14:26:27 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 2 Apr 2020 14:26:27 +0200    

Click here for diff

Author: Noriyoshi Shinoda  
Discussion: https://www.postgresql.org/message-id/flat/20200119143707.gyinppnigokesjok@development  

M doc/src/sgml/monitoring.sgml

Attempt to stabilize partitionwise_aggregate test

commit   : cefb82d49e2152e844af148a95d4072999dc3c6b    
  
author   : David Rowley <[email protected]>    
date     : Thu, 2 Apr 2020 21:26:54 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 2 Apr 2020 21:26:54 +1300    

Click here for diff

In b07642dbc, we added code to trigger autovacuums based on the number of  
INSERTs into a table. This seems to have cause some destabilization of  
the regression tests. Likely this is due to an autovacuum triggering  
mid-test and (per theory from Tom Lane) one of the test's queries causes  
autovacuum to skip some number of pages, resulting in the reltuples  
estimate changing.  
  
The failure that this is attempting to fix is around the order of subnodes  
in an Append. Since the planner orders these according to the subnode  
cost, then it's possible that a small change in the reltuples value changes  
the subnode's cost enough that it swaps position with one of its fellow  
subnodes.  
  
The failure here only seems to occur on slower buildfarm machines. In this  
case, lousyjack, which seems have taken over 8 minutes to run just  
the partitionwise_aggregate test. Such a slow run would increase the  
chances that the autovacuum launcher would trigger a vacuum mid-test.  
Faster machines run this test in sub second time, so have a much smaller  
window for an autovacuum to trigger.  
  
Here we fix this by disabling autovacuum on all tables created in the test.  
  
Additionally, this reverts the change made in the  
partitionwise_aggregate test in 2dc16efed.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add SQL functions for Unicode normalization

commit   : 2991ac5fc9b3904ca4582be6d323497d7c3d17c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Mar 2020 08:14:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Mar 2020 08:14:00 +0100    

Click here for diff

This adds SQL expressions NORMALIZE() and IS NORMALIZED to convert and  
check Unicode normal forms, per SQL standard.  
  
To support fast IS NORMALIZED tests, we pull in a new data file  
DerivedNormalizationProps.txt from Unicode and build a lookup table  
from that, using techniques similar to ones already used for other  
Unicode data.  make update-unicode will keep it up to date.  We only  
build and use these tables for the NFC and NFKC forms, because they  
are too big for NFD and NFKD and the improvement is not significant  
enough there.  
  
Reviewed-by: Daniel Verite <[email protected]>  
Reviewed-by: Andreas Karlsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/charset.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/catalog/system_views.sql
M src/backend/parser/gram.y
M src/backend/utils/adt/varlena.c
M src/common/unicode/.gitignore
M src/common/unicode/Makefile
A src/common/unicode/generate-unicode_normprops_table.pl
M src/common/unicode_norm.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/common/unicode_norm.h
A src/include/common/unicode_normprops_table.h
M src/include/parser/kwlist.h
A src/test/regress/expected/unicode.out
A src/test/regress/expected/unicode_1.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/unicode.sql

Fix whitespace

commit   : 070c3d3937e75e04d36405287353b7eca516555d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Apr 2020 08:56:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Apr 2020 08:56:12 +0200    

Click here for diff

M contrib/pg_stat_statements/pg_stat_statements–1.7–1.8.sql

doc: Update for Unix-domain sockets on Windows

commit   : 580a446c21f83bcddbaf3ce5f1bab72239c11eb6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Apr 2020 08:01:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Apr 2020 08:01:30 +0200    

Click here for diff

Update the documentation to reflect that Unix-domain sockets are now  
usable on Windows.  

M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/storage.sgml

Add some comments to some SQL features

commit   : c6e0edad465e3774401b7f09ad70bd22e5421858    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Apr 2020 07:52:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Apr 2020 07:52:20 +0200    

Click here for diff

Otherwise, it could be confusing to a reader that some of these  
well-publicized features are simply listed as unsupported without  
further explanation.  

M src/backend/catalog/sql_features.txt

Add maintenance_io_concurrency to postgresql.conf.sample.

commit   : 37b3794dfcfb9d55f7ea83693f50b1484caab21c    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 2 Apr 2020 16:44:11 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 2 Apr 2020 16:44:11 +1300    

Click here for diff

New GUC from commit fc34b0d9.  

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

Allow parallel vacuum to accumulate buffer usage.

commit   : 3a5e22138a8d014590834eb808c99a436c246aab    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 2 Apr 2020 08:04:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 2 Apr 2020 08:04:58 +0530    

Click here for diff

Commit 40d964ec99 allowed vacuum command to process indexes in parallel but  
forgot to accumulate the buffer usage stats of parallel workers.  This  
allows leader backend to accumulate buffer usage stats of all the parallel  
workers.  
  
Reported-by: Julien Rouhaud  
Author: Sawada Masahiko  
Reviewed-by: Dilip Kumar, Amit Kapila and Julien Rouhaud  
Discussion: https://postgr.es/m/20200328151721.GB12854@nol  

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

Allow pg_stat_statements to track planning statistics.

commit   : 17e03282241c6ac58a714eb0c3b6a8018cf6167a    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 2 Apr 2020 11:20:19 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 2 Apr 2020 11:20:19 +0900    

Click here for diff

This commit makes pg_stat_statements support new GUC  
pg_stat_statements.track_planning. If this option is enabled,  
pg_stat_statements tracks the planning statistics of the statements,  
e.g., the number of times the statement was planned, the total time  
spent planning the statement, etc. This feature is useful to check  
the statements that it takes a long time to plan. Previously since  
pg_stat_statements tracked only the execution statistics, we could  
not use that for the purpose.  
  
The planning and execution statistics are stored at the end of  
each phase separately. So there are not always one-to-one relationship  
between them. For example, if the statement is successfully planned  
but fails in the execution phase, only its planning statistics are stored.  
This may cause the users to be able to see different pg_stat_statements  
results from the previous version. To avoid this,  
pg_stat_statements.track_planning needs to be disabled.  
  
This commit bumps the version of pg_stat_statements to 1.8  
since it changes the definition of pg_stat_statements function.  
  
Author: Julien Rouhaud, Pascal Legrand, Thomas Munro, Fujii Masao  
Reviewed-by: Sergei Kornilov, Tomas Vondra, Yoshikazu Imai, Haribabu Kommi, Tom Lane  
Discussion: https://postgr.es/m/CAHGQGwFx_=DO-Gu-MfPW3VQ4qC7TfVdH2zHmvZfrGv6fQ3D-Tw@mail.gmail.com  
Discussion: https://postgr.es/m/CAEepm=0e59Y_6Q_YXYCTHZkqOc6H2pJ54C_Xe=VFu50Aqqp_sA@mail.gmail.com  
Discussion: https://postgr.es/m/DB6PR0301MB21352F6210E3B11934B0DCC790B00@DB6PR0301MB2135.eurprd03.prod.outlook.com  

M contrib/pg_stat_statements/Makefile
M contrib/pg_stat_statements/expected/pg_stat_statements.out
A contrib/pg_stat_statements/pg_stat_statements–1.7–1.8.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/pg_stat_statements.control
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
M doc/src/sgml/pgstatstatements.sgml
M src/tools/pgindent/typedefs.list

Collect statistics about SLRU caches

commit   : 28cac71bd368788d1ab22f048eef211641fb1283    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 2 Apr 2020 02:11:38 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 2 Apr 2020 02:11:38 +0200    

Click here for diff

There's a number of SLRU caches used to access important data like clog,  
commit timestamps, multixact, asynchronous notifications, etc. Until now  
we had no easy way to monitor these shared caches, compute hit ratios,  
number of reads/writes etc.  
  
This commit extends the statistics collector to track this information  
for a predefined list of SLRUs, and also introduces a new system view  
pg_stat_slru displaying the data.  
  
The list of built-in SLRUs is fixed, but additional SLRUs may be defined  
in extensions. Unfortunately, there's no suitable registry of SLRUs, so  
this patch simply defines a fixed list of SLRUs with entries for the  
built-in ones and one entry for all additional SLRUs. Extensions adding  
their own SLRU are fairly rare, so this seems acceptable.  
  
This patch only allows monitoring of SLRUs, not tuning. The SLRU sizes  
are still fixed (hard-coded in the code) and it's not entirely clear  
which of the SLRUs might need a GUC to tune size. In a way, allowing us  
to determine that is one of the goals of this patch.  
  
Bump catversion as the patch introduces new functions and system view.  
  
Author: Tomas Vondra  
Reviewed-by: Alvaro Herrera  
Discussion: https://www.postgresql.org/message-id/flat/20200119143707.gyinppnigokesjok@development  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/slru.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/pgstat.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Clean up parsing of ltree and lquery some more.

commit   : 17ca067995114ee40749d9138ba85fdd68518052    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2020 19:44:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2020 19:44:17 -0400    

Click here for diff

Fix lquery parsing to handle repeated flag characters correctly,  
and to enforce the max label length correctly in some cases where  
it did not before, and to detect empty labels in some cases where  
it did not before.  
  
In a more cosmetic vein, use a switch rather than if-then chains to  
handle the different states, and avoid unnecessary checks on charlen  
when looking for ASCII characters, and factor out multiple copies of  
the label length checking code.  
  
Tom Lane and Dmitry Belyavsky  
  
Discussion: https://postgr.es/m/CADqLbzLVkBuPX0812o+z=c3i6honszsZZ6VQOSKR3VPbB56P3w@mail.gmail.com  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree_io.c
M contrib/ltree/sql/ltree.sql

Add support for binary I/O of ltree, lquery, and ltxtquery types.

commit   : 949a9f043eb70a4986041b47513579f9a13d6a33    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2020 17:31:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2020 17:31:29 -0400    

Click here for diff

Not much to say here --- does what it says on the tin.  The "binary"  
representation in each case is really just the same as the text format,  
though we prefix a version-number byte in case anyone ever feels  
motivated to change that.  Thus, there's not any expectation of improved  
speed or reduced space; the point here is just to allow clients to use  
binary format for all columns of a query result or COPY data.  
  
This makes use of the recently added ALTER TYPE support to add binary  
I/O functions to an existing data type.  As in commit a80818605,  
we can piggy-back on there already being a new-for-v13 version of the  
ltree extension, so we don't need a new update script file.  
  
Nino Floris, reviewed by Alexander Korotkov and myself  
  
Discussion: https://postgr.es/m/CANmj9Vxx50jOo1L7iSRxd142NyTz6Bdcgg7u9P3Z8o0=HGkYyQ@mail.gmail.com  

M contrib/ltree/crc32.c
M contrib/ltree/crc32.h
M contrib/ltree/ltree–1.1–1.2.sql
M contrib/ltree/ltree_io.c
M contrib/ltree/ltxtquery_io.c

Check equality semantics for unique indexes on partitioned tables.

commit   : 501b0187998c24d4a950459d9bf5e67f9f3e4a25    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2020 14:49:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2020 14:49:49 -0400    

Click here for diff

We require the partition key to be a subset of the set of columns  
being made unique, so that physically-separate indexes on the different  
partitions are sufficient to enforce the uniqueness constraint.  
  
The existing code checked that the listed columns appear, but did not  
inquire into the index semantics, which is a serious oversight given  
that different index opclasses might enforce completely different  
notions of uniqueness.  
  
Ideally, perhaps, we'd just match the partition key opfamily to the  
index opfamily.  But hash partitioning uses hash opfamilies which we  
can't directly match to btree opfamilies.  Hence, look up the equality  
operator in each family, and accept if it's the same operator.  This  
should be okay in a fairly general sense, since the equality operator  
ought to precisely represent the opfamily's notion of uniqueness.  
  
A remaining weak spot is that we don't have a cross-index-AM notion of  
which opfamily member is "equality".  But we know which one to use for  
hash and btree AMs, and those are the only two that are relevant here  
at present.  (Any non-core AMs that know how to enforce equality are  
out of luck, for now.)  
  
Back-patch to v11 where this feature was introduced.  
  
Guancheng Luo, revised a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/indexcmds.c

Improve selectivity estimation for assorted match-style operators.

commit   : a80818605e5447b9b846590c3d3fab99060cb53e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2020 10:32:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Apr 2020 10:32:33 -0400    

Click here for diff

Quite a few matching operators such as JSONB's @> used "contsel" and  
"contjoinsel" as their selectivity estimators.  That was a bad idea,  
because (a) contsel is only a stub, yielding a fixed default estimate,  
and (b) that default is 0.001, meaning we estimate these operators as  
five times more selective than equality, which is surely pretty silly.  
  
There's a good model for improving this in ltree's ltreeparentsel():  
for any "var OP constant" query, we can try applying the operator  
to all of the column's MCV and histogram values, taking the latter  
as being a random sample of the non-MCV values.  That code is  
actually 100% generic, except for the question of exactly what  
default selectivity ought to be plugged in when we don't have stats.  
  
Hence, migrate the guts of ltreeparentsel() into the core code, provide  
wrappers "matchingsel" and "matchingjoinsel" with a more-appropriate  
default estimate, and use those for the non-geometric operators that  
formerly used contsel (mostly JSONB containment operators and tsquery  
matching).  
  
Also apply this code to some match-like operators in hstore, ltree, and  
pg_trgm, including the former users of ltreeparentsel as well as ones  
that improperly used contsel.  Since commit 911e70207 just created new  
versions of those extensions that we haven't released yet, we can sneak  
this change into those new versions instead of having to create an  
additional generation of update scripts.  
  
Patch by me, reviewed by Alexey Bashtanov  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/hstore–1.6–1.7.sql
M contrib/ltree/ltree–1.1–1.2.sql
M contrib/ltree/ltree_op.c
M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/pg_trgm–1.4–1.5.sql
M doc/src/sgml/xoper.sgml
M src/backend/utils/adt/selfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_proc.dat
M src/include/utils/selfuncs.h

Refactor code to look up local replication tuple

commit   : d8653f468789a75627c2fc82e73e2755ad8d1fb4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Apr 2020 15:31:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Apr 2020 15:31:47 +0200    

Click here for diff

This unifies some duplicate code.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CA+HiwqFjYE5anArxvkjr37AQMd52L-LZtz9Ld2QrLQ3YfcYhTw@mail.gmail.com  

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

Update SQL features count

commit   : 369623492d08703c6e6269c995ce73b73d187416    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Apr 2020 14:43:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Apr 2020 14:43:45 +0200    

Click here for diff

The previously listed total of 179 does not appear to be correct for  
SQL:2016 anymore.  (Previous SQL versions had slightly different  
feature sets, so it's plausible that it was once correct.)  The  
currently correct count is the number of rows in the respective tables  
in appendix F in SQL parts 2 and 11, minus 2 features that are listed  
twice.  Thus the correct count is currently 177.  This also matches  
the number of Core entries the built documentation currently shows, so  
it's internally consistent.  

M doc/src/sgml/features.sgml

Fix typo in contrib/intarray documentation

commit   : 4d276ba94fd9b19457aeb5b6d9af00589fe184a0    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 1 Apr 2020 15:07:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 1 Apr 2020 15:07:53 +0300    

Click here for diff

Reported-by: Erik Rijkers  
Discussion: https://postgr.es/m/82529ecf9bcc58d5b5cf9f3ffb699881%40xs4all.nl  

M doc/src/sgml/intarray.sgml

Correct CREATE INDEX documentation for opclass parameters

commit   : 3eabc62312ef9da7885d2d3380986e0592a0ee5d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 1 Apr 2020 15:01:26 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 1 Apr 2020 15:01:26 +0300    

Click here for diff

Old versions of opclass parameters patch supported ability to specify DEFAULT  
as the opclass name in CREATE INDEX command.  This ability was removed in the  
final version, but 911e702077 still mentions that in the documentation.  

M doc/src/sgml/ref/create_index.sgml

Documentation corrections for opclass parameters

commit   : 3f1802e1fdb74a33db176291be27a2ec243511c6    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 1 Apr 2020 14:42:17 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 1 Apr 2020 14:42:17 +0300    

Click here for diff

Discussion: https://postgr.es/m/20200331024419.GB14618%40telsasoft.com  
Author: Justin Pryzby  

M doc/src/sgml/hstore.sgml
M doc/src/sgml/intarray.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/textsearch.sgml

Fix crash in psql when attempting to reuse old connection

commit   : 8d84dd00123985e739233fa67c9b1d555f33ed03    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Apr 2020 14:45:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Apr 2020 14:45:45 +0900    

Click here for diff

In a psql session, if the connection to the server is abruptly cut, the  
referenced connection would become NULL as of CheckConnection().  This  
could cause a hard crash with psql if attempting to connect by reusing  
the past connection's data because of a null-pointer dereference with  
either PQhost() or PQdb().  This issue is fixed by making sure that no  
reuse of the past connection is done if it does not exist.  
  
Issue has been introduced by 6e5f8d4, so backpatch down to 12.  
  
Reported-by: Hugh Wang  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/bin/psql/command.c

Fix coverity complaint about commit 40d964ec99.

commit   : 2401d93718310237b3cb1ff914abc1bcbdd8e1dc    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 1 Apr 2020 09:28:13 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 1 Apr 2020 09:28:13 +0530    

Click here for diff

The coverity complained that dividing integer expressions and then  
converting the integer quotient to type "double" would lose fractional  
part.  Typecasting one of the arguments of expression with double should  
fix the report.  
  
Author: Mahendra Singh Thalor  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuum.c

psql: do file completion for \gx

commit   : 08481eedd186ea5c22eef86e85cacacbc715f995    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 23:01:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 23:01:34 -0400    

Click here for diff

This was missed when the feature was added.  
  
Reported-by: Vik Fearing  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

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

Add -c/--restore-target-wal to pg_rewind

commit   : a7e8ece41cf7a96d8a9c4c037cdfef304d950831    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Apr 2020 10:57:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Apr 2020 10:57:03 +0900    

Click here for diff

pg_rewind needs to copy from the source cluster to the target cluster a  
set of relation blocks changed from the previous checkpoint where WAL  
forked up to the end of WAL on the target.  Building this list of  
relation blocks requires a range of WAL segments that may not be present  
anymore on the target's pg_wal, causing pg_rewind to fail.  It is  
possible to work around this issue by copying manually the WAL segments  
needed but this may lead to some extra and actually useless work.  
  
This commit introduces a new option allowing pg_rewind to use a  
restore_command while doing the rewind by grabbing the parameter value  
of restore_command from the target cluster configuration.  This allows  
the rewind operation to be more reliable, so as only the WAL segments  
needed by the rewind are restored from the archives.  
  
In order to be able to do that, a new routine is added to src/common/ to  
allow frontend tools to restore files from archives using an  
already-built restore command.  This version is more simple than the  
backend equivalent as there is no need to handle the non-recovery case.  
  
Author: Alexey Kondratov  
Reviewed-by: Andrey Borodin, Andres Freund, Alvaro Herrera, Alexander  
Korotkov, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/common/Makefile
M src/common/exec.c
A src/common/fe_archive.c
A src/include/common/fe_archive.h
M src/include/port.h
M src/tools/msvc/Mkvcbuild.pm

doc: remove mention of bitwise operators as solely type-limited

commit   : 92d31085e926253aa650b9d1e1f2f09934d0ddfc    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 18:44:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 18:44:29 -0400    

Click here for diff

There are other operators that have limited number data type support, so  
just remove the sentence.  
  
Reported-by: Sergei Agalakov  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/func.sgml

doc: clarify hierarchy of objects: global, db, schema, etc.

commit   : 009e422c1b6854870b6b7f6ba0b7e2816395d933    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 18:10:39 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 18:10:39 -0400    

Click here for diff

The previous wording was confusing because it wasn't in decreasing order  
and had to backtrack.  Also clarify role/user wording.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/manage-ag.sgml

doc: clarify when row-level locks are released

commit   : 046fd4f364157fca85eadfddb0f0e8e5d7ceef26    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 17:57:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 17:57:44 -0400    

Click here for diff

They are released just like table-level locks.  Also clean up wording.  
(Uses wording "rolled back to".)  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/mvcc.sgml

Add CREATE INDEX deduplication assertions.

commit   : 7dbe290da446544a04ace7d342841070f062a0ed    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 31 Mar 2020 14:38:39 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 31 Mar 2020 14:38:39 -0700    

Click here for diff

Add two assertions that verify the assumptions about posting list tuple  
space accounting and suffix truncation made within nbtsort.c.  

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

Revert erroroneous commit 834b80464d; my apologies

commit   : c2da793fd28073603c39d7abfffbc203a9bd4ac0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 17:32:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 17:32:00 -0400    

Click here for diff

Backpatch-through: master  

M doc/src/sgml/mvcc.sgml

dummy commit

commit   : 834b80464d653c976787f5b5849fa0595678d0a0    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 12 Mar 2020 15:42:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 12 Mar 2020 15:42:35 -0400    

Click here for diff

M doc/src/sgml/mvcc.sgml

doc: add namespace column to pg_buffercache example query

commit   : 9b2009c4cfe1450228b941aba52e00e6bb938282    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 17:16:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 17:16:33 -0400    

Click here for diff

Without the namespace, the table name could be ambiguous.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/pgbuffercache.sgml

doc: clarify which table creation is used for inheritance part.

commit   : d97d55460bbda698a8d3ca100bee5485255b888f    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 17:07:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 17:07:43 -0400    

Click here for diff

Previously people might assume that the partition syntax version of  
CREATE TABLE is to be used for the inheritance partition table example;  
mention that the non-partitioned version should be used.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ddl.sgml

Fix race condition in statext_store().

commit   : fe3036527a1ff715bceb22ff5cba919001262a71    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 17:06:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 17:06:22 -0400    

Click here for diff

Must hold some lock on the pg_statistic_ext_data catalog *before*  
we look up the tuple we aim to replace.  Otherwise a concurrent  
VACUUM FULL or similar operation could move it to a different TID,  
leaving us trying to replace the wrong tuple.  
  
Back-patch to v12 where this got broken.  
  
Credit goes to Dean Rasheed; I'm just doing the clerical work.  
  
Discussion: https://postgr.es/m/CAEZATCU0zHMDiQV0g8P2U+YSP9C1idUPrn79DajsbonwkN0xvQ@mail.gmail.com  

M src/backend/statistics/extended_stats.c

doc: adjust UPDATE/DELETE's FROM/USING to match SELECT's FROM

commit   : 33cd0e5ea65d1fad0a579fa7ef0bab337246c231    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 16:31:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 16:31:44 -0400    

Click here for diff

Previously the syntax and wording were unclear.  
  
Reported-by: Alexey Bashtanov  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/update.sgml

Still another try at stabilizing stats_ext test results.

commit   : 0936d1b6ffc6d59b4d17f3d6e53c036110c02b44    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 16:09:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 16:09:17 -0400    

Click here for diff

The stats_ext test is not expecting that autovacuum will touch  
any of its tables; an expectation falsified by commit b07642dbc.  
Although I'm suspicious that there's something else going on that  
makes extended stats estimates not 100% reproducible, it's pretty  
easy to demonstrate that there are places in this test that fail  
if an autovacuum updates the table's stats unexpectedly.  
  
Hence, revert the band-aid changes made by 2dc16efed and 24566b359  
in favor of summarily disabling autovacuum for all the tables that  
this test checks estimated rowcounts for.  
  
Also remove an evidently obsolete comment at the head of the test.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove header noise from test_decoding test

commit   : 69360b34589bd6dbc7bc58dec718f938167f1071    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 31 Mar 2020 16:37:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 31 Mar 2020 16:37:24 -0300    

Click here for diff

Use psql's expanded output to avoid a pointless header.  
  
Kyotaro Horiguchi, after an idea of Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve the message logged when recovery is paused.

commit   : b0236508d3589a45e574284cd3303b689111765d    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 1 Apr 2020 03:35:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 1 Apr 2020 03:35:13 +0900    

Click here for diff

When recovery target is reached and recovery is paused because of  
recovery_target_action=pause, executing pg_wal_replay_resume() causes  
the standby to promote, i.e., the recovery to end. So, in this case,  
the previous message "Execute pg_wal_replay_resume() to continue"  
logged was confusing because pg_wal_replay_resume() doesn't cause  
the recovery to continue.  
  
This commit improves the message logged when recovery is paused,  
and the proper message is output based on what (pg_wal_replay_pause  
or recovery_target_action) causes recovery to be paused.  
  
Author: Sergei Kornilov, revised by Fujii Masao  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

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

Allow ecpg to be built stand-alone, allow parallel libpq make

commit   : 051fd5e0f99b14d7bd76fb800bd077bf394fecd5    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 14:17:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Mar 2020 14:17:32 -0400    

Click here for diff

This change defines SHLIB_PREREQS for the libpgport dependency, rather  
than using a makefile rule.  This was broken in PG 12.  
  
Reported-by: Filip Janus  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Dagfinn Ilmari Mannsåker (for libpq)  
  
Backpatch-through: 12  

M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/Makefile

Teach pg_ls_dir_files() to ignore ENOENT failures from stat().

commit   : 82e801852274e46492b0e160624a850157c677e4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 12:57:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 12:57:55 -0400    

Click here for diff

Buildfarm experience shows that this function can fail with ENOENT  
if some other process unlinks a file between when we read the directory  
entry and when we try to stat() it.  The problem is old but we had  
not noticed it until 085b6b667 added regression test coverage.  
  
To fix, just ignore ENOENT failures.  There is one other case that  
this might hide: a symlink that points to nowhere.  That seems okay  
though, at least better than erroring.  
  
Back-patch to v10 where this function was added, since the regression  
test cases were too.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix lquery's NOT handling, and add ability to quantify non-'*' items.

commit   : 70dc4c509b330fdd965d795e8d7f41f09d56c9ae    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 11:14:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 11:14:30 -0400    

Click here for diff

The existing implementation of the ltree ~ lquery match operator is  
sufficiently complex and undocumented that it's hard to tell exactly  
what it does.  But one thing it clearly gets wrong is the combination  
of NOT symbols (!) and '*' symbols.  A pattern such as '*.!foo.*'  
should, by any ordinary understanding of regular expression behavior,  
match any ltree that has at least one label that's not "foo".  As best  
we can tell by experimentation, what it's actually matching is any  
ltree in which *no* label is "foo".  That's surprising, and not at all  
what the documentation says.  
  
Now, that's arguably a useful behavior, so if we rewrite to fix the  
bug we should provide some other way to get it.  To do so, add the  
ability to attach lquery quantifiers to non-'*' items as well as '*'s.  
Then the pattern '!foo{,}' expresses "any ltree in which no label is  
foo".  For backwards compatibility, the default quantifier for non-'*'  
items has to be "{1}", although the default for '*' items is '{,}'.  
I wouldn't have done it like that in a green field, but it's not  
totally horrible.  
  
Armed with that, rewrite checkCond() from scratch.  Treating '*' and  
non-'*' items alike makes it simpler, not more complicated, so that  
the function actually gets a lot shorter than it was.  
  
Filip Rembiałkowski, Tom Lane, Nikita Glukhov, per a very  
ancient bug report from M. Palm  
  
Discussion: https://postgr.es/m/CAP_rww=waX2Oo6q+MbMSiZ9ktdj6eaJj0cQzNu=Ry2cCDij5fw@mail.gmail.com  

M contrib/ltree/expected/ltree.out
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltree_io.c
M contrib/ltree/sql/ltree.sql
M doc/src/sgml/ltree.sgml

Improve error messages in ltree_in and lquery_in.

commit   : e07e2a40bd0c3c02a9baf2e5ddccf665e73208fb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 10:30:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Mar 2020 10:30:59 -0400    

Click here for diff

Ensure that the type name is mentioned in all cases (bare "syntax error"  
isn't that helpful).  Avoid using the term "level", since that's not  
used in the documentation.  Phrase error position reports as "at  
character N" not "in position N"; the latter seems ambiguous, and it's  
certainly not how we say it elsewhere.  For the same reason, make the  
character position values be 1-based not 0-based.  Provide a position  
in more cases.  (I continued to leave that out of messages complaining  
about end-of-input, where it seemed pointless, as well as messages  
complaining about overall input complexity, where fingering any one part  
of the input would be arbitrary.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree_io.c
M contrib/ltree/sql/ltree.sql
M contrib/ltree_plpython/expected/ltree_plpython.out

Improve error reporting in opclasscmds.c

commit   : 02a5786df24b12c6379ef1b0375b70b8a9fb4925    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 31 Mar 2020 17:51:57 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 31 Mar 2020 17:51:57 +0300    

Click here for diff

This commit improves error reporting introduced by 911e702077.  It puts  
argument of errmsg() to the single line for easier grepping source for error  
text.  Also it improves wording of errhint().  

M src/backend/commands/opclasscmds.c
M src/test/regress/expected/alter_generic.out

Fix assorted typos

commit   : 087d3d0583cf292146a7385746d1f5b53eeeaee6    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 31 Mar 2020 16:00:06 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 31 Mar 2020 16:00:06 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/ref/psql-ref.sgml
M src/backend/storage/ipc/procarray.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/mb/stringinfo_mb.c
M src/bin/pg_dump/pg_dump.c
M src/include/access/attmap.h

Fix INSERT OVERRIDING USER VALUE behavior

commit   : de3bbfcc962f24c1a20a17b76c604e5973a05817    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 31 Mar 2020 08:40:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 31 Mar 2020 08:40:32 +0200    

Click here for diff

The original implementation disallowed using OVERRIDING USER VALUE on  
identity columns defined as GENERATED ALWAYS, which is not per  
standard.  So allow that now.  
  
Expand documentation and tests around this.  
  
Author: Dean Rasheed <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Vik Fearing <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAEZATCVrh2ufCwmzzM%3Dk_OfuLhTTPBJCdFkimst2kry4oHepuQ%40mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/update.sgml
M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/identity.out
M src/test/regress/sql/identity.sql

Move routine definitions of xlogarchive.c to a new header file

commit   : 616ae3d2b0566e91b49f301bf08410a9972fed93    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 31 Mar 2020 15:33:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 31 Mar 2020 15:33:04 +0900    

Click here for diff

The definitions of the routines defined in xlogarchive.c have been part  
of xlog_internal.h which is included by several frontend tools, but all  
those routines are only called by the backend.  More cleanup could be  
done within xlog_internal.h, but that's already a nice cut.  
  
This will help a follow-up patch for pg_rewind where handling of  
restore_command is added for frontends.  
  
Author: Alexey Kondratov, Michael Paquier  
Reviewed-by: Álvaro Herrera, Alexander Korotkov  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/replication/walreceiver.c
M src/include/access/xlog_internal.h
A src/include/access/xlogarchive.h

Update SQL features

commit   : fc8c3bdde20c4045659f082910cfcbb2b8c9fa4a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 31 Mar 2020 08:25:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 31 Mar 2020 08:25:03 +0200    

Click here for diff

Set T653 to supported.  This has always been possible.  

M src/backend/catalog/sql_features.txt

Avoid calls to RelationGetRelationName() and RelationGetNamespace() in vacuum code.

commit   : ef75140fe756e6460524b067e063beac109853ec    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 31 Mar 2020 09:34:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 31 Mar 2020 09:34:49 +0530    

Click here for diff

After commit b61d161c14, during vacuum, we cache the information of  
relation name and relation namespace in local structure LVRelStats so that  
we can use it in an error callback function.  We can use the cached  
information to avoid the calls to RelationGetRelationName(),  
RelationGetNamespace() and get_namespace_name().  This is mainly for the  
consistent in vacuum code path but it will avoid the extra syscache lookup  
we do in get_namespace_name().  
  
Author: Justin Pryzby  
Reviewed-by: Amit Kapila  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Further simplify nbtree high key truncation.

commit   : f01157e2ac8ac4dff8ba159c36edf2fdb7d6704e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 30 Mar 2020 17:34:12 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 30 Mar 2020 17:34:12 -0700    

Click here for diff

Commit 7c2dbc69 reorganized _bt_truncate() in a way that enables a  
further simplification that I (pgeoghegan) missed:  Since we mark the  
tuple that is returned to the caller as a pivot tuple before the point  
where its heap TID is set as of 7c2dbc69, it is possible to use the high  
level BTreeTupleGetHeapTID() inline function to get an item pointer.  Do  
it that way now.  This approach is clearer and more maintainable.  

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

Revert "Skip redundant anti-wraparound vacuums"

commit   : dd9ac7d5d80608a640bb82cffb6a805ce84cf112    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 31 Mar 2020 08:27:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 31 Mar 2020 08:27:47 +0900    

Click here for diff

This reverts commit 2aa6e33, that added a fast path to skip  
anti-wraparound and non-aggressive autovacuum jobs (these have no sense  
as anti-wraparound implies aggressive).  With a cluster using a high  
amount of relations with a portion of them being heavily updated, this  
could cause autovacuum to lock down, with autovacuum workers attempting  
repeatedly those jobs on the same relations for the same database, that  
just kept being skipped.  This lock down can be solved with a manual  
VACUUM FREEZE.  
  
Justin King has reported one environment where the issue happened, and  
Julien Rouhaud and I have been able to reproduce it in a second  
environment.  With a very aggressive autovacuum_freeze_max_age,  
triggering those jobs with pgbench is a matter of minutes, and hitting  
the lock down is a lot harder (my local tests failed to do that).  
  
Note that anti-wraparound and non-aggressive jobs can only be triggered  
on a subset of shared catalogs:  
- pg_auth_members  
- pg_authid  
- pg_database  
- pg_replication_origin  
- pg_shseclabel  
- pg_subscription  
- pg_tablespace  
While the lock down was possible down to v12, the root cause of those  
jobs is a much older issue, which needs more analysis.  
  
Bonus thanks to Andres Freund for the discussion.  
  
Reported-by: Justin King  
Discussion: https://postgr.es/m/CAE39h22zPLrkH17GrkDgAYL3kbjvySYD1io+rtnAUFnaJJVS4g@mail.gmail.com  
Backpatch-through: 12  

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

Refactor nbtree high key truncation.

commit   : 7c2dbc691c3e19b7d33c78f6c8aacc6e0cab510b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 30 Mar 2020 15:52:39 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 30 Mar 2020 15:52:39 -0700    

Click here for diff

Simplify _bt_truncate(), the routine that generates truncated leaf page  
high keys.  Remove a micro-optimization that avoided a second palloc0()  
call (this was used when a heap TID was needed in the final pivot tuple,  
though only when the index happened to not be an INCLUDE index).  
  
Removing this dubious micro-optimization allows _bt_truncate() to use  
the index_truncate_tuple() indextuple.c utility routine in all cases.  
This was already the common case.  
  
This commit is a HEAD-only follow up to bugfix commit 4b42a899.  

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

Deduplicate PageIsNew() check in lazy_scan_heap().

commit   : d4b34f60c54904bb3647911dfd9d79d8a4fab430    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 30 Mar 2020 13:51:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 30 Mar 2020 13:51:12 -0700    

Click here for diff

The recheck isn't needed anymore, as RelationGetBufferForTuple() now  
extends the relation with RBM_ZERO_AND_LOCK. Previously we needed to  
handle the fact that relation extension extended the relation and then  
separately acquired a lock on the page - while expecting that the page  
is empty.  
  
Reported-By: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQArA_=J0D5T258xsCY6Xtf6wiH4b=QDPDgVS+WZUN10WDw@mail.gmail.com  

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

Fix missing SP-GiST support in 911e702077

commit   : 364bdd0b411343747aeca17708ff7817d7fe0b00    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 30 Mar 2020 23:45:03 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 30 Mar 2020 23:45:03 +0300    

Click here for diff

911e702077 misses setting of amoptsprocnum for SP-GiST.  This commit fixes  
that.  

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

Remove rudiments of supporting procnum == 0 from 911e702077

commit   : 851b14b0c69b3773753a3c202bff42c3e4425d8d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 30 Mar 2020 23:40:22 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 30 Mar 2020 23:40:22 +0300    

Click here for diff

Early versions of opclass options patch uses zero support procedure as opclass  
options procedure.  This commit removes rudiments of it, which were committed  
in 911e702077.  Also, it implements correct handling of amoptsprocnum == 0.  

M src/backend/access/index/indexam.c
M src/backend/utils/cache/relcache.c

Consistently truncate non-key suffix columns.

commit   : 4b42a89938ac9d2ec06e9d831356407040e9094c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 30 Mar 2020 12:03:59 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 30 Mar 2020 12:03:59 -0700    

Click here for diff

INCLUDE indexes failed to have their non-key attributes physically  
truncated away in certain rare cases.  This led to physically larger  
pivot tuples that contained useless non-key attribute values.  The  
impact on users should be negligible, but this is still clearly a  
regression (Postgres 11 supports INCLUDE indexes, and yet was not  
affected).  
  
The bug appeared in commit dd299df8, which introduced "true" suffix  
truncation of key attributes.  
  
Discussion: https://postgr.es/m/CAH2-Wz=E8pkV9ivRSFHtv812H5ckf8s1-yhx61_WrJbKccGcrQ@mail.gmail.com  
Backpatch: 12-, where "true" suffix truncation was introduced.  

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

Implement operator class parameters

commit   : 911e70207703799605f5a0e8aad9f06cff067c63    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 30 Mar 2020 19:17:11 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 30 Mar 2020 19:17:11 +0300    

Click here for diff

PostgreSQL provides set of template index access methods, where opclasses have  
much freedom in the semantics of indexing.  These index AMs are GiST, GIN,  
SP-GiST and BRIN.  There opclasses define representation of keys, operations on  
them and supported search strategies.  So, it's natural that opclasses may be  
faced some tradeoffs, which require user-side decision.  This commit implements  
opclass parameters allowing users to set some values, which tell opclass how to  
index the particular dataset.  
  
This commit doesn't introduce new storage in system catalog.  Instead it uses  
pg_attribute.attoptions, which is used for table column storage options but  
unused for index attributes.  
  
In order to evade changing signature of each opclass support function, we  
implement unified way to pass options to opclass support functions.  Options  
are set to fn_expr as the constant bytea expression.  It's possible due to the  
fact that opclass support functions are executed outside of expressions, so  
fn_expr is unused for them.  
  
This commit comes with some examples of opclass options usage.  We parametrize  
signature length in GiST.  That applies to multiple opclasses: tsvector_ops,  
gist__intbig_ops, gist_ltree_ops, gist__ltree_ops, gist_trgm_ops and  
gist_hstore_ops.  Also we parametrize maximum number of integer ranges for  
gist__int_ops.  However, the main future usage of this feature is expected  
to be json, where users would be able to specify which way to index particular  
json parts.  
  
Catversion is bumped.  
  
Discussion: https://postgr.es/m/d22c3a18-31c7-1879-fc11-4c1ce2f5e5af%40postgrespro.ru  
Author: Nikita Glukhov, revised by me  
Reviwed-by: Nikolay Shaplov, Robert Haas, Tom Lane, Tomas Vondra, Alvaro Herrera  

M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvalidate.c
M contrib/hstore/Makefile
M contrib/hstore/expected/hstore.out
A contrib/hstore/hstore–1.6–1.7.sql
M contrib/hstore/hstore.control
M contrib/hstore/hstore_gist.c
M contrib/hstore/sql/hstore.sql
M contrib/intarray/Makefile
M contrib/intarray/_int.h
M contrib/intarray/_int_bool.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_tool.c
M contrib/intarray/_intbig_gist.c
M contrib/intarray/expected/_int.out
A contrib/intarray/intarray–1.2–1.3.sql
M contrib/intarray/intarray.control
M contrib/intarray/sql/_int.sql
M contrib/ltree/Makefile
M contrib/ltree/_ltree_gist.c
M contrib/ltree/expected/ltree.out
A contrib/ltree/ltree–1.1–1.2.sql
M contrib/ltree/ltree.control
M contrib/ltree/ltree.h
M contrib/ltree/ltree_gist.c
M contrib/ltree/sql/ltree.sql
M contrib/pg_trgm/Makefile
M contrib/pg_trgm/expected/pg_trgm.out
A contrib/pg_trgm/pg_trgm–1.4–1.5.sql
M contrib/pg_trgm/pg_trgm.control
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_gist.c
M doc/src/sgml/hstore.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/intarray.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/textsearch.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/fmgr/fmgr.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/brin_internal.h
M src/include/access/genam.h
M src/include/access/gin.h
M src/include/access/gist.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/access/reloptions.h
M src/include/access/spgist.h
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_proc.dat
M src/include/fmgr.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/utils/lsyscache.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/ruleutils.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/btree_index.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/tsearch.out
M src/test/regress/input/create_function_1.source
M src/test/regress/output/create_function_1.source
M src/test/regress/regress.c
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/btree_index.sql
M src/test/regress/sql/opr_sanity.sql
M src/test/regress/sql/tsearch.sql
M src/tools/pgindent/typedefs.list

Allow using Unix-domain sockets on Windows in tests

commit   : 1d53432ff940b789c2431ba476a2a6e2db3edf84    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Mar 2020 17:30:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Mar 2020 17:30:44 +0200    

Click here for diff

The test suites currently don't use Unix-domain sockets on Windows.  
This optionally allows enabling that by setting the environment  
variable PG_TEST_USE_UNIX_SOCKETS.  
  
This should currently be considered experimental.  In particular,  
pg_regress.c contains some comments that the cleanup code for  
Unix-domain sockets doesn't work correctly under Windows, which hasn't  
been an problem until now.  But it's good enough for locally  
supervised testing of the functionality.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_ctl/t/001_start_stop.pl
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/regress/pg_regress.c

Be more careful about extracting encoding from locale strings on Windows.

commit   : 8c49454caa636a02aa37e10b8941b7e67b6954bb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Mar 2020 11:14:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Mar 2020 11:14:58 -0400    

Click here for diff

GetLocaleInfoEx() can fail on strings that setlocale() was perfectly  
happy with.  A common way for that to happen is if the locale string  
is actually a Unix-style string, say "et_EE.UTF-8".  In that case,  
what's after the dot is an encoding name, not a Windows codepage number;  
blindly treating it as a codepage number led to failure, with a fairly  
silly error message.  Hence, check to see if what's after the dot is  
all digits, and if not, treat it as a literal encoding name rather than  
a codepage number.  This will do the right thing with many Unix-style  
locale strings, and produce a more sensible error message otherwise.  
  
Somewhat independently of that, treat a zero (CP_ACP) result from  
GetLocaleInfoEx() as meaning that we must use UTF-8 encoding.  
  
Back-patch to all supported branches.  
  
Juan José Santamaría Flecha  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/chklocale.c

Attempt to fix unstable regression tests, take 2

commit   : 24566b359d095c3800c2a326d88a595722813f58    
  
author   : David Rowley <[email protected]>    
date     : Mon, 30 Mar 2020 23:41:11 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 30 Mar 2020 23:41:11 +1300    

Click here for diff

Following up on 2dc16efed, petalura has suffered some additional  
failures in stats_ext which again appear to be around the timing of an  
autovacuum during the test, causing instability in the row estimates.  
  
Again, let's fix this by explicitly performing a VACUUM on the table  
and not leave it to happen by chance of an autovacuum pass.  
  
Discussion: https://postgr.es/m/CAApHDvok5hmXr%2BbUbJe7%2B2sQzWo4B_QzSk7RKFR9fP6BjYXx5g%40mail.gmail.com  

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

Report waiting via PS while recovery is waiting for buffer pin in hot standby.

commit   : 64638ccba3a659d8b8a3a4bc5b47307685a64a8a    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 30 Mar 2020 17:35:03 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 30 Mar 2020 17:35:03 +0900    

Click here for diff

Previously while the startup process was waiting for the recovery conflict  
with snapshot, tablespace or lock to be resolved, waiting was reported in  
PS display, but not in the case of recovery conflict with buffer pin.  
This commit makes the startup process in hot standby report waiting via PS  
while waiting for the conflicts with other backends holding buffer pins to  
be resolved.  
  
Author: Masahiko Sawada  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CA+fd4k4mXWTwfQLS3RPwGr4xnfAEs1ysFfgYHvmmoUgv6Zxvmg@mail.gmail.com  

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

Improve handling of parameter differences in physical replication

commit   : 246f136e76ecd26844840f2b2057e2c87ec9868d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Mar 2020 09:19:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Mar 2020 09:19:40 +0200    

Click here for diff

When certain parameters are changed on a physical replication primary,  
this is communicated to standbys using the XLOG_PARAMETER_CHANGE WAL  
record.  The standby then checks whether its own settings are at least  
as big as the ones on the primary.  If not, the standby shuts down  
with a fatal error.  
  
The correspondence of settings between primary and standby is required  
because those settings influence certain shared memory sizings that  
are required for processing WAL records that the primary might send.  
For example, if the primary sends a prepared transaction, the standby  
must have had max_prepared_transaction set appropriately or it won't  
be able to process those WAL records.  
  
However, fatally shutting down the standby immediately upon receipt of  
the parameter change record might be a bit of an overreaction.  The  
resources related to those settings are not required immediately at  
that point, and might never be required if the activity on the primary  
does not exhaust all those resources.  If we just let the standby roll  
on with recovery, it will eventually produce an appropriate error when  
those resources are used.  
  
So this patch relaxes this a bit.  Upon receipt of  
XLOG_PARAMETER_CHANGE, we still check the settings but only issue a  
warning and set a global flag if there is a problem.  Then when we  
actually hit the resource issue and the flag was set, we issue another  
warning message with relevant information.  At that point we pause  
recovery, so a hot standby remains usable.  We also repeat the last  
warning message once a minute so it is harder to miss or ignore.  
  
Reviewed-by: Sergei Kornilov <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lock.c
M src/include/access/xlog.h

Add new part SQL/MDA to information_schema.sql_parts

commit   : a01e1b8b9d937894a916465643d9707861ffb838    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Mar 2020 08:55:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Mar 2020 08:55:55 +0200    

Click here for diff

M src/backend/catalog/information_schema.sql

commit   : 6aba63ef3e606db71beb596210dd95fa73c44ce2    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 30 Mar 2020 13:51:05 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 30 Mar 2020 13:51:05 +0900    

Click here for diff

This commit adds query_string argument into the planner-related functions  
and hook and allows us to pass the query string to them.  
  
Currently there is no user of the query string passed. But the upcoming patch  
for the planning counters will add the planning hook function into  
pg_stat_statements and the function will need the query string. So this change  
will be necessary for that patch.  
  
Also this change is useful for some extensions that want to use the query  
string in their planner hook function.  
  
Author: Pascal Legrand, Julien Rouhaud  
Reviewed-by: Yoshikazu Imai, Tom Lane, Fujii Masao  
Discussion: https://postgr.es/m/CAOBaU_bU1m3_XF5qKYtSj1ua4dxd=FWDyh2SH4rSJAUUfsGmAQ@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/matview.c
M src/backend/commands/portalcmds.c
M src/backend/executor/functions.c
M src/backend/optimizer/plan/planner.c
M src/backend/tcop/postgres.c
M src/backend/utils/cache/plancache.c
M src/include/optimizer/optimizer.h
M src/include/optimizer/planner.h
M src/include/tcop/tcopprot.h

Expose BufferUsageAccumDiff().

commit   : 4a539a25ebfc48329fd656a95f3c1eb2cda38af3    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 30 Mar 2020 12:15:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 30 Mar 2020 12:15:26 +0900    

Click here for diff

Previously pg_stat_statements calculated the difference of buffer counters  
by its own code even while BufferUsageAccumDiff() had the same code.  
This commit expose BufferUsageAccumDiff() and makes pg_stat_statements  
use it for the calculation, in order to simply the code.  
  
This change also would be useful for the upcoming patch for the planning  
counters in pg_stat_statements because the patch will add one more code  
for the calculation of difference of buffer counters and that can easily be  
done by using BufferUsageAccumDiff().  
  
Author: Julien Rouhaud  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/executor/instrument.c
M src/include/executor/instrument.h

Introduce vacuum errcontext to display additional information.

commit   : b61d161c146328ae6ba9ed937862d66e5c8b035a    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 30 Mar 2020 07:33:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 30 Mar 2020 07:33:38 +0530    

Click here for diff

The additional information displayed will be block number for error  
occurring while processing heap and index name for error occurring  
while processing the index.  
  
This will help us in diagnosing the problems that occur during a vacuum.  
For ex. due to corruption (either caused by bad hardware or by some bug)  
if we get some error while vacuuming, it can help us identify the block  
in heap and or additional index information.  
  
It sets up an error context callback to display additional information  
with the error.  During different phases of vacuum (heap scan, heap  
vacuum, index vacuum, index clean up, heap truncate), we update the error  
context callback to display appropriate information.  We can extend it to  
a bit more granular level like adding the phases for FSM operations or for  
prefetching the blocks while truncating. However, I felt that it requires  
adding many more error callback function calls and can make the code a bit  
complex, so left those for now.  
  
Author: Justin Pryzby, with few changes by Amit Kapila  
Reviewed-by: Alvaro Herrera, Amit Kapila, Andres Freund, Michael Paquier  
and Sawada Masahiko  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/heap/vacuumlazy.c
M src/tools/pgindent/typedefs.list

Cosmetic improvements in ltree code.

commit   : 2743d9ae4a490a7d96b5c19d50694bd101a87dc8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2020 19:14:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2020 19:14:15 -0400    

Click here for diff

Add more comments in ltree.h, and correct a misstatement or two.  
  
Use a symbol, rather than hardwired constants, for the maximum length  
of an ltree label.  The max length is still hardwired in the associated  
error messages, but I want to clean that up as part of a separate patch  
to improve the error messages.  

M contrib/ltree/ltree.h
M contrib/ltree/ltree_io.c

Doc: correct misstatement about ltree label maximum length.

commit   : 122b0ccfef068b0c0c3716c83a93173866e454aa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2020 18:54:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Mar 2020 18:54:19 -0400    

Click here for diff

The documentation says that the max length is 255 bytes, but  
code inspection says it's actually 255 characters; and relevant  
lengths are stored as uint16 so that that works.  

M doc/src/sgml/ltree.sgml

Document color support

commit   : e1ff780485ca9ff0d2db3cd716b63557fc6ae5e5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Mar 2020 11:13:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Mar 2020 11:13:27 +0200    

Click here for diff

Add a documentation appendix that explains the PG_COLOR and PG_COLORS  
environment variables.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

pg_regress: Observe TMPDIR

commit   : 9cedb1666051516c2763bb0ae4ace583cd26b141    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Mar 2020 09:25:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Mar 2020 09:25:40 +0200    

Click here for diff

Put the temporary socket directory under TMPDIR, if that environment  
variable is set, instead of the hardcoded /tmp.  
  
This allows running the tests if there is no /tmp at all (for example  
on Windows, although running the tests with Unix-domain sockets is not  
enabled on Windows yet).  We also use TMPDIR everywhere else /tmp is  
hardcoded, so this makes the behavior consistent.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/test/regress/pg_regress.c

Update SQL features

commit   : b79911dc8c0dc3b864999b9a17333716d602c6a0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Mar 2020 08:56:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Mar 2020 08:56:41 +0200    

Click here for diff

Change F181 to supported.  It requires that an embedded C program can  
be split across multiple files, which ECPG easily supports.  

M src/backend/catalog/sql_features.txt

Attempt to fix unstable regression tests

commit   : 2dc16efedc767aec38368d215eb7695b87a054b5    
  
author   : David Rowley <[email protected]>    
date     : Sun, 29 Mar 2020 19:36:20 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sun, 29 Mar 2020 19:36:20 +1300    

Click here for diff

b07642dbc added code to trigger autovacuums based on the number of  
inserts into a table. This seems to have caused some regression test  
results to destabilize. I suspect this is due to autovacuum triggering a  
vacuum sometime after the test's ANALYZE run and perhaps reltuples is  
ending up being set to a slightly different value as a result.  
  
Attempt to resolve this by running a VACUUM ANALYZE on the affected table  
instead of just ANALYZE. pg_class.reltuples will still get set to whatever  
ANALYZE chooses but we should no longer get the proceeding autovacuum  
overriding that.  
  
The overhead this adds to each test's runtime seems small enough not to  
worry about. I measure 3-4% on stats_ext and can't measure any change in  
partition_aggregate.  
  
I'm unable to recreate the issue locally, so this is a bit of a blind  
fix.  
  
Discussion: https://postgr.es/m/CAApHDvpWmpqYrKwwDQyeDq8dAyK7GMNaxDhrG69CkSuXoEg%2BVg%40mail.gmail.com  

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

Make deduplication use number of key attributes.

commit   : a7b9d24e4e00048bf9d99b197996476dcf9492de    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 28 Mar 2020 20:25:03 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 28 Mar 2020 20:25:03 -0700    

Click here for diff

Use IndexRelationGetNumberOfKeyAttributes() rather than  
IndexRelationGetNumberOfAttributes() when determining whether or not two  
index tuples are suitable for merging together into a single posting  
list tuple.  This is a little bit tidier.  It brings affected code in  
nbtdedup.c a little closer to similar, related code in nbtsplitloc.c.  

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

Fix lquery's behavior for consecutive '*' items.

commit   : 9950c8aadf0edd31baec74a729d47d94af636c06    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Mar 2020 18:31:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Mar 2020 18:31:05 -0400    

Click here for diff

Something like "*{2}.*{3}" should presumably mean the same as  
"*{5}", but it didn't.  Improve that.  
  
Get rid of an undocumented and remarkably ugly (though not, as far as  
I can tell, actually unsafe) static variable in favor of passing more  
arguments to checkCond().  
  
Reverse-engineer some commentary.  This function, like all of ltree,  
is still far short of what I would consider the minimum acceptable  
level of internal documentation, but at least now it has more than  
zero comments.  
  
Although this certainly seems like a bug fix, people might not  
thank us for changing query behavior in stable branches, so  
no back-patch.  
  
Nikita Glukhov, with cosmetic improvements by me  
  
Discussion: https://postgr.es/m/CAP_rww=waX2Oo6q+MbMSiZ9ktdj6eaJj0cQzNu=Ry2cCDij5fw@mail.gmail.com  

M contrib/ltree/expected/ltree.out
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/sql/ltree.sql

Protect against overflow of ltree.numlevel and lquery.numlevel.

commit   : 95f7ddfdad99c5ea0500d90ce52075814e10ed8c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Mar 2020 17:09:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Mar 2020 17:09:51 -0400    

Click here for diff

These uint16 fields could be overflowed by excessively long input,  
producing strange results.  Complain for invalid input.  
  
Likewise check for out-of-range values of the repeat counts in lquery.  
(We don't try too hard on that one, notably not bothering to detect  
if atoi's result has overflowed.)  
  
Also detect length overflow in ltree_concat.  
  
In passing, be more consistent about whether "syntax error" messages  
include the type name.  Also, clarify the documentation about what  
the size limit is.  
  
This has been broken for a long time, so back-patch to all supported  
branches.  
  
Nikita Glukhov, reviewed by Benjie Gillam and Tomas Vondra  
  
Discussion: https://postgr.es/m/CAP_rww=waX2Oo6q+MbMSiZ9ktdj6eaJj0cQzNu=Ry2cCDij5fw@mail.gmail.com  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree.h
M contrib/ltree/ltree_io.c
M contrib/ltree/ltree_op.c
M contrib/ltree/sql/ltree.sql
M doc/src/sgml/ltree.sgml

Ensure snapshot is registered within ScanPgRelation().

commit   : 42750b08d946e2a5048454d7b4e127f0e1df3c65    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 28 Mar 2020 11:52:11 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 28 Mar 2020 11:52:11 -0700    

Click here for diff

In 9.4 I added support to use a historical snapshot in  
ScanPgRelation(), while adding logical decoding. Unfortunately a  
conflict with the concurrent removal of SnapshotNow was incorrectly  
resolved, leading to an unregistered snapshot being used.  
  
It is not correct to use an unregistered (or non-active) snapshot for  
anything non-trivial, because catalog invalidations can cause the  
snapshot to be invalidated.  
  
Luckily it seems unlikely to actively cause problems in practice, as  
ScanPgRelation() requires that we already have a lock on the relation,  
we only look for a single row, and we don't appear to rely on the  
result's tid to be correct. It however is clearly wrong and potential  
negative consequences would likely be hard to find. So it seems worth  
backpatching the fix, even without a concrete hazard.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-  

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

Fix costing for disk-based hash aggregation.

commit   : 7351bfeda33b60b69c15791c7eb77a127546df26    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 28 Mar 2020 10:53:01 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 28 Mar 2020 10:53:01 -0700    

Click here for diff

Report and suggestions from Richard Guo and Tomas Vondra.  
  
Discussion: https://postgr.es/m/CAMbWs4_W8fYbAn8KxgidAaZHON_Oo08OYn9ze=7remJymLqo5g@mail.gmail.com  

M src/backend/executor/nodeAgg.c
M src/backend/optimizer/path/costsize.c

Improve the performance and accuracy of numeric sqrt() and ln().

commit   : 4083f445c0cbda2eacb6b17297f9d555397e5eaa    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 28 Mar 2020 14:37:53 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 28 Mar 2020 14:37:53 +0000    

Click here for diff

Instead of using Newton's method to compute numeric square roots, use  
the Karatsuba square root algorithm, which performs better for numbers  
of all sizes. In practice, this is 3-5 times faster for inputs with  
just a few digits and up to around 10 times faster for larger inputs.  
  
Also, the new algorithm guarantees that the final digit of the result  
is correctly rounded, since it computes an integer square root with  
truncation, containing at least 1 extra decimal digit before rounding.  
The former algorithm would occasionally round the wrong way because  
it rounded both the intermediate and final results.  
  
In addition, arrange for sqrt_var() to explicitly support negative  
rscale values (rounding before the decimal point). This allows the  
argument reduction phase of ln_var() to be optimised for large inputs,  
since it only needs to compute square roots with a few more digits  
than the final ln() result, rather than computing all the digits  
before the decimal point. For very large inputs, this can be many  
thousands of times faster.  
  
In passing, optimise div_var_fast() in a couple of places where it was  
doing unnecessary work.  
  
Patch be me, reviewed by Tom Lane and Tels.  
  
Discussion: https://postgr.es/m/CAEZATCV1A7+jD3P30Zu31KjaxeSEyOn3v9d6tYegpxcq3cQu-g@mail.gmail.com  

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

Enable Unix-domain sockets support on Windows

commit   : 8f3ec75de4060d86176ad4ac998eeb87a39748c2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 28 Mar 2020 13:01:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 28 Mar 2020 13:01:42 +0100    

Click here for diff

As of Windows 10 version 1803, Unix-domain sockets are supported on  
Windows.  But it's not automatically detected by configure because it  
looks for struct sockaddr_un and Windows doesn't define that.  So we  
just make our own definition on Windows and override the configure  
result.  
  
Set DEFAULT_PGSOCKET_DIR to empty on Windows so by default no  
Unix-domain socket is used, because there is no good standard  
location.  
  
In pg_upgrade, we have to do some extra tweaking to preserve the  
existing behavior of not using Unix-domain sockets on Windows.  Adding  
support would be desirable, but it needs further work, in particular a  
way to select whether to use Unix-domain sockets from the command-line  
or with a run-time test.  
  
The pg_upgrade test script needs a fix.  The previous code passed  
"localhost" to postgres -k, which only happened to work because  
Windows used to ignore the -k argument value altogether.  We instead  
need to pass an empty string to get the desired effect.  
  
The test suites will continue to not use Unix-domain sockets on  
Windows.  This requires a small tweak in pg_regress.c.  The TAP tests  
don't need to be changed because they decide by the operating system  
rather than HAVE_UNIX_SOCKETS.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M config/c-library.m4
M configure
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/test.sh
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config_manual.h
M src/include/port/win32.h
M src/test/regress/pg_regress.c
M src/tools/msvc/Solution.pm

Prevent functional dependency estimates from exceeding column estimates.

commit   : 87779aa47463d0fb3b4743a7d5c9534994bf7c98    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 28 Mar 2020 12:48:34 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 28 Mar 2020 12:48:34 +0000    

Click here for diff

Formerly we applied a functional dependency "a => b with dependency  
degree f" using the formula  
  
  P(a,b) = P(a) * [f + (1-f)*P(b)]  
  
This leads to the possibility that the combined selectivity P(a,b)  
could exceed P(b), which is not ideal. The addition of support for IN  
and OR clauses (commits 8f321bd16c and ccaa3569f5) would seem to make  
this more likely, since the user-supplied values in such clauses are  
not necessarily compatible with the functional dependency.  
  
Mitigate this by using the formula  
  
  P(a,b) = f * Min(P(a), P(b)) + (1-f) * P(a) * P(b)  
  
instead, which guarantees that the combined selectivity is less than  
each column's individual selectivity. Logically, this is modifies the  
part of the formula that accounts for dependent rows to handle cases  
where P(a) > P(b), whilst not changing the second term which accounts  
for independent rows.  
  
Additionally, this refactors the way that functional dependencies are  
applied, so now dependencies_clauselist_selectivity() estimates both  
the implying clauses and the implied clauses for each functional  
dependency (formerly only the implied clauses were estimated), and now  
all clauses for each attribute are taken into account (formerly only  
one clause for each implied attribute was estimated). This removes the  
previously built-in assumption that only equality clauses will be  
seen, which is no longer true, and opens up the possibility of  
applying functional dependencies to more general clauses.  
  
Patch by me, reviewed by Tomas Vondra.  
  
Discussion: https://postgr.es/m/CAEZATCXaNFZyOhR4XXAfkvj1tibRBEjje6ZbXwqWUB_tqbH%3Drw%40mail.gmail.com  
Discussion: https://postgr.es/m/20200318002946.6dvblukm3cfmgir2%40development  

M src/backend/statistics/dependencies.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Cleanup in SQL features files

commit   : 145cb16d3bd7d20dbf14507905404aa8153ebf2a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 28 Mar 2020 08:46:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 28 Mar 2020 08:46:18 +0100    

Click here for diff

Feature C011 was still listed in sql_feature_packages.txt but had been  
removed from sql_features.txt, so also remove from the former.  

M src/backend/catalog/sql_feature_packages.txt

Trigger autovacuum based on number of INSERTs

commit   : b07642dbcd8d5de05f0ee1dbb72dd6760dd30436    
  
author   : David Rowley <[email protected]>    
date     : Sat, 28 Mar 2020 19:20:12 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 28 Mar 2020 19:20:12 +1300    

Click here for diff

Traditionally autovacuum has only ever invoked a worker based on the  
estimated number of dead tuples in a table and for anti-wraparound  
purposes. For the latter, with certain classes of tables such as  
insert-only tables, anti-wraparound vacuums could be the first vacuum that  
the table ever receives. This could often lead to autovacuum workers being  
busy for extended periods of time due to having to potentially freeze  
every page in the table. This could be particularly bad for very large  
tables. New clusters, or recently pg_restored clusters could suffer even  
more as many large tables may have the same relfrozenxid, which could  
result in large numbers of tables requiring an anti-wraparound vacuum all  
at once.  
  
Here we aim to reduce the work required by anti-wraparound and aggressive  
vacuums in general, by triggering autovacuum when the table has received  
enough INSERTs. This is controlled by adding two new GUCs and reloptions;  
autovacuum_vacuum_insert_threshold and  
autovacuum_vacuum_insert_scale_factor. These work exactly the same as the  
existing scale factor and threshold controls, only base themselves off the  
number of inserts since the last vacuum, rather than the number of dead  
tuples. New controls were added rather than reusing the existing  
controls, to allow these new vacuums to be tuned independently and perhaps  
even completely disabled altogether, which can be done by setting  
autovacuum_vacuum_insert_threshold to -1.  
  
We make no attempt to skip index cleanup operations on these vacuums as  
they may trigger for an insert-mostly table which continually doesn't have  
enough dead tuples to trigger an autovacuum for the purpose of removing  
those dead tuples. If we were to skip cleaning the indexes in this case,  
then it is possible for the index(es) to become bloated over time.  
  
There are additional benefits to triggering autovacuums based on inserts,  
as tables which never contain enough dead tuples to trigger an autovacuum  
are now more likely to receive a vacuum, which can mark more of the table  
as "allvisible" and encourage the query planner to make use of Index Only  
Scans.  
  
Currently, we still obey vacuum_freeze_min_age when triggering these new  
autovacuums based on INSERTs. For large insert-only tables, it may be  
beneficial to lower the table's autovacuum_freeze_min_age so that tuples  
are eligible to be frozen sooner. Here we've opted not to zero that for  
these types of vacuums, since the table may just be insert-mostly and we  
may otherwise freeze tuples that are still destined to be updated or  
removed in the near future.  
  
There was some debate to what exactly the new scale factor and threshold  
should default to. For now, these are set to 0.2 and 1000, respectively.  
There may be some motivation to adjust these before the release.  
  
Author: Laurenz Albe, Darafei Praliaskouski  
Reviewed-by: Alvaro Herrera, Masahiko Sawada, Chris Travers, Andres Freund, Justin Pryzby  
Discussion: https://postgr.es/m/CAC8Q8t%2Bj36G_bLF%3D%2B0iMo6jGNWnLnWb1tujXuJr-%2Bx8ZCCTqoQ%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/postmaster/autovacuum.h
M src/include/utils/rel.h
M src/test/regress/expected/rules.out

Justify nbtree page split locking in code comment.

commit   : 9945ad6e904041be1567a89916ddc64087ed1edc    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 27 Mar 2020 16:44:52 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 27 Mar 2020 16:44:52 -0700    

Click here for diff

Delaying unlocking the right child page until after the point that the  
left child's parent page has been refound is no longer truly necessary.  
Commit 40dae7ec made nbtree tolerant of interrupted page splits.  VACUUM  
was taught to avoid deleting a page that happens to be the right half of  
an incomplete split.  As long as page splits don't unlock the left child  
page until the end of the second/final phase, it should be safe to  
unlock the right child page earlier (at the end of the first phase).  
  
It probably isn't actually useful to release the right child's lock  
earlier like this (it probably won't improve performance).  Even still,  
pointing out that it ought to be safe to do so should make it easier to  
understand the overall design.  

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

Allow walreceiver configuration to change on reload

commit   : 1e6148032e4d27aec75c49264b47ad193405a919    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Mar 2020 19:43:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Mar 2020 19:43:41 -0300    

Click here for diff

The parameters primary_conninfo, primary_slot_name and  
wal_receiver_create_temp_slot can now be changed with a simple "reload"  
signal, no longer requiring a server restart.  This is achieved by  
signalling the walreceiver process to terminate and having it start  
again with the new values.  
  
Thanks to Andres Freund, Kyotaro Horiguchi, Fujii Masao for discussion.  
  
Author: Sergei Kornilov <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/postmaster/startup.c
M src/backend/replication/walreceiver.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h
M src/test/recovery/t/001_stream_rep.pl

Set wal_receiver_create_temp_slot PGC_POSTMASTER

commit   : 092c6936de49effe63daad94855bcd8ef26a09dd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Mar 2020 16:04:52 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Mar 2020 16:04:52 -0300    

Click here for diff

Commit 329730827848 gave walreceiver the ability to create and use a  
temporary replication slot, and made it controllable by a GUC (enabled  
by default) that can be changed with SIGHUP.  That's useful but has two  
problems: one, it's possible to cause the origin server to fill its disk  
if the slot doesn't advance in time; and also there's a disconnect  
between state passed down via the startup process and GUCs that  
walreceiver reads directly.  
  
We handle the first problem by setting the option to disabled by  
default.  If the user enables it, its on their head to make sure that  
disk doesn't fill up.  
  
We handle the second problem by passing the flag via startup rather than  
having walreceiver acquire it directly, and making it PGC_POSTMASTER  
(which ensures a walreceiver always has the fresh value).  A future  
commit can relax this (to PGC_SIGHUP again) by having the startup  
process signal walreceiver to shutdown whenever the value changes.  
  
Author: Sergei Kornilov <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h
M src/include/replication/walreceiver.h

Rearrange validity checks for plpgsql "simple" expressions.

commit   : fbc7a716084ebccd2a996cc415187c269ea54b3e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Mar 2020 14:47:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Mar 2020 14:47:34 -0400    

Click here for diff

Buildfarm experience shows what probably should've occurred to me before:  
if a cache flush occurs partway through building a generic plan, then  
the plansource may have is_valid = false even though the plan is valid.  
We need to accept this case, use the generated plan, and then try to  
replan the next time.  We can't try to replan immediately, because that  
would produce an infinite loop in CLOBBER_CACHE_ALWAYS builds; moreover  
it's really overkill.  (We can assume that the plan is valid, it's just  
possibly a bit stale.  Note that the pre-existing code behaved this way,  
and the non-simple-expression code paths do too.)  Conversely, not using  
the generated plan would drop us into the not-a-simple-expression code  
path, which is bad for performance and would also cause regression-test  
failures due to visibly different error-reporting behavior.  
  
Hence, refactor the validity-check functions so that the initial check  
and recheck cases can react differently to plansource->is_valid.  
This makes their usage a bit simpler, too.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/plancache.c
M src/include/utils/plancache.h
M src/pl/plpgsql/src/pl_exec.c

Update SQL features

commit   : 8d1b9648c5861dd14773e551f0b0f37f7ff22820    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 27 Mar 2020 08:36:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 27 Mar 2020 08:36:08 +0100    

Click here for diff

Change F311 to supported.  This was already accomplished when  
subfeature F311-04 (WITH CHECK OPTION) was added, but the top-level  
feature wasn't updated at the time.  

M src/backend/catalog/sql_features.txt

Improve performance of "simple expressions" in PL/pgSQL.

commit   : 8f59f6b9c0376173a072e4fb7de1edd6a26e6b52    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Mar 2020 18:58:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Mar 2020 18:58:57 -0400    

Click here for diff

For relatively simple expressions (say, "x + 1" or "x > 0"), plpgsql's  
management overhead exceeds the cost of evaluating the expression.  
This patch substantially improves that situation, providing roughly  
2X speedup for such trivial expressions.  
  
First, add infrastructure in the plancache to allow fast re-validation  
of cached plans that contain no table access, and hence need no locks.  
Teach plpgsql to use this infrastructure for expressions that it's  
already deemed "simple" (which in particular will never contain table  
references).  
  
The fast path still requires checking that search_path hasn't changed,  
so provide a fast path for OverrideSearchPathMatchesCurrent by  
counting changes that have occurred to the active search path in the  
current session.  This is simplistic but seems enough for now, seeing  
that PushOverrideSearchPath is not used in any performance-critical  
cases.  
  
Second, manage the refcounts on simple expressions' cached plans using  
a transaction-lifespan resource owner, so that we only need to take  
and release an expression's refcount once per transaction not once per  
expression evaluation.  The management of this resource owner exactly  
parallels the existing management of plpgsql's simple-expression EState.  
  
Add some regression tests covering this area, in particular verifying  
that expression caching doesn't break semantics for search_path changes.  
  
Patch by me, but it owes something to previous work by Amit Langote,  
who recognized that getting rid of plancache-related overhead would  
be a useful thing to do here.  Also thanks to Andres Freund for review.  
  
Discussion: https://postgr.es/m/CAFj8pRDRVfLdAxsWeVLzCAbkLFZhW549K+67tpOc-faC8uH8zw@mail.gmail.com  

M src/backend/catalog/namespace.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/resowner/resowner.c
M src/include/catalog/namespace.h
M src/include/utils/plancache.h
M src/include/utils/resowner.h
M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_simple.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/plpgsql.h
A src/pl/plpgsql/src/sql/plpgsql_simple.sql

Ensure that plpgsql cleans up cleanly during parallel-worker exit.

commit   : 86e5badd22d9ae131a2badb87acdbb20e41811a2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Mar 2020 18:06:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Mar 2020 18:06:55 -0400    

Click here for diff

plpgsql_xact_cb ought to treat events XACT_EVENT_PARALLEL_COMMIT and  
XACT_EVENT_PARALLEL_ABORT like XACT_EVENT_COMMIT and XACT_EVENT_ABORT  
respectively, since its goal is to do process-local cleanup.  This  
oversight caused plpgsql's end-of-transaction cleanup to not get done  
in parallel workers.  Since a parallel worker will exit just after the  
transaction cleanup, the effects of this are limited.  I couldn't find  
any case in the core code with user-visible effects, but perhaps there  
are some in extensions.  In any case it's wrong, so let's fix it before  
it bites us not after.  
  
In passing, add some comments around the handling of expression  
evaluation resources in DO blocks.  There's no live bug there, but it's  
quite unobvious what's happening; at least I thought so.  This isn't  
related to the other issue, except that I found both things while poking  
at expression-evaluation performance.  
  
Back-patch the plpgsql_xact_cb fix to 9.5 where those event types  
were introduced, and the DO-block commentary to v11 where DO blocks  
gained the ability to issue COMMIT/ROLLBACK.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Document that pg_checksums exists in checksums README

commit   : eff5b245df259c73d8342e2f04dba5a832d2ea0a    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 26 Mar 2020 15:05:54 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 26 Mar 2020 15:05:54 +0100    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/backend/storage/page/README

Drop slot's LWLock before returning from SaveSlotToPath()

commit   : 49bf81536e242f079bfbce6e8f95f53f18207dd5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Mar 2020 11:51:39 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Mar 2020 11:51:39 +0100    

Click here for diff

When SaveSlotToPath() is called with elevel=LOG, the early exits didn't  
release the slot's io_in_progress_lock.  
  
This could result in a walsender being stuck on the lock forever.  A  
possible way to get into this situation is if the offending code paths  
are triggered in a low disk space situation.  
  
Author: Pavan Deolasee <[email protected]>  
Reported-by: Craig Ringer <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/56a138c5-de61-f553-7e8f-6789296de785%402ndquadrant.com  

M src/backend/replication/slot.c

Further fixes for ssl_passphrase_callback test module.

commit   : 958aa438aaa473d580f60154786ffd716a28faf2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2020 22:05:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2020 22:05:19 -0400    

Click here for diff

The Makefile should set TAP_TESTS = 1, not implement the infrastructure  
for itself.  For one thing, it missed the appropriate "make clean"  
steps.  For another, the buildfarm isn't running this test because  
it wasn't hooked into "make installcheck" either.  

M src/test/modules/ssl_passphrase_callback/Makefile

Don't listen to localhost in ssl_passphrase_callback test

commit   : e984fb341f293ab21c7d63897357ffca08280268    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 25 Mar 2020 21:14:14 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 25 Mar 2020 21:14:14 -0400    

Click here for diff

Commit 896fcdb230 contained an unnecessary setting that listened to  
localhost. Since the test doesn't actually try to make an SSL connection  
to the database this isn't required. Moreover, it's a security hole.  
  
Per gripe from Tom Lane.  

M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl

Fix assorted portability issues in commit 896fcdb23.

commit   : 13c98bdfc41eefb75da24fd2a886b0ef5314b7f6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2020 19:37:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2020 19:37:30 -0400    

Click here for diff

Some platforms require libssl to be linked explicitly in the new  
SSL test module.  Borrow contrib/sslinfo's code for that.  
  
Since src/test/modules/Makefile now has a variable SUBDIRS list,  
it needs to follow the ALWAYS_SUBDIRS protocol for that (cf.  
comments in Makefile.global.in).  
  
Blindly try to fix MSVC build failures by adding PGDLLIMPORT.  

M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/test/modules/Makefile
M src/test/modules/ssl_passphrase_callback/Makefile

Provide a TLS init hook

commit   : 896fcdb230e729652d37270c8606ccdc45212f0d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 25 Mar 2020 17:13:17 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 25 Mar 2020 17:13:17 -0400    

Click here for diff

The default hook function sets the default password callback function.  
In order to allow preloaded libraries to have an opportunity to override  
the default, TLS initialization if now delayed slightly until after  
shared preloaded libraries have been loaded.  
  
A test module is provided which contains a trivial example that decodes  
an obfuscated password for an SSL certificate.  
  
Author: Andrew Dunstan  
Reviewed By: Andreas Karlsson, Asaba Takanori  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-openssl.c
M src/backend/postmaster/postmaster.c
M src/include/libpq/libpq-be.h
M src/test/modules/Makefile
A src/test/modules/ssl_passphrase_callback/.gitignore
A src/test/modules/ssl_passphrase_callback/Makefile
A src/test/modules/ssl_passphrase_callback/server.crt
A src/test/modules/ssl_passphrase_callback/server.key
A src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
A src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/tools/msvc/Mkvcbuild.pm

pg_dump new test: Change order of arguments

commit   : ffd398021c296e55b59ab848ac71a1769ddff93f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2020 15:14:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2020 15:14:14 -0300    

Click here for diff

Some getopt_long implementations don't like to have a non-option  
argument before option arguments, so put the database name as the  
last switch.  
  
Per buildfarm member hoverfly.  

M src/bin/pg_dump/t/003_pg_dump_with_server.pl

pg_dump: Allow dumping data of specific foreign servers

commit   : 2f9eb31320948b968e5f744b73032405e1f25225    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2020 13:19:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Mar 2020 13:19:31 -0300    

Click here for diff

The new command-line switch --include-foreign-data=PATTERN lets the user  
specify foreign servers from which to dump foreign table data.  This can  
be refined by further inclusion/exclusion switches, so that the user has  
full control over which tables to dump.  
  
A limitation is that this doesn't work in combination with parallel  
dumps, for implementation reasons.  This might be lifted in the future,  
but requires shuffling some code around.  
  
Author: Luis Carril <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Surafel Temesgen <[email protected]>  
Reviewed-by: vignesh C <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/LEJPR01MB0185483C0079D2F651B16231E7FC0@LEJPR01MB0185.DEUPRD01.PROD.OUTLOOK.DE  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/001_basic.pl
A src/bin/pg_dump/t/003_pg_dump_with_server.pl

Go back to returning int from ereport auxiliary functions.

commit   : bda6dedbea599209048bc51115ecb2062ceb976c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2020 11:57:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Mar 2020 11:57:36 -0400    

Click here for diff

This reverts the parts of commit 17a28b03645e27d73bf69a95d7569b61e58f06eb  
that changed ereport's auxiliary functions from returning dummy integer  
values to returning void.  It turns out that a minority of compilers  
complain (not entirely unreasonably) about constructs such as  
  
	(condition) ? errdetail(...) : 0  
  
if errdetail() returns void rather than int.  We could update those  
call sites to say "(void) 0" perhaps, but the expectation for this  
patch set was that ereport callers would not have to change anything.  
And this aspect of the patch set was already the most invasive and  
least compelling part of it, so let's just drop it.  
  
Per buildfarm.  
  
Discussion: https://postgr.es/m/CA+fd4k6N8EjNvZpM8nme+y+05mz-SM8Z_BgkixzkA34R+ej0Kw@mail.gmail.com  

M src/backend/executor/execUtils.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_node.c
M src/backend/parser/scan.l
M src/backend/storage/ipc/dsm_impl.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/error/elog.c
M src/include/executor/executor.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_node.h
M src/include/parser/scanner.h
M src/include/utils/elog.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h

Define EXEC_BACKEND in pg_config_manual.h

commit   : f5817595a7f194d25bc9be5b035eb1f7f60cd1fa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Mar 2020 14:23:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Mar 2020 14:23:25 +0100    

Click here for diff

It was for unclear reasons defined in a separate location, which makes  
it more cumbersome to override for testing, and it also did not have  
any prominent documentation.  Move to pg_config_manual.h, where  
similar things are already collected.  
  
The previous definition on the command-line had the effect of defining  
it to the value 1, but now that we don't need that anymore we just  
define it to empty, to simplify manual editing a bit.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/b7053ba8-b008-5335-31de-2fe4fe41ef0f%402ndquadrant.com  

M configure
M configure.in
M src/include/pg_config_manual.h
M src/tools/msvc/MSBuildProject.pm

Update SQL features

commit   : e8b1774fc288d7f789a539ef0a768aff2deef600    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Mar 2020 08:46:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Mar 2020 08:46:41 +0100    

Click here for diff

The name of E182 was changed in SQL:2011.  
  
Also, we can change it to supported because all it requires is one  
embedded language to be supported, which we do.  

M src/backend/catalog/sql_features.txt

Add collation versions for Windows.

commit   : 352f6f2df60f8725cf6e81141985977d76c169d3    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 25 Mar 2020 15:56:00 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 25 Mar 2020 15:56:00 +1300    

Click here for diff

On Vista and later, use GetNLSVersionEx() to request collation version  
information.  
  
Reviewed-by: Juan José Santamaría Flecha <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJvqup3s%2BJowVTcacZADO6dOhfdBmvOPHLS3KXUJu41Jw%40mail.gmail.com  

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

Allow NULL version for individual collations.

commit   : 382a821907e76bf6068492a164fdfc57578391f4    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 25 Mar 2020 15:53:24 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 25 Mar 2020 15:53:24 +1300    

Click here for diff

Remove the documented restriction that collation providers must either  
return NULL for all collations or non-NULL for all collations.  
  
Use NULL for glibc collations like "C.UTF-8", which might otherwise lead  
future proposed commits to force unnecessary index rebuilds.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJvqup3s%2BJowVTcacZADO6dOhfdBmvOPHLS3KXUJu41Jw%40mail.gmail.com  

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

Consider disk-based hash aggregation to implement DISTINCT.

commit   : dd8e19132acfbb28d579288a412ed6c0a5ea338b    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 24 Mar 2020 18:19:51 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 24 Mar 2020 18:19:51 -0700    

Click here for diff

Correct oversight in 1f39bce0. If enable_hashagg_disk=true, we should  
consider hash aggregation for DISTINCT when applicable.  

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

Avoid allocating unnecessary zero-sized array.

commit   : 3649133b147638f25933c93e3d4f6b920da50332    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 24 Mar 2020 18:19:34 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 24 Mar 2020 18:19:34 -0700    

Click here for diff

If there are no aggregates, there is no need to allocate an array of  
zero AggStatePerGroupData elements.  

M src/backend/executor/nodeAgg.c

Fix nbtree deduplication README commentary.

commit   : b150a76793109b00ea43c26e0006b3cad9030096    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 24 Mar 2020 14:58:27 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 24 Mar 2020 14:58:27 -0700    

Click here for diff

Descriptions of some aspects of how deduplication works were unclear in  
a couple of places.  

M src/backend/access/nbtree/README

logical decoding: Remove TODO about unnecessary optimization.

commit   : 112b006fe79b6fe84647df84a07c201e5a7b1635    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 24 Mar 2020 12:14:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 24 Mar 2020 12:14:18 -0700    

Click here for diff

Measurements show, and intuition agrees, that there's currently no  
known cases where adding a fastpath to avoid allocating / ordering a  
heap for a single transaction is worthwhile.  
  
Author: Dilip Kumar  
Discussion: https://postgr.es/m/CAFiTN-sp701wvzvnLQJGk7JDqrFM8f--97-ihbwkU8qvn=p8nw@mail.gmail.com  

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

Fix compiler warning on Cygwin

commit   : f15ace793578d96d70dad1e613293ae3eab92503    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 24 Mar 2020 19:29:34 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 24 Mar 2020 19:29:34 +0100    

Click here for diff

bf68b79e50e3359accc85c94fa23cc03abb9350a introduced an unused variable  
compiler warning on Cygwin.  

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

Improve the internal implementation of ereport().

commit   : 17a28b03645e27d73bf69a95d7569b61e58f06eb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Mar 2020 12:08:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Mar 2020 12:08:48 -0400    

Click here for diff

Change all the auxiliary error-reporting routines to return void,  
now that we no longer need to pretend they are passing something  
useful to errfinish().  While this probably doesn't save anything  
significant at the machine-code level, it allows detection of some  
additional types of mistakes.  
  
Pass the error location details (__FILE__, __LINE__, PG_FUNCNAME_MACRO)  
to errfinish not errstart.  This shaves a few cycles off the case where  
errstart decides we're not going to emit anything.  
  
Re-implement elog() as a trivial wrapper around ereport(), removing  
the separate support infrastructure it used to have.  Aside from  
getting rid of some now-surplus code, this means that elog() now  
really does have exactly the same semantics as ereport(), in particular  
that it can skip evaluation work if the message is not to be emitted.  
  
Andres Freund and Tom Lane  
  
Discussion: https://postgr.es/m/CA+fd4k6N8EjNvZpM8nme+y+05mz-SM8Z_BgkixzkA34R+ej0Kw@mail.gmail.com  

M src/backend/executor/execUtils.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_node.c
M src/backend/parser/scan.l
M src/backend/storage/ipc/dsm_impl.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/error/elog.c
M src/include/executor/executor.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_node.h
M src/include/parser/scanner.h
M src/include/utils/elog.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h

Re-implement the ereport() macro using __VA_ARGS__.

commit   : e3a87b4991cc2d00b7a3082abb54c5f12baedfd1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Mar 2020 11:48:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Mar 2020 11:48:33 -0400    

Click here for diff

Now that we require C99, we can depend on __VA_ARGS__ to work, and  
revising ereport() to use it has several significant benefits:  
  
* The extra parentheses around the auxiliary function calls are now  
optional.  Aside from being a bit less ugly, this removes a common  
gotcha for new contributors, because in some cases the compiler errors  
you got from forgetting them were unintelligible.  
  
* The auxiliary function calls are now evaluated as a comma expression  
list rather than as extra arguments to errfinish().  This means that  
compilers can be expected to warn about no-op expressions in the list,  
allowing detection of several other common mistakes such as forgetting  
to add errmsg(...) when converting an elog() call to ereport().  
  
* Unlike the situation with extra function arguments, comma expressions  
are guaranteed to be evaluated left-to-right, so this removes platform  
dependency in the order of the auxiliary function calls.  While that  
dependency hasn't caused us big problems in the past, this change does  
allow dropping some rather shaky assumptions around errcontext() domain  
handling.  
  
There's no intention to make wholesale changes of existing ereport  
calls, but as proof-of-concept this patch removes the extra parens  
from a couple of calls in postgres.c.  
  
While new code can be written either way, code intended to be  
back-patched will need to use extra parens for awhile yet.  It seems  
worth back-patching this change into v12, so as to reduce the window  
where we have to be careful about that by one year.  Hence, this patch  
is careful to preserve ABI compatibility; a followup HEAD-only patch  
will make some additional simplifications.  
  
Andres Freund and Tom Lane  
  
Discussion: https://postgr.es/m/CA+fd4k6N8EjNvZpM8nme+y+05mz-SM8Z_BgkixzkA34R+ej0Kw@mail.gmail.com  

M doc/src/sgml/sources.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/error/elog.c
M src/include/utils/elog.h

Fix compiler warning

commit   : cef27ae01ac872355b2bd56c0882aafe5c6f08de    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 24 Mar 2020 16:01:06 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 24 Mar 2020 16:01:06 +0100    

Click here for diff

A variable was unused in non-assert builds.  Simplify the code to  
avoid the issue.  
  
Reported-by: Erik Rijkers <[email protected]>  

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

Doc: fix broken markup.

commit   : ab3e4fbd5421e9b3203de9ebf6a741eebab2ab94    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Mar 2020 10:27:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Mar 2020 10:27:02 -0400    

Click here for diff

Sloppiness in commit cedffbdb8, noted by Erikjan Rijkers.  
(It's fairly unfortunate that xmllint doesn't catch this.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Some refactoring of logical/worker.c

commit   : 97ee604d9bcedf0066986521a7ee15e3aa87be34    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 24 Mar 2020 14:00:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 24 Mar 2020 14:00:58 +0100    

Click here for diff

This moves the main operations of apply_handle_{insert|update|delete},  
that of inserting, updating, deleting a tuple into/from a given  
relation, into corresponding  
apply_handle_{insert|update|delete}_internal functions.  This allows  
performing those operations on relations that are not directly the  
targets of replication, which is something a later patch will use for  
targeting partitioned tables.  
  
Author: Amit Langote <[email protected]>  
Reviewed-by: Rafia Sabih <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com  

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

Add support for other normal forms to Unicode normalization API

commit   : d40d564c5a920e1121b28463dfed74441cbae5c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 24 Mar 2020 08:49:52 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 24 Mar 2020 08:49:52 +0100    

Click here for diff

It previously only supported NFKC, for use by SASLprep.  This expands  
the API to offer the choice of all four normalization forms.  Right  
now, there are no internal users of the forms other than NFKC.  
  
Reviewed-by: Daniel Verite <[email protected]>  
Reviewed-by: Andreas Karlsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/common/saslprep.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/norm_test.c
M src/common/unicode_norm.c
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_table.h

Report wait event for cost-based vacuum delay.

commit   : cedffbdb8b137325a79e07a976457bc2314adf9b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Mar 2020 22:19:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Mar 2020 22:19:56 -0700    

Click here for diff

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

M doc/src/sgml/monitoring.sgml
M src/backend/commands/vacuum.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Prefer standby promotion over recovery pause.

commit   : 496ee647ecd2917369ffcf1eaa0b2cdca07c8730    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 24 Mar 2020 12:46:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 24 Mar 2020 12:46:48 +0900    

Click here for diff

Previously if a promotion was triggered while recovery was paused,  
the paused state continued. Also recovery could be paused by executing  
pg_wal_replay_pause() even while a promotion was ongoing. That is,  
recovery pause had higher priority over a standby promotion.  
But this behavior was not desirable because most users basically wanted  
the recovery to complete as soon as possible and the server to become  
the master when they requested a promotion.  
  
This commit changes recovery so that it prefers a promotion over  
recovery pause. That is, if a promotion is triggered while recovery  
is paused, the paused state ends and a promotion continues. Also  
this commit makes recovery pause functions like pg_wal_replay_pause()  
throw an error if they are executed while a promotion is ongoing.  
  
Internally, this commit adds new internal function PromoteIsTriggered()  
that returns true if a promotion is triggered. Since the name of  
this function and the existing function IsPromoteTriggered() are  
confusingly similar, the commit changes the name of IsPromoteTriggered()  
to IsPromoteSignaled, as more appropriate name.  
  
Author: Fujii Masao  
Reviewed-by: Atsushi Torikoshi, Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/postmaster/startup.c
M src/include/access/xlog.h
M src/include/postmaster/startup.h

Move routine building restore_command to src/common/

commit   : e09ad07b21a244c3cbcdbe3048e9ab0834ac6d41    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 24 Mar 2020 12:13:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 24 Mar 2020 12:13:36 +0900    

Click here for diff

restore_command has only been used until now by the backend, but there  
is a pending patch for pg_rewind to make use of that in the frontend.  
  
Author: Alexey Kondratov  
Reviewed-by: Andrey Borodin, Andres Freund, Alvaro Herrera, Alexander  
Korotkov, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogarchive.c
M src/common/Makefile
A src/common/archive.c
A src/include/common/archive.h
M src/tools/msvc/Mkvcbuild.pm

Add wait events for WAL archive and recovery pause.

commit   : b8e20d6dabdafbe905b62910dc0236037c7881e1    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 24 Mar 2020 11:12:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 24 Mar 2020 11:12:21 +0900    

Click here for diff

This commit introduces new wait events BackupWaitWalArchive and  
RecoveryPause. The former is reported while waiting for the WAL files  
required for the backup to be successfully archived. The latter is  
reported while waiting for recovery in pause state to be resumed.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier, Atsushi Torikoshi, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Reduce test time for disk-based Hash Aggregation.

commit   : 76df765e88fd9016e4b4f75dc69bcd9a1f335f72    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 23 Mar 2020 18:55:12 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 23 Mar 2020 18:55:12 -0700    

Click here for diff

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

M src/test/regress/expected/aggregates.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/groupingsets.sql

Report NULL as total backup size if it's not estimated.

commit   : 67e0adfb3f98f1e4a89a32b6f2e59774ce579146    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 24 Mar 2020 10:43:41 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 24 Mar 2020 10:43:41 +0900    

Click here for diff

Previously 0 was reported in pg_stat_progress_basebackup.total_backup  
if the total backup size was not estimated. Per discussion, our consensus  
is that NULL is better choise as the value in total_backup in that case.  
So this commit makes pg_stat_progress_basebackup view report NULL  
in total_backup column if the estimation is disabled.  
  
Bump catversion.  
  
Author: Fujii Masao  
Reviewed-by: Amit Langote, Magnus Hagander, Alvaro Herrera  
Discussion: https://postgr.es/m/CABUevExnhOD89zBDuPvfAAh243RzNpwCPEWNLtMYpKHMB8gbAQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/basebackup.c
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

Fixes for Disk-based Hash Aggregation.

commit   : 64fe6022790920ef6edee475bfa162a961f148d8    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 23 Mar 2020 13:56:28 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 23 Mar 2020 13:56:28 -0700    

Click here for diff

Justin Pryzby raised a couple issues with commit 1f39bce0. Fixed.  
  
Also, tweak the way the size of a hash entry is estimated and the  
number of buckets is estimated when calling BuildTupleHashTableExt().  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/explain.c
M src/backend/executor/nodeAgg.c

docs: add backend_type to file-fdw CSV log example

commit   : 0830d21f5b01064837dc8bd910ab31a5b7a1101a    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 23 Mar 2020 18:38:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 23 Mar 2020 18:38:42 -0400    

Click here for diff

backend_type was added to the CVS log output in commit 70a7b4776b.  
  
Reported-by: Fabrízio de Royes Mello  
  
Discussion: https://postgr.es/m/CAFcNs+ruvRks3BV1j7yQ-MvxsswmKJa0cVh2yK5Dd-xXVM8wPw@mail.gmail.com  
  
Backpatch-through: master  

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

Add regression tests for constraint errors in partitioned tables.

commit   : f801ceb696b4a865ef80fd29c9df880280472e03    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Mar 2020 14:48:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Mar 2020 14:48:19 -0700    

Click here for diff

While #16293 only applied to 11 (and 10 to some degree), it seems best  
to add tests to all branches with partitioning support.  
  
Reported-By: Daniel WM  
Author: Andres Freund  
Bug: #16293  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-  

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

Fix ordering in typedefs.list

commit   : 0df94beb362e0ebc812170fbabd1aaf75136831a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 24 Mar 2020 00:54:33 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 24 Mar 2020 00:54:33 +0300    

Click here for diff

M src/tools/pgindent/typedefs.list

Doc: explain that LIKE et al can be used in ANY (sub-select) etc.

commit   : fe604800681aed8228fbe67d2e175d6822c66ea2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Mar 2020 12:42:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Mar 2020 12:42:15 -0400    

Click here for diff

This wasn't stated anywhere, and it's perhaps not that obvious,  
since we get questions about it from time to time.  Also undocumented  
was that the parser actually translates these into operators.  
  
Discussion: https://postgr.es/m/CAFj8pRBkvZ71BqGKZnBBG4=0cKG+s50Dy+DYmrizUKEpAtdc+w@mail.gmail.com  

M doc/src/sgml/func.sgml

Fix our getopt_long's behavior for a command line argument of just "-".

commit   : 980a70b9763e330dab6d0eb994c96a007876e40e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Mar 2020 11:58:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Mar 2020 11:58:00 -0400    

Click here for diff

src/port/getopt_long.c failed on such an argument, always seeing it  
as an unrecognized switch.  This is unhelpful; better is to treat such  
an item as a non-switch argument.  That behavior is what we find in  
GNU's getopt_long(); it's what src/port/getopt.c does; and it is  
required by POSIX for getopt(), which getopt_long() ought to be  
generally a superset of.  Moreover, it's expected by ecpg, which  
intends an argument of "-" to mean "read from stdin".  So fix it.  
  
Also add some documentation about ecpg's behavior in this area, since  
that was miserably underdocumented.  I had to reverse-engineer it  
from the code.  
  
Per bug #16304 from James Gray.  Back-patch to all supported branches,  
since this has been broken forever.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/ecpg-ref.sgml
M src/port/getopt_long.c

Doc: Fix type of some storage parameters in CREATE TABLE page

commit   : c81bd3b9a5e99315148f4f5714c32e633af30123    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Mar 2020 13:38:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Mar 2020 13:38:03 +0900    

Click here for diff

autovacuum_vacuum_scale_factor and autovacuum_analyze_scale_factor have  
been documented as "float4", but "floating type" is used in this case  
for GUCs and relation options in the documentation.  
  
Author: Atsushi Torikoshi  
Discussion: https://postgr.es/m/CACZ0uYFf_p9BpbjLccx3CA=eM1Hk2Te=ULY4iptGLUhL-JxCPA@mail.gmail.com  
Backpatch-through: 9.5  

M doc/src/sgml/ref/create_table.sgml

Revert "Refactor compile-time assertion checks in c.h"

commit   : faa650a99b4bfbe95e88f44070ae0df1818944a7    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Mar 2020 12:52:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Mar 2020 12:52:37 +0900    

Click here for diff

This reverts commit b7f64c6, which broke the fallback implementation for  
C++.  We have discussed a couple of alternatives to reduce the number of  
implementations for those asserts, but nothing allowing to reduce the  
number of implementations down to three instead of four, so there is no  
benefit in keeping this patch.  
  
Thanks to Tom Lane for the discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h

Add object names to partition integrity violations.

commit   : 33753ac9d7bc83dd9ccee9d5e678ed78a0725b4e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 23 Mar 2020 08:09:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 23 Mar 2020 08:09:15 +0530    

Click here for diff

All errors of SQLSTATE class 23 should include the name of an object  
associated with the error in separate fields of the error report message.  
We do this so that applications need not try to extract them from the  
possibly-localized human-readable text of the message.  
  
Reported-by: Chris Bandy  
Author: Chris Bandy  
Reviewed-by: Amit Kapila and Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/ri_triggers.c

Add bound checks for ssl_min_protocol_version and ssl_max_protocol_version

commit   : 79dfa8afb296e1b0dcffbe674e04c5f25cc13dfd    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Mar 2020 11:01:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Mar 2020 11:01:41 +0900    

Click here for diff

Mixing incorrect bounds in the SSL context leads to confusing error  
messages generated by OpenSSL which are hard to act on.  New range  
checks are added when both min/max parameters are loaded in the context  
of a SSL reload to improve the error reporting.  Note that this does not  
make use of the GUC hook machinery contrary to 41aadee, as there is no  
way to ensure a consistent range check (except if there is a way one day  
to define range types for GUC parameters?).  Hence, this patch applies  
only to OpenSSL, and uses a logic similar to other parameters to trigger  
an error when reloading the SSL context in a session.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-openssl.c
M src/test/ssl/t/001_ssltests.pl

Revert "Skip WAL for new relfilenodes, under wal_level=minimal."

commit   : de9396326edcbe5cafc06a72016f9d715c350e0e    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 22 Mar 2020 09:24:09 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 22 Mar 2020 09:24:09 -0700    

Click here for diff

This reverts commit cb2fd7eac285b1b0a24eeb2b8ed4456b66c5a09f.  Per  
numerous buildfarm members, it was incompatible with parallel query, and  
a test case assumed LP64.  Back-patch to 9.5 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/sql/pg_visibility.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/perform.sgml
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/transam/README
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/storage.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/access/heapam.h
M src/include/access/rewriteheap.h
M src/include/access/tableam.h
M src/include/catalog/storage.h
M src/include/nodes/parsenodes.h
M src/include/storage/bufmgr.h
M src/include/storage/lock.h
M src/include/storage/smgr.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
D src/test/recovery/t/018_wal_optimize.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql

Fix up recent breakage of headerscheck and cpluspluscheck.

commit   : d0587f52b3bb898db3c0011954de6ae9adc076c8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Mar 2020 18:28:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Mar 2020 18:28:44 -0400    

Click here for diff

headerscheck and cpluspluscheck should skip the recently-added  
cmdtaglist.h header, since (like kwlist.h and some other similarly-  
designed headers) it's not meant to be included standalone.  
  
evtcache.h was missing an #include to support its usage of Bitmapset.  
  
typecmds.h was missing an #include to support its usage of ParseState.  
  
The first two of these were evidently oversights in commit 2f9661311.  
I didn't track down exactly which change broke typecmds.h, but it  
must have been some rearrangement in one of its existing inclusions,  
because it's referenced ParseState for quite a long time and there  
were not complaints from these checking programs before.  

M src/include/commands/typecmds.h
M src/include/tcop/cmdtaglist.h
M src/include/utils/evtcache.h
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Skip WAL for new relfilenodes, under wal_level=minimal.

commit   : cb2fd7eac285b1b0a24eeb2b8ed4456b66c5a09f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    

Click here for diff

Until now, only selected bulk operations (e.g. COPY) did this.  If a  
given relfilenode received both a WAL-skipping COPY and a WAL-logged  
operation (e.g. INSERT), recovery could lose tuples from the COPY.  See  
src/backend/access/transam/README section "Skipping WAL for New  
RelFileNode" for the new coding rules.  Maintainers of table access  
methods should examine that section.  
  
To maintain data durability, just before commit, we choose between an  
fsync of the relfilenode and copying its contents to WAL.  A new GUC,  
wal_skip_threshold, guides that choice.  If this change slows a workload  
that creates small, permanent relfilenodes under wal_level=minimal, try  
adjusting wal_skip_threshold.  Users setting a timeout on COMMIT may  
need to adjust that timeout, and log_min_duration_statement analysis  
will reflect time consumption moving to COMMIT from commands like COPY.  
  
Internally, this requires a reliable determination of whether  
RollbackAndReleaseCurrentSubTransaction() would unlink a relation's  
current relfilenode.  Introduce rd_firstRelfilenodeSubid.  Amend the  
specification of rd_createSubid such that the field is zero when a new  
rel has an old rd_node.  Make relcache.c retain entries for certain  
dropped relations until end of transaction.  
  
Back-patch to 9.5 (all supported versions).  This introduces a new WAL  
record type, XLOG_GIST_ASSIGN_LSN, without bumping XLOG_PAGE_MAGIC.  As  
always, update standby systems before master systems.  This changes  
sizeof(RelationData) and sizeof(IndexStmt), breaking binary  
compatibility for affected extensions.  (The most recent commit to  
affect the same class of extensions was  
089e4d405d0f3b94c74a2c6a54357a84a681754b.)  
  
Kyotaro Horiguchi, reviewed (in earlier, similar versions) by Robert  
Haas.  Heikki Linnakangas and Michael Paquier implemented earlier  
designs that materially clarified the problem.  Reviewed, in earlier  
designs, by Andrew Dunstan, Andres Freund, Alvaro Herrera, Tom Lane,  
Fujii Masao, and Simon Riggs.  Reported by Martijn van Oosterhout.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/sql/pg_visibility.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/perform.sgml
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/transam/README
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/storage.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/access/heapam.h
M src/include/access/rewriteheap.h
M src/include/access/tableam.h
M src/include/catalog/storage.h
M src/include/nodes/parsenodes.h
M src/include/storage/bufmgr.h
M src/include/storage/lock.h
M src/include/storage/smgr.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
A src/test/recovery/t/018_wal_optimize.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql

In log_newpage_range(), heed forkNum and page_std arguments.

commit   : d3e572855be1e15c7e0a6adc8db52b9fd4f71be0    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    

Click here for diff

The function assumed forkNum=MAIN_FORKNUM and page_std=true, ignoring  
the actual arguments.  Existing callers passed exactly those values, so  
there's no live bug.  Back-patch to v12, where the function first  
appeared, because another fix needs this.  
  
Discussion: https://postgr.es/m/[email protected]  

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

During heap rebuild, lock any TOAST index until end of transaction.

commit   : e629a01f6973688f77ecff964d9d6bea9bc4b374    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    

Click here for diff

swap_relation_files() calls toast_get_valid_index() to find and lock  
this index, just before swapping with the rebuilt TOAST index.  The  
latter function releases the lock before returning.  Potential for  
mischief is low; a concurrent session can issue ALTER INDEX ... SET  
(fillfactor = ...), which is not alarming.  Nonetheless, changing  
pg_class.relfilenode without a lock is unconventional.  Back-patch to  
9.5 (all supported versions), because another fix needs this.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/toast_internals.c
M src/backend/commands/cluster.c

Fix cosmetic blemishes involving rd_createSubid.

commit   : d60ef94d7639b433a7bf9dd7d48aeb63194235d3    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    

Click here for diff

Remove an obsolete comment from AtEOXact_cleanup().  Restore formatting  
of a comment in struct RelationData, mangled by the pgindent run in  
commit 9af4159fce6654aa0e081b00d02bca40b978745c.  Back-patch to 9.5 (all  
supported versions), because another fix stacks on this.  

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

Allow page lock to conflict among parallel group members.

commit   : 3ba59ccc896e8877e2fbfb8d4f148904cad5f9b0    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 21 Mar 2020 08:48:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 21 Mar 2020 08:48:06 +0530    

Click here for diff

This is required as it is no safer for two related processes to perform  
clean up in gin indexes at a time than for unrelated processes to do the  
same.  After acquiring page locks, we can acquire relation extension lock  
but reverse never happens which means these will also not participate in  
deadlock.  So, avoid checking wait edges from this lock.  
  
Currently, the parallel mode is strictly read-only, but after this patch  
we have the infrastructure to allow parallel inserts and parallel copy.  
  
Author: Dilip Kumar, Amit Kapila  
Reviewed-by: Amit Kapila, Kuntal Ghosh and Sawada Masahiko  
Discussion: https://postgr.es/m/CAD21AoCmT3cFQUN4aVvzy5chw7DuzXrJCbrjTU05B+Ss=Gn1LA@mail.gmail.com  

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

docs: use alias in WHERE clause of full text search example

commit   : a6d7e9fb2816fcd23e5d1e95a52448eb9acf7f6e    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2020 20:19:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 20 Mar 2020 20:19:32 -0400    

Click here for diff

The current doc query specified an alias in the FROM clause and used in  
it the target list, but not in the WHERE clause.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

M doc/src/sgml/textsearch.sgml

Fix bogus last-minute edit in 4e62091341b4

commit   : 069b750ca764a85324a138c22c3ece5cf13d684f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Mar 2020 18:11:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Mar 2020 18:11:28 -0300    

Click here for diff

Noticed by Erik Rijkers before I was able to push the fix.  

M src/bin/pg_dump/pg_dump.c

pg_dump: Add FOREIGN to ALTER statements, if appropriate

commit   : 4e62091341b4a55666a32dd7762f185a1faa54f7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Mar 2020 17:21:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Mar 2020 17:21:00 -0300    

Click here for diff

Author: Luis Carril  
Reviewed-by: Tomas Vondra, Daniel Gustafsson, Álvaro Herrera  
Discussion: https://postgr.es/m/LEJPR01MB0185A19B2E7C98E5E2A031F5E7F20@LEJPR01MB0185.DEUPRD01.PROD.OUTLOOK.DE  

M src/bin/pg_dump/pg_dump.c

Turn off deprecated bison warnings under MSVC

commit   : 71c2fd0c04a5daaaab5331879e23181bb52334e1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 20 Mar 2020 13:55:15 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 20 Mar 2020 13:55:15 -0400    

Click here for diff

These are disabled by the configure code, so this is just fixing an  
inconsistency in the MSVC code.  
  
Backpatch to all live branches.  

M src/tools/msvc/pgbison.pl

psql: Catch and report errors while printing result table

commit   : b03436994bcc4909dd644fd5ae6d9a9acdf30da5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Mar 2020 16:04:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Mar 2020 16:04:15 +0100    

Click here for diff

Errors (for example I/O errors or disk full) while printing out result  
tables were completely ignored, which could result in silently  
truncated output in scripts, for example.  Fix by adding some basic  
error checking and reporting.  
  
Author: Daniel Verite <[email protected]>  
Author: David Zhang <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/psql/common.c

Allow relation extension lock to conflict among parallel group members.

commit   : 85f6b49c2c53fb1e08d918ec9305faac13cf7ad6    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 20 Mar 2020 08:20:56 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 20 Mar 2020 08:20:56 +0530    

Click here for diff

This is required as it is no safer for two related processes to extend the  
same relation at a time than for unrelated processes to do the same.  We  
don't acquire a heavyweight lock on any other object after relation  
extension lock which means such a lock can never participate in the  
deadlock cycle.  So, avoid checking wait edges from this lock.  
  
This provides an infrastructure to allow parallel operations like insert,  
copy, etc. which were earlier not possible as parallel group members won't  
conflict for relation extension lock.  
  
Author: Dilip Kumar, Amit Kapila  
Reviewed-by: Amit Kapila, Kuntal Ghosh and Sawada Masahiko  
Discussion: https://postgr.es/m/CAD21AoCmT3cFQUN4aVvzy5chw7DuzXrJCbrjTU05B+Ss=Gn1LA@mail.gmail.com  

M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lock.h

nbtree: Remove obsolete _bt_pgaddtup() comments.

commit   : b27e1b3418b189e1a5aee13cbd09bff94f010a86    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 19 Mar 2020 14:56:56 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 19 Mar 2020 14:56:56 -0700    

Click here for diff

Remove comments that are a throw back to a time when nbtree cared about  
write-ordering dependencies.  The comments are similar to those removed  
by commit 9ee7414e, among others.  

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

Revert "Specialize MemoryContextMemAllocated()."

commit   : 2fd6a44ad5744905e9ceacef7aaf698f608e6adb    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 19 Mar 2020 11:20:39 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 19 Mar 2020 11:20:39 -0700    

Click here for diff

This reverts commit e00912e11a9ec2d29274ed8a6465e81385906dc2.  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h

pg_upgrade: make get_major_server_version() err msg consistent

commit   : 2247a1ea5fabafc11a6deab1c6fe822c9df45bb1    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2020 15:20:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 19 Mar 2020 15:20:55 -0400    

Click here for diff

This patch fixes the error message in get_major_server_version() to be  
"could not parse version file", and uses the full file path name, rather  
than just the data directory path.  
  
Also, commit 4109bb5de4 added the cause of the failure to the  "could  
not open" error message, and improved quoting.  This patch backpatches  
the "could not open" cause to PG 12, where it was first widely used, and  
backpatches the quoting fix in that patch to all supported releases.  
  
Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Dagfinn Ilmari Mannsåker  
  
Backpatch-through: 9.5  

M src/bin/pg_upgrade/server.c

Add new typedefs introduced in 773df883e8 to typedefs.list

commit   : 45452825e5a11f8242a8012853bd2ff81e8b9620    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 19 Mar 2020 21:40:45 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 19 Mar 2020 21:40:45 +0300    

Click here for diff

M src/tools/pgindent/typedefs.list

Introduce "anycompatible" family of polymorphic types.

commit   : 24e2885ee304cb6a94fdfc25a1a108344ed9f4f7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Mar 2020 11:43:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Mar 2020 11:43:11 -0400    

Click here for diff

This patch adds the pseudo-types anycompatible, anycompatiblearray,  
anycompatiblenonarray, and anycompatiblerange.  They work much like  
anyelement, anyarray, anynonarray, and anyrange respectively, except  
that the actual input values need not match precisely in type.  
Instead, if we can find a common supertype (using the same rules  
as for UNION/CASE type resolution), then the parser automatically  
promotes the input values to that type.  For example,  
"myfunc(anycompatible, anycompatible)" can match a call with one  
integer and one bigint argument, with the integer automatically  
promoted to bigint.  With anyelement in the definition, the user  
would have had to cast the integer explicitly.  
  
The new types also provide a second, independent set of type variables  
for function matching; thus with "myfunc(anyelement, anyelement,  
anycompatible) returns anycompatible" the first two arguments are  
constrained to be the same type, but the third can be some other  
type, and the result has the type of the third argument.  The need  
for more than one set of type variables was foreseen back when we  
first invented the polymorphic types, but we never did anything  
about it.  
  
Pavel Stehule, revised a bit by me  
  
Discussion: https://postgr.es/m/CAFj8pRDna7VqNi8gR+Tt2Ktmz0cq5G93guc3Sbn_NVPLdXAkqA@mail.gmail.com  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/catalog/index.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/functioncmds.c
M src/backend/parser/parse_coerce.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/fmgr/funcapi.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/pl/plpgsql/src/pl_comp.c
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/create_aggregate.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/create_aggregate.sql
M src/test/regress/sql/opr_sanity.sql
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/polymorphism.sql
M src/test/regress/sql/rangefuncs.sql
M src/test/regress/sql/rangetypes.sql
M src/test/regress/sql/type_sanity.sql

Make pg_basebackup ask the server to estimate the total backup size, by default.

commit   : fab13dc50ba5e7a12b474a7366024681bc169ac8    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 19 Mar 2020 17:09:00 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 19 Mar 2020 17:09:00 +0900    

Click here for diff

This commit changes pg_basebackup so that it specifies PROGRESS option in  
BASE_BACKUP replication command whether --progress is specified or not.  
This causes the server to estimate the total backup size and report it in  
pg_stat_progress_basebackup.backup_total, by default. This is reasonable  
default because the time required for the estimation would not be so large  
in most cases.  
  
Also this commit adds new option --no-estimate-size to pg_basebackup.  
This option prevents the server from the estimation, and so is useful to  
avoid such estimation time if it's too long.  
  
Author: Fujii Masao  
Reviewed-by: Magnus Hagander, Amit Langote  
Discussion: https://postgr.es/m/CABUevEyDPPSjP7KRvfTXPdqOdY5aWNkqsB5aAXs3bco5ZwtGHg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/pg_basebackup.c

Prepare to support non-tables in publications

commit   : c314c147c0563c9758bdad988ffda8d64daa2db6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Mar 2020 08:17:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Mar 2020 08:17:50 +0100    

Click here for diff

This by itself doesn't change any functionality but prepares the way  
for having relations other than base tables in publications.  
  
Make arrangements for COPY handling the initial table sync.  For  
non-tables we have to use COPY (SELECT ...) instead of directly  
copying from the table, but then we have to take care to omit  
generated columns from the column list.  
  
Also, remove a hardcoded reference to relkind = 'r' and rely on the  
publisher to send only what it can actually publish, which will be  
correct even in future cross-version scenarios.  
  
Reviewed-by: Amit Langote <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com  

M src/backend/replication/logical/tablesync.c
M src/include/replication/logicalproto.h

commit   : 1d253bae57fcb3e75cdd9cdb2592c5b09cf7e7b7    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 19 Mar 2020 15:32:55 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 19 Mar 2020 15:32:55 +0900    

Click here for diff

This commit renames RecoveryWalAll and RecoveryWalStream wait events to  
RecoveryWalStream and RecoveryRetrieveRetryInterval, respectively,  
in order to make the names and what they are more consistent. For example,  
previously RecoveryWalAll was reported as a wait event while the recovery  
was waiting for WAL from a stream, and which was confusing because the name  
was very different from the situation where the wait actually could happen.  
  
The names of macro variables for those wait events also are renamed  
accordingly.  
  
This commit also changes the category of RecoveryRetrieveRetryInterval to  
Timeout from Activity because the wait event is reported while waiting based  
on wal_retrieve_retry_interval.  
  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, Atsushi Torikoshi  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Add assert to ensure that page locks don't participate in deadlock cycle.

commit   : 72e78d831ab5550c39f2dcc7cc5d44c406ec3dc2    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 Mar 2020 08:11:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 Mar 2020 08:11:45 +0530    

Click here for diff

Assert that we don't acquire any other heavyweight lock while holding the  
page lock except for relation extension.  However, these locks are never  
taken in reverse order which implies that page locks will never  
participate in the deadlock cycle.  
  
Similar to relation extension, page locks are also held for a short  
duration, so imposing such a restriction won't hurt.  
  
Author: Dilip Kumar, with few changes by Amit Kapila  
Reviewed-by: Amit Kapila, Kuntal Ghosh and Sawada Masahiko  
Discussion: https://postgr.es/m/CAD21AoCmT3cFQUN4aVvzy5chw7DuzXrJCbrjTU05B+Ss=Gn1LA@mail.gmail.com  

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

nbtree: Use raw PageAddItem() for retail inserts.

commit   : 6312c08a291fc34068571ec64ee439f2674d739a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 18 Mar 2020 18:17:37 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 18 Mar 2020 18:17:37 -0700    

Click here for diff

Only internal page splits need to call _bt_pgaddtup() instead of  
PageAddItem(), and only for data items, one of which will end up at the  
first offset (or first offset after the high key offset) on the new  
right page.  This data item alone will need to be truncated in  
_bt_pgaddtup().  
  
Since there is no reason why retail inserts ever need to truncate the  
incoming item, use a raw PageAddItem() call there instead.  Even  
_bt_split() uses raw PageAddItem() calls for left page and right page  
high keys.  Clearly the _bt_pgaddtup() shim function wasn't really  
encapsulating anything.  _bt_pgaddtup() should now be thought of as a  
_bt_split() helper function.  
  
Note that the assertions from commit d1e241c2 verify that retail inserts  
never insert an item at an internal page's negative infinity offset.  
This invariant could only ever be violated as a result of a basic logic  
error in nbtinsert.c.  

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

commit   : d41202f36eed97a4ee68a6a9f5fcca314f12c35d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Mar 2020 09:51:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Mar 2020 09:51:33 +0900    

Click here for diff

A comment about switching indisvalid of the new and old indexes swapped  
in REINDEX CONCURRENTLY got this backwards.  
  
Issue introduced by 5dc92b8, the original commit of REINDEX  
CONCURRENTLY.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20200318143340.GA46897@nol  
Backpatch-through: 12  

M src/backend/catalog/index.c

Disk-based Hash Aggregation.

commit   : 1f39bce021540fde00990af55b4432c55ef4b3c7    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 18 Mar 2020 15:42:02 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 18 Mar 2020 15:42:02 -0700    

Click here for diff

While performing hash aggregation, track memory usage when adding new  
groups to a hash table. If the memory usage exceeds work_mem, enter  
"spill mode".  
  
In spill mode, new groups are not created in the hash table(s), but  
existing groups continue to be advanced if input tuples match. Tuples  
that would cause a new group to be created are instead spilled to a  
logical tape to be processed later.  
  
The tuples are spilled in a partitioned fashion. When all tuples from  
the outer plan are processed (either by advancing the group or  
spilling the tuple), finalize and emit the groups from the hash  
table. Then, create new batches of work from the spilled partitions,  
and select one of the saved batches and process it (possibly spilling  
recursively).  
  
Author: Jeff Davis  
Reviewed-by: Tomas Vondra, Adam Lee, Justin Pryzby, Taylor Vesely, Melanie Plageman  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/commands/explain.c
M src/backend/executor/nodeAgg.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/misc/guc.c
M src/include/executor/nodeAgg.h
M src/include/nodes/execnodes.h
M src/include/optimizer/cost.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/select_distinct.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/groupingsets.sql
M src/test/regress/sql/select_distinct.sql

Specialize MemoryContextMemAllocated().

commit   : e00912e11a9ec2d29274ed8a6465e81385906dc2    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 18 Mar 2020 15:39:14 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 18 Mar 2020 15:39:14 -0700    

Click here for diff

An AllocSet doubles the size of allocated blocks (up to maxBlockSize),  
which means that the current block can represent half of the total  
allocated space for the memory context. But the free space in the  
current block may never have been touched, so don't count the  
untouched memory as allocated for the purposes of  
MemoryContextMemAllocated().  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h

Enable BEFORE row-level triggers for partitioned tables

commit   : 487e9861d0cf83e9100ad0d0369147db3ef4ea73    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2020 18:58:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Mar 2020 18:58:05 -0300    

Click here for diff

... with the limitation that the tuple must remain in the same  
partition.  
  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/trigger.sgml
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/partitioning/partdesc.c
M src/include/utils/reltrigger.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Refactor nbtree fastpath optimization.

commit   : b029395f5e616e0f2b1131b2c7ecb6640f30c055    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 18 Mar 2020 14:42:49 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 18 Mar 2020 14:42:49 -0700    

Click here for diff

Commit 2b272734, which added the fastpath rightmost leaf page cache  
insert optimization, added code to _bt_doinsert() to handle using and  
invalidating the backend local block cache.  It doesn't seem like a good  
place to handle these low level details, though.  _bt_doinsert() is  
supposed to be a high level function -- it is the main entry point to  
nbtinsert.c.  
  
Restructure the code by placing handling of the rightmost block cache at  
the start of a new _bt_search() shim function, _bt_search_insert().  The  
new function is called from _bt_doinsert(), which uses it as a  
_bt_search() variant that conveniently accepts its BTInsertState state  
as an argument.  _bt_doinsert() no longer needs to directly consider the  
fastpath optimization.  
  
Discussion: https://postgr.es/m/CAH2-Wzk59cxKJRd=rfbyub6-V4yWRjsOYRkUNHBLT1P1GdtCQQ@mail.gmail.com  

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

Implement type regcollation

commit   : a2b1faa0f279f18517adc1dd969e5f026eb51d33    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 18 Mar 2020 21:20:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 18 Mar 2020 21:20:01 +0100    

Click here for diff

This will be helpful for a following commit and it's also just  
generally useful, like the other reg* types.  
  
Author: Julien Rouhaud  
Reviewed-by: Thomas Munro and Michael Paquier  
Discussion: https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M src/backend/utils/adt/regproc.c
M src/bin/pg_upgrade/check.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/test/regress/expected/regproc.out
M src/test/regress/sql/regproc.sql

Document pg_statistic_ext.stxstattarget

commit   : c31132d87c6315bbbe4b4aa383705aaae2348c0e    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 18 Mar 2020 16:48:12 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 18 Mar 2020 16:48:12 +0100    

Click here for diff

Commit d06215d03b added a new attribute to pg_statistic_ext catalog, but  
failed to add it to document it properly.  
  
Reported-by: Noriyoshi Shinoda <[email protected]>  

M doc/src/sgml/catalogs.sgml

Recognize some OR clauses as compatible with functional dependencies

commit   : ccaa3569f58796868303629bc2d63ddddb599b38    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 18 Mar 2020 16:41:45 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 18 Mar 2020 16:41:45 +0100    

Click here for diff

Since commit 8f321bd16c functional dependencies can handle IN clauses,  
which however introduced a possible (and surprising) inconsistency,  
because IN clauses may be expressed as an OR clause, which are still  
considered incompatible. For example  
  
  a IN (1, 2, 3)  
  
may be rewritten as  
  
  (a = 1 OR a = 2 OR a = 3)  
  
The IN clause will work fine with functional dependencies, but the OR  
clause will force the estimation to fall back to plain per-column  
estimates, possibly introducing significant estimation errors.  
  
This commit recognizes OR clauses equivalent to an IN clause (when all  
arugments are compatible and reference the same attribute) as a special  
case, compatible with functional dependencies. This allows applying  
functional dependencies, just like for IN clauses.  
  
This does not eliminate the difference in estimating the clause itself,  
i.e. IN clause and OR clause still use different formulas. It would be  
possible to change that (for these special OR clauses), but that's not  
really about extended statistics - it was always like this. Moreover the  
errors are usually much smaller compared to ignoring dependencies.  
  
Author: Tomas Vondra  
Reviewed-by: Dean Rasheed  
Discussion: https://www.postgresql.org/message-id/flat/13902317.Eha0YfKkKy%40pierred-pdoc  

M src/backend/statistics/dependencies.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

commit   : dbe0d9892c338a475c0e791a5e77cff798216d29    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 18 Mar 2020 23:07:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 18 Mar 2020 23:07:17 +0900    

Click here for diff

This commit corrects the descriptions of RecoveryWalAll and RecoveryWalStream  
wait events in the documentation.  
  
Back-patch to v10 where those wait events were added.  
  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, Atsushi Torikoshi  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

doc: Update documentation about reg* types

commit   : 8408e3a557ad26a7e88f867a425b2b9a86c4fa04    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 18 Mar 2020 14:51:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 18 Mar 2020 14:51:37 +0100    

Click here for diff

Add missing index entries, add missing information on pg_upgrade man  
page, order things alphabetical instead of (apparently) in the order  
they were implemented, reduce repetitiveness a bit.  

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

Fix wording of several extended stats comments

commit   : 6f72dbc48bf8a0f4dc3248691355b0688d7aeba2    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 18 Mar 2020 13:38:49 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 18 Mar 2020 13:38:49 +0100    

Click here for diff

Reported-by: Thomas Munro  
Discussion: https://www.postgresql.org/message-id/flat/20200113230008.g67iyk4cs3xbnjju@development  

M src/backend/statistics/extended_stats.c

Update the description of type of check_option reloption in docs.

commit   : 1558413432e3dce941af550f1ad0d41790ec6fba    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 18 Mar 2020 18:28:22 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 18 Mar 2020 18:28:22 +0900    

Click here for diff

Commit 773df883e8f7 changed the type of check_option reloption  
from string to enum. But it forgot to update the description of  
the type in the documentation.  
  
Author: Atsushi Torikoshi  
Discussion: https://postgr.es/m/CACZ0uYFvHF4n6yxF390YZgr4Q0Z0c2w0ihu=DLb8ipNOnNcqzQ@mail.gmail.com  

M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/create_view.sgml

Add missing errcode() in a few ereport calls.

commit   : b4f140869f5da081c27c344587b0ff1a02821776    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 18 Mar 2020 09:27:14 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 18 Mar 2020 09:27:14 +0530    

Click here for diff

This will allow to specifying SQLSTATE error code for the errors in the  
missing places.  
  
Reported-by: Sawada Masahiko  
Author: Sawada Masahiko  
Backpatch-through: 9.5  
Discussion: https://postgr.es/m/CA+fd4k6N8EjNvZpM8nme+y+05mz-SM8Z_BgkixzkA34R+ej0Kw@mail.gmail.com  

M contrib/adminpack/adminpack.c
M src/backend/storage/page/bufpage.c

Fix typo in indexcmds.c

commit   : fdeeb524b4e28affc527548af389c75e0a99c340    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Mar 2020 11:13:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Mar 2020 11:13:12 +0900    

Click here for diff

Introduced by 61d7c7b.  
  
Backpatch-through: 12  

M src/backend/commands/indexcmds.c

Assert that we don't acquire a heavyweight lock on another object after relation extension lock.

commit   : 15ef6ff4b985276c386adf3e11ebf7f955ea6f1f    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 18 Mar 2020 07:20:17 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 18 Mar 2020 07:20:17 +0530    

Click here for diff

The only exception to the rule is that we can try to acquire the same  
relation extension lock more than once.  This is allowed as we are not  
creating any new lock for this case.  This restriction implies that the  
relation extension lock won't ever participate in the deadlock cycle  
because we can never wait for any other heavyweight lock after acquiring  
this lock.  
  
Such a restriction is okay for relation extension locks as unlike other  
heavyweight locks these are not held till the transaction end.  These are  
taken for a short duration to extend a particular relation and then  
released.  
  
Author: Dilip Kumar, with few changes by Amit Kapila  
Reviewed-by: Amit Kapila, Kuntal Ghosh and Sawada Masahiko  
Discussion: https://postgr.es/m/CAD21AoCmT3cFQUN4aVvzy5chw7DuzXrJCbrjTU05B+Ss=Gn1LA@mail.gmail.com  

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

nbtree: Remove useless local variables.

commit   : b897b3aae6b525922fe3d074d4bdf5f2674954dd    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 17 Mar 2020 18:39:26 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 17 Mar 2020 18:39:26 -0700    

Click here for diff

Copying block and offset numbers to local variables in _bt_insertonpg()  
made the code less readable.  Remove the variables.  There is already  
code that conditionally calls BufferGetBlockNumber() in the same block,  
so consistently do it that way instead.  
  
Calling BufferGetBlockNumber() is very cheap, but we might as well avoid  
it when it isn't truly necessary.  It isn't truly necessary for  
_bt_insertonpg() to call BufferGetBlockNumber() in almost all cases.  
  
Spotted while working on a patch that refactors the fastpath rightmost  
leaf page cache optimization, which was added by commit 2b272734.  

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

Don't use EV_CLEAR for kqueue events.

commit   : 9b8aa0929390aab1f2f0859016e6110d283732dd    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 18 Mar 2020 12:48:13 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 18 Mar 2020 12:48:13 +1300    

Click here for diff

For the semantics to match the epoll implementation, we need a socket to  
continue to appear readable/writable if you wait multiple times without  
doing I/O in between (in Linux terminology: level-triggered rather than  
edge-triggered).  This distinction will be important for later commits.  
Similar to commit 3b790d256f8 for Windows.  
  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJAC4Oqao%3DqforhNey20J8CiG2R%3DoBPqvfR0vOJrFysGw%40mail.gmail.com  

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

Fix kqueue support under debugger on macOS.

commit   : 7bc84a1f304acc9f4705c4178eb362ddce310452    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 18 Mar 2020 12:43:05 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 18 Mar 2020 12:43:05 +1300    

Click here for diff

While running under a debugger, macOS's getppid() can return the  
debugger's PID.  That could cause a backend to exit because it falsely  
believed that the postmaster had died, since commit 815c2f09.  
  
Continue to use getppid() as a fast postmaster check after adding the  
postmaster's PID to a kqueue, to close a PID-reuse race, but double  
check that it actually exited by trying to read the pipe.  The new check  
isn't reached in the common case.  
  
Reported-by: Alexander Korotkov <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKhAxJ8V8RVwCo6zJaeVrdOG1kFBHGZOOjf6DzW_omeMA%40mail.gmail.com  

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

Refactor our checks for valid function and aggregate signatures.

commit   : e6c178b5b73ac1fb822829e6d9b99e3fc1129c21    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 19:36:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 19:36:41 -0400    

Click here for diff

pg_proc.c and pg_aggregate.c had near-duplicate copies of the logic  
to decide whether a function or aggregate's signature is legal.  
This seems like a bad thing even without the problem that the  
upcoming "anycompatible" patch would roughly double the complexity  
of that logic.  Hence, refactor so that the rules are localized  
in new subroutines supplied by parse_coerce.c.  (One could quibble  
about just where to add that code, but putting it beside  
enforce_generic_type_consistency seems not totally unreasonable.)  
  
The fact that the rules are about to change would mandate some  
changes in the wording of the associated error messages in any case.  
I ended up spelling things out in a fairly literal fashion in the  
errdetail messages, eg "A result of type anyelement requires at  
least one input of type anyelement, anyarray, anynonarray, anyenum,  
or anyrange."  Perhaps this is overkill, but once there's more than  
one subgroup of polymorphic types, people might get confused by  
more-abstract messages.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_proc.c
M src/backend/parser/parse_coerce.c
M src/include/parser/parse_coerce.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/rangetypes.out

Doc: Correct deduplicate_items varlistentry id.

commit   : dbbb55385cf5eb75837eb3eb7ca1f14e2beb5a63    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 17 Mar 2020 15:53:05 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 17 Mar 2020 15:53:05 -0700    

Click here for diff

Use a varlistentry id for the deduplicate_items storage parameter that  
is derived from the name of the parameter itself.  
  
This oversight happened because the storage parameter was renamed  
relatively late during the development of the patch that became commit  
0d861bbb.  

M doc/src/sgml/ref/create_index.sgml

Adjust handling of an ANYARRAY actual input for an ANYARRAY argument.

commit   : 77ec5affbc44cc0a1d06d4201f0d7c8c79371550    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 18:29:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 18:29:07 -0400    

Click here for diff

Ordinarily it's impossible for an actual input of a function to have  
declared type ANYARRAY, since we'd resolve that to a concrete array  
type before doing argument type resolution for the function.  But an  
exception arises for functions applied to certain columns of pg_statistic  
or pg_stats, since we abuse the "anyarray" pseudotype by using it to  
declare those columns.  So parse_coerce.c has to deal with the case.  
  
Previously we allowed an ANYARRAY actual input to match an ANYARRAY  
polymorphic argument, but only if no other argument or result was  
declared ANYELEMENT.  When that logic was written, those were the only  
two polymorphic types, and I fear nobody thought carefully about how it  
ought to extend to the other ones that came along later.  But actually  
it was wrong even then, because if a function has two ANYARRAY  
arguments, it should be able to expect that they have identical element  
types, and we'd not be able to ensure that.  
  
The correct generalization is that we can match an ANYARRAY actual input  
to an ANYARRAY polymorphic argument only if no other argument or result  
is of any polymorphic type, so that no promises are being made about  
element type compatibility.  check_generic_type_consistency can't test  
that condition, but it seems better anyway to accept such matches there  
and then throw an error if needed in enforce_generic_type_consistency.  
That way we can produce a specific error message rather than an  
unintuitive "function does not exist" complaint.  (There's some risk  
perhaps of getting new ambiguous-function complaints, but I think that  
any set of functions for which that could happen would be ambiguous  
against ordinary array columns as well.)  While we're at it, we can  
improve the message that's produced in cases that the code did already  
object to, as shown in the regression test changes.  
  
Also, remove a similar test that got cargo-culted in for ANYRANGE;  
there are no catalog columns of type ANYRANGE, and I hope we never  
create any, so that's not needed.  (It was incomplete anyway.)  
  
While here, update some comments and rearrange the code a bit in  
preparation for upcoming additions of more polymorphic types.  
  
In practical situations I believe this is just exchanging one error  
message for another, hopefully better, one.  So it doesn't seem  
needful to back-patch, even though the mistake is ancient.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove logical_read_local_xlog_page

commit   : 5d0c2d5eba6b58b3c9955ee41c917f7df8b62746    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Mar 2020 18:18:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Mar 2020 18:18:01 -0300    

Click here for diff

It devolved into a content-less wrapper over read_local_xlog_page, with  
nothing to add, plus it's easily confused with walsender's  
logical_read_xlog_page.  There doesn't seem to be any reason for it to  
stay.  
  
src/include/replication/logicalfuncs.h becomes empty, so remove it too.  
The prototypes it initially had were absorbed by generated fmgrprotos.h.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
D src/include/replication/logicalfuncs.h

Fix consistency issues with replication slot copy

commit   : bcd1c3630095e48bc3b1eb0fc8e8c8a7c851eba1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Mar 2020 16:13:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Mar 2020 16:13:18 -0300    

Click here for diff

Commit 9f06d79ef831's replication slot copying failed to  
properly reserve the WAL that the slot is expecting to see  
during DecodingContextFindStartpoint (to set the confirmed_flush  
LSN), so concurrent activity could remove that WAL and cause the  
copy process to error out.  But it doesn't actually *need* that  
WAL anyway: instead of running decode to find confirmed_flush, it  
can be copied from the source slot. Fix this by rearranging things  
to avoid DecodingContextFindStartpoint() (leaving the target slot's  
confirmed_flush_lsn to invalid), and set that up afterwards by copying  
from the target slot's value.  
  
Also ensure the source slot's confirmed_flush_lsn is valid.  
  
Reported-by: Arseny Sher  
Author: Masahiko Sawada, Arseny Sher  
Discussion: https://postgr.es/m/871rr3ohbo.fsf@ars-thinkpad  

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

Doc: clarify behavior of "anyrange" pseudo-type.

commit   : 31d846e0265c2c1415d7910d39d5b259b92184ea    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 15:05:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 15:05:16 -0400    

Click here for diff

I noticed that we completely failed to document the restriction  
that an "anyrange" result type has to be inferred from an "anyrange"  
input.  The docs also were less clear than they could be about the  
relationship between "anyrange" and "anyarray".  
  
It's been like this all along, so back-patch.  

M doc/src/sgml/extend.sgml

Remove bogus assertion about polymorphic SQL function result.

commit   : 9d9784c840f3ac98eb41d021c981eea0fe1735ed    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 14:54:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 14:54:46 -0400    

Click here for diff

It is possible to reach check_sql_fn_retval() with an unresolved  
polymorphic rettype, resulting in an assertion failure as demonstrated  
by one of the added test cases.  However, the code following that  
throws what seems an acceptable error message, so just remove the  
Assert and adjust commentary.  
  
While here, I thought it'd be a good idea to provide some parallel  
tests of SQL-function and PL/pgSQL-function polymorphism behavior.  
Some of these cases are perhaps duplicative of tests elsewhere,  
but we hadn't any organized coverage of the topic AFAICS.  
  
Although that assertion's been wrong all along, it won't have any  
effect in production builds, so I'm not bothering to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/functions.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/polymorphism.sql

Use pkg-config, if available, to locate libxml2 during configure.

commit   : 0bc8cebdb889368abdf224aeac8bc197fe4c9ae6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 12:09:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Mar 2020 12:09:26 -0400    

Click here for diff

If pkg-config is installed and knows about libxml2, use its information  
rather than asking xml2-config.  Otherwise proceed as before.  This  
patch allows "configure --with-libxml" to succeed on platforms that  
have pkg-config but not xml2-config, which is likely to soon become  
a typical situation.  
  
The old mechanism can be forced by setting XML2_CONFIG explicitly  
(hence, build processes that were already doing so will certainly  
not need adjustment).  Also, it's now possible to set XML2_CFLAGS  
and XML2_LIBS explicitly to override both programs.  
  
There is a small risk of this breaking existing build processes,  
if there are multiple libxml2 installations on the machine and  
pkg-config disagrees with xml2-config about which to use.  The  
only case where that seems really likely is if a builder has tried  
to select a non-default xml2-config by putting it early in his PATH  
rather than setting XML2_CONFIG.  Plan to warn against that in the  
minor release notes.  
  
Back-patch to v10; before that we had no pkg-config infrastructure,  
and it doesn't seem worth adding it for this.  
  
Hugh McMaster and Tom Lane; Peter Eisentraut also made an earlier  
attempt at this, from which I lifted most of the docs changes.  
  
Discussion: https://postgr.es/m/CAN9BcdvfUwc9Yx5015bLH2TOiQ-M+t_NADBSPhMF7dZ=pLa_iw@mail.gmail.com  

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

Add the type information for index storage parameters to the documentation.

commit   : 28e0a103a835aec8b31c897b19b3ceb7d92e7c12    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 17 Mar 2020 16:06:59 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 17 Mar 2020 16:06:59 +0900    

Click here for diff

Author: Atsushi Torikoshi  
Discussion: https://postgr.es/m/CACZ0uYFQebs4WT5eu3dK4qm_2PurZuvB++8nDvSBG0ebRWmbdg@mail.gmail.com  

M doc/src/sgml/ref/create_index.sgml

Fix comment in xlog.c.

commit   : 1429d3f767a05e7a4819f55c5b3ff768862dcf78    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 17 Mar 2020 12:06:22 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 17 Mar 2020 12:06:22 +0900    

Click here for diff

This commit fixes the comment about SharedHotStandbyActive variable.  
The comment was apparently copy-and-pasted.  
  
Author: Atsushi Torikoshi  
Discussion: https://postgr.es/m/CACZ0uYEjpqZB9wN2Rwc_RMvDybyYqdbkPuDr1NyxJg4f9yGfMw@mail.gmail.com  

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

Remove useless pfree()s at the ends of various ValuePerCall SRFs.

commit   : 41b45576d532ab6ef4a968f78b5b06d700ebf61f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Mar 2020 21:36:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Mar 2020 21:36:53 -0400    

Click here for diff

We don't need to manually clean up allocations in a SRF's  
multi_call_memory_ctx, because the SRF_RETURN_DONE infrastructure  
takes care of that (and also ensures that it will happen even if the  
function never gets a final call, which simple manual cleanup cannot  
do).  
  
Hence, the code removed by this patch is a waste of code and cycles.  
Worse, it gives the impression that cleaning up manually is a thing,  
which can lead to more serious errors such as those fixed in  
commits 085b6b667 and b4570d33a.  So we should get rid of it.  
  
These are not quite actual bugs though, so I couldn't muster the  
enthusiasm to back-patch.  Fix in HEAD only.  
  
Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M src/backend/access/transam/multixact.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/tsvector_op.c

Avoid holding a directory FD open across assorted SRF calls.

commit   : b4570d33aa045df330bb325ba8a2cbf02266a555    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Mar 2020 21:05:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Mar 2020 21:05:28 -0400    

Click here for diff

This extends the fixes made in commit 085b6b667 to other SRFs with the  
same bug, namely pg_logdir_ls(), pgrowlocks(), pg_timezone_names(),  
pg_ls_dir(), and pg_tablespace_databases().  
  
Also adjust various comments and documentation to warn against  
expecting to clean up resources during a ValuePerCall SRF's final  
call.  
  
Back-patch to all supported branches, since these functions were  
all born broken.  
  
Justin Pryzby, with cosmetic tweaks by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/adminpack/adminpack.c
M contrib/pgrowlocks/pgrowlocks.c
M doc/src/sgml/xfunc.sgml
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/misc.c
M src/backend/utils/fmgr/README
M src/include/funcapi.h
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

nbtree: Fix obsolete _bt_search() comment.

commit   : 113758155c11cf993ca0ecee8856e300a2525a30    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 16 Mar 2020 15:51:06 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 16 Mar 2020 15:51:06 -0700    

Click here for diff

Oversight in commit d2086b08b02.  

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

Document pg_ls_*dir hiding of directories and special files

commit   : 8b6d94cf6c8319bfd6bebf8b863a5db586c19c3b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2020 19:12:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2020 19:12:14 -0300    

Click here for diff

It's strange that a directory-listing function does not list all entries  
in a directory, so let's at least document it.  This involves  
  
pg_ls_logdir  
pg_ls_waldir  
pg_ls_archive_statusdir  
pg_ls_tmpdir  
  
Backpatch as far back as it applies cleanly (and as far as as each  
function exists).  REL_10_STABLE uses different wording, but hopefully  
people are not reading docs so old to write new apps anyway.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Update comment

commit   : b234b567ed740aae368672670d8d03640e884f1f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2020 18:38:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2020 18:38:28 -0300    

Click here for diff

I forgot to update it per last-minute edits leading to commit  
2f9661311b83.  Reported by Mark Dilger.  
  
Discussion: https://postgr.es/m/[email protected]>  

M src/include/tcop/cmdtaglist.h

Plug memory leak

commit   : 046001fe3cf59e19b2e8c24b82fb2e9b8ab6edd4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2020 16:27:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Mar 2020 16:27:13 -0300    

Click here for diff

Introduced by b08dee24a557.  Noted by Coverity.  

M src/bin/pg_dump/pg_dump.c

nbtree: Pass down MAXALIGN()'d itemsz for new item.

commit   : 013c1f6af6c5017d97b1268cf9a5fa3d0575eecb    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 16 Mar 2020 12:00:10 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 16 Mar 2020 12:00:10 -0700    

Click here for diff

Refactor nbtinsert.c so that the final itemsz of each new non-pivot  
tuple (the MAXALIGN()'d size) is determined once.  Most of the functions  
used by leaf page inserts used the insertstate.itemsz value already.  
This commit makes everything use insertstate.itemsz as standard  
practice.  The goal is to decouple tuple size from "effective" tuple  
size.  Making this distinction isn't truly necessary right now, but that  
might change in the future.  
  
Also explain why we consistently apply MAXALIGN() to get an effective  
index tuple size.  This was rather unclear, in part because it isn't  
actually strictly necessary right now.  

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

Introduce a maintenance_io_concurrency setting.

commit   : fc34b0d9de27ab5ac2887da00b3892bdabd89e45    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 16 Mar 2020 12:31:34 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 16 Mar 2020 12:31:34 +1300    

Click here for diff

Introduce a GUC and a tablespace option to control I/O prefetching, much  
like effective_io_concurrency, but for work that is done on behalf of  
many client sessions.  
  
Use the new setting in heapam.c instead of the hard-coded formula  
effective_io_concurrency + 10 introduced by commit 558a9165e08.  Go with  
a default value of 10 for now, because it's a round number pretty close  
to the value used for that existing case.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJUw08dPs_3EUcdO6M90GnjofPYrWp4YSLaBkgYwS-AqA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/alter_tablespace.sgml
M doc/src/sgml/ref/create_tablespace.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/misc/guc.c
M src/bin/psql/tab-complete.c
M src/include/commands/tablespace.h
M src/include/storage/bufmgr.h
M src/include/utils/spccache.h

Simplify the effective_io_concurrency setting.

commit   : b09ff53667ffc986371ec8ffa372916ad460220d    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 16 Mar 2020 11:43:18 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 16 Mar 2020 11:43:18 +1300    

Click here for diff

The effective_io_concurrency GUC and equivalent tablespace option were  
previously passed through a formula based on a theory about RAID  
spindles and probabilities, to arrive at the number of pages to prefetch  
in bitmap heap scans.  Tomas Vondra, Andres Freund and others argued  
that it was anachronistic and hard to justify, and commit 558a9165e08  
already started down the path of bypassing it in new code.  We agreed to  
drop that logic and use the value directly.  
  
For the default setting of 1, there is no change in effect.  Higher  
settings can be converted from the old meaning to the new with:  
  
  select round(sum(OLD / n::float)) from generate_series(1, OLD) s(n);  
  
We might want to consider renaming the GUC before the next release given  
the change in meaning, but it's not clear that many users had set it  
very carefully anyway.  That decision is deferred for now.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJUw08dPs_3EUcdO6M90GnjofPYrWp4YSLaBkgYwS-AqA%40mail.gmail.com  

M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/misc/guc.c
M src/include/storage/bufmgr.h

nbtree: Reorder nbtinsert.c prototypes.

commit   : f207bb0b8f13999c91b405a2e6c8526225470816    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 15 Mar 2020 20:53:12 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 15 Mar 2020 20:53:12 -0700    

Click here for diff

Relocate _bt_newroot() prototype, so that the order that prototypes  
appear in matches the order that the functions are defined in.  

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

Add backend type to csvlog and optionally log_line_prefix

commit   : 70a7b4776be4e776221e578d8ca53b2b9f8118c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 15 Mar 2020 11:20:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 15 Mar 2020 11:20:21 +0100    

Click here for diff

The backend type, which corresponds to what  
pg_stat_activity.backend_type shows, is added as a column to the  
csvlog and can optionally be added to log_line_prefix using the new %b  
placeholder.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Reviewed-by: Kuntal Ghosh <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/error/elog.c
M src/backend/utils/misc/postgresql.conf.sample
M src/test/regress/pg_regress.c

Improve test coverage for multi-column MCV lists

commit   : d8cfa82d51f812f886d06bdc7bb73470e55d74b7    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 14 Mar 2020 23:04:56 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 14 Mar 2020 23:04:56 +0100    

Click here for diff

The regression tests for extended statistics were not testing a couple  
of important cases for the MCV lists:  
  
  * IS NOT NULL clauses - We did have queries with IS NULL clauses, but  
    not the negative case.  
  
  * clauses with variable on the right - All the clauses had the Var on  
    the left, i.e. (Var op Const), so this adds (Const op Var) too.  
  
  * columns with fixed-length types passed by reference - All columns  
    were using either by-value or varlena types, so add a test with  
    UUID columns too. This matters for (de)serialization.  
  
  * NULL-only dimension - When one of the columns contains only NULL  
    values, we treat it a a special case during (de)serialization.  
  
  * arrays containing NULL - When the constant parameter contains NULL  
    value, we need to handle it correctly during estimation, for all  
    IN, ANY and ALL clauses.  
  
Discussion: https://www.postgresql.org/message-id/flat/20200113230008.g67iyk4cs3xbnjju@development  
Author: Tomas Vondra  

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

Improve test coverage for functional dependencies

commit   : f9696782c70168e575c0f2d17a1cfe71847fef3d    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 14 Mar 2020 23:02:55 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 14 Mar 2020 23:02:55 +0100    

Click here for diff

The regression tests for functional dependencies were only using clauses  
of the form (Var op Const), i.e. with Var on the left side. This adds  
a couple of queries with Var on the right, to test other code paths.  
  
It also prints one of the functional dependencies, to test the data type  
output function. The functional dependencies are "perfect" with degree  
of 1.0 so this should be stable.  
  
Discussion: https://www.postgresql.org/message-id/flat/20200113230008.g67iyk4cs3xbnjju@development  
Author: Tomas Vondra  

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

Rearrange pseudotypes.c to get rid of duplicative code.

commit   : 87c9c2571c8146f1594830072253ba39e62ccbc8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2020 15:31:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2020 15:31:44 -0400    

Click here for diff

Commit a5954de10 replaced a lot of manually-coded stub I/O routines  
with code generated by macros.  That was a good idea but it didn't  
go far enough, because there were still manually-coded stub input  
routines for types that had live output routines.  Refactor the  
macro so that we can generate just a stub input routine at need.  
  
Also create similar macros to generate stub binary I/O routines,  
since we have some of those now.  The only stub functions that remain  
hand-coded are shell_in() and shell_out(), which need to be separate  
because they use different error messages.  
  
While here, rearrange the commentary to discuss each type not each  
function.  This provides a better way to explain the *why* of which  
types need which support, rather than just duplicatively annotating  
the functions.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Restructure polymorphic-type resolution in funcapi.c.

commit   : 4dbcb3f844eca4a401ce06aa2781bd9a9be433e9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2020 14:42:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Mar 2020 14:42:22 -0400    

Click here for diff

resolve_polymorphic_tupdesc() and resolve_polymorphic_argtypes() failed to  
cover the case of having to resolve anyarray given only an anyrange input.  
The bug was masked if anyelement was also used (as either input or  
output), which probably helps account for our not having noticed.  
  
While looking at this I noticed that resolve_generic_type() would produce  
the wrong answer if asked to make that same resolution.  ISTM that  
resolve_generic_type() is confusingly defined and overly complex, so  
rather than fix it, let's just make funcapi.c do the specific lookups  
it requires for itself.  
  
With this change, resolve_generic_type() is not used anywhere, so remove  
it in HEAD.  In the back branches, leave it alone (complete with bug)  
just in case any external code is using it.  
  
While we're here, make some other refactoring adjustments in funcapi.c  
with an eye to upcoming future expansion of the set of polymorphic types:  
  
* Simplify quick-exit tests by adding an overall have_polymorphic_result  
flag.  This is about a wash now but will be a win when there are more  
flags.  
  
* Reduce duplication of code between resolve_polymorphic_tupdesc() and  
resolve_polymorphic_argtypes().  
  
* Don't bother to validate correct matching of anynonarray or anyenum;  
the parser should have done that, and even if it didn't, just doing  
"return false" here would lead to a very confusing, off-point error  
message.  (Really, "return false" in these two functions should only  
occur if the call_expr isn't supplied or we can't obtain data type  
info from it.)  
  
* For the same reason, throw an elog rather than "return false" if  
we fail to resolve a polymorphic type.  
  
The bug's been there since we added anyrange, so back-patch to  
all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_coerce.c
M src/backend/utils/fmgr/funcapi.c
M src/include/parser/parse_coerce.h
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/rangetypes.sql

Use multi-variate MCV lists to estimate ScalarArrayOpExpr

commit   : e83daa7e331e0718bb254ab685f2ed95df423554    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 14 Mar 2020 14:56:37 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 14 Mar 2020 14:56:37 +0100    

Click here for diff

Commit 8f321bd16c added support for estimating ScalarArrayOpExpr clauses  
(IN/ANY) clauses using functional dependencies. There's no good reason  
not to support estimation of these clauses using multi-variate MCV lists  
too, so this commits implements that. That makes the behavior consistent  
and MCV lists can estimate all variants (ANY/ALL, inequalities, ...).  
  
Author: Tomas Vondra  
Review: Dean Rasheed  
Discussion: https://www.postgresql.org/message-id/flat/13902317.Eha0YfKkKy%40pierred-pdoc  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/include/statistics/extended_stats_internal.h
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Use functional dependencies to estimate ScalarArrayOpExpr

commit   : 8f321bd16cdb11307f17007eb3c55b65d7d323ef    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 14 Mar 2020 14:55:59 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 14 Mar 2020 14:55:59 +0100    

Click here for diff

Until now functional dependencies supported only simple equality clauses  
and clauses that can be trivially translated to equalities. This commit  
allows estimation of some ScalarArrayOpExpr (IN/ANY) clauses.  
  
For IN clauses we can do this thanks to using operator with equality  
semantics, which means an IN clause  
  
    WHERE c IN (1, 2, ..., N)  
  
can be translated to  
  
    WHERE (c = 1 OR c = 2 OR ... OR c = N)  
  
IN clauses are now considered compatible with functional dependencies,  
and rely on the same assumption of consistency of queries with data  
(which is an assumption we already used for simple equality clauses).  
This applies also to ALL clauses with an equality operator, which can be  
considered equivalent to IN clause.  
  
ALL clauses are still considered incompatible, although there's some  
discussion about maybe relaxing this in the future.  
  
Author: Pierre Ducroquet  
Reviewed-by: Tomas Vondra, Dean Rasheed  
Discussion: https://www.postgresql.org/message-id/flat/13902317.Eha0YfKkKy%40pierred-pdoc  

M doc/src/sgml/perform.sgml
M src/backend/statistics/dependencies.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Doc: fix mistaken reference to "PG_ARGNULL_xxx()" macro.

commit   : dbf95c843a3d66cf9a692f5937a1bec4f2261035    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Mar 2020 12:49:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Mar 2020 12:49:10 -0400    

Click here for diff

This should of course be just "PG_ARGISNULL()".  
  
Also reorder a couple of paras to make the discussion of PG_ARGISNULL  
less disjointed.  
  
Back-patch to v10 where the error was introduced.  
  
Laurenz Albe and Tom Lane, per an anonymous docs comment  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml

doc: Remove unused title ids

commit   : 340de72780e4eb769d5cf052b03084808bac476a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Mar 2020 15:45:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Mar 2020 15:45:37 +0100    

Click here for diff

FOP issues warnings about them.  These aren't even used, so just  
remove them.  For the ones that are actually used, we'll come up with  
a different solution.  
  
Discussion: https://www.postgresql.org/message-id/flat/e29b580e-79ab-a371-5ea4-6946e4d3af0b%402ndQuadrant.com  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/file-fdw.sgml
M doc/src/sgml/ref/commit_prepared.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/do.sgml
M doc/src/sgml/ref/prepare_transaction.sgml
M doc/src/sgml/ref/rollback_prepared.sgml

Remove am_syslogger global variable

commit   : d90bd24391fdde2b73906e16052821c9e3c1ce82    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 16:36:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 16:36:40 +0100    

Click here for diff

Use the new MyBackendType instead.  More similar changes for other "am  
something" variables are possible.  This one was just particularly  
simple.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Reviewed-by: Kuntal Ghosh <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/postmaster/syslogger.c
M src/backend/utils/error/elog.c
M src/include/postmaster/syslogger.h

Unify several ways to tracking backend type

commit   : 8e8a0becb335529c66a9f82f88e1419e49b458ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 16:36:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 16:36:40 +0100    

Click here for diff

Add a new global variable MyBackendType that uses the same BackendType  
enum that was previously only used by the stats collector.  That way  
several duplicate ways of checking what type a particular process is  
can be simplified.  Since it's no longer just for stats, move to  
miscinit.c and rename existing functions to match the expanded  
purpose.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Reviewed-by: Kuntal Ghosh <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/ps_status.c
M src/include/miscadmin.h
M src/include/pgstat.h

Preserve replica identity index across ALTER TABLE rewrite

commit   : 1cc9c2412cc9a2fbe6a381170097d315fd40ccca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Mar 2020 11:28:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Mar 2020 11:28:11 +0100    

Click here for diff

If an index was explicitly set as replica identity index, this setting  
was lost when a table was rewritten by ALTER TABLE.  Because this  
setting is part of pg_index but actually controlled by ALTER  
TABLE (not part of CREATE INDEX, say), we have to do some extra work  
to restore it.  
  
Based-on-patch-by: Quan Zongliang <[email protected]>  
Reviewed-by: Euler Taveira <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/replica_identity.out
M src/test/regress/sql/replica_identity.sql

Refactor compile-time assertion checks in c.h

commit   : b7f64c64d3262c309e2c5e8c11fd111b1dbd1a4a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 Mar 2020 15:04:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 Mar 2020 15:04:11 +0900    

Click here for diff

This commit refactors and simplifies the definitions of StaticAssertStmt,  
StaticAssertExpr and StaticAssertDecl.  By unifying the C and C++  
fallback implementations, this reduces the number of different  
implementations from four to three.  
  
Author: Michael Paquier  
Reviewed-by: Georgios Kokolatos, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h

Fix test case instability introduced in 085b6b667.

commit   : a029a0641cce002acbb5e8ac6ec5533e599a9aea    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2020 18:23:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2020 18:23:57 -0400    

Click here for diff

I forgot that the WAL directory might hold other files besides WAL  
segments, notably including new segments still being filled.  
That means a blind test for the first file's size being 16MB can  
fail.  Restrict based on file name length to make it more robust.  
  
Per buildfarm.  

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

Add pg_dump support for ALTER obj DEPENDS ON EXTENSION

commit   : b08dee24a5574ba6657d238b91c10f1f8e2608f8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2020 16:54:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2020 16:54:54 -0300    

Click here for diff

pg_dump is oblivious to this kind of dependency, so they're lost on  
dump/restores (and pg_upgrade).  Have pg_dump emit ALTER lines so that  
they're preserved.  Add some pg_dump tests for the whole thing, also.  
  
Reviewed-by: Tom Lane (offlist)  
Reviewed-by: Ibrar Ahmed  
Reviewed-by: Ahsan Hadi (who also reviewed commit 899a04f5ed61)  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/test/modules/test_pg_dump/t/001_base.pl

Avoid holding a directory FD open across pg_ls_dir_files() calls.

commit   : 085b6b6679e73b9b386f209b4d625c7bc60597c0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2020 15:27:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Mar 2020 15:27:59 -0400    

Click here for diff

This coding technique is undesirable because (a) it leaks the FD for  
the rest of the transaction if the SRF is not run to completion, and  
(b) allocated FDs are a scarce resource, but multiple interleaved  
uses of the relevant functions could eat many such FDs.  
  
In v11 and later, a query such as "SELECT pg_ls_waldir() LIMIT 1"  
yields a warning about the leaked FD, and the only reason there's  
no warning in earlier branches is that fd.c didn't whine about such  
leaks before commit 9cb7db3f0.  Even disregarding the warning, it  
wouldn't be too hard to run a backend out of FDs with careless use  
of these SQL functions.  
  
Hence, rewrite the function so that it reads the directory within  
a single call, returning the results as a tuplestore rather than  
via value-per-call mode.  
  
There are half a dozen other built-in SRFs with similar problems,  
but let's fix this one to start with, just to see if the buildfarm  
finds anything wrong with the code.  
  
In passing, fix bogus error report for stat() failure: it was  
whining about the directory when it should be fingering the  
individual file.  Doubtless a copy-and-paste error.  
  
Back-patch to v10 where this function was added.  
  
Justin Pryzby, with cosmetic tweaks and test cases by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor ps_status.c API

commit   : bf68b79e50e3359accc85c94fa23cc03abb9350a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 16:36:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 16:36:40 +0100    

Click here for diff

The init_ps_display() arguments were mostly lies by now, so to match  
typical usage, just use one argument and let the caller assemble it  
from multiple sources if necessary.  The only user of the additional  
arguments is BackendInitialize(), which was already doing string  
assembly on the caller side anyway.  
  
Remove the second argument of set_ps_display() ("force") and just  
handle that in init_ps_display() internally.  
  
BackendInitialize() also used to set the initial status as  
"authentication", but that was very far from where authentication  
actually happened.  So now it's set to "initializing" and then  
"authentication" just before the actual call to  
ClientAuthentication().  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Reviewed-by: Kuntal Ghosh <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/bootstrap/bootstrap.c
M src/backend/commands/async.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/basebackup.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lock.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/ps_status.c
M src/include/utils/ps_status.h

Avoid duplicates in ALTER ... DEPENDS ON EXTENSION

commit   : 899a04f5ed61c3db7a2bd84957ecf530c09fd05a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2020 11:04:59 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Mar 2020 11:04:59 -0300    

Click here for diff

If the command is attempted for an extension that the object already  
depends on, silently do nothing.  
  
In particular, this means that if a database containing multiple such  
entries is dumped, the restore will silently do the right thing and  
record just the first one.  (At least, in a world where pg_dump does  
dump such entries -- which it doesn't currently, but it will.)  
  
Backpatch to 9.6, where this kind of dependency was introduced.  
  
Reviewed-by: Ibrar Ahmed, Tom Lane (offlist)  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_depend.c
M src/backend/commands/alter.c
M src/include/catalog/dependency.h
M src/test/modules/test_extensions/expected/test_extdepend.out
M src/test/modules/test_extensions/sql/test_extdepend.sql

Clean up order in miscinit.c a bit

commit   : 1c918381814ca6ff976aab2bf130b0c582ca30e4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 13:51:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 13:51:55 +0100    

Click here for diff

The code around InitPostmasterChild() from commit 31c453165b5 somehow  
ended up in the middle of a block of code related to "User ID state".  
Move it into its own block instead.  

M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

Remove HAVE_WORKING_LINK

commit   : aaa3aeddee51dd0058d38469907865052706a590    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 10:58:02 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Mar 2020 10:58:02 +0100    

Click here for diff

Previously, hard links were not used on Windows and Cygwin, but they  
support them just fine in currently supported OS versions, so we can  
use them there as well.  
  
Since all supported platforms now support hard links, we can remove  
the alternative code paths.  
  
Rename durable_link_or_rename() to durable_rename_excl() to make the  
purpose more clear without referencing the implementation details.  
  
Discussion: https://www.postgresql.org/message-id/flat/72fff73f-dc9c-4ef4-83e8-d2e60c98df48%402ndquadrant.com  

M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c
M src/backend/storage/file/fd.c
M src/include/pg_config_manual.h
M src/include/storage/fd.h

Improve checking of child pages in contrib/amcheck.

commit   : d114cc538715e14d29d6de8b6ea1a1d5d3e0edb4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 11 Mar 2020 12:00:31 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 11 Mar 2020 12:00:31 +0300    

Click here for diff

This commit eliminates lossiness in check for missing parent downlinks in  
B-tree.  Instead of collecting lossy bitmap, we check for missing downlinks  
while visiting child pages referenced by downlinks of target level.  We  
traverse from previous child page to the subsequent child page by right links.  
Intermediate pages are candidates to have lost parent downlinks.  
  
Also this commit introduces matching of child high key to the pivot key of  
it's parent.  
  
Discussion: https://postgr.es/m/CAPpHfduoF-c4RhOyOm%3D4-Y367%2B8txq9Q6iM_ty0OYc8si1Abww%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Peter Geoghegan  

M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml

Remove stray parenthesis in nbtree.h.

commit   : a88a285c7e343502b55204a211818d12b1b7d6ff    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 10 Mar 2020 18:03:56 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 10 Mar 2020 18:03:56 -0700    

Click here for diff

Oversight in commit 0d861bbb702.  

M src/include/access/nbtree.h

nbtree: Move fastpath NULL descent stack assertion.

commit   : 39eabec90451d8badbba9b3e938d6d05432a0517    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 10 Mar 2020 17:25:47 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 10 Mar 2020 17:25:47 -0700    

Click here for diff

Commit 074251db added an assertion that verified the fastpath/rightmost  
page insert optimization's assumption about free space: There should  
always be enough free space on the page to insert the new item without  
splitting the page.  Otherwise, we end up using the "concurrent root  
page split" phony/fake stack path in _bt_insert_parent().  This does not  
lead to incorrect behavior, but it is likely to be far slower than  
simply using the regular _bt_search() path.  The assertion catches  
serious performance bugs that would probably take a long time to detect  
any other way.  
  
It seems much more natural to make this assertion just before the point  
that we generate a fake/phony descent stack.  Move the assert there.  
This also makes _bt_insertonpg() a bit more readable.  

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

Marginal comments and docs cleanup.

commit   : c8e8b2f9dfee21fa4ef1ec7da5c10e6ef706df36    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2020 17:34:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2020 17:34:01 -0400    

Click here for diff

Fix up some imprecise comments and poor markup from ba79cb5dc.  Also try  
to convert the documentation of log_min_duration_sample and friends into  
passable English.  

M doc/src/sgml/config.sgml
M src/backend/nodes/params.c
M src/backend/utils/mb/stringinfo_mb.c

nbtree: Demote minus infinity "can't happen" error.

commit   : d1e241c22602a5369b54e29b7430553445f6a52b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 10 Mar 2020 14:15:41 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 10 Mar 2020 14:15:41 -0700    

Click here for diff

Only a very basic logic bug in a _bt_insertonpg() caller could lead to a  
violation of this invariant.  Besides, any newitemoff used for an  
internal page is sanitized using other "can't happen" errors in  
_bt_getstackbuf() or its callers, before _bt_insertonpg() even gets  
called.  
  
Also, move the error/assertion from the insert-without-split path of  
_bt_insertonpg() to the top of the same function.  There is no reason  
why this invariant only applies to insertions that happen to not result  
in a page split; cover every insertion.  The assertion naturally belongs  
next to the existing generic assertions that document relatively  
high-level invariants for the item being inserted.  

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

Ensure that CREATE TABLE LIKE copies any NO INHERIT constraint property.

commit   : cacef172237fd3426b578f81b7414c0de56cbaaf    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2020 14:54:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2020 14:54:00 -0400    

Click here for diff

Since the documentation about LIKE doesn't say that a copied constraint  
has properties different from the original, it seems that ignoring  
a NO INHERIT property doesn't meet the principle of least surprise.  
So make it copy that.  
  
(Note, however, that we still don't copy a NOT VALID property;  
CREATE TABLE offers no way to do that, plus it seems pointless.)  
  
Arguably this is a bug fix; but no back-patch, as it seems barely  
possible somebody is depending on the current behavior.  
  
Ildar Musin and Chris Travers; reviewed by Amit Langote and myself  
  
Discussion: https://postgr.es/m/CAONYFtMC6C+3AWCVp7Yd8H87Zn0GxG1_iQG6_bQKbaqYZY0=-g@mail.gmail.com  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/sql/create_table_like.sql

Avoid portability problem introduced in 0a42a2e9c.

commit   : dbf05a14399430751e54cd0b4bd8fb0e4f1fb309    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2020 12:46:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2020 12:46:07 -0400    

Click here for diff

Apparently not all shells handle nested quotes quite the same.  
But we don't need the inner double quotes in this case, so just  
drop them.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in

Preserve integer and float values accurately in (de)serialize_deflist.

commit   : d01f03a495294f726001a90ec27a675428d9fc45    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2020 12:29:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Mar 2020 12:29:59 -0400    

Click here for diff

Previously, this code just smashed all types of DefElem values to  
strings, cavalierly reasoning that nobody would care.  But in point of  
fact, most of the defGetFoo functions do distinguish among different  
input syntaxes; for instance defGetBoolean will accept 1 as an integer  
but not "1" as a string.  This led to CREATE/ALTER TEXT SEARCH  
DICTIONARY accepting 0 and 1 as values for boolean dictionary  
properties, only to have the dictionary fail at runtime.  
  
We can upgrade this behavior by teaching serialize_deflist that it  
does not need to quote T_Integer or T_Float nodes' values on output,  
and then teaching deserialize_deflist to restore unquoted integer or  
float values as the appropriate node type.  This should not break  
anything using pg_ts_dict.dictinitoption, since that field is just  
defined as being something valid to include in CREATE TEXT SEARCH  
DICTIONARY.  
  
deserialize_deflist is also used to parse the options arguments  
for the ts_headline family of functions, but so far as I can see  
this won't cause any problems there either: the only consumer of  
that output is prsd_headline which always uses defGetString.  
(Really that's a bad idea, but I won't risk changing it here.)  
  
This is surely a bug fix, but given the lack of field complaints  
I don't think it's necessary to back-patch.  
  
Discussion: https://postgr.es/m/CAMkU=1xRcs_BUPzR0+V3WndaCAv0E_m3h6aUEJ8NF-sY1nnHsw@mail.gmail.com  

M contrib/dict_int/expected/dict_int.out
M contrib/dict_int/sql/dict_int.sql
M src/backend/commands/tsearchcmds.c
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/tsdicts.sql

Split out CreateCast into src/backend/catalog/pg_cast.c

commit   : 40b3e2c201af10c27a2c4c5bfcd029026b4cdff3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Mar 2020 11:28:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Mar 2020 11:28:23 -0300    

Click here for diff

This catalog-handling code was previously together with the rest of  
CastCreate() in src/backend/commands/functioncmds.c.  A future patch  
will need a way to add casts internally, so this will be useful to have  
separate.  
  
Also, move the nearby get_cast_oid() function from functioncmds.c to  
lsyscache.c, which seems a more natural place for it.  
  
Author: Paul Jungwirth, minor edits by Álvaro  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Makefile
A src/backend/catalog/pg_cast.c
M src/backend/commands/functioncmds.c
M src/backend/commands/typecmds.c
M src/backend/utils/cache/lsyscache.c
M src/include/catalog/pg_cast.h
M src/include/commands/defrem.h
M src/include/utils/lsyscache.h

Remove win32ver.rc from version_stamp.pl

commit   : 0a42a2e9ce8481a024d085f2cc526a366db8df59    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2020 11:20:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2020 11:20:38 +0100    

Click here for diff

This removes another relic from the old nmake-based Windows build.  
version_stamp.pl put version number information into win32ver.rc.  But  
win32ver.rc already gets other version number information from the  
preprocessor at build time, so it would make more sense if all version  
number information would be handled in the same way and we don't have  
two places that do it.  
  
What we need for this is having the major version number and the minor  
version number as separate integer symbols.  Both configure and  
Solution.pm already have that logic, because they compute  
PG_VERSION_NUM.  So we just keep all the logic there now.  Put the  
minor version number into a new symbol PG_MINORVERSION_NUM.  Also, add  
a symbol PG_MAJORVERSION_NUM, which is a number, alongside the  
existing PG_MAJORVERSION, which is a string.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/port/win32ver.rc
M src/tools/msvc/Solution.pm
M src/tools/version_stamp.pl

Remove utils/acl.h from catalog/objectaddress.h

commit   : 3c173a53a825075f3efe32b9917eff5063e81f4d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2020 10:22:52 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2020 10:22:52 +0100    

Click here for diff

The need for this was removed by  
8b9e9644dc6a9bd4b7a97950e6212f63880cf18b.  
  
A number of files now need to include utils/acl.h or  
parser/parse_node.h explicitly where they previously got it indirectly  
somehow.  
  
Since parser/parse_node.h already includes nodes/parsenodes.h, the  
latter is then removed where the former was added.  Also, remove  
nodes/pg_list.h from objectaddress.h, since that's included via  
nodes/parsenodes.h.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/7601e258-26b2-8481-36d0-dc9dca6f28f1%402ndquadrant.com  

M contrib/adminpack/adminpack.c
M contrib/file_fdw/file_fdw.c
M src/backend/access/brin/brin.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/collationcmds.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/dropcmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/executor/execExpr.c
M src/backend/executor/execPartition.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/misc/guc.c
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_namespace.h
M src/include/commands/collationcmds.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/defrem.h
M src/include/commands/extension.h
M src/include/commands/vacuum.h
M src/pl/tcl/pltcl.c

Support adding partitioned tables to publication

commit   : 17b9e7f9fe238eeb5f6b40061b444ebf28d9e06f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2020 08:42:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Mar 2020 08:42:59 +0100    

Click here for diff

When a partitioned table is added to a publication, changes of all of  
its partitions (current or future) are published via that publication.  
  
This change only affects which tables a publication considers as its  
members.  The receiving side still sees the data coming from the  
individual leaf partitions.  So existing restrictions that partition  
hierarchies can only be replicated one-to-one are not changed by this.  
  
Author: Amit Langote <[email protected]>  
Reviewed-by: Rafia Sabih <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/pg_publication.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
A src/test/subscription/t/013_partition.pl

Prevent reindex of invalid indexes on TOAST tables

commit   : 61d7c7bce3686ec02bd64abac742dd35ed9b9b01    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 Mar 2020 15:38:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 Mar 2020 15:38:17 +0900    

Click here for diff

Such indexes can only be duplicated leftovers of a previously failed  
REINDEX CONCURRENTLY command, and a valid equivalent is guaranteed to  
exist.  As toast indexes can only be dropped if invalid, reindexing  
these would lead to useless duplicated indexes that can't be dropped  
anymore, except if the parent relation is dropped.  
  
Thanks to Justin Pryzby for reminding that this problem was reported  
long ago during the review of the original patch of REINDEX  
CONCURRENTLY, but the issue was never addressed.  
  
Reported-by: Sergei Kornilov, Justin Pryzby  
Author: Julien Rouhaud  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/36712441546604286%40sas1-890ba5c2334a.qloud-c.yandex.net  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h

Tidy up XLogSource code in xlog.c.

commit   : 71e0d0a73773b3985db658d3c5366ce5ceef76ae    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 10 Mar 2020 09:41:44 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 10 Mar 2020 09:41:44 +0900    

Click here for diff

This commit replaces 0 used as an initial value of XLogSource variable,  
with XLOG_FROM_ANY. Also this commit changes those variable so that  
XLogSource instead of int is used as the type for them. These changes  
are for code readability and debugger-friendliness.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

Fix pg_dump/pg_restore to restore event triggers later.

commit   : 8728b2c703573c6cbb431e01e228ae489117f974    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Mar 2020 14:58:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Mar 2020 14:58:11 -0400    

Click here for diff

Previously, event triggers were restored just after regular triggers  
(and FK constraints, which are basically triggers).  This is risky  
since an event trigger, once installed, could interfere with subsequent  
restore commands.  Worse, because event triggers don't have any  
particular dependencies on any post-data objects, a parallel restore  
would consider them eligible to be restored the moment the post-data  
phase starts, allowing them to also interfere with restoration of a  
whole bunch of objects that would have been restored before them in  
a serial restore.  There's no way to completely remove the risk of a  
misguided event trigger breaking the restore, since if nothing else  
it could break other event triggers.  But we can certainly push them  
to later in the process to minimize the hazard.  
  
To fix, tweak the RestorePass mechanism introduced by commit 3eb9a5e7c  
so that event triggers are handled as part of the post-ACL processing  
pass (renaming the "REFRESH" pass to "POST_ACL" to reflect its more  
general use).  This will cause them to restore after everything except  
matview refreshes, which seems OK since matview refreshes really ought  
to run in the post-restore state of the database.  In a parallel  
restore, event triggers and matview refreshes might be intermixed,  
but that seems all right as well.  
  
Also update the code and comments in pg_dump_sort.c so that its idea  
of how things are sorted agrees with what actually happens due to  
the RestorePass mechanism.  This is mostly cosmetic: it'll affect the  
order of objects in a dump's TOC, but not the actual restore order.  
But not changing that would be quite confusing to somebody reading  
the code.  
  
Back-patch to all supported branches.  
  
Fabrízio de Royes Mello, tweaked a bit by me  
  
Discussion: https://postgr.es/m/CAFcNs+ow1hmFox8P--3GSdtwz-S3Binb6ZmoP6Vk+Xg=K6eZNA@mail.gmail.com  

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

Introduce LogicalTapeSetExtend().

commit   : 24d85952a57b16090ca8ad9cf800fbdd9ddd104f    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 6 Mar 2020 17:28:53 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 6 Mar 2020 17:28:53 -0800    

Click here for diff

Increases the number of tapes in a logical tape set. This will be  
important for disk-based hash aggregation, because the maximum number  
of tapes is not known ahead of time.  
  
While discussing this change, it was observed to regress the  
performance of Sort for at least one test case. The performance  
regression was because some versions of GCC switch to an inlined  
version of memcpy() in LogicalTapeWrite() after this change. No  
performance regression for clang was observed.  
  
Because the regression is due to an arbitrary decision by the  
compiler, I decided it shouldn't hold up this change. If it needs to  
be fixed, we can find a workaround.  
  
Author: Adam Lee, Jeff Davis  
Discussion: https://postgr.es/m/e54bfec11c59689890f277722aaaabd05f78e22c.camel%40j-davis.com  

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

Fix bug that causes to report waiting in PS display twice, in hot standby.

commit   : 17d3fcdc39577b1e43624392c25e5384da42e522    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 10 Mar 2020 00:14:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 10 Mar 2020 00:14:43 +0900    

Click here for diff

Previously "waiting" could appear twice via PS in case of lock conflict  
in hot standby mode. Specifically this issue happend when the delay  
in WAL application determined by max_standby_archive_delay and  
max_standby_streaming_delay had passed but it took more than 500 msec  
to cancel all the conflicting transactions. Especially we can observe this  
easily by setting those delay parameters to -1.  
  
The cause of this issue was that WaitOnLock() and  
ResolveRecoveryConflictWithVirtualXIDs() added "waiting" to  
the process title in that case. This commit prevents  
ResolveRecoveryConflictWithVirtualXIDs() from reporting waiting  
in case of lock conflict, to fix the bug.  
  
Back-patch to all back branches.  
  
Author: Masahiko Sawada  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CA+fd4k4mXWTwfQLS3RPwGr4xnfAEs1ysFfgYHvmmoUgv6Zxvmg@mail.gmail.com  

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

Add tg_updatedcols to TriggerData

commit   : 71d60e2aa05157efec28393b15c0b0b9fc1b210c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 Mar 2020 09:22:22 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 Mar 2020 09:22:22 +0100    

Click here for diff

This allows a trigger function to determine for an UPDATE trigger  
which columns were actually updated.  This allows some optimizations  
in generic trigger functions such as lo_manage and  
tsvector_update_trigger.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/lo/expected/lo.out
M contrib/lo/lo.c
M contrib/lo/sql/lo.sql
M doc/src/sgml/trigger.sgml
M src/backend/commands/trigger.c
M src/backend/utils/adt/tsvector_op.c
M src/include/commands/trigger.h

Code simplification

commit   : 8f152b6c50c764d4c300e73a535da88cd1b18fa5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 24 Feb 2020 10:12:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 24 Feb 2020 10:12:10 +0100    

Click here for diff

Initialize TriggerData to 0 for the whole struct together, instead of  
each field separately.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c

Avoid assertion failure with targeted recovery in standby mode.

commit   : ef34ab42a85968f3ab4c8e490b77dfb3565dd5e7    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 9 Mar 2020 15:31:31 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 9 Mar 2020 15:31:31 +0900    

Click here for diff

At the end of recovery, standby mode is turned off to re-fetch the last  
valid record from archive or pg_wal. Previously, if recovery target was  
reached and standby mode was turned off while the current WAL source  
was stream, recovery could try to retrieve WAL file containing the last  
valid record unexpectedly from stream even though not in standby mode.  
This caused an assertion failure. That is, the assertion test confirms that  
WAL file should not be retrieved from stream if standby mode is not true.  
  
This commit moves back the current WAL source to archive if it's stream  
even though not in standby mode, to avoid that assertion failure.  
  
This issue doesn't cause the server to crash when built with assertion  
disabled. In this case, the attempt to retrieve WAL file from stream not  
in standby mode just fails. And then recovery tries to retrieve WAL file  
from archive or pg_wal.  
  
Back-patch to all supported branches.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

Mark ssl_passphrase_command as GUC_SUPERUSER_ONLY.

commit   : d9249441efc5b4adc5b1a71f3d16538c68e198fc    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 9 Mar 2020 11:41:31 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 9 Mar 2020 11:41:31 +0900    

Click here for diff

This commit changes the GUC ssl_passphrase_command so that  
it's examinable by only superuser and a member of pg_read_all_settings.  
Per discussion, we determined to do this because the parameter may  
contain a sensitive informtaion like a passphrase itself.  
  
Author: Insung Moon  
Reviewed-by: Keisuke Kuroda  
Discussion: https://postgr.es/m/CAEMmqBuHVGayc+QkYKgx3gWSdqwTAQGw+0DYn3WhcX-eNa2ntA@mail.gmail.com  

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

Doc: fix some description of environment variables with frontend tools

commit   : 5aaa584f819e2d8d2fb23cdf2174ce6e5628e1f5    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 9 Mar 2020 10:53:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 9 Mar 2020 10:53:22 +0900    

Click here for diff

This addresses a couple of issues in the documentation:  
- Description of PG_COLOR was missing for some tools (pg_archivecleanup  
and pg_test_fsync), while the other descriptions had grammar mistakes.  
- pgbench supports more environment variables: PGUSER, PGHOST and  
PGPORT.  
- vacuumlo, oid2name and pgbench support coloring (HEAD only)  
  
Author: Michael Paquier  
Reviewed-by: Fabien Coelho, Daniel Gustafsson, Juan José Santamaría  
Flecha  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M doc/src/sgml/oid2name.sgml
M doc/src/sgml/ref/clusterdb.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/dropdb.sgml
M doc/src/sgml/ref/dropuser.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_controldata.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_isready.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M doc/src/sgml/vacuumlo.sgml

Add an "absval" parameter to allow contrib/dict_int to ignore signs.

commit   : 806eb92c018102da9514443ad19160c7b1841062    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2020 18:35:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2020 18:35:06 -0400    

Click here for diff

Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1xRcs_BUPzR0+V3WndaCAv0E_m3h6aUEJ8NF-sY1nnHsw@mail.gmail.com  

M contrib/dict_int/dict_int.c
M contrib/dict_int/expected/dict_int.out
M contrib/dict_int/sql/dict_int.sql
M doc/src/sgml/dict-int.sgml

Add an explicit test to catch changes in checksumming calculations.

commit   : 38ce06c37e9cc8fec9125262b129602c2274f344    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2020 15:09:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Mar 2020 15:09:14 -0400    

Click here for diff

Seems like a good idea in view of 006517432 and addd034ae.  
  
Michael Paquier, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/Makefile
A contrib/pageinspect/expected/checksum.out
A contrib/pageinspect/expected/checksum_1.out
A contrib/pageinspect/sql/checksum.sql

commit   : b0b5e20cd8d1a58a8782d5dc806a5232db116e2f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 8 Mar 2020 13:32:25 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 8 Mar 2020 13:32:25 +0300    

Click here for diff

This commit provides psql commands for listing operator classes, operator  
families and its contents in psql.  New commands will be useful for exploring  
capabilities of both builtin opclasses/opfamilies as well as  
opclasses/opfamilies defined in extensions.  
  
Discussion: https://postgr.es/m/1529675324.14193.5.camel%40postgrespro.ru  
Author: Sergey Cherkashin, Nikita Glukhov, Alexander Korotkov  
Reviewed-by: Michael Paquier, Alvaro Herrera, Arthur Zakirov  
Reviewed-by: Kyotaro Horiguchi, Andres Freund  

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

pageinspect: Fix types used for bt_metap() columns.

commit   : 691e8b2e1889d61df47ae76601fa9db6cbac6f1c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 7 Mar 2020 16:44:53 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 7 Mar 2020 16:44:53 -0800    

Click here for diff

The data types that contrib/pageinspect's bt_metap() function were  
declared to return as OUT arguments were wrong in some cases.  For  
example, the oldest_xact column (a TransactionId/xid field) was declared  
integer/int4 within the pageinspect extension's sql file.  This led to  
errors when an oldest_xact value that exceeded 2^31-1 was encountered.  
Some of the other columns were defined incorrectly ever since  
pageinspect was first introduced, though they were far less likely to  
produce problems in practice.  
  
Fix these issues by changing the declaration of bt_metap() to  
consistently use data types that can reliably represent all possible  
values.  This fixes things on HEAD only.  No backpatch, since it doesn't  
seem like there is a safe way to fix the issue without including a new  
version of the pageinspect extension (HEAD/Postgres 13 already  
introduced a new version of the extension).  Besides, the oldest_xact  
issue has been around since the release of Postgres 11, and we haven't  
heard any complaints about it before now.  
  
Also, throw an error when we detect a bt_metap() declaration that must  
be from an old version of the pageinspect extension by examining the  
number of attributes from the tuple descriptor for the return tuples.  
It seems better to throw an error in a reliable and obvious way  
following a Postgres upgrade, rather than letting bt_metap() fail  
unpredictably.  The problem is fundamentally with the CREATE FUNCTION  
declared data types themselves, so I see no sensible alternative.  
  
Reported-By: Victor Yegorov  
Bug: #16285  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/pageinspect–1.7–1.8.sql

Tab completion: offer parens as appropriate in CREATE/ALTER TEXT SEARCH.

commit   : b9c3de62cbc9c6993ceac0de99985cf051e91c88    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Mar 2020 16:58:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Mar 2020 16:58:07 -0500    

Click here for diff

Jeff Janes, Georgios Kokolatos  
  
Discussion: https://postgr.es/m/CAMkU=1wU=vgxnvwy2HswLUVvoawrkrjZYeKXMr3w3p=_NNbGhQ@mail.gmail.com  

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

Simplify/speed up assertion cross-check in ginCompressPostingList().

commit   : ea7dace2aa21e79a7a8eb23c493bcd2057d9bd7e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Mar 2020 13:31:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Mar 2020 13:31:17 -0500    

Click here for diff

I noticed while testing some other stuff that the CHECK_ENCODING_ROUNDTRIP  
logic in ginCompressPostingList could account for over 50% of the runtime  
of an INSERT with a GIN index.  While that's not relevant to production  
performance, it's still kind of annoying in a debug build.  Replacing  
the loop around short memcmp's with one long memcmp works just as well  
and is significantly faster, at least on my machine.  

M src/backend/access/gin/ginpostinglist.c

doc: Remove unused ids

commit   : 7e39b968f118c6444bd3a3bd59c3e9d73e652e0c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Mar 2020 14:04:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Mar 2020 14:04:09 +0100    

Click here for diff

Some reference pages contained id attributes on refname elements.  
These were apparently copied around from ancient times, but they don't  
serve a purpose.  FOP issues minor warnings about them.  So it's  
easiest to just remove them.  

M doc/src/sgml/ref/clusterdb.sgml
M doc/src/sgml/ref/postmaster.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/vacuumdb.sgml

doc: Add information about new SQL part SQL/MDA

commit   : 33e27c3785c5ce8a3264d6af2550ec5adcebc517    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Mar 2020 10:57:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Mar 2020 10:57:03 +0100    

Click here for diff

M doc/src/sgml/features.sgml

Fix typo

commit   : 8d7def5c27c18c85deaf4e55c39a074600f36b48    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Mar 2020 08:51:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Mar 2020 08:51:59 +0100    

Click here for diff

M src/backend/catalog/objectaddress.c

Create contrib/bool_plperl to provide a bool transform for PL/Perl[U].

commit   : 36058a3c55d2c42a513a53da8140b07cf0893afb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Mar 2020 17:11:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Mar 2020 17:11:23 -0500    

Click here for diff

plperl's default handling of bool arguments or results is not terribly  
satisfactory, since Perl doesn't consider the string 'f' to be false.  
Ideally we'd just fix that, but the backwards-compatibility hazard  
would be substantial.  Instead, build a TRANSFORM module that can  
be optionally applied to provide saner semantics.  
  
Perhaps usefully, this is also about the minimum possible skeletal  
example of a plperl transform module; so it might be a better starting  
point for user-written transform modules than hstore_plperl or  
jsonb_plperl.  
  
Ivan Panchenko  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/Makefile
A contrib/bool_plperl/.gitignore
A contrib/bool_plperl/Makefile
A contrib/bool_plperl/bool_plperl–1.0.sql
A contrib/bool_plperl/bool_plperl.c
A contrib/bool_plperl/bool_plperl.control
A contrib/bool_plperl/bool_plperlu–1.0.sql
A contrib/bool_plperl/bool_plperlu.control
A contrib/bool_plperl/expected/bool_plperl.out
A contrib/bool_plperl/expected/bool_plperlu.out
A contrib/bool_plperl/sql/bool_plperl.sql
A contrib/bool_plperl/sql/bool_plperlu.sql
M doc/src/sgml/plperl.sgml
M src/tools/msvc/Mkvcbuild.pm

Allow Unicode escapes in any server encoding, not only UTF-8.

commit   : a6525588b7c21fd8539e9a43ec9c5c245ed1cc91    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Mar 2020 14:17:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Mar 2020 14:17:43 -0500    

Click here for diff

SQL includes provisions for numeric Unicode escapes in string  
literals and identifiers.  Previously we only accepted those  
if they represented ASCII characters or the server encoding  
was UTF-8, making the conversion to internal form trivial.  
This patch adjusts things so that we'll call the appropriate  
encoding conversion function in less-trivial cases, allowing  
the escape sequence to be accepted so long as it corresponds  
to some character available in the server encoding.  
  
This also applies to processing of Unicode escapes in JSONB.  
However, the old restriction still applies to client-side  
JSON processing, since that hasn't got access to the server's  
encoding conversion infrastructure.  
  
This patch includes some lexer infrastructure that simplifies  
throwing errors with error cursors pointing into the middle of  
a string (or other complex token).  For the moment I only used  
it for errors relating to Unicode escapes, but we might later  
expand the usage to some other cases.  
  
Patch by me, reviewed by John Naylor.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/json.sgml
M doc/src/sgml/syntax.sgml
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/xml.c
M src/backend/utils/mb/mbutils.c
M src/common/jsonapi.c
M src/include/mb/pg_wchar.h
M src/include/parser/scanner.h
M src/test/regress/expected/json_encoding.out
M src/test/regress/expected/json_encoding_1.out
A src/test/regress/expected/json_encoding_2.out
M src/test/regress/expected/jsonpath_encoding.out
M src/test/regress/expected/jsonpath_encoding_1.out
A src/test/regress/expected/jsonpath_encoding_2.out
M src/test/regress/expected/strings.out
M src/test/regress/sql/json_encoding.sql
M src/test/regress/sql/jsonpath_encoding.sql
M src/test/regress/sql/strings.sql

Allow ALTER TYPE to change some properties of a base type.

commit   : fe30e7ebfa3846416f1adeb7cf611006513a4ee0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Mar 2020 12:19:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Mar 2020 12:19:29 -0500    

Click here for diff

Specifically, this patch allows ALTER TYPE to:  
* Change the default TOAST strategy for a toastable base type;  
* Promote a non-toastable type to toastable;  
* Add/remove binary I/O functions for a type;  
* Add/remove typmod I/O functions for a type;  
* Add/remove a custom ANALYZE statistics functions for a type.  
  
The first of these can be done by the type's owner; all the others  
require superuser privilege since misuse could cause problems.  
  
The main motivation for this patch is to allow extensions to  
upgrade the feature sets of their data types, so the set of  
alterable properties is biased towards that use-case.  However  
it's also true that changing some other properties would be  
a lot harder, as they get baked into physical storage and/or  
stored expressions that depend on the type.  
  
Along the way, refactor GenerateTypeDependencies() to make it easier  
to call, refactor DefineType's volatility checks so they can be shared  
by AlterType, and teach typcache.c that it might have to reload data  
from the type's pg_type row, a scenario it never handled before.  
Also rearrange alter_type.sgml a bit for clarity (put the  
composite-type operations together).  
  
Tomas Vondra and Tom Lane  
  
Discussion: https://postgr.es/m/20200228004440.b23ein4qvmxnlpht@development  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_type.sgml
M src/backend/catalog/pg_type.c
M src/backend/commands/typecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/backend/utils/cache/typcache.c
M src/bin/psql/tab-complete.c
M src/include/catalog/pg_type.h
M src/include/commands/typecmds.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/utils/typcache.h
M src/test/regress/expected/create_type.out
M src/test/regress/sql/create_type.sql

Fix page-level checksum calculation in checksum_impl.h

commit   : addd034ae1795d0a99305b294e4dce44c6b1dfd8    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 6 Mar 2020 08:15:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 6 Mar 2020 08:15:29 +0900    

Click here for diff

Issue introduced by me, as of 0065174.  
  
Reported-by: David Steele  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/checksum_impl.h

Remove the "opaque" pseudo-type and associated compatibility hacks.

commit   : bb03010b9f0766e10399174fe850b2506907c4e4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Mar 2020 15:48:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Mar 2020 15:48:56 -0500    

Click here for diff

A long time ago, it was necessary to declare datatype I/O functions,  
triggers, and language handler support functions in a very type-unsafe  
way involving a single pseudo-type "opaque".  We got rid of those  
conventions in 7.3, but there was still support in various places to  
automatically convert such functions to the modern declaration style,  
to be able to transparently re-load dumps from pre-7.3 servers.  
It seems unnecessary to continue to support that anymore, so take out  
the hacks; whereupon the "opaque" pseudo-type itself is no longer  
needed and can be dropped.  
  
This is part of a group of patches removing various server-side kluges  
for transparently upgrading pre-8.0 dump files.  Since we've had few  
complaints about dropping pg_dump's support for dumping from pre-8.0  
servers (commit 64f3524e2), it seems okay to now remove these kluges.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/ref/create_language.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/create_type.sgml
M src/backend/commands/functioncmds.c
M src/backend/commands/proclang.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/utils/adt/pseudotypes.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/commands/defrem.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpython/plpy_main.c
M src/test/regress/expected/create_type.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/create_type.sql
M src/test/regress/sql/opr_sanity.sql

Remove ancient hacks to ignore certain opclass names in CREATE INDEX.

commit   : 84eca14bc4bdf71911cceb3a6286bc47db3a5a06    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Mar 2020 15:36:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Mar 2020 15:36:06 -0500    

Click here for diff

Twenty years ago, we removed certain operator classes in favor of  
letting indexes over their data types be built with some other  
binary-compatible, more standard opclass.  As a hack to allow existing  
index definitions to be dumped and reloaded, we made CREATE INDEX ignore  
the removed opclass names, so that such indexes would fall back to the  
new default opclass for their data types.  This was never intended to  
be a long-lived thing; it carries the obvious risk of breaking some  
future developer's attempt to re-use those old opclass names.  Since  
all of the cases in question are for opclasses that were removed  
before PG 8.0, it seems okay to get rid of these hacks now.  
  
This is part of a group of patches removing various server-side kluges  
for transparently upgrading pre-8.0 dump files.  Since we've had few  
complaints about dropping pg_dump's support for dumping from pre-8.0  
servers (commit 64f3524e2), it seems okay to now remove these kluges.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/indexcmds.c

Remove ancient support for upgrading pre-7.3 foreign key constraints.

commit   : e58a5997528794687e40ec64b3c4d95a4e6cd0b0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Mar 2020 15:25:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Mar 2020 15:25:45 -0500    

Click here for diff

Before 7.3, foreign key constraints had no explicit catalog  
representation, so that what pg_dump produced for them was (usually)  
a set of three CREATE CONSTRAINT TRIGGER commands.  Commit a2899ebdc  
and some follow-on fixes added an ugly hack in CreateTrigger() to  
recognize that pattern and reconstruct the foreign key definition.  
However, we've never had any test coverage for that code, so that it's  
legitimate to wonder if it still works; and having to maintain it in  
the face of upcoming trigger-related patches seems rather pointless.  
Let's decree that its time has passed, and drop it.  
  
This is part of a group of patches removing various server-side kluges  
for transparently upgrading pre-8.0 dump files.  Since we've had few  
complaints about dropping pg_dump's support for dumping from pre-8.0  
servers (commit 64f3524e2), it seems okay to now remove these kluges.  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

Remove RangeIOData->typiofunc

commit   : a77315fdf2a197a925e670be2d8b376c4ac02efc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Mar 2020 11:35:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Mar 2020 11:35:02 -0300    

Click here for diff

We used to carry the I/O function OID in RangeIOData, but it's not used  
for anything.  Since the struct is not exposed to the world anyway, we  
can simplify it a bit.  Also, rename the FmgrInfo member to match  
the accompanying 'typioparam' and put them in a more sensible order.  
  
Reviewed by Tom Lane and Paul Jungwirth.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid -Wconversion warnings when using checksum_impl.h

commit   : 0065174324a97c0f39ccf0823a81fb674fb49cca    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 5 Mar 2020 14:12:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 5 Mar 2020 14:12:37 +0900    

Click here for diff

This does not matter much when compiling Postgres proper as many  
warnings exist when enabling this compilation flag, but it can be  
annoying for external modules willing to use both.  
  
Author: David Steele  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/checksum_impl.h

Fix issues around .pgpass file.

commit   : 2eb3bc58814fa1ab86308a3658ddb76081080db3    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 5 Mar 2020 13:00:38 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 5 Mar 2020 13:00:38 +0900    

Click here for diff

This commit fixes the following two issues around .pgpass file.  
  
(1) If the length of a line in .pgpass file was larger than 319B,  
        libpq silently treated each 319B in the line as a separate  
        setting line.  
  
(2) The document explains that a line beginning with # is treated  
        as a comment in .pgpass. But there was no code doing such  
        special handling. Whether a line begins with # or not, libpq  
        just checked that the first token in the line match with the host.  
  
For (1), this commit makes libpq warn if the length of a line  
is larger than 319B, and throw away the remaining part beginning  
from 320B position.  
  
For (2), this commit changes libpq so that it treats any lines  
beginning with # as comments.  
  
Author: Fujii Masao  
Reviewed-by: Hamid Akhtar  
Discussion: https://postgr.es/m/[email protected]  

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

Fix more issues with dependency handling at swap phase of REINDEX CONCURRENTLY

commit   : fbcf0871123b464fef7f957301dcc57377cde9c5    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 5 Mar 2020 12:50:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 5 Mar 2020 12:50:15 +0900    

Click here for diff

When canceling a REINDEX CONCURRENTLY operation after swapping is done,  
a drop of the parent table would leave behind old indexes.  This is a  
consequence of 68ac9cf, which fixed the case of pg_depend bloat when  
repeating REINDEX CONCURRENTLY on the same relation.  
  
In order to take care of the problem without breaking the previous fix,  
this uses a different strategy, possible even with the exiting set of  
routines to handle dependency changes.  The dependencies of/on the  
new index are additionally switched to the old one, allowing an old  
invalid index remaining around because of a cancellation or a failure to  
use the dependency links of the concurrently-created index.  This  
ensures that dropping any objects the old invalid index depends on also  
drops the old index automatically.  
  
Reported-by: Julien Rouhaud  
Author: Michael Paquier  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/20200227080735.l32fqcauy73lon7o@nol  
Backpatch-through: 12  

M src/backend/catalog/index.c

Extend ExecBuildAggTrans() to support a NULL pointer check.

commit   : c954d49046504bde0a80b5fec53f4321dd88f1ea    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 4 Mar 2020 17:20:20 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 4 Mar 2020 17:20:20 -0800    

Click here for diff

Optionally push a step to check for a NULL pointer to the pergroup  
state.  
  
This will be important for disk-based hash aggregation in combination  
with grouping sets. When memory limits are reached, a given tuple may  
find its per-group state for some grouping sets but not others. For  
the former, it advances the per-group state as normal; for the latter,  
it skips evaluation and the calling code will have to spill the tuple  
and reprocess it in a later batch.  
  
Add the NULL check as a separate expression step because in some  
common cases it's not needed.  
  
Discussion: https://postgr.es/m/20200221202212.ssb2qpmdgrnx52sj%40alap3.anarazel.de  

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

Introduce macros for typalign and typstorage constants.

commit   : 3ed2005ff595d349276e5b2edeca1a8100b08c87    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2020 10:34:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 Mar 2020 10:34:25 -0500    

Click here for diff

Our usual practice for "poor man's enum" catalog columns is to define  
macros for the possible values and use those, not literal constants,  
in C code.  But for some reason lost in the mists of time, this was  
never done for typalign/attalign or typstorage/attstorage.  It's never  
too late to make it better though, so let's do that.  
  
The reason I got interested in this right now is the need to duplicate  
some uses of the TYPSTORAGE constants in an upcoming ALTER TYPE patch.  
But in general, this sort of change aids greppability and readability,  
so it's a good idea even without any specific motivation.  
  
I may have missed a few places that could be converted, and it's even  
more likely that pending patches will re-introduce some hard-coded  
references.  But that's not fatal --- there's no expectation that  
we'd actually change any of these values.  We can clean up stragglers  
over time.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_trgm/trgm_op.c
M contrib/pgcrypto/pgp-pgsql.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/tupdesc.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/table/toast_helper.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/toasting.c
M src/backend/commands/analyze.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/policy.c
M src/backend/commands/prepare.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/nodeTidscan.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/libpq/hba.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/tsearch/dict.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/pg_dump.c
M src/include/access/toast_helper.h
M src/include/access/tupmacs.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_type.h
M src/include/utils/lsyscache.h
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/plpy_typeio.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c

commit   : 0ad6f848eef267489d4aee7306c16f96454b7a64    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Mar 2020 08:05:33 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Mar 2020 08:05:33 +0100    

Click here for diff

This way we can make use of it in other components as well, and it  
fits better with the rest of the build system.  
  
Discussion: https://www.postgresql.org/message-id/flat/72fff73f-dc9c-4ef4-83e8-d2e60c98df48%402ndquadrant.com  

M configure
M configure.in
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/include/pg_config.h.in
M src/include/port.h
A src/port/link.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Allow to_date/to_timestamp to recognize non-English month/day names.

commit   : d67755049388526cd8673aa826dc794b97345eb3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Mar 2020 11:06:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Mar 2020 11:06:47 -0500    

Click here for diff

to_char() has long allowed the TM (translation mode) prefix to  
specify output of translated month or day names; but that prefix  
had no effect in input format strings.  Now it does.  to_date()  
and to_timestamp() will now recognize the same month or day names  
that to_char() would output for the same format code.  Matching is  
case-insensitive (per the active collation's notion of what that  
means), just as it has always been for English month/day names  
without the TM prefix.  
  
(As per the discussion thread, there are lots of cases that this  
feature will not handle, such as alternate day names.  But being  
able to accept what to_char() will output seems useful enough.)  
  
In passing, fix some shaky English and violations of message  
style guidelines in jsonpath errors for the .datetime() method,  
which depends on this code.  
  
Juan José Santamaría Flecha, reviewed and modified by me,  
with other commentary from Alvaro Herrera, Tomas Vondra,  
Arthur Zakirov, Peter Eisentraut, Mark Dilger.  
  
Discussion: https://postgr.es/m/CAC+AXB3u1jTngJcoC1nAHBf=M3v-jrEfo86UFtCqCjzbWS9QhA@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/pg_locale.c
M src/include/utils/formatting.h
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/sql/collate.linux.utf8.sql
M src/test/regress/sql/jsonb_jsonpath.sql

pg_standby: Don't use HAVE_WORKING_LINK

commit   : 1810ca18bfad9072facc548417630115b078483e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Feb 2020 16:33:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Feb 2020 16:33:05 +0100    

Click here for diff

HAVE_WORKING_LINK is meant to indicate support for hard links, mainly  
for Windows.  Here it is used for soft links on Unix, and the  
functionality is optional anyway, so we can just make it error out  
normally if needed.  
  
Discussion: https://www.postgresql.org/message-id/flat/72fff73f-dc9c-4ef4-83e8-d2e60c98df48%402ndquadrant.com  

M contrib/pg_standby/pg_standby.c

Fix typo in monitoring.sgml.

commit   : 61b73940452b1f6871a1d73f35216fb052a7a5ab    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 3 Mar 2020 15:01:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 3 Mar 2020 15:01:47 +0900    

Click here for diff

Author: Noriyoshi Shinoda  

M doc/src/sgml/monitoring.sgml

Remove overzealous _bt_split() assertions.

commit   : 1e07f5e0a1cf56f8cbc121dbb86c128a0f711c94    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 2 Mar 2020 21:40:11 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 2 Mar 2020 21:40:11 -0800    

Click here for diff

_bt_split() is passed NULL as its insertion scankey for internal page  
splits.  Two recently added Assert() statements failed to consider this,  
leading to a crash with pg_upgrade'd BREE_VERSION < 4 indexes.  Remove  
the assertions.  
  
The assertions in question were added by commit 0d861bbb, which added  
nbtree deduplication.  It would be possible to fix the assertions  
directly instead, but they weren't adding much anyway.  

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

Fix assertion failure with ALTER TABLE ATTACH PARTITION and indexes

commit   : 0b48f1335dddb7141160e392cccac98edfb3fa85    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Mar 2020 13:55:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Mar 2020 13:55:41 +0900    

Click here for diff

Using ALTER TABLE ATTACH PARTITION causes an assertion failure when  
attempting to work on a partitioned index, because partitioned indexes  
cannot have partition bounds.  
  
The grammar of ALTER TABLE ATTACH PARTITION requires partition bounds,  
but not ALTER INDEX, so mixing ALTER TABLE with partitioned indexes is  
confusing.  Hence, on HEAD, prevent ALTER TABLE to attach a partition if  
the relation involved is a partitioned index.  On back-branches, as  
applications may rely on the existing behavior, just remove the  
culprit assertion.  
  
Reported-by: Alexander Lakhin  
Author: Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Fix the name of the first WAL segment file, in docs.

commit   : 54a4f52a9258198243c53fceaf8da70546ebd652    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 3 Mar 2020 12:22:04 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 3 Mar 2020 12:22:04 +0900    

Click here for diff

Previously the documentation explains that WAL segment files  
start at 000000010000000000000000. But the first WAL segment file  
that initdb creates is 000000010000000000000001 not  
000000010000000000000000. This change was caused by old  
commit 8c843fff2d, but the documentation had not been updated  
a long time.  
  
Back-patch to all supported branches.  
  
Author: Fujii Masao  
Reviewed-by: David Zhang  
Discussion: https://postgr.es/m/CAHGQGwHOmGe2OqGOmp8cOfNVDivq7dbV74L5nUGr+3eVd2CU2Q@mail.gmail.com  

M doc/src/sgml/wal.sgml

Report progress of streaming base backup.

commit   : e65497df8f85ab9b9084c928ff69f384ea729b24    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 3 Mar 2020 12:03:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 3 Mar 2020 12:03:43 +0900    

Click here for diff

This commit adds pg_stat_progress_basebackup view that reports  
the progress while an application like pg_basebackup is taking  
a base backup. This uses the progress reporting infrastructure  
added by c16dc1aca5e0, adding support for streaming base backup.  
  
Bump catversion.  
  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, Amit Langote, Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/basebackup.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Preserve pg_index.indisclustered across REINDEX CONCURRENTLY

commit   : d79fb88ac738e0854e84a6c9445babfa5b2504b0    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Mar 2020 10:12:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Mar 2020 10:12:28 +0900    

Click here for diff

If the flag value is lost, a CLUSTER query following REINDEX  
CONCURRENTLY could fail.  Non-concurrent REINDEX is already handling  
this case consistently.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/catalog/index.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix possibly-uninitialized variable.

commit   : 91f3bd732cea7e25e53eaceae88232d0ab984434    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Mar 2020 18:41:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Mar 2020 18:41:50 -0500    

Click here for diff

Thinko in 2f9661311.  Per buildfarm, as well as warning seen locally.  

M contrib/pg_stat_statements/pg_stat_statements.c

Represent command completion tags as structs

commit   : 2f9661311b83dc481fc19f6e3bda015392010a40    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 2 Mar 2020 18:19:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 2 Mar 2020 18:19:51 -0300    

Click here for diff

The backend was using strings to represent command tags and doing string  
comparisons in multiple places, but that's slow and unhelpful.  Create a  
new command list with a supporting structure to use instead; this is  
stored in a tag-list-file that can be tailored to specific purposes with  
a caller-definable C macro, similar to what we do for WAL resource  
managers.  The first first such uses are a new CommandTag enum and a  
CommandTagBehavior struct.  
  
Replace numerous occurrences of char *completionTag with a  
QueryCompletion struct so that the code no longer stores information  
about completed queries in a cstring.  Only at the last moment, in  
EndCommand(), does this get converted to a string.  
  
EventTriggerCacheItem no longer holds an array of palloc’d tag strings  
in sorted order, but rather just a Bitmapset over the CommandTags.  
  
Author: Mark Dilger, with unsolicited help from Álvaro Herrera  
Reviewed-by: John Naylor, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/sepgsql/hooks.c
M doc/src/sgml/event-trigger.sgml
M src/backend/commands/createas.c
M src/backend/commands/event_trigger.c
M src/backend/commands/matview.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/executor/execMain.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/replication/logical/decode.c
M src/backend/replication/walsender.c
M src/backend/tcop/Makefile
A src/backend/tcop/cmdtag.c
M src/backend/tcop/dest.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/mmgr/portalmem.c
M src/include/commands/createas.h
M src/include/commands/event_trigger.h
M src/include/commands/matview.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
A src/include/tcop/cmdtag.h
A src/include/tcop/cmdtaglist.h
M src/include/tcop/dest.h
M src/include/tcop/pquery.h
M src/include/tcop/utility.h
M src/include/utils/evtcache.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/tcl/pltcl.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

Blacklist port/win32_msvc/utime.h in cpluspluscheck and headerscheck.

commit   : 7b425a5283cb2c8a452c2e79d6218e41373fd641    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Mar 2020 14:35:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Mar 2020 14:35:22 -0500    

Click here for diff

Since commit 481c8e923 it tends to produce "error: sys/utime.h: No such  
file or directory" on non-Windows platforms.  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Silence nbtree.h cpluspluscheck warning.

commit   : 90051cd8278bd089cf59ca6366df64de2982be2a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 2 Mar 2020 10:29:30 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 2 Mar 2020 10:29:30 -0800    

Click here for diff

Add a cast to size_t to silence "comparison between signed and unsigned  
integer expressions" cpluspluscheck warning.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/nbtree.h

Add assertions to _bt_update_posting().

commit   : 77b88bd5dc92a46319a3dd4b554f89f634bb9eaa    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 2 Mar 2020 08:07:16 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 2 Mar 2020 08:07:16 -0800    

Click here for diff

Copy some assertions from _bt_form_posting() to its sibling function,  
_bt_update_posting().  
  
Discussion: https://postgr.es/m/CAH2-WzkPR8KMwkL0ap976kmXwBCeukTeHz6fB-U__wvuP1S9Zg@mail.gmail.com  

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

Update Microsoft documentation link

commit   : ed0d8837658946de4c965a55bf0ea73fd2682d7f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 2 Mar 2020 15:21:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 2 Mar 2020 15:21:42 +0100    

Click here for diff

Reported-by: Juan José Santamaría Flecha <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAC%2BAXB1EDXiRPmiVfh%2BWX79x5vXJDU17k0GkDjfyPgOWO4Y5og%40mail.gmail.com  

M src/bin/pg_upgrade/file.c

Remove long unused code behind a #if 0

commit   : d433b79b89c7d429ab69cb00857a8aca45d0ad47    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 2 Mar 2020 08:55:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 2 Mar 2020 08:55:31 +0100    

Click here for diff

Author: Vignesh C <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CALDaNm3sn4yOq-4rogb-CfE0EYw6b3mVzz8+DnS9BNRwPnhngw@mail.gmail.com  

M src/interfaces/ecpg/pgtypeslib/numeric.c

Fix command-line colorization on Windows with VT100-compatible environments

commit   : 3b77dce863d94de2de40b2a302c0f58248655e6c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 Mar 2020 15:45:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 Mar 2020 15:45:34 +0900    

Click here for diff

When setting PG_COLOR to "always" or "auto" in a Windows terminal  
VT100-compatible, the colorization output was not showing up correctly  
because it is necessary to update the console's output handling mode.  
This fix allows to detect automatically if the environment is compatible  
with VT100.  Hence, PG_COLOR=auto is able to detect and handle both  
compatible and non-compatible environments.  The behavior of  
PG_COLOR=always remains unchanged, as it enforces the use of colorized  
output even if the environment does not allow it.  
  
This fix is based on an initial suggestion from Thomas Munro.  
  
Reported-by: Haiying Tang  
Author: Juan José Santamaría Flecha  
Reviewed-by: Michail Nikolaev, Michael Paquier, Haiying Tang  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/common/logging.c

Handle logical decoding in multi-insert for catalog tuples

commit   : 12c5cad76f9247f39b6e542ef1c6255912c2adda    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 Mar 2020 10:00:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 Mar 2020 10:00:37 +0900    

Click here for diff

The code path for multi-insert decoding is not stressed yet for  
catalogs (a future patch may introduce this capability), so no  
back-patch is needed.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

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

Remove dead code from _bt_update_posting().

commit   : 84ec9b231a865348f5388dcc125c084297709332    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 1 Mar 2020 12:11:26 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 1 Mar 2020 12:11:26 -0800    

Click here for diff

Discussion: https://postgr.es/m/CAH2-WzmAufHiOku6AGiFD=81VQs5nYJ1L2YkhW1t+BH4CMsgRw@mail.gmail.com  

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

Fix corner-case loss of precision in numeric ln().

commit   : 43a899f41f46918a0bf442edb091b08c214c68f8    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 1 Mar 2020 14:49:25 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 1 Mar 2020 14:49:25 +0000    

Click here for diff

When deciding on the local rscale to use for the Taylor series  
expansion, ln_var() neglected to account for the fact that the result  
is subsequently multiplied by a factor of 2^(nsqrt+1), where nsqrt is  
the number of square root operations performed in the range reduction  
step, which can be as high as 22 for very large inputs. This could  
result in a loss of precision, particularly when combined with large  
rscale values, for which a large number of Taylor series terms is  
required (up to around 400).  
  
Fix by computing a few extra digits in the Taylor series, based on the  
weight of the multiplicative factor log10(2^(nsqrt+1)). It remains to  
be proven whether or not the other 8 extra digits used for the Taylor  
series is appropriate, but this at least deals with the obvious  
oversight of failing to account for the effects of the final  
multiplication.  
  
Per report from Justin AnyhowStep. Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: Fix pageinspect bt_page_items() example.

commit   : dba915333967609cc7ca73f0904dfdc08db0a052    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 29 Feb 2020 15:10:13 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 29 Feb 2020 15:10:13 -0800    

Click here for diff

Oversight in commit 93ee38ea.  

M doc/src/sgml/pageinspect.sgml

Teach pageinspect about nbtree deduplication.

commit   : 93ee38eade1b2b4964354b95b01b09e17d6f098d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 29 Feb 2020 12:10:17 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 29 Feb 2020 12:10:17 -0800    

Click here for diff

Add a new bt_metap() column to display the metapage's allequalimage  
field.  Also add three new columns to contrib/pageinspect's  
bt_page_items() function:  
  
* Add a boolean column ("dead") that displays the LP_DEAD bit value for  
each non-pivot tuple.  
  
* Add a TID column ("htid") that displays a single heap TID value for  
each tuple.  This is the TID that is returned by BTreeTupleGetHeapTID(),  
so comparable values are shown for pivot tuples, plain non-pivot tuples,  
and posting list tuples.  
  
* Add a TID array column ("tids") that displays TIDs from each tuple's  
posting list, if any.  This works just like the "tids" column from  
pageinspect's gin_leafpage_items() function.  
  
No version bump for the pageinspect extension, since there hasn't been a  
stable Postgres release since the last version bump (the last bump was  
part of commit 58b4cb30).  
  
Author: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-WzmSMmU2eNvY9+a4MNP+z02h6sa-uxZvN3un6jY02ZVBSw@mail.gmail.com  

M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/btree.out
M contrib/pageinspect/pageinspect–1.7–1.8.sql
M doc/src/sgml/pageinspect.sgml

Correctly re-use hash tables in buildSubPlanHash().

commit   : 58c47ccfff20b8c125903482725c1dbfd30beade    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Feb 2020 13:48:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Feb 2020 13:48:09 -0500    

Click here for diff

Commit 356687bd8 omitted to remove leftover code for destroying  
a hashed subplan's hash tables, with the result that the tables  
were always rebuilt not reused; this leads to severe memory  
leakage if a hashed subplan is re-executed enough times.  
Moreover, the code for reusing the hashnulls table had a typo  
that would have made it do the wrong thing if it were reached.  
  
Looking at the code coverage report shows severe under-coverage  
of the potential callers of ResetTupleHashTable, so add some test  
cases that exercise them.  
  
Andreas Karlsson and Tom Lane, per reports from Ranier Vilela  
and Justin Pryzby.  
  
Backpatch to v11, as the faulty commit was.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAEudQAo=DCebm1RXtig9OH+QivpS97sMkikt0A9qHmMUs+g6ZA@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeSubplan.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Remove obsolete comment.

commit   : 6afc8aefd3b95c0c4e7d07d2c99b90ce83e313de    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Feb 2020 13:23:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Feb 2020 13:23:12 -0500    

Click here for diff

Noted while studying subplan hash issue.  

M src/backend/executor/execGrouping.c

Avoid failure if autovacuum tries to access a just-dropped temp namespace.

commit   : 80d76be51cfb7f8f54e779ec5a287d80ac28b6e4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Feb 2020 20:28:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Feb 2020 20:28:34 -0500    

Click here for diff

Such an access became possible when commit 246a6c8f7 added more  
aggressive cleanup of orphaned temp relations by autovacuum.  
Since autovacuum's snapshot might be slightly stale, it could  
attempt to access an already-dropped temp namespace, resulting in  
an assertion failure or null-pointer dereference.  (In practice,  
since we don't drop temp namespaces automatically but merely  
recycle them, this situation could only arise if a superuser does  
a manual drop of a temp namespace.  Still, that should be allowed.)  
  
The core of the bug, IMO, is that isTempNamespaceInUse and its callers  
failed to think hard about whether to treat "temp namespace isn't there"  
differently from "temp namespace isn't in use".  In hopes of forestalling  
future mistakes of the same ilk, replace that function with a new one  
checkTempNamespaceStatus, which makes the same tests but returns a  
three-way enum rather than just a bool.  isTempNamespaceInUse is gone  
entirely in HEAD; but just in case some external code is relying on it,  
keep it in the back branches, as a bug-compatible wrapper around the  
new function.  
  
Per report originally from Prabhat Kumar Sahu, investigated by Mahendra  
Singh and Michael Paquier; the final form of the patch is my fault.  
This replaces the failed fix attempt in a052f6cbb.  
  
Backpatch as far as v11, as 246a6c8f7 was.  
  
Discussion: https://postgr.es/m/CAKYtNAr9Zq=1-ww4etHo-VCC-k120YxZy5OS01VkaLPaDbv2tg@mail.gmail.com  

M src/backend/catalog/namespace.c
M src/backend/postmaster/autovacuum.c
M src/include/catalog/namespace.h

Fix commit c11cb17d.

commit   : 32bb4535a0be892f4a2794a26ba429032f4ae51e    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 28 Feb 2020 09:32:35 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 28 Feb 2020 09:32:35 -0800    

Click here for diff

I neglected to update copyfuncs/outfuncs/readfuncs.  
  
Discussion: https://postgr.es/m/12491.1582833409%40sss.pgh.pa.us  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h

Doc: correct thinko in pg_buffercache documentation.

commit   : 963ea55c34cc325243fd30468ce8c629572f0c73    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Feb 2020 11:29:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Feb 2020 11:29:58 -0500    

Click here for diff

Access to this module is granted to the pg_monitor role, not  
pg_read_all_stats.  (Given the view's performance impact,  
it seems wise to be restrictive, so I think this was the  
correct decision --- and anyway it was clearly intentional.)  
  
Per bug #16279 from Philip Semanchuk.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgbuffercache.sgml

Add comments on avoid reuse of parse-time snapshot

commit   : db989184cda7f4aa1ff764cca96142029e7e093b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 28 Feb 2020 13:13:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 28 Feb 2020 13:13:54 -0300    

Click here for diff

Apparently, reusing the parse-time query snapshot for later steps  
(execution) is a frequently considered optimization ... but it doesn't  
work, for reasons discovered in thread [1].  Adding some comments about  
why it doesn't really work can relieve some future hackers from wasting  
time reimplementing it again.  
  
[1] https://postgr.es/m/flat/[email protected]  
  
Author: Michail Nikolaev  
Discussion: https://postgr.es/m/CANtu0ogp6cTvMJObXP8n=k+JtqxY1iT9UV5MbGCpjjPa5crCiw@mail.gmail.com  

M src/backend/tcop/postgres.c

Add PostgreSQL home page to --help output

commit   : 1933ae629e7b706c6c23673a381e778819db307d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Feb 2020 08:54:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Feb 2020 08:54:49 +0100    

Click here for diff

Per emerging standard in GNU programs and elsewhere.  Autoconf already  
has support for specifying a home page, so we can just that.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8d389c5f-7fb5-8e48-9a4a-68cec44786fa%402ndquadrant.com  

M configure
M configure.in
M contrib/oid2name/oid2name.c
M contrib/pg_standby/pg_standby.c
M contrib/vacuumlo/vacuumlo.c
M src/Makefile.global.in
M src/Makefile.shlib
M src/backend/main/main.c
M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/help.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/test/regress/pg_regress.c
M src/tools/msvc/Solution.pm

Refer to bug report address by symbol rather than hardcoding

commit   : 864934131ef72dc3a403ad1375a94543fcc04206    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Feb 2020 08:54:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Feb 2020 08:54:49 +0100    

Click here for diff

Use the PACKAGE_BUGREPORT macro that is created by Autoconf for  
referring to the bug reporting address rather than hardcoding it  
everywhere.  This makes it easier to change the address and it reduces  
translation work.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8d389c5f-7fb5-8e48-9a4a-68cec44786fa%402ndquadrant.com  

M configure.in
M contrib/oid2name/oid2name.c
M contrib/pg_standby/pg_standby.c
M contrib/vacuumlo/vacuumlo.c
M src/backend/main/main.c
M src/backend/postmaster/postmaster.c
M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/help.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/type.c
M src/test/regress/pg_regress.c

Catversion bump for b9b408c48724

commit   : afb5465e0cfce7637066eaaaeecab30b0f23fbe3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 27 Feb 2020 17:25:47 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 27 Feb 2020 17:25:47 -0300    

Click here for diff

Per Tom Lane.  

M src/include/catalog/catversion.h

Save calculated transitionSpace in Agg node.

commit   : c11cb17dc55a6b432dc637491a4491920f9c2770    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 27 Feb 2020 10:46:58 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 27 Feb 2020 10:46:58 -0800    

Click here for diff

This will be useful in the upcoming Hash Aggregation work to improve  
estimates for hash table sizing.  
  
Discussion: https://postgr.es/m/37091115219dd522fd9ed67333ee8ed1b7e09443.camel%40j-davis.com  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/planmain.h

Doc: Fix deduplicate_items index term.

commit   : e537aed61db767745b614600be15cd19bb581330    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 27 Feb 2020 09:32:34 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 27 Feb 2020 09:32:34 -0800    

Click here for diff

Reported-By: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_index.sgml

Record parents of triggers

commit   : b9b408c487244ef8e6d613d183c56eb2c62990b1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 27 Feb 2020 13:23:33 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 27 Feb 2020 13:23:33 -0300    

Click here for diff

This let us get rid of a recently introduced ugly hack (commit  
1fa846f1c9af).  
  
Author: Álvaro Herrera  
Reviewed-by: Amit Langote, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/include/catalog/pg_trigger.h
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Remove TAP test for createdb --lc-ctype

commit   : c4b0edb07ed53063ea4c86cd7918ad6ea01d8979    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Feb 2020 21:58:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Feb 2020 21:58:37 +0900    

Click here for diff

OpenBSD falls back to "C" when using an incorrect input with setlocale()  
and LC_CTYPE, causing this test, introduced by 008cf04, to fail.  This  
removes the culprit test to avoid the portability issue.  
  
Per report from Robert Haas, via buildfarm member curculio.  
  
Discussion: https://postgr.es/m/CA+TgmoZ6ddh3mHD9gU8DvNYoFmuJaYYn1+4AvZNp25vTdRwCAQ@mail.gmail.com  
Backpatch-through: 11  

M src/bin/scripts/t/020_createdb.pl

Skip foreign tablespaces when running pg_checksums/pg_verify_checksums

commit   : 428a2609ef64b69d709418a50e192ff11a2643f1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Feb 2020 15:31:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Feb 2020 15:31:27 +0900    

Click here for diff

Attempting to use pg_checksums (pg_verify_checksums in 11) on a data  
folder which includes tablespace paths used across multiple major  
versions would cause pg_checksums to scan all directories present in  
pg_tblspc, and not only marked with TABLESPACE_VERSION_DIRECTORY.  This  
could lead to failures when for example running sanity checks on an  
upgraded instance with --check.  Even worse, it was possible to rewrite  
on-disk pages with --enable for a cluster potentially online.  
  
This commit makes pg_checksums skip any directories not named  
TABLESPACE_VERSION_DIRECTORY, similarly to what is done for base  
backups.  
  
Reported-by: Michael Banck  
Author: Michael Banck, Bernd Helmle  
Discussion: https://postgr.es/m/[email protected]  
backpatch-through: 11  

M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/002_actions.pl

Move src/backend/utils/hash/hashfn.c to src/common

commit   : 05d8449e73694585b59f8b03aaa087f04cc4679a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 27 Feb 2020 09:25:41 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 27 Feb 2020 09:25:41 +0530    

Click here for diff

This also involves renaming src/include/utils/hashutils.h, which  
becomes src/include/common/hashfn.h. Perhaps an argument can be  
made for keeping the hashutils.h name, but it seemed more  
consistent to make it match the name of the file, and also more  
descriptive of what is actually going on here.  
  
Patch by me, reviewed by Suraj Kharage and Mark Dilger. Off-list  
advice on how not to break the Windows build from Davinder Singh  
and Amit Kapila.  
  
Discussion: http://postgr.es/m/CA+TgmoaRiG4TXND8QuM6JXFRkM_1wL2ZNhzaUKsuec9-4yrkgw@mail.gmail.com  

M contrib/citext/citext.c
M contrib/hstore/hstore_op.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/sepgsql/uavc.c
M src/backend/access/common/tupdesc.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/commands/async.c
M src/backend/executor/execGrouping.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/tidbitmap.c
M src/backend/partitioning/partbounds.c
M src/backend/storage/file/sharedfileset.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/hash/Makefile
M src/backend/utils/hash/dynahash.c
M src/backend/utils/resowner/resowner.c
M src/common/Makefile
R099 src/backend/utils/hash/hashfn.c src/common/hashfn.c
M src/include/access/hash.h
R097 src/include/utils/hashutils.h src/include/common/hashfn.h
M src/tools/msvc/Mkvcbuild.pm

createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate

commit   : 008cf040962c98c7c55d54c28dcb43c3c1d83c92    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Feb 2020 11:20:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Feb 2020 11:20:46 +0900    

Click here for diff

The original coding failed to properly quote those arguments, leading to  
failures when using quotes in the values used.  As the quoting can be  
encoding-sensitive, the connection to the backend needs to be taken  
before applying the correct quoting.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/bin/scripts/createdb.c
M src/bin/scripts/t/020_createdb.pl

Silence another compiler warning in nbtinsert.c.

commit   : 2c0797da2c26dd5574e0d9128887c1fc2a385c25    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 26 Feb 2020 15:15:45 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 26 Feb 2020 15:15:45 -0800    

Click here for diff

Per complaint from Álvaro Herrera.  

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

Suppress unnecessary RelabelType nodes in more cases.

commit   : a477bfc1dfb8d2b7125a9818edcbf383bf82d62a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Feb 2020 18:13:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Feb 2020 18:13:58 -0500    

Click here for diff

eval_const_expressions sometimes produced RelabelType nodes that  
were useless because they just relabeled an expression to the same  
exposed type it already had.  This is worth avoiding because it can  
cause two equivalent expressions to not be equal(), preventing  
recognition of useful optimizations.  In the test case added here,  
an unpatched planner fails to notice that the "sqli = constant" clause  
renders a sort step unnecessary, because one code path produces an  
extra RelabelType and another doesn't.  
  
Fix by ensuring that eval_const_expressions_mutator's T_RelabelType  
case will not add in an unnecessary RelabelType.  Also save some  
code by sharing a subroutine with the effectively-equivalent cases  
for CollateExpr and CoerceToDomain.  (CollateExpr had no bug, and  
I think that the case couldn't arise with CoerceToDomain, but  
it seems prudent to do the same check for all three cases.)  
  
Back-patch to v12.  In principle this has been wrong all along,  
but I haven't seen a case where it causes visible misbehavior  
before v12, so refrain from changing stable branches unnecessarily.  
  
Per investigation of a report from Eric Gillum.  
  
Discussion: https://postgr.es/m/CAMmjdmvAZsUEskHYj=KT9sTukVVCiCSoe_PBKOXsncFeAUDPCQ@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/equivclass.out
M src/test/regress/sql/equivclass.sql

Fix docs regarding AFTER triggers on partitioned tables

commit   : 3acfe6b089a5283c2961eb2ff135106e23b89263    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 26 Feb 2020 19:57:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 26 Feb 2020 19:57:14 -0300    

Click here for diff

In commit 86f575948c77 I forgot to update the trigger.sgml paragraph  
that needs to explain that AFTER triggers are allowed in partitioned  
tables.  Do so now.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/trigger.sgml

Silence compiler warning in nbtinsert.c.

commit   : 2d8a6fad18fcec1850b79ddcf3a0032058d86715    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 26 Feb 2020 13:17:36 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 26 Feb 2020 13:17:36 -0800    

Click here for diff

Per buildfarm member longfin.  

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

Add deduplication to nbtree.

commit   : 0d861bbb702f8aa05c2a4e3f1650e7e8df8c8c27    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 26 Feb 2020 13:05:30 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 26 Feb 2020 13:05:30 -0800    

Click here for diff

Deduplication reduces the storage overhead of duplicates in indexes that  
use the standard nbtree index access method.  The deduplication process  
is applied lazily, after the point where opportunistic deletion of  
LP_DEAD-marked index tuples occurs.  Deduplication is only applied at  
the point where a leaf page split would otherwise be required.  New  
posting list tuples are formed by merging together existing duplicate  
tuples.  The physical representation of the items on an nbtree leaf page  
is made more space efficient by deduplication, but the logical contents  
of the page are not changed.  Even unique indexes make use of  
deduplication as a way of controlling bloat from duplicates whose TIDs  
point to different versions of the same logical table row.  
  
The lazy approach taken by nbtree has significant advantages over a GIN  
style eager approach.  Most individual inserts of index tuples have  
exactly the same overhead as before.  The extra overhead of  
deduplication is amortized across insertions, just like the overhead of  
page splits.  The key space of indexes works in the same way as it has  
since commit dd299df8 (the commit that made heap TID a tiebreaker  
column).  
  
Testing has shown that nbtree deduplication can generally make indexes  
with about 10 or 15 tuples for each distinct key value about 2.5X - 4X  
smaller, even with single column integer indexes (e.g., an index on a  
referencing column that accompanies a foreign key).  The final size of  
single column nbtree indexes comes close to the final size of a similar  
contrib/btree_gin index, at least in cases where GIN's posting list  
compression isn't very effective.  This can significantly improve  
transaction throughput, and significantly reduce the cost of vacuuming  
indexes.  
  
A new index storage parameter (deduplicate_items) controls the use of  
deduplication.  The default setting is 'on', so all new B-Tree indexes  
automatically use deduplication where possible.  This decision will be  
reviewed at the end of the Postgres 13 beta period.  
  
There is a regression of approximately 2% of transaction throughput with  
synthetic workloads that consist of append-only inserts into a table  
with several non-unique indexes, where all indexes have few or no  
repeated values.  The underlying issue is that cycles are wasted on  
unsuccessful attempts at deduplicating items in non-unique indexes.  
There doesn't seem to be a way around it short of disabling  
deduplication entirely.  Note that deduplication of items in unique  
indexes is fairly well targeted in general, which avoids the problem  
there (we can use a special heuristic to trigger deduplication passes in  
unique indexes, since we're specifically targeting "version bloat").  
  
Bump XLOG_PAGE_MAGIC because xl_btree_vacuum changed.  
  
No bump in BTREE_VERSION, since the representation of posting list  
tuples works in a way that's backwards compatible with version 4 indexes  
(i.e. indexes built on PostgreSQL 12).  However, users must still  
REINDEX a pg_upgrade'd index to use deduplication, regardless of the  
Postgres version they've upgraded from.  This is the only way to set the  
new nbtree metapage flag indicating that deduplication is generally  
safe.  
  
Author: Anastasia Lubennikova, Peter Geoghegan  
Reviewed-By: Peter Geoghegan, Heikki Linnakangas  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/btree.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/citext.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/Makefile
M src/backend/access/nbtree/README
A src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/storage/page/bufpage.c
M src/bin/psql/tab-complete.c
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/rmgrlist.h
M src/include/access/xlog_internal.h
M src/test/regress/expected/btree_index.out
M src/test/regress/sql/btree_index.sql

Add equalimage B-Tree support functions.

commit   : 612a1ab76724aa1514b6509269342649f8cab375    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 26 Feb 2020 11:28:25 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 26 Feb 2020 11:28:25 -0800    

Click here for diff

Invent the concept of a B-Tree equalimage ("equality implies image  
equality") support function, registered as support function 4.  This  
indicates whether it is safe (or not safe) to apply optimizations that  
assume that any two datums considered equal by an operator class's order  
method must be interchangeable without any loss of semantic information.  
This is static information about an operator class and a collation.  
  
Register an equalimage routine for almost all of the existing B-Tree  
opclasses.  We only need two trivial routines for all of the opclasses  
that are included with the core distribution.  There is one routine for  
opclasses that index non-collatable types (which returns 'true'  
unconditionally), plus another routine for collatable types (which  
returns 'true' when the collation is a deterministic collation).  
  
This patch is infrastructure for an upcoming patch that adds B-Tree  
deduplication.  
  
Author: Peter Geoghegan, Anastasia Lubennikova  
Discussion: https://postgr.es/m/CAH2-Wzn3Ee49Gmxb7V1VJ3-AC8fWn-Fr8pfWQebHe8rYRxt5OQ@mail.gmail.com  

M doc/src/sgml/btree.sgml
M doc/src/sgml/ref/alter_opfamily.sgml
M doc/src/sgml/ref/create_opclass.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/commands/opclasscmds.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/varlena.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/access/nbtree.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/opr_sanity.sql

Include error code in message from pg_upgrade

commit   : 4109bb5de4998b9301ea2ac18c9d6dfb0b4f900b    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 26 Feb 2020 10:03:11 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 26 Feb 2020 10:03:11 +0100    

Click here for diff

In passing, also quote the filename in one message where it wasn't.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/server.c

Fix build failure on header generation with repetitive builds of MSVC

commit   : 59f9cd9dd5e4db8c59c57a17388c17564a3211a3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Feb 2020 13:57:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Feb 2020 13:57:40 +0900    

Click here for diff

GenerateConfigHeader() in Solution.pm was complaining about unused  
define symbols even if a newer config header was not generated, causing  
successive build attempts with MSVC to fail.  
  
Oversight in commit 8f4fb4c.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Juan José Santamaría Flecha  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Solution.pm

Fix compile failure.

commit   : 36390713a60f446da7e7ae758771c9104fa89394    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Feb 2020 18:43:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Feb 2020 18:43:23 -0500    

Click here for diff

I forgot that some compilers won't handle #if constructs within  
ereport() calls.  Duplicating most of the call is annoying but simple.  
Per buildfarm.  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c

expression eval: Reduce number of steps for agg transition invocations.

commit   : 2742c45080077ed3b08b810bb96341499b86d530    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 24 Feb 2020 14:39:22 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 24 Feb 2020 14:39:22 -0800    

Click here for diff

Do so by combining the various steps that are part of aggregate  
transition function invocation into one larger step. As some of the  
current steps are only necessary for some aggregates, have one variant  
of the aggregate transition step for each possible combination.  
  
To avoid further manual copies of code in the different transition  
step implementations, move most of the code into helper functions  
marked as "always inline".  
  
The benefit of this change is an increase in performance when  
aggregating lots of rows. This comes in part due to the reduced number  
of indirect jumps due to the reduced number of steps, and in part by  
reducing redundant setup code across steps. This mainly benefits  
interpreted execution, but the code generated by JIT is also improved  
a bit.  
  
As a nice side-effect it also ends up making the code a bit simpler.  
  
A small additional optimization is removing the need to set  
aggstate->curaggcontext before calling ExecAggInitGroup, choosing to  
instead passign curaggcontext as an argument. It was, in contrast to  
other aggregate related functions, only needed to fetch a memory  
context to copy the transition value into.  
  
Author: Andres Freund  
Discussion:  
   https://postgr.es/m/[email protected]  
   https://postgr.es/m/[email protected]  

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

Issue properly WAL record for CID of first catalog tuple in multi-insert

commit   : 7d672b76bf27327dc3527dabcd8be4e2dedf430f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Feb 2020 07:55:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Feb 2020 07:55:22 +0900    

Click here for diff

Multi-insert for heap is not yet used actively for catalogs, but the  
code to support this case is in place for logical decoding.  The  
existing code forgot to issue a XLOG_HEAP2_NEW_CID record for the first  
tuple inserted, leading to failures when attempting to use multiple  
inserts for catalogs at decoding time.  This commit fixes the problem by  
WAL-logging the needed CID.  
  
This is not an active bug, so no back-patch is done.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

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

Account explicitly for long-lived FDs that are allocated outside fd.c.

commit   : 3d475515a15f70a4a3f36fbbba93db6877ff8346    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Feb 2020 17:28:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Feb 2020 17:28:33 -0500    

Click here for diff

The comments in fd.c have long claimed that all file allocations should  
go through that module, but in reality that's not always practical.  
fd.c doesn't supply APIs for invoking some FD-producing syscalls like  
pipe() or epoll_create(); and the APIs it does supply for non-virtual  
FDs are mostly insistent on releasing those FDs at transaction end;  
and in some cases the actual open() call is in code that can't be made  
to use fd.c, such as libpq.  
  
This has led to a situation where, in a modern server, there are likely  
to be seven or so long-lived FDs per backend process that are not known  
to fd.c.  Since NUM_RESERVED_FDS is only 10, that meant we had *very*  
few spare FDs if max_files_per_process is >= the system ulimit and  
fd.c had opened all the files it thought it safely could.  The  
contrib/postgres_fdw regression test, in particular, could easily be  
made to fall over by running it under a restrictive ulimit.  
  
To improve matters, invent functions Acquire/Reserve/ReleaseExternalFD  
that allow outside callers to tell fd.c that they have or want to allocate  
a FD that's not directly managed by fd.c.  Add calls to track all the  
fixed FDs in a standard backend session, so that we are honestly  
guaranteeing that NUM_RESERVED_FDS FDs remain unused below the EMFILE  
limit in a backend's idle state.  The coding rules for these functions say  
that there's no need to call them in code that just allocates one FD over  
a fairly short interval; we can dip into NUM_RESERVED_FDS for such cases.  
That means that there aren't all that many places where we need to worry.  
But postgres_fdw and dblink must use this facility to account for  
long-lived FDs consumed by libpq connections.  There may be other places  
where it's worth doing such accounting, too, but this seems like enough  
to solve the immediate problem.  
  
Internally to fd.c, "external" FDs are limited to max_safe_fds/3 FDs.  
(Callers can choose to ignore this limit, but of course it's unwise  
to do so except for fixed file allocations.)  I also reduced the limit  
on "allocated" files to max_safe_fds/3 FDs (it had been max_safe_fds/2).  
Conceivably a smarter rule could be used here --- but in practice,  
on reasonable systems, max_safe_fds should be large enough that this  
isn't much of an issue, so KISS for now.  To avoid possible regression  
in the number of external or allocated files that can be opened,  
increase FD_MINFREE and the lower limit on max_files_per_process a  
little bit; we now insist that the effective "ulimit -n" be at least 64.  
  
This seems like pretty clearly a bug fix, but in view of the lack of  
field complaints, I'll refrain from risking a back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M src/backend/access/transam/xlog.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/latch.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/storage/fd.h

Change client-side fsync_fname() to report errors fatally

commit   : 1420617b14e2e3722367b826986a50ea33ff62ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 24 Feb 2020 16:32:34 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 24 Feb 2020 16:32:34 +0100    

Click here for diff

Given all we have learned about fsync() error handling in the last few  
years, reporting an fsync() error non-fatally is not useful,  
unless you don't care much about the file, in which case you probably  
don't need to use fsync() in the first place.  
  
Change fsync_fname() and durable_rename() to exit(1) on fsync() errors  
other than those that we specifically chose to ignore.  
  
This affects initdb, pg_basebackup, pg_checksums, pg_dump, pg_dumpall,  
and pg_rewind.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d239d1bd-aef0-ca7c-dc0a-da14bdcf0392%402ndquadrant.com  

M src/common/file_utils.c

Adapt hashfn.c and hashutils.h for frontend use.

commit   : a91e2fa94180f24dd68fb6c99136cda820e02089    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Feb 2020 17:27:15 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Feb 2020 17:27:15 +0530    

Click here for diff

hash_any() and its various variants are defined to return Datum,  
which is a backend-only concept, but the underlying functions  
actually want to return uint32 and uint64, and only return Datum  
because it's convenient for callers who are using them to  
implement a hash function for some SQL datatype.  
  
However, changing these functions to return uint32 and uint64  
seems like it might lead to programming errors or back-patching  
difficulties, both because they are widely used and because  
failure to use UInt{32,64}GetDatum() might not provoke a  
compilation error. Instead, rename the existing functions as  
well as changing the return type, and add static inline wrappers  
for those callers that need the previous behavior.  
  
Although this commit adapts hashutils.h and hashfn.c so that they  
can be compiled as frontend code, it does not actually do  
anything that would cause them to be so compiled. That is left  
for another commit.  
  
Patch by me, reviewed by Suraj Kharage and Mark Dilger.  
  
Discussion: http://postgr.es/m/CA+TgmoaRiG4TXND8QuM6JXFRkM_1wL2ZNhzaUKsuec9-4yrkgw@mail.gmail.com  

M src/backend/utils/hash/hashfn.c
M src/include/utils/hashutils.h

Put all the prototypes for hashfn.c into the same header file.

commit   : 9341c783cc42ffae5860c86bdc713bd47d734ffd    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Feb 2020 17:22:45 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Feb 2020 17:22:45 +0530    

Click here for diff

Previously, some of the prototypes for functions in hashfn.c were  
in utils/hashutils.h and others were in utils/hsearch.h, but that  
is confusing and has no particular benefit.  
  
Patch by me, reviewed by Suraj Kharage and Mark Dilger.  
  
Discussion: http://postgr.es/m/CA+TgmoaRiG4TXND8QuM6JXFRkM_1wL2ZNhzaUKsuec9-4yrkgw@mail.gmail.com  

M src/backend/lib/dshash.c
M src/backend/utils/hash/dynahash.c
M src/include/utils/hashutils.h
M src/include/utils/hsearch.h

Move bitmap_hash and bitmap_match to bitmapset.c.

commit   : 07b95c3d8334f737d4717c91967729f7721e785c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Feb 2020 17:17:08 +0530    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Feb 2020 17:17:08 +0530    

Click here for diff

The closely-related function bms_hash_value is already defined in that  
file, and this change means that hashfn.c no longer needs to depend on  
nodes/bitmapset.h. That gets us closer to allowing use of the hash  
functions in hashfn.c in frontend code.  
  
Patch by me, reviewed by Suraj Kharage and Mark Dilger.  
  
Discussion: http://postgr.es/m/CA+TgmoaRiG4TXND8QuM6JXFRkM_1wL2ZNhzaUKsuec9-4yrkgw@mail.gmail.com  

M src/backend/nodes/bitmapset.c
M src/backend/utils/hash/hashfn.c
M src/include/nodes/bitmapset.h
M src/include/utils/hsearch.h

Add prefix checks in exclude lists for pg_rewind, pg_checksums and base backups

commit   : bf883b211eae18662f2dfaede02f5d115bf0b805    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 24 Feb 2020 18:13:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 24 Feb 2020 18:13:25 +0900    

Click here for diff

An instance of PostgreSQL crashing with a bad timing could leave behind  
temporary pg_internal.init files, potentially causing failures when  
verifying checksums.  As the same exclusion lists are used between  
pg_rewind, pg_checksums and basebackup.c, all those tools are extended  
with prefix checks to keep everything in sync, with dedicated checks  
added for pg_internal.init.  
  
Backpatch down to 11, where pg_checksums (pg_verify_checksums in 11) and  
checksum verification for base backups have been introduced.  
  
Reported-by: Michael Banck  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, David Steele  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_rewind/filemap.c

Factor out InitControlFile() from BootStrapXLOG()

commit   : 79c2385915dd4aa43127e766c3dce323ec562ba0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 17:58:02 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 17:58:02 +0100    

Click here for diff

Right now this only makes BootStrapXLOG() a bit more manageable, but  
in the future there may be external callers.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Reformat code comment

commit   : 9745f93afc56829f9cf10ca3e43a29f0b4409fe3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 17:46:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 17:46:37 +0100    

Click here for diff

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

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

pg_resetwal: Rename function to avoid potential conflict

commit   : 5f1b8260af961ddf05968c9c3e7f178a3ad5d2ea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 17:35:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 17:35:48 +0100    

Click here for diff

ReadControlFile() here conflicts with a function of the same name in  
xlog.c.  There is no actual conflict right now, but since  
pg_resetwal.c reaches deep inside backend headers, it's possible in  
the future.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/pg_resetwal/pg_resetwal.c

Adjust Solution.pm to set HAVE_STDINT_H.

commit   : ec4a7851d5914bbdc5b65175e2489ec19020217e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 16:14:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 16:14:09 -0500    

Click here for diff

We're not testing that anywhere anymore, but for consistency,  
it should get defined.  

M src/tools/msvc/Solution.pm

Fix perlcritic warnings

commit   : b24e125696a94b6ebdd2262c0c41bf45cbeba23f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Feb 2020 22:03:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Feb 2020 22:03:05 +0100    

Click here for diff

M src/tools/msvc/Mkvcbuild.pm

Allow running src/tools/msvc/mkvcbuild.pl under not Windows

commit   : 73c8596488fd5fd619991f56dae5d22f551b06d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Feb 2020 20:50:56 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Feb 2020 20:50:56 +0100    

Click here for diff

This to allow verifying the MSVC build file generation without having  
to have Windows.  
  
To do this, we avoid Windows-specific Perl modules and don't run the  
"cl" compiler or "nmake".  The resulting build files won't actually be  
completely correct, but it's useful enough.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d73b2c7b-f081-8357-8422-7564d55f1aac%402ndquadrant.com  

M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm

Assume that we have signed integral types and flexible array members.

commit   : f4d59369d2ddf0ad7850112752ec42fd115825d4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 14:30:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 14:30:21 -0500    

Click here for diff

These compiler features are required by C99, so remove the configure  
probes for them.  
  
This is part of a series of commits to get rid of no-longer-relevant  
configure checks and dead src/port/ code.  I'm committing them separately  
to make it easier to back out individual changes if they prove less  
portable than I expect.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.in
M src/include/c.h
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Assume that we have <wchar.h>.

commit   : 97cf1fa4ed57cc1ed556ac4f827e7df8538f2d29    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 14:11:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 14:11:39 -0500    

Click here for diff

Windows has this, and so do all other live platforms according to the  
buildfarm; it's been required by POSIX since SUSv2.  So remove the  
configure probe and tests of HAVE_WCHAR_H.  
  
This is part of a series of commits to get rid of no-longer-relevant  
configure checks and dead src/port/ code.  I'm committing them separately  
to make it easier to back out individual changes if they prove less  
portable than I expect.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/utils/adt/formatting.c
M src/include/pg_config.h.in
M src/include/regex/regcustom.h
M src/include/tsearch/ts_locale.h
M src/tools/msvc/Solution.pm

Assume that we have utime() and <utime.h>.

commit   : 481c8e9232386e289fbd3e8f75893ae8d9814298    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 14:04:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 14:04:19 -0500    

Click here for diff

These are required by POSIX since SUSv2, and no live platforms fail  
to provide them.  On Windows, utime() exists and we bring our own  
<utime.h>, so we're good there too.  So remove the configure probes  
and ad-hoc substitute code.  We don't need to check for utimes()  
anymore either, since that was only used as a substitute.  
  
In passing, make the Windows build include <sys/utime.h> only where  
we need it, not everywhere.  
  
This is part of a series of commits to get rid of no-longer-relevant  
configure checks and dead src/port/ code.  I'm committing them separately  
to make it easier to back out individual changes if they prove less  
portable than I expect.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/libpq/pqcomm.c
M src/backend/utils/init/miscinit.c
M src/include/pg_config.h.in
M src/include/port/win32_msvc/utime.h
M src/include/port/win32_port.h
M src/tools/msvc/Solution.pm

Assume that we have rint().

commit   : f88a058200a40032e88a8bfc1aea453c22d2dcb0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 13:47:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 13:47:40 -0500    

Click here for diff

Windows has this since _MSC_VER >= 1200, and so do all other live  
platforms according to the buildfarm, so remove the configure probe  
and src/port/ substitution.  
  
This is part of a series of commits to get rid of no-longer-relevant  
configure checks and dead src/port/ code.  I'm committing them separately  
to make it easier to back out individual changes if they prove less  
portable than I expect.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/port.h
D src/port/rint.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm

Assume that we have memmove().

commit   : 1200d71a09177b7e64167df440d0c9bd16111ebe    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 13:42:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 13:42:28 -0500    

Click here for diff

Windows has this, and so do all other live platforms according to the  
buildfarm, so remove the configure probe and c.h's substitute code.  
  
This is part of a series of commits to get rid of no-longer-relevant  
configure checks and dead src/port/ code.  I'm committing them separately  
to make it easier to back out individual changes if they prove less  
portable than I expect.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Assume that we have cbrt().

commit   : abe41f453a5c42129e21825d75450aced0053eb8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 13:24:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 13:24:21 -0500    

Click here for diff

Windows has this, and so do all other live platforms according to the  
buildfarm, so remove the configure probe and float.c's substitute code.  
  
This is part of a series of commits to get rid of no-longer-relevant  
configure checks and dead src/port/ code.  I'm committing them separately  
to make it easier to back out individual changes if they prove less  
portable than I expect.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/utils/adt/float.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Assume that we have isinf().

commit   : 7fde892bc191e4df9fcd52ce11d1502673498d97    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 13:18:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 13:18:27 -0500    

Click here for diff

Windows has this, and so do all other live platforms according to the  
buildfarm, so remove the configure probe and src/port/ substitution.  
  
This also lets us get rid of some configure probes that existed only  
to support src/port/isinf.c.  I kept the port.h hack to force using  
__builtin_isinf() on clang, though.  
  
This is part of a series of commits to get rid of no-longer-relevant  
configure checks and dead src/port/ code.  I'm committing them separately  
to make it easier to back out individual changes if they prove less  
portable than I expect.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/port.h
D src/port/isinf.c
M src/tools/msvc/Solution.pm

Assume that we have functional, 64-bit fseeko()/ftello().

commit   : 799d22461a932aace890d61a82186e0d64de0ee8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 12:49:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Feb 2020 12:49:42 -0500    

Click here for diff

Windows has this, and so do all other live platforms according to the  
buildfarm, so remove the configure probe and src/port/ substitution.  
  
Keep the probe that detects whether _LARGEFILE_SOURCE has to be  
defined to get that, though ... that seems to be still relevant in  
some places.  
  
This is part of a series of commits to get rid of no-longer-relevant  
configure checks and dead src/port/ code.  I'm committing them separately  
to make it easier to back out individual changes if they prove less  
portable than I expect.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/bin/pg_dump/pg_backup_archiver.c
M src/include/port.h
M src/include/port/win32_port.h
D src/port/fseeko.c
M src/tools/msvc/Mkvcbuild.pm

Fix compiler warnings on 64-bit Windows

commit   : 3f9c1697dca0b4964f1f5ba624d361d4e0e53051    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Feb 2020 19:49:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Feb 2020 19:49:44 +0100    

Click here for diff

GCC reports various instances of  
  
warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]  
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]  
  
and MSVC equivalently  
  
warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size  
warning C4311: 'type cast': pointer truncation from 'void *' to 'long'  
  
in ECPG test files.  This is because void* and long are cast back and  
forth, but on 64-bit Windows, these have different sizes.  Fix by  
using intptr_t instead.  
  
The code actually worked fine because the integer values in use are  
all small.  So this is just to get the test code to compile warning-free.  
  
This change is simplified by having made stdint.h required (commit  
957338418b69e9774ccc1bab59f765a62f0aa6f9).  Before this it would have  
been more complicated because the ecpg test source files don't use the  
full pg_config.h.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5d398bbb-262a-5fed-d839-d0e5cff3c0d7%402ndquadrant.com  

M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/ecpg/test/expected/thread-thread.c
M src/interfaces/ecpg/test/expected/thread-thread_implicit.c
M src/interfaces/ecpg/test/thread/alloc.pgc
M src/interfaces/ecpg/test/thread/prep.pgc
M src/interfaces/ecpg/test/thread/thread.pgc
M src/interfaces/ecpg/test/thread/thread_implicit.pgc

Fixup for nodeAgg.c refactor.

commit   : b7fabe80df9a65010bfe5e5d0a979bacebfec382    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 20 Feb 2020 17:04:19 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 20 Feb 2020 17:04:19 -0800    

Click here for diff

Commit 5b618e1f made an unintended behavior change.  

M src/backend/executor/nodeAgg.c

Avoid redundant checks in partition_bounds_copy().

commit   : 032f9ae012d87c730be0e261a6bae9323c2b2d6c    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 21 Feb 2020 20:00:45 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 21 Feb 2020 20:00:45 +0900    

Click here for diff

Previously, partition_bounds_copy() checked whether the strategy for the  
given partition bounds was hash or not, and then determined the number of  
elements in the datums in the datums array for the partition bounds, on  
each iteration of the loop for copying the datums array, but there is no  
need to do that.  Perform the checks only once before the loop iteration.  
  
Author: Etsuro Fujita  
Reported-by: Amit Langote and Julien Rouhaud  
Discussion: https://postgr.es/m/CAPmGK14Rvxrm8DHWvCjdoks6nwZuHBPvMnWZ6rkEx2KhFeEoPQ@mail.gmail.com  

M src/backend/partitioning/partbounds.c

Require stdint.h

commit   : 957338418b69e9774ccc1bab59f765a62f0aa6f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Feb 2020 09:14:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Feb 2020 09:14:03 +0100    

Click here for diff

stdint.h belongs to the compiler (as opposed to inttypes.h), so by  
requiring a C99 compiler we can also require stdint.h  
unconditionally.  Remove configure checks and other workarounds for  
it.  
  
This also removes a few steps in the required portability adjustments  
to the imported time zone code, which can be applied on the next  
import.  
  
When using GCC on a platform that is otherwise pre-C99, this will now  
require at least GCC 4.5, which is the first release that supplied a  
standard-conforming stdint.h if the native platform didn't have it.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5d398bbb-262a-5fed-d839-d0e5cff3c0d7%402ndquadrant.com  

M configure
M configure.in
M src/include/c.h
M src/include/pg_config.h.in
M src/timezone/README
M src/tools/msvc/Solution.pm

Doc: Fix instructions to control build environment with MSVC

commit   : dca3911a81f0ba823b56c3d4462419c83f385e55    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Feb 2020 12:05:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Feb 2020 12:05:29 +0900    

Click here for diff

The documentation included some outdated instructions to change the  
architecture, build type or target OS of a build done with MSVC.  This  
commit updates the documentation to include the modern options  
available, down to Visual Studio 2013.  
  
Reported-by: Kyotaro Horiguchi  
Author: Juan José Santamaría Flecha  
Discussion: https://postgr.es/m/CAC+AXB0J7tAqW_2F1fCE4Dh2=Ccz96TcLpsGXOCvka7VvWG9Qw@mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/install-windows.sgml

Simplify FK-to-partitioned regression test query

commit   : b2304a71748a3e664a1b8354d746f28c38aaa816    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 20 Feb 2020 14:14:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 20 Feb 2020 14:14:20 -0300    

Click here for diff

Avoid a join between relations having the FK to detect FK violation.  
The planner might optimize this considering the PK must exist on the  
referenced side at some point, effectively masking a bug this test  
tries to detect.  
  
Tom Lane and Jehan-Guillaume de Rorthais  
Discussion: https://postgr.es/m/[email protected]  

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

Remove extra word from comment.

commit   : 53b01acd463d64c385db0ab728b8cc336549a315    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 20 Feb 2020 19:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 20 Feb 2020 19:15:00 +0900    

Click here for diff

M src/backend/partitioning/partbounds.c

commit   : d55e9ae2633ee462d554dddc08d640d725dd6494    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 20 Feb 2020 11:57:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 20 Feb 2020 11:57:41 +0900    

Click here for diff

e2e0219 has removed a code path for Windows 2000 that attempts to load  
wship6.dll as fallback if ws2_32.dll is found but not getaddrinfo(),  
leaving behind a dangling pointer as the library is freed.  However,  
there is no point in this check as ws2_32.dll exists since Windows XP,  
so just remove the duplicated check.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/port/getaddrinfo.c

Doc: discourage use of partial indexes for poor-man's-partitioning.

commit   : 6a8e5605b53561464c53006337596699f41b1de2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Feb 2020 18:52:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Feb 2020 18:52:18 -0500    

Click here for diff

Creating a bunch of non-overlapping partial indexes is generally  
a bad idea, so add an example saying not to do that.  
  
Back-patch to v10.  Before that, the alternative of using (real)  
partitioning wasn't available, so that the tradeoff isn't quite  
so clear cut.  
  
Discussion: https://postgr.es/m/CAKVFrvFY-f7kgwMRMiPLbPYMmgjc8Y2jjUGK_Y0HVcYAmU6ymg@mail.gmail.com  

M doc/src/sgml/indices.sgml

Remove support for upgrading extensions from "unpackaged" state.

commit   : 70a7732007bc4689f4c7a44e738eb2d892dac1e3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Feb 2020 16:59:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Feb 2020 16:59:14 -0500    

Click here for diff

Andres Freund pointed out that allowing non-superusers to run  
"CREATE EXTENSION ... FROM unpackaged" has security risks, since  
the unpackaged-to-1.0 scripts don't try to verify that the existing  
objects they're modifying are what they expect.  Just attaching such  
objects to an extension doesn't seem too dangerous, but some of them  
do more than that.  
  
We could have resolved this, perhaps, by still requiring superuser  
privilege to use the FROM option.  However, it's fair to ask just what  
we're accomplishing by continuing to lug the unpackaged-to-1.0 scripts  
forward.  None of them have received any real testing since 9.1 days,  
so they may not even work anymore (even assuming that one could still  
load the previous "loose" object definitions into a v13 database).  
And an installation that's trying to go from pre-9.1 to v13 or later  
in one jump is going to have worse compatibility problems than whether  
there's a trivial way to convert their contrib modules into extension  
style.  
  
Hence, let's just drop both those scripts and the core-code support  
for "CREATE EXTENSION ... FROM".  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/Makefile
D contrib/btree_gin/btree_gin–unpackaged–1.0.sql
M contrib/btree_gist/Makefile
D contrib/btree_gist/btree_gist–unpackaged–1.0.sql
M contrib/citext/Makefile
D contrib/citext/citext–unpackaged–1.0.sql
M contrib/cube/Makefile
D contrib/cube/cube–unpackaged–1.0.sql
M contrib/dblink/Makefile
D contrib/dblink/dblink–unpackaged–1.0.sql
M contrib/dict_int/Makefile
D contrib/dict_int/dict_int–unpackaged–1.0.sql
M contrib/dict_xsyn/Makefile
D contrib/dict_xsyn/dict_xsyn–unpackaged–1.0.sql
M contrib/earthdistance/Makefile
D contrib/earthdistance/earthdistance–unpackaged–1.0.sql
M contrib/fuzzystrmatch/Makefile
D contrib/fuzzystrmatch/fuzzystrmatch–unpackaged–1.0.sql
M contrib/hstore/Makefile
D contrib/hstore/hstore–unpackaged–1.0.sql
M contrib/intagg/Makefile
D contrib/intagg/intagg–unpackaged–1.0.sql
M contrib/intarray/Makefile
D contrib/intarray/intarray–unpackaged–1.0.sql
M contrib/isn/Makefile
D contrib/isn/isn–unpackaged–1.0.sql
M contrib/lo/Makefile
D contrib/lo/lo–unpackaged–1.0.sql
M contrib/ltree/Makefile
D contrib/ltree/ltree–unpackaged–1.0.sql
M contrib/pageinspect/Makefile
D contrib/pageinspect/pageinspect–unpackaged–1.0.sql
M contrib/pg_buffercache/Makefile
D contrib/pg_buffercache/pg_buffercache–unpackaged–1.0.sql
M contrib/pg_freespacemap/Makefile
D contrib/pg_freespacemap/pg_freespacemap–unpackaged–1.0.sql
M contrib/pg_stat_statements/Makefile
D contrib/pg_stat_statements/pg_stat_statements–unpackaged–1.0.sql
M contrib/pg_trgm/Makefile
M contrib/pg_trgm/pg_trgm–1.3.sql
D contrib/pg_trgm/pg_trgm–unpackaged–1.0.sql
M contrib/pgcrypto/Makefile
D contrib/pgcrypto/pgcrypto–unpackaged–1.0.sql
M contrib/pgrowlocks/Makefile
D contrib/pgrowlocks/pgrowlocks–unpackaged–1.0.sql
M contrib/pgstattuple/Makefile
D contrib/pgstattuple/pgstattuple–unpackaged–1.0.sql
M contrib/seg/Makefile
D contrib/seg/seg–unpackaged–1.0.sql
M contrib/spi/Makefile
D contrib/spi/autoinc–unpackaged–1.0.sql
D contrib/spi/insert_username–unpackaged–1.0.sql
D contrib/spi/moddatetime–unpackaged–1.0.sql
D contrib/spi/refint–unpackaged–1.0.sql
M contrib/sslinfo/Makefile
D contrib/sslinfo/sslinfo–unpackaged–1.0.sql
M contrib/tablefunc/Makefile
D contrib/tablefunc/tablefunc–unpackaged–1.0.sql
M contrib/unaccent/Makefile
D contrib/unaccent/unaccent–unpackaged–1.0.sql
M contrib/uuid-ossp/Makefile
D contrib/uuid-ossp/uuid-ossp–unpackaged–1.0.sql
M contrib/xml2/Makefile
D contrib/xml2/xml2–unpackaged–1.0.sql
M contrib/xml2/xml2.control
M doc/src/sgml/contrib.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/ref/create_extension.sgml
M src/backend/commands/extension.c
M src/backend/parser/gram.y
M src/pl/plperl/GNUmakefile
D src/pl/plperl/plperl–unpackaged–1.0.sql
D src/pl/plperl/plperlu–unpackaged–1.0.sql
M src/pl/plpgsql/src/Makefile
D src/pl/plpgsql/src/plpgsql–unpackaged–1.0.sql
M src/pl/plpython/Makefile
D src/pl/plpython/plpython2u–unpackaged–1.0.sql
D src/pl/plpython/plpython3u–unpackaged–1.0.sql
D src/pl/plpython/plpythonu–unpackaged–1.0.sql
M src/pl/tcl/Makefile
D src/pl/tcl/pltcl–unpackaged–1.0.sql
D src/pl/tcl/pltclu–unpackaged–1.0.sql
M src/test/modules/test_parser/Makefile
D src/test/modules/test_parser/test_parser–unpackaged–1.0.sql

Fix typo

commit   : 2f9c46a32b43d72c9384378827ee51fde896807c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Feb 2020 20:52:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Feb 2020 20:52:42 +0100    

Click here for diff

Reported-by: Daniel Verite <[email protected]>  

M src/common/unicode_norm.c

Fix confusion about event trigger vs. plain function in plpgsql.

commit   : 761a5688b179d46091e7314458571c5fc537084a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Feb 2020 14:44:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Feb 2020 14:44:58 -0500    

Click here for diff

The function hash table keys made by compute_function_hashkey() failed  
to distinguish event-trigger call context from regular call context.  
This meant that once we'd successfully made a hash entry for an event  
trigger (either by validation, or by normal use as an event trigger),  
an attempt to call the trigger function as a plain function would  
find this hash entry and thereby bypass the you-can't-do-that check in  
do_compile().  Thus we'd attempt to execute the function, leading to  
strange errors or even crashes, depending on function contents and  
server version.  
  
To fix, add an isEventTrigger field to PLpgSQL_func_hashkey,  
paralleling the longstanding infrastructure for regular triggers.  
This fits into what had been pad space, so there's no risk of an ABI  
break, even assuming that any third-party code is looking at these  
hash keys.  (I considered replacing isTrigger with a PLpgSQL_trigtype  
enum field, but felt that that carried some API/ABI risk.  Maybe we  
should change it in HEAD though.)  
  
Per bug #16266 from Alexander Lakhin.  This has been broken since  
event triggers were invented, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Set gen_random_uuid() to volatile

commit   : 2ed19a488edb3980e054e6064e7028ccb652e5df    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Feb 2020 20:09:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Feb 2020 20:09:32 +0100    

Click here for diff

It was set to immutable.  This was a mistake in the initial  
commit (5925e5549890416bcf588334d9d0bc99f8ad6c7f).  
  
Reported-by: hubert depesz lubaczewski <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20200218185452.GA8710%40depesz.com  

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

Minor refactor of nodeAgg.c.

commit   : 5b618e1f48aecc66e3a9f60289491da520faae19    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 19 Feb 2020 10:15:16 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 19 Feb 2020 10:15:16 -0800    

Click here for diff

  * Separate calculation of hash value from the lookup.  
  * Split build_hash_table() into two functions.  
  * Change lookup_hash_entry() to return AggStatePerGroup. That's all  
    the caller needed, anyway.  
  
These changes are to support the upcoming Disk-based Hash Aggregation  
work.  
  
Discussion: https://postgr.es/m/31f5ab871a3ad5a1a91a7a797651f20e77ac7ce3.camel%40j-davis.com  

M src/backend/executor/nodeAgg.c

logtape.c: allocate read buffer even for an empty tape.

commit   : 8021985d791902a9eeda51acdede759fbc67ae01    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 18 Feb 2020 12:31:24 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 18 Feb 2020 12:31:24 -0800    

Click here for diff

Prior to this commit, the read buffer was allocated at the time the tape  
was rewound; but as an optimization, would not be allocated at all if  
the tape was empty.  
  
That optimization meant that it was valid to have a rewound tape with  
the buffer set to NULL, but only if a number of conditions were met  
and only if the API was used properly. After 7fdd919a refactored the  
code to support lazily-allocating the buffer, Coverity started  
complaining.  
  
The optimization for empty tapes doesn't seem important, so just  
allocate the buffer whether the tape has any data or not.  
  
Discussion: https://postgr.es/m/20351.1581868306%40sss.pgh.pa.us  

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

Fix mesurement of elapsed time during truncating heap in VACUUM.

commit   : 007491979461ff10d487e1da9bcc87f2fd834f26    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 19 Feb 2020 20:37:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 19 Feb 2020 20:37:26 +0900    

Click here for diff

VACUUM may truncate heap in several batches. The activity report  
is logged for each batch, and contains the number of pages in the table  
before and after the truncation, and also the elapsed time during  
the truncation. Previously the elapsed time reported in each batch was  
the total elapsed time since starting the truncation until finishing  
each batch. For example, if the truncation was processed dividing into  
three batches, the second batch reported the accumulated time elapsed  
during both first and second batches. This is strange and confusing  
because the number of pages in the table reported together is not  
total. Instead, each batch should report the time elapsed during  
only that batch.  
  
The cause of this issue was that the resource usage snapshot was  
initialized only at the beginning of the truncation and was never  
reset later. This commit fixes the issue by changing VACUUM so that  
the resource usage snapshot is reset at each batch.  
  
Back-patch to all supported branches.  
  
Reported-by: Tatsuhito Kasahara  
Author: Tatsuhito Kasahara  
Reviewed-by: Masahiko Sawada, Fujii Masao  
Discussion: https://postgr.es/m/CAP0=ZVJsf=NvQuy+QXQZ7B=ZVLoDV_JzsVC1FRsF1G18i3zMGg@mail.gmail.com  

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

Clean up some code, comments and docs referring to Windows 2000 and older

commit   : e2e02191e23379502a38a6b0436ab7f41b2efc08    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Feb 2020 13:20:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Feb 2020 13:20:33 +0900    

Click here for diff

This fixes and updates a couple of comments related to outdated Windows  
versions.  Particularly, src/common/exec.c had a fallback implementation  
to read a file's line from a pipe because stdin/stdout/stderr does not  
exist in Windows 2000 that is removed to simplify src/common/ as there  
are unlikely versions of Postgres running on such platforms.  
  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, Juan José Santamaría Flecha  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/backend/libpq/auth.c
M src/bin/initdb/initdb.c
M src/common/exec.c
M src/port/getaddrinfo.c

Stop demanding that top xact must be seen before subxact in decoding.

commit   : e3ff789acfb2754cd7b5e87f6f4463fd08e35996    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 12 Feb 2020 11:23:24 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 12 Feb 2020 11:23:24 +0530    

Click here for diff

Manifested as  
  
ERROR:  subtransaction logged without previous top-level txn record  
  
this check forbids legit behaviours like  
 - First xl_xact_assignment record is beyond reading, i.e. earlier  
   restart_lsn.  
 - After restart_lsn there is some change of a subxact.  
 - After that, there is second xl_xact_assignment (for another subxact)  
   revealing the relationship between top and first subxact.  
  
Such a transaction won't be streamed anyway because we hadn't seen it in  
full.  Saying for sure whether xact of some record encountered after  
the snapshot was deserialized can be streamed or not requires to know  
whether it wrote something before deserialization point --if yes, it  
hasn't been seen in full and can't be decoded. Snapshot doesn't have such  
info, so there is no easy way to relax the check.  
  
Reported-by: Hsu, John  
Diagnosed-by: Arseny Sher  
Author: Arseny Sher, Amit Kapila  
Reviewed-by: Amit Kapila, Dilip Kumar  
Backpatch-through: 9.5  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/subxact_without_top.out
A contrib/test_decoding/specs/subxact_without_top.spec
M src/backend/replication/logical/reorderbuffer.c

Remove obsolete _bt_compare() comment.

commit   : fe9b92854e7d5f66d3abb565c5b60a879b6c9442    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 18 Feb 2020 16:07:16 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 18 Feb 2020 16:07:16 -0800    

Click here for diff

btbuild() has nothing to say about how NULL values compare in nbtree.  
Besides, there are _bt_compare() header comments that describe how NULL  
values are handled.  

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

Make inherited LOCK TABLE perform access permission checks on parent table only.

commit   : b7e51b350c4e6b1cb3404588cf11801525e2336f    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 18 Feb 2020 13:13:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 18 Feb 2020 13:13:15 +0900    

Click here for diff

Previously, LOCK TABLE command through a parent table checked  
the permissions on not only the parent table but also the children  
tables inherited from it. This was a bug and inherited queries should  
perform access permission checks on the parent table only. This  
commit fixes LOCK TABLE so that it does not check the permission  
on children tables.  
  
This patch is applied only in the master branch. We decided not to  
back-patch because it's not hard to imagine that there are some  
applications expecting the old behavior and the change breaks their  
security.  
  
Author: Amit Langote  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CAHGQGwE+GauyG7POtRfRwwthAGwTjPQYdFHR97+LzA4RHGnJxA@mail.gmail.com  

M src/backend/commands/lockcmds.c
M src/test/regress/expected/lock.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/lock.sql
M src/test/regress/sql/privileges.sql

Remove duplicated words in comments

commit   : 958f9fb98da97a1d781a3766ea86bcdba3b216c5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Feb 2020 12:20:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Feb 2020 12:20:55 +0900    

Click here for diff

Author: Daniel Gustafsson  
Reviewed-by: Vik Fearing  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAgg.c
M src/backend/utils/adt/jsonpath_exec.c
M src/bin/pg_upgrade/version.c

Fix grammar in monitoring.sgml

commit   : ddfc3c1499b05956094a7f219fe2b6ac0c9ce5eb    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Feb 2020 10:49:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Feb 2020 10:49:44 +0900    

Click here for diff

This is related to progress reporting for ANALYZE and partitioned  
tables.  
  
Author: Amit Langote  
Reviewed-by: Daniel Gustafsson, Julien Rouhaud  
Discussion: https://postgr.es/m/CA+HiwqGx6C=-bFTX=ryMThyvM7CcSC3b1x8_6zh4Uo41Kvu-zw@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Teach pg_dump to dump comments on RLS policy objects.

commit   : f31364676dfd9e7a2b712ea0da7b4ab6b7d28f5e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Feb 2020 18:40:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Feb 2020 18:40:02 -0500    

Click here for diff

This was unaccountably omitted in the original RLS patch.  
The SQL syntax is basically the same as for comments on triggers,  
so crib code from dumpTrigger().  
  
Per report from Marc Munro.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Optimize update of tables with generated columns

commit   : c6679e4fca21d253ced84c51ac1a31c1b2aec72f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 15:19:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 15:19:58 +0100    

Click here for diff

When updating a table row with generated columns, only recompute those  
generated columns whose base columns have changed in this update and  
keep the rest unchanged.  This can result in a significant performance  
benefit.  The required information was already kept in  
RangeTblEntry.extraUpdatedCols; we just have to make use of it.  
  
Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/copy.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/nodeModifyTable.h
M src/include/nodes/execnodes.h

Fill in extraUpdatedCols in logical replication

commit   : ad3ae64770e5b4391ad07fb2a689d72aa45b4689    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 15:19:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Feb 2020 15:19:58 +0100    

Click here for diff

The extraUpdatedCols field of the target RTE records which generated  
columns are affected by an update.  This is used in a variety of  
places, including per-column triggers and foreign data wrappers.  When  
an update was initiated by a logical replication subscription, this  
field was not filled in, so such an update would not affect generated  
columns in a way that is consistent with normal updates.  To fix,  
factor out some code from analyze.c to fill in extraUpdatedCols in the  
logical replication worker as well.  
  
Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/analyze.c
M src/backend/replication/logical/worker.c
M src/include/parser/analyze.h

Add description about GSSOpenServer wait event into document.

commit   : f4ae7221413d5176e4d5a49883217ea87312104a    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 17 Feb 2020 16:16:08 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 17 Feb 2020 16:16:08 +0900    

Click here for diff

This commit also updates wait event enum into alphabetical order.  
Previously the enum entry for GSSOpenServer was added out-of-order.  
  
Back-patch to v12 where commit b0b39f72b9 introduced  
GSSOpenServer wait event. In v12, the commit doesn't include  
the update of wait event enum, not to break ABI.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Add description about LogicalRewriteTruncate wait event into document.

commit   : e593148d43adb8ef1721ccd987046c02f4532920    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 17 Feb 2020 15:33:32 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 17 Feb 2020 15:33:32 +0900    

Click here for diff

Back-patch to v10 where commit 249cf070e3 introduced  
LogicalRewriteTruncate wait event.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Try again to work around Windows' ERROR_SHARING_VIOLATION in pg_ctl.

commit   : e02ea141ee66e5b2372e1eb2d2000b7ed3a8e13a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Feb 2020 12:20:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Feb 2020 12:20:18 -0500    

Click here for diff

Commit 0da33c762 introduced an unfortunate regression in pg_ctl on  
Windows: if the log file specified with -l doesn't exist yet, and  
pg_ctl is running with Administrator privileges, then the log file  
might get created with permissions that prevent the postmaster from  
writing on it.  (It seems that whether this happens depends on whether  
the log file is inside the user's home directory or not, and perhaps  
on other phase-of-the-moon conditions, which may explain why we failed  
to notice it sooner.)  
  
To fix, just don't create the log file if it doesn't exist yet.  The  
case where we need to wait obviously only occurs with a pre-existing  
log file.  
  
In passing, switch from using fopen() to plain open(), saving a few  
cycles.  
  
Per bug #16259 from Jonathan Katz and Heath Lord.  Back-patch to v12,  
as the faulty commit was.  
  
Alexander Lakhin  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

Update obsolete comment.

commit   : faade5d4c6d8b4f7d46f91702a57529c96aee86e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Feb 2020 15:22:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Feb 2020 15:22:40 -0500    

Click here for diff

Noted by Justin Pryzby, though I chose to just rip out the stale text,  
as it's in no way relevant to this particular function.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/cluster.c

Clarify coding in Catalog::AddDefaultValues.

commit   : 9d1ec5a8e155a996a81b5fecc3da803ecb94d8ae    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Feb 2020 15:13:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Feb 2020 15:13:44 -0500    

Click here for diff

Make it a bit shorter and better-commented; no functional change.  
  
Alvaro Herrera and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm

Run "make reformat-dat-files".

commit   : b78542b9e975494bba6db2d2802439c3328d5ef7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Feb 2020 14:58:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Feb 2020 14:58:30 -0500    

Click here for diff

Mostly to make sure the previous commit didn't break this.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat

Don't require pg_class.dat to contain correct relnatts values.

commit   : 86ff085e83888e2e359620fc326608a674423308    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Feb 2020 14:57:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Feb 2020 14:57:27 -0500    

Click here for diff

Practically everybody who's ever added a column to one of the bootstrap  
catalogs has been burnt by the need to update the relnatts field in the  
initial pg_class data to match.  Now that we use Perl scripts to  
generate postgres.bki, we can have the machines take care of that,  
by filling the field during genbki.pl.  
  
While at it, use the BKI_DEFAULTS mechanism to eliminate repetitive  
specifications of other column values in pg_class.dat, too.  They  
weren't particularly a maintenance problem, but this way is prettier  
(certainly the spotty previous usage of BKI_DEFAULTS wasn't pretty).  
  
No catversion bump needed, since this doesn't actually change the  
contents of postgres.bki.  
  
Per gripe from Justin Pryzby, though this is quite different from  
his originally proposed solution.  
  
Amit Langote, John Naylor, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/genbki.pl
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h

Recreate website's formatting for "website" doc builds.

commit   : 317906f2a634090a79ca95d5816931c4ce8dca5a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 14 Feb 2020 18:38:35 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 14 Feb 2020 18:38:35 -0800    

Click here for diff

The stylesheets used for the HTML documentation rendered on  
postgresql.org have shifted, and no longer matched what was expected by  
"make STYLE=website html" builds performed locally.  Local doc builds  
did not reflect other aspects of the website, including font and  
margins.  
  
This patch updates the references to use the current set of stylesheets  
that are used by the documentation on postgresql.org. This also wraps  
the documentation preview in a HTML container so it can keep the content  
within similar margins to those found on the website.  
  
The documentation on building the docs is updated to reflect this  
change, and to let the documentation builder know that an external  
network connection is required to properly preview documentation built  
with "make STYLE=website html" (which was true prior to this patch too,  
but not mentioned).  
  
Author: Jonathan Katz  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Remove pg_regress' --load-language option.

commit   : 751c63cea0befe292fafd9a4a1f16dfa2f1746f9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Feb 2020 11:20:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Feb 2020 11:20:07 -0500    

Click here for diff

We haven't used this option since inventing extensions.  As of commit  
50fc694e4 it's actually formally equivalent to --load-extension, so  
let's just drop it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Remove some dead code in contrib/adminpack/

commit   : 11f063b0a974f4e1c87c26d0fe259c2167f3d00e    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Feb 2020 12:38:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Feb 2020 12:38:44 +0900    

Click here for diff

Since its introduction in fe59e56, the code in charge of validating and  
converting a file path includes some extra handling for absolute paths  
pointing to an external log_directory, but this has never been used.  
  
Author: Antonin Houska  
Reviewed-by: Julien Rouhaud, Michael Paquier  
Discussion: https://postgr.es/m/32663.1581592539@antos  

M contrib/adminpack/adminpack.c

Mark some contrib modules as "trusted".

commit   : eb67623c965b4759a96309cdb58a17339fc5d401    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Feb 2020 15:02:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Feb 2020 15:02:35 -0500    

Click here for diff

This allows these modules to be installed into a database without  
superuser privileges (assuming that the DBA or sysadmin has installed  
the module's files in the expected place).  You only need CREATE  
privilege on the current database, which by default would be  
available to the database owner.  
  
The following modules are marked trusted:  
  
btree_gin  
btree_gist  
citext  
cube  
dict_int  
earthdistance  
fuzzystrmatch  
hstore  
hstore_plperl  
intarray  
isn  
jsonb_plperl  
lo  
ltree  
pg_trgm  
pgcrypto  
seg  
tablefunc  
tcn  
tsm_system_rows  
tsm_system_time  
unaccent  
uuid-ossp  
  
In the future we might mark some more modules trusted, but there  
seems to be no debate about these, and on the whole it seems wise  
to be conservative with use of this feature to start out with.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/btree_gin.control
M contrib/btree_gist/btree_gist.control
M contrib/citext/citext.control
M contrib/cube/cube.control
M contrib/dict_int/dict_int.control
M contrib/earthdistance/earthdistance.control
M contrib/fuzzystrmatch/fuzzystrmatch.control
M contrib/hstore/hstore.control
M contrib/hstore_plperl/hstore_plperl.control
M contrib/intarray/intarray.control
M contrib/isn/isn.control
M contrib/jsonb_plperl/jsonb_plperl.control
M contrib/lo/lo.control
M contrib/ltree/ltree.control
M contrib/pg_trgm/pg_trgm.control
M contrib/pgcrypto/pgcrypto.control
M contrib/seg/seg.control
M contrib/tablefunc/tablefunc.control
M contrib/tcn/tcn.control
M contrib/tsm_system_rows/tsm_system_rows.control
M contrib/tsm_system_time/tsm_system_time.control
M contrib/unaccent/unaccent.control
M contrib/uuid-ossp/uuid-ossp.control
M doc/src/sgml/btree-gin.sgml
M doc/src/sgml/btree-gist.sgml
M doc/src/sgml/citext.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/cube.sgml
M doc/src/sgml/dict-int.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/fuzzystrmatch.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/intarray.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/lo.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/pgtrgm.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/tablefunc.sgml
M doc/src/sgml/tcn.sgml
M doc/src/sgml/tsm-system-rows.sgml
M doc/src/sgml/tsm-system-time.sgml
M doc/src/sgml/unaccent.sgml
M doc/src/sgml/uuid-ossp.sgml

Logical Tape Set: lazily allocate read buffer.

commit   : 7fdd919ae7550f478e7ae4031f7f439278cf2282    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 13 Feb 2020 09:43:51 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 13 Feb 2020 09:43:51 -0800    

Click here for diff

The write buffer was already lazily-allocated, so this is more  
symmetric. It also means that a freshly-rewound tape (whether for  
reading or writing) is not consuming memory for the buffer.  
  
Discussion: https://postgr.es/m/97c46a59c27f3c38e486ca170fcbc618d97ab049.camel%40j-davis.com  

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

Avoid a performance regression in float overflow/underflow detection.

commit   : 607f8ce74df9d5a4a7a3c65235909794cdc1d1d8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Feb 2020 13:37:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Feb 2020 13:37:43 -0500    

Click here for diff

Commit 6bf0bc842 replaced float.c's CHECKFLOATVAL() macro with static  
inline subroutines, but that wasn't too well thought out.  In the original  
coding, the unlikely condition (isinf(result) or result == 0) was checked  
first, and the inf_is_valid or zero_is_valid condition only afterwards.  
The inline-subroutine coding caused that to be swapped around, which is  
pretty horrid for performance because (a) in common cases the is_valid  
condition is twice as expensive to evaluate (e.g., requiring two isinf()  
calls not one) and (b) in common cases the is_valid condition is false,  
requiring us to perform the unlikely-condition check anyway.  Net result  
is that one isinf() call becomes two or three, resulting in visible  
performance loss as reported by Keisuke Kuroda.  
  
The original fix proposal was to revert the replacement of the macro,  
but on second thought, that macro was just a bad idea from the beginning:  
if anything it's a net negative for readability of the code.  So instead,  
let's just open-code all the overflow/underflow tests, being careful to  
test the unlikely condition first (and mark it unlikely() to help the  
compiler get the point).  
  
Also, rather than having N copies of the actual ereport() calls, collapse  
those into out-of-line error subroutines to save some code space.  This  
does mean that the error file/line numbers won't be very helpful for  
figuring out where the issue really is --- but we'd already burned that  
bridge by putting the ereports into static inlines.  
  
In HEAD, check_float[48]_val() are gone altogether.  In v12, leave them  
present in float.h but unused in the core code, just in case some  
extension is depending on them.  
  
Emre Hasegeli, with some kibitzing from me and Andres Freund  
  
Discussion: https://postgr.es/m/CANDwggLe1Gc1OrRqvPfGE=kM9K0FSfia0hbeFCEmwabhLz95AA@mail.gmail.com  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/geo_ops.c
M src/include/utils/float.h

Doc: Restructure B-Tree support routine docs.

commit   : caba0910afa124b8c6c61208b487846eea6b1970    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 12 Feb 2020 14:08:34 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 12 Feb 2020 14:08:34 -0800    

Click here for diff

Use a top-level "variablelist", with one item per B-Tree support  
function.  This structure matches the structure used by various  
"Extensibility" sections in other documentation chapters for other index  
access methods.  
  
An explicit list makes it much clearer where each item begins and ends.  
This wasn't really a problem before now, but an upcoming patch that adds  
deduplication to nbtree will need to have its own new B-Tree support  
function.  Ease the burden of translators by tidying up btree.sgml ahead  
of committing the deduplication patch.  

M doc/src/sgml/btree.sgml

Remove long-dead comments.

commit   : 0973f5602c349ad99fae6f57cdcc26754a03ba83    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Feb 2020 14:33:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Feb 2020 14:33:49 -0500    

Click here for diff

These should've been dropped by a8bb8eb58, but evidently were  
missed.  Not important enough to back-patch.  

M src/backend/commands/user.c

Doc: fix old oversights in GRANT/REVOKE documentation.

commit   : dce988145f7e455f224310afec6b06bcf3eed24e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Feb 2020 14:13:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Feb 2020 14:13:13 -0500    

Click here for diff

The GRANTED BY clause in GRANT/REVOKE ROLE has been there since 2005  
but was never documented.  I'm not sure now whether that was just an  
oversight or was intentional (given the limited capability of the  
option).  But seeing that pg_dumpall does emit code that uses this  
option, it seems like not documenting it at all is a bad idea.  
  
Also, when we upgraded the syntax to allow CURRENT_USER/SESSION_USER  
as the privilege recipient, the role form of GRANT was incorrectly  
not modified to show that, and REVOKE's docs weren't touched at all.  
  
Although I'm not that excited about GRANTED BY, the other oversight  
seems serious enough to justify a back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml

Try to harden insert-conflict-specconflict against autovacuum.

commit   : 997563dfcb2501a7a199589cd6f15f2bb8af3d04    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 11 Feb 2020 21:14:08 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 11 Feb 2020 21:14:08 -0800    

Click here for diff

Looks like guaibasaurus had a autovacuum running during the  
controller_print_speculative_locks step (just added in  
43e08419708). Which does indeed seem quite possible.  
  
Avoid the problem by only looking for the backends participating in  
the test.  

M src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/specs/insert-conflict-specconflict.spec

Add %x to default PROMPT1 and PROMPT2 in psql

commit   : dcdbb5a5db09064ac08ff3971c5031281ef2e545    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Feb 2020 13:31:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Feb 2020 13:31:14 +0900    

Click here for diff

%d can be used to track if the current connection is in a transaction  
block or not, and adding it by default to the prompt has the advantage  
to not need a modification of .psqlrc, something not possible depending  
on the environment.  
  
This discussion has happened across various sources, and there was a  
strong consensus in favor of this change.  
  
Author: Vik Fearing  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/settings.h

Test additional speculative conflict scenarios.

commit   : 43e08419708a938236e76cd50de2db512e1c3a0c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 11 Feb 2020 16:32:11 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 11 Feb 2020 16:32:11 -0800    

Click here for diff

Previously, the speculative insert tests did not cover the case when a  
tuple t is inserted into a table with a unique index on a column but  
before it can insert into the index, a concurrent transaction has  
inserted a conflicting value into the index and the insertion of tuple t  
must be aborted.  
  
The basic permutation is one session successfully inserts into the table  
and an associated unique index while a concurrent session successfully  
inserts into the table but discovers a conflict before inserting into  
the index and must abort the insertion.  
  
Several variants on this include:  
- swap which session is successful  
- first session insert transaction does not commit, so second session  
must wait on a transaction lock  
- first session insert does not "complete", so second session must wait  
on a speculative insertion lock  
  
Also, refactor the existing TOAST table upsert test to be in the same  
spec and reuse the steps.  
  
Author: Melanie Plageman, Ashwin Agrawal, Andres Freund  
Reviewed-by: Andres Freund, Taylor Vesely  
Discussion: https://postgr.es/m/CAAKRu_ZRmxy_OEryfY3G8Zp01ouhgw59_-_Cm8n7LzRH5BAvng@mail.gmail.com  

M src/test/isolation/expected/insert-conflict-specconflict.out
D src/test/isolation/expected/insert-conflict-toast.out
M src/test/isolation/isolation_schedule
M src/test/isolation/specs/insert-conflict-specconflict.spec
D src/test/isolation/specs/insert-conflict-toast.spec

Fix bug in pg_basebackup -F plain -R.

commit   : be6221e9be234109aa261ea767c85f5e8cda90e8    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 12 Feb 2020 09:08:22 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 12 Feb 2020 09:08:22 +0900    

Click here for diff

Commit caba97a9d9 changed pg_basebackup -F plain -R so that  
it overwrote postgresql.auto.conf in the backup, with new connection  
setting. This could cause the existing postgresql.auto.conf settings  
in the server to get lost unexpectedly. This is a bug.  
  
This commit fixes the bug by making pg_basebackup -F plain -R  
append the connection setting into postgresql.auto.conf in the backup.  
  
Author: Fujii Masao  
Reviewed-by: Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M src/fe_utils/recovery_gen.c

Document the pg_upgrade -j/--jobs option as taking an argument

commit   : e49d5ebbaebc3ecd6b495fda9518c2c2fac5c296    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 11 Feb 2020 23:47:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 11 Feb 2020 23:47:36 +0100    

Click here for diff

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/option.c

Use pg_pwrite() in more places.

commit   : 701a51fd4e01dbbd02067d8f01905a04bc571131    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 11 Feb 2020 17:22:37 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 11 Feb 2020 17:22:37 +1300    

Click here for diff

This removes some lseek() system calls.  
  
Author: Thomas Munro  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CA%2BhUKGJ%2BoHhnvqjn3%3DHro7xu-YDR8FPr0FL6LF35kHRX%3D_bUzg%40mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/heap/rewriteheap.c
M src/backend/replication/walreceiver.c
M src/backend/utils/init/miscinit.c

Canonicalize some URLs

commit   : 2102ba4b586350957bf95b371432583239000164    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Feb 2020 20:47:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Feb 2020 20:47:50 +0100    

Click here for diff

M HISTORY
M README
M README.git
M src/bin/psql/copy.c

psql: Remove one use of HAVE_UNIX_SOCKETS

commit   : 541757f34ee099dd8e601b29dfad6302c6747d71    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Feb 2020 19:27:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Feb 2020 19:27:05 +0100    

Click here for diff

This use was not protecting any unportable code, it was just omitting  
the code because it wouldn't be used.  Remove the use to reduce code  
complexity a bit.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/psql/prompt.c

Simplify passing of configure arguments to pg_config

commit   : b691c189c671ca9b88743ed6546b60641e5199e4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Feb 2020 17:12:46 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Feb 2020 17:12:46 +0100    

Click here for diff

The previous system had configure put the value into the makefiles and  
then have the makefiles pass them to the build of pg_config.  That was  
put in place when pg_config was a shell script.  We can simplify that  
by having configure put the value into pg_config.h directly.  This  
also makes the standard build system match how the MSVC build system  
already does it.  
  
Discussion: https://www.postgresql.org/message-id/flat/6e457870-cef5-5f1d-b57c-fc89cfb8a788%402ndquadrant.com  

M configure
M configure.in
M src/Makefile.global.in
M src/common/Makefile
M src/common/config_info.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Change signature of TupleHashTableHash().

commit   : 11de6c903da99a4b2220acfa776fc26c7f384ccc    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 10 Feb 2020 10:20:10 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 10 Feb 2020 10:20:10 -0800    

Click here for diff

Commit 4eaea3db introduced TupleHashTableHash(), but the signature  
didn't match the other exposed functions. Separate it into internal  
and external versions. The external version hides the details behind  
an API more consistent with the other external functions, and the  
internal version is still suitable for simplehash.  

M src/backend/executor/execGrouping.c
M src/include/executor/executor.h

createuser: fix parsing of --connection-limit argument

commit   : 8fa8e011563744f61d29024ab187a189124a6551    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 10 Feb 2020 12:14:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 10 Feb 2020 12:14:58 -0300    

Click here for diff

The original coding failed to quote the argument properly.  
  
Reported-by: Daniel Gustafsson  
Discussion: [email protected]  

M src/bin/scripts/createuser.c

Fix priv checks for ALTER <object> DEPENDS ON EXTENSION

commit   : b048f558dd7c26a0c630a2cff29d3d8981eaf6b9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 10 Feb 2020 11:47:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 10 Feb 2020 11:47:09 -0300    

Click here for diff

Marking an object as dependant on an extension did not have any  
privilege check whatsoever; this allowed any user to mark objects as  
droppable by anyone able to DROP EXTENSION, which could be used to cause  
system-wide havoc.  Disallow by checking that the calling user owns the  
mentioned object.  
  
(No constraints are placed on the extension.)  
  
Security: CVE-2020-1720  
Reported-by: Tom Lane  
Discussion: [email protected]  

M src/backend/commands/alter.c

Revert "pg_upgrade: Fix quoting of some arguments in pg_ctl command"

commit   : 4e818866e57aa9ec13821fd36a2ff60e00e6dea6    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 10 Feb 2020 15:48:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 10 Feb 2020 15:48:21 +0900    

Click here for diff

This reverts commit d1c0b61.  The patch has some downsides that require  
more attention, as discussed with Noah Misch.  
  
Backpatch-through: 9.5  

M src/bin/pg_upgrade/server.c

Fix typos.

commit   : 3dfba9fdf52121e777e83f27120a755f408927ed    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 10 Feb 2020 09:31:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 10 Feb 2020 09:31:18 +0530    

Click here for diff

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

M doc/src/sgml/sources.sgml
M src/backend/access/transam/README.parallel
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/sync/sync.c
M src/include/access/tableam.h

doc: Spell checking

commit   : 77a00b809a03fbc80957815bbd9092aa9a7748e3    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 10 Feb 2020 08:34:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 10 Feb 2020 08:34:43 +0530    

Click here for diff

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

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

pg_upgrade: Fix quoting of some arguments in pg_ctl command

commit   : d1c0b6132839e496eea73383813a127833af72f1    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 10 Feb 2020 10:48:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 10 Feb 2020 10:48:43 +0900    

Click here for diff

The previous coding forgot to apply shell quoting to the socket  
directory and the data folder, leading to failures when running  
pg_upgrade.  This refactors the code generating the pg_ctl command  
starting clusters to use a more correct shell quoting.  Failures are  
easier to trigger in 12 and newer versions by using a value of  
--socketdir that includes quotes, but it is also possible to cause  
failures with quotes included in the default socket directory used by  
pg_upgrade or the data folders of the clusters involved in the  
upgrade.  
  
As 9.4 is going to be EOL'd with the next minor release, nobody is  
likely going to upgrade to it now so this branch is not included in the  
set of branches fixed.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Noah Misch  
Backpatch-through: 9.5  

M src/bin/pg_upgrade/server.c

psql: Fix %w length in PROMPT2 when PROMPT1 contains a newline.

commit   : 1713a0013f909d9ce5dd43d234f1cd33d6a50854    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 10 Feb 2020 13:20:00 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 10 Feb 2020 13:20:00 +1300    

Click here for diff

The width of the invisible PROMPT2 must take into account, in order  
for user input to be aligned with the first line, that PROMPT1 can  
contain newlines.  
  
Author: Maxence Ahlouche  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAJeaomVyLSP_Wj%3D0FtYNTuoopWHyFarhUtYKDHs0HHv%2Bb%3DN9sA%40mail.gmail.com  

M src/bin/psql/prompt.c

Revert "docs: change "default role" wording to "predefined role""

commit   : c185a57753e64fe3ffc996ea18da8672b302a5a4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Feb 2020 14:19:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Feb 2020 14:19:46 -0500    

Click here for diff

This reverts commit 0e936a2148472e6c364aee8c3e298dc16dc4240a.  
  
Per discussion, we can't change the section title without some  
web-site work, so revert this change temporarily.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Store the deletion horizon XID for a deleted GIN page on the right page.

commit   : 4093ff573702e9f157507340593680dc2c75e88e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Feb 2020 12:02:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Feb 2020 12:02:57 -0500    

Click here for diff

Commit b10714080 moved the GinPageSetDeleteXid() call to a spot where  
the "page" variable was pointing to the wrong page, causing the XID  
to be inserted on a page that's not being deleted, thus allowing later  
GinPageIsRecyclable tests to recycle the deleted page too soon.  
  
It might be a good idea to stop using the single "page" variable for  
multiple purposes in this function.  But for the moment I just moved  
the GinPageSetDeleteXid() call down beside the GinPageSetDeleted()  
call, which seems like a more logical place for it anyway.  
  
Back-patch to v11, as the faulty patch was.  (Fortunately, the bug  
hasn't made it into any release yet.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gin/ginvacuum.c

Fix failure to create FKs correctly in partitions

commit   : 55173d2e663fbe32430665ce7bd65a47856dc237    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Feb 2020 18:27:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Feb 2020 18:27:18 -0300    

Click here for diff

On a multi-level partioned table, when adding a partition not directly  
connected to the root table, foreign key constraints referencing the  
root were not cloned to the new partition, leading to the FK being  
possibly inadvertently violated later on.  
  
This was caused by fuzzy thinking in CloneFkReferenced (commit  
f56f8f8da6af): it was skipping constraints marked as having parents on  
the theory that cloning those would create duplicates; but that's only  
correct for the top level of the partitioning hierarchy.  For levels  
below that one, such constraints must still be considered and only  
skipped if later on we see that we'd create duplicates.  Apparently, I  
(Álvaro) wrote the comments right but the code implemented something  
slightly different.  
  
Author: Jehan-Guillaume de Rorthais  
Discussion: https://postgr.es/m/20200206004948.238352db@firost  

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

Fix TRUNCATE .. CASCADE on partitions

commit   : 9710d3d4a87f428a10f63015a0d75ccf028dd137    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Feb 2020 17:09:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Feb 2020 17:09:36 -0300    

Click here for diff

When running TRUNCATE CASCADE on a child of a partitioned table  
referenced by another partitioned table, the truncate was not applied to  
partitions of the referencing table; this could leave rows violating the  
constraint in the referencing partitioned table.  Repair by walking the  
pg_constraint chain all the way up to the topmost referencing table.  
  
Note: any partitioned tables containing FKs that reference other  
partitioned tables should be checked for possible violating rows, if  
TRUNCATE has occurred in partitions of the referenced table.  
  
Reported-by: Christophe Courtois  
Author: Jehan-Guillaume de Rorthais  
Discussion: https://postgr.es/m/20200204183906.115f693e@firost  

M doc/src/sgml/ref/truncate.sgml
M src/backend/catalog/heap.c
M src/test/regress/expected/truncate.out
M src/test/regress/sql/truncate.sql

Fix bug in Tid scan.

commit   : cb5b28613d553b1c750622e91cbc96c83f052a63    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 7 Feb 2020 22:00:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 7 Feb 2020 22:00:21 +0900    

Click here for diff

Commit 147e3722f7 changed Tid scan so that it calls table_beginscan()  
and uses the scan option for seq scan. This change caused two issues.  
  
(1) The change caused Tid scan to take a predicate lock on the entire  
       relation in serializable transaction even when relation-level  
       lock is not necessary. This could lead to an unexpected  
       serialization error.  
  
(2) The change caused Tid scan to increment the number of seq_scan  
       in pg_stat_*_tables views even though it's not seq scan. This  
       could confuse the users.  
  
This commit adds the scan option for Tid scan and makes Tid scan  
use it, to avoid those issues.  
  
Back-patch to v12, where the bug was introduced.  
  
Author: Tatsuhito Kasahara  
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Fujii Masao  
Discussion: https://postgr.es/m/CAP0=ZVKy+gTbFmB6X_UW0pP3WaeJ-fkUWHoD-pExS=at3CY76g@mail.gmail.com  

M src/backend/executor/nodeTidscan.c
M src/backend/utils/adt/tid.c
M src/include/access/tableam.h
M src/test/regress/expected/tidscan.out
M src/test/regress/sql/tidscan.sql

jit: Reference expression step functions via llvmjit_types.

commit   : b059d2f45685a946da061ee15692fa306bd67f12    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 22:13:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 22:13:52 -0800    

Click here for diff

The main benefit of doing so is that this allows llvm to ensure that  
types match - previously that'd only be detected by a crash within the  
called function. There were a number of cases where we passed a  
superfluous parameter...  
  
To avoid needing to add all the functions to llvmjit.{c,h}, instead  
get them from the llvm module for llvmjit_types.c. Also use that for  
the functions from llvmjit_types already in llvmjit.h.  
  
Author: Soumyadeep Chakraborty and Andres Freund  
Discussion: https://postgr.es/m/CADwEdooww3wZv-sXSfatzFRwMuwa186LyTwkBfwEW6NjtooBPA@mail.gmail.com  

M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/jit/llvmjit.h

Bump catalog version for the addition of leader_pid in pg_stat_activity

commit   : c4f3b63caba02b087519d58cb9bf4990b9c8ec45    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Feb 2020 15:08:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Feb 2020 15:08:17 +0900    

Click here for diff

Oversight in commit b025f32.  
  
Per private report from Julien Rouhaud.  

M src/include/catalog/catversion.h

Introduce TupleHashTableHash() and LookupTupleHashEntryHash().

commit   : 4eaea3db150af56aa2e40efe91997fd25f3b6d73    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 6 Feb 2020 19:39:47 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 6 Feb 2020 19:39:47 -0800    

Click here for diff

Expose two new entry points: one for only calculating the hash value  
of a tuple, and another for looking up a hash entry when the hash  
value is already known. This will be useful for disk-based Hash  
Aggregation to avoid recomputing the hash value for the same tuple  
after saving and restoring it from disk.  
  
Discussion: https://postgr.es/m/37091115219dd522fd9ed67333ee8ed1b7e09443.camel%40j-davis.com  

M src/backend/executor/execGrouping.c
M src/include/executor/executor.h

jit: Remove redundancies in expression evaluation code generation.

commit   : e6f86f8dd9835b18890fd8e9868884dec37e3bd7    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 19:45:45 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 19:45:45 -0800    

Click here for diff

This merges the code emission for a number of opcodes by handling the  
behavioural difference more locally. This reduces code, and also  
improves the generated code a bit in some cases, by removing redundant  
constants.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

jit: Reference functions by name in IOCOERCE steps.

commit   : 8c2769405ff1f4617b0d3af50760b1ee357733ef    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 19:09:06 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 19:09:06 -0800    

Click here for diff

Previously we used constant function pointer addresses, which prevents  
inlining and other related optimizations.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

expression eval: Don't redundantly keep track of AggState.

commit   : 1fdb7f9789c4550204cd62d1746a7deed1dc4c29    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 19:06:16 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 19:06:16 -0800    

Click here for diff

It's already tracked via ExprState->parent, so we don't need to also  
include it in ExprEvalStep. When that code originally was written  
ExprState->parent didn't exist, but it since has been introduced in  
6719b238e8f.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/include/executor/execExpr.h
M src/include/nodes/execnodes.h

expression eval, jit: Minor code cleanups.

commit   : 1ec7679f1b67e84be688a311dce234eeaa1d5de8    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 19:04:50 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 6 Feb 2020 19:04:50 -0800    

Click here for diff

This mostly consists of using C99 style for loops, moving variables  
into narrower scopes, and a smattering of other minor improvements.  
Done separately to make it easier to review patches with actual  
functional changes.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c

Fix typo in proc.c

commit   : 5ac4e9a12c6543414891cd8972b2cd36a08e40cc    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Feb 2020 12:41:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Feb 2020 12:41:10 +0900    

Click here for diff

Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20200206082333.GA95343@nol  

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

Revert "Prevent running pg_basebackup as root"

commit   : dcddc3f813ff39d0e33c2b7c77092a6c0b0e9d0b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Feb 2020 10:51:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Feb 2020 10:51:17 +0900    

Click here for diff

This reverts commit 7bae0ad, as this is not ideal with the tar format,  
and we may want to explore more options like what is done by tar with  
some equivalents of --owner and --group, but for pg_basebackup.  
  
Per complaints from Magnus Hagander and Stephen Frost.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c

Revert "Add GUC checks for ssl_min_protocol_version and ssl_max_protocol_version"

commit   : 414c2fd1e1c0ccd1af1cad046bef1264e3f4347f    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Feb 2020 08:10:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Feb 2020 08:10:40 +0900    

Click here for diff

This reverts commit 41aadee, as the GUC checks could run on older values  
with the new values used, and result in incorrect errors if both  
parameters are changed at the same time.  
  
Per complaint from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/utils/misc/guc.c
M src/test/ssl/t/001_ssltests.pl

Ensure relcache consistency around generated columns

commit   : fc7a5e9eaa2fa34b053ffe52e0e57f1fd6b1f939    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Feb 2020 21:21:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Feb 2020 21:21:04 +0100    

Click here for diff

In certain transient states, it's possible that a table has attributes  
with attgenerated set but no default expressions in pg_attrdef yet.  
In that case, the old code path would not set  
relation->rd_att->constr->has_generated_stored, unless  
relation->rd_att->constr was also populated for some other reason.  
There was probably no practical impact, but it's better to keep this  
consistent.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20200115181105.ad6ab6dlgyww3lb6%40alap3.anarazel.de  

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

Refactor hash_agg_entry_size().

commit   : 7d4395d0a11589aa450a073d658c49b420f4493f    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 6 Feb 2020 11:49:56 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 6 Feb 2020 11:49:56 -0800    

Click here for diff

Consolidate the calculations for hash table size estimation. This will  
help with upcoming Hash Aggregation work that will add additional call  
sites.  

M src/backend/executor/nodeAgg.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/adt/selfuncs.c
M src/include/executor/nodeAgg.h

Logical Tape Set: use min heap for freelist.

commit   : c02fdc9223015c5c386abfa00c47fc7f4c845161    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 6 Feb 2020 10:06:25 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 6 Feb 2020 10:06:25 -0800    

Click here for diff

Previously, the freelist of blocks was tracked as an  
occasionally-sorted array. A min heap is more resilient to larger  
freelists or more frequent changes between reading and writing.  
  
Discussion: https://postgr.es/m/97c46a59c27f3c38e486ca170fcbc618d97ab049.camel%40j-davis.com  

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

Fix typo.

commit   : cac8ce4a738a6fbc6cda4759c056f89a5b603bfc    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 6 Feb 2020 15:57:02 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 6 Feb 2020 15:57:02 +0530    

Click here for diff

Reported-by: Amit Langote  
Author: Amit Langote  
Backpatch-through: 9.6, where it was introduced  
Discussion: https://postgr.es/m/CA+HiwqFNADeukaaGRmTqANbed9Fd81gLi08AWe_F86_942Gspw@mail.gmail.com  

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

Fix bug in LWLock statistics mechanism.

commit   : 3ccc66dac65e12b8f19d0766b00feabd55433854    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 6 Feb 2020 14:43:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 6 Feb 2020 14:43:21 +0900    

Click here for diff

Previously PostgreSQL built with -DLWLOCK_STATS could report  
more than one LWLock statistics entries for the same backend  
process and the same LWLock. This is strange and only one  
statistics should be output in that case, instead.  
  
The cause of this issue is that the key variable used for  
LWLock stats hash table was not fully initialized. The key  
consists of two fields and they were initialized. But  
the following 4 bytes allocated in the key variable for  
the alignment was not initialized. So even if the same key  
was specified, hash_search(HASH_ENTER) could not find  
the existing entry for that key and created new one.  
  
This commit fixes this issue by initializing the key  
variable with zero. As the side effect of this commit,  
the volume of LWLock statistics output would be reduced  
very much.  
  
Back-patch to v10, where commit 3761fe3c20 introduced the issue.  
  
Author: Fujii Masao  
Reviewed-by: Julien Rouhaud, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

Add leader_pid to pg_stat_activity

commit   : b025f32e0b5d7668daec9bfa957edf3599f4baa8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Feb 2020 09:18:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Feb 2020 09:18:06 +0900    

Click here for diff

This new field tracks the PID of the group leader used with parallel  
query.  For parallel workers and the leader, the value is set to the  
PID of the group leader.  So, for the group leader, the value is the  
same as its own PID.  Note that this reflects what PGPROC stores in  
shared memory, so as leader_pid is NULL if a backend has never been  
involved in parallel query.  If the backend is using parallel query or  
has used it at least once, the value is set until the backend exits.  
  
Author: Julien Rouhaud  
Reviewed-by: Sergei Kornilov, Guillaume Lelarge, Michael Paquier, Tomas  
Vondra  
Discussion: https://postgr.es/m/CAOBaU_Yy5bt0vTPZ2_LUM6cUcGeqmYNoJ8-Rgto+c2+w3defYA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out

Force tuple conversion when the source has missing attributes.

commit   : bf6cc19e347d4cb8dfc8f05a59171ac06e18b5e5    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 5 Feb 2020 19:49:47 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 5 Feb 2020 19:49:47 +0000    

Click here for diff

Tuple conversion incorrectly concluded that no conversion was needed  
as long as all the attributes lined up. But if the source tuple has a  
missing attribute (from addition of a column with default), then the  
destination tupdesc might not reflect the same default. The typical  
symptom was that the affected columns would be unexpectedly NULL.  
  
Repair by always forcing conversion if the source has missing  
attributes, which will be filled in by the deform operation. (In  
theory we could optimize for when the destination has the same  
default, but that seemed overkill.)  
  
Backpatch to 11 where missing attributes were added.  
  
Per bug #16242.  
  
Vik Fearing (discovery, code, testing) and me (analysis, testcase).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/attmap.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Make vacuum buffer counters 64 bits wide

commit   : 15d13e82911f7cc9f04f0bf419a96fd827fd1a9d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 5 Feb 2020 16:59:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 5 Feb 2020 16:59:29 -0300    

Click here for diff

Using 32 bit counters means they can now realistically wrap around when  
vacuuming extremely large tables.  Because they're signed integers,  
stats printed by vacuum look very odd when they do.  
  
We'd love to backpatch this, but refrain because the variables are  
exported and could cause third-party code to break.  
  
Reviewed-by: Julien Rouhaud, Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/vacuumlazy.c
M src/backend/utils/init/globals.c
M src/include/miscadmin.h

ALTER SUBSCRIPTION / REFRESH docs: explain copy_data

commit   : 75cdf24ec3f812b2c52e0f47286665f9c8ced24b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 5 Feb 2020 13:21:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 5 Feb 2020 13:21:43 -0300    

Click here for diff

The docs are ambiguous as to which tables would be copied over when the  
copy_data parameter is true in ALTER SUBSCRIPTION ... REFRESH PUBLICATION.  
Make it clear that it only applies to tables which are new in the  
publication.  
  
Author: David Christensen (reword by Álvaro Herrera)  
Discussion: https://postgr.es/m/[email protected]  

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

When a TAP file has non-zero exit status, retain temporary directories.

commit   : bf989aaf35613ed2c2a66e120ca600e7b9da4f82    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 5 Feb 2020 08:26:41 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 5 Feb 2020 08:26:41 -0800    

Click here for diff

PostgresNode already retained base directories in such cases.  Stop  
using $SIG{__DIE__}, which is redundant with the exit status check, in  
lieu of proliferating it to TestLib.  Back-patch to 9.6, where commit  
88802e068017bee8cea7a5502a712794e761c7b5 introduced retention on  
failure.  
  
Reviewed by Daniel Gustafsson.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm

Add kqueue(2) support to the WaitEventSet API.

commit   : 815c2f0972c8386aba7c606f1ee6690d13b04db2    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 5 Feb 2020 17:35:57 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 5 Feb 2020 17:35:57 +1300    

Click here for diff

Use kevent(2) to wait for events on the BSD family of operating  
systems and macOS.  This is similar to the epoll(2) support added  
for Linux by commit 98a64d0bd.  
  
Author: Thomas Munro  
Reviewed-by: Andres Freund, Marko Tiikkaja, Tom Lane  
Tested-by: Mateusz Guzik, Matteo Beccati, Keith Fiske, Heikki Linnakangas, Michael Paquier, Peter Eisentraut, Rui DeSousa, Tom Lane, Mark Wong  
Discussion: https://postgr.es/m/CAEepm%3D37oF84-iXDTQ9MrGjENwVGds%2B5zTr38ca73kWR7ez_tA%40mail.gmail.com  

M configure
M configure.in
M src/backend/storage/ipc/latch.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Handle lack of DSM slots in parallel btree build, take 2.

commit   : d9fe702a2c9843af71419ad0df069859e5581694    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 5 Feb 2020 12:21:03 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 5 Feb 2020 12:21:03 +1300    

Click here for diff

Commit 74618e77 added a new check intended to fix a bug, but put  
it in the wrong place so that parallel btree build was always  
disabled.  Do the check after we've actually tried to create  
a DSM segment.  Back-patch to 11, like the earlier commit.  
  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-WzmDABkJzrNnvf%2BOULK-_A_j9gkYg_Dz-H62jzNv4eKQTw%40mail.gmail.com  

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

Fix handling of "Subplans Removed" field in EXPLAIN output.

commit   : 7d91b604d9b5d6ec8c19c57a9ffd2f27129cdd94    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Feb 2020 13:07:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Feb 2020 13:07:13 -0500    

Click here for diff

Commit 499be013d added this field in a rather poorly-thought-through  
manner, with the result being that rather than being a field of the  
Append or MergeAppend plan node as intended (and as it seems to be,  
in text format), it was actually an element of the "Plans" subgroup.  
At least in JSON format, that's flat out invalid syntax, because  
"Plans" is an array not an object.  
  
While it's not hard to move the generation of the field so that it  
appears where it's supposed to, this does result in a visible change  
in field order in text format, in cases where a Append or MergeAppend  
plan node has any InitPlans attached.  That's slightly annoying to  
do in stable branches; but the alternative of continuing to emit  
broken non-text formats seems worse.  
  
Also, since the set of fields emitted is not supposed to be  
data-dependent in non-text formats, make sure that "Subplans Removed"  
appears in Append and MergeAppend nodes even when it's zero, in those  
formats.  (The previous coding made it look like it could appear in  
some other node types such as BitmapAnd, but we don't actually support  
runtime pruning there, so don't emit it in those cases.)  
  
Per bug #16171 from Mahadevan Ramachandran.  Fix by Daniel Gustafsson  
and Tom Lane, reviewed by Hamid Akhtar.  Back-patch to v11 where this  
code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/test/regress/expected/partition_prune.out

Fix fuzzy error handling in pg_basebackup when opening gzFile

commit   : 177be9edf4bb966400db7769d61e479aa0fe0201    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Feb 2020 13:56:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Feb 2020 13:56:04 +0900    

Click here for diff

First, this code did not bother checking for a failure when calling  
dup().  Then, per zlib, gzerror() returns NULL for a NULL input, which  
can happen if passing down to gzdopen() an invalid file descriptor or if  
there was an allocation failure.  
  
No back-patch is done as this would unlikely be a problem in the field.  
  
Per Coverity.  
  
Reported-by: Tom Lane  

M src/bin/pg_basebackup/pg_basebackup.c

Add missing break out seqscan loop in logical replication

commit   : 1c7a0b387d18c517d45e2f6ec7d8b7d1b2d5fe13    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 3 Feb 2020 18:59:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 3 Feb 2020 18:59:12 -0300    

Click here for diff

When replica identity is FULL (an admittedly unusual case), the loop  
that searches for tuples in execReplication.c didn't stop scanning the  
table when once a matching tuple was found.  Add the missing 'break'.  
  
Note slight behavior change: we now return the first matching tuple  
rather than the last one.  They are supposed to be indistinguishable  
anyway, so this shouldn't matter.  
  
Author: Konstantin Knizhnik  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execReplication.c

Add declaration-level assertions for compile-time checks

commit   : f1f10a1ba9e17e606a7b217ccccdd3cc4d8cb771    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Feb 2020 14:48:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Feb 2020 14:48:42 +0900    

Click here for diff

Those new assertions can be used at file scope, outside of any function  
for compilation checks.  This commit provides implementations for C and  
C++, and fallback implementations.  
  
Author: Peter Smith  
Reviewed-by: Andres Freund, Kyotaro Horiguchi, Dagfinn Ilmari Mannsåker,  
Michael Paquier  
Discussion: https://postgr.es/m/201DD0641B056142AC8C6645EC1B5F62014B8E8030@SYD1217  

M src/backend/storage/page/bufpage.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/pg_dump_sort.c
M src/common/relpath.c
M src/include/c.h
M src/include/storage/bufpage.h

Fix assorted error-cleanup bugs in SSL min/max protocol version code.

commit   : 6148e2b9a6399b77e10e277c32d701b84703820f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Feb 2020 13:09:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Feb 2020 13:09:33 -0500    

Click here for diff

The error exits added to initialize_SSL() failed to clean up the  
partially-built SSL_context, and some of them also leaked the  
result of SSLerrmessage().  Make them match other error-handling  
cases in that function.  
  
The error exits added to connectOptions2() failed to set conn->status  
like every other error exit in that function.  
  
In passing, make the SSL_get_peer_certificate() error exit look more  
like all the other calls of SSLerrmessage().  
  
Oversights in commit ff8ca5fad.  Coverity whined about leakage of the  
SSLerrmessage() results; I noted the rest in manual code review.  

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

Optimizations for integer to decimal output.

commit   : 1fd687a035558238c0e3cab09fc22dc61a088869    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 1 Feb 2020 21:57:14 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 1 Feb 2020 21:57:14 +0000    

Click here for diff

Using a lookup table of digit pairs reduces the number of divisions  
needed, and calculating the length upfront saves some work; these  
ideas are taken from the code previously committed for floats.  
  
David Fetter, reviewed by Kyotaro Horiguchi, Tels, and me.  
  
Discussion: https://postgr.es/m/20190924052620.GP31596%40fetter.org  

M src/backend/access/common/printsimple.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numutils.c
M src/include/utils/builtins.h

Prevent running pg_basebackup as root

commit   : 7bae0ad9fcb76b28410571dc71edfdc3175c4a02    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 1 Feb 2020 18:30:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 1 Feb 2020 18:30:25 +0900    

Click here for diff

Similarly to pg_upgrade, pg_ctl and initdb, a root user is able to use  
--version and --help, but cannot execute the actual operation to avoid  
the creation of files with permissions incompatible with the  
postmaster.  
  
This is a behavior change, so not back-patching is done.  
  
Author: Ian Barwick  
Discussion: https://postgr.es/m/CABvVfJVqOdD2neLkYdygdOHvbWz_5K_iWiqY+psMfA=FeAa3qQ@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Fix memory leak on DSM slot exhaustion.

commit   : 93745f1e019543fe7b742d0c5e971aad8d08fd56    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 1 Feb 2020 14:29:13 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 1 Feb 2020 14:29:13 +1300    

Click here for diff

If we attempt to create a DSM segment when no slots are available,  
we should return the memory to the operating system.  Previously  
we did that if the DSM_CREATE_NULL_IF_MAXSEGMENTS flag was  
passed in, but we didn't do it if an error was raised.  Repair.  
  
Back-patch to 9.4, where DSM segments arrived.  
  
Author: Thomas Munro  
Reviewed-by: Robert Haas  
Reported-by: Julian Backes  
Discussion: https://postgr.es/m/CA%2BhUKGKAAoEw-R4om0d2YM4eqT1eGEi6%3DQot-3ceDR-SLiWVDw%40mail.gmail.com  

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

Fix not-quite-right string comparison in parse_jsonb_index_flags().

commit   : 870ad6a59bbbd95c2dc3cfe67b07d0e079599edf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Jan 2020 17:26:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Jan 2020 17:26:40 -0500    

Click here for diff

This code would accept "strinX", where X is any 1-byte character,  
as meaning "string".  Clearly it wasn't meant to do that.  
  
No back-patch, since this doesn't affect correct queries and  
there's some tiny chance we'd break somebody's incorrect query  
in a minor release.  
  
Report and patch by Dominik Czarnota.  
  
Discussion: https://postgr.es/m/CABEVAa1dU0mDCAfaT8WF2adVXTDsLVJy_izotg6ze_hh-cn8qQ@mail.gmail.com  

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

Fix CheckAttributeType's handling of collations for ranges.

commit   : 74b35eb468dcf353e25afd4acfc7ee2b2022d6b6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Jan 2020 17:03:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Jan 2020 17:03:55 -0500    

Click here for diff

Commit fc7695891 changed CheckAttributeType to recurse into ranges,  
but made it pass down the wrong collation (always InvalidOid, since  
ranges as such have no collation).  This would result in guaranteed  
failure when considering a range type whose subtype is collatable.  
  
Embarrassingly, we lack any regression tests that would expose such  
a problem (but fortunately, somebody noticed before we shipped this  
bug in any release).  
  
Fix it to pass down the range's subtype collation property instead,  
and add some regression test cases to exercise collatable-subtype  
ranges a bit more.  Back-patch to all supported branches, as the  
previous patch was.  
  
Report and patch by Julien Rouhaud, test cases tweaked by me  
  
Discussion: https://postgr.es/m/CAOBaU_aBWqNweiGUFX0guzBKkcfJ8mnnyyGC_KBQmO12Mj5f_A@mail.gmail.com  

M src/backend/catalog/heap.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/rangetypes.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/rangetypes.sql

Fix parallel pg_dump/pg_restore for failure to create worker processes.

commit   : 2425f8f714a15fa0fa6fa2f656ad546cbb78e2d6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Jan 2020 14:41:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Jan 2020 14:41:49 -0500    

Click here for diff

If we failed to fork a worker process, or create a communication pipe  
for one, WaitForTerminatingWorkers would suffer an assertion failure  
if assert-enabled, otherwise crash or go into an infinite loop.  This  
was a consequence of not accounting for the startup condition where  
we've not yet forked all the workers.  
  
The original bug was that ParallelBackupStart would set workerStatus to  
WRKR_IDLE before it had successfully forked a worker.  I made things  
worse in commit b7b8cc0cf by not understanding the undocumented fact  
that the WRKR_TERMINATED state was also meant to represent the case  
where a worker hadn't been started yet: I changed enum T_WorkerStatus  
so that *all* the worker slots were initially in WRKR_IDLE state.  But  
this wasn't any more broken in practice, since even one slot in the  
wrong state would keep WaitForTerminatingWorkers from terminating.  
  
In v10 and later, introduce an explicit T_WorkerStatus value for  
worker-not-started, in hopes of preventing future oversights of the  
same ilk.  Before that, just document that WRKR_TERMINATED is supposed  
to cover that case (partly because it wasn't actively broken, and  
partly because the enum is exposed outside parallel.c in those branches,  
so there's microscopically more risk involved in changing it).  
In all branches, introduce a WORKER_IS_RUNNING status test macro  
to hide which T_WorkerStatus values mean that, and be more careful  
not to access ParallelSlot fields till we're sure they're valid.  
  
Per report from Vignesh C, though this is my patch not his.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CALDaNm1Luv-E3sarR+-unz-BjchquHHyfP+YC+2FS2pt_J+wxg@mail.gmail.com  

M src/bin/pg_dump/parallel.c

Allow building without default socket directory

commit   : a9cff89f7e638c060621a62ca35da97a12adde42    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 31 Jan 2020 16:26:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 31 Jan 2020 16:26:12 +0100    

Click here for diff

We have code paths for Unix socket support and no Unix socket support.  
Now add a third variant: Unix socket support but do not use a Unix  
socket by default in the client or the server, only if you explicitly  
specify one.  This will be useful when we enable Unix socket support  
on Windows.  
  
To implement this, tweak things so that setting DEFAULT_PGSOCKET_DIR  
to "" has the desired effect.  This mostly already worked like that;  
only a few places needed to be adjusted.  Notably, the reference to  
DEFAULT_PGSOCKET_DIR in UNIXSOCK_PATH() could be removed because all  
callers already resolve an empty socket directory setting with a  
default if appropriate.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/libpq/pqcomm.h
M src/include/pg_config_manual.h
M src/interfaces/libpq/fe-connect.c

Sprinkle some const decorations

commit   : 7c23bfd25c423b4513a16d41c5e4d09c32807155    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 31 Jan 2020 11:50:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 31 Jan 2020 11:50:32 +0100    

Click here for diff

This might help clarify the API a bit.  

M src/backend/libpq/pqcomm.c
M src/include/libpq/libpq.h

Fix typo in recently-added TAP test for replication slots

commit   : 7ca8c9706a5785feef5d5eff0078c5361694b274    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 31 Jan 2020 13:57:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 31 Jan 2020 13:57:56 +0900    

Click here for diff

Oversight in commit b0afdca.  

M src/test/recovery/t/006_logical_decoding.pl

Report time spent in posix_fallocate() as a wait event.

commit   : ef02fb15a35ab7bd74a79afebf35572ed82b5e9f    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 31 Jan 2020 17:21:47 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 31 Jan 2020 17:21:47 +1300    

Click here for diff

When allocating DSM segments with posix_fallocate() on Linux (see commit  
899bd785), report this activity as a wait event exactly as we would if  
we were using file-backed DSM rather than shm_open()-backed DSM.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CA%2BhUKGKCSh4GARZrJrQZwqs5SYp0xDMRr9Bvb%2BHQzJKvRgL6ZA%40mail.gmail.com  

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

Adjust DSM and DSA slot usage constants.

commit   : d061ea21fc1cc1c657bb5c742f5c4a1564e82ee2    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 31 Jan 2020 16:58:38 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 31 Jan 2020 16:58:38 +1300    

Click here for diff

When running a lot of large parallel queries concurrently, or a plan with  
a lot of separate Gather nodes, it is possible to run out of DSM slots.  
There are better solutions to these problems requiring architectural  
redesign work, but for now, let's adjust the constants so that it's more  
difficult to hit the limit.  
  
1.  Previously, a DSA area would create up to four segments at each size  
before doubling the size.  After this commit, it will create only two at  
each size, so it ramps up faster and therefore needs fewer slots.  
  
2.  Previously, the total limit on DSM slots allowed for 2 per connection.  
Switch to 5 per connection.  
  
Also remove an obsolete nearby comment.  
  
Author: Thomas Munro  
Reviewed-by: Robert Haas, Andres Freund  
Discussion: https://postre.es/m/CA%2BhUKGL6H2BpGbiF7Lj6QiTjTGyTLW_vLR%3DSn2tEBeTcYXiMKw%40mail.gmail.com  

M src/backend/storage/ipc/dsm.c
M src/backend/utils/mmgr/dsa.c

In jsonb_plpython.c, suppress warning message from gcc 10.

commit   : a069218163704c44a8996e7e98e765c56e2b9c8e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Jan 2020 18:25:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Jan 2020 18:25:55 -0500    

Click here for diff

Very recent gcc complains that PLyObject_ToJsonbValue could return  
a pointer to a local variable.  I think it's wrong; but the coding  
is fragile enough, and the savings of one palloc() minimal enough,  
that it seems better to just do a palloc() all the time.  (My other  
idea of tweaking the if-condition doesn't suppress the warning.)  
  
Back-patch to v11 where this code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/jsonb_plpython/jsonb_plpython.c

Handle lack of DSM slots in parallel btree build.

commit   : 74618e77b43cfce670b4725d5b9a300a2afd12d1    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 31 Jan 2020 10:25:34 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 31 Jan 2020 10:25:34 +1300    

Click here for diff

If no DSM slots are available, a ParallelContext can still be  
created, but its seg pointer is NULL.  Teach parallel btree build  
to cope with that by falling back to a regular non-parallel build,  
to avoid crashing with a segmentation fault.  
  
Back-patch to 11, where parallel CREATE INDEX landed.  
  
Reported-by: Nicola Contu  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CA%2BhUKGJgJEBnkuODBVomyK3MWFvDBbMVj%3Dgdt6DnRPU-5sQ6UQ%40mail.gmail.com  

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

Clean up newlines following left parentheses

commit   : c9d29775195922136c09cc980bb1b7091bf3d859    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jan 2020 13:42:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jan 2020 13:42:14 -0300    

Click here for diff

We used to strategically place newlines after some function call left  
parentheses to make pgindent move the argument list a few chars to the  
left, so that the whole line would fit under 80 chars.  However,  
pgindent no longer does that, so the newlines just made the code  
vertically longer for no reason.  Remove those newlines, and reflow some  
of those lines for some extra naturality.  
  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_macaddr8.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_uuid.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/hstore/hstore_op.c
M contrib/intarray/_int_op.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltxtquery_op.c
M contrib/oid2name/oid2name.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M contrib/seg/seg.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gist/gistproc.c
M src/backend/access/heap/heapam.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/transam/xact.c
M src/backend/catalog/heap.c
M src/backend/commands/event_trigger.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeAgg.c
M src/backend/libpq/auth.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/tcop/utility.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/psql/help.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_elog.c
M src/pl/tcl/pltcl.c
M src/port/gettimeofday.c

Remove excess parens in ereport() calls

commit   : 4e89c79a52f8a898edd648b56a00f0f4f840cfe7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jan 2020 13:32:04 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Jan 2020 13:32:04 -0300    

Click here for diff

Cosmetic cleanup, not worth backpatching.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Tom Lane, Michael Paquier  

M contrib/adminpack/adminpack.c
M contrib/hstore_plperl/hstore_plperl.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/commands/alter.c
M src/backend/commands/collationcmds.c
M src/backend/commands/createas.c
M src/backend/commands/functioncmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/user.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/repl_gram.y
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/misc/guc.c

Fix test failure with non-MULTIPLICITY Perl interpreters.

commit   : 2520cf8c2a0a1d679094dffbd99871884e620ed5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Jan 2020 10:51:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Jan 2020 10:51:31 -0500    

Click here for diff

Per buildfarm.  

M src/pl/plperl/expected/plperl_setup.out
M src/pl/plperl/sql/plperl_setup.sql

Make inherited TRUNCATE perform access permission checks on parent table only.

commit   : e6f1e560e4c6e764080af8c8d5e76cdea4d8d00a    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 31 Jan 2020 00:42:06 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 31 Jan 2020 00:42:06 +0900    

Click here for diff

Previously, TRUNCATE command through a parent table checked the  
permissions on not only the parent table but also the children tables  
inherited from it. This was a bug and inherited queries should perform  
access permission checks on the parent table only. This commit fixes  
that bug.  
  
Back-patch to all supported branches.  
  
Author: Amit Langote  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CAHGQGwFHdSvifhJE+-GSNqUHSfbiKxaeQQ7HGcYz6SC2n_oDcg@mail.gmail.com  

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

Fix slot data persistency when advancing physical replication slots

commit   : b0afdcad21fde1470e6502a376bfaf0e10d384fa    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 30 Jan 2020 11:14:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 30 Jan 2020 11:14:02 +0900    

Click here for diff

Advancing a physical replication slot with pg_replication_slot_advance()  
did not mark the slot as dirty if any advancing was done, preventing the  
follow-up checkpoint to flush the slot data to disk.  This caused the  
advancing to be lost even on clean restarts.  This does not happen for  
logical slots as any advancing marked the slot as dirty.  Per  
discussion, the original feature has been implemented so as in the event  
of a crash the slot may move backwards to a past LSN.  This property is  
kept and more documentation is added about that.  
  
This commit adds some new TAP tests to check the persistency of physical  
and logical slots after advancing across clean restarts.  
  
Author: Alexey Kondratov, Michael Paquier  
Reviewed-by: Andres Freund, Kyotaro Horiguchi, Craig Ringer  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M doc/src/sgml/func.sgml
M src/backend/replication/slotfuncs.c
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/006_logical_decoding.pl

Fix vcregress.pl for new plperl test case.

commit   : 26a81bb8152bd9f29bc24c1edfc00e2cbcd68548    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jan 2020 19:13:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jan 2020 19:13:34 -0500    

Click here for diff

As of commit 50fc694e4, the plperl tests don't want preinstalled  
plperl languages; they now install those themselves.  I'd removed the  
--load-extension options from the GNUmakefile, but missed teaching  
the MSVC build script about that.  
  
Per buildfarm.  

M src/tools/msvc/vcregress.pl

Invent "trusted" extensions, and remove the pg_pltemplate catalog.

commit   : 50fc694e43742ce3d04a5e9f708432cb022c5f0d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jan 2020 18:42:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jan 2020 18:42:43 -0500    

Click here for diff

This patch creates a new extension property, "trusted".  An extension  
that's marked that way in its control file can be installed by a  
non-superuser who has the CREATE privilege on the current database,  
even if the extension contains objects that normally would have to be  
created by a superuser.  The objects within the extension will (by  
default) be owned by the bootstrap superuser, but the extension itself  
will be owned by the calling user.  This allows replicating the old  
behavior around trusted procedural languages, without all the  
special-case logic in CREATE LANGUAGE.  We have, however, chosen to  
loosen the rules slightly: formerly, only a database owner could take  
advantage of the special case that allowed installation of a trusted  
language, but now anyone who has CREATE privilege can do so.  
  
Having done that, we can delete the pg_pltemplate catalog, moving the  
knowledge it contained into the extension script files for the various  
PLs.  This ends up being no change at all for the in-core PLs, but it is  
a large step forward for external PLs: they can now have the same ease  
of installation as core PLs do.  The old "trusted PL" behavior was only  
available to PLs that had entries in pg_pltemplate, but now any  
extension can be marked trusted if appropriate.  
  
This also removes one of the stumbling blocks for our Python 2 -> 3  
migration, since the association of "plpythonu" with Python 2 is no  
longer hard-wired into pg_pltemplate's initial contents.  Exactly where  
we go from here on that front remains to be settled, but one problem  
is fixed.  
  
Patch by me, reviewed by Peter Eisentraut, Stephen Frost, and others.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/ref/create_extension.sgml
M doc/src/sgml/ref/create_language.sgml
M doc/src/sgml/xplang.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/catalog.c
M src/backend/catalog/system_views.sql
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/proclang.c
M src/backend/parser/gram.y
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/function.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
D src/include/catalog/pg_pltemplate.dat
D src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/toasting.h
M src/include/commands/extension.h
M src/include/commands/proclang.h
M src/pl/plperl/GNUmakefile
A src/pl/plperl/expected/plperl_setup.out
M src/pl/plperl/plperl–1.0.sql
M src/pl/plperl/plperl.control
M src/pl/plperl/plperlu–1.0.sql
A src/pl/plperl/sql/plperl_setup.sql
M src/pl/plpgsql/src/plpgsql–1.0.sql
M src/pl/plpgsql/src/plpgsql.control
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpython2u–1.0.sql
M src/pl/plpython/plpython3u–1.0.sql
M src/pl/plpython/plpythonu–1.0.sql
M src/pl/tcl/pltcl–1.0.sql
M src/pl/tcl/pltcl.control
M src/pl/tcl/pltclu–1.0.sql
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out

Teach plpgsql's "make clean" to remove generated test files.

commit   : 166ab9c8d343b51e6838d7b59194d32a0019242f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Jan 2020 11:06:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Jan 2020 11:06:59 -0500    

Click here for diff

Copy the rules that src/test/regress/GNUmakefile uses for this purpose.  
Since these files are .gitignore'd, the mistake wasn't obvious unless  
you happened to look at "git status --ignored" in an allegedly clean  
tree.  
  
Oversight in commit 1858b105b.  No need for back-patch since that's  
not in the back branches.  

M src/pl/plpgsql/src/Makefile

Add jsonapi.c to Mkvcbuild.pm's @pgcommonallfiles.

commit   : 006b9dcad41956f180f9363648206fede8417592    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Jan 2020 10:50:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Jan 2020 10:50:17 -0500    

Click here for diff

My recent commit beb4699091e9fab1c5f465056bef35c9ddf7f9fc caused  
some buildfarm breakage, as reported by Tom Lane. Try to repair.  
  
This fix is extracted from a larger patch by Andrew Dunstan.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/[email protected]  

M src/tools/msvc/Mkvcbuild.pm

Move jsonapi.c and jsonapi.h to src/common.

commit   : beb4699091e9fab1c5f465056bef35c9ddf7f9fc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 29 Jan 2020 10:19:24 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 29 Jan 2020 10:19:24 -0500    

Click here for diff

To make this work, (1) makeJsonLexContextCstringLen now takes the  
encoding to be used as an argument; (2) check_stack_depth() is made to  
do nothing in frontend code, and (3) elog(ERROR, ...) is changed to  
pg_log_fatal + exit in frontend code.  
  
Mark Dilger, reviewed and slightly revised by me.  
  
Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com  

M contrib/hstore/hstore_io.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/common/Makefile
R096 src/backend/utils/adt/jsonapi.c src/common/jsonapi.c
R099 src/include/utils/jsonapi.h src/include/common/jsonapi.h
M src/include/utils/jsonfuncs.h

Fail if recovery target is not reached

commit   : dc788668bb269b10a108e87d14fefd1b9301b793    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Jan 2020 15:43:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Jan 2020 15:43:32 +0100    

Click here for diff

Before, if a recovery target is configured, but the archive ended  
before the target was reached, recovery would end and the server would  
promote without further notice.  That was deemed to be pretty wrong.  
With this change, if the recovery target is not reached, it is a fatal  
error.  
  
Based-on-patch-by: Leif Gunnar Erlandsen <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/test/perl/PostgresNode.pm
M src/test/recovery/t/003_recovery_targets.pl

Fix dispsize for libpq connection parameters channel_binding and gssencmode

commit   : 29e321cdd63ea48fd0223447d58f4742ad729eb0    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 29 Jan 2020 15:08:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 29 Jan 2020 15:08:19 +0900    

Click here for diff

channel_binding's longest allowed value is not "7", it is actually "8".  
gssencmode also got that wrong.  
  
A similar mistake has been fixed as of f4051e3.  
  
Backpatch down to v12, where gssencmode has been introduced.  
  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Add --parallel option to vacuumdb command.

commit   : 47bc9ced0d0e96523e2c639c7066c9aede189ed7    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 29 Jan 2020 11:08:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 29 Jan 2020 11:08:50 +0530    

Click here for diff

Commit 40d964ec99 allowed vacuum command to leverage multiple CPUs by  
invoking parallel workers to process indexes.  This commit provides a  
'--parallel' option to specify the parallel degree used by vacuum command.  
  
Author: Masahiko Sawada, with few modifications by me  
Reviewed-by: Mahendra Singh and Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDTPMgzSkV4E3SFo1CH_x50bf5PqZFQf4jmqjk-C03BWg@mail.gmail.com  

M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c

Fix dangling pointer in EvalPlanQual machinery.

commit   : 01d9676a53af075feb42d2f83ddb8c61186812fc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Jan 2020 17:26:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Jan 2020 17:26:37 -0500    

Click here for diff

EvalPlanQualStart() supposed that it could re-use the relsubs_rowmark  
and relsubs_done arrays from a prior instantiation.  But since they are  
allocated in the es_query_cxt of the recheckestate, that's just wrong;  
EvalPlanQualEnd() will blow away that storage.  Therefore we were using  
storage that could have been reallocated to something else, causing all  
sorts of havoc.  
  
I think this was modeled on the old code's handling of es_epqTupleSlot,  
but since the code was anyway clearing the arrays at re-use, there's  
clearly no expectation of importing any outside state.  So it's just  
a dubious savings of a couple of pallocs, which is negligible compared  
to setting up a new planstate tree.  Therefore, just allocate the  
arrays always.  (I moved the allocations slightly for readability.)  
  
In principle this bug could cause a problem whenever EPQ rechecks are  
needed in more than one target table of a ModifyTable plan node.  
In practice it seems not quite so easy to trigger as that; I couldn't  
readily duplicate a crash with a partitioned target table, for instance.  
That's probably down to incidental choices about when to free or  
reallocate stuff.  The added isolation test case does seem to reliably  
show an assertion failure, though.  
  
Per report from Oleksii Kliukin.  Back-patch to v12 where the bug was  
introduced (evidently by commit 3fb307bc4).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Fix randAccess setting in ReadRecord()

commit   : 30012a04a6c8127397a8ab71e160d9c7e7fbe874    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Jan 2020 12:55:30 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 28 Jan 2020 12:55:30 +0200    

Click here for diff

Commit 38a957316d got this backwards.  
  
Author: Kyotaro Horiguchi  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix compile error on HP C.

commit   : 11da6bccd178c1e0d5b0fbc4bccc538f8a005dd3    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 28 Jan 2020 20:30:40 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 28 Jan 2020 20:30:40 +1300    

Click here for diff

Per build farm animal anole, after commit 6f38d4dac3.  

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

Don't reset latch in ConditionVariablePrepareToSleep().

commit   : 78aaa0e82335527b8cc91601c98c9abbbc3ef3ee    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 28 Jan 2020 15:28:36 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 28 Jan 2020 15:28:36 +1300    

Click here for diff

It's not OK to do that without calling CHECK_FOR_INTERRUPTS().  
Let the next wait loop deal with it, following the usual pattern.  
  
One consequence of this bug was that a SIGTERM delivered in a very  
narrow timing window could leave a parallel worker process waiting  
forever for a condition variable that will never be signaled, after  
an error was raised in other process.  
  
The code is a bit different in the stable branches due to commit  
1321509f, making problems less likely there.  No back-patch for now,  
but we may finish up deciding to make a similar change after more  
discussion.  
  
Author: Thomas Munro  
Reviewed-by: Shawn Debnath  
Reported-by: Tomas Vondra  
Discussion: https://postgr.es/m/CA%2BhUKGJOm8zZHjVA8svoNT3tHY0XdqmaC_kHitmgXDQM49m1dA%40mail.gmail.com  

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

Added relation name in error messages for constraint checks.

commit   : 05f18c6b6b6e4b44302ee20a042cedc664532aa2    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 28 Jan 2020 07:48:10 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 28 Jan 2020 07:48:10 +0530    

Click here for diff

This gives more information to the user about the error and it makes such  
messages consistent with the other similar messages in the code.  
  
Reported-by: Simon Riggs  
Author: Mahendra Singh and Simon Riggs  
Reviewed-by: Beena Emerson and Amit Kapila  
Discussion: https://postgr.es/m/CANP8+j+7YUvQvGxTrCiw77R23enMJ7DFmyA3buR+fa2pKs4XhA@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/domain.out
M src/test/regress/expected/generated.out
M src/test/regress/expected/identity.out
M src/test/regress/expected/index_including.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/reloptions.out
M src/test/regress/expected/sequence.out
M src/test/regress/expected/vacuum.out
M src/test/regress/output/constraints.source

Add connection parameters to control SSL protocol min/max in libpq

commit   : ff8ca5fadd819155c82bd16fcc6b7231af649cf8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Jan 2020 10:40:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Jan 2020 10:40:48 +0900    

Click here for diff

These two new parameters, named sslminprotocolversion and  
sslmaxprotocolversion, allow to respectively control the minimum and the  
maximum version of the SSL protocol used for the SSL connection attempt.  
The default setting is to allow any version for both the minimum and the  
maximum bounds, causing libpq to rely on the bounds set by the backend  
when negotiating the protocol to use for an SSL connection.  The bounds  
are checked when the values are set at the earliest stage possible as  
this makes the checks independent of any SSL implementation.  
  
Author: Daniel Gustafsson  
Reviewed-by: Michael Paquier, Cary Huang  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/libpq.sgml
M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/t/001_ssltests.pl

Remove dependency on HeapTuple from predicate locking functions.

commit   : 6f38d4dac381b5b8bead302a0b4f81761042cd25    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 28 Jan 2020 13:13:04 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 28 Jan 2020 13:13:04 +1300    

Click here for diff

The following changes make the predicate locking functions more  
generic and suitable for use by future access methods:  
  
- PredicateLockTuple() is renamed to PredicateLockTID().  It takes  
  ItemPointer and inserting transaction ID instead of HeapTuple.  
  
- CheckForSerializableConflictIn() takes blocknum instead of buffer.  
  
- CheckForSerializableConflictOut() no longer takes HeapTuple or buffer.  
  
Author: Ashwin Agrawal  
Reviewed-by: Andres Freund, Kuntal Ghosh, Thomas Munro  
Discussion: https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com  

M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/storage/lmgr/predicate.c
M src/include/access/heapam.h
M src/include/storage/predicate.h

Apply project best practices to switches over enum values.

commit   : 4589c6a2a30faba53d0655a8e3a29b54d28bb6f6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Jan 2020 18:46:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Jan 2020 18:46:30 -0500    

Click here for diff

In the wake of 1f3a02173, assorted buildfarm members were warning about  
"control reaches end of non-void function" or the like.  Do what we've  
done elsewhere: in place of a "default" switch case that will prevent  
the compiler from warning about unhandled enum values, put a catchall  
elog() after the switch.  And return a dummy value to satisfy compilers  
that don't know elog() doesn't return.  

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

Move some code from jsonapi.c to jsonfuncs.c.

commit   : 73ce2a03f30b52d6bfb26bc28f1e3e1aa1637577    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Jan 2020 11:22:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Jan 2020 11:22:13 -0500    

Click here for diff

Specifically, move those functions that depend on ereport()  
from jsonapi.c to jsonfuncs.c, in preparation for allowing  
jsonapi.c to be used from frontend code.  
  
A few cases where elog(ERROR, ...) is used for can't-happen  
conditions are left alone; we can handle those in some other  
way in frontend code.  
  
Reviewed by Mark Dilger and Andrew Dunstan.  
  
Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonapi.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonapi.h
M src/include/utils/jsonfuncs.h

Adjust pg_parse_json() so that it does not directly ereport().

commit   : 1f3a021730be98b880d94cabbe21de7e4d8136f5    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 27 Jan 2020 11:03:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 27 Jan 2020 11:03:21 -0500    

Click here for diff

Instead, it now returns a value indicating either success or the  
type of error which occurred. The old behavior is still available  
by calling pg_parse_json_or_ereport(). If the new interface is  
used, an error can be thrown by passing the return value of  
pg_parse_json() to json_ereport_error().  
  
pg_parse_json() can still elog() in can't-happen cases, but it  
seems like that issue is best handled separately.  
  
Adjust json_lex() and json_count_array_elements() to return an  
error code, too.  
  
This is all in preparation for making the backend's json parser  
available to frontend code.  
  
Reviewed and/or tested by Mark Dilger and Andrew Dunstan.  
  
Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonapi.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonapi.h

Avoid unnecessary shm writes in Parallel Hash Join.

commit   : 3e4818e9dd5be294d97ca67012528cb1c0b0ccaa    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 27 Jan 2020 12:52:08 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 27 Jan 2020 12:52:08 +1300    

Click here for diff

Currently, Parallel Hash Join cannot be used for full/right joins,  
so there is no point in setting the match flag.  It turns out that  
the cache coherence traffic generated by those writes slows down  
large systems running many-core joins, so let's stop doing that.  
In future, if we need to use match bits in parallel joins, we might  
want to consider setting them only if not already set.  
  
Back-patch to 11, where Parallel Hash Join arrived.  
  
Reported-by: Deng, Gang  
Discussion: https://postgr.es/m/0F44E799048C4849BAE4B91012DB910462E9897A%40SHSMSX103.ccr.corp.intel.com  

M src/backend/executor/nodeHashjoin.c

Fix some memory leaks and improve restricted token handling on Windows

commit   : 10a525230fb18331dbcfd6a4a7248d76f55c331c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Jan 2020 11:02:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Jan 2020 11:02:05 +0900    

Click here for diff

The leaks have been detected by a Coverity run on Windows.  No backpatch  
is done as the leaks are minor.  
  
While on it, make restricted token creation more consistent in its error  
handling by logging an error instead of a warning if missing  
advapi32.dll, which was missing in the NT4 days.  Any modern platform  
should have this DLL around.  Now, if the library is not there, an error  
is still reported back to the caller, and nothing is done do there is no  
behavior change done in this commit.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQApa9MG0foPkgPX87fipk=vhnF2Xfg+CfUyR08h4R7Mywg@mail.gmail.com  

M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/common/restricted_token.c

Fix EXPLAIN (SETTINGS) to follow policy about when to print empty fields.

commit   : 3ec20c7091e97a554e7447ac2b7f4ed795631395    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jan 2020 16:31:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jan 2020 16:31:48 -0500    

Click here for diff

In non-TEXT output formats, the "Settings" field should appear when  
requested, even if it would be empty.  
  
Also, get rid of the premature optimization of counting all the  
GUC_EXPLAIN variables at startup.  Since there was no provision for  
adjusting that count later, all it'd take would be some extension marking  
a parameter as GUC_EXPLAIN to risk an assertion failure or memory stomp.  
We could make get_explain_guc_options() count those variables on-the-fly,  
or dynamically resize its array ... but TBH I do not think that making a  
transient array of pointers a bit smaller is worth any extra complication,  
especially when you consider all the other transient space EXPLAIN eats.  
So just allocate that array at the max possible size.  
  
In HEAD, also add some regression test coverage for this feature.  
  
Because of the memory-stomp hazard, back-patch to v12 where this  
feature was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/utils/misc/guc.c
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Refactor confusing code in _mdfd_openseg().

commit   : f37ff03478aefb5e01d748b85ad86e6213624992    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 27 Jan 2020 09:05:27 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 27 Jan 2020 09:05:27 +1300    

Click here for diff

As reported independently by a couple of people, _mdfd_openseg() is coded in a  
way that seems to imply that the segments could be opened in an order that  
isn't strictly sequential.  Even if that were true, it's also using the wrong  
comparison.  It's not an active bug, since the condition is always true anyway,  
but it's confusing, so replace it with an assertion.  
  
Author: Thomas Munro  
Reviewed-by: Andres Freund, Kyotaro Horiguchi, Noah Misch  
Discussion: https://postgr.es/m/CA%2BhUKG%2BNBw%2BuSzxF1os-SO6gUuw%3DcqO5DAybk6KnHKzgGvxhxA%40mail.gmail.com  
Discussion: https://postgr.es/m/20191222091930.GA1280238%40rfd.leadboat.com  

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

In postgres_fdw, don't try to ship MULTIEXPR updates to remote server.

commit   : 215824f9188a2b19f870e6a707c5a81e1ac3f1fc    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jan 2020 14:31:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jan 2020 14:31:08 -0500    

Click here for diff

In a statement like "UPDATE remote_tab SET (x,y) = (SELECT ...)",  
we'd conclude that the statement could be directly executed remotely,  
because the sub-SELECT is in a resjunk tlist item that's not examined  
for shippability.  Currently that ends up crashing if the sub-SELECT  
contains any remote Vars.  Prevent the crash by deeming MULTIEXEC  
Params to be unshippable.  
  
This is a bit of a brute-force solution, since if the sub-SELECT  
*doesn't* contain any remote Vars, the current execution technology  
would work; but that's not a terribly common use-case for this syntax,  
I think.  In any case, we generally don't try to ship sub-SELECTs, so  
it won't surprise anybody that this doesn't end up as a remote direct  
update.  I'd be inclined to see if that general limitation can be fixed  
before worrying about this case further.  
  
Per report from Lukáš Sobotka.  
  
Back-patch to 9.6.  9.5 had MULTIEXPR, but we didn't try to perform  
remote direct updates then, so the case didn't arise anyway.  
  
Discussion: https://postgr.es/m/CAJif3k+iA_ekBB5Zw2hDBaE1wtiQa4LH4_JUXrrMGwTrH0J01Q@mail.gmail.com  

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

Refactor XLogReadRecord(), adding XLogBeginRead() function.

commit   : 38a957316d7e46d4b00de40f43966984a463d80a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 26 Jan 2020 11:39:00 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 26 Jan 2020 11:39:00 +0200    

Click here for diff

The signature of XLogReadRecord() required the caller to pass the starting  
WAL position as argument, or InvalidXLogRecPtr to continue reading at the  
end of previous record. That's slightly awkward to the callers, as most  
of them don't want to randomly jump around in the WAL stream, but start  
reading at one position and then read everything from that point onwards.  
Remove the 'RecPtr' argument and add a new function XLogBeginRead() to  
specify the starting position instead. That's more convenient for the  
callers. Also, xlogreader holds state that is reset when you change the  
starting position, so having a separate function for doing that feels like  
a more natural fit.  
  
This changes XLogFindNextRecord() function so that it doesn't reset the  
xlogreader's state to what it was before the call anymore. Instead, it  
positions the xlogreader to the found record, like XLogBeginRead().  
  
Reviewed-by: Kyotaro Horiguchi, Alvaro Herrera  
Discussion: https://www.postgresql.org/message-id/5382a7a3-debe-be31-c860-cb810c08f366%40iki.fi  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h

Clean up EXPLAIN's handling of per-worker details.

commit   : 10013684970453a0ddc86050bba813c611114321    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Jan 2020 18:16:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Jan 2020 18:16:42 -0500    

Click here for diff

Previously, it was possible for EXPLAIN ANALYZE of a parallel query  
to produce several different "Workers" fields for a single plan node,  
because different portions of explain.c independently generated  
per-worker data and wrapped that output in separate fields.  This  
is pretty bogus, especially for the structured output formats: even  
if it's not technically illegal, most programs would have a hard time  
dealing with such data.  
  
To improve matters, add infrastructure that allows redirecting  
per-worker values into a side data structure, and then collect that  
data into a single "Workers" field after we've finished running all  
the relevant code for a given plan node.  
  
There are a few visible side-effects:  
  
* In text format, instead of something like  
  
  Sort Method: external merge  Disk: 4920kB  
  Worker 0:  Sort Method: external merge  Disk: 5880kB  
  Worker 1:  Sort Method: external merge  Disk: 5920kB  
  Buffers: shared hit=682 read=10188, temp read=1415 written=2101  
  Worker 0:  actual time=130.058..130.324 rows=1324 loops=1  
    Buffers: shared hit=337 read=3489, temp read=505 written=739  
  Worker 1:  actual time=130.273..130.512 rows=1297 loops=1  
    Buffers: shared hit=345 read=3507, temp read=505 written=744  
  
you get  
  
  Sort Method: external merge  Disk: 4920kB  
  Buffers: shared hit=682 read=10188, temp read=1415 written=2101  
  Worker 0:  actual time=130.058..130.324 rows=1324 loops=1  
    Sort Method: external merge  Disk: 5880kB  
    Buffers: shared hit=337 read=3489, temp read=505 written=739  
  Worker 1:  actual time=130.273..130.512 rows=1297 loops=1  
    Sort Method: external merge  Disk: 5920kB  
    Buffers: shared hit=345 read=3507, temp read=505 written=744  
  
* When JIT is enabled, any relevant per-worker JIT stats are attached  
to the child node of the Gather or Gather Merge node, which is where  
the other per-worker output has always been.  Previously, that info  
was attached directly to a Gather node, or missed entirely for Gather  
Merge.  
  
* A query's summary JIT data no longer includes a bogus  
"Worker Number: -1" field.  
  
A notable code-level change is that indenting for lines of text-format  
output should now be handled by calling "ExplainIndentText(es)",  
instead of hard-wiring how much space to emit.  This seems a good deal  
cleaner anyway.  
  
This patch also adds a new "explain.sql" regression test script that's  
dedicated to testing EXPLAIN.  There is more that can be done in that  
line, certainly, but for now it just adds some coverage of the XML and  
YAML output formats, which had been completely untested.  
  
Although this is surely a bug fix, it's not clear that people would  
be happy with rearranging EXPLAIN output in a minor release, so apply  
to HEAD only.  
  
Maciek Sakrejda and Tom Lane, based on an idea of Andres Freund's;  
reviewed by Georgios Kokolatos  
  
Discussion: https://postgr.es/m/CAOtHd0AvAA8CLB9Xz0wnxu1U=zJCKrr1r4QwwXi_kcQsHDVU=Q@mail.gmail.com  

M src/backend/commands/explain.c
M src/include/commands/explain.h
A src/test/regress/expected/explain.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/explain.sql

Add functions gcd() and lcm() for integer and numeric types.

commit   : 13661ddd7eaec7e2809ff5c29fc14653b6161036    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 25 Jan 2020 14:00:59 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 25 Jan 2020 14:00:59 +0000    

Click here for diff

These compute the greatest common divisor and least common multiple of  
a pair of numbers using the Euclidean algorithm.  
  
Vik Fearing, reviewed by Fabien Coelho.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove jsonapi.c's lex_accept().

commit   : 530609aa4263bee5b5ca205d83f0dbad098d0465    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 17 Jan 2020 14:06:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 17 Jan 2020 14:06:41 -0500    

Click here for diff

At first glance, this function seems useful, but it actually increases  
the amount of code required rather than decreasing it. Inline the  
logic into the callers instead; most callers don't use the 'lexeme'  
argument for anything and as a result considerable simplification is  
possible.  
  
Along the way, fix the header comment for the nearby function  
lex_expect(), which mislabeled it as lex_accept().  
  
Patch by me, reviewed by David Steele, Mark Dilger, and Andrew  
Dunstan.  
  
Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com  

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

Split JSON lexer/parser from 'json' data type support.

commit   : 11b5e3e35d3900164cb36754ee4e4dcab0bd02f0    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Jan 2020 10:17:43 -0800    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Jan 2020 10:17:43 -0800    

Click here for diff

Keep the code that pertains to the 'json' data type in json.c, but  
move the lexing and parsing code to a new file jsonapi.c, a name  
I chose because the corresponding prototypes are in jsonapi.h.  
  
This seems like a logical division, because the JSON lexer and parser  
are also used by the 'jsonb' data type, but the SQL-callable functions  
in json.c are a separate thing. Also, the new jsonapi.c file needs to  
include far fewer header files than json.c, which seems like a good  
sign that this is an appropriate place to insert an abstraction  
boundary. I took the opportunity to remove a few apparently-unneeded  
includes from json.c at the same time.  
  
Patch by me, reviewed by David Steele, Mark Dilger, and Andrew  
Dunstan. The previous commit was, too, but I forgot to note it  
in the commit message.  
  
Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com  

M src/backend/utils/adt/Makefile
M src/backend/utils/adt/json.c
A src/backend/utils/adt/jsonapi.c
M src/include/utils/jsonapi.h

Adjust src/include/utils/jsonapi.h so it's not backend-only.

commit   : ce0425b162d0a8c168e1fbab5324fb1cbca4b6b7    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 24 Jan 2020 09:58:37 -0800    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 24 Jan 2020 09:58:37 -0800    

Click here for diff

The major change here is that we no longer include jsonb.h into  
jsonapi.h. The reason that was necessary is that jsonapi.h included  
several prototypes functions in jsonfuncs.c that depend on the Jsonb  
type. Move those prototypes to a new header, jsonfuncs.h, and include  
it where needed.  
  
The other change is that JsonEncodeDateTime is now declared in  
json.h rather than jsonapi.h.  
  
Taken together, these steps eliminate all dependencies of jsonapi.h  
on backend-only data types and header files, so that it can  
potentially be included in frontend code.  

M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/json.h
M src/include/utils/jsonapi.h
A src/include/utils/jsonfuncs.h

Add pg_file_sync() to adminpack extension.

commit   : d694e0bb793ebd6b392e6ef6a3b0a59ae66cbc95    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 24 Jan 2020 20:42:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 24 Jan 2020 20:42:52 +0900    

Click here for diff

This function allows us to fsync the specified file or directory.  
It's useful, for example, when we want to sync the file that  
pg_file_write() writes out or that COPY TO exports the data into,  
for durability.  
  
Author: Fujii Masao  
Reviewed-By: Julien Rouhaud, Arthur Zakirov, Michael Paquier, Atsushi Torikoshi  
Discussion: https://www.postgresql.org/message-id/CAHGQGwGY8uzZ_k8dHRoW1zDcy1Z7=5GQ+So4ZkVy2u=nLsk=hA@mail.gmail.com  

M contrib/adminpack/Makefile
A contrib/adminpack/adminpack–2.0–2.1.sql
M contrib/adminpack/adminpack.c
M contrib/adminpack/adminpack.control
M contrib/adminpack/expected/adminpack.out
M contrib/adminpack/sql/adminpack.sql
M doc/src/sgml/adminpack.sgml
M src/backend/storage/file/fd.c
M src/include/storage/fd.h

Add exclusion to headercheck

commit   : cc25464763f0211e59a209eb50a7b7a79449051f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Jan 2020 12:23:06 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Jan 2020 12:23:06 +0100    

Click here for diff

src/include/common/unicode_combining_table.h is currently not meant to  
be included standalone.  Things could be refactored to allow it, but  
that would be beyond the present purpose.  So adding an exclusion here  
seems best.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Fix typo

commit   : a7a848844d74e63ee102717972de3e60b5f4549a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Jan 2020 10:27:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Jan 2020 10:27:49 +0100    

Click here for diff

M doc/src/sgml/ref/drop_foreign_table.sgml

Doc: Fix list of storage parameters available for ALTER TABLE

commit   : 6de7bcb76f6593dcd107a6bfed645f2142bf3225    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 Jan 2020 09:55:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 Jan 2020 09:55:21 +0900    

Click here for diff

Only the parameter parallel_workers can be used directly with ALTER  
TABLE.  
  
Issue introduced in 6f3a13f, so backpatch down to 10.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

Add configure probe for rl_completion_suppress_quote.

commit   : c32704441d47cc1cbb36367a429814511edb6ffd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Jan 2020 18:20:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Jan 2020 18:20:57 -0500    

Click here for diff

I had supposed that all versions of Readline that have filename  
quoting hooks also have the rl_completion_suppress_quote variable.  
But it seems OpenBSD managed to find a version someplace that does  
not, so we'll have to expend a separate configure probe for that.  
  
(Light testing suggests that this version also lacks the bugs that  
make it necessary to frob that variable.  Hooray!)  
  
Per buildfarm.  

M config/programs.m4
M configure
M src/bin/psql/tab-complete.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Fix an oversight in commit 4c70098ff.

commit   : 9a3a75cb81d3b060b8e76001d04c78ab4ce0dcef    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Jan 2020 16:15:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Jan 2020 16:15:32 -0500    

Click here for diff

I had supposed that the from_char_seq_search() call sites were  
all passing the constant arrays you'd expect them to pass ...  
but on looking closer, the one for DY format was passing the  
days[] array not days_short[].  This accidentally worked because  
the day abbreviations in English are all the same as the first  
three letters of the full day names.  However, once we took out  
the "maximum comparison length" logic, it stopped working.  
  
As penance for that oversight, add regression test cases covering  
this, as well as every other switch case in DCH_from_char() that  
was not reached according to the code coverage report.  
  
Also, fold the DCH_RM and DCH_rm cases into one --- now that  
seq_search is case independent, there's no need to pass different  
comparison arrays for those cases.  
  
Back-patch, as the previous commit was.  

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

Clean up formatting.c's logic for matching constant strings.

commit   : 4c70098ffa8cf19e79e7b124ccac05dd338c937b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Jan 2020 13:42:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Jan 2020 13:42:09 -0500    

Click here for diff

seq_search(), which is used to match input substrings to constants  
such as month and day names, had a lot of bizarre and unnecessary  
behaviors.  It was mostly possible to avert our eyes from that before,  
but we don't want to duplicate those behaviors in the upcoming patch  
to allow recognition of non-English month and day names.  So it's time  
to clean this up.  In particular:  
  
* seq_search scribbled on the input string, which is a pretty dangerous  
thing to do, especially in the badly underdocumented way it was done here.  
Fortunately the input string is a temporary copy, but that was being made  
three subroutine levels away, making it something easy to break  
accidentally.  The behavior is externally visible nonetheless, in the form  
of odd case-folding in error reports about unrecognized month/day names.  
The scribbling is evidently being done to save a few calls to pg_tolower,  
but that's such a cheap function (at least for ASCII data) that it's  
pretty pointless to worry about.  In HEAD I switched it to be  
pg_ascii_tolower to ensure it is cheap in all cases; but there are corner  
cases in Turkish where this'd change behavior, so leave it as pg_tolower  
in the back branches.  
  
* seq_search insisted on knowing the case form (all-upper, all-lower,  
or initcap) of the constant strings, so that it didn't have to case-fold  
them to perform case-insensitive comparisons.  This likewise seems like  
excessive micro-optimization, given that pg_tolower is certainly very  
cheap for ASCII data.  It seems unsafe to assume that we know the case  
form that will come out of pg_locale.c for localized month/day names, so  
it's better just to define the comparison rule as "downcase all strings  
before comparing".  (The choice between downcasing and upcasing is  
arbitrary so far as English is concerned, but it might not be in other  
locales, so follow citext's lead here.)  
  
* seq_search also had a parameter that'd cause it to report a match  
after a maximum number of characters, even if the constant string were  
longer than that.  This was not actually used because no caller passed  
a value small enough to cut off a comparison.  Replicating that behavior  
for localized month/day names seems expensive as well as useless, so  
let's get rid of that too.  
  
* from_char_seq_search used the maximum-length parameter to truncate  
the input string in error reports about not finding a matching name.  
This leads to rather confusing reports in many cases.  Worse, it is  
outright dangerous if the input string isn't all-ASCII, because we  
risk truncating the string in the middle of a multibyte character.  
That'd lead either to delivering an illegible error message to the  
client, or to encoding-conversion failures that obscure the actual  
data problem.  Get rid of that in favor of truncating at whitespace  
if any (a suggestion due to Alvaro Herrera).  
  
In addition to fixing these things, I const-ified the input string  
pointers of DCH_from_char and its subroutines, to make sure there  
aren't any other scribbling-on-input problems.  
  
The risk of generating a badly-encoded error message seems like  
enough of a bug to justify back-patching, so patch all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/formatting.c
M src/test/regress/expected/horology.out

Improve psql's tab completion for filenames.

commit   : cd69ec66c88633c09bc9a984a7f0930e09c7c96e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Jan 2020 11:07:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Jan 2020 11:07:12 -0500    

Click here for diff

The Readline library contains a fair amount of knowledge about how to  
tab-complete filenames, but it turns out that that doesn't work too well  
unless we follow its expectation that we use its filename quoting hooks  
to quote and de-quote filenames.  We were trying to do such quote handling  
within complete_from_files(), and that's still what we have to do if we're  
using libedit, which lacks those hooks.  But for Readline, it works a lot  
better if we tell Readline that single-quote is a quoting character and  
then provide hooks that know the details of the quoting rules for SQL  
and psql meta-commands.  
  
Hence, resurrect the quoting hook functions that existed in the original  
version of tab-complete.c (and were disabled by commit f6689a328 because  
they "didn't work so well yet"), and whack on them until they do seem to  
work well.  
  
Notably, this fixes bug #16059 from Steven Winfield, who pointed out  
that the previous coding would strip quote marks from filenames in SQL  
COPY commands, even though they're syntactically necessary there.  
Now, we not only don't do that, but we'll add a quote mark when you  
tab-complete, even if you didn't type one.  
  
Getting this to work across a range of libedit versions (and, to a  
lesser extent, libreadline versions) was depressingly difficult.  
It will be interesting to see whether the new regression test cases  
pass everywhere in the buildfarm.  
  
Some future patch might try to handle quoted SQL identifiers with  
similar explicit quoting/dequoting logic, but that's for another day.  
  
Patch by me, reviewed by Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/programs.m4
M configure
M configure.in
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/tab-complete.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Doc: Fix and tweak documentation for ANALYZE reporting

commit   : 5ba40b62318e4d941497333b72d589420a48d82f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 Jan 2020 17:01:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 Jan 2020 17:01:46 +0900    

Click here for diff

The docs had some typos and grammar mistakes, and its indentation was  
inconsistent.  
  
Author: Amit Langote, Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Clarify some comments in vacuumlazy.c

commit   : f942dfb952aaccb0163564c86c0b7654b8512807    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 Jan 2020 15:56:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 Jan 2020 15:56:56 +0900    

Click here for diff

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

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

Add BRIN test case

commit   : 611ce856f5a862a291a05d148828208e1f4ed46b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 22 Jan 2020 18:35:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 22 Jan 2020 18:35:05 -0300    

Click here for diff

This test case was sketched in commit message 4c87010981f3 to explain an  
ancient bug; it translates to a coverage increase, so add it to the BRIN  
regression tests.  

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

Add GUC ignore_invalid_pages.

commit   : 41c184bc642b25f67fb1d8ee290f28805fa5a0b4    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 22 Jan 2020 11:56:34 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 22 Jan 2020 11:56:34 +0900    

Click here for diff

Detection of WAL records having references to invalid pages  
during recovery causes PostgreSQL to raise a PANIC-level error,  
aborting the recovery. Setting ignore_invalid_pages to on causes  
the system to ignore those WAL records (but still report a warning),  
and continue recovery. This behavior may cause crashes, data loss,  
propagate or hide corruption, or other serious problems.  
However, it may allow you to get past the PANIC-level error,  
to finish the recovery, and to cause the server to start up.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://www.postgresql.org/message-id/CAHGQGwHCK6f77yeZD4MHOnN+PaTf6XiJfEB+Ce7SksSHjeAWtg@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlogutils.c
M src/backend/utils/misc/guc.c

Fix the computation of max dead tuples during the vacuum.

commit   : 79a3efb84d09b1e98ad7bb2756fa570efb578d1d    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 22 Jan 2020 07:43:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 22 Jan 2020 07:43:51 +0530    

Click here for diff

In commit 40d964ec99, we changed the way memory is allocated for dead  
tuples but forgot to update the place where we compute the maximum  
number of dead tuples.  This could lead to invalid memory requests.  
  
Reported-by: Andres Freund  
Diagnosed-by: Andres Freund  
Author: Masahiko Sawada  
Reviewed-by: Amit Kapila and Dilip Kumar  
Discussion: https://postgr.es/m/[email protected]  

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

Fix concurrent indexing operations with temporary tables

commit   : a904abe2e284f570168839e52e18ef0b7f26179d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Jan 2020 09:49:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Jan 2020 09:49:18 +0900    

Click here for diff

Attempting to use CREATE INDEX, DROP INDEX or REINDEX with CONCURRENTLY  
on a temporary relation with ON COMMIT actions triggered unexpected  
errors because those operations use multiple transactions internally to  
complete their work.  Here is for example one confusing error when using  
ON COMMIT DELETE ROWS:  
ERROR:  index "foo" already contains data  
  
Issues related to temporary relations and concurrent indexing are fixed  
in this commit by enforcing the non-concurrent path to be taken for  
temporary relations even if using CONCURRENTLY, transparently to the  
user.  Using a non-concurrent path does not matter in practice as locks  
cannot be taken on a temporary relation by a session different than the  
one owning the relation, and the non-concurrent operation is more  
effective.  
  
The problem exists with REINDEX since v12 with the introduction of  
CONCURRENTLY, and with CREATE/DROP INDEX since CONCURRENTLY exists for  
those commands.  In all supported versions, this caused only confusing  
error messages to be generated.  Note that with REINDEX, it was also  
possible to issue a REINDEX CONCURRENTLY for a temporary relation owned  
by a different session, leading to a server crash.  
  
The idea to enforce transparently the non-concurrent code path for  
temporary relations comes originally from Andres Freund.  
  
Reported-by: Manuel Rigger  
Author: Michael Paquier, Heikki Linnakangas  
Reviewed-by: Andres Freund, Álvaro Herrera, Heikki Linnakangas  
Discussion: https://postgr.es/m/CA+u7OA6gP7YAeCguyseusYcc=uR8+ypjCcgDDCTzjQ+k6S9ksQ@mail.gmail.com  
Backpatch-through: 9.4  

M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/drop_index.sgml
M doc/src/sgml/ref/reindex.sgml
M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Clarify behavior of adding and altering a column in same ALTER command.

commit   : 9b9c5f279e8261ab90dc64559911d2578288b7e9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jan 2020 16:17:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jan 2020 16:17:21 -0500    

Click here for diff

The behavior of something like  
  
ALTER TABLE transactions  
  ADD COLUMN status varchar(30) DEFAULT 'old',  
  ALTER COLUMN status SET default 'current';  
  
is to fill existing table rows with 'old', not 'current'.  That's  
intentional and desirable for a couple of reasons:  
  
* It makes the behavior the same whether you merge the sub-commands  
into one ALTER command or give them separately;  
  
* If we applied the new default while filling the table, there would  
be no way to get the existing behavior in one SQL command.  
  
The same reasoning applies in cases that add a column and then  
manipulate its GENERATED/IDENTITY status in a second sub-command,  
since the generation expression is really just a kind of default.  
However, that wasn't very obvious (at least not to me; earlier in  
the referenced discussion thread I'd thought it was a bug to be  
fixed).  And it certainly wasn't documented.  
  
Hence, add documentation, code comments, and a test case to clarify  
that this behavior is all intentional.  
  
In passing, adjust ATExecAddColumn's defaults-related relkind check  
so that it matches up exactly with ATRewriteTables, instead of being  
effectively (though not literally) the negated inverse condition.  
The reasoning can be explained a lot more concisely that way, too  
(not to mention that the comment now matches the code, which it  
did not before).  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/test/regress/expected/identity.out
M src/test/regress/sql/identity.sql

Fix edge case leading to agg transitions skipping ExecAggTransReparent() calls.

commit   : affdde2e15d9df6e9736bbb7e7cd9d56049d2f5a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Jan 2020 23:26:51 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Jan 2020 23:26:51 -0800    

Click here for diff

The code checking whether an aggregate transition value needs to be  
reparented into the current context has always only compared the  
transition return value with the previous transition value by datum,  
i.e. without regard for NULLness.  This normally works, because when  
the transition function returns NULL (via fcinfo->isnull), it'll  
return a value that won't be the same as its input value.  
  
But there's no hard requirement that that's the case. And it turns  
out, it's possible to hit this case (see discussion or reproducers),  
leading to a non-null transition value not being reparented, followed  
by a crash caused by that.  
  
Instead of adding another comparison of NULLness, instead have  
ExecAggTransReparent() ensure that pergroup->transValue ends up as 0  
when the new transition value is NULL. That avoids having to add an  
additional branch to the much more common cases of the transition  
function returning the old transition value (which is a pointer in  
this case), and when the new value is different, but not NULL.  
  
In branches since 69c3936a149, also deduplicate the reparenting code  
between the expression evaluation based transitions, and the path for  
ordered aggregates.  
  
Reported-By: Teodor Sigaev, Nikita Glukhov  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, this issue has existed since at least 7.4  

M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeAgg.c

Add GUC variables for stat tracking and timeout as PGDLLIMPORT

commit   : 62c9b522311afd791fd92fe46a294f7e21f10540    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Jan 2020 13:46:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Jan 2020 13:46:39 +0900    

Click here for diff

This helps integration of extensions with Windows.  The following  
parameters are changed:  
- idle_in_transaction_session_timeout (9.6 and newer versions)  
- lock_timeout  
- statement_timeout  
- track_activities  
- track_counts  
- track_functions  
  
Author: Pascal Legrand  
Reviewed-by: Amit Kamila, Julien Rouhaud, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M src/include/pgstat.h
M src/include/storage/proc.h

Further tweaking of jsonb_set_lax().

commit   : 31f403e95fdf88338d3fc9c6af80fcf6d8241044    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Jan 2020 14:26:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Jan 2020 14:26:56 -0500    

Click here for diff

Some buildfarm members were still warning about this, because in  
9c679a08f I'd missed decorating one of the ereport() code paths  
with a dummy return.  
  
Also, adjust the error messages to be more in line with project  
style guide.  

M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/jsonb.out

Fix pg_dump's sigTermHandler() to use _exit() not exit().

commit   : cd23a2019c4b8da47905e91c8a841cadac978a32    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Jan 2020 12:57:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Jan 2020 12:57:17 -0500    

Click here for diff

sigTermHandler() tried to be careful to invoke only operations that  
are safe to do in a signal handler.  But for some reason we forgot  
that exit(3) is not among those, because it calls atexit handlers  
that might do various random things.  (pg_dump itself installs no  
atexit handlers, but e.g. OpenSSL does.)  That led to crashes or  
lockups when attempting to terminate a parallel dump or restore  
via a signal.  
  
Fix by calling _exit() instead.  
  
Per bug #16199 from Raúl Marín.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/parallel.c

Fix crash in BRIN inclusion op functions, due to missing datum copy.

commit   : 4c87010981f3a9a41751e5550f6eb889ab5667e8    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jan 2020 10:36:35 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 20 Jan 2020 10:36:35 +0200    

Click here for diff

The BRIN add_value() and union() functions need to make a longer-lived  
copy of the argument, if they want to store it in the BrinValues struct  
also passed as argument. The functions for the "inclusion operator  
classes" used with box, range and inet types didn't take into account  
that the union helper function might return its argument as is, without  
making a copy. Check for that case, and make a copy if necessary. That  
case arises at least with the range_union() function, when one of the  
arguments is an 'empty' range:  
  
CREATE TABLE brintest (n numrange);  
CREATE INDEX brinidx ON brintest USING brin (n);  
INSERT INTO brintest VALUES ('empty');  
INSERT INTO brintest VALUES (numrange(0, 2^1000::numeric));  
INSERT INTO brintest VALUES ('(-1, 0)');  
  
SELECT brin_desummarize_range('brinidx', 0);  
SELECT brin_summarize_range('brinidx', 0);  
  
Backpatch down to 9.5, where BRIN was introduced.  
  
Discussion: https://www.postgresql.org/message-id/e6e1d6eb-0a67-36aa-e779-bcca59167c14%40iki.fi  
Reviewed-by: Emre Hasegeli, Tom Lane, Alvaro Herrera  

M src/backend/access/brin/brin_inclusion.c

Allow vacuum command to process indexes in parallel.

commit   : 40d964ec997f64227bc0ff5e058dc4a5770a70a9    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 20 Jan 2020 07:57:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 20 Jan 2020 07:57:49 +0530    

Click here for diff

This feature allows the vacuum to leverage multiple CPUs in order to  
process indexes.  This enables us to perform index vacuuming and index  
cleanup with background workers.  This adds a PARALLEL option to VACUUM  
command where the user can specify the number of workers that can be used  
to perform the command which is limited by the number of indexes on a  
table.  Specifying zero as a number of workers will disable parallelism.  
This option can't be used with the FULL option.  
  
Each index is processed by at most one vacuum process.  Therefore parallel  
vacuum can be used when the table has at least two indexes.  
  
The parallel degree is either specified by the user or determined based on  
the number of indexes that the table has, and further limited by  
max_parallel_maintenance_workers.  The index can participate in parallel  
vacuum iff it's size is greater than min_parallel_index_scan_size.  
  
Author: Masahiko Sawada and Amit Kapila  
Reviewed-by: Dilip Kumar, Amit Kapila, Robert Haas, Tomas Vondra,  
Mahendra Singh and Sergei Kornilov  
Tested-by: Mahendra Singh and Prabhat Sahu  
Discussion:  
https://postgr.es/m/CAD21AoDTPMgzSkV4E3SFo1CH_x50bf5PqZFQf4jmqjk-C03BWg@mail.gmail.com  
https://postgr.es/m/CAA4eK1J-VoR9gzS5E75pcD-OH0mEyCdp8RihcwKrcuw7J-Q0+w@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/parallel.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/include/access/heapam.h
M src/include/access/parallel.h
M src/include/commands/vacuum.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql
M src/tools/pgindent/typedefs.list

Fix out-of-memory handling in ecpglib.

commit   : 44f1fc8df5dadbc5e80661660903aab4076d868f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Jan 2020 19:15:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Jan 2020 19:15:15 -0500    

Click here for diff

ecpg_build_params() would crash on a null pointer dereference if  
realloc() failed, due to updating the persistent "stmt" struct  
too aggressively.  (Even without the crash, this would've leaked  
the old storage that we were trying to realloc.)  
  
Per Coverity.  This seems to have been broken in commit 0cc050794,  
so back-patch into v12.  

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

Silence minor compiler warnings.

commit   : 9c679a08f0cdedcf7f084daea3cba6ae9c3cbced    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Jan 2020 16:04:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Jan 2020 16:04:36 -0500    

Click here for diff

Ensure that ClassifyUtilityCommandAsReadOnly() has defined behavior  
even if TransactionStmt.kind has a value that's not one of the  
declared values for its enum.  
  
Suppress warnings from compilers that don't know that elog(ERROR)  
doesn't return, in ClassifyUtilityCommandAsReadOnly() and  
jsonb_set_lax().  
  
Per Coverity and buildfarm.  

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

Remove separate files for the initial contents of pg_(sh)description

commit   : 7aaefadaac6452b2e813fae4ea531cb12d022531    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 19 Jan 2020 13:54:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 19 Jan 2020 13:54:58 +0200    

Click here for diff

This data was only in separate files because it was the most convenient  
way to handle it with a shell script. Now that we use a general-purpose  
programming language, it's easy to assemble the data into the same format  
as the rest of the catalogs and output it into postgres.bki. This allows  
removal of some special-purpose code from initdb.c.  
  
Discussion: https://www.postgresql.org/message-id/CACPNZCtVFtjHre6hg9dput0qRPp39pzuyA2A6BT8wdgrRy%2BQdA%40mail.gmail.com  
Author: John Naylor  

M src/backend/catalog/.gitignore
M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl
M src/bin/initdb/initdb.c
M src/tools/msvc/clean.bat

Doc: Improve description of connection strings with Percent-encoding

commit   : e0ed6817c0ee218a3681920807404603e042ff04    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 19 Jan 2020 18:55:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 19 Jan 2020 18:55:51 +0900    

Click here for diff

Clarify the description related to the use of characters which can be  
encoded, and add an example.  
  
Author: Jobin Augustine  
Reviewed-by: Peter Eisentraut, Alvaro Herrera, Heikki Linnakangas,  
Michael Paquier, Alex Shulgin  
Discussion: https://postgr.es/m/CANaTPsrYgSgE2fuj3=4x=Jmx1c+NgkEDzftNknZbrMuqL+aBhQ@mail.gmail.com  

M doc/src/sgml/libpq.sgml

Doc: rearrange the documentation of binary-string functions.

commit   : 34a0a81bfb388504deaa51b16a8bb531b827e519    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Jan 2020 17:51:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Jan 2020 17:51:03 -0500    

Click here for diff

Rather than intermixing the discussion of text-string and binary-string  
functions, make a clean break, moving all discussion of binary-string  
operations into section 9.5.  This involves some duplication of  
function descriptions between 9.4 and 9.5, but it seems cleaner on the  
whole since the individual descriptions are clearer (and on the other  
side of the coin, it gets rid of some duplicated descriptions, too).  
  
Move the convert*/encode/decode functions to a separate table, because  
they don't quite seem to fit under the heading of "binary string  
functions".  
  
Also provide full documentation of the textual formats supported by  
encode() and decode() (which was the original goal of this patch  
series, many moons ago).  
  
Also move the table of built-in encoding conversions out of section 9.4,  
where it no longer had any relevance whatsoever, and put it into section  
23.3 about character sets.  I chose to put both that and table 23.2  
(multibyte-translation-table) into a new <sect2> so as not to break up  
the flow of discussion in 23.3.3.  
  
Also do a bunch of minor copy-editing on the function descriptions  
in 9.4 and 9.5.  
  
Karl Pinc, reviewed by Fabien Coelho, further hacking by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml
M doc/src/sgml/func.sgml

Add GUC checks for ssl_min_protocol_version and ssl_max_protocol_version

commit   : 41aadeeb124ee5f8e7d154a16a74d53286882b74    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 18 Jan 2020 12:32:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 18 Jan 2020 12:32:43 +0900    

Click here for diff

Mixing incorrect bounds set in the SSL context leads to confusing error  
messages generated by OpenSSL which are hard to act on.  New checks are  
added within the GUC machinery to improve the user experience as they  
apply to any SSL implementation, not only OpenSSL, and doing the checks  
beforehand avoids the creation of a SSL during a reload (or startup)  
which we know will never be used anyway.  
  
Backpatch down to 12, as those parameters have been introduced by  
e73e67c.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/utils/misc/guc.c
M src/test/ssl/t/001_ssltests.pl

Avoid full scan of GIN indexes when possible

commit   : 4b754d6c16e16cc1a1adf12ab0f48603069a0efd    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 18 Jan 2020 01:11:39 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 18 Jan 2020 01:11:39 +0300    

Click here for diff

The strategy of GIN index scan is driven by opclass-specific extract_query  
method.  This method that needed search mode is GIN_SEARCH_MODE_ALL.  This  
mode means that matching tuple may contain none of extracted entries.  Simple  
example is '!term' tsquery, which doesn't need any term to exist in matching  
tsvector.  
  
In order to handle such scan key GIN calculates virtual entry, which contains  
all TIDs of all entries of attribute.  In fact this is full scan of index  
attribute.  And typically this is very slow, but allows to handle some queries  
correctly in GIN.  However, current algorithm calculate such virtual entry for  
each GIN_SEARCH_MODE_ALL scan key even if they are multiple for the same  
attribute.  This is clearly not optimal.  
  
This commit improves the situation by introduction of "exclude only" scan keys.  
Such scan keys are not capable to return set of matching TIDs.  Instead, they  
are capable only to filter TIDs produced by normal scan keys.  Therefore,  
each attribute should contain at least one normal scan key, while rest of them  
may be "exclude only" if search mode is GIN_SEARCH_MODE_ALL.  
  
The same optimization might be applied to the whole scan, not per-attribute.  
But that leads to NULL values elimination problem.  There is trade-off between  
multiple possible ways to do this.  We probably want to do this later using  
some cost-based decision algorithm.  
  
Discussion: https://postgr.es/m/CAOBaU_YGP5-BEt5Cc0%3DzMve92vocPzD%2BXiZgiZs1kjY0cj%3DXBg%40mail.gmail.com  
Author: Nikita Glukhov, Alexander Korotkov, Tom Lane, Julien Rouhaud  
Reviewed-by: Julien Rouhaud, Tomas Vondra, Tom Lane  

M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginscan.c
M src/backend/utils/adt/selfuncs.c
M src/include/access/gin_private.h
M src/test/regress/expected/gin.out
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/gin.sql
M src/test/regress/sql/tsearch.sql

Repair more failures with SubPlans in multi-row VALUES lists.

commit   : 41c6f9db25b5e3a8bb8afbb7d6715cff541fd41e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Jan 2020 16:17:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Jan 2020 16:17:17 -0500    

Click here for diff

Commit 9b63c13f0 turns out to have been fundamentally misguided:  
the parent node's subPlan list is by no means the only way in which  
a child SubPlan node can be hooked into the outer execution state.  
As shown in bug #16213 from Matt Jibson, we can also get short-lived  
tuple table slots added to the outer es_tupleTable list.  At this point  
I have little faith that there aren't other possible connections as  
well; the long time it took to notice this problem shows that this  
isn't a heavily-exercised situation.  
  
Therefore, revert that fix, returning to the coding that passed a  
NULL parent plan pointer down to the transiently-built subexpressions.  
That gives us a pretty good guarantee that they won't hook into the  
outer executor state in any way.  But then we need some other solution  
to make SubPlans work.  Adopt the solution speculated about in the  
previous commit's log message: do expression initialization at plan  
startup for just those VALUES rows containing SubPlans, abandoning the  
goal of reclaiming memory intra-query for those rows.  In practice it  
seems unlikely that queries containing a vast number of VALUES rows  
would be using SubPlans in them, so this should not give up much.  
  
(BTW, this test case also refutes my claim in connection with the prior  
commit that the issue only arises with use of LATERAL.  That was just  
wrong: some variants of SubLink always produce SubPlans.)  
  
As with previous patch, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeValuesscan.c
M src/include/nodes/execnodes.h
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Set ReorderBufferTXN->final_lsn more eagerly

commit   : 15cac3a523cc06dba1331635f3f67445fa202a44    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 17 Jan 2020 18:00:39 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 17 Jan 2020 18:00:39 -0300    

Click here for diff

... specifically, set it incrementally as each individual change is  
spilled down to disk.  This way, it is set correctly when the  
transaction disappears without trace, ie. without leaving an XACT_ABORT  
wal record.  (This happens when the server crashes midway through a  
transaction.)  
  
Failing to have final_lsn prevents ReorderBufferRestoreCleanup() from  
working, since it needs the final_lsn in order to know the endpoint of  
its iteration through spilled files.  
  
Commit df9f682c7bf8 already tried to fix the problem, but it didn't set  
the final_lsn in all cases.  Revert that, since it's no longer needed.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila, Dilip Kumar  
Discussion: https://postgr.es/m/CALDaNm2CLk+K9JDwjYST0sPbGg5AQdvhUt0jbKyX_HdAE0jk3A@mail.gmail.com  

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

Allocate freechunks bitmap as part of SlabContext

commit   : 543852fd8bf0adc56192aeb25ff83f1a12c30368    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 17 Jan 2020 14:06:28 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 17 Jan 2020 14:06:28 +0100    

Click here for diff

The bitmap used by SlabCheck to cross-check free chunks in a block used  
to be allocated for each SlabCheck call, and was never freed. The memory  
leak could be fixed by simply adding a pfree call, but it's actually a  
bad idea to do any allocations in SlabCheck at all as it assumes the  
state of the memory management as a whole is sane.  
  
So instead we allocate the bitmap as part of SlabContext, which means  
we don't need to do any allocations in SlabCheck and the bitmap goes  
away together with the SlabContext.  
  
Backpatch to 10, where the Slab context was introduced.  
  
Author: Tomas Vondra  
Reported-by: Andres Freund  
Reviewed-by: Tom Lane  
Backpatch-through: 10  
Discussion: https://www.postgresql.org/message-id/20200116044119.g45f7pmgz4jmodxj%40alap3.anarazel.de  

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

bump catalog version as should have been done for jsonb_set_lax

commit   : 4b0e0f67f2f16c077b4e5c8a3d70c6af4355db09    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jan 2020 16:24:13 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jan 2020 16:24:13 +1030    

Click here for diff

M src/include/catalog/catversion.h

Add a non-strict version of jsonb_set

commit   : a83586b5543b948f9e621462537a7303b113c482    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jan 2020 11:41:35 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 17 Jan 2020 11:41:35 +1030    

Click here for diff

jsonb_set_lax() is the same as jsonb_set, except that it takes and extra  
argument that specifies what to do if the value argument is NULL. The  
default is 'use_json_null'. Other possibilities are 'raise_exception',  
'return_target' and 'delete_key', all these behaviours having been  
suggested as reasonable by various users.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Reviewed by: Pavel Stehule  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

Move OpenSSL routines for min/max protocol setting to src/common/

commit   : f7cd5896a69621818189fbdd209fb2e1fc008102    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Jan 2020 10:06:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Jan 2020 10:06:17 +0900    

Click here for diff

Two routines have been added in OpenSSL 1.1.0 to set the protocol bounds  
allowed within a given SSL context:  
- SSL_CTX_set_min_proto_version  
- SSL_CTX_set_max_proto_version  
  
As Postgres supports OpenSSL down to 1.0.1 (as of HEAD), equivalent  
replacements exist in the tree, which are only available for the  
backend.  A follow-up patch is planned to add control of the SSL  
protocol bounds for libpq, so move those routines to src/common/ so as  
libpq can use them.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-openssl.c
M src/common/Makefile
A src/common/protocol_openssl.c
A src/include/common/openssl.h
M src/tools/msvc/Mkvcbuild.pm

Rationalize code placement between wchar.c, encnames.c, and mbutils.c.

commit   : 5afaa2e42655811461044c4216e2f821cadc766d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jan 2020 18:08:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jan 2020 18:08:21 -0500    

Click here for diff

Move all the backend-only code that'd crept into wchar.c and encnames.c  
into mbutils.c.  
  
To remove the last few #ifdef dependencies from wchar.c and encnames.c,  
also make the following changes:  
  
* Adjust get_encoding_name_for_icu to return NULL, not throw an error,  
for unsupported encodings.  Its sole caller can perfectly well throw an  
error instead.  (While at it, I also made this function and its sibling  
is_encoding_supported_by_icu proof against out-of-range encoding IDs.)  
  
* Remove the overlength-name error condition from pg_char_to_encoding.  
It's completely silly not to treat that just like any other  
the-name-is-not-in-the-table case.  
  
Also, get rid of pg_mic_mblen --- there's no obvious reason why  
conv.c shouldn't call pg_mule_mblen instead.  
  
Other than that, this is just code movement and comment-polishing with  
no functional changes.  Notably, I reordered declarations in pg_wchar.h  
to show which functions are frontend-accessible and which are not.  
  
Discussion: https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com  

M src/backend/utils/adt/pg_locale.c
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/mbutils.c
M src/common/encnames.c
M src/common/wchar.c
M src/include/mb/pg_wchar.h

Update header comments for wchar.c and encnames.c.

commit   : 3d4cb5d6c180e38ebf84f6403cfa18c09d0b738e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jan 2020 15:58:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jan 2020 15:58:24 -0500    

Click here for diff

Bring these into common style (including having proper copyright  
notices) and adjust their self-declaration of where they live.  
  
Discussion: https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com  

M src/common/encnames.c
M src/common/wchar.c

Move wchar.c and encnames.c to src/common/.

commit   : e6afa8918c461c1dd80c5063a950518fa4e950cd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jan 2020 15:56:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jan 2020 15:56:32 -0500    

Click here for diff

Formerly, various frontend directories symlinked these two sources  
and then built them locally.  That's an ancient, ugly hack, and  
we now have a much better way: put them into libpgcommon.  
So do that.  (The immediate motivation for this is the prospect  
of having to introduce still more symlinking if we don't.)  
  
This commit moves these two files absolutely verbatim, for ease of  
reviewing the git history.  There's some follow-on work to be done  
that will modify them a bit.  
  
Robert Haas, Tom Lane  
  
Discussion: https://postgr.es/m/CA+TgmoYO8oq-iy8E02rD8eX25T-9SmyxKWqqks5OMHxKvGXpXQ@mail.gmail.com  

M src/backend/utils/mb/Makefile
M src/backend/utils/mb/README
M src/bin/initdb/.gitignore
M src/bin/initdb/Makefile
M src/common/Makefile
R100 src/backend/utils/mb/encnames.c src/common/encnames.c
M src/common/saslprep.c
R100 src/backend/utils/mb/wchar.c src/common/wchar.c
M src/include/mb/pg_wchar.h
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Fix problems with "read only query" checks, and refactor the code.

commit   : 2eb34ac369741c110b593e2dc2195c57d29ab8e8    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 Jan 2020 12:11:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 Jan 2020 12:11:31 -0500    

Click here for diff

Previously, check_xact_readonly() was responsible for determining  
which types of queries could not be run in a read-only transaction,  
standard_ProcessUtility() was responsibility for prohibiting things  
which were allowed in read only transactions but not in recovery, and  
utility commands were basically prohibited in bulk in parallel mode by  
calls to CommandIsReadOnly() in functions.c and spi.c.  This situation  
was confusing and error-prone. Accordingly, move all the checks to a  
new function ClassifyUtilityCommandAsReadOnly(), which determines the  
degree to which a given statement is read only.  
  
In the old code, check_xact_readonly() inadvertently failed to handle  
several statement types that actually should have been prohibited,  
specifically T_CreatePolicyStmt, T_AlterPolicyStmt, T_CreateAmStmt,  
T_CreateStatsStmt, T_AlterStatsStmt, and T_AlterCollationStmt.  As a  
result, thes statements were erroneously allowed in read only  
transactions, parallel queries, and standby operation. Generally, they  
would fail anyway due to some lower-level error check, but we  
shouldn't rely on that.  In the new code structure, future omissions  
of this type should cause ClassifyUtilityCommandAsReadOnly() to  
complain about an unrecognized node type.  
  
As a fringe benefit, this means we can allow certain types of utility  
commands in parallel mode, where it's safe to do so. This allows  
ALTER SYSTEM, CALL, DO, CHECKPOINT, COPY FROM, EXPLAIN, and SHOW.  
It might be possible to allow additional commands with more work  
and thought.  
  
Along the way, document the thinking process behind the current set  
of checks, as per discussion especially with Peter Eisentraut. There  
is some interest in revising some of these rules, but that seems  
like a job for another patch.  
  
Patch by me, reviewed by Tom Lane, Stephen Frost, and Peter  
Eisentraut.  
  
Discussion: http://postgr.es/m/CA+TgmoZ_rLqJt5sYkvh+JpQnfX0Y+B2R+qfi820xNih6x-FQOQ@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/commands/lockcmds.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/tcop/utility.c
M src/include/tcop/utility.h

Minor code beautification in regexp.c.

commit   : 0db7c67051806f28a9129d50695efc19372d3af2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Jan 2020 11:31:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Jan 2020 11:31:30 -0500    

Click here for diff

Remove duplicated code (apparently introduced by commit c8ea87e4b).  
Also get rid of some PG_USED_FOR_ASSERTS_ONLY variables we don't  
really need to have.  
  
Li Japin, Tom Lane  
  
Discussion: https://postgr.es/m/PS1PR0601MB3770A5595B6E5E3FD6F35724B6360@PS1PR0601MB3770.apcprd06.prod.outlook.com  

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

Restructure ALTER TABLE execution to fix assorted bugs.

commit   : 1281a5c907b41e992a66deb13c3aa61888a62268    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Jan 2020 18:49:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Jan 2020 18:49:24 -0500    

Click here for diff

We've had numerous bug reports about how (1) IF NOT EXISTS clauses in  
ALTER TABLE don't behave as-expected, and (2) combining certain actions  
into one ALTER TABLE doesn't work, though executing the same actions as  
separate statements does.  This patch cleans up all of the cases so far  
reported from the field, though there are still some oddities associated  
with identity columns.  
  
The core problem behind all of these bugs is that we do parse analysis  
of ALTER TABLE subcommands too soon, before starting execution of the  
statement.  The root of the bugs in group (1) is that parse analysis  
schedules derived commands (such as a CREATE SEQUENCE for a serial  
column) before it's known whether the IF NOT EXISTS clause should cause  
a subcommand to be skipped.  The root of the bugs in group (2) is that  
earlier subcommands may change the catalog state that later subcommands  
need to be parsed against.  
  
Hence, postpone parse analysis of ALTER TABLE's subcommands, and do  
that one subcommand at a time, during "phase 2" of ALTER TABLE which  
is the phase that does catalog rewrites.  Thus the catalog effects  
of earlier subcommands are already visible when we analyze later ones.  
(The sole exception is that we do parse analysis for ALTER COLUMN TYPE  
subcommands during phase 1, so that their USING expressions can be  
parsed against the table's original state, which is what we need.  
Arguably, these bugs stem from falsely concluding that because ALTER  
COLUMN TYPE must do early parse analysis, every other command subtype  
can too.)  
  
This means that ALTER TABLE itself must deal with execution of any  
non-ALTER-TABLE derived statements that are generated by parse analysis.  
Add a suitable entry point to utility.c to accept those recursive  
calls, and create a struct to pass through the information needed by  
the recursive call, rather than making the argument lists of  
AlterTable() and friends even longer.  
  
Getting this to work correctly required a little bit of fiddling  
with the subcommand pass structure, in particular breaking up  
AT_PASS_ADD_CONSTR into multiple passes.  But otherwise it's mostly  
a pretty straightforward application of the above ideas.  
  
Fixing the residual issues for identity columns requires refactoring of  
where the dependency link from an identity column to its sequence gets  
set up.  So that seems like suitable material for a separate patch,  
especially since this one is pretty big already.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/include/commands/tablecmds.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_utilcmd.h
M src/include/tcop/utility.h
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/identity.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/identity.sql

Report progress of ANALYZE commands

commit   : a166d408eb0b35023c169e765f4664c3b114b52e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 15 Jan 2020 11:02:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 15 Jan 2020 11:02:09 -0300    

Click here for diff

This uses the progress reporting infrastructure added by c16dc1aca5e0,  
adding support for ANALYZE.  
  
Co-authored-by: Álvaro Herrera <[email protected]>  
Co-authored-by: Tatsuro Yamada <[email protected]>  
Reviewed-by: Julien Rouhaud, Robert Haas, Anthony Nowocien, Kyotaro Horiguchi,  
	Vignesh C, Amit Langote  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/analyze.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/sampling.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/include/pgstat.h
M src/include/utils/sampling.h
M src/test/regress/expected/rules.out

Remove libpq.rc, use win32ver.rc for libpq

commit   : 16a4a3d59cd5574fdc697ea16ef5692ce34c54d5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Jan 2020 10:15:06 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Jan 2020 10:15:06 +0100    

Click here for diff

For historical reasons, libpq used a separate libpq.rc file for the  
Windows builds while all other components use a common file  
win32ver.rc.  With a bit of tweaking, the libpq build can also use the  
win32ver.rc file.  This removes a bit of duplicative code.  
  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pgevent/Makefile
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
D src/interfaces/libpq/libpq.rc.in
M src/makefiles/Makefile.win32
M src/port/win32ver.rc
M src/tools/copyright.pl
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat
M src/tools/version_stamp.pl

Fix buggy logic in isTempNamespaceInUse()

commit   : ac5bdf62617507b1942f6124a2696c04a16fca04    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Jan 2020 13:58:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Jan 2020 13:58:33 +0900    

Click here for diff

The logic introduced in this routine as of 246a6c8 would report an  
incorrect result when a session calls it to check if the temporary  
namespace owned by the session is in use or not.  It is possible to  
optimize more the routine in this case to avoid a PGPROC lookup, but  
let's keep the logic simple.  As this routine is used only by autovacuum  
for now, there were no live bugs, still let's be correct for any future  
code involving it.  
  
Author: Michael Paquier  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/catalog/namespace.c

Introduce IndexAM fields for parallel vacuum.

commit   : 4d8a8d0c738410ec02aab46b1ebe1835365ad384    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 15 Jan 2020 07:24:14 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 15 Jan 2020 07:24:14 +0530    

Click here for diff

Introduce new fields amusemaintenanceworkmem and amparallelvacuumoptions  
in IndexAmRoutine for parallel vacuum.  The amusemaintenanceworkmem tells  
whether a particular IndexAM uses maintenance_work_mem or not.  This will  
help in controlling the memory used by individual workers as otherwise,  
each worker can consume memory equal to maintenance_work_mem.  The  
amparallelvacuumoptions tell whether a particular IndexAM participates in  
a parallel vacuum and if so in which phase (bulkdelete, vacuumcleanup) of  
vacuum.  
  
Author: Masahiko Sawada and Amit Kapila  
Reviewed-by: Dilip Kumar, Amit Kapila, Tomas Vondra and Robert Haas  
Discussion:  
https://postgr.es/m/CAD21AoDTPMgzSkV4E3SFo1CH_x50bf5PqZFQf4jmqjk-C03BWg@mail.gmail.com  
https://postgr.es/m/CAA4eK1LmcD5aPogzwim5Nn58Ki+74a6Edghx4Wd8hAskvHaq5A@mail.gmail.com  

M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/include/access/amapi.h
M src/include/commands/vacuum.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Fix compiler warning about format on Windows

commit   : fe233366f2e3ca44609c805ce0604c1e2122c3f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Jan 2020 23:59:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Jan 2020 23:59:18 +0100    

Click here for diff

On 64-bit Windows, pid_t is long long int, so a %d format isn't  
enough.  

M src/backend/replication/walreceiver.c

docs: change "default role" wording to "predefined role"

commit   : 0e936a2148472e6c364aee8c3e298dc16dc4240a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 Jan 2020 13:13:04 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 Jan 2020 13:13:04 -0500    

Click here for diff

The new wording was determined to be more accurate.  Also, update  
release note links that reference these sections.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.6  

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

commit   : 344c26915136fa54c4a1bf54074ba15090b32721    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 Jan 2020 11:28:07 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 Jan 2020 11:28:07 -0500    

Click here for diff

This reverts part of commit 7559d8ebfa.  The copyright script has  
already been updated to skip *.key files.  
  
Reported-by: Alvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

M src/test/ssl/ssl/client-der.key
M src/test/ssl/ssl/client-encrypted-der.key

commit   : 7316f11be03863858fa7acb5eee97ec35c91fca4    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 Jan 2020 10:51:58 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 Jan 2020 10:51:58 -0500    

Click here for diff

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

M src/tools/copyright.pl

walreceiver uses a temporary replication slot by default

commit   : 329730827848f61eb8d353d5addcbd885fa823da    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Jan 2020 14:07:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Jan 2020 14:07:11 +0100    

Click here for diff

If no permanent replication slot is configured using  
primary_slot_name, the walreceiver now creates and uses a temporary  
replication slot.  A new setting wal_receiver_create_temp_slot can be  
used to disable this behavior, for example, if the remote instance is  
out of replication slots.  
  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CA%2Bfd4k4dM0iEPLxyVyme2RAFsn8SUgrNtBJOu81YqTY4V%2BnqZA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walreceiver.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/walreceiver.h

Expose PQbackendPID() through walreceiver API

commit   : ee4ac46c8eb289bc200d0fd682e75d11b4c55b5a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Jan 2020 14:05:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Jan 2020 14:05:25 +0100    

Click here for diff

This will be used by a subsequent patch.  
  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CA%2Bfd4k4dM0iEPLxyVyme2RAFsn8SUgrNtBJOu81YqTY4V%2BnqZA%40mail.gmail.com  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/include/replication/walreceiver.h

ALTER TABLE ... ALTER COLUMN ... DROP EXPRESSION

commit   : f595117e24a79db6072979ab5a757431fd17232f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Jan 2020 13:09:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Jan 2020 13:09:31 +0100    

Click here for diff

Add an ALTER TABLE subcommand for dropping the generated property from  
a column, per SQL standard.  
  
Reviewed-by: Sergei Kornilov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/2f7f1d9c-946e-0453-d841-4f38eb9d69b6%402ndquadrant.com  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/catalog/sql_features.txt
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Make rewriter prevent auto-updates on views with conditional INSTEAD rules.

commit   : d751ba523546df2b2709c1ffd4d12d6a25e25bf6    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 14 Jan 2020 09:52:21 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 14 Jan 2020 09:52:21 +0000    

Click here for diff

A view with conditional INSTEAD rules and no unconditional INSTEAD  
rules or INSTEAD OF triggers is not auto-updatable. Previously we  
relied on a check in the executor to catch this, but that's  
problematic since the planner may fail to properly handle such a query  
and thus return a particularly unhelpful error to the user, before  
reaching the executor check.  
  
Instead, trap this in the rewriter and report the correct error there.  
Doing so also allows us to include more useful error detail than the  
executor check can provide. This doesn't change the existing behaviour  
of updatable views; it merely ensures that useful error messages are  
reported when a view isn't updatable.  
  
Per report from Pengzhou Tang, though not adopting that suggested fix.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAG4reAQn+4xB6xHJqWdtE0ve_WqJkdyCV4P=trYr4Kn8_3_PEA@mail.gmail.com  

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

Revert test added by commit d207038053.

commit   : ed7bb5c311ce059294807cf4abfa9406d95feec0    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 11 Jan 2020 10:24:48 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 11 Jan 2020 10:24:48 +0530    

Click here for diff

This test was trying to test the mechanism to release kernel FDs as needed  
to get us under the max_safe_fds limit in case of spill files.  To do that,  
it needs to set max_files_per_process to a very low value which doesn't  
even permit starting of the server in the case when there are a few already  
opened files.  This test also won't work on platforms where we use one FD  
per semaphore.  
  
Backpatch-through: 10, till where this test was added  
Discussion:  
https://postgr.es/m/CAA4eK1LHhERi06Q+MmP9qBXBBboi+7WV3910J0aUgz71LcnKAw@mail.gmail.com  
https://postgr.es/m/[email protected]  

M src/test/recovery/t/006_logical_decoding.pl

Reduce size of backend scanner's tables.

commit   : 7f380c59f800f7e0fb49f45a6ff7787256851a59    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Jan 2020 15:04:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Jan 2020 15:04:31 -0500    

Click here for diff

Previously, the core scanner's yy_transition[] array had 37045 elements.  
Since that number is larger than INT16_MAX, Flex generated the array to  
contain 32-bit integers.  By reimplementing some of the bulkier scanner  
rules, this patch reduces the array to 20495 elements.  The much smaller  
total length, combined with the consequent use of 16-bit integers for  
the array elements reduces the binary size by over 200kB.  This was  
accomplished in two ways:  
  
1. Consolidate handling of quote continuations into a new start condition,  
rather than duplicating that logic for five different string types.  
  
2. Treat Unicode strings and identifiers followed by a UESCAPE sequence  
as three separate tokens, rather than one.  The logic to de-escape  
Unicode strings is moved to the filter code in parser.c, which already  
had the ability to provide special processing for token sequences.  
While we could have implemented the conversion in the grammar, that  
approach was rejected for performance and maintainability reasons.  
  
Performance in microbenchmarks of raw parsing seems equal or slightly  
faster in most cases, and it's reasonable to expect that in real-world  
usage (with more competition for the CPU cache) there will be a larger  
win.  The exception is UESCAPE sequences; lexing those is about 10%  
slower, primarily because the scanner now has to be called three times  
rather than one.  This seems acceptable since that feature is very  
rarely used.  
  
The psql and epcg lexers are likewise modified, primarily because we  
want to keep them all in sync.  Since those lexers don't use the  
space-hogging -CF option, the space savings is much less, but it's  
still good for perhaps 10kB apiece.  
  
While at it, merge the ecpg lexer's handling of C-style comments used  
in SQL and in C.  Those have different rules regarding nested comments,  
but since we already have the ability to keep track of the previous  
start condition, we can use that to handle both cases within a single  
start condition.  This matches the core scanner more closely.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CACPNZCvaoa3EgVWm5yZhcSTX6RAtaLgniCPcBVOCwm8h3xpWkw@mail.gmail.com  

M src/backend/parser/gram.y
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/include/fe_utils/psqlscan_int.h
M src/include/mb/pg_wchar.h
M src/include/parser/kwlist.h
M src/include/parser/scanner.h
M src/interfaces/ecpg/preproc/ecpg.tokens
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/expected/preproc-strings.c
M src/interfaces/ecpg/test/expected/preproc-strings.stderr
M src/pl/plpgsql/src/pl_gram.y
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

Fix base backup with database OIDs larger than INT32_MAX

commit   : 259bbe177808986e5d226ea7ce5a1ebb74657791    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Jan 2020 13:27:39 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Jan 2020 13:27:39 +0100    

Click here for diff

The use of pg_atoi() for parsing a string into an Oid fails for values  
larger than INT32_MAX, since OIDs are unsigned.  Instead, use  
atooid().  While this has less error checking, the contents of the  
data directory are expected to be trustworthy, so we don't need to go  
out of our way to do full error checking.  
  
Discussion: https://www.postgresql.org/message-id/flat/dea47fc8-6c89-a2b1-07e3-754ff1ab094b%402ndquadrant.com  

M src/backend/replication/basebackup.c

Fix typo.

commit   : 23d0dfa8fa016f7f8af25b1040d7a55ba77da6fc    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Jan 2020 14:44:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Jan 2020 14:44:55 +0530    

Click here for diff

Reported-by: Antonin Houska  
Author: Antonin Houska  
Backpatch-through: 11, where it was introduced  
Discussion: https://postgr.es/m/2246.1578900133@antos  

M src/include/access/session.h

Fix comment in heapam.c

commit   : 7689d907bbb177fa2a8f5aca3f968761dd16bf28    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Jan 2020 17:57:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Jan 2020 17:57:38 +0900    

Click here for diff

Improvement per suggestion from Tom Lane.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

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

Only superuser can set sslcert/sslkey in postgres_fdw user mappings

commit   : cebf9d6e6ee13cbf9f1a91ec633cf96780ffc985    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 13 Jan 2020 18:08:09 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 13 Jan 2020 18:08:09 +1030    

Click here for diff

Othrwise there is a security risk.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Delete empty pages in each pass during GIST VACUUM.

commit   : 4e514c6180fbf71cf7a0171867c828c63afd1c37    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Jan 2020 07:59:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Jan 2020 07:59:44 +0530    

Click here for diff

Earlier, we use to postpone deleting empty pages till the second stage of  
vacuum to amortize the cost of scanning internal pages.  However, that can  
sometimes (say vacuum is canceled or errored between first and second  
stage) delay the pages to be recycled.  
  
Another thing is that to facilitate deleting empty pages in the second  
stage, we need to share the information about internal and empty pages  
between different stages of vacuum.  It will be quite tricky to share this  
information via DSM which is required for the upcoming parallel vacuum  
patch.  
  
Also, it will bring the logic to reclaim deleted pages closer to nbtree  
where we delete empty pages in each pass.  
  
Overall, the advantages of deleting empty pages in each pass outweigh the  
advantages of postponing the same.  
  
Author: Dilip Kumar, with changes by Amit Kapila  
Reviewed-by: Sawada Masahiko and Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1LGr+MN0xHZpJ2dfS8QNQ1a_aROKowZB+MPNep8FVtwAA@mail.gmail.com  

M src/backend/access/gist/README
M src/backend/access/gist/gistvacuum.c

Apply multiple multivariate MCV lists when possible

commit   : eae056c19ee8f5ebc45ac0fe13181f91c8791e00    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 13 Jan 2020 01:20:57 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 13 Jan 2020 01:20:57 +0100    

Click here for diff

Until now we've only used a single multivariate MCV list per relation,  
covering the largest number of clauses. So for example given a query  
  
    SELECT * FROM t WHERE a = 1 AND b =1 AND c = 1 AND d = 1  
  
and extended statistics on (a,b) and (c,d), we'd only pick and use one  
of them. This commit improves this by repeatedly picking and applying  
the best statistics (matching the largest number of remaining clauses)  
until no additional statistics is applicable.  
  
This greedy algorithm is simple, but may not be optimal. A different  
choice of statistics may leave fewer clauses unestimated and/or give  
better estimates for some other reason.  
  
This can however happen only when there are overlapping statistics, and  
selecting one makes it impossible to use the other. E.g. with statistics  
on (a,b), (c,d), (b,c,d), we may pick either (a,b) and (c,d) or (b,c,d).  
But it's not clear which option is the best one.  
  
We however assume cases like this are rare, and the easiest solution is  
to define statistics covering the whole group of correlated columns. In  
the future we might support overlapping stats, using some of the clauses  
as conditions (in conditional probability sense).  
  
Author: Tomas Vondra  
Reviewed-by: Mark Dilger, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20191028152048.jc6pqv5hb7j77ocp@development  

M src/backend/statistics/extended_stats.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Apply all available functional dependencies

commit   : aaa6761876ba5b06a5c3fa914b2951ace1e31dee    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 13 Jan 2020 01:20:57 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 13 Jan 2020 01:20:57 +0100    

Click here for diff

When considering functional dependencies during selectivity estimation,  
it's not necessary to bother with selecting the best extended statistic  
object and then use just dependencies from it. We can simply consider  
all applicable functional dependencies at once.  
  
This means we need to deserialie all (applicable) dependencies before  
applying them to the clauses. This is a bit more expensive than picking  
the best statistics and deserializing dependencies for it. To minimize  
the additional cost, we ignore statistics that are not applicable.  
  
Author: Tomas Vondra  
Reviewed-by: Mark Dilger  
Discussion: https://postgr.es/m/20191028152048.jc6pqv5hb7j77ocp@development  

M src/backend/statistics/dependencies.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix edge-case crashes and misestimation in range containment selectivity.

commit   : 652686a334b437f57f9bd0e3baa5dbd245a9e15d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Jan 2020 14:36:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Jan 2020 14:36:59 -0500    

Click here for diff

When estimating the selectivity of "range_var <@ range_constant" or  
"range_var @> range_constant", if the upper (or respectively lower)  
bound of the range_constant was above the last bin of the range_var's  
histogram, the code would access uninitialized memory and potentially  
crash (though it seems the probability of a crash is quite low).  
Handle the endpoint cases explicitly to fix that.  
  
While at it, be more paranoid about the possibility of getting NaN  
or other silly results from the range type's subdiff function.  
And improve some comments.  
  
Ordinarily we'd probably add a regression test case demonstrating  
the bug in unpatched code.  But it's too hard to get it to crash  
reliably because of the uninitialized-memory dependence, so skip that.  
  
Per bug #16122 from Adam Scott.  It's been broken from the beginning,  
apparently, so backpatch to all supported branches.  
  
Diagnosis by Michael Paquier, patch by Andrey Borodin and Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove incorrect assertion for INSERT in logical replication's publisher

commit   : 1088729e84cc382270c592ac8c57c323836f40ca    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 12 Jan 2020 22:43:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 12 Jan 2020 22:43:45 +0900    

Click here for diff

On the publisher, it was assumed that an INSERT change cannot happen for  
a relation with no replica identity.  However this is true only for a  
change that needs references to old rows, aka UPDATE or DELETE, so  
trying to use logical replication with a relation that has no replica  
identity led to an assertion failure in the publisher when issuing an  
INSERT.  This commit removes the incorrect assertion, and adds more  
regression tests to provide coverage for relations without replica  
identity.  
  
Reported-by: Neha Sharma  
Author: Dilip Kumar, Michael Paquier  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CANiYTQsL1Hb8_Km08qd32svrqNumXLJeoGo014O7VZymgOhZEA@mail.gmail.com  
Backpatch-through: 10  

M src/backend/replication/logical/proto.c
M src/test/subscription/t/001_rep_changes.pl

Extensive code review for GSSAPI encryption mechanism.

commit   : 2c0cdc8183654c090c9a1e2f1b5e96ba4634e16a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Jan 2020 17:14:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Jan 2020 17:14:08 -0500    

Click here for diff

Fix assorted bugs in handling of non-blocking I/O when using GSSAPI  
encryption.  The encryption layer could return the wrong status  
information to its caller, resulting in effectively dropping some data  
(or possibly in aborting a not-broken connection), or in a "livelock"  
situation where data remains to be sent but the upper layers think  
transmission is done and just go to sleep.  There were multiple small  
thinkos contributing to that, as well as one big one (failure to think  
through what to do when a send fails after having already transmitted  
data).  Note that these errors could cause failures whether the client  
application asked for non-blocking I/O or not, since both libpq and  
the backend always run things in non-block mode at this level.  
  
Also get rid of use of static variables for GSSAPI inside libpq;  
that's entirely not okay given that multiple connections could be  
open at once inside a single client process.  
  
Also adjust a bunch of random small discrepancies between the frontend  
and backend versions of the send/receive functions -- except for error  
handling, they should be identical, and now they are.  
  
Also extend the Kerberos TAP tests to exercise cases where nontrivial  
amounts of data need to be pushed through encryption.  Before, those  
tests didn't provide any useful coverage at all for the cases of  
interest here.  (They still might not, depending on timing, but at  
least there's a chance.)  
  
Per complaint from pmc@citylink and subsequent investigation.  
Back-patch to v12 where this code was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-gssapi.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/t/001_auth.pl

Make lsn argument of walrcv_create_slot() optional

commit   : c67a55da4ea0caa18547fd1533110e9126ba8d47    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 11 Jan 2020 09:00:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 11 Jan 2020 09:00:19 +0100    

Click here for diff

Some callers are not using it, so it's wasteful to have to specify it.  
  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CA+fd4k4BcYrYucNfTnK-CQX3+jsG+PRPEhHAUSo-W4P0Lec57A@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Remove STATUS_FOUND

commit   : c096a804d9dcc46f1a8ebf2742696aca90b2dfcf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Dec 2019 09:09:20 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Dec 2019 09:09:20 +0100    

Click here for diff

Replace the solitary use with a bool.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/a6f91ead-0ce4-2a34-062b-7ab9813ea308%402ndquadrant.com  

M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/include/c.h
M src/include/storage/lock.h

Maintain valid md.c state when FileClose() fails.

commit   : 38fc056074e034087af8a1589507631682a279d1    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 10 Jan 2020 18:31:22 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 10 Jan 2020 18:31:22 -0800    

Click here for diff

FileClose() failure ordinarily causes a PANIC.  Suppose the user  
disables that PANIC via data_sync_retry=on.  After mdclose() issued a  
FileClose() that failed, calls into md.c raised SIGSEGV.  This fix adds  
repalloc() calls during mdclose(); update a comment about ignoring  
repalloc() cost.  The rate of relation segment count change is a minor  
factor; more relevant to overall performance is the rate of mdclose()  
and subsequent re-opening of segments.  Back-patch to v10, where commit  
45e191e3aa62d47a8bc1a33f784286b2051f45cb introduced the bug.  
  
Reviewed by Kyotaro Horiguchi.  
  
Discussion: https://postgr.es/m/[email protected]  

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

nbtree: Rename BT_HEAP_TID_ATTR.

commit   : 1a4a0329650b0545a54afb3c317aa289fd817f8a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 10 Jan 2020 13:15:28 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 10 Jan 2020 13:15:28 -0800    

Click here for diff

Author: Peter Geoghegan  
Reviewed-By: Heikki Linnakangas  

M src/include/access/nbtree.h

nbtree: BTREE_[MIN|NOVAC]_VERSION comment tweaks.

commit   : a0dc3c19ed1cffed6616f8b8b5f21ad7d6830045    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 10 Jan 2020 13:12:50 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 10 Jan 2020 13:12:50 -0800    

Click here for diff

Author: Peter Geoghegan  
Reviewed-By: Heikki Linnakangas  

M src/include/access/nbtree.h

Clean up representation of flags in struct ReorderBufferTXN

commit   : a7b6ab5db1d35438112f74f3531354ddd61970b5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 10 Jan 2020 17:46:57 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 10 Jan 2020 17:46:57 -0300    

Click here for diff

This simplifies addition of further flags.  
  
Author: Nikhil Sontakke  
Discussion: https://postgr.es/m/CAMGcDxeViP+R-OL7QhzUV9eKCVjURobuY1Zijik4Ay_Ddwo4Cg@mail.gmail.com  

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

doc: Fix naming of SELinux

commit   : 00b047fa67e9f4428a682bd90d5e6b08d2f8a87b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 Jan 2020 09:36:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 Jan 2020 09:36:55 +0900    

Click here for diff

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

M doc/src/sgml/ref/security_label.sgml
M src/test/modules/dummy_seclabel/README

pgbench: Make more debug messages use common logging API

commit   : 39a5f2a94f8a3bcfdb3da7391427a63f8f88b210    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 Jan 2020 09:02:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 Jan 2020 09:02:25 +0900    

Click here for diff

This is a follow-up of 30a3e772, making the output more consistent when  
using --debug for meta-command execution.  
  
Author: Michael Paquier  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1912241100390.3339@pseudo  

M src/bin/pgbench/pgbench.c

Skip tab-completion tests if envar SKIP_READLINE_TESTS is defined.

commit   : e7ee433137b6eb3678deeebc68be53d58aa1e5d3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jan 2020 16:46:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jan 2020 16:46:05 -0500    

Click here for diff

Experience so far suggests that getting these tests to pass on  
all libedit versions that are out there may be impossible, or  
require dumbing down the tests to the point of uselessness.  
So we need to provide a way to skip them when the user knows they'll  
fail.  An environment variable is probably the most convenient way  
to deal with this; it's easy for, e.g., a buildfarm animal's  
configuration to set up.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl

Reconsider the representation of join alias Vars.

commit   : 9ce77d75c5ab094637cc4a446296dc3be6e3c221    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Jan 2020 11:56:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Jan 2020 11:56:59 -0500    

Click here for diff

The core idea of this patch is to make the parser generate join alias  
Vars (that is, ones with varno pointing to a JOIN RTE) only when the  
alias Var is actually different from any raw join input, that is a type  
coercion and/or COALESCE is necessary to generate the join output value.  
Otherwise just generate varno/varattno pointing to the relevant join  
input column.  
  
In effect, this means that the planner's flatten_join_alias_vars()  
transformation is already done in the parser, for all cases except  
(a) columns that are merged by JOIN USING and are transformed in the  
process, and (b) whole-row join Vars.  In principle that would allow  
us to skip doing flatten_join_alias_vars() in many more queries than  
we do now, but we don't have quite enough infrastructure to know that  
we can do so --- in particular there's no cheap way to know whether  
there are any whole-row join Vars.  I'm not sure if it's worth the  
trouble to add a Query-level flag for that, and in any case it seems  
like fit material for a separate patch.  But even without skipping the  
work entirely, this should make flatten_join_alias_vars() faster,  
particularly where there are nested joins that it previously had to  
flatten recursively.  
  
An essential part of this change is to replace Var nodes'  
varnoold/varoattno fields with varnosyn/varattnosyn, which have  
considerably more tightly-defined meanings than the old fields: when  
they differ from varno/varattno, they identify the Var's position in  
an aliased JOIN RTE, and the join alias is what ruleutils.c should  
print for the Var.  This is necessary because the varno change  
destroyed ruleutils.c's ability to find the JOIN RTE from the Var's  
varno.  
  
Another way in which this change broke ruleutils.c is that it's no  
longer feasible to determine, from a JOIN RTE's joinaliasvars list,  
which join columns correspond to which columns of the join's immediate  
input relations.  (If those are sub-joins, the joinaliasvars entries  
may point to columns of their base relations, not the sub-joins.)  
But that was a horrid mess requiring a lot of fragile assumptions  
already, so let's just bite the bullet and add some more JOIN RTE  
fields to make it more straightforward to figure that out.  I added  
two integer-List fields containing the relevant column numbers from  
the left and right input rels, plus a count of how many merged columns  
there are.  
  
This patch depends on the ParseNamespaceColumn infrastructure that  
I added in commit 5815696bc.  The biggest bit of code change is  
restructuring transformFromClauseItem's handling of JOINs so that  
the ParseNamespaceColumn data is propagated upward correctly.  
  
Other than that and the ruleutils fixes, everything pretty much  
just works, though some processing is now inessential.  I grabbed  
two pieces of low-hanging fruit in that line:  
  
1. In find_expr_references, we don't need to recurse into join alias  
Vars anymore.  There aren't any except for references to merged USING  
columns, which are more properly handled when we scan the join's RTE.  
This change actually fixes an edge-case issue: we will now record a  
dependency on any type-coercion function present in a USING column's  
joinaliasvar, even if that join column has no references in the query  
text.  The odds of the missing dependency causing a problem seem quite  
small: you'd have to posit somebody dropping an implicit cast between  
two data types, without removing the types themselves, and then having  
a stored rule containing a whole-row Var for a join whose USING merge  
depends on that cast.  So I don't feel a great need to change this in  
the back branches.  But in theory this way is more correct.  
  
2. markRTEForSelectPriv and markTargetListOrigin don't need to recurse  
into join alias Vars either, because the cases they care about don't  
apply to alias Vars for USING columns that are semantically distinct  
from the underlying columns.  This removes the only case in which  
markVarForSelectPriv could be called with NULL for the RTE, so adjust  
the comments to describe that hack as being strictly internal to  
markRTEForSelectPriv.  
  
catversion bump required due to changes in stored rules.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/paramassign.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteManip.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/parse_relation.h

Add pg_shmem_allocations view.

commit   : ed10f32e37e9a16814c25e400d7826745ae3c797    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jan 2020 10:59:07 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jan 2020 10:59:07 -0500    

Click here for diff

This tells you about allocations that have been made from the main  
shared memory segment. The original patch also tried to show information  
about dynamic shared memory allocation as well, but I decided to  
leave that problem for another time.  
  
Andres Freund and Robert Haas, reviewed by Michael Paquier, Marti  
Raudsepp, Tom Lane, Álvaro Herrera, and Kyotaro Horiguchi.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/ipc/shmem.c
M src/include/catalog/pg_proc.dat
M src/include/storage/shmem.h
M src/test/regress/expected/rules.out

Remove bogus 'return'.

commit   : 5acf6d8bb4ec23349604c7c15111959e657ff294    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 9 Jan 2020 09:01:37 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 9 Jan 2020 09:01:37 -0500    

Click here for diff

Per the buildfarm, via Michael Paquier.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/include/access/tableam.h

Clarify that pg_trgm is used in example

commit   : e3019f631d1f2e21667ad05f903c52d904b9048c    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 9 Jan 2020 10:48:22 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 9 Jan 2020 10:48:22 +0100    

Click here for diff

Reported-by: Octopus ZHANG  
Author: Daniel Gustafsson  

M doc/src/sgml/rules.sgml

Add support for automatically updating Unicode derived files

commit   : f85a485f89e2eb38499558c7489f108994410952    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Jan 2020 09:54:47 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Jan 2020 09:54:47 +0100    

Click here for diff

We currently have several sets of files generated from data provided  
by Unicode.  These all have ad hoc rules and instructions for updating  
when new Unicode versions appear, and it's not done consistently.  
  
This patch centralizes and automates the process and makes it part of  
the release checklist.  The Unicode and CLDR versions are specified in  
Makefile.global.in.  There is a new make target "update-unicode" that  
downloads all the relevant files and runs the generation script.  
  
There is also a new script for generating the table of combining  
characters for ucs_wcwidth().  That table is now in a separate include  
file rather than hardcoded into the middle of other code.  This is  
based on the script that was used for generating  
d8594d123c155aeecd47fc2450f62f5100b2fbf0, but the script itself wasn't  
committed at that time.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M GNUmakefile.in
M contrib/unaccent/.gitignore
M contrib/unaccent/Makefile
M contrib/unaccent/generate_unaccent_rules.py
M src/Makefile.global.in
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/wchar.c
M src/common/unicode/.gitignore
M src/common/unicode/Makefile
M src/common/unicode/README
A src/common/unicode/generate-unicode_combining_table.pl
A src/include/common/unicode_combining_table.h
M src/tools/RELEASE_CHANGES

Allow 'sslkey' and 'sslcert' in postgres_fdw user mappings

commit   : f5fd995a1a24e6571d26b1e29c4dc179112b1003    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 9 Jan 2020 18:39:54 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 9 Jan 2020 18:39:54 +1030    

Click here for diff

This allows different users to authenticate with different certificates.  
  
Author: Craig Ringer  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Modernize Python exception syntax in tests

commit   : 45223fd9cefe483daa4af7740f15c004486636eb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Jan 2020 21:48:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Jan 2020 21:48:44 +0100    

Click here for diff

Change the exception syntax used in the tests to use the more current  
  
    except Exception as ex:  
  
rather than the old  
  
    except Exception, ex:  
  
Since support for Python <2.6 has been removed, all supported versions  
now support the new style, and we can save one step in the Python 3  
compatibility conversion.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com  

M src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/expected/plpython_error.out
M src/pl/plpython/expected/plpython_import.out
M src/pl/plpython/expected/plpython_params.out
M src/pl/plpython/expected/plpython_spi.out
M src/pl/plpython/expected/plpython_subtransaction.out
M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/regress-python3-mangle.mk
M src/pl/plpython/sql/plpython_ereport.sql
M src/pl/plpython/sql/plpython_error.sql
M src/pl/plpython/sql/plpython_import.sql
M src/pl/plpython/sql/plpython_params.sql
M src/pl/plpython/sql/plpython_spi.sql
M src/pl/plpython/sql/plpython_subtransaction.sql
M src/pl/plpython/sql/plpython_types.sql
M src/tools/msvc/vcregress.pl

Remove support for Python older than 2.6

commit   : 37f21ed132d1c5aee88e81fee0a0b7e735673d35    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Jan 2020 21:48:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Jan 2020 21:48:44 +0100    

Click here for diff

Supporting very old Python versions is a maintenance burden,  
especially with the several variant test files to maintain for Python  
<2.6.  
  
Since we have dropped support for older OpenSSL versions in  
7b283d0e1d1d79bf1c962d790c94d2a53f3bb38a, RHEL 5 is now effectively  
desupported, and that was also the only mainstream operating system  
still using Python versions before 2.6, so it's a good time to drop  
those as well.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com  

M config/python.m4
M configure
M doc/src/sgml/installation.sgml
M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/README
D src/pl/plpython/expected/plpython_error_0.out
M src/pl/plpython/expected/plpython_subtransaction.out
D src/pl/plpython/expected/plpython_subtransaction_0.out
D src/pl/plpython/expected/plpython_subtransaction_5.out
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpython.h
M src/pl/plpython/sql/plpython_subtransaction.sql

Reimplement nullification of walsender timestamp

commit   : f5d28710c707ad602cd869602e092cc9d538cbb9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 Jan 2020 14:33:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 Jan 2020 14:33:49 -0300    

Click here for diff

Make the value null only at pg_stat_activity-output time, as suggested  
by Tom Lane, instead of messing with the internal state.  This should  
appease buildfarm members with force_parallel_mode=regress, which are  
running parallel queries on logical replication walsenders.  
  
The fact that walsenders can run parallel queries should perhaps be  
studied more carefully, but for the moment let's get rid of the red  
blots in buildfarm.  
  
Backpatch to pg10, like the previous commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/utils/adt/pgstatfuncs.c

Improve the handling of result type coercions in SQL functions.

commit   : 913bbd88dc6b859c70ebb48107b38d693c4c6673    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Jan 2020 11:07:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Jan 2020 11:07:53 -0500    

Click here for diff

Use the parser's standard type coercion machinery to convert the  
output column(s) of a SQL function's final SELECT or RETURNING  
to the type(s) they should have according to the function's declared  
result type.  We'll allow any case where an assignment-level  
coercion is available.  Previously, we failed unless the required  
coercion was a binary-compatible one (and the documentation ignored  
this, falsely claiming that the types must match exactly).  
  
Notably, the coercion now accounts for typmods, so that cases where  
a SQL function is declared to return a composite type whose columns  
are typmod-constrained now behave as one would expect.  Arguably  
this aspect is a bug fix, but the overall behavioral change here  
seems too large to consider back-patching.  
  
A nice side-effect is that functions can now be inlined in a  
few cases where we previously failed to do so because of type  
mismatches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml
M src/backend/catalog/pg_proc.c
M src/backend/executor/functions.c
M src/backend/optimizer/util/clauses.c
M src/include/executor/functions.h
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/rangefuncs.sql

Improve GSSAPI Encryption startup comment in libpq

commit   : 8dd1511e39acd729020e151deb15a958300ebff5    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 8 Jan 2020 10:57:09 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 8 Jan 2020 10:57:09 -0500    

Click here for diff

The original comment was a bit confusing, pointed out by Alvaro Herrera.  
  
Thread: https://postgr.es/m/20191224151520.GA16435%40alvherre.pgsql  

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

Fix handling of generated columns in ALTER TABLE.

commit   : 4ac8aaa36fa24639989849c8109f8b52e9544fd1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Jan 2020 09:42:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Jan 2020 09:42:53 -0500    

Click here for diff

ALTER TABLE failed if a column referenced in a GENERATED expression  
had been added or changed in type earlier in the ALTER command.  
That's because the GENERATED expression needs to be evaluated  
against the table's updated tuples, but it was being evaluated  
against the original tuples.  (Fortunately the executor has adequate  
cross-checks to notice the mismatch, so we just got an obscure error  
message and not anything more dangerous.)  
  
Per report from Andreas Joseph Krogh.  Back-patch to v12 where  
GENERATED was added.  
  
Discussion: https://postgr.es/m/VisenaEmail.200.231b0a41523275d0.16ea7f800c7@tc7-visena  

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

pgbench: Use common logging API

commit   : 30a3e772b4013d6593e4141cebd5ebfaff4d71a8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Jan 2020 14:23:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Jan 2020 14:23:55 +0100    

Click here for diff

Author: Fabien COELHO <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1912241100390.3339@pseudo  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/002_pgbench_no_server.pl

Revert "Forbid DROP SCHEMA on temporary namespaces"

commit   : 65192e02441cedd106b6abebe0036fb8cc124fb3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Jan 2020 10:36:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Jan 2020 10:36:12 +0900    

Click here for diff

This reverts commit a052f6c, following complains from Robert Haas and  
Tom Lane.  Backpatch down to 9.4, like the previous commit.  
  
Discussion: https://postgr.es/m/CA+TgmobL4npEX5=E5h=5Jm_9mZun3MT39Kq2suJFVeamc9skSQ@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/commands/dropcmds.c

Remove dependency to system calls for memory allocation in refint

commit   : b0b6196386681383b8f0cb76df4fd35178a7371e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Jan 2020 10:02:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Jan 2020 10:02:55 +0900    

Click here for diff

Failures in allocations could lead to crashes with NULL pointer  
dereferences .  Memory context TopMemoryContext is used instead to keep  
alive the plans allocated in the session.  A more specific context could  
be used here, but this is left for later.  
  
Reported-by: Jian Zhang  
Author: Michael Paquier  
Reviewed-by: Tom Lane, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/spi/refint.c

pg_stat_activity: show NULL stmt start time for walsenders

commit   : b175bd59fa54a90d21bc541f812643ac45281b98    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jan 2020 17:38:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 7 Jan 2020 17:38:48 -0300    

Click here for diff

Returning a non-NULL time is pointless, sinc a walsender is not a  
process that would be running normal transactions anyway, but the code  
was unintentionally exposing the process start time intermittently,  
which was not only bogus but it also confused monitoring systems looking  
for idle transactions.  Fix by avoiding all updates in walsenders.  
  
Backpatch to 11, where walsenders started appearing in pg_stat_activity.  
  
Reported-by: Tomas Vondra  
Discussion: https://postgr.es/m/20191209234409.exe7osmyalwkt5j4@development  

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

tableam: New callback relation_fetch_toast_slice.

commit   : ce242ae154dde3217971c6f262705d80999f4e00    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jan 2020 14:35:48 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jan 2020 14:35:48 -0500    

Click here for diff

Instead of always calling heap_fetch_toast_slice during detoasting,  
invoke a table AM callback which, when the toast table is a heap  
table, will be heap_fetch_toast_slice.  
  
This makes it possible for a table AM other than heap to be used  
as a TOAST table. It also completes the series of commits intended  
to improve the interaction of tableam with TOAST that began with  
commit 8b94dab06617ef80a0901ab103ebd8754427ef5a; detoast.c is  
now, hopefully, fully AM-independent.  
  
Patch by me, reviewed by Andres Freund and Peter Eisentraut.  
  
Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com  

M src/backend/access/common/detoast.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heaptoast.c
M src/include/access/heaptoast.h
M src/include/access/tableam.h

tableam: Allow choice of toast AM.

commit   : 83322e38da1aa054e1b144cb37e6074a86854199    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jan 2020 14:23:25 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jan 2020 14:23:25 -0500    

Click here for diff

Previously, the toast table had to be implemented by the same AM that  
was used for the main table, which was bad, because the detoasting  
code won't work with anything but heap. This commit doesn't fix the  
latter problem, although there's another patch coming which does,  
but it does let you pick something that works (i.e. heap, right now).  
  
Patch by me, reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com  

M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/toasting.c
M src/include/access/tableam.h

Increase the maximum value of track_activity_query_size.

commit   : 814727858918154bdde9dbdfb99c544b52eb8818    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 7 Jan 2020 12:14:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 7 Jan 2020 12:14:19 -0500    

Click here for diff

This one-line change provoked a lot of discussion, but ultimately  
the consensus seems to be that allowing a larger value might be  
useful to somebody, and probably won't hurt anyone who chooses  
not to take advantage of the higher maximum limit.  
  
Vyacheslav Makarov, reviewed by many people.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Clean up management of IP addresses in our SSL tests.

commit   : 2bd0735b954b14dcfab85d57fc4a0c7f9826fbb1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Jan 2020 20:56:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Jan 2020 20:56:32 -0500    

Click here for diff

Instead of hard-wiring the netmask as /32, allow it to be specified  
where we specify the server address.  This will ease changing the  
test to use IPv6, when/if somebody wants to do that.  
  
Also remove the hard-wired pg_hba.conf entries for IPv6 (::1/128).  
These have never had any usefulness, because the client side  
of the tests has always explicitly connected to $SERVERHOSTADDR  
which has always been set to IPv4 (127.0.0.1).  All they accomplish  
is to break the test on non-IPv6-supporting hosts, and besides  
that they violate the express intent of the code to minimize the  
server's range of allowed connections.  
  
This could be back-patched, perhaps, but for now I don't see  
a need to.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/SSLServer.pm

Reduce the number of GetFlushRecPtr() calls done by walsenders.

commit   : e369f3708636c66718796fc8269d253432410392    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Jan 2020 16:42:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Jan 2020 16:42:20 -0500    

Click here for diff

Since the WAL flush position only moves forward, it's safe to cache  
its previous value within each walsender process, and update from  
shared memory only once we've caught up to the previously-seen value.  
When there are many active walsenders, this makes for a very significant  
reduction in the amount of contention on the XLogCtl->info_lck spinlock.  
  
This patch also adjusts the logic so that we update our idea of the  
flush position after processing a WAL record, rather than beforehand.  
This may cause us to realize we're not caught up when the preceding  
coding would've thought that we were, but that seems all to the good;  
it may avoid a useless sleep-and-wakeup cycle.  
  
Back-patch to v12.  The contention problem exists in prior branches,  
but it's much less severe (due to inefficiencies elsewhere) so there  
seems no need to take any risk of back-patching further.  
  
Pierre Ducroquet, reviewed by Julien Rouhaud  
  
Discussion: https://postgr.es/m/2931018.Vxl9zapr77@pierred-pdoc  

M src/backend/replication/walsender.c

Add functions min_scale(numeric) and trim_scale(numeric).

commit   : 20d6225d1656102534a73d9675bc531ff0e5203b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Jan 2020 12:13:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Jan 2020 12:13:53 -0500    

Click here for diff

These allow better control of trailing zeroes in numeric values.  
  
Pavel Stehule, based on an old proposal of Marko Tiikkaja's;  
review by Karl Pinc  
  
Discussion: https://postgr.es/m/CAFj8pRDjs-navGASeF0Wk74N36YGFJ+v=Ok9_knRa7vDc-qugg@mail.gmail.com  

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

Have logical replication subscriber fire column triggers

commit   : b9c130a1fdf16cd99afb390c186d19acaea7d132    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Jan 2020 08:21:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Jan 2020 08:21:14 +0100    

Click here for diff

The logical replication apply worker did not fire per-column update  
triggers because the updatedCols bitmap in the RTE was not populated.  
This fixes that.  
  
Reviewed-by: Euler Taveira <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/21673e2d-597c-6afe-637e-e8b10425b240%402ndquadrant.com  

M src/backend/replication/logical/worker.c
M src/test/subscription/t/003_constraints.pl

Remove support for OpenSSL 0.9.8 and 1.0.0

commit   : 7b283d0e1d1d79bf1c962d790c94d2a53f3bb38a    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Jan 2020 12:51:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Jan 2020 12:51:44 +0900    

Click here for diff

Support is out of scope from all the major vendors for these versions  
(for example RHEL5 uses a version based on 0.9.8, and RHEL6 uses 1.0.1),  
and it created some extra maintenance work.  Upstream has stopped  
support of 0.9.8 in December 2015 and of 1.0.0 in February 2016.  
  
Since b1abfec, note that the default SSL protocol version set with  
ssl_min_protocol_version is TLSv1.2, whose support was added in OpenSSL  
1.0.1, so there is no point to enforce ssl_min_protocol_version to TLSv1  
in the SSL tests.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml
M doc/src/sgml/libpq.sgml
M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/test/ssl/t/SSLServer.pm

Remove redundant incomplete split assertion.

commit   : fc3100112395485f1c65848b273b3235de4aad07    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 5 Jan 2020 17:42:13 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 5 Jan 2020 17:42:13 -0800    

Click here for diff

The fastpath insert optimization's incomplete split flag Assert() is  
redundant.  We'll reach the more general Assert() within  
_bt_findinsertloc() in all cases. (Besides, Assert()'ing that the  
rightmost page doesn't have the flag set never made much sense.)  

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

Minor style improvements for tab-completion test.

commit   : 8c081a2f4e8eec11747e709c1ea4c3485ef129dd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Jan 2020 11:35:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Jan 2020 11:35:45 -0500    

Click here for diff

Use qr// syntax for regex values.  
Include the regex that failed to match in diagnostic reports.  
  
Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl

Docs: use more standard terminology "round-to-nearest-even" instead of "round-to-even".

commit   : 955f1213012361e32d88976c3ce03ae62153c355    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sun, 5 Jan 2020 19:45:37 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sun, 5 Jan 2020 19:45:37 +0900    

Click here for diff

Per suggestion from Tom Lane.  
Discussion: https://postgr.es/m/flat/20191230.093451.1762483750956466101.t-ishii%40sraoss.co.jp  

M doc/src/sgml/datatype.sgml

Avoid reading ~/.inputrc in tab-completion test, and revert other changes.

commit   : 48e03583cd373ce67827f4d8a99dcef8242364b0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Jan 2020 21:33:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Jan 2020 21:33:34 -0500    

Click here for diff

The true explanation for Peter Geoghegan's trouble report turns out  
to be that he has a ~/.inputrc that affects readline's behavior  
enough to break this test.  Prevent readline from reading that file.  
  
Also, the best way to prevent TERM from affecting the results seems  
to be to unset it altogether, not to set it to "xterm".  The latter  
choice licenses readline to emit xterm escape sequences, and there's  
a lot of variation in exactly what it will emit.  
  
Revert changes that attempted to account exactly for xterm escape  
sequences.  We shouldn't need that with TERM unset, and it was not  
looking like a maintainable solution anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl

Don't try to force TERM to a fixed value in tab-completion test.

commit   : 7e42478186aa8b41a8706f3f53b44e25a427bde9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Jan 2020 16:40:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Jan 2020 16:40:56 -0500    

Click here for diff

Right at the moment, this is making things worse not better in the  
buildfarm.  I'm not happy with anything about the current state,  
but let's at least try to have a green buildfarm report while further  
investigation continues.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl

In tab-completion test, print out the value of TERM before changing it.

commit   : 60ab7c80b4de2c3591e50dfb5ed0fd4002f0f2f2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Jan 2020 15:05:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Jan 2020 15:05:24 -0500    

Click here for diff

I'm curious to see what values are prevailing in the buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl

Skip memcpy(x, x) in qunique().

commit   : 5b630501e9fa58c5069b36247d63fc460d912c7f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 4 Jan 2020 11:31:42 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 4 Jan 2020 11:31:42 -0800    

Click here for diff

It has undefined behavior.  Follow the precedent of commit  
9a9473f3cce1a21c25d6cc7569710e832d2b180b.  No back-patch, since the  
master branch alone has this function.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/lib/qunique.h

Make tab-completion tests more robust.

commit   : fac1c04feca6d01f2d324088c5899485f55b6217    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Jan 2020 14:29:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Jan 2020 14:29:28 -0500    

Click here for diff

Depending on as-yet-incompletely-explained factors, readline/libedit  
might choose to emit screen-control escape sequences as part of  
repainting the display.  I'd tried to make the test patterns avoid  
matching parts of the output that are likely to contain such, but  
it seems that there's really no way around matching them explicitly  
in some places, unless we want to just give up testing some behaviors  
such as display of alternatives.  
  
Per report from Peter Geoghegan.  
  
Discussion: https://postgr.es/m/CAH2-WznPzfWHu8PQwv1Qjpf4wQVPaaWpoO5NunFz9zsYKB4uJA@mail.gmail.com  

M src/bin/psql/t/010_tab_completion.pl

Make better use of ParseState in ProcessUtility

commit   : 3fd40b628c7db4c4bcf03b548f9a55f85e327e25    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 4 Jan 2020 11:56:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 4 Jan 2020 11:56:58 +0100    

Click here for diff

Pass ParseState into the functions called from  
standard_ProcessUtility() instead passing the query string and query  
environment separately.  No functionality change, but it makes the  
notation consistent.  We had already started moving things into  
that direction piece by piece, and this completes it.  
  
Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/tcop/utility.c
M src/include/commands/createas.h
M src/include/commands/explain.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h

Add xl_btree_delete optimization.

commit   : d2e5e20e57111cca9e14f6e5a99a186d4c66a5b7    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 3 Jan 2020 12:18:13 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 3 Jan 2020 12:18:13 -0800    

Click here for diff

Commit 558a9165e08 taught _bt_delitems_delete() to produce its own XID  
horizon on the primary.  Standbys no longer needed to generate their own  
latestRemovedXid, since they could just use the explicitly logged value  
from the primary instead.  The deleted offset numbers array from the  
xl_btree_delete WAL record was no longer used by the REDO routine for  
anything other than deleting the items.  
  
This enables a minor optimization:  We now treat the array as buffer  
state, not generic WAL data, following _bt_delitems_vacuum()'s example.  
This should be a minor win, since it allows us to avoid including the  
deleted items array in cases where XLogInsert() stores the whole buffer  
anyway.  The primary goal here is to make the code more maintainable,  
though.  Removing inessential differences between the two functions  
highlights the fundamental differences that remain.  
  
Also change xl_btree_delete to use uint32 for the size of the array of  
item offsets being deleted.  This brings xl_btree_delete closer to  
xl_btree_vacuum.  Furthermore, it seems like a good idea to use an  
explicit-width integer type (the field was previously an "int").  
  
Bump XLOG_PAGE_MAGIC because xl_btree_delete changed.  
  
Discussion: https://postgr.es/m/CAH2-Wzkz4TjmezzfAbaV1zYrh=fr0bCpzuJTvBe5iUQ3aUPsCQ@mail.gmail.com  

M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/xlog_internal.h

Further fixes for tab-completion TAP tests.

commit   : 56a3921a2f5102f804bd0ff741e144a0e6f1c0b6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jan 2020 12:54:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jan 2020 12:54:13 -0500    

Click here for diff

Escape non-printable characters in failure reports, by using Data::Dumper  
in Useqq mode.  Also, bump $Test::Builder::Level so the diagnostic  
references the calling line, and use diag() instad of note(),  
so it shows even in non-verbose mode (per request from Christoph Berg).  
  
Also, give up on trying to test for the specific way that readline  
chooses to overwrite existing text in the \DRD -> \drds test.  
There are too many variants, it seems, at least on the libedit  
side of things.  
  
Dagfinn Ilmari Mannsåker and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl

Add an ugly workaround for a bug in some recent libedit versions.

commit   : ddd87d564508bb1c80aac0a4439cfe74a3c203a9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jan 2020 11:15:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jan 2020 11:15:26 -0500    

Click here for diff

Debian unstable is shipping a broken version of libedit: it de-escapes  
words before passing them to the application's tab completion function,  
preventing us from recognizing backslash commands.  Fortunately,  
we have enough information available to dig the original text out of  
rl_line_buffer, so ignore the string argument and do that.  
  
I view this as a temporary workaround to get the affected buildfarm  
members back to green in the wake of 7c015045b.  I hope we can get  
rid of it once somebody fixes Debian's libedit; hence, no back-patch,  
at least for now.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pgbench: Improve test description

commit   : 04334fde69132f335d9d70cfefe419bd1276b232    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Jan 2020 10:44:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Jan 2020 10:44:13 +0100    

Click here for diff

Author: Fabien COELHO <[email protected]>  

M src/bin/pgbench/t/002_pgbench_no_server.pl

Fix typos in parallel query docs.

commit   : d5b6b6515b35b11c82ce620fa84c989f246068aa    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 3 Jan 2020 10:52:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 3 Jan 2020 10:52:46 +0530    

Click here for diff

Reported-by: Jon Jensen  
Author: Jon Jensen  
Reviewed-by: Amit Kapila and Robert Haas  
Backpatch-through: 10  
Discussion: https://postgr.es/m/nycvar.YSQ.7.76.1912301807510.9899@ybpnyubfg  

M doc/src/sgml/parallel.sgml

Clear up btree_xlog_split() alignment comment.

commit   : 0c41c83d8ff44ed8f9753885e2c11b3277babcce    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 2 Jan 2020 18:30:25 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 2 Jan 2020 18:30:25 -0800    

Click here for diff

Adjust a comment that describes how alignment of the new left page high  
key works in btree_xlog_split(), the nbtree page split REDO routine.  
The wording used before commit 2c03216d831 is much clearer, so go back  
to that.  

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

Minor portability fixes for new TAP script.

commit   : 90d7f6604b6ed2dcedee2884c3b01541600515cb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 19:44:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 19:44:43 -0500    

Click here for diff

Satisfy perlcritic, mostly.  Per buildfarm.  

M src/bin/psql/t/010_tab_completion.pl

Correct _bt_delitems_vacuum() lock comments.

commit   : 44e44bd258a71162444d41a1044c795f2c6dd3d1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 2 Jan 2020 13:30:40 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 2 Jan 2020 13:30:40 -0800    

Click here for diff

The expectation within _bt_delitems_vacuum() is that caller has a  
super-exclusive/cleanup buffer lock (not just a pin and a write lock).  

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

Fix cloning of row triggers to sub-partitions

commit   : 1fa846f1c9afe6bb185d4bb60bed8102a8eacb8f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 2 Jan 2020 17:04:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 2 Jan 2020 17:04:24 -0300    

Click here for diff

When row triggers exist in partitioned partitions that are not either  
part of FKs or deferred unique constraints, they are not correctly  
cloned to their partitions.  That's because they are marked "internal",  
and those are purposefully skipped when doing the clone triggers dance.  
Fix by relaxing the condition on which internal triggers are skipped.  
  
Amit Langote initially diagnosed the problem and proposed a fix, but I  
used a different approach.  
  
Reported-by: Petr Fedorov  
Discussion: https://postgr.es/m/[email protected]  

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

Add basic TAP tests for psql's tab-completion logic.

commit   : 7c015045b9141cc30272930ea88cfa5df47240b7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 15:02:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 15:02:21 -0500    

Click here for diff

Up to now, psql's tab-complete.c has had exactly no regression test  
coverage.  This patch is an experimental attempt to add some.  
  
This needs Perl's IO::Pty module, which isn't installed everywhere,  
so the test script just skips all tests if that's not present.  
There may be other portability gotchas too, so I await buildfarm  
results with interest.  
  
So far this just covers a few very basic keyword-completion and  
query-driven-completion scenarios, which should be enough to let us  
get a feel for whether this is practical at all from a portability  
standpoint.  If it is, there's lots more that can be done.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/Makefile.global.in
M src/bin/psql/.gitignore
M src/bin/psql/Makefile
A src/bin/psql/t/010_tab_completion.pl
M src/test/perl/PostgresNode.pm

Fix typmod exposed for scalar function in FROM, too.

commit   : 915c04f091f13dbbc0fde833e612dc90b70103ce    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 14:02:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 14:02:46 -0500    

Click here for diff

On further reflection about commit 4d02eb017, it occurs to me that  
expandRTE() had better agree with what addRangeTableEntryForFunction()  
is doing.  So teach that about functions possibly having typmods, too.  

M src/backend/parser/parse_relation.c

Reorder two nbtree.h function prototypes.

commit   : a412f469880ede9f52336a7b383905129c2b03a0    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 2 Jan 2020 10:57:15 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 2 Jan 2020 10:57:15 -0800    

Click here for diff

Make the function prototype order consistent with the definition order  
in nbtpage.c.  

M src/include/access/nbtree.h

Fix collation exposed for scalar function in FROM.

commit   : 4d02eb017e3c1268762fd1a10ec3c569515c047d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 13:48:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 13:48:54 -0500    

Click here for diff

One code path in addRangeTableEntryForFunction() neglected to assign  
a collation to the tupdesc entry it constructs (which is a bit odd  
considering the other path did do so).  This didn't matter before commit  
5815696bc, because nothing would look at the type data in this tupdesc;  
but now it does.  
  
While at it, make sure we assign the correct typmod as well.  Most  
function expressions don't have a determinate typmod, but some do.  
  
Per buildfarm, which showed failures in non-C collations, a case  
I'd not thought to test for this patch :-(  

M src/backend/parser/parse_relation.c

Make parser rely more heavily on the ParseNamespaceItem data structure.

commit   : 5815696bc66b3092f6361f53e0394909647042c8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 11:29:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Jan 2020 11:29:01 -0500    

Click here for diff

When I added the ParseNamespaceItem data structure (in commit 5ebaaa494),  
it wasn't very tightly integrated into the parser's APIs.  In the wake of  
adding p_rtindex to that struct (commit b541e9acc), there is a good reason  
to make more use of it: by passing around ParseNamespaceItem pointers  
instead of bare RTE pointers, we can get rid of various messy methods for  
passing back or deducing the rangetable index of an RTE during parsing.  
Hence, refactor the addRangeTableEntryXXX functions to build and return  
a ParseNamespaceItem struct, not just the RTE proper; and replace  
addRTEtoQuery with addNSItemToQuery, which is passed a ParseNamespaceItem  
rather than building one internally.  
  
Also, add per-column data (a ParseNamespaceColumn array) to each  
ParseNamespaceItem.  These arrays are built during addRangeTableEntryXXX,  
where we have column type data at hand so that it's nearly free to fill  
the data structure.  Later, when we need to build Vars referencing RTEs,  
we can use the ParseNamespaceColumn info to avoid the rather expensive  
operations done in get_rte_attribute_type() or expandRTE().  
get_rte_attribute_type() is indeed dead code now, so I've removed it.  
This makes for a useful improvement in parse analysis speed, around 20%  
in one moderately-complex test query.  
  
The ParseNamespaceColumn structs also include Var identity information  
(varno/varattno).  That info isn't actually being used in this patch,  
except that p_varno == 0 is a handy test for a dropped column.  
A follow-on patch will make more use of it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/copy.c
M src/backend/commands/policy.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/view.c
M src/backend/optimizer/plan/subselect.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/tablesync.c
M src/backend/rewrite/rewriteHandler.c
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h
M src/include/parser/parsetree.h
M src/test/modules/test_rls_hooks/test_rls_hooks.c

Fix comment in test

commit   : 198c7153dccb11950e3030dec564fdc6e59b4451    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Jan 2020 14:40:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Jan 2020 14:40:18 +0100    

Click here for diff

The comment was apparently copy-and-pasted and did not reflect the  
actual test outcome.  

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

Fix running out of file descriptors for spill files.

commit   : d207038053837ae9365df2776371632387f6f655    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 14 Dec 2019 11:41:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 14 Dec 2019 11:41:37 +0530    

Click here for diff

Currently while decoding changes, if the number of changes exceeds a  
certain threshold, we spill those to disk.  And this happens for each  
(sub)transaction.  Now, while reading all these files, we don't close them  
until we read all the files.  While reading these files, if the number of  
such files exceeds the maximum number of file descriptors, the operation  
errors out.  
  
Use PathNameOpenFile interface to open these files as that internally has  
the mechanism to release kernel FDs as needed to get us under the  
max_safe_fds limit.  
  
Reported-by: Amit Khandekar  
Author: Amit Khandekar  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/CAJ3gD9c-sECEn79zXw4yBnBdOttacoE-6gAyP0oy60nfs_sabQ@mail.gmail.com  

M src/backend/replication/logical/reorderbuffer.c
M src/test/recovery/t/006_logical_decoding.pl

Revise BTP_HAS_GARBAGE nbtree VACUUM comments.

commit   : 4b25f5d0ba0197af80e3af0de7441ca9c88c1e24    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 1 Jan 2020 17:29:41 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 1 Jan 2020 17:29:41 -0800    

Click here for diff

_bt_delitems_vacuum() comments claimed that it isn't worth another scan  
of the page to avoid falsely unsetting the BTP_HAS_GARBAGE page flag  
hint (this happens to be the same wording that was removed from  
_bt_delitems_delete() by my recent commit fe97c61c).  The comments made  
little sense, though.  The issue can't have much to do with performing a  
second scan of the target leaf page, since an LP_DEAD test could easily  
be performed in the first scan of the page anyway (the scan that takes  
place in btvacuumpage() caller).  
  
Revise the explanation.  It makes much more sense to frame this as an  
issue about recovery conflicts.  _bt_delitems_vacuum() cannot easily  
generate an XID cutoff in the same way that _bt_delitems_delete() is  
designed to.  
  
Falsely unsetting the page flag is not ideal, and is likely to happen  
more often than was supposed by the original comments.  Explain why it  
usually isn't a problem in practice.  There may be an argument for  
_bt_delitems_vacuum() not clearing the BTP_HAS_GARBAGE bit, removing the  
question of it being falsely unset by VACUUM (there may even be an  
argument for not using a page level hint at all).  This can be revisited  
later.  

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

Test GROUP BY matching of join columns that are type-coerced by USING.

commit   : 823e739d4a7257cf0ca58fc6eff3c4cec308fccf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Jan 2020 19:31:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Jan 2020 19:31:41 -0500    

Click here for diff

If we have, say, an int column that is left-joined to a bigint column  
with USING, the merged column is the int column promoted to bigint.  
GROUP BY's tests for whether grouping on the merged column allows a  
reference to the underlying column, or vice versa, should know about  
that relationship --- and they do.  But I nearly broke this case with  
an ill-advised optimization, so the lack of any test coverage for it  
seems like a bad idea.  

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

Update btree_xlog_delete() comments.

commit   : c5f3b53b0ef2e8ae78e7488148c12bfe5939ca17    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 1 Jan 2020 11:32:07 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 1 Jan 2020 11:32:07 -0800    

Click here for diff

Commit fe97c61c updated LP_DEAD item deletion comments, but missed a  
minor discrepancy on the REDO side.  Fix it now.  
  
In passing, don't talk about the btree_xlog_vacuum() behavior within  
btree_xlog_delete().  The reliance on XLOG_HEAP2_CLEANUP_INFO records  
for recovery conflicts is already discussed within btvacuumpage() and  
mentioned again in passing above btree_xlog_vacuum(), which seems  
sufficient.  

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

Update copyrights for 2020

commit   : 7559d8ebfa11d98728e816f6b655582ce41150f3    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 1 Jan 2020 12:21:45 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 1 Jan 2020 12:21:45 -0500    

Click here for diff

Backpatch-through: update all files in master, backpatch legal files through 9.4  

M COPYRIGHT
M configure
M configure.in
M contrib/adminpack/adminpack.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/dblink/dblink.c
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/intarray/_int_selfuncs.c
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgcrypto/imath.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/vacuumlo.c
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/attmap.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/detoast.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/table.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/access/table/toast_helper.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/lib/binaryheap.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/integerset.c
M src/backend/lib/knapsack.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/port/atomics.c
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashes.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/probes.d
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_config/Makefile
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/fetch.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/timeline.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgevent/Makefile
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/scripts_parallel.c
M src/bin/scripts/scripts_parallel.h
M src/bin/scripts/vacuumdb.c
M src/common/base64.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/d2s.c
M src/common/d2s_full_table.h
M src/common/d2s_intrinsics.h
M src/common/exec.c
M src/common/f2s.c
M src/common/fe_memutils.c
M src/common/file_perm.c
M src/common/file_utils.c
M src/common/ip.c
M src/common/keywords.c
M src/common/kwlookup.c
M src/common/link-canary.c
M src/common/logging.c
M src/common/md5.c
M src/common/pg_lzcompress.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/ryu_common.h
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha2.c
M src/common/sha2_openssl.c
M src/common/string.c
M src/common/stringinfo.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/norm_test.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/fe_utils/Makefile
M src/fe_utils/cancel.c
M src/fe_utils/conditional.c
M src/fe_utils/mbprint.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/recovery_gen.c
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attmap.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/detoast.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/heaptoast.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/sysattr.h
M src/include/access/table.h
M src/include/access/tableam.h
M src/include/access/timeline.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/access/tupmacs.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/Makefile
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/opfam_internal.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_pltemplate.dat
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/variable.h
M src/include/commands/view.h
M src/include/common/base64.h
M src/include/common/config_info.h
M src/include/common/controldata_utils.h
M src/include/common/fe_memutils.h
M src/include/common/file_perm.h
M src/include/common/file_utils.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/keywords.h
M src/include/common/kwlookup.h
M src/include/common/link-canary.h
M src/include/common/logging.h
M src/include/common/md5.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha2.h
M src/include/common/shortest_dec.h
M src/include/common/string.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_table.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/connect.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/integerset.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/qunique.h
M src/include/lib/rbtree.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/mb/stringinfo_mb.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/replnodes.h
M src/include/nodes/supportnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/paramassign.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bitutils.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/win32_port.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/interrupt.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/basebackup.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalfuncs.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/backendid.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/md.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hashutils.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/partcache.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenodemap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/legacy-pqsignal.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/libpq.rc.in
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/test/uri-regress.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/plpython.h
M src/pl/tcl/generate-pltclerrcodes.pl
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/dlopen.c
M src/port/erand48.c
M src/port/explicit_bzero.c
M src/port/fls.c
M src/port/fseeko.c
M src/port/getaddrinfo.c
M src/port/getpeereid.c
M src/port/getrusage.c
M src/port/isinf.c
M src/port/kill.c
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_bitutils.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_crc32c_sse42_choose.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pgstrsignal.c
M src/port/pqsignal.c
M src/port/pread.c
M src/port/pwrite.c
M src/port/quotes.c
M src/port/random.c
M src/port/snprintf.c
M src/port/sprompt.c
M src/port/srandom.c
M src/port/strerror.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/strtof.c
M src/port/system.c
M src/port/thread.c
M src/port/unsetenv.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/kerberos/Makefile
M src/test/ldap/Makefile
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_predtest/test_predtest.c
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/perl/Makefile
M src/test/recovery/Makefile
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/ssl/ssl/client-der.key
M src/test/ssl/ssl/client-encrypted-der.key
M src/test/subscription/Makefile
M src/test/thread/Makefile
M src/test/thread/thread_test.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/tools/PerfectHash.pm
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/findoidjoins/Makefile
M src/tools/findoidjoins/findoidjoins.c
M src/tools/fix-old-flex-code.pl
M src/tools/gen_keywordlist.pl
M src/tools/ifaddrs/Makefile
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck
M src/tools/testint128.c
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Modernize Python exception syntax in documentation

commit   : b55413d77f96b9fa2dfae4ddec43412b90ebf588    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 31 Dec 2019 10:35:16 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 31 Dec 2019 10:35:16 +0100    

Click here for diff

Change the exception syntax used in the documentation to use the more  
current  
  
    except Exception as ex:  
  
rather than the old  
  
    except Exception, ex:  
  
We keep the old syntax in the test code since Python <2.6 is still  
supported there, but the documentation might as well use the modern  
syntax.  

M doc/src/sgml/plpython.sgml

Micro-optimize AllocSetFreeIndex() by reference to pg_bitutils code.

commit   : 0ce38730ac72029f3f2c95ae80b44f5b9060cbcc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Dec 2019 17:21:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Dec 2019 17:21:17 -0500    

Click here for diff

Use __builtin_clz() where available.  Where it isn't, we can still win  
a little by using the pg_leftmost_one_pos[] lookup table instead of  
having a private table.  
  
Also drop the initial right shift by ALLOC_MINBITS in favor of  
subtracting ALLOC_MINBITS from the leftmost-one-pos result.  This  
is a win because the compiler can fold that adjustment into other  
constants it'd have to add anyway, making the shift-removal free.  
  
Also, we can explain this coding as an unrolled form of  
pg_leftmost_one_pos32(), even though that's a bit ahistorical  
since it long predates pg_bitutils.h.  
  
John Naylor, with some cosmetic adjustments by me  
  
Discussion: https://postgr.es/m/CACPNZCuNUGMxjK7WTn_=WZnRbfASDdBxmjsVf2+m9MdmeNw_sg@mail.gmail.com  

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

Add pg_dump test for triggers on partitioned tables

commit   : 27a3b2ad836c9e7dd243bfebc760a9df9d6fd5a3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Dec 2019 18:34:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Dec 2019 18:34:30 -0300    

Click here for diff

This currently works, but add this test to ensure it continues to work.  
Lack of this test became evident after a recent bugfix submission that  
would have inadvertently broken it, in  
https://postgr.es/m/CA+HiwqFM2=i+uHB9o4OkLbE2S3sjPHoVe2wXuAD1GLJ4+Pk9eg@mail.gmail.com  

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

doc: add examples of creative use of unique expression indexes

commit   : a9760d0f3cb523336b5fdd9d6c5985e39a8588a1    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 27 Dec 2019 14:49:08 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 27 Dec 2019 14:49:08 -0500    

Click here for diff

Unique expression indexes can constrain data in creative ways, so show  
two examples.  
  
Reported-by: Tuomas Leikola  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

M doc/src/sgml/indices.sgml

docs: clarify infinite range values from data-type infinities

commit   : 650692a18d29c44c8019545c02ba42c3efd2c964    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 27 Dec 2019 14:33:30 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 27 Dec 2019 14:33:30 -0500    

Click here for diff

The previous docs referenced these distinct ideas confusingly.  
  
Reported-by: Eugen Konkov  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

M doc/src/sgml/rangetypes.sgml

Forbid DROP SCHEMA on temporary namespaces

commit   : a052f6cbb84e5630d50b68586cecc127e64be639    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Dec 2019 17:58:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Dec 2019 17:58:43 +0900    

Click here for diff

This operation was possible for the owner of the schema or a superuser.  
Down to 9.4, doing this operation would cause inconsistencies in a  
session whose temporary schema was dropped, particularly if trying to  
create new temporary objects after the drop.  A more annoying  
consequence is a crash of autovacuum on an assertion failure when  
logging information about an orphaned temp table dropped.  Note that  
because of 246a6c8 (present in v11~), which has made the removal of  
orphaned temporary tables more aggressive, the failure could be  
triggered more easily, but it is possible to reproduce down to 9.4.  
  
Reported-by: Mahendra Singh, Prabhat Sahu  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, Mahendra Singh  
Discussion: https://postgr.es/m/CAKYtNAr9Zq=1-ww4etHo-VCC-k120YxZy5OS01VkaLPaDbv2tg@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/commands/dropcmds.c

commit   : 7854e07f25be3a3dfa9c94011a30767eca3c10ba    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Dec 2019 08:09:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Dec 2019 08:09:00 +0900    

Click here for diff

This follows multiple complains from Peter Geoghegan, Andres Freund and  
Alvaro Herrera that this issue ought to be dug more before actually  
happening, if it happens.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/common/detoast.c
M src/backend/access/common/toast_internals.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/Makefile
R097 src/backend/access/index/indexamapi.c src/backend/access/index/amapi.c
R098 src/backend/access/index/indexamvalidate.c src/backend/access/index/amvalidate.c
R099 src/backend/access/index/indexgenam.c src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/dbcommands.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partdesc.c
M src/backend/replication/logical/origin.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/init/postinit.c
R097 src/include/access/indexam.h src/include/access/amapi.h
R084 src/include/access/indexamvalidate.h src/include/access/amvalidate.h
M src/include/access/brin_internal.h
R097 src/include/access/indexgenam.h src/include/access/genam.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/access/reloptions.h
M src/include/access/spgist.h
M src/include/executor/nodeIndexscan.h
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/utils/index_selfuncs.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Fix possible loss of sync between rectypeid and underlying PLpgSQL_type.

commit   : 4ba4bfaf256c17fe4c8f497924b74eb98241b84f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Dec 2019 15:19:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Dec 2019 15:19:39 -0500    

Click here for diff

When revalidate_rectypeid() acts to update a stale record type OID  
in plpgsql's data structures, it fixes the active PLpgSQL_rec struct  
as well as the PLpgSQL_type struct it references.  However, the latter  
is shared across function executions while the former is not.  In a  
later function execution, the PLpgSQL_rec struct would be reinitialized  
by copy_plpgsql_datums and would then contain a stale type OID,  
typically leading to "could not open relation with OID NNNN" errors.  
revalidate_rectypeid() can easily fix this, fortunately, just by  
treating typ->typoid as authoritative.  
  
Per report and diagnosis from Ashutosh Sharma, though this is not his  
suggested fix.  Back-patch to v11 where this code came in.  
  
Discussion: https://postgr.es/m/CAE9k0Pkd4dZwt9J5pS9xhJFWpUtqs05C9xk_GEwPzYdV=GxwWg@mail.gmail.com  

M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_record.sql

Improve comments in utils/rel.h.

commit   : fbe0232358c14792e1b94b902d0f7a9b55154275    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Dec 2019 11:20:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Dec 2019 11:20:05 -0500    

Click here for diff

Mark the fields that should be accessed via partitioning-related  
functions, as we already did for some other fields.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqFnK6LbVMACMCaqwWrvoSFTecZzufKRahg2qGvLPYMX=g@mail.gmail.com  

M src/include/utils/rel.h

Refactor parser's generation of Var nodes.

commit   : b541e9accb28c90656388a3f827ca3a68dd2a308    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Dec 2019 11:16:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Dec 2019 11:16:42 -0500    

Click here for diff

Instead of passing around a pointer to the RangeTblEntry that  
provides the desired column, pass a pointer to the associated  
ParseNamespaceItem.  The RTE is trivially reachable from the nsitem,  
and having the ParseNamespaceItem allows access to additional  
information.  As proof of concept for that, add the rangetable index  
to ParseNamespaceItem, and use that to get rid of RTERangeTablePosn  
searches.  
  
(I have in mind to teach the parser to generate some different  
representation for Vars that are nullable by outer joins, and  
keeping the necessary information in ParseNamespaceItems seems  
like a reasonable approach to that.  But whether that ever  
happens or not, this seems like good cleanup.)  
  
Also refactor the code around scanRTEForColumn so that the  
"fuzzy match" stuff does not leak out of parse_relation.c.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h

commit   : 044b319cd77c589507291f9591994093ad30931d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 26 Dec 2019 22:26:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 26 Dec 2019 22:26:09 +0900    

Click here for diff

confirmed_flush is part of a replication slot's information, but not  
confirmed_lsn.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/replication/slotfuncs.c

Refactor code dedicated to index vacuuming in vacuumlazy.c

commit   : 1ab41a3c8edcf5d7751e61d6ab83bf43b494668b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 26 Dec 2019 17:01:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 26 Dec 2019 17:01:23 +0900    

Click here for diff

The part in charge of doing the vacuum on all the indexes of a relation  
was duplicated, with the same handling for progress reporting done.  
While on it, update the progress reporting for heap vacuuming in the  
subroutine doing the actual work, keeping the status update local.  This  
way, any future caller of lazy_vacuum_heap() does not have to worry  
about doing any progress reporting update.  
  
Author: Justin Pryzby, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Add note about how each partition's default value is treated, into the doc.

commit   : 1ab029d528dcb409fb371d5ad826a67ec78b2b4e    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 26 Dec 2019 15:07:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 26 Dec 2019 15:07:43 +0900    

Click here for diff

Column defaults may be specified separately for each partition.  
But INSERT via a partitioned table ignores those partition's default values.  
The former is documented, but the latter restriction not.  
This commit adds the note about that restriction into the document.  
  
Author: Fujii Masao  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/CAHGQGwEs-59omrfGF7hOHz9iMME3RbKy5ny+iftDx3LHTEn9sA@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml

Allow whole-row Vars to be used in partitioning expressions.

commit   : bb4114a4e2c65f27931cc074214c051dba2876c3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Dec 2019 15:44:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Dec 2019 15:44:15 -0500    

Click here for diff

In the wake of commit 5b9312378, there's no particular reason  
for this restriction (previously, it was problematic because of  
the implied rowtype reference).  A simple constraint on a whole-row  
Var probably isn't that useful, but conceivably somebody would want  
to pass one to a function that extracts a partitioning key.  Besides  
which, we're expending much more code to enforce the restriction than  
we save by having it, since the latter quantity is now zero.  
So drop the restriction.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c
M src/include/catalog/partition.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Remove equalPartitionDescs().

commit   : 42f74f49367bee1d3da28c4b383faec29364f320    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Dec 2019 14:45:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Dec 2019 14:45:57 -0500    

Click here for diff

This is dead code in the wake of the previous commit.  
We can always add it back if we need it again someday.  
  
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com  

M src/backend/partitioning/partdesc.c
M src/include/partitioning/partdesc.h

Load relcache entries' partitioning data on-demand, not immediately.

commit   : 5b9312378e2f8fb35ef4584aea351c3319a10422    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Dec 2019 14:43:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Dec 2019 14:43:13 -0500    

Click here for diff

Formerly the rd_partkey and rd_partdesc data structures were always  
populated immediately when a relcache entry was built or rebuilt.  
This patch changes things so that they are populated only when they  
are first requested.  (Hence, callers *must* now always use  
RelationGetPartitionKey or RelationGetPartitionDesc; just fetching  
the pointer directly is no longer acceptable.)  
  
This seems to have some performance benefits, but the main reason to do  
it is that it eliminates a recursive-reload failure that occurs if the  
partkey or partdesc expressions contain any references to the relation's  
rowtype (as discovered by Amit Langote).  In retrospect, since loading  
these data structures might result in execution of nearly-arbitrary code  
via eval_const_expressions, it was a dumb idea to require that to happen  
during relcache entry rebuild.  
  
Also, fix things so that old copies of a relcache partition descriptor  
will be dropped when the cache entry's refcount goes to zero.  In the  
previous coding it was possible for such copies to survive for the  
lifetime of the session, as I'd complained of in a previous discussion.  
(This management technique still isn't perfect, but it's better than  
before.)  Improve the commentary explaining how that works and why  
it's safe to hand out direct pointers to these relcache substructures.  
  
In passing, improve RelationBuildPartitionDesc by using the same  
memory-context-parent-swap approach used by RelationBuildPartitionKey,  
thereby making it less dependent on strong assumptions about what  
partition_bounds_copy does.  Avoid doing get_rel_relkind in the  
critical section, too.  
  
Patch by Amit Langote and Tom Lane; Robert Haas deserves some credit  
for prior work in the area, too.  Although this is a pre-existing  
problem, no back-patch: the patch seems too invasive to be safe to  
back-patch, and the bug it fixes is a corner case that seems  
relatively unlikely to cause problems in the field.  
  
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+TgmoY3bRmGB6-DUnoVy5fJoreiBJ43rwMrQRCdPXuKt4Ykaw@mail.gmail.com  

M src/backend/catalog/heap.c
M src/backend/commands/indexcmds.c
M src/backend/executor/execPartition.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/include/partitioning/partdesc.h
M src/include/utils/partcache.h
M src/include/utils/rel.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

commit   : 8ce3aa9b5914d1ac45ed3f9bc484f66b3c4850c7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Dec 2019 10:23:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Dec 2019 10:23:39 +0900    

Click here for diff

The following renaming is done so as source files related to index  
access methods are more consistent with table access methods (the  
original names used for index AMs ware too generic, and could be  
confused as including features related to table AMs):  
- amapi.h -> indexam.h.  
- amapi.c -> indexamapi.c.  Here we have an equivalent with  
backend/access/table/tableamapi.c.  
- amvalidate.c -> indexamvalidate.c.  
- amvalidate.h -> indexamvalidate.h.  
- genam.c -> indexgenam.c.  
- genam.h -> indexgenam.h.  
  
This has been discussed during the development of v12 when table AM was  
worked on, but the renaming never happened.  
  
Author: Michael Paquier  
Reviewed-by: Fabien Coelho, Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/common/detoast.c
M src/backend/access/common/toast_internals.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/Makefile
M src/backend/access/index/indexam.c
R097 src/backend/access/index/amapi.c src/backend/access/index/indexamapi.c
R098 src/backend/access/index/amvalidate.c src/backend/access/index/indexamvalidate.c
R099 src/backend/access/index/genam.c src/backend/access/index/indexgenam.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/dbcommands.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partdesc.c
M src/backend/replication/logical/origin.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/init/postinit.c
M src/include/access/brin_internal.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
R097 src/include/access/amapi.h src/include/access/indexam.h
R084 src/include/access/amvalidate.h src/include/access/indexamvalidate.h
R097 src/include/access/genam.h src/include/access/indexgenam.h
M src/include/access/nbtree.h
M src/include/access/reloptions.h
M src/include/access/spgist.h
M src/include/executor/nodeIndexscan.h
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/utils/index_selfuncs.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Avoid splitting C string literals with \-newline

commit   : c4dcd9144ba64946c9f9466748bdb2c51719c8a3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 24 Dec 2019 12:37:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 24 Dec 2019 12:37:13 -0300    

Click here for diff

Using \ is unnecessary and ugly, so remove that.  While at it, stitch  
the literals back into a single line: we've long discouraged splitting  
error message literals even when they go past the 80 chars line limit,  
to improve greppability.  
  
Leave contrib/tablefunc alone.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/tablefunc/tablefunc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/commands/extension.c
M src/backend/commands/prepare.c
M src/backend/executor/execExprInterp.c
M src/backend/libpq/hba.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/portalmem.c

Replace use of strerror() with %s by %m in pg_waldump

commit   : cce64a51cabc1e59d202d95bb0b92ed22bac73cf    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 24 Dec 2019 12:14:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 24 Dec 2019 12:14:08 +0900    

Click here for diff

Since d6c55de1, src/port/snprintf.c is able to use %m instead of  
strerror().  A couple of utilities in src/bin/ have already done the  
switch, and do it now for pg_waldump as this reduces the workload for  
translators.  
  
Note that more could be done, particularly with pgbench.  Thanks to  
Kyotaro Horiguchi for the discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_waldump/pg_waldump.c

Rotate instead of shifting hash join batch number.

commit   : e69d644547785cc9f079650d29118a3688bc5039    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 24 Dec 2019 11:31:24 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 24 Dec 2019 11:31:24 +1300    

Click here for diff

Our algorithm for choosing batch numbers turned out not to work  
effectively for multi-billion key inner relations.  We would use  
more hash bits than we have, and effectively concentrate all tuples  
into a smaller number of batches than we intended.  While ideally  
we should switch to wider hashes, for now, change the algorithm to  
one that effectively gives up bits from the bucket number when we  
don't have enough bits.  That means we'll finish up with longer  
bucket chains than would be ideal, but that's better than having  
batches that don't fit in work_mem and can't be divided.  
  
Batch-patch to all supported releases.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane, thanks also to Tomas Vondra, Alvaro Herrera, Andres Freund for testing and discussion  
Reported-by: James Coleman  
Discussion: https://postgr.es/m/16104-dc11ed911f1ab9df%40postgresql.org  

M src/backend/executor/nodeHash.c
M src/include/port/pg_bitutils.h

Disallow null category in crosstab_hash

commit   : d5b9c2baff662aac22cd2a497d5bcd3b5a916fd0    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 23 Dec 2019 13:33:25 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 23 Dec 2019 13:33:25 -0500    

Click here for diff

While building a hash map of categories in load_categories_hash,  
resulting category names have not thus far been checked to ensure  
they are not null. Prior to pg12 null category names worked to the  
extent that they did not crash on some platforms. This is because  
those system libraries have an snprintf which can deal with being  
passed a null pointer argument for a string. But even in those cases  
null categories did nothing useful. And on some platforms it crashed.  
As of pg12, our own version of snprintf gets called, and it does  
not deal with null pointer arguments at all, and crashes consistently.  
  
Fix that by disallowing null categories. They never worked usefully,  
and no one has ever asked for them to work previously. Back-patch to  
all supported branches.  
  
Reported-By: Ireneusz Pluta  
Discussion: https://postgr.es/m/[email protected]  

M contrib/tablefunc/tablefunc.c

Disallow partition key expressions that return pseudo-types.

commit   : 39ebb943de9dd64e305d17329b8989e3061d03a5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Dec 2019 12:53:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Dec 2019 12:53:12 -0500    

Click here for diff

This wasn't checked originally, but it should have been, because  
in general pseudo-types can't be stored to and retrieved from disk.  
Notably, partition bound values of type "record" would not be  
interpretable by another session.  
  
In v12 and HEAD, add another flag to CheckAttributeType's repertoire  
so that it can produce a specific error message for this case.  That's  
infeasible in older branches without an ABI break, so fall back to  
a slightly-less-nicely-worded error message in v10 and v11.  
  
Problem noted by Amit Langote, though this patch is not his initial  
solution.  Back-patch to v10 where partitioning was introduced.  
  
Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/include/catalog/heap.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Prevent a rowtype from being included in itself via a range.

commit   : fc7695891d357a54f0258142de85f88520796b9b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Dec 2019 12:08:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Dec 2019 12:08:23 -0500    

Click here for diff

We probably should have thought of this case when ranges were added,  
but we didn't.  (It's not the fault of commit eb51af71f, because  
ranges didn't exist then.)  
  
It's an old bug, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/rangetypes.sql

GetPublicationByName: Don't repeat ourselves

commit   : 0fd8cfb20d2d41d4c2df021a5f355965fd8d21bc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Dec 2019 12:47:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Dec 2019 12:47:36 -0300    

Click here for diff

Use get_publication_oid() instead of reimplementing it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_publication.c

Normalize _bt_finish_split() argument names.

commit   : 696cc3a0cabd5f11d0c8a187b7561f6d0d39c5e0    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 22 Dec 2019 20:07:45 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 22 Dec 2019 20:07:45 -0800    

Click here for diff

Make a function prototype argument's name match the function  
definition's argument name.  

M src/include/access/nbtree.h

Update nbtree LP_DEAD item deletion comments.

commit   : fe97c61c8777858cc1a271e657a7d812e100ef00    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 22 Dec 2019 19:57:35 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 22 Dec 2019 19:57:35 -0800    

Click here for diff

Comments about the consequences of clearing the BTP_HAS_GARBAGE page  
flag bit that apply only to VACUUM were added to code that deals with  
opportunistic deletion of LP_DEAD items by commit a760893d.  The same  
comment block was added to both _bt_delitems_vacuum() and  
_bt_delitems_delete().  Correct _bt_delitems_delete()'s copy of the  
comment block.  
  
_bt_delitems_delete() reliably deletes items that were found by caller  
to have their LP_DEAD bit set.  There is no question about whether or  
not unsetting the BTP_HAS_GARBAGE bit can miss some LP_DEAD items that  
were set recently.  
  
Also tweak a related section of the nbtree README.  

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

Avoid low-probability regression test failures in timestamp[tz] tests.

commit   : b265aa1f39b672d263e37bdb715516d32128d0c4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Dec 2019 18:00:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Dec 2019 18:00:17 -0500    

Click here for diff

If the first transaction block in these tests were entered exactly  
at midnight (California time), they'd report a bogus failure due  
to 'now' and 'midnight' having the same values.  Commit 8c2ac75c5  
had dismissed this as being of negligible probability, but we've  
now seen it happen in the buildfarm, so let's prevent it.  We can  
get pretty much the same test coverage without an it's-not-midnight  
assumption by moving the does-'now'-work cases into their own test step.  
  
While here, apply commit 47169c255's s/DELETE/TRUNCATE/ change to  
timestamptz as well as timestamp (not sure why that didn't  
occur to me at the time; the risk of failure is the same).  
  
Back-patch to all supported branches, since the main point is  
to get rid of potential buildfarm failures.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Fix compiler warning for ppoll() on Cygwin

commit   : 127ccb37251744c0fad2df0f3f67dd2c38fe8389    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 22 Dec 2019 23:20:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 22 Dec 2019 23:20:00 +0100    

Click here for diff

_GNU_SOURCE is required to get the prototype, so just define that  
globally, as was already done in the linux template.  
  
Discussion: https://www.postgresql.org/message-id/flat/6b467edc-4018-521f-ab18-171f098557ca%402ndquadrant.com  

M src/template/cygwin

In pgwin32_open, loop after ERROR_ACCESS_DENIED only if we can't stat.

commit   : 5406513e997f5ee9de79d4076ae91c04af0c52f6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Dec 2019 17:39:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Dec 2019 17:39:36 -0500    

Click here for diff

This fixes a performance problem introduced by commit 6d7547c21.  
ERROR_ACCESS_DENIED is returned in some other cases besides the  
delete-pending case considered by that commit; notably, if the  
given path names a directory instead of a plain file.  In that  
case we'll uselessly loop for 1 second before returning the  
failure condition.  That slows down some usage scenarios enough  
to cause test timeout failures on our Windows buildfarm critters.  
  
To fix, try to stat() the file, and sleep/loop only if that fails.  
It will fail in the delete-pending case, and also in the case where  
the deletion completed before we could stat(), so we have the cases  
where we want to loop covered.  In the directory case, the stat()  
should succeed, letting us exit without a wait.  
  
One case where we'll still wait uselessly is if the access-denied  
problem pertains to a directory in the given pathname.  But we don't  
expect that to happen in any performance-critical code path.  
  
There might be room to refine this further, but I'll push it now  
in hopes of making the buildfarm green again.  
  
Back-patch, like the preceding commit.  
  
Alexander Lakhin and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/open.c

C comment: clarify why psql's help/exit/quit must alone

commit   : 4376fdbae11de9333012a31ba8d3a4f4b5d7a692    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Dec 2019 17:02:38 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Dec 2019 17:02:38 -0500    

Click here for diff

Document why no indentation and why no non-whitespace postfix is  
supported.  
  
Backpatch-through: master  

M src/bin/psql/mainloop.c

docs: clarify handling of column lists in COPY TO/FROM

commit   : 4cab43ec806a6298a545a399415ee8c4fe9307a8    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 21 Dec 2019 12:44:38 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 21 Dec 2019 12:44:38 -0500    

Click here for diff

Previously it was unclear how COPY FROM handled cases where not all  
columns were specified, or if the order didn't match.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

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

Adjust test case added by commit 6136e94dc.

commit   : 0af0504da91e5e15f0b203309a1e49a4829dac64    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Dec 2019 15:45:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Dec 2019 15:45:37 -0500    

Click here for diff

Per project policy, transient roles created by regression test cases  
should be named "regress_something", to reduce the risks of running  
such cases against installed servers.  And no such role should ever  
be left behind after running a test.  
  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : e60b480d39ee3401727a994988dd9117a3b48466    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Dec 2019 15:34:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Dec 2019 15:34:07 -0500    

Click here for diff

We realized years ago that it's better for libpq to accept all  
connection parameters syntactically, even if some are ignored or  
restricted due to lack of the feature in a particular build.  
However, that lesson from the SSL support was for some reason never  
applied to the GSSAPI support.  This is causing various buildfarm  
members to have problems with a test case added by commit 6136e94dc,  
and it's just a bad idea from a user-experience standpoint anyway,  
so fix it.  
  
While at it, fix some places where parameter-related infrastructure  
was added with the aid of a dartboard, or perhaps with the aid of  
the anti-pattern "add new stuff at the end".  It should be safe  
to rearrange the contents of struct pg_conn even in released  
branches, since that's private to libpq (and we'd have to move  
some fields in some builds to fix this, anyway).  
  
Back-patch to all supported branches.  
  
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/libpq.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

Clean up inconsistent backslash use in paths

commit   : 77f416af6e821b40649c971ded43089e0450791a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Dec 2019 12:26:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Dec 2019 12:26:01 +0100    

Click here for diff

Most of the MSVC Perl code uses forward slashes for file paths.  Make  
the few places that use backslashes the same.  This also helps running  
that code on non-Windows.  

M src/tools/msvc/build.pl
M src/tools/msvc/mkvcbuild.pl

Generate pg_config.h from pg_config.h.in on Windows

commit   : 8f4fb4c648ee8df00f78bee3f8099a6ae510071a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Dec 2019 08:54:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Dec 2019 08:54:42 +0100    

Click here for diff

Previously, the Windows MSVC build generated pg_config.h from a  
hard-coded pg_config.h.win32 with some ad hoc postprocessing.  The  
pg_config.h.win32 file required manual maintenance and was as a result  
frequently out of date.  
  
Instead, have the MSVC build scripts emulate what configure and  
config.status do: collect a list of defines and then create  
pg_config.h from pg_config.h.in by changing the appropriate lines.  
  
The previous setup was made to support old Windows build systems that  
didn't have any text processing capabilities, but the current system  
has Perl, so it's not a problem.  pg_config.h.win32 is removed.  
  
In order to try to keep the Windows side of things more up to date in  
the future, we now also require that all symbols found in  
pg_config.h.in are defined in the MSVC build system.  So if there is a  
change in configure that results in a new symbol, an update in  
Solution.pm will be required.  
  
The other headers managed by AC_CONFIG_HEADERS in configure, namely  
src/include/pg_config_ext.h and  
src/interfaces/ecpg/include/ecpg_config.h, get the same treatment, so  
this removes even more ad hoc code in the MSVC build scripts.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/1441b834-f434-e0bf-46ed-9c4d5c29c2d4%402ndquadrant.com  

D src/include/pg_config.h.win32
D src/include/pg_config_ext.h.win32
M src/tools/msvc/Solution.pm
M src/tools/version_stamp.pl

Disallow dropping rules on system tables by default

commit   : df7fe9e2d707da69a4437fb6f9e695c070882160    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Dec 2019 08:25:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Dec 2019 08:25:43 +0100    

Click here for diff

This was previously not covered by allow_system_table_mods, but now it  
is.  The impact in practice is probably low, but this makes it  
consistent with most other DDL commands.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/ee9df1af-c0d8-7c82-5be7-39ce4e3b0a9d%402ndquadrant.com  

M src/backend/rewrite/rewriteRemove.c
M src/test/modules/unsafe_tests/expected/alter_system_table.out
M src/test/modules/unsafe_tests/sql/alter_system_table.sql

Fix compiler warnings on MSYS2

commit   : 8c6d30f211390df911072d33f0114a31f066a4cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Dec 2019 08:04:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Dec 2019 08:04:24 +0100    

Click here for diff

The PS_USE_NONE case in ps_status.c left a couple of unused variables  
exposed.  
  
Discussion: https://www.postgresql.org/message-id/flat/6b467edc-4018-521f-ab18-171f098557ca%402ndquadrant.com  

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

Superuser can permit passwordless connections on postgres_fdw

commit   : 6136e94dcb88c50b6156aa646746565400e373d4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 20 Dec 2019 16:23:34 +1030    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 20 Dec 2019 16:23:34 +1030    

Click here for diff

Currently postgres_fdw doesn't permit a non-superuser to connect to a  
foreign server without specifying a password, or to use an  
authentication mechanism that doesn't use the password. This is to avoid  
using the settings and identity of the user running Postgres.  
  
However, this doesn't make sense for all authentication methods. We  
therefore allow a superuser to set "password_required 'false'" for user  
mappings for the postgres_fdw. The superuser must ensure that the  
foreign server won't try to rely solely on the server identity (e.g.  
trust, peer, ident) or use an authentication mechanism that relies on the  
password settings (e.g. md5, scram-sha-256).  
  
This feature is a prelude to better support for sslcert and sslkey  
settings in user mappings.  
  
Author: Craig Ringer.  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Extend the ProcSignal mechanism to support barriers.

commit   : 16a4e4aecd47da7a6c4e1ebc20f6dd1a13f9133b    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Dec 2019 14:56:20 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Dec 2019 14:56:20 -0500    

Click here for diff

A new function EmitProcSignalBarrier() can be used to emit a global  
barrier which all backends that participate in the ProcSignal  
mechanism must absorb, and a new function WaitForProcSignalBarrier()  
can be used to wait until all relevant backends have in fact  
absorbed the barrier.  
  
This can be used to coordinate global state changes, such as turning  
checksums on while the system is running.  
  
There's no real client of this mechanism yet, although two are  
proposed, but an enum has to have at least one element, so this  
includes a placeholder type (PROCSIGNAL_BARRIER_PLACEHOLDER) which  
should be replaced by the first real client of this mechanism to  
get committed.  
  
Andres Freund and Robert Haas, reviewed by Daniel Gustafsson and,  
in earlier versions, by Magnus Hagander.  
  
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/startup.c
M src/backend/replication/walreceiver.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procsignal.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/globals.c
M src/include/miscadmin.h
M src/include/pgstat.h
M src/include/storage/procsignal.h

Remove unneeded "pin scan" nbtree VACUUM code.

commit   : 9f83468b3536caf6fb7fe8f9dcdbb108a98d1257    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 19 Dec 2019 11:35:55 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 19 Dec 2019 11:35:55 -0800    

Click here for diff

The REDO routine for nbtree's xl_btree_vacuum record type hasn't  
performed a "pin scan" since commit 3e4b7d87 went in, so clearly there  
isn't any point in VACUUM WAL-logging information that won't actually be  
used.  Finish off the work of commit 3e4b7d87 (and the closely related  
preceding commit 687f2cd7) by removing the code that generates this  
unused information.  Also remove the REDO routine code disabled by  
commit 3e4b7d87.  
  
Replace the unneeded lastBlockVacuumed field in xl_btree_vacuum with a  
new "ndeleted" field.  The new field isn't actually needed right now,  
since we could continue to infer the array length from the overall  
record length.  However, an upcoming patch to add deduplication to  
nbtree needs to add an "items updated" field to xl_btree_vacuum, so we  
might as well start being explicit about the number of items now.  
(Besides, it doesn't seem like a good idea to leave the xl_btree_vacuum  
struct without any fields; the C standard says that that's undefined.)  
  
nbtree VACUUM no longer forces writing a WAL record for the last block  
in the index.  Writing out a WAL record with no items for the final  
block was supposed to force processing of a lastBlockVacuumed field by a  
pin scan.  
  
Bump XLOG_PAGE_MAGIC because xl_btree_vacuum changed.  
  
Discussion: https://postgr.es/m/CAH2-WzmY_mT7UnTzFB5LBQDBkKpdV5UxP3B5bLb7uP%3D%3D6UQJRQ%40mail.gmail.com  

M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/xlog_internal.h

revert: Remove meaningless assignments in nbtree code

commit   : b93e9a5c94b4c89932a637798bd560971fe790d7    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 19 Dec 2019 11:19:10 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 19 Dec 2019 11:19:10 -0500    

Click here for diff

Reverts commit 05684c8255.  
  
Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

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

Remove meaningless assignments in nbtree code

commit   : 05684c8255af57258386c00354c61155ec519707    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 19 Dec 2019 10:33:48 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 19 Dec 2019 10:33:48 -0500    

Click here for diff

Reported-by: Ranier Vilela  
  
Discussion: https://postgr.es/m/MN2PR18MB2927BB876D12A70FDBE8F35AE3450@MN2PR18MB2927.namprd18.prod.outlook.com  
  
Backpatch-through: master  

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

makeArrayTypeName: Remove pointless relation open/close

commit   : 2b93e3d96b941740877b2ae196511564e5cc989b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Dec 2019 12:08:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Dec 2019 12:08:30 -0300    

Click here for diff

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

M src/backend/catalog/pg_type.c

Doc: add a short summary of available authentication methods.

commit   : 54fbd155cc6fdbf875185035b3d9823f739b617d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Dec 2019 09:42:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Dec 2019 09:42:39 -0500    

Click here for diff

The "auth-methods" <sect1> used to include descriptions of all our  
authentication methods.  Commit 56811e573 promoted its child <sect2>'s  
to <sect1>'s, which has advantages but also created some issues:  
* The auth-methods page itself is essentially empty/useless.  
* Links that pointed to "auth-methods" as a placeholder for all  
auth methods were rendered a bit nonsensical.  
* DocBook no longer provides a subsection table-of-contents here,  
which formerly was a useful if terse summary of available auth methods.  
  
To improve matters, add a handwritten list of all the auth methods.  
  
Per gripe from Dave Cramer.  Back-patch to v11 where the previous  
commit came in.  
  
Discussion: https://postgr.es/m/CADK3HH+xQLhcPgg=kWqfogtXGGZr-JdSo=x=WQC0PkAVyxUWyQ@mail.gmail.com  

M doc/src/sgml/client-auth.sgml

Update neglected comment.

commit   : 7cdcc747a9fe588f9e9b3a5d3feb650340093fb2    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Dec 2019 09:24:44 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Dec 2019 09:24:44 -0500    

Click here for diff

Commit d986d4e87f61c68f52c68ebc274960dc664b7b4e renamed a variable  
but neglected to update the corresponding comment.  
  
Amit Langote  

M src/backend/commands/trigger.c

Fix minor problems with non-exclusive backup cleanup.

commit   : 303640199d0436c5e7acdf50b837a027b5726594    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 19 Dec 2019 09:06:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 19 Dec 2019 09:06:54 -0500    

Click here for diff

The previous coding imagined that it could call before_shmem_exit()  
when a non-exclusive backup began and then remove the previously-added  
handler by calling cancel_before_shmem_exit() when that backup  
ended. However, this only works provided that nothing else in the  
system has registered a before_shmem_exit() hook in the interim,  
because cancel_before_shmem_exit() is documented to remove a callback  
only if it is the latest callback registered. It also only works  
if nothing can ERROR out between the time that sessionBackupState  
is reset and the time that cancel_before_shmem_exit(), which doesn't  
seem to be strictly true.  
  
To fix, leave the handler installed for the lifetime of the session,  
arrange to install it just once, and teach it to quietly do nothing if  
there isn't a non-exclusive backup in process.  
  
This is a bug, but for now I'm not going to back-patch, because the  
consequences are minor. It's possible to cause a spurious warning  
to be generated, but that doesn't really matter. It's also possible  
to trigger an assertion failure, but production builds shouldn't  
have assertions enabled.  
  
Patch by me, reviewed by Kyotaro Horiguchi, Michael Paquier (who  
preferred a different approach, but got outvoted), Fujii Masao,  
and Tom Lane, and with comments by various others.  
  
Discussion: http://postgr.es/m/CA+TgmobMjnyBfNhGTKQEDbqXYE3_rXWpc4CM63fhyerNCes3mA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/replication/basebackup.c
M src/include/access/xlog.h

Add support for MSYS2

commit   : e975c1a6026adb9e248a408fe3ca2629bc8c0084    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Dec 2019 08:28:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Dec 2019 08:28:37 +0100    

Click here for diff

It's basically a variant of Cygwin, so use that template.  
  
Discussion: https://www.postgresql.org/message-id/flat/6b467edc-4018-521f-ab18-171f098557ca%402ndquadrant.com  

M configure
M configure.in

Re-#include <time.h> in checkpointer.c.

commit   : 9aafc4529f50e027f05037d993c6dd60a6cde54d    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Dec 2019 13:03:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Dec 2019 13:03:41 -0500    

Click here for diff

Commit 7dbfea3c455e83a77213a92b9dfdc1c0577441ea thought it could get  
away with removing this, but Thomas Munro reports, on behalf of the  
buildfarm, that it's still needed at least on Windows to avoid  
compiler warnings.  

M src/backend/postmaster/checkpointer.c

Move heap-specific detoasting logic into a separate function.

commit   : e9fd0415e6e27c8ce5f40152aa98347ca6fe4385    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 18 Dec 2019 11:08:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 18 Dec 2019 11:08:59 -0500    

Click here for diff

The new function, heap_fetch_toast_slice, is shared between  
toast_fetch_datum_slice and toast_fetch_datum, and does all the  
work of scanning the TOAST table, fetching chunks, and storing  
them into the space allocated for the result varlena.  
  
As an incidental side effect, this allows toast_fetch_datum_slice  
to perform the scan with only a single scankey if all chunks are  
being fetched, which might have some tiny performance benefit.  
  
Discussion: http://postgr.es/m/CA+TgmobBzxwFojJ0zV0Own3dr09y43hp+OzU2VW+nos4PMXWEg@mail.gmail.com  

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

Minimal portability fix for commit e1551f96e.

commit   : bf7427bdd389aa6c266768f2a07214a2a02b85c9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Dec 2019 10:22:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Dec 2019 10:22:50 -0500    

Click here for diff

Older gcc versions are not happy with having multiple declarations  
for the same typedef name (not struct name).  I'm a bit dubious  
as to how well-thought-out that patch was at all, but for the moment  
just fix it enough so I can get some work done today.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/parser/parse_utilcmd.h
M src/include/rewrite/rewriteManip.h

Add .editorconfig

commit   : ecb09cd5de5279ab9cfa20a58fd3da44f7df5779    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 18 Dec 2019 09:08:23 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 18 Dec 2019 09:08:23 +0100    

Click here for diff

The main use right now is getting properly spaced diff views on  
GitHub, but perhaps this will also help developers with editors that  
we currently don't have setup recipes for.  
  
The settings mirror mostly what's currently in .dir-locals.el.  
  
Discussion: https://www.postgresql.org/message-id/flat/273cb788-bbb2-ff34-ad6f-5192b44e5049%402ndquadrant.com  

A .editorconfig

Fix compiler warning in non-assert builds

commit   : 2032645b195a53519b43dad57f55bc163b99f0ef    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 16:55:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 16:55:25 +0900    

Click here for diff

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

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

Refactor attribute mappings used in logical tuple conversion

commit   : e1551f96e643a52a035c3b35777d968bc073f7fc    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 16:23:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 16:23:02 +0900    

Click here for diff

Tuple conversion support in tupconvert.c is able to convert rowtypes  
between two relations, inner and outer, which are logically equivalent  
but have a different ordering or even dropped columns (used mainly for  
inheritance tree and partitions).  This makes use of attribute mappings,  
which are simple arrays made of AttrNumber elements with a length  
matching the number of attributes of the outer relation.  The length of  
the attribute mapping has been treated as completely independent of the  
mapping itself until now, making it easy to pass down an incorrect  
mapping length.  
  
This commit refactors the code related to attribute mappings and moves  
it into an independent facility called attmap.c, extracted from  
tupconvert.c.  This merges the attribute mapping with its length,  
avoiding to try to guess what is the length of a mapping to use as this  
is computed once, when the map is built.  
  
This will avoid mistakes like what has been fixed in dc816e58, which has  
used an incorrect mapping length by matching it with the number of  
attributes of an inner relation (a child partition) instead of an outer  
relation (a partitioned table).  
  
Author: Michael Paquier  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/Makefile
A src/backend/access/common/attmap.c
M src/backend/access/common/tupconvert.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteManip.c
A src/include/access/attmap.h
M src/include/access/tupconvert.h
M src/include/catalog/index.h
M src/include/parser/parse_utilcmd.h
M src/include/replication/logicalrelation.h
M src/include/rewrite/rewriteManip.h
M src/tools/pgindent/typedefs.list

Fix subscriber invalid memory access on DDL.

commit   : 04c8a69c0cccbc271e0feeb22a74c69fbd87c37e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 16 Dec 2019 15:23:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 16 Dec 2019 15:23:46 +0530    

Click here for diff

This patch allows building the local relmap cache for a subscribed  
relation after processing pending invalidation messages and potential  
relcache updates.  Without this, the attributes in the local cache don't  
tally with the updated relcache entry leading to invalid memory access.  
  
Reported-by Jehan-Guillaume de Rorthais  
Author: Jehan-Guillaume de Rorthais and Vignesh C  
Reviewed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/20191025175929.7e90dbf5@firost  

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

Doc: Improve readability of options for REINDEX

commit   : 52dcfda48778d16683c64ca4372299a099a15b96    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 11:07:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 11:07:36 +0900    

Click here for diff

That's more consistent with the style we have been using with for  
example EXPLAIN, VACUUM or ANALYZE (this one had only one option in  
v11).  Based on a suggestion from Pavel Stehule.  
  
Author: Josef Šimánek  
Discussion: https://postgr.es/m/CAFj8pRCrUS+eMFvssVPGZN-VDEMP3XN+1Dop0=CmeBq2D+dqOg@mail.gmail.com  
Discussion: https://postgr.es/m/CAFp7QwpeMPEtAR5AYpsG623ooMWX03wMjq5cpZn=X+6OCkfwJw@mail.gmail.com  

M doc/src/sgml/ref/reindex.sgml

Fix some OBJS lists in two Makefiles to be ordered alphabetically

commit   : aa3ef7ff505305d8ee5f733090b076c301a32cc8    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 10:42:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 10:42:40 +0900    

Click here for diff

These have been missed in 01368e5, and count for plpython and the  
backend's tsearch code.  
  
Author: Mahendra Singh  
Discussion: https://postgr.es/m/CAKYtNAo4mxRRyDB0YqE6QLh17XD7pPQotpGm3GnHS+gQKz4zQQ@mail.gmail.com  

M src/backend/tsearch/Makefile
M src/pl/plpython/Makefile

Remove redundant not-null test

commit   : 181932a03212751102fb2c105fe556a26aee6ed7    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 17 Dec 2019 20:37:22 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 17 Dec 2019 20:37:22 -0500    

Click here for diff

Reported-by: Ranier Vilela  
  
Discussion: https://postgr.es/m/MN2PR18MB2927E73FADCA8967B2302469E3490@MN2PR18MB2927.namprd18.prod.outlook.com  
  
Author: Ranier Vilela  
  
Backpatch-through: master  

M src/backend/executor/execExpr.c

Remove shadow variables linked to RedoRecPtr in xlog.c

commit   : 70116493a8e07713f7e1270646ca1147898b4f6d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 10:11:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Dec 2019 10:11:13 +0900    

Click here for diff

This changes the routines in charge of recycling WAL segments past the  
last redo LSN to not use anymore "RedoRecPtr" as a local variable, which  
is also available in the context of the session as a static declaration,  
replacing it with "lastredoptr".  This confusion has been introduced by  
d9fadbf, so backpatch down to v11 like the other commit.  
  
Thanks to Tom Lane, Robert Haas, Alvaro Herrera, Mark Dilger and Kyotaro  
Horiguchi for the input provided.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/MN2PR18MB2927F7B5F690065E1194B258E35D0@MN2PR18MB2927.namprd18.prod.outlook.com  
Backpatch-through: 11  

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

Fix error reporting for index expressions of prohibited types.

commit   : 2acab054b3ff8e46707727980ce3fa1a1897381f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Dec 2019 17:44:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Dec 2019 17:44:27 -0500    

Click here for diff

If CheckAttributeType() threw an error about the datatype of an  
index expression column, it would report an empty column name,  
which is pretty unhelpful and certainly not the intended behavior.  
I (tgl) evidently broke this in commit cfc5008a5, by not noticing  
that the column's attname was used above where I'd placed the  
assignment of it.  
  
In HEAD and v12, this is trivially fixable by moving up the  
assignment of attname.  Before v12 the code is a bit more messy;  
to avoid doing substantial refactoring, I took the lazy way out  
and just put in two copies of the assignment code.  
  
Report and patch by Amit Langote.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CA+HiwqFA+BGyBFimjiYXXMa2Hc3fcL0+OJOyzUNjhU4NCa_XXw@mail.gmail.com  

M src/backend/catalog/index.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix bad formula in previous commit.

commit   : 5184f110aa4130ec87b0b3e0834292cd8cb1fd8a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 15:53:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 15:53:17 -0500    

Click here for diff

Commit d5406dea25b600408e7acf17d5a06e82d3ce6d0d used a slightly  
novel, and wrong, approach to compute the length of the last  
toast chunk. It worked fine unless the last chunk happened to  
have the largest possible size.  

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

Code cleanup for toast_fetch_datum and toast_fetch_datum_slice.

commit   : d5406dea25b600408e7acf17d5a06e82d3ce6d0d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 22 Nov 2019 08:43:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 22 Nov 2019 08:43:28 -0500    

Click here for diff

Rework some of the checks for bad TOAST chunks to be a bit simpler  
and easier to understand. These checks verify that (1) we get all  
and only the chunk numbers we expect to see and (2) each chunk has  
the expected size. However, the existing code was a bit hard to  
understand, at least for me; try to make it clearer.  
  
As part of that, have toast_fetch_datum_slice check the relationship  
between endchunk and totalchunks only with an Assert() rather than  
checking every chunk number against both values. There's no need to  
check that relationship in production builds because it's not a  
function of whether on-disk corruption is present; it's just a  
question of whether the code does the right math.  
  
Also, have toast_fetch_datum_slice() use ereport(ERROR) rather than  
elog(ERROR). Commit fd6ec93bf890314ac694dc8a7f3c45702ecc1bbd made  
the two functions inconsistent with each other.  
  
Rename assorted variables for better clarity and consistency, and  
move assorted variables from function scope to the function's main  
loop. Remove a few variables that are used only once entirely.  
  
Patch by me, reviewed by Peter Eisentraut.  
  
Discussion: http://postgr.es/m/CA+TgmobBzxwFojJ0zV0Own3dr09y43hp+OzU2VW+nos4PMXWEg@mail.gmail.com  

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

simplehash: Allow for use in frontend code.

commit   : da41d71070d14ecd9e2f4bbe275c98a136826d4b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 14:11:14 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 14:11:14 -0500    

Click here for diff

Commit 48995040d5e7b1e9bac35d72aff326cae002219d removed the largest  
barrier to use of simplehash in frontend code, but there's one more  
problem: it uses elog(ERROR, ...) or elog(LOG, ...) in a couple of  
places. Work around that by changing those to pg_log_error() and  
pg_log_info() when FRONTEND is defined.  
  
Patch by me, reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+Tgmob8oyh02NrZW=xCScB+5GyJ-jVowE3+TWTUmPF=FsGWTA@mail.gmail.com  

M src/include/lib/simplehash.h

simplehash: Allow use of simplehash without MemoryContext.

commit   : 48995040d5e7b1e9bac35d72aff326cae002219d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 14:06:25 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 14:06:25 -0500    

Click here for diff

If the SH_RAW_ALLOCATOR is defined, it will be used to allocate bytes  
for the hash table, and no dependencies on MemoryContext will exist.  
This means, in particular, that the SH_CREATE function will not take  
a MemoryContext argument.  
  
Patch by me, reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+Tgmob8oyh02NrZW=xCScB+5GyJ-jVowE3+TWTUmPF=FsGWTA@mail.gmail.com  

M src/include/lib/simplehash.h

Add missing "void" to prototypes.

commit   : b1cc572f1274c946da42ed13ae4065e08b13262a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 13:56:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 13:56:19 -0500    

Click here for diff

Commit 5910d6c7e311f0b14e3d3cb9ce3597c01d3a3cde got this wrong.  
  
Report and patch by Andrew Gierth.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c

Partially deduplicate interrupt handling for background processes.

commit   : 7dbfea3c455e83a77213a92b9dfdc1c0577441ea    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 13:14:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 13:14:28 -0500    

Click here for diff

Where possible, share signal handler code and main loop interrupt  
checking. This saves quite a bit of code and should simplify  
maintenance, too.  
  
This commit intends not to change the way anything works, even  
though that might allow more code to be unified. It does unify  
a bunch of individual variables into a ShutdownRequestPending  
flag that has is now used by a bunch of different process types,  
though.  
  
Patch by me, reviewed by Andres Freund and Daniel Gustafsson.  
  
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com  

M src/backend/postmaster/Makefile
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
A src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/globals.c
M src/include/miscadmin.h
A src/include/postmaster/interrupt.h

Use PostgresSigHupHandler in more places.

commit   : 1e53fe0e70f610c34f4c9e770d108cd94151342c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 13:03:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 13:03:57 -0500    

Click here for diff

There seems to be no reason for every background process to have  
its own flag indicating that a config-file reload is needed.  
Instead, let's just use ConfigFilePending for that purpose  
everywhere.  
  
Patch by me, reviewed by Andres Freund and Daniel Gustafsson.  
  
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c

Move interrupt-handling code into subroutines.

commit   : 5910d6c7e311f0b14e3d3cb9ce3597c01d3a3cde    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 12:55:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 17 Dec 2019 12:55:13 -0500    

Click here for diff

Some auxiliary processes, as well as the autovacuum launcher,  
have interrupt handling code directly in their main loops.  
Try to abstract things a little better by moving it into  
separate functions.  
  
This doesn't make any functional difference, and leaves  
in place relatively large differences among processes in how  
interrupts are handled, but hopefully it at least makes it  
easier to see the commonalities and differences across  
process types.  
  
Patch by me, reviewed by Andres Freund and Daniel Gustafsson.  
  
Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c

Change overly strict Assert in TransactionGroupUpdateXidStatus.

commit   : af3290f5e790dcd1be3ac209be1805626f4ebac8    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 12 Dec 2019 11:51:30 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 12 Dec 2019 11:51:30 +0530    

Click here for diff

This Assert thought that an overflowed transaction can never get registered  
for the group update.  But that is not true, because even when the number  
of children for a transaction got reduced, the overflow flag is not  
changed.  And, for group update, we only care about the current number of  
children for a transaction that is being committed.  
  
Based on comments by Andres Freund, remove a redundant Assert in  
TransactionIdSetPageStatus as we already had a static Assert for the same  
condition a few lines earlier.  
  
Reported-by: Vignesh C  
Author: Dilip Kumar  
Reviewed-by: Amit Kapila  
Backpatch-through: 11  
Discussion: https://postgr.es/m/CAFiTN-s5=uJw-Z6JC9gcqtBSjXsrHnU63PXBrA=pnBjqnkm5UA@mail.gmail.com  

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

Rename nbtree tuple macros.

commit   : fcf3b6917bd8f6f9f463e3e42e53d6ff9612e327    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 16 Dec 2019 17:49:45 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 16 Dec 2019 17:49:45 -0800    

Click here for diff

Rename two function-style macros, removing the word "inner".  This makes  
things more consistent.  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/nbtree.h

Fix query cancellation handling in psql

commit   : 5d43c3c54d77f39135fe463539f5f438f460ae7e    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 17 Dec 2019 10:44:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 17 Dec 2019 10:44:25 +0900    

Click here for diff

The refactoring done in a4fd3aa for query cancellation has messed up  
with the logic in psql by mixing CancelRequested and cancel_pressed,  
breaking for example \watch.  The former would be switched to true if a  
cancellation request has been attempted and that it actually succeeded,  
and the latter tracks if a cancellation attempt has been done.  
  
This commit brings back the code of psql to a state consistent to what  
it was before a4fd3aa, without giving up on the refactoring pieces  
introduced.  It should be actually possible to merge more both flags as  
their concepts are close enough, however note that psql's --single-step  
mode relies on cancel_pressed to be always set, so this requires more  
careful analysis left for later.  
  
While on it, fix the declarations of CancelRequested (in cancel.c) and  
cancel_pressed (in psql) to be volatile sig_atomic_t.  Previously,  
both were declared as booleans, which should be fine on modern  
platforms, but the C standard recommends the use of sig_atomic_t for  
variables used in signal handlers.  Note that since its introduction in  
a1792320, CancelRequested declaration was not volatile.  
  
Reported-by: Jeff Janes  
Author: Michael Paquier  
Discussion: https://postgr.es/m/CAMkU=1zpoUDGKqWKuMWkj7t-bOCaJDx0r=5te_-d0B2HVLABXg@mail.gmail.com  

M src/bin/psql/common.c
M src/fe_utils/cancel.c
M src/fe_utils/print.c
M src/include/fe_utils/cancel.h
M src/include/fe_utils/print.h

Fix "force_parallel_mode = regress" to work with ANALYZE + VERBOSE.

commit   : b925a00f4ef65db9359e1c60fbf0e56d05afb25a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Dec 2019 20:14:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Dec 2019 20:14:25 -0500    

Click here for diff

force_parallel_mode = regress is supposed to force use of a Gather  
node without having any impact on EXPLAIN output.  But it failed to  
accomplish that if both ANALYZE and VERBOSE are given, because that  
enables per-worker output data that you wouldn't see if the Gather  
hadn't been inserted.  Improve the logic so that we suppress the  
per-worker data too.  
  
This allows putting the new test case added by commit 5935917ce  
back into the originally intended form (cf. 776a2c887, 22864f6e0).  
We can also get rid of a kluge in subselect.sql, which previously  
had to clean up after force_parallel_mode's failure to do what it  
said on the tin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/include/commands/explain.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/partition_prune.sql
M src/test/regress/sql/subselect.sql

Update nbtree README's "Scans during Recovery".

commit   : 9067b83955da5fde49a2605510900e6d9fa273af    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 16 Dec 2019 17:11:35 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 16 Dec 2019 17:11:35 -0800    

Click here for diff

get_actual_variable_range() hasn't used a dirty snapshot since commit  
3ca930fc3, which invented a new snapshot type specifically to meet  
selfuncs.c's requirements (HeapTupleSatisfiesNonVacuumable() type  
snapshots were added).  
  
Discussion: https://postgr.es/m/CAH2-Wzn2pSqEOcBDAA40CnO82oEy-EOpE2bNh_XL_cfFoA86jw@mail.gmail.com  

M src/backend/access/nbtree/README

On Windows, wait a little to see if ERROR_ACCESS_DENIED goes away.

commit   : 6d7547c219adf2436323cdbd4bebc5e872d53546    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Dec 2019 15:10:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Dec 2019 15:10:55 -0500    

Click here for diff

Attempting to open a file fails with ERROR_ACCESS_DENIED if the file  
is flagged for deletion but not yet actually gone (another in a long  
list of reasons why Windows is broken, if you ask me).  This seems  
likely to explain a lot of irreproducible failures we see in the  
buildfarm.  This state generally persists for only a millisecond or so,  
so just wait a bit and retry.  If it's a real permissions problem,  
we'll eventually give up and report it as such.  If it's the pending  
deletion case, we'll see file-not-found and report that after the  
deletion completes, and the caller will treat that in an appropriate  
way.  
  
In passing, rejigger the existing retry logic for some other error  
cases so that we don't uselessly wait an extra time when we're  
not going to retry anymore.  
  
Alexander Lakhin (with cosmetic tweaks by me).  Back-patch to all  
supported branches, since this seems like a pretty safe change and  
the problem is definitely real.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/open.c

Demote variable from global to local

commit   : 91fca4bb60e8c00e8b0e2755555b39f4b1c1659c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Dec 2019 14:23:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Dec 2019 14:23:56 -0300    

Click here for diff

recoveryDelayUntilTime was introduced by commit 36da3cfb457b as a global  
because its method of operation was devilishly intrincate.  Commit  
c945af80cfda removed all that complexity and could have turned it into a  
local variable, but didn't.  Do so now.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Michaël Paquier, Daniel Gustafsson  

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

Fix yet another crash in page split during GiST index creation.

commit   : 741b884353e4803abc15d4392ad287b0d5953fc4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 16 Dec 2019 13:57:41 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 16 Dec 2019 13:57:41 +0200    

Click here for diff

Commit a7ee7c8513 fixed a bug in GiST page split during index creation,  
where we failed to re-find the position of a downlink after the page  
containing it was split. However, that fix was incomplete; the other call  
to gistinserttuples() in the same function needs to also clear  
'downlinkoffnum'.  
  
Fixes bug #16134 reported by Alexander Lakhin, for real this time. The  
previous fix was enough to fix the crash with the reproducer script for  
bug #16162, but the original script for #16134 was still crashing.  
  
Backpatch to v12, like the previous incomplete fix.  
  
Discussion: https://www.postgresql.org/message-id/d869f537-abe4-d2ea-0510-38cd053f5152%40gmail.com  

M src/backend/access/gist/gist.c

Fix build of Perl-using modules of Windows

commit   : 502423180a8cc9214861bffcb8405a42f146f160    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Dec 2019 11:48:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Dec 2019 11:48:01 +0100    

Click here for diff

Commit f14413b684d57211068ee56ee04695efcc87a23a broke the build of  
Perl-using modules on Windows.  
  
Perl might have its own definitions of uid_t and gid_t, so we hide  
ours, but then we can't use ours in our header files such as port.h  
which don't see the Perl definition.  
  
Hide our definition of getpeereid() on Windows in Perl-using modules,  
using PLPERL_HAVE_UID_GID define.  That means we can't portably use  
getpeeruid() is such modules right now, but there is no need anyway.  

M src/include/port.h

Sort out getpeereid() and peer auth handling on Windows

commit   : f14413b684d57211068ee56ee04695efcc87a23a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Oct 2019 12:58:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Oct 2019 12:58:32 +0100    

Click here for diff

The getpeereid() uses have so far been protected by HAVE_UNIX_SOCKETS,  
so they didn't ever care about Windows support.  But in anticipation  
of Unix-domain socket support on Windows, that needs to be handled  
differently.  
  
Windows doesn't support getpeereid() at this time, so we use the  
existing not-supported code path.  We let configure do its usual thing  
of picking up the replacement from libpgport, instead of the custom  
overrides that it was doing before.  
  
But then Windows doesn't have struct passwd, so this patch sprinkles  
some additional #ifdef WIN32 around to make it work.  This is similar  
to existing code that deals with this issue.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M configure
M configure.in
M src/backend/libpq/auth.c
M src/include/port.h
M src/interfaces/libpq/fe-connect.c
M src/tools/msvc/Mkvcbuild.pm

Clean up some misplaced comments in partition_join.sql regression test.

commit   : 956ef5875341c22a602fb825e6c98eaabb1ecce7    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 16 Dec 2019 17:00:15 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 16 Dec 2019 17:00:15 +0900    

Click here for diff

Also, add a comment explaining a test case.  
  
Back-patch to 11 where the regression test was added.  
  
Discussion: https://postgr.es/m/CAPmGK15adZPh2B%2BmGUjSOMH%2BH39ogDRWfCfm4G6jncZCAs9V_Q%40mail.gmail.com  

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

Remove duplicated progress reporting during heap scan of VACUUM

commit   : e5a02e0fc68bd57048f2c74a89f5412dbf87015e    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 15 Dec 2019 22:05:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 15 Dec 2019 22:05:33 +0900    

Click here for diff

This has been introduced by c16dc1a since progress reporting for VACUUM  
has been added.  As this issue just causes some extra work and is  
harmless, no backpatch is done.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

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

Try to stabilize results of new tuplesort regression test.

commit   : baa32ce28b39eccdf384e979dac5ad8be91ff44e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Dec 2019 15:01:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Dec 2019 15:01:56 -0500    

Click here for diff

It appears that a concurrent autovacuum/autoanalyze run can cause  
changes in the plans expected by this test.  To prevent that, change  
the tables it uses to be temp tables --- there's no need for them  
to be permanent, and this should save a few cycles too.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Prevent overly-aggressive collapsing of joins to RTE_RESULT relations.

commit   : 6ea364e7e7d5f298fc965006caa6c228c743fe77    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Dec 2019 13:49:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Dec 2019 13:49:15 -0500    

Click here for diff

The RTE_RESULT simplification logic added by commit 4be058fe9 had a  
flaw: it would collapse out a RTE_RESULT that is due to compute a  
PlaceHolderVar, and reassign the PHV to the parent join level, even if  
another input relation of the join contained a lateral reference to  
the PHV.  That can't work because the PHV would be computed too late.  
In practice it led to failures of internal sanity checks later in  
planning (either assertion failures or errors such as "failed to  
construct the join relation").  
  
To fix, add code to check for the presence of such PHVs in relevant  
portions of the query tree.  Notably, this required refactoring  
range_table_walker so that a caller could ask to walk individual RTEs  
not the whole list.  (It might be a good idea to refactor  
range_table_mutator in the same way, if only to keep those functions  
looking similar; but I didn't do so here as it wasn't necessary for  
the bug fix.)  
  
This exercise also taught me that find_dependent_phvs(), as it stood,  
could only safely be used on the entire Query, not on subtrees.  
Adjust its API to reflect that; which in passing allows it to have  
a fast path for the common case of no PHVs anywhere.  
  
Per report from Will Leinweber.  Back-patch to v12 where the bug  
was introduced.  
  
Discussion: https://postgr.es/m/CALLb-4xJMd4GZt2YCecMC95H-PafuWNKcmps4HLRx2NHNBfB4g@mail.gmail.com  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/nodeFuncs.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix memory leak when initializing DH parameters in backend

commit   : e0e569e1d192c3fed942257302f24b550cf982f4    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 14 Dec 2019 18:17:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 14 Dec 2019 18:17:31 +0900    

Click here for diff

When loading DH parameters used for the generation of ephemeral DH keys  
in the backend, the code has never bothered releasing the memory used  
for the DH information loaded from a file or from libpq's default.  This  
commit makes sure that the information is properly free()'d.  
  
Note that as SSL parameters can be reloaded, this can cause an accumulation  
of memory leaked.  As the leak is minor, no backpatch is done.  
  
Reported-by: Dmitry Uspenskiy  
Discussion: https://postgr.es/m/[email protected]  

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

Fix mdsyncfiletag(), take II.

commit   : 7c85be08a2d404ec2a1a6a3b089e7f08d62e5db8    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 14 Dec 2019 17:38:09 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 14 Dec 2019 17:38:09 +1300    

Click here for diff

The previous commit failed to consider that FileGetRawDesc() might  
not return a valid fd, as discovered on the build farm.  Switch to  
using the File interface only.  
  
Back-patch to 12, like the previous commit.  

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

Don't use _mdfd_getseg() in mdsyncfiletag().

commit   : 7bb3102cea02101efcbb4c4fba3fdd452a52bdab    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 14 Dec 2019 15:54:31 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 14 Dec 2019 15:54:31 +1300    

Click here for diff

_mdfd_getseg() opens all segments up to the requested one.  That  
causes problems for mdsyncfiletag(), if mdunlinkfork() has  
already unlinked other segment files.  Open the file we want  
directly by name instead, if it's not already open.  
  
The consequence of this bug was a rare panic in the checkpointer,  
made more likely if you saturated the sync request queue so that  
the SYNC_FORGET_REQUEST messages for a given relation were more  
likely to be absorbed in separate cycles by the checkpointer.  
  
Back-patch to 12.  Defect in commit 3eb77eba.  
  
Author: Thomas Munro  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20191119115759.GI30362%40telsasoft.com  

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

Fix crash when a page was split during GiST index creation.

commit   : a7ee7c85132221ff7231b6f910915a1b3ce1ecbc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Dec 2019 23:58:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Dec 2019 23:58:10 +0200    

Click here for diff

The bug was similar to the one that was fixed in commit 22251686f0. When  
we split page X and insert the downlink for the new page, the parent page  
might also need to be split. When that happens, the downlink offset number  
we remembered for X is no longer valid. We correctly called  
gistFindCorrectParent() to re-find it, but gistFindCorrectParent() doesn't  
do anything if the LSN of the page hasn't changed, and we stopped updating  
LSNs during index build in commit 9155580fd5. The buggy codepath was taken  
if the page was split into three or more pages, and inserting the downlink  
caused the parent page to split. To fix, explicitly mark the downlink  
offset number as invalid, to force gistFindCorrectParent() to re-find it.  
  
Fixes bug #16134 reported by Alexander Lakhin, reported again as #16162 by  
Andreas Kunert. Thanks to Jeff Janes, Tom Lane and Tomas Vondra for  
debugging. Backpatch to v12, where we stopped WAL-logging during index  
build.  
  
Discussion: https://www.postgresql.org/message-id/16134-0423f729671dec64%40postgresql.org  
Discussion: https://www.postgresql.org/message-id/16162-45d21b7b6c1a3105%40postgresql.org  

M src/backend/access/gist/gist.c

Modernize our readline API a tad.

commit   : 5e7bedc5adba570b526d89746201481616756779    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Dec 2019 11:16:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Dec 2019 11:16:33 -0500    

Click here for diff

Prefer to call "rl_filename_completion_function" and  
"rl_completion_matches", rather than using the names without the rl_  
prefix.  This matches Readline's documentation, and makes our code  
a little clearer about which names are external.  On platforms that  
only have the un-prefixed names (just some very ancient versions of  
libedit, AFAICT), reverse the direction of the compatibility macro  
definitions to match.  
  
Also, remove our extern declaration of "filename_completion_function";  
whatever libedit versions may have failed to declare that are surely  
dead and buried.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Put back regression test case in a more robust form.

commit   : 22864f6e02f8fc19f6167442f13d1f917e36548e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Dec 2019 13:49:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Dec 2019 13:49:54 -0500    

Click here for diff

This undoes my hurried commit 776a2c887, restoring the removed test case  
in a form that passes with or without force_parallel_mode = regress.  
  
It turns out that force_parallel_mode = regress simply fails to mask  
the Worker lines that will be produced by EXPLAIN (ANALYZE, VERBOSE).  
I'd say that's a bug in that feature, as its entire alleged reason  
for existence is to make the EXPLAIN output the same.  It's certainly  
not a bug in the plan node pruning logic.  Fortunately, this test case  
doesn't really need to use ANALYZE, so just drop that.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.

commit   : 1a3efa1eb67ab752231a6fff2743a77ae55808d5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Dec 2019 12:30:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Dec 2019 12:30:43 -0500    

Click here for diff

The test cases added by commit 26ae3aa80 exposed an old oversight in  
timestamp[tz]_part: they didn't correct the result of date2isoyear()  
for BC years, so that we produced an off-by-one answer for such years.  
Fix that, and back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/SG2PR06MB37762CAE45DB0F6CA7001EA9B6550@SG2PR06MB3776.apcprd06.prod.outlook.com  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out

Remove redundant function calls in timestamp[tz]_part().

commit   : 26ae3aa80e337261203ba4442452bed261ff9888    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Dec 2019 12:12:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Dec 2019 12:12:35 -0500    

Click here for diff

The DTK_DOW/DTK_ISODOW and DTK_DOY switch cases in timestamp_part() and  
timestamptz_part() contained calls of timestamp2tm() that were fully  
redundant with the ones done just above the switch.  This evidently crept  
in during commit 258ee1b63, which relocated that code from another place  
where the calls were indeed needed.  Just delete the redundant calls.  
  
I (tgl) noted that our test coverage of these functions left quite a  
bit to be desired, so extend timestamp.sql and timestamptz.sql to  
cover all the branches.  
  
Back-patch to all supported branches, as the previous commit was.  
There's no real issue here other than some wasted cycles in some  
not-too-heavily-used code paths, but the test coverage seems valuable.  
  
Report and patch by Li Japin; test case adjustments by me.  
  
Discussion: https://postgr.es/m/SG2PR06MB37762CAE45DB0F6CA7001EA9B6550@SG2PR06MB3776.apcprd06.prod.outlook.com  

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

(Blindly) tweak new test regex

commit   : 8ed428dc977f6d3e454892ddca089f17e150384f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Dec 2019 13:45:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Dec 2019 13:45:15 -0300    

Click here for diff

gcc-based Windows buildfarm animals are not happy about a multiline  
regular expression I added recently.  Try to accomodate; existing  
pg_basebackup tests suggest that \n should work instead of a bare  
newline, but throw in \r also.  This being perl, TIMTOWTDI.  
Also remove the pointless $ at the end of the pattern, for extra luck.  
  
(If this doesn't work, I'll probably just split the regex in two.)  
  
Per buildfarm members jacana and fairywren.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Remove extra parenthesis from comment.

commit   : a41a1456c4a1040974939db23a81101a2f6ade6f    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 12 Dec 2019 15:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 12 Dec 2019 15:45:00 +0900    

Click here for diff

M src/backend/partitioning/partbounds.c

Add readfuncs.c support for AppendRelInfo.

commit   : 591d404b9cd2c562bfe7fe60d76988d49b5ba2b1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 19:08:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 19:08:16 -0500    

Click here for diff

This is made necessary by the fact that commit 6ef77cf46 added  
AppendRelInfos to plan trees.  I'd concluded that this extra code was  
not necessary because we don't transmit that data to parallel workers  
... but I forgot about -DWRITE_READ_PARSE_PLAN_TREES.  Per buildfarm.  

M src/backend/nodes/readfuncs.c

Remove unstable test case added in commit 5935917ce.

commit   : 776a2c887480977a4327108945364fb4d84a817f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 18:53:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 18:53:53 -0500    

Click here for diff

The buildfarm says this produces some unexpected output with  
force_parallel_mode = regress.  There's probably a bug underneath  
that, but for the moment just delete the test case to make the  
buildfarm green again.  
  
(I now notice that the case had also failed to get updated to follow  
commit d52eaa094, which made plan_cache_mode = force_generic_plan  
prevail throughout partition_prune.sql; it was thereby managing to  
break a later test.  When/if we put this back in, *don't* include the  
SET and RESET commands.)  

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

Allow executor startup pruning to prune all child nodes.

commit   : 5935917ce59e2e613ac7a4b54ed49a7b9f8f28ac    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 17:05:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 17:05:30 -0500    

Click here for diff

Previously, if the startup pruning logic proved that all child nodes  
of an Append or MergeAppend could be pruned, we still kept one, just  
to keep EXPLAIN from failing.  The previous commit removed the  
ruleutils.c limitation that required this kluge, so drop it.  That  
results in less-confusing EXPLAIN output, as per a complaint from  
Yuzuko Hosoya.  
  
David Rowley  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/include/nodes/execnodes.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Further adjust EXPLAIN's choices of table alias names.

commit   : 6ef77cf46e81f45716ec981cb08781d426181378    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 17:05:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 17:05:18 -0500    

Click here for diff

This patch causes EXPLAIN to always assign a separate table alias to the  
parent RTE of an append relation (inheritance set); before, such RTEs  
were ignored if not actually scanned by the plan.  Since the child RTEs  
now always have that same alias to start with (cf. commit 55a1954da),  
the net effect is that the parent RTE usually gets the alias used or  
implied by the query text, and the children all get that alias with "_N"  
appended.  (The exception to "usually" is if there are duplicate aliases  
in different subtrees of the original query; then some of those original  
RTEs will also have "_N" appended.)  
  
This results in more uniform output for partitioned-table plans than  
we had before: the partitioned table itself gets the original alias,  
and all child tables have aliases with "_N", rather than the previous  
behavior where one of the children would get an alias without "_N".  
  
The reason for giving the parent RTE an alias, even if it isn't scanned  
by the plan, is that we now use the parent's alias to qualify Vars that  
refer to an appendrel output column and appear above the Append or  
MergeAppend that computes the appendrel.  But below the append, Vars  
refer to some one of the child relations, and are displayed that way.  
This seems clearer than the old behavior where a Var that could carry  
values from any child relation was displayed as if it referred to only  
one of them.  
  
While at it, change ruleutils.c so that the code paths used by EXPLAIN  
deal in Plan trees not PlanState trees.  This effectively reverts a  
decision made in commit 1cc29fe7c, which seemed like a good idea at  
the time to make ruleutils.c consistent with explain.c.  However,  
it's problematic because we'd really like to allow executor startup  
pruning to remove all the children of an append node when possible,  
leaving no child PlanState to resolve Vars against.  (That's not done  
here, but will be in the next patch.)  This requires different handling  
of subplans and initplans than before, but is otherwise a pretty  
straightforward change.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/utils/ruleutils.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/tablesample.out
M src/test/regress/expected/updatable_views.out

Emit parameter values during query bind/execute errors

commit   : ba79cb5dc841104cf4810b5c23af4f881079dbb5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Dec 2019 18:03:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Dec 2019 18:03:35 -0300    

Click here for diff

This makes such log entries more useful, since the cause of the error  
can be dependent on the parameter values.  
  
Author: Alexey Bashtanov, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Peter Eisentraut, Andres Freund, Tom Lane  

M doc/src/sgml/config.sgml
M src/backend/nodes/params.c
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/include/nodes/params.h
M src/include/utils/guc.h

Use only one thread to handle incoming signals on Windows.

commit   : 16114f2ea0c0aba75d10b622797d31bcd296fadd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 15:09:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Dec 2019 15:09:54 -0500    

Click here for diff

Since its inception, our Windows signal emulation code has worked by  
running a main signal thread that just watches for incoming signal  
requests, and then spawns a new thread to handle each such request.  
That design is meant for servers in which requests can take substantial  
effort to process, and it's worth parallelizing the handling of  
requests.  But those assumptions are just bogus for our signal code.  
It's not much more than pg_queue_signal(), which is cheap and can't  
parallelize at all, plus we don't really expect lots of signals to  
arrive at the same backend at once.  More importantly, this approach  
creates failure modes that we could do without: either inability to  
spawn a new thread or inability to create a new pipe handle will risk  
loss of signals.  Hence, dispense with the separate per-signal threads  
and just service each request in-line in the main signal thread.  This  
should be a bit faster (for the normal case of one signal at a time)  
as well as more robust.  
  
Patch by me; thanks to Andrew Dunstan for testing and Amit Kapila  
for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32/signal.c

Remove ATPrepSetStatistics

commit   : 105eb360f2513523d221302b2d52880a14afae34    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Dec 2019 08:59:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Dec 2019 08:59:18 +0100    

Click here for diff

It was once possible to do ALTER TABLE ... SET STATISTICS on system  
tables without allow_sytem_table_mods.  This was changed apparently by  
accident between PostgreSQL 9.1 and 9.2, but a code comment still  
claimed this was possible.  Without that functionality, having a  
separate ATPrepSetStatistics() is useless, so use the generic  
ATSimplePermissions() instead and move the remaining custom code into  
ATExecSetStatistics().  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/cc8d2648-a0ec-7a86-13e5-db473484e19e%402ndquadrant.com  

M src/backend/commands/tablecmds.c

Fix output of Unicode normalization test

commit   : b802412106e82ccf1aef36a4984e321082c122cb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 Dec 2019 08:42:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 Dec 2019 08:42:17 +0100    

Click here for diff

Several off-by-more-than-one errors caused the output in case of a  
test failure to be truncated and unintelligible.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/6a7a8516-7d11-8fbd-0e8b-eadb4f0679eb%402ndquadrant.com  

M src/common/unicode/norm_test.c

Fix some compiler warnings with timestamp parsing in formatting.c

commit   : c341c7d391e256f80cfbae53b4f55278bffca699    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Dec 2019 10:01:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Dec 2019 10:01:06 +0900    

Click here for diff

gcc-7 used with a sufficient optimization level complains about warnings  
around do_to_timestamp() regarding the initialization and handling of  
some of its variables.  Recent commits 66c74f8 and d589f94 made things  
made the interface more confusing, so document which variables are  
always expected and initialize properly the optional ones when they are  
set.  
  
Author: Andrey Lepikhov, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Fix tuple column count in pg_control_init().

commit   : 8729fa72483f8a9acf299508bb2cbae1aa9a29b8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Dec 2019 17:51:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Dec 2019 17:51:46 -0500    

Click here for diff

Oversight in commit 2e4db241b.  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/[email protected]  

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

Cosmetic cleaning of pg_config.h.win32

commit   : 877b61e9ce95934c71a9c01614db4be1b395fff6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Dec 2019 21:15:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Dec 2019 21:15:30 +0100    

Click here for diff

Clean up some comments (some generated by old versions of autoconf)  
and some random ordering differences, so it's easier to diff this  
against the default pg_config.h or pg_config.h.in.  Remove LOCALEDIR  
handling from pg_config.h.win32 altogether because it's already in  
pg_config_paths.h.  

M src/include/pg_config.h.win32
M src/tools/msvc/Solution.pm

Add backend-only appendStringInfoStringQuoted

commit   : 6cafde1bd43f1c28b044953cac2f2999eb425b22    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Dec 2019 17:09:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Dec 2019 17:09:32 -0300    

Click here for diff

This provides a mechanism to emit literal values in informative  
messages, such as query parameters.  The new code is more complex than  
what it replaces, primarily because it wants to be more efficient.  
It also has the (currently unused) additional optional capability of  
specifying a maximum size to print.  
  
The new function lives out of common/stringinfo.c so that frontend users  
of that file need not pull in unnecessary multibyte-encoding support  
code.  
  
Author: Álvaro Herrera and Alexey Bashtanov, after a suggestion from Andres Freund  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c
M src/backend/utils/mb/Makefile
M src/backend/utils/mb/README
A src/backend/utils/mb/stringinfo_mb.c
A src/include/mb/stringinfo_mb.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster log file.

commit   : 0da33c762b85aeada111aa1371c33ac6737f8396    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Dec 2019 13:17:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Dec 2019 13:17:08 -0500    

Click here for diff

On Windows, we use CMD.EXE to redirect the postmaster's stdout/stderr  
into a log file.  CMD.EXE will open that file with non-sharing-friendly  
parameters, and the file will remain open for a short time after the  
postmaster has removed postmaster.pid.  This can result in an  
ERROR_SHARING_VIOLATION failure if we attempt to start a new postmaster  
immediately with the same log file (e.g. during "pg_ctl restart").  
This seems to explain intermittent buildfarm failures we've been seeing  
on Windows machines.  
  
To fix, just open and close the log file using our own pgwin32_open(),  
which will wait if necessary to avoid the failure.  (Perhaps someday  
we should stop using CMD.EXE, but that would be a far more complex  
patch, and it doesn't seem worth the trouble ... yet.)  
  
Back-patch to v12.  This only solves the problem when frontend fopen()  
is redirected to pgwin32_fopen(), which has only been true since commit  
0ba06e0bf.  Hence, no point in back-patching further, unless we care  
to back-patch that change too.  
  
Diagnosis and patch by Alexander Lakhin (bug #16154).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

Fix handling of multiple AFTER ROW triggers on a foreign table.

commit   : 5a20b0219e7684788a1b63e812dd44b31361b259    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 10 Dec 2019 18:00:30 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 10 Dec 2019 18:00:30 +0900    

Click here for diff

AfterTriggerExecute() retrieves a fresh tuple or pair of tuples from a  
tuplestore and then stores the tuple(s) in the passed-in slot(s) if  
AFTER_TRIGGER_FDW_FETCH, while it uses the most-recently-retrieved  
tuple(s) stored in the slot(s) if AFTER_TRIGGER_FDW_REUSE.  This was  
done correctly before 12, but commit ff11e7f4b broke it by mistakenly  
clearing the tuple(s) stored in the slot(s) in that function, leading to  
an assertion failure as reported in bug #16139 from Alexander Lakhin.  
  
Also, fix some other issues with the aforementioned commit in passing:  
  
* For tg_newslot, which is a slot added to the TriggerData struct by the  
  commit to store new updated tuples, it didn't ensure the slot was NULL  
  if there was no such tuple.  
* The commit failed to update the documentation about the trigger  
  interface.  
  
Author: Etsuro Fujita  
Backpatch-through: 12  
Discussion: https://postgr.es/m/16139-94f9ccf0db6119ec%40postgresql.org  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/trigger.sgml
M src/backend/commands/trigger.c

Fix race condition in our Windows signal emulation.

commit   : 28e6a2fd6358c1b75ce2f4e7cb3fcff979dbe539    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Dec 2019 15:03:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Dec 2019 15:03:51 -0500    

Click here for diff

pg_signal_dispatch_thread() responded to the client (signal sender)  
and disconnected the pipe before actually setting the shared variables  
that make the signal visible to the backend process's main thread.  
In the worst case, it seems, effective delivery of the signal could be  
postponed for as long as the machine has any other work to do.  
  
To fix, just move the pg_queue_signal() call so that we do it before  
responding to the client.  This essentially makes pgkill() synchronous,  
which is a stronger guarantee than we have on Unix.  That may be  
overkill, but on the other hand we have not seen comparable timing bugs  
on any Unix platform.  
  
While at it, add some comments to this sadly underdocumented code.  
  
Problem diagnosis and fix by Amit Kapila; I just added the comments.  
  
Back-patch to all supported versions, as it appears that this can cause  
visible NOTIFY timing oddities on all of them, and there might be  
other misbehavior due to slow delivery of other signals.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32/signal.c

Improve isolationtester's timeout management.

commit   : 99351a8b5a3882ee5d131bd37d03a67ab07b4fea    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Dec 2019 14:31:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Dec 2019 14:31:57 -0500    

Click here for diff

isolationtester.c had a hard-wired limit of 3 minutes per test step.  
It now emerges that this isn't quite enough for some of the slowest  
buildfarm animals.  This isn't the first time we've had to raise  
this limit (cf. 1db439ad4), so let's make it configurable.  This  
patch raises the default to 5 minutes, and introduces an environment  
variable PGISOLATIONTIMEOUT that can be set if more time is needed,  
following the precedent of PGCTLTIMEOUT.  
  
Also, modify isolationtester so that when the timeout is hit,  
it explicitly reports having sent a cancel.  This makes the regression  
failure log considerably more intelligible.  (In the worst case, a  
timed-out test might actually be reported as "passing" without this  
extra output, so arguably this is a bug fix in itself.)  
  
In passing, update the README file, which had apparently not gotten  
touched when we added "make check" support here.  
  
Back-patch to 9.6; older versions don't have comparable timeout logic.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/README
M src/test/isolation/isolationtester.c

Fix typos in miscinit.c.

commit   : 2d0fdfaccec8b314895e026018874dcc5565b43e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 9 Dec 2019 08:39:34 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 9 Dec 2019 08:39:34 +0530    

Click here for diff

Commit f13ea95f9e moved the description of postmaster.pid file contents  
from miscadmin.h to pidfile.h, but missed to update the comments in  
miscinit.c.  
  
Author: Hadi Moshayedi  
Reviewed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAK=1=WpYEM9x3LGkaxgXaxeYQjnkdW8XLsxrYRTE2Gq-H83FMw@mail.gmail.com  

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

Document search_path security with untrusted dbowner or CREATEROLE.

commit   : fd5e16e782fc6cd829b27e2c83c623b8020e5774    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 8 Dec 2019 11:06:26 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 8 Dec 2019 11:06:26 -0800    

Click here for diff

Commit 5770172cb0c9df9e6ce27c507b449557e5b45124 wrote, incorrectly, that  
certain schema usage patterns are secure against CREATEROLE users and  
database owners.  When an untrusted user is the database owner or holds  
CREATEROLE privilege, a query is secure only if its session started with  
SELECT pg_catalog.set_config('search_path', '', false) or equivalent.  
Back-patch to 9.4 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Doc: improve documentation about run-time pruning's effects on EXPLAIN.

commit   : a395e21e989af0c2aab9dd1b1e0a1842ca42a063    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Dec 2019 10:36:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Dec 2019 10:36:29 -0500    

Click here for diff

Tatsuo Ishii complained that this para wasn't very intelligible.  
Try to make it better.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/perform.sgml

Remove PQsslpassword function

commit   : e75b1e33710249d1699850920c0390fb08ea5673    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 7 Dec 2019 09:20:53 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 7 Dec 2019 09:20:53 -0500    

Click here for diff

This partially reverts commit 4dc6355210.  
  
The information returned by the function can be obtained by calling  
PQconninfo(), so the function is redundant.  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-fe.h

Improve test coverage of ruleutils.c.

commit   : 830d1c73b3f4524bc897ddab5c6c3b47840c915a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Dec 2019 17:40:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Dec 2019 17:40:24 -0500    

Click here for diff

While fooling around with the EXPLAIN improvements I've been working  
on, I noticed that there were some large gaps in our test coverage  
of ruleutils.c, according to the code coverage report.  This commit  
just adds a few test cases to improve coverage of:  
get_name_for_var_field()  
get_update_query_targetlist_def()  
isSimpleNode()  
get_sublink_expr()  

M src/test/regress/expected/create_view.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/rules.sql

Fix comments in execGrouping.c

commit   : 30d47723fd151641e89d18ce775f1a102ff07ae2    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 6 Dec 2019 11:47:59 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 6 Dec 2019 11:47:59 -0800    

Click here for diff

Commit 5dfc1981 missed updating some comments.  
  
Also, fix a comment typo found in passing.  
  
Author: Jeff Davis  
Discussion: https://postgr.es/m/9723131d247b919f94699152647fa87ee0bc02c2.camel%40j-davis.com  

M src/backend/executor/execGrouping.c
M src/include/nodes/execnodes.h

Disallow non-default collation in ADD PRIMARY KEY/UNIQUE USING INDEX.

commit   : fbbf68094c5ff3d513969d072126c92932e484da    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Dec 2019 11:25:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Dec 2019 11:25:09 -0500    

Click here for diff

When creating a uniqueness constraint using a pre-existing index,  
we have always required that the index have the same properties you'd  
get if you just let a new index get built.  However, when collations  
were added, we forgot to add the index's collation to that check.  
  
It's hard to trip over this without intentionally trying to break it:  
you'd have to explicitly specify a different collation in CREATE  
INDEX, then convert it to a pkey or unique constraint.  Still, if you  
did that, pg_dump would emit a script that fails to reproduce the  
index's collation.  The main practical problem is that after a  
pg_upgrade the index would be corrupt, because its actual physical  
order wouldn't match what pg_index says.  A more theoretical issue,  
which is new as of v12, is that if you create the index with a  
nondeterministic collation then it wouldn't be enforcing the normal  
notion of uniqueness, causing the constraint to mean something  
different from a normally-created constraint.  
  
To fix, just add collation to the conditions checked for index  
acceptability in ADD PRIMARY KEY/UNIQUE USING INDEX.  We won't try  
to clean up after anybody who's already created such a situation;  
it seems improbable enough to not be worth the effort involved.  
(If you do get into trouble, a REINDEX should be enough to fix it.)  
  
In principle this is a long-standing bug, but I chose not to  
back-patch --- the odds of causing trouble seem about as great  
as the odds of preventing it, and both risks are very low anyway.  
  
Per report from Alexey Bashtanov, though this is not his preferred  
fix.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix handling of OpenSSL's SSL_clear_options

commit   : 7d0bcb04771764aa3023e5a5089459d40dbd5e65    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 6 Dec 2019 15:13:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 6 Dec 2019 15:13:55 +0900    

Click here for diff

This function is supported down to OpenSSL 0.9.8, which is the oldest  
version supported since 593d4e4 (from Postgres 10 onwards), and is used  
since e3bdb2d (from 11 onwards).  It is defined as a macro from OpenSSL  
0.9.8 to 1.0.2, and as a function in 1.1.0 and newer versions.  However,  
the configure check present is only adapted for functions.  So, even if  
the code would be able to compile, configure fails to detect the macro,  
causing it to be ignored when compiling the code with OpenSSL from 0.9.8  
to 1.0.2.  
  
The code needs a configure check as per a364dfa, which has fixed a  
compilation issue with a past version of LibreSSL in NetBSD 5.1.  On  
HEAD, just remove the configure check as the last release of NetBSD 5 is  
from 2014 (and we have no more buildfarm members for it).  In 11 and 12,  
improve the configure logic so as both macros and functions are  
correctly detected.  This makes NetBSD 5 still work on already-released  
branches, but not for 13 onwards.  
  
The patch for HEAD is from me, and Daniel has written the version to use  
for the back-branches.  
  
Author: Michael Paquier, Daniel Gustaffson  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/libpq/fe-secure-openssl.c

Improve some comments in pg_upgrade.c

commit   : 690c880269bf08dfb3f5bffb02be67e7e2a6c0f3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 6 Dec 2019 11:55:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 6 Dec 2019 11:55:04 +0900    

Click here for diff

When restoring database schemas on a new cluster, database "template1"  
is processed first, followed by all other databases in parallel,  
including "postgres".  Both "postgres" and "template1" have some extra  
handling to propagate each one's properties, but comments were confusing  
regarding which one is processed where.  
  
Author: Julien Rouhaud  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAOBaU_a2iviTG7FE10yO_gcW+zQCHNFhRA_NDiktf3UR65BHdw@mail.gmail.com  

M src/bin/pg_upgrade/pg_upgrade.c

Remove configure check for OpenSSL's SSL_get_current_compression()

commit   : 28f4bba66b572d6b3b8dc4fcf4e585821e0a5363    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 6 Dec 2019 09:41:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 6 Dec 2019 09:41:32 +0900    

Click here for diff

This function has been added in OpenSSL 0.9.8, which is the oldest  
version supported on HEAD, so checking for it at configure time is  
useless.  Both the frontend and backend code did not even bother to use  
it.  
  
Reported-by: Daniel Gustafsson  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h

pg_basebackup: Refactor code for reading COPY and tar data.

commit   : 431ba7bebf139b6edf5544ce18f39a1a4dcb8110    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Dec 2019 15:14:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Dec 2019 15:14:09 -0500    

Click here for diff

Add a new function ReceiveCopyData that does just that, taking a  
callback as an argument to specify what should be done with each chunk  
as it is received. This allows a single copy of the logic to be shared  
between ReceiveTarFile and ReceiveAndUnpackTarFile, and eliminates  
a few #ifdef conditions based on HAVE_LIBZ.  
  
While this is slightly more code, it's arguably clearer, and  
there is a pending patch that introduces additional calls to  
ReceiveCopyData.  
  
This commit is not intended to result in any functional change.  
  
Discussion: http://postgr.es/m/CA+TgmoYZDTHbSpwZtW=JDgAhwVAYvmdSrRUjOd+AYdfNNXVBDg@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Minor comment improvements for instrumentation.h

commit   : 42f362967d9f82043608610c689c24046e07497c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 5 Dec 2019 07:53:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 5 Dec 2019 07:53:12 -0500    

Click here for diff

Remove a duplicated word. Add "of" or "# of" in a couple places  
for clarity and consistency. Start comments with a lower case  
letter as we do elsewhere in this file.  
  
Rafia Sabih  

M src/include/executor/instrument.h

Blind attempt at fixing ecpg/compatlib's build

commit   : 9a798234963cd1f746ded41453392c257a4f9fdd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 4 Dec 2019 20:15:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 4 Dec 2019 20:15:11 -0300    

Click here for diff

It now needs libpgcommon in order to get pnstrdup.  
  
Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Offer pnstrdup to frontend code

commit   : 0b9466fce2cf4f8c32b3a9170ca272829aa11e66    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 4 Dec 2019 19:36:06 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 4 Dec 2019 19:36:06 -0300    

Click here for diff

We already had it on the backend.  Frontend can also use it now.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_waldump/pg_waldump.c
M src/bin/psql/prompt.c
M src/bin/scripts/common.c
M src/common/fe_memutils.c
M src/include/common/fe_memutils.h
M src/interfaces/ecpg/compatlib/informix.c

Update minimum SSL version

commit   : b1abfec825472434ea445b9700eaa80cde9da86a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Dec 2019 21:40:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Dec 2019 21:40:17 +0100    

Click here for diff

Change default of ssl_min_protocol_version to TLSv1.2 (from TLSv1,  
which means 1.0).  Older versions are still supported, just not by  
default.  
  
TLS 1.0 is widely deprecated, and TLS 1.1 only slightly less so.  All  
OpenSSL versions that support TLS 1.1 also support TLS 1.2, so there  
would be very little reason to, say, set the default to TLS 1.1  
instead on grounds of better compatibility.  
  
The test suite overrides this new setting, so it can still run with  
older OpenSSL versions.  
  
Discussion: https://www.postgresql.org/message-id/flat/b327f8df-da98-054d-0cc5-b76a857cfed9%402ndquadrant.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/test/ssl/t/SSLServer.pm

Fix whitespace.

commit   : 4af77aa797d95f9f77d7b88a41b4e02bc62d8975    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 4 Dec 2019 12:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 4 Dec 2019 12:45:00 +0900    

Click here for diff

M src/backend/executor/nodeModifyTable.c

Use carriage returns for data insertion logs in pgbench on terminal

commit   : d37ddb745be07502814635585cbf935363c8a33d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Dec 2019 11:33:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Dec 2019 11:33:14 +0900    

Click here for diff

This is similar to what pg_basebackup and pg_rewind do when reporting  
cumulative data, and that's more user-friendly.  Carriage returns are  
now used when stderr points to a terminal, and newlines are used in  
other cases, like a redirection to a log file.  
  
Author: Amit Langote  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/CA+HiwqFNwEjPeVaQsp2L7DyCPv1Eg1guwhrVhzMYqUJUk8ULKg@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Remove unnecessary definition of CancelRequested in bin/scripts/

commit   : 85b9ef5fe7533e5d07dcf2a2b67c8855a34e5125    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Dec 2019 10:06:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Dec 2019 10:06:45 +0900    

Click here for diff

This variable is now part of the refactored code for query cancellation  
in fe_utils.  This fixes an oversight in commit a4fd3aa.  While on it,  
improve some header includes in bin/scripts/.  
  
Author: Michael Paquier  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/reindexdb.c
M src/bin/scripts/scripts_parallel.c
M src/bin/scripts/vacuumdb.c

Ensure maxlen is at leat 1 in dict_int

commit   : b5273943679d22f58f1e1e269ad75e791172f557    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 3 Dec 2019 16:55:51 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 3 Dec 2019 16:55:51 +0100    

Click here for diff

The dict_int text search dictionary template accepts maxlen parameter,  
which is then used to cap the length of input strings. The value was  
not properly checked, and the code simply does  
  
    txt[d->maxlen] = '\0';  
  
to insert a terminator, leading to segfaults with negative values.  
  
This commit simply rejects values less than 1. The issue was there since  
dct_int was introduced in 9.3, so backpatch all the way back to 9.4  
which is the oldest supported version.  
  
Reported-by: cili  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M contrib/dict_int/dict_int.c
M contrib/dict_int/expected/dict_int.out
M contrib/dict_int/sql/dict_int.sql

Further sync postgres_fdw's "Relations" output with the rest of EXPLAIN.

commit   : bf39b3af6a9c6a036aae0742cf339fce662eee3a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Dec 2019 12:25:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Dec 2019 12:25:56 -0500    

Click here for diff

EXPLAIN generally only adds schema qualifications to table names when  
VERBOSE is specified.  In postgres_fdw's "Relations" output, table  
names were always so qualified, but that was an implementation  
restriction: in the original coding, we didn't have access to the  
verbose flag at the time the string was generated.  After the code  
rearrangement of commit 4526951d5, we do have that info available  
at the right time, so make this output follow the normal rule.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c

Fix thinkos from commit 9989d37

commit   : 68ab982906187fba3530a01b01eb065ea9134298    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Dec 2019 18:59:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Dec 2019 18:59:09 +0900    

Click here for diff

Error messages referring to incorrect WAL segment names could have been  
generated for a fsync() failure or when creating a new segment at the  
end of recovery.  

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

Fix alter_system_table test

commit   : 88d45ac752ae49dbfafeb163b07381d3b8a6b601    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Dec 2019 09:14:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Dec 2019 09:14:35 +0100    

Click here for diff

Add workaround for disabling ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS  
warning for the test that tries to create a tablespace with a reserved  
name.  
  
Discussion: https://www.postgresql.org/message-id/flat/E1iacW7-0003h6-6U%40gemulon.postgresql.org  

M src/test/modules/unsafe_tests/expected/alter_system_table.out
M src/test/modules/unsafe_tests/sql/alter_system_table.sql

Remove XLogFileNameP() from the tree

commit   : 9989d37d1c8dff12f20a1de8e1f470093136c893    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Dec 2019 15:06:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Dec 2019 15:06:04 +0900    

Click here for diff

XLogFileNameP() is a wrapper routine able to build a palloc'd string for  
a WAL segment name, which is used for error string generation.  There  
were several code paths where it gets called in a critical section,  
where memory allocation is not allowed.  This results in triggering  
an assertion failure instead of generating the wanted error message.  
  
Another, more annoying, problem is that if the allocation to generate  
the WAL segment name fails on OOM, then the failure would be escalated  
to a PANIC.  
  
This removes the routine and all its callers are replaced with a logic  
using a fixed-size buffer.  This way, all the existing mistakes are  
fixed and future ones are prevented.  
  
Author: Masahiko Sawada  
Reviewed-by: Michael Paquier, Álvaro Herrera  
Discussion: https://postgr.es/m/CA+fd4k5gC9H4uoWMLg9K_QfNrnkkdEw+-AFveob9YX7z8JnKTA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h

Fix failures with TAP tests of pg_ctl on Windows

commit   : e5532f194c18e6c12c3aa9cb07291973dc8adb39    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Dec 2019 13:01:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Dec 2019 13:01:06 +0900    

Click here for diff

On Windows, all the hosts spawned by the TAP tests bind to 127.0.0.1.  
Hence, if there is a port conflict, starting a cluster would immediately  
fail.  One of the test scripts of pg_ctl initializes a node without  
PostgresNode.pm, using the default port 5432.  This could cause  
unexpected startup failures in the tests if an independent server was up  
and running on the same host (the reverse is also possible, though more  
unlikely).  Fix this issue by assigning properly a free port to the node  
configured, in the same range used as for the other nodes part of the  
tests.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/bin/pg_ctl/t/001_start_stop.pl

Fix EXPLAIN's column alias output for mismatched child tables.

commit   : 55a1954da16e041f895e5c3a6abff13c5e3a4a2f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Dec 2019 19:08:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Dec 2019 19:08:10 -0500    

Click here for diff

If an inheritance/partitioning parent table is assigned some column  
alias names in the query, EXPLAIN mapped those aliases onto the  
child tables' columns by physical position, resulting in bogus output  
if a child table's columns aren't one-for-one with the parent's.  
  
To fix, make expand_single_inheritance_child() generate a correctly  
re-mapped column alias list, rather than just copying the parent  
RTE's alias node.  (We have to fill the alias field, not just  
adjust the eref field, because ruleutils.c will ignore eref in  
favor of looking at the real column names.)  
  
This means that child tables will now always have alias fields in  
plan rtables, where before they might not have.  That results in  
a rather substantial set of regression test output changes:  
EXPLAIN will now always show child tables with aliases that match  
the parent table (usually with "_N" appended for uniqueness).  
But that seems like a net positive for understandability, since  
the parent alias corresponds to something that actually appeared  
in the original query, while the child table names didn't.  
(Note that this does not change anything for cases where an explicit  
table alias was written in the query for the parent table; it  
just makes cases without such aliases behave similarly to that.)  
Hence, while we could avoid these subsidiary changes if we made  
inherit.c more complicated, we choose not to.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/util/inherit.c
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/tablesample.out
M src/test/regress/expected/union.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/update.out
M src/test/regress/expected/with.out
M src/test/regress/sql/partition_prune.sql

Add a reverse-translation column number array to struct AppendRelInfo.

commit   : ce76c0ba53e4bd0daf3db7a703671b27797b7244    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Dec 2019 18:05:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Dec 2019 18:05:29 -0500    

Click here for diff

This provides for cheaper mapping of child columns back to parent  
columns.  The one existing use-case in examine_simple_variable()  
would hardly justify this by itself; but an upcoming bug fix will  
make use of this array in a mainstream code path, and it seems  
likely that we'll find other uses for it as we continue to build  
out the partitioning infrastructure.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/pathnodes.h

Make postgres_fdw's "Relations" output agree with the rest of EXPLAIN.

commit   : 4526951d564a7eed512b4a0ac3b5893e0a115690    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Dec 2019 16:31:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Dec 2019 16:31:03 -0500    

Click here for diff

The relation aliases shown in the "Relations" line for a foreign scan  
didn't always agree with those used in the rest of EXPLAIN's output.  
The regression test result changes appearing here provide examples.  
  
It's really impossible for postgres_fdw to duplicate EXPLAIN's alias  
assignment logic during postgresGetForeignRelSize(), because of the  
de-duplication that EXPLAIN does on a global basis --- and anyway,  
trying to duplicate that would be unmaintainable.  Instead, just put  
numeric rangetable indexes into the string, and convert those to  
table names/aliases in postgresExplainForeignScan, which does have  
access to the results of ruleutils.c's alias assignment logic.  
Aside from being more reliable, this shifts some work from planning  
to EXPLAIN, which is a good tradeoff for performance.  (I also  
changed from using StringInfo to using psprintf, which makes the  
code slightly simpler and reduces its memory consumption.)  
  
A kluge required by this solution is that we have to reverse-engineer  
the rtoffset applied by setrefs.c.  If that logic ever fails  
(presumably because the member tables of a join got offset by  
different amounts), we'll need some more cooperation with setrefs.c  
to keep things straight.  But for now, there's no need for that.  
  
Arguably this is a back-patchable bug fix, but since this is a mostly  
cosmetic issue and there have been no field complaints, I'll refrain  
for now.  
  
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/postgres_fdw.h

Add query cancellation capabilities in pgbench init phase

commit   : 1d468b9ad81b9139b4a0b16b416c3597925af4b0    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 Dec 2019 11:42:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 Dec 2019 11:42:28 +0900    

Click here for diff

This can be useful to stop data generation happening on the server for  
long-running queries caused by large scale factors.  This cannot happen  
by default as data is generated on the client, but it is possible to  
control the initialization steps of pgbench to do that.  
  
Reported-by: Fujii Masao  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1910311939430.27369@lancre  
Discussion: https://postgr.es/m/CAHGQGwHWEyTXxZh46qgFY8a2bDF_EYeUdp3+_Hy=qLZSzwVPKg@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Refactor query cancellation code into src/fe_utils/

commit   : a4fd3aa719e8f97299dfcf1a8f79b3017e2b8d8b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 Dec 2019 11:18:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 Dec 2019 11:18:56 +0900    

Click here for diff

Originally, this code was duplicated in src/bin/psql/ and  
src/bin/scripts/, but it can be useful for other frontend applications,  
like pgbench.  This refactoring offers the possibility to setup a custom  
callback which would get called in the signal handler for SIGINT or when  
the interruption console events happen on Windows.  
  
Author: Fabien Coelho, with contributions from Michael Paquier  
Reviewed-by: Álvaro Herrera, Ibrar Ahmed  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1910311939430.27369@lancre  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/large_obj.c
M src/bin/psql/startup.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/Makefile
A src/fe_utils/cancel.c
A src/include/fe_utils/cancel.h
M src/tools/msvc/Mkvcbuild.pm

Add dummy versions of new SSL functions for non-SSL builds

commit   : c01ac6dcba0aa65ad237c3af4a67bc70da8e4b0e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 1 Dec 2019 17:49:43 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 1 Dec 2019 17:49:43 -0500    

Click here for diff

This rectifies an oversight in commit 4dc6355210, which caused certain  
builds to fail, especially on Windows.  

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

Fix misbehavior with expression indexes on ON COMMIT DELETE ROWS tables.

commit   : c35b714caff008c875b484656de7d168a7bc45f9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 1 Dec 2019 13:09:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 1 Dec 2019 13:09:26 -0500    

Click here for diff

We implement ON COMMIT DELETE ROWS by truncating tables marked that  
way, which requires also truncating/rebuilding their indexes.  But  
RelationTruncateIndexes asks the relcache for up-to-date copies of any  
index expressions, which may cause execution of eval_const_expressions  
on them, which can result in actual execution of subexpressions.  
This is a bad thing to have happening during ON COMMIT.  Manuel Rigger  
reported that use of a SQL function resulted in crashes due to  
expectations that ActiveSnapshot would be set, which it isn't.  
The most obvious fix perhaps would be to push a snapshot during  
PreCommit_on_commit_actions, but I think that would just open the door  
to more problems: CommitTransaction explicitly expects that no  
user-defined code can be running at this point.  
  
Fortunately, since we know that no tuples exist to be indexed, there  
seems no need to use the real index expressions or predicates during  
RelationTruncateIndexes.  We can set up dummy index expressions  
instead (we do need something that will expose the right data type,  
as there are places that build index tupdescs based on this), and  
just ignore predicates and exclusion constraints.  
  
In a green field it'd likely be better to reimplement ON COMMIT DELETE  
ROWS using the same "init fork" infrastructure used for unlogged  
relations.  That seems impractical without catalog changes though,  
and even without that it'd be too big a change to back-patch.  
So for now do it like this.  
  
Per private report from Manuel Rigger.  This has been broken forever,  
so back-patch to all supported branches.  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/index.h
M src/include/utils/relcache.h
M src/test/regress/expected/temp.out
M src/test/regress/sql/temp.sql

libq support for sslpassword connection param, DER format keys

commit   : 4dc63552109f65cebbe168203bd62c5e4c753162    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 30 Nov 2019 15:27:13 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 30 Nov 2019 15:27:13 -0500    

Click here for diff

This patch providies for support for password protected SSL client  
keys in libpq, and for DER format keys, both encrypted and unencrypted.  
There is a new connection parameter sslpassword, which is supplied to  
the OpenSSL libraries via a callback function. The callback function can  
also be set by an application by calling PQgetSSLKeyPassHook(). There is  
also a function to retreive the connection setting, PQsslpassword().  
  
Craig Ringer and Andrew Dunstan  
  
Reviewed by: Greg Nancarrow  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/expected/dblink.out
M doc/src/sgml/libpq.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/Makefile
A src/test/ssl/ssl/client-der.key
A src/test/ssl/ssl/client-encrypted-der.key
A src/test/ssl/ssl/client-encrypted-pem.key
M src/test/ssl/t/001_ssltests.pl

Fix off-by-one error in PGTYPEStimestamp_fmt_asc

commit   : 3ff660bbeb96086cb1cf880bfb4e2e350cbd21b2    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 30 Nov 2019 14:51:27 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 30 Nov 2019 14:51:27 +0100    

Click here for diff

When using %b or %B patterns to format a date, the code was simply using  
tm_mon as an index into array of month names. But that is wrong, because  
tm_mon is 1-based, while array indexes are 0-based. The result is we  
either use name of the next month, or a segfault (for December).  
  
Fix by subtracting 1 from tm_mon for both patterns, and add a regression  
test triggering the issue. Backpatch to all supported versions (the bug  
is there far longer, since at least 2003).  
  
Reported-by: Paul Spencer  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/16143-0d861eb8688d3fef%40postgresql.org  

M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stderr
M src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stdout
M src/interfaces/ecpg/test/pgtypeslib/dt_test.pgc

Revert commits 290acac92b and 8a7e9e9dad.

commit   : 98a9b37ba70f24b28478360d9cf7f190b0f75f8d    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 30 Nov 2019 07:43:42 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 30 Nov 2019 07:43:42 +0530    

Click here for diff

This commit revert the commits to add a test case that tests the 'force'  
option when there is an active backend connected to the database being  
dropped.  
  
This feature internally sends SIGTERM to all the backends connected to the  
database being dropped and then the same is reported to the client.  We  
found that on Windows, the client end of the socket is not able to read  
the data once we close the socket in the server which leads to loss of  
error message which is not what we expect.  We also observed  similar  
behavior in other cases like pg_terminate_backend(),  
pg_ctl kill TERM <pid>.  There are probably a few others like that.  The  
fix for this requires further study.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/t/050_dropdb.pl
D src/bin/scripts/t/051_dropdb_force.pl
M src/test/perl/TestLib.pm
M src/test/recovery/t/013_crash_restart.pl

Small code simplification

commit   : e6c2d17c5367ddcd900450c6a857dac8630da0ca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 10:55:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 10:55:31 +0100    

Click here for diff

FLOAT8PASSBYVAL can be used instead of USE_FLOAT8_BYVAL here.  

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

Add a regression test for allow_system_table_mods

commit   : 7fc380f83d466b43a8f65bb52c925c1ab19736ea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    

Click here for diff

Add a regression test file that exercises the kinds of commands that  
allow_system_table_mods allows.  
  
This is put in the "unsafe_tests" suite, so it won't accidentally  
create a mess if someone runs the normal regression tests against an  
instance that they care about.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com  

M src/test/modules/unsafe_tests/Makefile
A src/test/modules/unsafe_tests/expected/alter_system_table.out
A src/test/modules/unsafe_tests/sql/alter_system_table.sql
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Make allow_system_table_mods settable at run time

commit   : c4a7a392ec8f0ff7701d84768080721ff8a7782e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    

Click here for diff

Make allow_system_table_mods settable at run time by superusers.  It  
was previously postmaster start only.  
  
We don't want to make system catalog DDL wide-open, but there are  
occasionally useful things to do like setting reloptions or statistics  
on a busy system table, and blocking those doesn't help anyone.  Also,  
this enables the possibility of writing a test suite for this setting.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com  

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

Remove any-user DML capability from allow_system_table_mods

commit   : 508bf95b767140ec1a339bcb53538d21deb9d995    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 10:04:45 +0100    

Click here for diff

Previously, allow_system_table_mods allowed a non-superuser to do DML  
on a system table without further permission checks.  This has been  
removed, as it was quite inconsistent with the rest of the meaning of  
this setting.  (Since allow_system_table_mods was previously only  
accessible with a server restart, it is unlikely that anyone was using  
this possibility.)  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com  

M src/backend/catalog/aclchk.c

Add error position to an error message

commit   : d4feadeca1591fd5fe91bdf73a7897553f5366d7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 09:10:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Nov 2019 09:10:17 +0100    

Click here for diff

Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Use memcpy instead of a byte loop in pglz_decompress

commit   : c60e520f6e0e8db9618cad042df071a6752f3c06    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 28 Nov 2019 23:29:30 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 28 Nov 2019 23:29:30 +0100    

Click here for diff

The byte loop used in pglz_decompress() because of possible overlap may  
be quite inefficient, so this commit replaces it with memcpy. The gains  
do depend on the data (compressibility) and hardware, but seem to be  
quite significant.  
  
Author: Andrey Borodin  
Reviewed-by: Michael Paquier, Konstantin Knizhnik, Tels  
Discussion: https://postgr.es/m/[email protected]  

M src/common/pg_lzcompress.c

Remove unnecessary clauses_attnums variable

commit   : 6d61c3f1cb7134c3ad80d29e216563571cc43de2    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 28 Nov 2019 23:25:14 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 28 Nov 2019 23:25:14 +0100    

Click here for diff

Commit c676e659b2 reworked how choose_best_statistics() picks the best  
extended statistics, but failed to remove clauses_attnums which is now  
unnecessary. So get rid of it and backpatch to 12, same as c676e659b2.  
  
Author: Tomas Vondra  
Discussion: https://postgr.es/m/CA+u7OA7H5rcE2=8f263w4NZD6ipO_XOrYB816nuLXbmSTH9pQQ@mail.gmail.com  
Backpatch-through: 12  

M src/backend/statistics/extended_stats.c

Fix choose_best_statistics to check clauses individually

commit   : c676e659b246f94d571b57b559f80cb2dc03e73b    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 28 Nov 2019 22:20:28 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 28 Nov 2019 22:20:28 +0100    

Click here for diff

When picking the best extended statistics object for a list of clauses,  
it's not enough to look at attnums extracted from the clause list as a  
whole. Consider for example this query with OR clauses:  
  
   SELECT * FROM t WHERE (t.a = 1) OR (t.b = 1) OR (t.c = 1)  
  
with a statistics defined on columns (a,b). Relying on attnums extracted  
from the whole OR clause, we'd consider the statistics usable. That does  
not work, as we see the conditions as a single OR-clause, referencing an  
attribute not covered by the statistic, leading to empty list of clauses  
to be estimated using the statistics and an assert failure.  
  
This changes choose_best_statistics to check which clauses are actually  
covered, and only using attributes from the fully covered ones. For the  
previous example this means the statistics object will not be considered  
as compatible with the OR-clause.  
  
Backpatch to 12, where MCVs were introduced. The issue does not affect  
older versions because functional dependencies don't handle OR clauses.  
  
Author: Tomas Vondra  
Reviewed-by: Dean Rasheed  
Reported-By: Manuel Rigger  
Discussion: https://postgr.es/m/CA+u7OA7H5rcE2=8f263w4NZD6ipO_XOrYB816nuLXbmSTH9pQQ@mail.gmail.com  
Backpatch-through: 12  

M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/include/statistics/statistics.h
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Remove useless "return;" lines

commit   : 3974c4a72459fc07acef3ee1369d63a7b8305b62    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Nov 2019 16:48:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Nov 2019 16:48:37 -0300    

Click here for diff

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

M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_standby/pg_standby.c
M contrib/pgcrypto/mbuf.c
M contrib/seg/seg.c
M contrib/sepgsql/selinux.c
M src/backend/access/gist/gist.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/libpq/hba.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/datetime.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/psql/common.c
M src/fe_utils/print.c
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/libpq/fe-auth-scram.c
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_exec.c
M src/port/win32error.c
M src/test/examples/testlo.c
M src/test/examples/testlo64.c

Add tests for '-f' option in dropdb utility.

commit   : 8a7e9e9dad56419ff987e5f6baaf411a03c1951a    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 28 Nov 2019 11:46:57 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 28 Nov 2019 11:46:57 +0530    

Click here for diff

This will test that the force option works when there is an active backend  
connected to the database being dropped.  
  
Author: Pavel Stehule and Vignesh C  
Reviewed-by: Amit Kapila and Vignesh C  
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com  

M src/bin/scripts/t/050_dropdb.pl
A src/bin/scripts/t/051_dropdb_force.pl

Move pump_until to TestLib.pm.

commit   : 290acac92b1d7bebb4ec68fe8b7a5cb442333eda    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 28 Nov 2019 08:28:17 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 28 Nov 2019 08:28:17 +0530    

Click here for diff

The subroutine pump_until provides the functionality to poll until the  
given string is matched, or a timeout occurs.  This can be used from other  
places as well, so moving it to TestLib.pm.  The immediate need is for an  
upcoming regression test patch for dropdb utility.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com  

M src/test/perl/TestLib.pm
M src/test/recovery/t/013_crash_restart.pl

pg_upgrade: adjust error paragraph width to be consistent

commit   : 60b35b7f1ea1d5cd17805e30299fd21616855b7d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 27 Nov 2019 20:36:33 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 27 Nov 2019 20:36:33 -0500    

Click here for diff

Previously these error paragraphs were too wide.  
  
Backpatch-through: 13  

M src/bin/pg_upgrade/check.c

pg_upgrade: improve instructions for fixing incompatible isn use

commit   : f0b57aec1d41f89611efac4d6938a725b056ed00    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 27 Nov 2019 20:24:57 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 27 Nov 2019 20:24:57 -0500    

Click here for diff

This clarifies instructions on how to dump/reload databases that use  
incompatible isn versions.  
  
Reported-by: Alvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
  
Backpatch-through: 13  

M src/bin/pg_upgrade/check.c

Don't use native methods in TestLib::slurp_file on Msys

commit   : f6f59826f01188aa9603983d00b0cd3496e9359d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 27 Nov 2019 15:45:44 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 27 Nov 2019 15:45:44 -0500    

Click here for diff

Commit 114541d58e has upset some buildfarm members running Msys, that  
weren't previously having problems, so the use of native Windows methods  
to open files is restricted by this patch to only MSVC builds.  

M src/test/perl/TestLib.pm

Revert "Close stdin where it's not needed in TestLib.pm procedures"

commit   : ca266a069a20c32a8f0a1df982a5a67d9483bcb3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 27 Nov 2019 07:19:22 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 27 Nov 2019 07:19:22 -0500    

Click here for diff

This reverts commits 9af34f3c6b and 792dba73c8.  
  
The code has been found not to be portable.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/TestLib.pm

Move configure --disable-float8-byval to pg_config_manual.h

commit   : 4513d8b07bf342028ca95250b6e1d759858abdd3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Nov 2019 11:21:02 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Nov 2019 11:21:02 +0100    

Click here for diff

This build option was once useful to maintain compatibility with  
version-0 functions, but those are no longer supported, so this option  
is no longer useful for end users.  We keep the option available to  
developers in pg_config_manual.h so that it is easy to test the  
pass-by-reference code paths without having to fire up a 32-bit  
machine.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M configure
M configure.in
M doc/src/sgml/installation.sgml
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config_manual.h
M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Fix typo in comment.

commit   : 47a3c7fa06538c181be815db44b5d7e8efe696ef    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 27 Nov 2019 16:00:45 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 27 Nov 2019 16:00:45 +0900    

Click here for diff

M src/backend/optimizer/util/relnode.c

Fix closing stdin in TestLib.pm

commit   : 792dba73c8f30528e51c4967d3be8ec4bdc5234b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 26 Nov 2019 16:23:00 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 26 Nov 2019 16:23:00 -0500    

Click here for diff

Commit 9af34f3c6b naively assumed that all non-windows platforms would  
have pseudoterminals and that perl would have IO::Pty. Such is not the  
case. Instead of assumung anything, test for the presence of IO::Pty and  
only use code that might depend on it if it's present. The test result is  
exposed in $TestLib::have_io_pty so that it can be conveniently used in  
SKIP tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/TestLib.pm

Allow access to child table statistics if user can read parent table.

commit   : 553d2ec2710be5ae304c40134643c8f6d754af67    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Nov 2019 14:41:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Nov 2019 14:41:48 -0500    

Click here for diff

The fix for CVE-2017-7484 disallowed use of pg_statistic data for  
planning purposes if the user would not be able to select the associated  
column and a non-leakproof function is to be applied to the statistics  
values.  That turns out to disable use of pg_statistic data in some  
common cases involving inheritance/partitioning, where the user does  
have permission to select from the parent table that was actually named  
in the query, but not from a child table whose stats are needed.  Since,  
in non-corner cases, the user *can* select the child table's data via  
the parent, this restriction is not actually useful from a security  
standpoint.  Improve the logic so that we also check the permissions of  
the originally-named table, and allow access if select permission exists  
for that.  
  
When checking access to stats for a simple child column, we can map  
the child column number back to the parent, and perform this test  
exactly (including not allowing access if the child column isn't  
exposed by the parent).  For expression indexes, the current logic  
just insists on whole-table select access, and this patch allows  
access if the user can select the whole parent table.  In principle,  
if the child table has extra columns, this might allow access to  
stats on columns the user can't read.  In practice, it's unlikely  
that the planner is going to do any stats calculations involving  
expressions that are not visible to the query, so we'll ignore that  
fine point for now.  Perhaps someday we'll improve that logic to  
detect exactly which columns are used by an expression index ...  
but today is not that day.  
  
Back-patch to v11.  The issue was created in 9.2 and up by the  
CVE-2017-7484 fix, but this patch depends on the append_rel_array[]  
planner data structure which only exists in v11 and up.  In  
practice the issue is most urgent with partitioned tables, so  
fixing v11 and later should satisfy much of the practical need.  
  
Dilip Kumar and Amit Langote, with some kibitzing by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add safeguards for pg_fsync() called with incorrectly-opened fds

commit   : 12198239c0a5122e29619d50f76f89adc5bc7ade    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Nov 2019 13:32:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Nov 2019 13:32:52 +0900    

Click here for diff

On some platforms, fsync() returns EBADFD when opening a file descriptor  
with O_RDONLY (read-only), leading ultimately now to a PANIC to prevent  
data corruption.  
  
This commit adds a new sanity check in pg_fsync() based on fcntl() to  
make sure that we don't repeat again mistakes with incorrectly-set file  
descriptors so as problems are detected at an early stage.  Without  
that, such errors could only be detected after running Postgres on a  
specific supported platform for the culprit code path, which could take  
some time before being found.  b8e19b93 was a fix for such a problem,  
which got undetected for more than 5 years, and a586cc4b fixed another  
similar issue.  
  
Note that the new check added works as well when fsync=off is  
configured, so as all regression tests would detect problems as long as  
assertions are enabled.  fcntl() being not available on Windows, the  
new checks do not happen there.  
  
Author: Michael Paquier  
Reviewed-by: Mark Dilger  
Discussion: https://postgr.es/m/[email protected]  

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

Don't shut down Gather[Merge] early under Limit.

commit   : 080313f8296fb0bcc74bd70fc8e15cd64f45945e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 18 Nov 2019 14:17:41 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 18 Nov 2019 14:17:41 +0530    

Click here for diff

Revert part of commit 19df1702f5.  
  
Early shutdown was added by that commit so that we could collect  
statistics from workers, but unfortunately, it interacted badly with  
rescans.  The problem is that we ended up destroying the parallel context  
which is required for rescans.  This leads to rescans of a Limit node over  
a Gather node to produce unpredictable results as it tries to access  
destroyed parallel context.  By reverting the early shutdown code, we  
might lose statistics in some cases of Limit over Gather [Merge], but that  
will require further study to fix.  
  
Reported-by: Jerry Sievers  
Diagnosed-by: Thomas Munro  
Author: Amit Kapila, testcase by Vignesh C  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeLimit.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Use procsignal_sigusr1_handler for auxiliary processes.

commit   : 0d3c3aae3366891f1c3d6bac326070660be36f76    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 25 Nov 2019 16:08:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 25 Nov 2019 16:08:53 -0500    

Click here for diff

AuxiliaryProcessMain does ProcSignalInit, so one might expect that  
auxiliary processes would need to respond to SendProcSignal, but none  
of the auxiliary processes do that. Change them to use  
procsignal_sigusr1_handler instead of their own private handlers so  
that they do. Besides seeming more correct, this is also less code. It  
shouldn't make any functional difference right now because, as far as  
we know, there are no current cases where SendProcSignal targets an  
auxiliary process, but there are plans to change that in the future.  
  
Andres Freund  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walreceiver.c

Close stdin where it's not needed in TestLib.pm procedures

commit   : 9af34f3c6b02779fac6dbb6cd4c5bb225a019f43    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 25 Nov 2019 15:51:51 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 25 Nov 2019 15:51:51 -0500    

Click here for diff

Where possible, do this using a pseudoterminal, so that things like  
openssl that want to open /dev/tty if stdin isn't a tty won't.  
Elsewhere, i.e. Windows, just close by providing an empty string using  
the standard IPC::Run pipe mechanism.  
  
Patch by Andrew Dunstan, based on an idea from Craig Ringer.  
  
Reviewed by Mark Dilger.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/TestLib.pm

Refactor WAL file-reading code into WALRead()

commit   : 0dc8ead46363fec6f621a12c7e1f889ba73b55a9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Nov 2019 15:04:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Nov 2019 15:04:54 -0300    

Click here for diff

XLogReader, walsender and pg_waldump all had their own routines to read  
data from WAL files to memory, with slightly different approaches  
according to the particular conditions of each environment.  There's a  
lot of commonality, so we can refactor that into a single routine  
WALRead in XLogReader, and move the differences to a separate (simpler)  
callback that just opens the next WAL-segment.  This results in a  
clearer (ahem) code flow.  
  
The error reporting needs are covered by filling in a new error-info  
struct, WALReadError, and it's the caller's responsibility to act on it.  
The backend has WALReadRaiseError() to do so.  
  
We no longer ever need to seek in this interface; switch to using  
pg_pread().  
  
Author: Antonin Houska, with contributions from Álvaro Herrera  
Reviewed-by: Michaël Paquier, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/walsender.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h

Fix unportable printf format introduced in commit 9290ad198.

commit   : 5883f5fe27d7b52c812dd0f8cbda67373a14c451    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Nov 2019 10:48:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Nov 2019 10:48:36 -0500    

Click here for diff

"%ld" is not an acceptable format spec for int64 variables, though  
it accidentally works on most non-Windows 64-bit platforms.  Follow  
the lead of commit 6a1cd8b92, and use "%lld" with an explicit cast  
to long long.  Per buildfarm.  

M src/backend/replication/walsender.c

Make the order of the header file includes consistent.

commit   : e0487223ecac9cbb7f673e4ff6d2e4086e591abf    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 25 Nov 2019 08:08:57 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 25 Nov 2019 08:08:57 +0530    

Click here for diff

Similar to commits 14aec03502, 7e735035f2 and dddf4cdc33, this commit  
makes the order of header file inclusion consistent in more places.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com  

M contrib/bloom/bloom.h
M contrib/btree_gist/btree_gist.h
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.h
M contrib/postgres_fdw/postgres_fdw.h
M src/backend/libpq/auth.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_waldump/pg_waldump.c
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.h
M src/bin/psql/prompt.h
M src/bin/psql/settings.h
M src/bin/psql/tab-complete.c
M src/bin/scripts/common.h
M src/include/access/gin_private.h
M src/include/access/hio.h
M src/include/access/htup_details.h
M src/include/access/relation.h
M src/include/access/table.h
M src/include/access/twophase.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_type.h
M src/include/commands/event_trigger.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/tuptable.h
M src/include/funcapi.h
M src/include/jit/llvmjit.h
M src/include/nodes/execnodes.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/walreceiver.h
M src/include/rewrite/rewriteHandler.h
M src/include/statistics/extended_stats_internal.h
M src/include/storage/buf_internals.h
M src/include/storage/condition_variable.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/standby.h
M src/include/tsearch/ts_locale.h
M src/include/utils/date.h
M src/include/utils/jsonpath.h
M src/include/utils/pg_lsn.h
M src/include/utils/xml.h
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_planobject.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_resultobject.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_spi.h
M src/pl/plpython/plpy_subxactobject.c
M src/pl/plpython/plpy_subxactobject.h
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/plpy_util.c
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c

Fix inconsistent variable name in static function of mac8.c

commit   : 2aa84520b3508dda273b9bbffab7bf87f0d98bf8    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 25 Nov 2019 09:57:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 25 Nov 2019 09:57:35 +0900    

Click here for diff

Both argument names were reversed in the declaration of the function.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/MN2PR18MB292755AEFF9A9144B220ABEEE34B0@MN2PR18MB2927.namprd18.prod.outlook.com  

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

Refactor reloption handling for index AMs in-core

commit   : 4cb658af70027c3544fb843d77b2e84028762747    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 25 Nov 2019 09:40:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 25 Nov 2019 09:40:53 +0900    

Click here for diff

This reworks the reloption parsing and build of a couple of index AMs by  
creating new structures for each index AM's options.  This split was  
already done for BRIN, GIN and GiST (which actually has a fillfactor  
parameter), but not for hash, B-tree and SPGiST which relied on  
StdRdOptions due to an overlap with the default option set.  
  
This saves a couple of bytes for rd_options in each relcache entry with  
indexes making use of relation options, and brings more consistency  
between all index AMs.  While on it, add a couple of AssertMacro() calls  
to make sure that utility macros to grab values of reloptions are used  
with the expected index AM.  
  
Author: Nikolay Shaplov  
Reviewed-by: Amit Langote, Michael Paquier, Álvaro Herrera, Dent John  
Discussion: https://postgr.es/m/4127670.gFlpRb6XCm@x200m  

M src/backend/access/common/reloptions.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashutil.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgutils.c
M src/include/access/brin.h
M src/include/access/gin_private.h
M src/include/access/hash.h
M src/include/access/nbtree.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/utils/rel.h
M src/tools/pgindent/typedefs.list

Use native methods to open input in TestLib::slurp_file on Windows.

commit   : 114541d58e5970e51b78b77b65de16210beaab43    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 24 Nov 2019 18:25:22 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 24 Nov 2019 18:25:22 -0500    

Click here for diff

It is hoped that this will avoid some errors that we have seen before,  
but lately with greater frequency, in buildfarm animals.  
  
For now apply only to master. If this proves effective it can be  
backpatched.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Juan José Santamaría Flecha  

M src/test/perl/TestLib.pm

Doc: improve discussion of race conditions involved in LISTEN.

commit   : d3aa114ac4de9ecc558ba77ed5c85e2ad9ad01d4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 18:03:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 18:03:39 -0500    

Click here for diff

The user docs didn't really explain how to use LISTEN safely,  
so clarify that.  Also clean up some fuzzy-headed explanations  
in comments.  No code changes.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/listen.sgml
M src/backend/commands/async.c

Avoid assertion failure with LISTEN in a serializable transaction.

commit   : 6b802cfc7fab0f38001ae465ccd4f7f565b6169d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 15:57:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 15:57:31 -0500    

Click here for diff

If LISTEN is the only action in a serializable-mode transaction,  
and the session was not previously listening, and the notify queue  
is not empty, predicate.c reported an assertion failure.  That  
happened because we'd acquire the transaction's initial snapshot  
during PreCommit_Notify, which was called *after* predicate.c  
expects any such snapshot to have been established.  
  
To fix, just swap the order of the PreCommit_Notify and  
PreCommit_CheckForSerializationFailure calls during CommitTransaction.  
This will imply holding the notify-insertion lock slightly longer,  
but the difference could only be meaningful in serializable mode,  
which is an expensive option anyway.  
  
It appears that this is just an assertion failure, with no  
consequences in non-assert builds.  A snapshot used only to scan  
the notify queue could not have been involved in any serialization  
conflicts, so there would be nothing for  
PreCommit_CheckForSerializationFailure to do except assign it a  
prepareSeqNo and set the SXACT_FLAG_PREPARED flag.  And given no  
conflicts, neither of those omissions affect the behavior of  
ReleasePredicateLocks.  This admittedly once-over-lightly analysis  
is backed up by the lack of field reports of trouble.  
  
Per report from Mark Dilger.  The bug is old, so back-patch to all  
supported branches; but the new test case only goes back to 9.6,  
for lack of adequate isolationtester infrastructure before that.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/test/isolation/expected/async-notify.out
M src/test/isolation/specs/async-notify.spec

doc: Fix whitespace in syntax.

commit   : 1974853d899db69a72361a9052fd699c9dcd028e    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 25 Nov 2019 09:20:28 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 25 Nov 2019 09:20:28 +1300    

Click here for diff

Back-patch to 10.  
  
Author: Andreas Karlsson  
Discussion: https://postgr.es/m/043acae2-a369-b7fa-be48-1933aa2e82d1%40proxel.se  

M doc/src/sgml/ref/insert.sgml

Stabilize NOTIFY behavior by transmitting notifies before ReadyForQuery.

commit   : 7900269724424b6deca516eba3dd8e4bf6621bea    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 14:42:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 14:42:59 -0500    

Click here for diff

This patch ensures that, if any notify messages were received during  
a just-finished transaction, they get sent to the frontend just before  
not just after the ReadyForQuery message.  With libpq and other client  
libraries that act similarly, this guarantees that the client will see  
the notify messages as available as soon as it thinks the transaction  
is done.  
  
This probably makes no difference in practice, since in realistic  
use-cases the application would have to cope with asynchronous  
arrival of notify events anyhow.  However, it makes it a lot easier  
to build cross-session-notify test cases with stable behavior.  
I'm a bit surprised now that we've not seen any buildfarm instability  
with the test cases added by commit b10f40bf0.  Tests that I intend  
to add in an upcoming bug fix are definitely unstable without this.  
  
Back-patch to 9.6, which is as far back as we can do NOTIFY testing  
with the isolationtester infrastructure.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/async.c
M src/backend/tcop/postgres.c

Stabilize the results of pg_notification_queue_usage().

commit   : 8b7ae5a82d04312672c919ecea3c30b1ec7faaf2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 14:09:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 14:09:33 -0500    

Click here for diff

This function wasn't touched in commit 51004c717, but that turns out  
to be a bad idea, because its results now include any dead space  
that exists in the NOTIFY queue on account of our being lazy about  
advancing the queue tail.  Notably, the isolation tests now fail  
if run twice without a server restart between, because async-notify's  
first test of the function will already show a positive value.  
It seems likely that end users would be equally unhappy about the  
result's instability.  To fix, just make the function call  
asyncQueueAdvanceTail before computing its result.  That should end  
in producing the same value as before, and it's hard to believe that  
there's any practical use-case where pg_notification_queue_usage()  
is called so often as to create a performance degradation, especially  
compared to what we did before.  
  
Out of paranoia, also mark this function parallel-restricted (it  
was volatile, but parallel-safe by default, before).  Although the  
code seems to work fine when run in a parallel worker, that's outside  
the design scope of async.c, and it's a bit scary to have intentional  
side-effects happening in a parallel worker.  There seems no plausible  
use-case where it'd be important to try to parallelize this, so let's  
not take any risk of introducing new bugs.  
  
In passing, re-pgindent async.c and run reformat-dat-files on  
pg_proc.dat, just because I'm a neatnik.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/async.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Remove a couple of unnecessary if-tests.

commit   : 91da65f4ac2837e0792071e42b2e2101059f1b1b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 12:03:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Nov 2019 12:03:16 -0500    

Click here for diff

Commit abd9ca377 replaced a couple of while-loops in fmtfloat()  
with calls to dopr_outchmulti, but I (tgl) failed to notice that  
the new if-tests guarding those calls were really unnecessary,  
because they're inside a larger if-block checking the same thing.  
  
Ranier Vilela  
  
Discussion: https://postgr.es/m/MN2PR18MB2927850AB00CF39CC370D107E34B0@MN2PR18MB2927.namprd18.prod.outlook.com  

M src/port/snprintf.c

Remove debugging aid

commit   : 45ff049e288b0fc7d68195b25ba1a78522e7a45b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 23 Nov 2019 13:19:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 23 Nov 2019 13:19:20 -0300    

Click here for diff

This Assert(false) was not supposed to be in the committed copy.  
  
Reported by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/error/elog.c

Update sepgsql to add mandatory access control for TRUNCATE

commit   : 4f66c93f61439b4db866b21cc1ecd5bf815564ef    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 23 Nov 2019 10:41:52 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 23 Nov 2019 10:41:52 -0500    

Click here for diff

Use SELinux "db_table: { truncate }" to check if permission is granted to  
TRUNCATE. Update example SELinux policy to grant needed permission for  
TRUNCATE. Add new regression test to demonstrate a positive and negative  
cases. Test will only be run if the loaded SELinux policy has the  
"db_table: { truncate }" permission. Makes use of recent commit which added  
object TRUNCATE hook. Patch by Yuli Khodorkovskiy with minor  
editorialization by me. Not back-patched because the object TRUNCATE hook  
was not.  
  
Author: Yuli Khodorkovskiy  
Reviewed-by: Joe Conway  
Discussion: https://postgr.es/m/CAFL5wJcomybj1Xdw7qWmPJRpGuFukKgNrDb6uVBaCMgYS9dkaA%40mail.gmail.com  

A contrib/sepgsql/expected/truncate.out
M contrib/sepgsql/hooks.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql-regtest.te
M contrib/sepgsql/sepgsql.h
A contrib/sepgsql/sql/truncate.sql
M contrib/sepgsql/test_sepgsql

Add object TRUNCATE hook

commit   : f7a2002e82cfc639d1b6df89012f5d6c623ad545    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 23 Nov 2019 10:39:20 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 23 Nov 2019 10:39:20 -0500    

Click here for diff

All operations with acl permissions checks should have a corresponding hook  
so that, for example, mandatory access control (MAC) may be enforced by an  
extension. The command TRUNCATE is missing this hook, so add it. Patch by  
Yuli Khodorkovskiy with some editorialization by me. Based on the discussion  
not back-patched. A separate patch will exercise the hook in the sepgsql  
extension.  
  
Author: Yuli Khodorkovskiy  
Reviewed-by: Joe Conway  
Discussion: https://postgr.es/m/CAFL5wJcomybj1Xdw7qWmPJRpGuFukKgNrDb6uVBaCMgYS9dkaA%40mail.gmail.com  

M src/backend/catalog/objectaccess.c
M src/backend/commands/tablecmds.c
M src/include/catalog/objectaccess.h

Make psql redisplay the query buffer after \e.

commit   : d1c866e57f1156000a51ff7e26590984d32bab53    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Nov 2019 17:07:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Nov 2019 17:07:54 -0500    

Click here for diff

Up to now, whatever you'd edited was put back into the query buffer  
but not redisplayed, which is less than user-friendly.  But we can  
improve that just by printing the text along with a prompt, if we  
enforce that the editing result ends with a newline (which it  
typically would anyway).  You then continue typing more lines if  
you want, or you can type ";" or do \g or \r or another \e.  
  
This is intentionally divorced from readline's processing,  
for simplicity and so that it works the same with or without  
readline enabled.  We discussed possibly integrating things  
more closely with readline; but that seems difficult, uncertainly  
portable across different readline and libedit versions, and  
of limited real benefit anyway.  Let's try the simple way and  
see if it's good enough.  
  
Patch by me, thanks to Fabien Coelho and Laurenz Albe for review  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/mainloop.c

Avoid taking a new snapshot for an immutable simple expression in plpgsql.

commit   : 73b06cf893c9d3bb38c11878a12cc29407e78b6c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Nov 2019 15:02:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Nov 2019 15:02:18 -0500    

Click here for diff

We already used this optimization if the plpgsql function is read-only.  
But it seems okay to do it even in a read-write function, if the  
expression contains only immutable functions/operators.  There would  
only be a change of behavior if an "immutable" called function depends  
on seeing database updates made during the current plpgsql function.  
That's enough of a violation of the promise of immutability that anyone  
who complains won't have much of a case.  
  
The benefits are significant --- for simple cases like  
  
  while i < 10000000  
  loop  
    i := i + 1;  
  end loop;  
  
I see net performance improvements around 45%.  Of course, real-world  
cases won't get that much faster, but it ought to be noticeable.  
At the very least, this removes much of the performance penalty that  
used to exist for forgetting to mark a plpgsql function non-volatile.  
  
Konstantin Knizhnik, reviewed by Pavel Stehule, cosmetic changes by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add test coverage for "unchanged toast column" replication code path.

commit   : f67b173771a0525ff7f2010d2d57d63d7f546352    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Nov 2019 12:52:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Nov 2019 12:52:26 -0500    

Click here for diff

It seems pretty unacceptable to have no regression test coverage  
for this aspect of the logical replication protocol, especially  
given the bugs we've found in related code.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix bogus tuple-slot management in logical replication UPDATE handling.

commit   : 4d9ceb0018cc087e267f978c90917b3195542e22    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Nov 2019 11:31:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Nov 2019 11:31:19 -0500    

Click here for diff

slot_modify_cstrings seriously abused the TupleTableSlot API by relying  
on a slot's underlying data to stay valid across ExecClearTuple.  Since  
this abuse was also quite undocumented, it's little surprise that the  
case got broken during the v12 slot rewrites.  As reported in bug #16129  
from Ondřej Jirman, this could lead to crashes or data corruption when  
a logical replication subscriber processes a row update.  Problems would  
only arise if the subscriber's table contained columns of pass-by-ref  
types that were not being copied from the publisher.  
  
Fix by explicitly copying the datum/isnull arrays from the source slot  
that the old row was in already.  This ends up being about the same  
thing that happened pre-v12, but hopefully in a less opaque and  
fragile way.  
  
We might've caught the problem sooner if there were any test cases  
dealing with updates involving non-replicated or dropped columns.  
Now there are.  
  
Back-patch to v10 where this code came in.  Even though the failure  
does not manifest before v12, IMO this code is too fragile to leave  
as-is.  In any case we certainly want the additional test coverage.  
  
Patch by me; thanks to Tomas Vondra for initial investigation.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/worker.c
M src/test/subscription/t/001_rep_changes.pl

Add .gitignore to src/tutorial/

commit   : 8959a5e0fa2926b0f99e055e63fb4d81e1dcb3a0    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 22 Nov 2019 21:14:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 22 Nov 2019 21:14:54 +0900    

Click here for diff

A set of SQL files are generated for the tutorial when compiling the  
code, so let's avoid any risk to have them added in the tree in the  
future.  

A src/tutorial/.gitignore

Remove traces of version-0 calling convention in src/tutorial/

commit   : a9d5157ae8a7680b496d56f4edc3a43feff708c4    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 22 Nov 2019 21:08:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 22 Nov 2019 21:08:49 +0900    

Click here for diff

Support has been removed as of 5ded4bd, but code related to the tutorial  
still used it.  Functions using version-1 are already present for some  
time in the tutorial, and the documentation mentions them, so just  
replace the old version with the new one.  
  
Reported-by: Pavel Stehule  
Analyzed-by: Euler Taveira  
Author: Michael Paquier  
Reviewed-by: Tom Lane, Pavel Stehule  
Discussion: https://postgr.es/m/CAFj8pRCgC2uDzrw-vvanXu6Z3ofyviEOQPEpH6_aL4OCe7JRag@mail.gmail.com  

M src/tutorial/funcs.c
D src/tutorial/funcs_new.c

Defend against self-referential views in relation_is_updatable().

commit   : 4a0aab14dcb35550b55e623a3c194442c5666084    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Nov 2019 16:21:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Nov 2019 16:21:43 -0500    

Click here for diff

While a self-referential view doesn't actually work, it's possible  
to create one, and it turns out that this breaks some of the  
information_schema views.  Those views call relation_is_updatable(),  
which neglected to consider the hazards of being recursive.  In  
older PG versions you get a "stack depth limit exceeded" error,  
but since v10 it'd recurse to the point of stack overrun and crash,  
because commit a4c35ea1c took out the expression_returns_set() call  
that was incidentally checking the stack depth.  
  
Since this function is only used by information_schema views, it  
seems like it'd be better to return "not updatable" than suffer  
an error.  Hence, add tracking of what views we're examining,  
in just the same way that the nearby fireRIRrules() code detects  
self-referential views.  I added a check_stack_depth() call too,  
just to be defensive.  
  
Per private report from Manuel Rigger.  Back-patch to all  
supported versions.  

M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/misc.c
M src/include/rewrite/rewriteHandler.h

Remove configure --disable-float4-byval

commit   : 2e4db241bfd3206bad8286f8ffc2db6bbdaefcdf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Nov 2019 18:00:07 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Nov 2019 18:00:07 +0100    

Click here for diff

This build option was only useful to maintain compatibility for  
version-0 functions, but those are no longer supported, so this option  
can be removed.  
  
float4 is now always pass-by-value; the pass-by-reference code path is  
completely removed.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M configure
M configure.in
M doc/src/sgml/func.sgml
M doc/src/sgml/installation.sgml
M src/backend/access/index/indexam.c
M src/backend/access/transam/xlog.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/genbki.pl
M src/backend/commands/analyze.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/initdb/initdb.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/fmgr.h
M src/include/pg_config.h.in
M src/include/postgres.h
M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Bump WAL version.

commit   : 43a54a3bccd7dc6be798475214d561f3e93b3055    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 21 Nov 2019 22:17:28 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 21 Nov 2019 22:17:28 +0900    

Click here for diff

Oversight in commit e6d8069522. Since that commit changed the format of  
XLOG_DBASE_DROP WAL record, XLOG_PAGE_MAGIC needs to be bumped.  
  
Spotted by Michael Paquier  

M src/include/access/xlog_internal.h

Make DROP DATABASE command generate less WAL records.

commit   : e6d8069522c8bde8239dd1fedfb4984efa4b3a1a    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 21 Nov 2019 21:10:37 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 21 Nov 2019 21:10:37 +0900    

Click here for diff

Previously DROP DATABASE generated as many XLOG_DBASE_DROP WAL records  
as the number of tablespaces that the database to drop uses. This caused  
the scans of shared_buffers as many times as the number of the tablespaces  
during recovery because WAL replay of one XLOG_DBASE_DROP record needs  
that full scan. This could make the recovery time longer especially  
when shared_buffers is large.  
  
This commit changes DROP DATABASE so that it generates only one  
XLOG_DBASE_DROP record, and registers the information of all the tablespaces  
into it. Then, WAL replay of XLOG_DBASE_DROP record needs full scan of  
shared_buffers only once, and which may improve the recovery performance.  
  
Author: Fujii Masao  
Reviewed-by: Kirk Jamison, Simon Riggs  
Discussion: https://postgr.es/m/CAHGQGwF8YwNH0ZaL+2wjZPkj+ji9UhC+Z4ScnG97WKtVY5L9iw@mail.gmail.com  

M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/commands/dbcommands.c
M src/include/commands/dbcommands_xlog.h

Allow ALTER VIEW command to rename the column in the view.

commit   : 30840c92ac0c4073fb7bc8222317630571b8cf25    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 21 Nov 2019 19:55:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 21 Nov 2019 19:55:13 +0900    

Click here for diff

ALTER TABLE RENAME COLUMN command always can be used to rename the column  
in the view, but it's reasonable to add that syntax to ALTER VIEW too.  
  
Author: Fujii Masao  
Reviewed-by: Ibrar Ahmed, Yu Kimura  
Discussion: https://postgr.es/m/CAHGQGwHoQMD3b-MqTLcp1MgdhCpOKU7QNRwjFooT4_d+ti5v6g@mail.gmail.com  

M doc/src/sgml/ref/alter_view.sgml
M src/backend/commands/view.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

Improve tab-completion for ALTER MATERIALIZED VIEW.

commit   : 61a956d9cca3f72acb279c9c00f1d9cd47bbc934    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 21 Nov 2019 19:22:37 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 21 Nov 2019 19:22:37 +0900    

Click here for diff

Author: Takao Fujii  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

Track statistics for spilling of changes from ReorderBuffer.

commit   : 9290ad198b15d6b986b855d2a58d087a54777e87    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 16 Nov 2019 18:24:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 16 Nov 2019 18:24:00 +0530    

Click here for diff

This adds the statistics about transactions spilled to disk from  
ReorderBuffer.  Users can query the pg_stat_replication view to check  
these stats.  
  
Author: Tomas Vondra, with bug-fixes and minor changes by Dilip Kumar  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walsender.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/reorderbuffer.h
M src/include/replication/walsender_private.h
M src/test/regress/expected/rules.out

Provide statistics for hypothetical BRIN indexes

commit   : 168d2064001f704965899bb2057591271c44e57a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 21 Nov 2019 10:23:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 21 Nov 2019 10:23:28 +0900    

Click here for diff

Trying to use hypothetical indexes with BRIN currently fails when trying  
to access a relation that does not exist when looking for the  
statistics.  With the current API, it is not possible to easily pass  
a value for pages_per_range down to the hypothetical index, so this  
makes use of the default value of BRIN_DEFAULT_PAGES_PER_RANGE, which  
should be fine enough in most cases.  
  
Being able to refine or enforce the hypothetical costs in more  
optimistic ways would require more refactoring by filling in the  
statistics when building IndexOptInfo in plancat.c.  This would involve  
ABI breakages around the costing routines, something not fit for stable  
branches.  
  
This is broken since 7e534ad, so backpatch down to v10.  
  
Author: Julien Rouhaud, Heikki Linnakangas  
Reviewed-by: Álvaro Herrera, Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CAOBaU_ZH0LKEA8VFCocr6Lpte1ab0b6FpvgS0y4way+RPSXfYg@mail.gmail.com  
Backpatch-through: 10  

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

Sync patternsel_common's operator selection logic with pattern_prefix's.

commit   : 9ff5b699ed3e2d922ff6f5660e53b51bb5db983c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Nov 2019 15:00:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Nov 2019 15:00:11 -0500    

Click here for diff

Make patternsel_common() select the comparison operators to use with  
hardwired logic that matches pattern_prefix()'s new logic, eliminating  
its dependencies on particular index opfamilies.  
  
This shouldn't change any behavior, as it's just replacing runtime  
operator lookups with the same values hard-wired.  But it makes these  
closely-related functions look more alike, and saving some runtime  
syscache lookups is worth something.  
  
Actually, it's not quite true that this is zero behavioral change:  
when estimating for a column of type "name", the comparison constant  
will be kept as "text" not coerced to "name".  But that's more correct  
anyway, and it allows additional simplification of the coercion logic,  
again syncing this more closely with pattern_prefix().  
  
Per consideration of a report from Manuel Rigger.  
  
Discussion: https://postgr.es/m/CA+u7OA7nnGYy8rY0vdTe811NuA+Frr9nbcBO9u2Z+JxqNaud+g@mail.gmail.com  

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

Fix HeapTupleSatisfiesNonVacuumable() comment.

commit   : 9f0f12ac57023653ad870a33a2e0337e6f3bf512    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Nov 2019 11:36:54 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Nov 2019 11:36:54 -0800    

Click here for diff

Oversight in commit 63746189b23.  

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

Reduce match_pattern_prefix()'s dependencies on index opfamilies.

commit   : 2ddedcafca116c99e08c777ab2ab3a4de6f00c7e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Nov 2019 14:13:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Nov 2019 14:13:04 -0500    

Click here for diff

Historically, the planner's LIKE/regex index optimizations were only  
carried out for specific index opfamilies.  That's never been a great  
idea from the standpoint of extensibility, but it didn't matter so  
much as long as we had no practical way to extend such behaviors anyway.  
With the addition of planner support functions, and in view of ongoing  
work to support additional table and index AMs, it seems like a good  
time to relax this.  
  
Hence, recast the decisions in match_pattern_prefix() so that rather  
than decide which operators to generate by looking at what the index  
opfamily contains, we decide which operators to generate a-priori  
and then see if the opfamily supports them.  This is much more  
defensible from a semantic standpoint anyway, since we know the  
semantics of the chosen operators precisely, and we only need to  
assume that the opfamily correctly implements operators it claims  
to support.  
  
The existing "pattern" opfamilies put a crimp in this approach, since  
we need to select the pattern operators if we want those to work.  
So we still have to special-case those opfamilies.  But that seems  
all right, since in view of the addition of collations, the pattern  
opfamilies seem like a legacy hack that nobody will be building on.  
  
The only immediate effect of this change, so far as the core code is  
concerned, is that anchored LIKE/regex patterns can be mapped onto  
BRIN index searches, and exact-match patterns can be mapped onto hash  
indexes, not only btree and spgist indexes as before.  That's not a  
terribly exciting result, but it does fix an omission mentioned in  
the ancient comments here.  
  
Note: no catversion bump, even though this touches pg_operator.dat,  
because it's only adding OID macros not changing the contents of  
postgres.bki.  
  
Per consideration of a report from Manuel Rigger.  
  
Discussion: https://postgr.es/m/CA+u7OA7nnGYy8rY0vdTe811NuA+Frr9nbcBO9u2Z+JxqNaud+g@mail.gmail.com  

M src/backend/utils/adt/like_support.c
M src/include/catalog/pg_operator.dat

Doc: improve discussion of object owners' inherent privileges.

commit   : 86be6453ba295c3af222ee1e27a243d378070e92    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Nov 2019 12:27:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Nov 2019 12:27:00 -0500    

Click here for diff

In particular, clarify that the role membership mechanism allows  
members to inherit the ownership privileges of an object's owning  
role.  
  
Laurenz Albe, with some kibitzing by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Remove incorrect markup

commit   : a28704af42c68e659cdeeec5b5b2fc84054ae02c    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 20 Nov 2019 17:03:07 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 20 Nov 2019 17:03:07 +0100    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/libpq.sgml

Fix comment in xact.h

commit   : f9cb8bd3f21719589e09bda33974d994551a63b7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Nov 2019 17:48:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Nov 2019 17:48:31 +0900    

Click here for diff

xl_xact_relfilenodes refers to a number of relations, not XIDs, whose  
relfilenodes are processed.  
  
Author: Yu Kimura  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/xact.h

Handle ReadFile() EOF correctly on Windows.

commit   : 6969deeb8d3991cc533a5bcf451ae5eecaa9a517    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 20 Nov 2019 17:52:15 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 20 Nov 2019 17:52:15 +1300    

Click here for diff

When ReadFile() encounters the end of a file while reading from  
a synchronous handle with an offset provided via OVERLAPPED, it  
reports an error instead of returning 0.  By not handling that  
(undocumented) result correctly, we caused some noisy LOG  
messages about an unknown error code.  Repair.  
  
Back-patch to 12, where we started using pread()/ReadFile() with  
an offset.  
  
Reported-by: ZhenHua Cai, Amit Kapila  
Diagnosed-by: Juan Jose Santamaria Flecha  
Tested-by: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1LK3%2BWRtpz68TiRdpHwxxWm%3D%2Bt1BMf-G68hhQsAQ41PZg%40mail.gmail.com  

M src/port/pread.c

Add the support for '-f' option in dropdb utility.

commit   : 80e05a088e4edd421c9c0374d54d787c8a4c0d86    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 18 Nov 2019 10:28:32 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 18 Nov 2019 10:28:32 +0530    

Click here for diff

Specifying '-f' will add the 'force' option to the DROP DATABASE command  
sent to the server.  This will try to terminate all existing connections  
to the target database before dropping it.  
  
Author: Pavel Stehule  
Reviewed-by: Vignesh C and Amit Kapila  
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com  

M doc/src/sgml/ref/dropdb.sgml
M src/bin/scripts/dropdb.c
M src/bin/scripts/t/050_dropdb.pl

Doc: fix minor typo in func.sgml.

commit   : eecf963269648d4309cc54f8e94508ad42bbb88b    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 20 Nov 2019 09:08:43 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 20 Nov 2019 09:08:43 +0900    

Click here for diff

Discussion: https://postgr.es/m/20191119.222048.49467220816510881.t-ishii%40sraoss.co.jp  

M doc/src/sgml/func.sgml

Fix corner-case failure in match_pattern_prefix().

commit   : b3c265d7be42484bd0ab4a9c0a920289e8f5c995    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Nov 2019 17:03:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Nov 2019 17:03:26 -0500    

Click here for diff

The planner's optimization code for LIKE and regex operators could  
error out with a complaint like "no = operator for opfamily NNN"  
if someone created a binary-compatible index (for example, a  
bpchar_ops index on a text column) on the LIKE's left argument.  
  
This is a consequence of careless refactoring in commit 74dfe58a5.  
The old code in match_special_index_operator only accepted specific  
combinations of the pattern operator and the index opclass, thereby  
indirectly guaranteeing that the opclass would have a comparison  
operator with the same LHS input type as the pattern operator.  
While moving the logic out to a planner support function, I simplified  
that test in a way that no longer guarantees that.  Really though we'd  
like an altogether weaker dependency on the opclass, so rather than  
put back exactly the old code, just allow lookup failure.  I have in  
mind now to rewrite this logic completely, but this is the minimum  
change needed to fix the bug in v12.  
  
Per report from Manuel Rigger.  Back-patch to v12 where the mistake  
came in.  
  
Discussion: https://postgr.es/m/CA+u7OA7nnGYy8rY0vdTe811NuA+Frr9nbcBO9u2Z+JxqNaud+g@mail.gmail.com  

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

Fix page modification outside of critical section in GIN

commit   : b107140804817cc30a4069b1bb5545aa3ea0ce6c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 20 Nov 2019 00:12:33 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 20 Nov 2019 00:12:33 +0300    

Click here for diff

By oversight 52ac6cd2d0 makes ginDeletePage() sets pd_prune_xid of page to be  
deleted before entering the critical section.  It appears that only versions 11  
and later were affected by this oversight.  
  
Backpatch-through: 11  

M src/backend/access/gin/ginvacuum.c

Revise GIN README

commit   : 32ca32d0bed4b95e5cd63998478a7816a89cd43d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 19 Nov 2019 23:11:24 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 19 Nov 2019 23:11:24 +0300    

Click here for diff

We find GIN concurrency bugs from time to time.  One of the problems here is  
that concurrency of GIN isn't well-documented in README.  So, it might be even  
hard to distinguish design bugs from implementation bugs.  
  
This commit revised concurrency section in GIN README providing more details.  
Some examples are illustrated in ASCII art.  
  
Also, this commit add the explanation of how is tuple layout in internal GIN  
B-tree page different in comparison with nbtree.  
  
Discussion: https://postgr.es/m/CAPpHfduXR_ywyaVN4%2BOYEGaw%3DcPLzWX6RxYLBncKw8de9vOkqw%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Peter Geoghegan  
Backpatch-through: 9.4  

M src/backend/access/gin/README

Fix traversing to the deleted GIN page via downlink

commit   : d5ad7a09afd066dce423f282bb2b338f48614d32    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 19 Nov 2019 23:08:14 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 19 Nov 2019 23:08:14 +0300    

Click here for diff

Current GIN code appears to don't handle traversing to the deleted page via  
downlink.  This commit fixes that by stepping right from the delete page like  
we do in nbtree.  
  
This commit also fixes setting 'deleted' flag to the GIN pages.  Now other page  
flags are not erased once page is deleted.  That helps to keep our assertions  
true if we arrive deleted page via downlink.  
  
Discussion: https://postgr.es/m/CAPpHfdvMvsw-NcE5bRS7R1BbvA4BxoDnVVjkXC5W0Czvy9LVrg%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Peter Geoghegan  
Backpatch-through: 9.4  

M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c

Fix deadlock between ginDeletePage() and ginStepRight()

commit   : e14641197a5690d92cc48446d0d40f1aec07bac7    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 19 Nov 2019 23:07:36 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 19 Nov 2019 23:07:36 +0300    

Click here for diff

When ginDeletePage() is about to delete page it locks its left sibling to revise  
the rightlink.  So, it locks pages in right to left manner.  Int he same time  
ginStepRight() locks pages in left to right manner, and that could cause a  
deadlock.  
  
This commit makes ginScanToDelete() keep exclusive lock on left siblings of  
currently investigated path.  That elimites need to relock left sibling in  
ginDeletePage().  Thus, deadlock with ginStepRight() can't happen anymore.  
  
Reported-by: Chen Huajun  
Discussion: https://postgr.es/m/5c332bd1.87b6.16d7c17aa98.Coremail.chjischj%40163.com  
Author: Alexander Korotkov  
Reviewed-by: Peter Geoghegan  
Backpatch-through: 10  

M src/backend/access/gin/README
M src/backend/access/gin/ginvacuum.c

Doc: clarify use of RECURSIVE in WITH.

commit   : 5b805886ca11d5d74217ab1f12395ad54507d4d5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Nov 2019 14:43:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Nov 2019 14:43:37 -0500    

Click here for diff

Apparently some people misinterpreted the syntax as being that  
RECURSIVE is a prefix of individual WITH queries.  It's a modifier  
for the WITH clause as a whole, so state that more clearly.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: clarify behavior of ALTER DEFAULT PRIVILEGES ... IN SCHEMA.

commit   : 787b3fd33fb3089bf80d49ef9948a6ec85005d04    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Nov 2019 14:21:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Nov 2019 14:21:41 -0500    

Click here for diff

The existing text stated that "Default privileges that are specified  
per-schema are added to whatever the global default privileges are for  
the particular object type".  However, that bare-bones observation is  
not quite clear enough, as demonstrated by the complaint in bug #16124.  
Flesh it out by stating explicitly that you can't revoke built-in  
default privileges this way, and by providing an example to drive  
the point home.  
  
Back-patch to all supported branches, since it's been like this  
from the beginning.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_default_privileges.sgml

Allow invisible PROMPT2 in psql.

commit   : 7f338369ca624ca6c2e4f579623274c88d325bce    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 19 Nov 2019 15:17:15 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 19 Nov 2019 15:17:15 +1300    

Click here for diff

Keep track of the visible width of PROMPT1, and provide %w as a way  
for PROMPT2 to generate the same number of spaces.  
  
Author: Thomas Munro, with ideas from others  
Reviewed-by: Tom Lane (earlier version)  
Discussion: https://postgr.es/m/CA%2BhUKG%2BzGd7RigjWbxwhzGW59gUpf76ydQECeGdEdodH6nd__A%40mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/prompt.c

Add logical_decoding_work_mem to limit ReorderBuffer memory usage.

commit   : cec2edfa7859279f36d2374770ca920c59c73dd8    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 16 Nov 2019 17:49:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 16 Nov 2019 17:49:33 +0530    

Click here for diff

Instead of deciding to serialize a transaction merely based on the  
number of changes in that xact (toplevel or subxact), this makes  
the decisions based on amount of memory consumed by the changes.  
  
The memory limit is defined by a new logical_decoding_work_mem GUC,  
so for example we can do this  
  
    SET logical_decoding_work_mem = '128kB'  
  
to reduce the memory usage of walsenders or set the higher value to  
reduce disk writes. The minimum value is 64kB.  
  
When adding a change to a transaction, we account for the size in  
two places. Firstly, in the ReorderBuffer, which is then used to  
decide if we reached the total memory limit. And secondly in the  
transaction the change belongs to, so that we can pick the largest  
transaction to evict (and serialize to disk).  
  
We still use max_changes_in_memory when loading changes serialized  
to disk. The trouble is we can't use the memory limit directly as  
there might be multiple subxact serialized, we need to read all of  
them but we don't know how many are there (and which subxact to  
read first).  
  
We do not serialize the ReorderBufferTXN entries, so if there is a  
transaction with many subxacts, most memory may be in this type of  
objects. Those records are not included in the memory accounting.  
  
We also do not account for INTERNAL_TUPLECID changes, which are  
kept in a separate list and not evicted from memory. Transactions  
with many CTID changes may consume significant amounts of memory,  
but we can't really do much about that.  
  
The current eviction algorithm is very simple - the transaction is  
picked merely by size, while it might be useful to also consider age  
(LSN) of the changes for example. With the new Generational memory  
allocator, evicting the oldest changes would make it more likely  
the memory gets actually pfreed.  
  
The logical_decoding_work_mem can be set in postgresql.conf, in which  
case it serves as the default for all publishers on that instance.  
  
Author: Tomas Vondra, with changes by Dilip Kumar and Amit Kapila  
Reviewed-by: Dilip Kumar and Amit Kapila  
Tested-By: Vignesh C  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/logical.conf
M doc/src/sgml/config.sgml
M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/reorderbuffer.h

nbtree: Tweak _bt_pgaddtup() comments.

commit   : 2110f716965fe1ac5af83380aa108541b1457e0d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 18 Nov 2019 13:04:53 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 18 Nov 2019 13:04:53 -0800    

Click here for diff

Make it clear that _bt_pgaddtup() truncates the first data item on an  
internal page because its key is supposed to be treated as minus  
infinity within _bt_compare().  

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

Further fix dumping of views that contain just VALUES(...).

commit   : bf2efc55da9a1a33da32fa383db9db2f2c49b2cb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Nov 2019 20:00:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Nov 2019 20:00:19 -0500    

Click here for diff

It turns out that commit e9f1c01b7 missed a case: we must print a  
VALUES clause in long format if get_query_def is given a resultDesc  
that would require the query's output column name(s) to be different  
from what the bare VALUES clause would produce.  
  
This applies in case an ALTER ... RENAME COLUMN has been done to  
a view that formerly could be printed in simple format, as shown  
in the added regression test case.  It also explains bug #16119  
from Dmitry Telpt, because it turns out that (unlike CREATE VIEW)  
CREATE MATERIALIZED VIEW fails to apply any column aliases it's  
given to the stored ON SELECT rule.  So to get them to be printed,  
we have to account for the resultDesc renaming.  It might be worth  
changing the matview code so that it creates the ON SELECT rule  
with the correct aliases; but we'd still need these messy checks in  
get_simple_values_rte to handle the case of a subsequent column  
rename, so any such change would be just neatnik-ism not a bug fix.  
  
Like the previous patch, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add tuplesort test to serial_schedule.

commit   : 815bd578076672a2325d026a2c48b6075454be9b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 16 Nov 2019 10:51:03 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 16 Nov 2019 10:51:03 -0800    

Click here for diff

Oversight in commit 4a252996.  

M src/test/regress/serial_schedule

Improve stability of tests for VACUUM (SKIP_LOCKED)

commit   : 3db0598d908f22435ab8138d1c76b971f17a5633    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 16 Nov 2019 15:23:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 16 Nov 2019 15:23:12 +0900    

Click here for diff

Concurrent autovacuums running with the main regression test suite  
could cause the tests with VACUUM (SKIP_LOCKED) to generate randomly  
WARNING messages.  For these tests, set client_min_messages to ERROR to  
get rid of those random failures, as disabling autovacuum for the  
relations operated would not completely close the failure window.  
  
For isolation tests, disable autovacuum for the relations vacuumed with  
SKIP_LOCKED.  The tests are designed so as LOCK commands are taken  
in a first session before running a concurrent VACUUM (SKIP_LOCKED) in a  
second to generate WARNING messages, but a concurrent autovacuum could  
cause the tests to be slower.  
  
Reported-by: Tom Lane  
Author: Michael Paquier  
Reviewed-by: Andres Freund, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/test/isolation/specs/vacuum-skip-locked.spec
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Properly determine length for on-disk TOAST values

commit   : 2dc08bd6179d8cf480c93701010c19ad7a9891d8    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 16 Nov 2019 02:40:02 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 16 Nov 2019 02:40:02 +0100    

Click here for diff

In detoast_attr_slice, VARSIZE_ANY was used to compute compressed length  
of on-disk TOAST values. That's incorrect, because the varlena value may  
be just a TOAST pointer, producing either bogus value or crashing.  
  
This is likely why the code was crashing on big-endian machines before  
540f31680913 replaced the VARSIZE with VARSIZE_ANY, which however only  
masked the issue.  
  
Reported-by: Rushabh Lathia  
Discussion: https://postgr.es/m/CAL-OGkthU9Gs7TZchf5OWaL-Gsi=hXqufTxKv9qpNG73d5na_g@mail.gmail.com  

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

Skip system attributes when applying mvdistinct stats

commit   : d482f7f867b58bbd29f65a4471eca8c5b57a7da0    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 16 Nov 2019 01:17:15 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 16 Nov 2019 01:17:15 +0100    

Click here for diff

When estimating number of distinct groups, we failed to ignore system  
attributes when matching the group expressions to mvdistinct stats,  
causing failures like  
  
  ERROR: negative bitmapset member not allowed  
  
Fix that by simply skipping anything that is not a regular attribute.  
Backpatch to PostgreSQL 10, where the extended stats were introduced.  
  
Bug: #16111  
Reported-by: Tuomas Leikola  
Author: Tomas Vondra  
Backpatch-through: 10  
Discussion: https://postgr.es/m/[email protected]  

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

Always call ExecShutdownNode() if appropriate.

commit   : 76cbfcdf3a0dff3f029ca079701418b861ce86c8    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 16 Nov 2019 10:04:52 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 16 Nov 2019 10:04:52 +1300    

Click here for diff

Call ExecShutdownNode() after ExecutePlan()'s loop, rather than at each  
break.  We had forgotten to do that in one case.  The omission caused  
intermittent "temporary file leak" warnings from multi-batch parallel  
hash joins with a LIMIT clause.  
  
Back-patch to 11.  Though the problem exists in theory in earlier  
parallel query releases, nothing really depended on it.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Thomas Munro, Amit Kapila  
Discussion: https://postgr.es/m/20191111.212418.2222262873417235945.horikyota.ntt%40gmail.com  

M src/backend/executor/execMain.c

Remove the word "virgins" for documentation

commit   : 6ae4d271879b62c4325df3ddf75bff3f2b911086    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 14 Nov 2019 17:33:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 14 Nov 2019 17:33:26 -0300    

Click here for diff

Apparently, it's no longer welcome.  Therefore replace it with "pristine",  
and add some explanatory text while at it.  
  
Reported by Brian Williams  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/ref/create_database.sgml

Cleanup code in reloptions.h regarding reloption handling

commit   : 50d22de9325f41a32faeb0d1055f50b43d0507b3    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Nov 2019 13:59:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Nov 2019 13:59:59 +0900    

Click here for diff

reloptions.h includes since ba748f7 a set of macros to handle reloption  
types in a way similar to how parseRelOptions() works.  They have never  
been used in the core code, and we have more simple methods now to parse  
and fill in rd_options for a given relation depending on its relkind, so  
remove this interface to simplify things.  
  
Per discussion between Amit Langote, Álvaro Herrera and me.  
  
Discussion: https://postgr.es/m/CA+HiwqE6zbNO92az6pp5GiTw4tr-9rfCE0t84whQSP+YwSKjMQ@mail.gmail.com  

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

Split handling of reloptions for partitioned tables

commit   : 1bbd608fdae7af314d8e2229e369a45a3da83cd8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Nov 2019 12:34:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Nov 2019 12:34:28 +0900    

Click here for diff

Partitioned tables do not have relation options yet, but, similarly to  
what's done for views which have their own parsing table, it could make  
sense to introduce new parameters for some of the existing default ones  
like fillfactor, autovacuum, etc.  Splitting things has the advantage to  
make the information stored in rd_options include only the necessary  
information, reducing the amount of memory used for a relcache entry  
with partitioned tables if new reloptions are introduced at this level.  
  
Author:  Nikolay Shaplov  
Reviewed-by: Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/1627387.Qykg9O6zpu@x200m  

M src/backend/access/common/reloptions.c
M src/backend/commands/tablecmds.c
M src/include/access/reloptions.h

Fix plan instability in the new tuplesort test.

commit   : 80ef34fc7075b37fc23f4ab714a5ce60f82400de    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Nov 2019 16:36:31 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Nov 2019 16:36:31 -0800    

Click here for diff

At least buildfarm member florican doesn't use a material node above a  
sort in the mark/restore case. As material is not intended to be  
tested with that query, disallow.  

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

Remove unused code from tuplesort.

commit   : 7d962eaf50c093b4bb1d35a7b495d416a67b40e2    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 13 Nov 2019 15:57:01 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 13 Nov 2019 15:57:01 -0800    

Click here for diff

copytup_index() is unused, as tuplesort_putindextuplevalues() doesn't  
use COPYTUP(). Replace function body with an elog(ERROR), as already  
done e.g. for copytup_datum().  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Add tests for tuplesort.c.

commit   : 4a252996d5fda7662b2afdf329a5c95be0fe3b01    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Oct 2019 13:58:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Oct 2019 13:58:40 -0700    

Click here for diff

Previously significant parts of tuplesort.c were untested. This  
commit, while not testing every path, significantly increases  
coverage.  In particular, this adds tests for abbreviated key logic,  
forward/backward scans & scrolling and mark/restore.  
  
I tried to keep the table sizes reasonable, and stress the on-disk  
paths by setting work_mem to low values for specific tests. The  
buildfarm will tell whether more attention to test time is needed.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

A src/test/regress/expected/tuplesort.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/tuplesort.sql

Add missing check_collation_set call to bpcharne().

commit   : d57d61533a2b5b27b60cc9024c54688390871bf6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 15:53:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 15:53:53 -0500    

Click here for diff

We should throw an error for indeterminate collation, but bpcharne()  
was missing that logic, resulting in a much less user-friendly error  
(either an assertion failure or "cache lookup failed for collation 0").  
  
Per report from Manuel Rigger.  Back-patch to v12 where the mistake  
came in, evidently in commit 5e1963fb7.  (Before non-deterministic  
collations, this function wasn't collation sensitive.)  
  
Discussion: https://postgr.es/m/CA+u7OA4HOjtymxAbuGNh4-X_2R0Lw5n01tzvP8E5-i-2gQXYWA@mail.gmail.com  

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

Fix silly initializations (cosmetic only).

commit   : 0cafdd03a850265006c0ada1b0bf4f83e087a409    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 15:26:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 15:26:54 -0500    

Click here for diff

Initializing a pointer to "false" isn't per project style,  
and reportedly some compilers warn about it (though I've  
not seen any such warnings in the buildfarm).  
  
Seems to have come in with commit ff11e7f4b, so back-patch  
to v12 where that was added.  
  
Didier Gautheron  
  
Discussion: https://postgr.es/m/CAJRYxu+XQuM0qnSqt1Ujztu6fBPzMMAT3VEn6W32rgKG6A2Fsw@mail.gmail.com  

M src/backend/commands/trigger.c

Avoid using SplitIdentifierString to parse ListenAddresses, too.

commit   : 7bf40ea0d028e6dc49c152e5820a65d69b74b409    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 13:51:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 13:51:58 -0500    

Click here for diff

This gets rid of our former behavior of forcibly downcasing  
the postmaster's hostname list and truncating the elements to  
NAMEDATALEN.  In principle, DNS hostnames are case-insensitive  
so the first behavior should be harmless, and server hostnames  
are seldom long enough for the second behavior to be an issue.  
But it's still dubious, and an easy fix is available: just use  
SplitGUCList instead.  
  
AFAICT, all other SplitIdentifierString calls in the backend are  
OK: either the items actually are SQL identifiers, or they are  
keywords that are short and case-insensitive.  
  
Per thinking about bug #16106.  While this has been wrong for  
a very long time, the lack of field complaints means there's  
little reason to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Avoid downcasing/truncation of RADIUS authentication parameters.

commit   : 7618eaf5f315f53619b718e571cd2a2020fb0226    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 13:41:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 13:41:04 -0500    

Click here for diff

Commit 6b76f1bb5 changed all the RADIUS auth parameters to be lists  
rather than single values.  But its use of SplitIdentifierString  
to parse the list format was not very carefully thought through,  
because that function thinks it's parsing SQL identifiers, which  
means it will (a) downcase the strings and (b) truncate them to  
be shorter than NAMEDATALEN.  While downcasing should be harmless  
for the server names and ports, it's just wrong for the shared  
secrets, and probably for the NAS Identifier strings as well.  
The truncation aspect is at least potentially a problem too,  
though typical values for these parameters would fit in 63 bytes.  
  
Fortunately, we now have a function SplitGUCList that is exactly  
the same except for not doing the two unwanted things, so fixing  
this is a trivial matter of calling that function instead.  
  
While here, improve the documentation to show how to double-quote  
the parameter values.  I failed to resist the temptation to do  
some copy-editing as well.  
  
Report and patch from Marcos David (bug #16106); doc changes by me.  
Back-patch to v10 where the aforesaid commit came in, since this is  
arguably a regression from our previous behavior with RADIUS auth.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/hba.c

Include TableFunc references when computing expression dependencies.

commit   : 2c7b5dad6eb1602839e5961b4d4eb6494fe4a1ee    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 12:11:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 12:11:49 -0500    

Click here for diff

The TableFunc node (i.e., XMLTABLE) includes type and collation OIDs  
that might not be referenced anywhere else in the expression tree,  
so they need to be accounted for when extracting dependencies.  
  
Fortunately, the practical effects of this are limited, since  
(a) it's somewhat unlikely that people would be extracting  
columns of non-builtin types from an XML document, and (b)  
in many scenarios, the query would contain other references  
to such types, or functions depending on them.  However, it's  
not hard to construct examples wherein the existing code lets  
one drop a type used in XMLTABLE and thereby break a view.  
  
This is evidently an original oversight in the XMLTABLE patch,  
so back-patch to v10 where that came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c

Handle arrays and ranges in pg_upgrade's test for non-upgradable types.

commit   : 29aeda6e4e609b66b6f1c3c73b4def6fb34d90ed    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 11:35:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Nov 2019 11:35:37 -0500    

Click here for diff

pg_upgrade needs to check whether certain non-upgradable data types  
appear anywhere on-disk in the source cluster.  It knew that it has  
to check for these types being contained inside domains and composite  
types; but it somehow overlooked that they could be contained in  
arrays and ranges, too.  Extend the existing recursive-containment  
query to handle those cases.  
  
We probably should have noticed this oversight while working on  
commit 0ccfc2822 and follow-ups, but we failed to :-(.  The whole  
thing's possibly a bit overdesigned, since we don't really expect  
that any of these types will appear on disk; but if we're going to  
the effort of doing a recursive search then it's silly not to cover  
all the possibilities.  
  
While at it, refactor so that we have only one copy of the search  
logic, not three-and-counting.  Also, to keep the branches looking  
more alike, back-patch the output wording change of commit 1634d3615.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/version.c

Make pg_waldump report more detail information about PREPARE TRANSACTION record.

commit   : 7b8a899bdeb638f46e102d1714c079a0874e9fa0    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 13 Nov 2019 16:59:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 13 Nov 2019 16:59:17 +0900    

Click here for diff

This commit changes xact_desc() so that it reports the detail information about  
PREPARE TRANSACTION record, like GID (global transaction identifier),  
timestamp at prepare transaction, delete-on-abort/commit relations,  
XID of subtransactions, and invalidation messages. These are helpful  
when diagnosing 2PC-related troubles.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier, Andrey Lepikhov, Kyotaro Horiguchi, Julien Rouhaud, Alvaro Herrera  
Discussion: https://postgr.es/m/CAHGQGwEvhASad4JJnCv=0dW2TJypZgW_Vpb-oZik2a3utCqcrA@mail.gmail.com  

M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/twophase.c
M src/include/access/twophase.h
M src/include/access/xact.h

Add regression test for two-phase transaction in postgres_fdw

commit   : 94fec48516a77f219ab94890219d724b973e4674    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Nov 2019 13:30:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Nov 2019 13:30:14 +0900    

Click here for diff

postgres_fdw does not support two-phase transactions, so let's add a  
small negative test case to check after it.  Note that this is checked  
using an end-of-xact callback to ensure a proper connection cleanup with  
the foreign server, which is called before checking if a server is able  
to handle 2PC with max_prepared_xacts, so this test does not need an  
alternate output file.  
  
Author: Gilles Darold  
Discussion: https://postgr.es/m/[email protected]  

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

Introduce the 'force' option for the Drop Database command.

commit   : 1379fd537f9fc7941c8acff8c879ce3636dbdb77    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 12 Nov 2019 11:06:13 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 12 Nov 2019 11:06:13 +0530    

Click here for diff

This new option terminates the other sessions connected to the target  
database and then drop it.  To terminate other sessions, the current user  
must have desired permissions (same as pg_terminate_backend()).  We don't  
allow to terminate the sessions if prepared transactions, active logical  
replication slots or subscriptions are present in the target database.  
  
Author: Pavel Stehule with changes by me  
Reviewed-by: Dilip Kumar, Vignesh C, Ibrar Ahmed, Anthony Nowocien,  
Ryan Lambert and Amit Kapila  
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com  

M doc/src/sgml/ref/drop_database.sgml
M src/backend/commands/dbcommands.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/storage/ipc/procarray.c
M src/backend/tcop/utility.c
M src/bin/psql/tab-complete.c
M src/include/commands/dbcommands.h
M src/include/nodes/parsenodes.h
M src/include/storage/procarray.h
M src/test/regress/expected/drop_if_exists.out
M src/test/regress/sql/drop_if_exists.sql

Finish reverting commit 0a52d378b.

commit   : 112caf9039f4c8fb286bb610461ced8253313e9f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Nov 2019 16:58:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Nov 2019 16:58:00 -0500    

Click here for diff

Apply the solution adopted in commit dcb7d3caf (ie, explicitly  
don't call memcmp for a zero-length comparison) to func_get_detail()  
as well, removing one other place where we were passing an  
uninitialized array to a parse_func.c entry point.  
  
Discussion: https://postgr.es/m/MN2PR18MB2927F24692485D754794F01BE3740@MN2PR18MB2927.namprd18.prod.outlook.com  
Discussion: https://postgr.es/m/MN2PR18MB2927F6873DF2774A505AC298E3740@MN2PR18MB2927.namprd18.prod.outlook.com  

M src/backend/parser/parse_func.c
M src/backend/utils/adt/ruleutils.c

pg_stat_activity: document client_port being null

commit   : c5e8ea978d88ea4aa731516836e14d54c50cc957    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Nov 2019 18:34:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Nov 2019 18:34:20 -0300    

Click here for diff

As suggested by Stephen Frost.  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

pg_stat_{ssl,gssapi}: Show only processes with connections

commit   : 5c46e7d82e88859395c2688c37bb643ae7dbbfa1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Nov 2019 17:19:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Nov 2019 17:19:41 -0300    

Click here for diff

It is pointless to show in those views auxiliary processes that don't  
open network connections.  
  
A small incompatibility is that anybody joining pg_stat_activity and  
pg_stat_ssl/pg_stat_gssapi will have to use a left join if they want to  
see such auxiliary processes.  
  
Author: Euler Taveira  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

Make _bt_keep_natts_fast() use datum_image_eq().

commit   : 1f55ebae27225111d0a5c4d89d7e77d917357ff4    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 12 Nov 2019 13:08:41 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 12 Nov 2019 13:08:41 -0800    

Click here for diff

An upcoming patch that adds deduplication to the nbtree AM will rely on  
_bt_keep_natts_fast() understanding that differences in TOAST input  
state can never affect its answer.  In particular, two opclass-equal  
datums (with opclasses deemed safe for deduplication) should never be  
treated as unequal by _bt_keep_natts_fast() due to TOAST input  
differences.  
  
This also seems like a good idea on general principle.  nbtsplitloc.c  
will now occasionally make better decisions about where to split a leaf  
page.  The behavior of _bt_keep_natts_fast() is now somewhat closer to  
the behavior of _bt_keep_natts().  
  
Discussion: https://postgr.es/m/CAH2-Wzn3Ee49Gmxb7V1VJ3-AC8fWn-Fr8pfWQebHe8rYRxt5OQ@mail.gmail.com  

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

Have LookupFuncName accept NULL argtypes for 0 args

commit   : dcb7d3cafa3197c5425c129ba0dc5eddd23c0532    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Nov 2019 17:04:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Nov 2019 17:04:46 -0300    

Click here for diff

Prior to this change, it requires to be passed a valid pointer just to  
be able to pass it to a zero-byte memcmp, per 0a52d378b03b.  Given the  
strange resulting code in callsites, it seems better to test for the  
case specifically and remove the requirement.  
  
Reported-by: Ranier Vilela  
Discussion: https://postgr.es/m/MN2PR18MB2927F24692485D754794F01BE3740@MN2PR18MB2927.namprd18.prod.outlook.com  
Discussion: https://postgr.es/m/MN2PR18MB2927F6873DF2774A505AC298E3740@MN2PR18MB2927.namprd18.prod.outlook.com  

M src/backend/commands/event_trigger.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/proclang.c
M src/backend/commands/trigger.c
M src/backend/parser/parse_func.c
M src/pl/tcl/pltcl.c

Teach datum_image_eq() about cstring datums.

commit   : 8c951687f58ad604be13e6addfd56446afb36e13    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 12 Nov 2019 11:25:34 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 12 Nov 2019 11:25:34 -0800    

Click here for diff

Bring datum_image_eq() in line with datumIsEqual() by adding support for  
comparing cstring datums.  
  
An upcoming patch that adds deduplication to the nbtree AM will use  
datum_image_eq().  datum_image_eq() will need to work with all datatypes  
that can be used as the storage type of a B-Tree index column, including  
cstring.  (cstring is used as the storage type for columns of type  
"name" as a space-saving optimization.)  
  
Discussion: https://postgr.es/m/CAH2-Wzn3Ee49Gmxb7V1VJ3-AC8fWn-Fr8pfWQebHe8rYRxt5OQ@mail.gmail.com  

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

Fix ecpglib.h to declare bool consistently with c.h.

commit   : 7a0574b50ee9c2b96ce94c29e031c103285c0b1d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Nov 2019 13:00:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Nov 2019 13:00:04 -0500    

Click here for diff

This completes the task begun in commit 1408d5d86, to synchronize  
ECPG's exported definitions with the definition of bool used by  
c.h (and, therefore, the one actually in use in the ECPG library).  
On practically all modern platforms, ecpglib.h will now just  
include <stdbool.h>, which should surprise nobody anymore.  
That removes a header-inclusion-order hazard for ECPG clients,  
who previously might get build failures or unexpected behavior  
depending on whether they'd included <stdbool.h> themselves,  
and if so, whether before or after ecpglib.h.  
  
On platforms where sizeof(_Bool) is not 1 (only old PPC-based  
Mac systems, as far as I know), things are still messy, as  
inclusion of <stdbool.h> could still break ECPG client code.  
There doesn't seem to be any clean fix for that, and given the  
probably-negligible population of users who would care anymore,  
it's not clear we should go far out of our way to cope with it.  
This change at least fixes some header-inclusion-order hazards  
for our own code, since c.h and ecpglib.h previously disagreed  
on whether bool should be char or unsigned char.  
  
To implement this with minimal invasion of ECPG client namespace,  
move the choice of whether to rely on <stdbool.h> into configure,  
and have it export a configuration symbol PG_USE_STDBOOL.  
  
ecpglib.h no longer exports definitions for TRUE and FALSE,  
only their lowercase brethren.  We could undo that if we get  
push-back about it.  
  
Ideally we'd back-patch this as far as v11, which is where c.h  
started to rely on <stdbool.h>.  But the odds of creating problems  
for formerly-working ECPG client code seem about as large as the  
odds of fixing any non-working cases, so we'll just do this in HEAD.  
  
Discussion: https://postgr.es/m/CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com  

M configure
M configure.in
M src/backend/utils/fmgr/dfmgr.c
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/ecpg/include/ecpg_config.h.in
M src/interfaces/ecpg/include/ecpglib.h
M src/pl/plperl/plperl.h
M src/tools/msvc/Solution.pm

gitattributes: Add new file

commit   : de7c2d30b6dc2544b181cf074e942fff54d7999d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Nov 2019 08:13:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Nov 2019 08:13:55 +0100    

Click here for diff

M .gitattributes

Make the order of the header file includes consistent in backend modules.

commit   : 14aec03502302eff6c67981d8fd121175c436ce9    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 12 Nov 2019 08:30:16 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 12 Nov 2019 08:30:16 +0530    

Click here for diff

Similar to commits 7e735035f2 and dddf4cdc33, this commit makes the order  
of header file inclusion consistent for backend modules.  
  
In the passing, removed a couple of duplicate inclusions.  
  
Author: Vignesh C  
Reviewed-by: Kuntal Ghosh and Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com  

M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/commands/alter.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/hba.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/scansup.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slotfuncs.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/page/checksum.c
M src/backend/storage/smgr/md.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/time/combocid.c

Doc: fix ancient mistake, or at least obsolete info, in rules example.

commit   : b6423e92abfadaa1ed9642319872aa1654403cd6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Nov 2019 14:39:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Nov 2019 14:39:54 -0500    

Click here for diff

The example of expansion of multiple views claimed that the resulting  
subquery nest would not get fully flattened because of an aggregate  
function.  There's no aggregate in the example, though, only a user  
defined function confusingly named MIN().  In a modern server, the  
reason for the non-flattening is that MIN() is volatile, but I'm  
unsure whether that was true back when this text was written.  
  
Let's reduce the confusion level by using LEAST() instead (which  
we didn't have at the time this example was created).  And then  
we can just say that the planner will flatten the sub-queries, so  
the rewrite system doesn't have to.  
  
Noted by Paul Jungwirth.  This text is old enough to vote, so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CA+renyXZFnmp9PcvX1EVR2dR=XG5e6E-AELr8AHCNZ8RYrpnPw@mail.gmail.com  

M doc/src/sgml/rules.sgml

Further improve stability of partition_prune regression test.

commit   : 13e8b2ee896d76dfcd02dddee40919fd6f2cd937    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Nov 2019 10:33:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Nov 2019 10:33:00 -0500    

Click here for diff

Commits 4ea03f3f4 et al arranged to filter out row counts in parallel  
plans, because those are dependent on the number of workers actually  
obtained.  Somehow I missed that the 'Rows Removed by Filter' counts  
can also vary, so fix that too.  Per buildfarm.  
  
This seems worth a last-minute patch because unreliable regression  
tests are a serious pain in the rear for packagers.  
  
Like the previous patch, back-patch to v11 where this test was  
introduced.  

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

gitattributes: Remove entries for no longer existing files

commit   : 2cd75e4e795bea110c1d32e8cbfdf1e33a109e80    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Nov 2019 11:54:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Nov 2019 11:54:12 +0100    

Click here for diff

M .gitattributes

Fix whitespace

commit   : d0c92527cc77a8f6b235c2a5abba95e01367f825    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Nov 2019 09:51:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Nov 2019 09:51:10 +0100    

Click here for diff

M src/backend/utils/mmgr/README

Rerun autoheader

commit   : bbaa8232729f2aa1b1061503a3d9f7db503d2788    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Nov 2019 09:50:07 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Nov 2019 09:50:07 +0100    

Click here for diff

This puts pg_config.h.in content back into the "correct" order.  

M src/include/pg_config.h.in

Optimize PredicateLockTuple().

commit   : db2687d1f3787aa8113b3dbb358153feee30c64c    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 11 Nov 2019 16:34:01 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 11 Nov 2019 16:34:01 +1300    

Click here for diff

PredicateLockTuple() has a fast exit if tuple was written by the current  
transaction, as in that case it already has a lock.  This check can be  
performed using TransactionIdIsCurrentTransactionId() instead of  
SubTransGetTopmostTransaction(), to avoid any chance of having to hit the  
disk.  
  
Author: Ashwin Agrawal, based on a suggestion from Andres Freund  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com  

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

Optimize TransactionIdIsCurrentTransactionId().

commit   : 695c5977c8bc115029a85dcc1821d7b0136b4e4c    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 11 Nov 2019 16:33:04 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 11 Nov 2019 16:33:04 +1300    

Click here for diff

If the passed in xid is the current top transaction, we can do a fast  
check and exit early.  This should work well for the current heap but  
also works very well for proposed AMs that don't use a separate xid  
for subtransactions.  
  
Author: Ashwin Agrawal, based on a suggestion from Andres Freund  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com  

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

Rearrange dropdb() to avoid errors after allowing other sessions to exit.

commit   : 9fab25c6cd1f943284b8e0014007cd5750d54308    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 9 Nov 2019 17:28:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 9 Nov 2019 17:28:27 +0530    

Click here for diff

During Drop Database, it is better to error out before allowing other  
sessions to exit and forcefully terminating autovacuum workers.  All the  
other errors except for checking subscriptions are already done before.  
  
Author: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1+qhLkCYG2oy9xug9ur_j=G2wQNRYAyd+-kZfZ1z42pLw@mail.gmail.com  

M src/backend/commands/dbcommands.c

Fix subscription test

commit   : ef8fcbff56e8904ba83b2659e9d0290e6106928e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Nov 2019 13:19:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Nov 2019 13:19:27 +0100    

Click here for diff

After altering a subscription, we should wait until the updated table  
sync data has been fetched by the subscriber.  

M src/test/subscription/t/008_diff_schema.pl

doc: Clarify documentation about SSL passphrases

commit   : d2d4c35080026ba3da49583e30c1fd53c9fb22dd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Nov 2019 10:13:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Nov 2019 10:13:14 +0100    

Click here for diff

The previous statement that using a passphrase disables the ability to  
change the server's SSL configuration without a server restart was no  
longer completely true since the introduction of  
ssl_passphrase_command_supports_reload.  

M doc/src/sgml/runtime.sgml

doc: Further tweak recovery parameters documentation

commit   : 27b59d619ddfb512e3f158a87f557a46f2d5794f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Nov 2019 09:35:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Nov 2019 09:35:21 +0100    

Click here for diff

Remove one sentence that was deemed misleading.  
  
Discussion: https://www.postgresql.org/message-id/flat/E1iEgSp-0004R5-2E%40gemulon.postgresql.org  

M doc/src/sgml/config.sgml

Fix negative bitmapset member not allowed error in logical replication

commit   : 1c60e40ad54b18685436443da3c56a7018a35475    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Nov 2019 13:48:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Nov 2019 13:48:59 +0100    

Click here for diff

This happens when we add a replica identity column on a subscriber  
that does not yet exist on the publisher, according to the mapping  
maintained by the subscriber.  Code that checks whether the target  
relation on the subscriber is updatable would check the replica  
identity attribute bitmap with a column number -1, which would result  
in an error.  To fix, skip such columns in the bitmap lookup and  
consider the relation not updatable.  The result is consistent with  
the rule that the replica identity columns on the subscriber must be a  
subset of those on the publisher, since if the column doesn't exist on  
the publisher, the column set on the subscriber can't be a subset.  
  
Reported-by: Tim Clarke <[email protected]>  
Analyzed-by: Jehan-Guillaume de Rorthais <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/a9139c29-7ddd-973b-aa7f-71fed9c38d75%40minerva.info  

M src/backend/replication/logical/relation.c
M src/test/subscription/t/008_diff_schema.pl

Fix new COPY test of PL/pgSQL with VPATH builds

commit   : 943b447d303e6d0a7635d39ac552550b77b96cef    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 9 Nov 2019 15:41:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 9 Nov 2019 15:41:34 +0900    

Click here for diff

The buildfarm has turned red after 1858b10 because VPATH builds need to  
use "@abs_srcdir@" and not "@abs_builddir@" for paths coming directly  
from the source tree.  The input file of the new test got that right,  
but not the output file.  
  
Per complaints from several buildfarm animals, including desmoxytes and  
culicidae.  I have also reproduced the error by myself.  

M src/pl/plpgsql/src/output/plpgsql_copy.source

Add tests for COPY in PL/pgSQL

commit   : 1858b105b05fcded43e9f2b767dec7268431043b    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 9 Nov 2019 14:50:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 9 Nov 2019 14:50:20 +0900    

Click here for diff

This stresses the error handling of COPY inside SPI which does not  
support the operation using stdin or stdout, and these scenarios were  
not tested up to now.  
  
Author: Mark Dilger  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/data/copy1.data
A src/pl/plpgsql/src/expected/.gitignore
A src/pl/plpgsql/src/input/plpgsql_copy.source
A src/pl/plpgsql/src/output/plpgsql_copy.source
A src/pl/plpgsql/src/sql/.gitignore

Pass ItemPointer not HeapTuple to IndexBuildCallback.

commit   : aae50236e4ce95c05a3962be0814c74c5a22206d    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 8 Nov 2019 00:44:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 8 Nov 2019 00:44:52 -0800    

Click here for diff

Not all AMs use HeapTuples internally, making it inconvenient to pass  
a HeapTuple. As the index callbacks really only need the TID, not the  
full tuple, modify callback to only take ItemPointer.  
  
Author: Ashwin Agrawal  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CALfoeis6=8ehuR=VNtHvj3z16cYfCwPdTcpaxU+sfSUJ5QgR3g@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/bloom/blinsert.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/include/access/tableam.h

Add backtrace support for error reporting

commit   : 71a8a4f6e36547bb060dbcc961ea9b57420f7190    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Nov 2019 15:44:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Nov 2019 15:44:20 -0300    

Click here for diff

Add some support for automatically showing backtraces in certain error  
situations in the server.  Backtraces are shown on assertion failure;  
also, a new setting backtrace_functions can be set to a list of C  
function names, and all ereport()s and elog()s from the mentioned  
functions will have backtraces generated.  Finally, the function  
errbacktrace() can be manually added to an ereport() call to generate a  
backtrace for that call.  
  
Authors: Peter Eisentraut, Álvaro Herrera  
Discussion: https://postgr.es/m//[email protected]  
Discussion: https://postgr.es/m/CAMsr+YGL+yfWE=JvbUbnpWtrRZNey7hJ07+zT4bYJdVp4Szdrg@mail.gmail.com  

M configure
M configure.in
M doc/src/sgml/config.sgml
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/include/pg_config.h.in
M src/include/utils/elog.h
M src/include/utils/guc.h

Fix gratuitous error message variation

commit   : 3dcffb381c81c9c8f8254100feacac256b9e75a6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Nov 2019 18:12:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Nov 2019 18:12:51 +0100    

Click here for diff

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

postgres_fdw: Fix error message for PREPARE TRANSACTION.

commit   : 879c1176157175e0a83742b810f137aebccef4a4    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 8 Nov 2019 17:00:30 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 8 Nov 2019 17:00:30 +0900    

Click here for diff

Currently, postgres_fdw does not support preparing a remote transaction  
for two-phase commit even in the case where the remote transaction is  
read-only, but the old error message appeared to imply that that was not  
supported only if the remote transaction modified remote tables.  Change  
the message so as to include the case where the remote transaction is  
read-only.  
  
Also fix a comment above the message.  
  
Also add a note about the lack of supporting PREPARE TRANSACTION to the  
postgres_fdw documentation.  
  
Reported-by: Gilles Darold  
Author: Gilles Darold and Etsuro Fujita  
Reviewed-by: Michael Paquier and Kyotaro Horiguchi  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/08600ed3-3084-be70-65ba-279ab19618a5%40darold.net  

M contrib/postgres_fdw/connection.c
M doc/src/sgml/postgres-fdw.sgml

More precise errors from initial pg_control check

commit   : b85e43feb3e837699239aba6b8e0f280a59417be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Nov 2019 08:03:16 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Nov 2019 08:03:16 +0100    

Click here for diff

Use a separate error message for invalid checkpoint location and  
invalid state instead of just "invalid data" for both.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Use "low key" terminology in nbtsort.c.

commit   : e86c8ef243aad4570f66a406c81211f75774ced1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 7 Nov 2019 17:12:09 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 7 Nov 2019 17:12:09 -0800    

Click here for diff

nbtree index builds once stashed the "minimum key" for a page, which was  
used as the basis of the pivot tuple that gets placed in the next level  
up (i.e. the tuple that stores the downlink to the page in question).  
It doesn't quite work that way anymore, so the "minimum key" terminology  
now seems misleading (these days the minimum key is actually a straight  
copy of the high key from the left sibling, which is a distinct thing in  
subtle but important ways).  Rename this concept to "low key".  This  
name is a lot clearer given that there is now a sharp distinction  
between pivot and non-pivot tuples.  Also remove comments that describe  
obsolete details about how the minimum key concept used to work.  
  
Rather than generating the minus infinity item for the leftmost page on  
a level by copying the new item and truncating that copy, simply  
allocate a small buffer.  The old approach confusingly created the  
impression that the new item had some kind of significance.  This was  
another artifact of how things used to work before commits 8224de4f and  
dd299df8.  

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

docs: clarify that only INSERT and UPDATE triggers can mod. NEW

commit   : c10fae21428fe926568e67b7662ed8577faf9235    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 7 Nov 2019 15:50:00 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 7 Nov 2019 15:50:00 -0500    

Click here for diff

The point is that DELETE triggers cannot modify any values.  
  
Reported-by: Eugen Konkov  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

M doc/src/sgml/trigger.sgml

Move declaration of ecpg_gettext() to a saner place.

commit   : c8cb98ec41f0c41ac3b4c3e8be01f12c4c53d3aa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Nov 2019 14:21:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Nov 2019 14:21:52 -0500    

Click here for diff

Declaring this in the client-visible header ecpglib.h was a pretty  
poor decision.  It's not meant to be application-callable (and if  
it was, putting it outside the extern "C" { ... } wrapper means  
that C++ clients would fail to call it).  And the declaration would  
not even compile for a client, anyway, since it would not have the  
macro pg_attribute_format_arg().  Fortunately, it seems that no  
clients have tried to include this header with ENABLE_NLS defined,  
or we'd have gotten complaints about that.  But we have no business  
putting such a restriction on client code.  
  
Move the declaration to ecpglib_extern.h, since in fact nothing  
outside src/interfaces/ecpg/ecpglib/ needs to call it.  
  
The practical effect of this is just that clients can now safely  
#include ecpglib.h while having ENABLE_NLS defined, but that seems  
like enough of a reason to back-patch it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/include/ecpglib.h

Fix SET CONSTRAINTS .. DEFERRED on partitioned tables

commit   : b4bcc6bfdfa2b564b0171d437f9988a3159fd58d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Nov 2019 13:59:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Nov 2019 13:59:24 -0300    

Click here for diff

SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a  
sanity check that ensures that the affected constraints have triggers.  
On partitioned tables, the triggers are in the leaf partitions, not in  
the partitioned relations themselves, so the sanity check fails.  
Removing the sanity check solves the problem, because the code needed to  
support the case is already there.  
  
Backpatch to 11.  
  
Note: deferred unique constraints are not affected by this bug, because  
they do have triggers in the parent partitioned table.  I did not add a  
test for this scenario.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix integer-overflow edge case detection in interval_mul and pgbench.

commit   : a7145f6bc8b7774a29f3841552a463fb20ea98d7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Nov 2019 11:22:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Nov 2019 11:22:52 -0500    

Click here for diff

This patch adopts the overflow check logic introduced by commit cbdb8b4c0  
into two more places.  interval_mul() failed to notice if it computed a  
new microseconds value that was one more than INT64_MAX, and pgbench's  
double-to-int64 logic had the same sorts of edge-case problems that  
cbdb8b4c0 fixed in the core code.  
  
To make this easier to get right in future, put the guts of the checks  
into new macros in c.h, and add commentary about how to use the macros  
correctly.  
  
Back-patch to all supported branches, as we did with the previous fix.  
  
Yuya Watari  
  
Discussion: https://postgr.es/m/CAJ2pMkbkkFw2hb9Qb1Zj8d06EhWAQXFLy73St4qWv6aX=vqnjw@mail.gmail.com  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/timestamp.c
M src/bin/pgbench/pgbench.c
M src/include/c.h
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Remove HAVE_LONG_LONG_INT

commit   : effa40281bb1f6c71e81c980f86852ab3be603c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Nov 2019 13:30:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Nov 2019 13:30:04 +0100    

Click here for diff

The presence of long long int is now implied in the requirement for  
C99 and the configure check for the same.  
  
We keep the define hard-coded in ecpg_config.h for backward  
compatibility with ecpg-using user code.  
  
Discussion: https://www.postgresql.org/message-id/flat/5cdd6a2b-b2c7-c6f6-344c-a406d5c1a254%402ndquadrant.com  

M configure
M configure.in
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpg_config.h.in
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.stderr
M src/interfaces/ecpg/test/sql/sqlda.pgc

Fix nested error handling in PG_FINALLY

commit   : 581a55889ba7f76dd87a270e37e5137f684bfdb7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Nov 2019 09:54:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Nov 2019 09:54:09 +0100    

Click here for diff

We need to pop the error stack before running the user-supplied  
PG_FINALLY code.  Otherwise an error in the cleanup code would end up  
at the same sigsetjmp() invocation and result in an infinite error  
handling loop.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/95a822c3-728b-af0e-d7e5-71890507ae0c%402ndquadrant.com  

M src/backend/utils/adt/xml.c
M src/include/utils/elog.h

Fix assertion failure when running pgbench -s.

commit   : a0c96856e8b38a102daac76e3d385d9f8876744e    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 7 Nov 2019 16:31:36 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 7 Nov 2019 16:31:36 +0900    

Click here for diff

If there is the WAL page that the continuation WAL record just fits within  
(i.e., the continuation record ends just at the end of the page) and  
the LSN in such page is specified with -s option, previously pg_waldump  
caused an assertion failure. The cause of this assertion failure was that  
XLogFindNextRecord() that pg_waldump -s calls mistakenly handled  
such special WAL page.  
  
This commit changes XLogFindNextRecord() so that it can handle  
such WAL page correctly.  
  
Back-patch to all supported versions.  
  
Author: Andrey Lepikhov  
Reviewed-by: Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Add reusable routine for making arrays unique.

commit   : 7815e7efdb4ce9575b5d8460beb0dd2569d7ca3a    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 7 Nov 2019 16:51:04 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 7 Nov 2019 16:51:04 +1300    

Click here for diff

Introduce qunique() and qunique_arg(), which can be used after qsort()  
and qsort_arg() respectively to remove duplicate values.  Use it where  
appropriate.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane (in an earlier version)  
Discussion: https://postgr.es/m/CAEepm%3D2vmFTNpAmwbGGD2WaryM6T3hSDVKQPfUwjdD_5XY6vAA%40mail.gmail.com  

M contrib/hstore/hstore_io.c
M contrib/intarray/_int_tool.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/executor/nodeTidscan.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/txid.c
M src/backend/utils/cache/syscache.c
A src/include/lib/qunique.h

Check after errors of SPI_execute() in xml.c

commit   : 3feb6ace7cfe8edbf6db702de06dc9295f307a8e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Nov 2019 11:13:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Nov 2019 11:13:31 +0900    

Click here for diff

SPI gets used to build a list of relation OIDs for XML object  
generation, and one code path building a list uses SPI_execute() without  
looking at errors it produces.  So fix that.  
  
Author: Mark Dilger  
Reviewed-by: Michael Paquier, Pavel Stehule  
Discussion: https://postgr.es/m/[email protected]  

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

Allow sampling of statements depending on duration

commit   : 6e3e6cc0e884a6091e1094dff29db430af08fb93    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 4 Nov 2019 01:57:45 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 4 Nov 2019 01:57:45 +0100    

Click here for diff

This allows logging a sample of statements, without incurring excessive  
log traffic (which may impact performance).  This can be useful when  
analyzing workloads with lots of short queries.  
  
The sampling is configured using two new GUC parameters:  
  
 * log_min_duration_sample - minimum required statement duration  
  
 * log_statement_sample_rate - sample rate (0.0 - 1.0)  
  
Only statements with duration exceeding log_min_duration_sample are  
considered for sampling. To enable sampling, both those GUCs have to  
be set correctly.  
  
The existing log_min_duration_statement GUC has a higher priority, i.e.  
statements with duration exceeding log_min_duration_statement will be  
always logged, irrespectedly of how the sampling is configured. This  
means only configurations  
  
  log_min_duration_sample < log_min_duration_statement  
  
do actually sample the statements, instead of logging everything.  
  
Author: Adrien Nayrat  
Reviewed-by: David Rowley, Vik Fearing, Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc.h

Document log_transaction_sample_rate as superuser-only

commit   : 11d9ac28e5e0077d8f23761c2962a30423f44cee    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 4 Nov 2019 02:00:26 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 4 Nov 2019 02:00:26 +0100    

Click here for diff

The docs do say which GUCs can be changed only by superusers, but we  
forgot to mention this for the new log_transaction_sample_rate. This  
GUC was introduced in PostgreSQL 12, so backpatch accordingly.  
  
Author: Adrien Nayrat  
Backpatch-through: 12  

M doc/src/sgml/config.sgml

Minor code review for tuple slot rewrite.

commit   : 22e44e8dbcfe4b9f3c4189f07a2361c951d72514    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Nov 2019 12:00:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Nov 2019 12:00:17 -0500    

Click here for diff

Avoid creating transiently-inconsistent slot states where possible,  
by not setting TTS_FLAG_SHOULDFREE until after the slot actually has  
a free'able tuple pointer, and by making sure that we reset tts_nvalid  
and related derived state before we replace the tuple contents.  This  
would only matter if something were to examine the slot after we'd  
suffered some kind of error (e.g. out of memory) while manipulating  
the slot.  We typically don't do that, so these changes might just be  
cosmetic --- but even if so, it seems like good future-proofing.  
  
Also remove some redundant Asserts, and add a couple for consistency.  
  
Back-patch to v12 where all this code was rewritten.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c
M src/include/executor/tuptable.h

Sync our DTrace infrastructure with c.h's definition of type bool.

commit   : ff43b3e88eceb94b3a2b2579e8510e4f3aedbe09    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Nov 2019 11:11:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Nov 2019 11:11:40 -0500    

Click here for diff

Since commit d26a810eb, we've defined bool as being either _Bool from  
<stdbool.h>, or "unsigned char"; but that commit overlooked the fact  
that probes.d has "#define bool char".  For consistency, make it say  
"unsigned char" instead.  This should be strictly a cosmetic change,  
but it seems best to be in sync.  
  
Formally, in the now-normal case where we're using <stdbool.h>, it'd  
be better to write "#define bool _Bool".  However, then we'd need  
some build infrastructure to inject that configuration choice into  
probes.d, and it doesn't seem worth the trouble.  We only use  
<stdbool.h> if sizeof(_Bool) is 1, so having DTrace think that  
bool parameters are "unsigned char" should be close enough.  
  
Back-patch to v12 where d26a810eb came in.  
  
Discussion: https://postgr.es/m/CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/probes.d

Fix memory allocation mistake

commit   : d40abd5fcfb25d764419f8e9bffa5cdbdb247c1b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Nov 2019 14:20:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Nov 2019 14:20:29 +0100    

Click here for diff

The previous code was allocating more memory than necessary because  
the formula used the wrong data type.  
  
Reported-by: Jehan-Guillaume de Rorthais <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20191105172918.3e32a446@firost  

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

Remove unused function argument

commit   : 5b7ba75f7ff854003231e8099e3038c7e2eba875    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Nov 2019 08:07:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Nov 2019 08:07:04 +0100    

Click here for diff

The cache_plan argument to ri_PlanCheck has not been used since  
e8c9fd5fdf768323911f7088e8287f63b513c3c6.  
  
Reviewed-by: vignesh C <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/ec8a8b45-a30b-9193-cd4b-985d60d1497e%402ndquadrant.com  

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

Fix timestamp of sent message for write context in logical decoding

commit   : 5f6b1eb0cf4b0fb101478da51c294a63fd4726ef    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Nov 2019 16:12:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Nov 2019 16:12:21 +0900    

Click here for diff

When sending data for logical decoding using the streaming replication  
protocol via a WAL sender, the timestamp of the sent write message is  
allocated at the beginning of the message when preparing for the write,  
and actually computed when the write message is ready to be sent.  
  
The timestamp was getting computed after sending the message.  This  
impacts anything using logical decoding, causing for example logical  
replication to report mostly NULL for last_msg_send_time in  
pg_stat_subscription.  
  
This commit makes sure that the timestamp is computed before sending the  
message.  This is wrong since 5a991ef, so backpatch down to 9.4.  
  
Author: Jeff Janes  
Discussion: https://postgr.es/m/CAMkU=1z=WMn8jt7iEdC5sYNaPgAgOASb_OW5JYv-vMdYaJSL-w@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/replication/walsender.c

Request small targetlist for input to WindowAgg.

commit   : a9056cc637f2d183eefa165ebbd0308d9a89abb9    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 6 Nov 2019 04:13:30 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 6 Nov 2019 04:13:30 +0000    

Click here for diff

WindowAgg will potentially store large numbers of input rows into  
tuplestores to allow access to other rows in the frame. If the input  
is coming via an explicit Sort node, then unneeded columns will  
already have been discarded (since Sort requests a small tlist); but  
there are idioms like COUNT(*) OVER () that result in the input not  
being sorted at all, and cases where the input is being sorted by some  
means other than a Sort; if we don't request a small tlist, then  
WindowAgg's storage requirement is inflated by the unneeded columns.  
  
Backpatch back to 9.6, where the current tlist handling was added.  
(Prior to that, WindowAgg would always use a small tlist.)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Correct the command tags for ALTER ... RENAME COLUMN.

commit   : 979766c0afceb95c4b96323b57a0f6edf8472612    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 6 Nov 2019 12:54:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 6 Nov 2019 12:54:17 +0900    

Click here for diff

Previously ALTER MATERIALIZED VIEW / FOREIGN TABLE ... RENAME COLUMN ...  
returned "ALTER TABLE" as a command tag. This commit fixes them so that  
they return "ALTER MATERIALIZED VIEW" and "ALTER FOREIGN TABLE" as  
command tags, respectively.  
  
This issue exists in all supported versions, but we don't back-patch this  
because it's not enough of a bug to justify taking any compatibility risks for.  
Otherwise, the back-patch would cause minor version update to break,  
for example, the existing event trigger functions using TG_TAG.  
  
Author: Fujii Masao  
Reviewed-by: Ibrar Ahmed  
Discussion: https://postgr.es/m/CAHGQGwGUaC03FFdTFoHsCuDrrNvFvNVQ6xyd40==P25WvuBJjg@mail.gmail.com  

M src/backend/tcop/utility.c

Add "G" (server-side data generation) as an initialization step in pgbench.

commit   : a386942bd29b0ef0c9df061392659880d22cdf43    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 6 Nov 2019 11:02:30 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 6 Nov 2019 11:02:30 +0900    

Click here for diff

This commit allows --init-steps option in pgbench to accept "G" character  
meaning server-side data generation as an initialization step.  
With "G", only limited queries are sent from pgbench client and  
then data is actually generated in the server. This might make  
the initialization phase faster if the bandwidth between pgbench client  
and the server is low.  
  
Author: Fabien Coelho  
Reviewed-by: Anna Endo, Ibrar Ahmed, Fujii Masao  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904061826420.3678@lancre  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl

doc: fix plurality typo on bgwriter doc sentence

commit   : 4b5e58b86e3b09daa7384dbbd0bb4cacbd9bd7c6    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 Nov 2019 20:54:04 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 Nov 2019 20:54:04 -0500    

Click here for diff

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

M doc/src/sgml/bgworker.sgml

Make StringInfo available to frontend code.

commit   : 26aaf97b683d6258c098859e6b1268e1f5da242f    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 5 Nov 2019 14:56:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 5 Nov 2019 14:56:40 -0800    

Click here for diff

There's plenty places in frontend code that could benefit from a  
string buffer implementation. Some because it yields simpler and  
faster code, and some others because of the desire to share code  
between backend and frontend.  
  
While there is a string buffer implementation available to frontend  
code, libpq's PQExpBuffer, it is clunkier than stringinfo, it  
introduces a libpq dependency, doesn't allow for sharing between  
frontend and backend code, and has a higher API/ABI stability  
requirement due to being exposed via libpq.  
  
Therefore it seems best to just making StringInfo being usable by  
frontend code. There's not much to do for that, except for rewriting  
two subsequent elog/ereport calls into others types of error  
reporting, and deciding on a maximum string length.  
  
For the maximum string size I decided to privately define MaxAllocSize  
to the same value as used in the backend. It seems likely that we'll  
want to reconsider this for both backend and frontend code in the not  
too far away future.  
  
For now I've left stringinfo.h in lib/, rather than common/, to reduce  
the likelihood of unnecessary breakage. We could alternatively decide  
to provide a redirecting stringinfo.h in lib/, or just not provide  
compatibility.  
  
Author: Andres Freund  
Reviewed-By: Kyotaro Horiguchi, Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/lib/Makefile
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/common/Makefile
R086 src/backend/lib/stringinfo.c src/common/stringinfo.c
M src/include/lib/stringinfo.h
M src/tools/msvc/Mkvcbuild.pm

Split all OBJS style lines in makefiles into one-line-per-entry style.

commit   : 01368e5d9da77099b38aac527b01b85cc7869b25    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 5 Nov 2019 14:41:07 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 5 Nov 2019 14:41:07 -0800    

Click here for diff

When maintaining or merging patches, one of the most common sources  
for conflicts are the list of objects in makefiles. Especially when  
the split across lines has been changed on both sides, which is  
somewhat common due to attempting to stay below 80 columns, those  
conflicts are unnecessarily laborious to resolve.  
  
By splitting, and alphabetically sorting, OBJS style lines into one  
object per line, conflicts should be less frequent, and easier to  
resolve when they still occur.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/adminpack/Makefile
M contrib/amcheck/Makefile
M contrib/auto_explain/Makefile
M contrib/bloom/Makefile
M contrib/btree_gin/Makefile
M contrib/btree_gist/Makefile
M contrib/cube/Makefile
M contrib/dblink/Makefile
M contrib/dict_int/Makefile
M contrib/dict_xsyn/Makefile
M contrib/fuzzystrmatch/Makefile
M contrib/hstore/Makefile
M contrib/hstore_plperl/Makefile
M contrib/hstore_plpython/Makefile
M contrib/intarray/Makefile
M contrib/jsonb_plperl/Makefile
M contrib/jsonb_plpython/Makefile
M contrib/ltree/Makefile
M contrib/ltree_plpython/Makefile
M contrib/oid2name/Makefile
M contrib/pageinspect/Makefile
M contrib/passwordcheck/Makefile
M contrib/pg_buffercache/Makefile
M contrib/pg_freespacemap/Makefile
M contrib/pg_prewarm/Makefile
M contrib/pg_standby/Makefile
M contrib/pg_stat_statements/Makefile
M contrib/pg_trgm/Makefile
M contrib/pg_visibility/Makefile
M contrib/pgcrypto/Makefile
M contrib/pgrowlocks/Makefile
M contrib/pgstattuple/Makefile
M contrib/postgres_fdw/Makefile
M contrib/seg/Makefile
M contrib/sepgsql/Makefile
M contrib/sslinfo/Makefile
M contrib/tsm_system_rows/Makefile
M contrib/tsm_system_time/Makefile
M contrib/unaccent/Makefile
M contrib/uuid-ossp/Makefile
M contrib/vacuumlo/Makefile
M contrib/xml2/Makefile
M src/backend/Makefile
M src/backend/access/brin/Makefile
M src/backend/access/common/Makefile
M src/backend/access/gin/Makefile
M src/backend/access/gist/Makefile
M src/backend/access/hash/Makefile
M src/backend/access/heap/Makefile
M src/backend/access/index/Makefile
M src/backend/access/nbtree/Makefile
M src/backend/access/rmgrdesc/Makefile
M src/backend/access/spgist/Makefile
M src/backend/access/table/Makefile
M src/backend/access/tablesample/Makefile
M src/backend/access/transam/Makefile
M src/backend/bootstrap/Makefile
M src/backend/catalog/Makefile
M src/backend/commands/Makefile
M src/backend/executor/Makefile
M src/backend/foreign/Makefile
M src/backend/jit/Makefile
M src/backend/jit/llvm/Makefile
M src/backend/lib/Makefile
M src/backend/libpq/Makefile
M src/backend/main/Makefile
M src/backend/nodes/Makefile
M src/backend/optimizer/geqo/Makefile
M src/backend/optimizer/path/Makefile
M src/backend/optimizer/plan/Makefile
M src/backend/optimizer/prep/Makefile
M src/backend/optimizer/util/Makefile
M src/backend/parser/Makefile
M src/backend/partitioning/Makefile
M src/backend/port/Makefile
M src/backend/port/win32/Makefile
M src/backend/postmaster/Makefile
M src/backend/regex/Makefile
M src/backend/replication/Makefile
M src/backend/replication/libpqwalreceiver/Makefile
M src/backend/replication/logical/Makefile
M src/backend/replication/pgoutput/Makefile
M src/backend/rewrite/Makefile
M src/backend/snowball/Makefile
M src/backend/statistics/Makefile
M src/backend/storage/buffer/Makefile
M src/backend/storage/file/Makefile
M src/backend/storage/freespace/Makefile
M src/backend/storage/ipc/Makefile
M src/backend/storage/large_object/Makefile
M src/backend/storage/lmgr/Makefile
M src/backend/storage/page/Makefile
M src/backend/storage/smgr/Makefile
M src/backend/storage/sync/Makefile
M src/backend/tcop/Makefile
M src/backend/tsearch/Makefile
M src/backend/utils/adt/Makefile
M src/backend/utils/cache/Makefile
M src/backend/utils/error/Makefile
M src/backend/utils/fmgr/Makefile
M src/backend/utils/hash/Makefile
M src/backend/utils/init/Makefile
M src/backend/utils/mb/Makefile
M src/backend/utils/misc/Makefile
M src/backend/utils/mmgr/Makefile
M src/backend/utils/resowner/Makefile
M src/backend/utils/sort/Makefile
M src/backend/utils/time/Makefile
M src/bin/initdb/Makefile
M src/bin/pg_archivecleanup/Makefile
M src/bin/pg_basebackup/Makefile
M src/bin/pg_checksums/Makefile
M src/bin/pg_config/Makefile
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_dump/Makefile
M src/bin/pg_resetwal/Makefile
M src/bin/pg_rewind/Makefile
M src/bin/pg_test_fsync/Makefile
M src/bin/pg_test_timing/Makefile
M src/bin/pg_upgrade/Makefile
M src/bin/pg_waldump/Makefile
M src/bin/pgbench/Makefile
M src/bin/pgevent/Makefile
M src/bin/psql/Makefile
M src/common/Makefile
M src/fe_utils/Makefile
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/libpq/Makefile
M src/pl/plpgsql/src/Makefile
M src/pl/tcl/Makefile
M src/port/Makefile
M src/test/isolation/Makefile
M src/test/modules/test_bloomfilter/Makefile
M src/test/modules/test_ginpostinglist/Makefile
M src/test/modules/test_integerset/Makefile
M src/test/modules/test_parser/Makefile
M src/test/modules/test_predtest/Makefile
M src/test/modules/test_rbtree/Makefile
M src/test/modules/test_rls_hooks/Makefile
M src/test/modules/test_shm_mq/Makefile
M src/timezone/Makefile
M src/tools/findoidjoins/Makefile
M src/tools/ifaddrs/Makefile

Tweak some authentication debug messages to follow project style.

commit   : 66c61c81b90c68db84d422092fbbf8a1a82ee09a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Nov 2019 14:29:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Nov 2019 14:29:08 -0500    

Click here for diff

Avoid initial capital, since that's not how we do it.  
  
Discussion: https://postgr.es/m/CACP=ajbrFFYUrLyJBLV8=q+eNCapa1xDEyvXhMoYrNphs-xqPw@mail.gmail.com  

M src/backend/libpq/auth.c

Avoid logging complaints about abandoned connections when using PAM.

commit   : 3affe76ef8227dad85b61cec769235f682132651    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Nov 2019 14:27:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Nov 2019 14:27:37 -0500    

Click here for diff

For a long time (since commit aed378e8d) we have had a policy to log  
nothing about a connection if the client disconnects when challenged  
for a password.  This is because libpq-using clients will typically  
do that, and then come back for a new connection attempt once they've  
collected a password from their user, so that logging the abandoned  
connection attempt will just result in log spam.  However, this did  
not work well for PAM authentication: the bottom-level function  
pam_passwd_conv_proc() was on board with it, but we logged messages  
at higher levels anyway, for lack of any reporting mechanism.  
Add a flag and tweak the logic so that the case is silent, as it is  
for other password-using auth mechanisms.  
  
Per complaint from Yoann La Cancellera.  It's been like this for awhile,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CACP=ajbrFFYUrLyJBLV8=q+eNCapa1xDEyvXhMoYrNphs-xqPw@mail.gmail.com  

M src/backend/libpq/auth.c

Fix "unexpected relkind" error when denying permissions on toast tables.

commit   : a30531c5c8a384363d410d4027e1c1eeed76e550    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Nov 2019 13:40:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Nov 2019 13:40:37 -0500    

Click here for diff

get_relkind_objtype, and hence get_object_type, failed when applied to a  
toast table.  This is not a good thing, because it prevents reporting of  
perfectly legitimate permissions errors.  (At present, these functions  
are in fact *only* used to determine the ObjectType argument for  
acl_error() calls.)  It seems best to have them fall back to returning  
OBJECT_TABLE in every case where they can't determine an object type  
for a pg_class entry, so do that.  
  
In passing, make some edits to alter.c to make it more obvious that  
those calls of get_object_type() are used only for error reporting.  
This might save a few cycles in the non-error code path, too.  
  
Back-patch to v11 where this issue originated.  
  
John Hsu, Michael Paquier, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Generate EquivalenceClass members for partitionwise child join rels.

commit   : 529ebb20aaa5eb68e4fb7a656271bbb83efe9529    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Nov 2019 11:42:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Nov 2019 11:42:24 -0500    

Click here for diff

Commit d25ea0127 got rid of what I thought were entirely unnecessary  
derived child expressions in EquivalenceClasses for EC members that  
mention multiple baserels.  But it turns out that some of the child  
expressions that code created are necessary for partitionwise joins,  
else we fail to find matching pathkeys for Sort nodes.  (This happens  
only for certain shapes of the resulting plan; it may be that  
partitionwise aggregation is also necessary to show the failure,  
though I'm not sure of that.)  
  
Reverting that commit entirely would be quite painful performance-wise  
for large partition sets.  So instead, add code that explicitly  
generates child expressions that match only partitionwise child join  
rels we have actually generated.  
  
Per report from Justin Pryzby.  (Amit Langote noticed the problem  
earlier, though it's not clear if he recognized then that it could  
result in a planner error, not merely failure to exploit partitionwise  
join, in the code as-committed.)  Back-patch to v12 where commit  
d25ea0127 came in.  
  
Amit Langote, with lots of kibitzing from me  
  
Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/paths.h
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Doc: Clarify locks taken when using ALTER TABLE ATTACH PARTITION

commit   : 2a4d96ebbd65be9aa421a8a4550a51ff12bc6d2d    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 Nov 2019 10:32:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 Nov 2019 10:32:38 +0900    

Click here for diff

Since 898e5e32, this command uses partially ShareUpdateExclusiveLock,  
but the docs did not get the call.  
  
Author: Justin Pryzby  
Reviewed-by: Amit Langote, Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Doc: Improve description around ALTER TABLE ATTACH PARTITION

commit   : ea881338014fd5c7d864d78d2eb441d784d1cc39    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 Nov 2019 10:17:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 Nov 2019 10:17:33 +0900    

Click here for diff

This clarifies more how to use and how to take advantage of constraints  
when attaching a new partition.  
  
Author: Justin Pryzby  
Reviewed-by: Amit Langote, Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

Refactor code building relation options

commit   : 3534fa2233285c1fab1e668871aabf05e5541213    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 Nov 2019 09:17:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 Nov 2019 09:17:05 +0900    

Click here for diff

Historically, the code to build relation options has been shaped the  
same way in multiple code paths by using a set of datums in input with  
the options parsed with a static table which is then filled with the  
option values.  This introduces a new common routine in reloptions.c to  
do most of the legwork for the in-core code paths.  
  
Author: Amit Langote  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CA+HiwqGsoSn_uTPPYT19WrtR7oYpYtv4CdS0xuedTKiHHWuk_g@mail.gmail.com  

M contrib/bloom/blutils.c
M src/backend/access/brin/brin.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gistutil.c
M src/include/access/reloptions.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Stabilize pg_dump output order for similarly-named triggers and policies.

commit   : 5102f39440f758ea53c2e1cdea7d8411df1805d2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Nov 2019 16:25:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Nov 2019 16:25:05 -0500    

Click here for diff

The code only compared two triggers' names and namespaces (the latter  
being the owning table's schema).  This could result in falling back  
to an OID-based sort of similarly-named triggers on different tables.  
We prefer to avoid that, so add a comparison of the table names too.  
(The sort order is thus table namespace, trigger name, table name,  
which is a bit odd, but it doesn't seem worth contorting the code  
to work around that.)  
  
Likewise for policy objects, in 9.5 and up.  
  
Complaint and fix by Benjie Gillam.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CAMThMzEEt2mvBbPgCaZ1Ap1N-moGn=Edxmadddjq89WG4NpPtQ@mail.gmail.com  

M src/bin/pg_dump/pg_dump_sort.c

Fix ginEntryInsert's counting of GIN leaf tuples.

commit   : ec28808ba85853fa14b090199236ca555273607e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Nov 2019 14:16:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Nov 2019 14:16:42 -0500    

Click here for diff

As the code stands, nEntries counts the number of ginEntryInsert()  
calls, so that's what you end up with at the end of a GIN index build.  
However, ginvacuumcleanup() recomputes nEntries as the number of  
surviving leaf tuples, and that's generally consistent with the way that  
gincostestimate() uses the value.  So let's clearly define nEntries  
as the number of leaf tuples, and therefore adjust ginEntryInsert() to  
increment it only when we make a new one, not when we add TIDs into an  
existing tuple or posting tree.  
  
In practice this inconsistency probably has little impact, so I don't  
feel a need to back-patch.  
  
Insung Moon and Keisuke Kuroda  
  
Discussion: https://postgr.es/m/CAEMmqBuH_O-oXL+3_ArQ6F5cJ7kXVow2SGQB3HRacku_T+xkmA@mail.gmail.com  

M src/backend/access/gin/gininsert.c

Fix some compiler warnings on older compilers

commit   : a63c84e59acf9f5e2b54aad4974a80e5075af646    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Nov 2019 11:07:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Nov 2019 11:07:32 +0100    

Click here for diff

Some older compilers appear to not understand the recently introduced  
PG_FINALLY code structure that well in some circumstances and complain  
about possibly uninitialized variables.  So to fix, initialize the  
variables explicitly in the cases complained about.  
  
Discussion: https://www.postgresql.org/message-id/flat/95a822c3-728b-af0e-d7e5-71890507ae0c%402ndquadrant.com  

M src/backend/utils/adt/xml.c
M src/pl/plperl/plperl.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c

Catch invalid typlens in a couple of places

commit   : 8557a6f10ca6f01f4b2f2f25e197292f3f46bb5c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Nov 2019 08:30:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Nov 2019 08:30:00 +0100    

Click here for diff

Rearrange the logic in record_image_cmp() and datum_image_eq() to  
error out on unexpected typlens (either not supported there or  
completely invalid due to corruption).  Barring corruption, this is  
not possible today but it seems more future-proof and robust to fix  
this.  
  
Reported-by: Peter Geoghegan <[email protected]>  

M src/backend/utils/adt/datum.c
M src/backend/utils/adt/rowtypes.c

Suppress warning from older compilers.

commit   : db27b60f07a039e236738fe90bd4215cafd35cf2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Nov 2019 16:10:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Nov 2019 16:10:23 -0500    

Click here for diff

Commit 8af1624e3 introduced a warning about possibly returning  
without a value, on compilers that don't realize that ereport(ERROR)  
doesn't return.  Tweak the code to avoid that.  
  
Per buildfarm.  Back-patch to 9.6, like the aforesaid commit.  

M src/backend/tsearch/spell.c

Fix PG_GETARG_SEG_P() definition.

commit   : 741b1aaf61a3da10250555f827c0a7a2f9bc2822    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Nov 2019 10:57:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Nov 2019 10:57:49 -0500    

Click here for diff

DatumGetPointer() takes a Datum argument, not a pointer.  
This is cosmetic given the current definitions of the  
underlying macros, but it's still formally a type violation.  
  
Bug was introduced in commit 389bb2818, but there seems  
no need to back-patch.  
  
Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/seg/seg.c

Validate ispell dictionaries more carefully.

commit   : 8af1624e3f0efd2d029217a91d07bd3795f080a6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Nov 2019 16:45:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Nov 2019 16:45:32 -0400    

Click here for diff

Using incorrect, or just mismatched, dictionary and affix files  
could result in a crash, due to failure to cross-check offsets  
obtained from the file.  Add necessary validation, as well as  
some Asserts for future-proofing.  
  
Per bug #16050 from Alexander Lakhin.  Back-patch to 9.6 where the  
problem was introduced.  
  
Arthur Zakirov, per initial investigation by Tomas Vondra  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/20191013012610.2p2fp3zzpoav7jzf@development  

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

Fix failure when creating cloned indexes for a partition

commit   : dc816e5815913e2b2ae2327a4d3e4d4416ed6898    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 2 Nov 2019 14:16:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 2 Nov 2019 14:16:04 +0900    

Click here for diff

When using CREATE TABLE for a new partition, the partitioned indexes of  
the parent are created automatically in a fashion similar to LIKE  
INDEXES.  The new partition and its parent use a mapping for attribute  
numbers for this operation, and while the mapping was correctly built,  
its length was defined as the number of attributes of the newly-created  
child, and not the parent.  If the parent includes dropped columns, this  
could cause failures.  
  
This is wrong since 8b08f7d which has introduced the concept of  
partitioned indexes, so backpatch down to 11.  
  
Reported-by: Wyatt Alt  
Author: Michael Paquier  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/CAGem3qCcRmhbs4jYMkenYNfP2kEusDXvTfw-q+eOhM0zTceG-g@mail.gmail.com  
Backpatch-through: 11  

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

Add some assertions in syncrep.c

commit   : e174f699c476a4cc01875211a5f43e57c3190a37    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Nov 2019 22:51:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Nov 2019 22:51:05 +0900    

Click here for diff

A couple of routines assume that the LWLock SyncRepLock needs to be  
taken, so add a couple of assertions to be sure of that.  Also, when  
waiting for a given LSN at transaction commit, the code implied that the  
syncrep queue cleanup happens while holding interrupts, but the code  
never checked after that.  
  
Author: Michael Paquier  
Reviewed-by: Fujii Masao, Kyotaro Horiguchi, Dongming Liu  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/syncrep.c

Fix race condition at backend exit when deleting element in syncrep queue

commit   : 20345197ff48c99a8a20dd3cd191d2aad5c7271c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Nov 2019 22:38:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Nov 2019 22:38:32 +0900    

Click here for diff

When a backend exits, it gets deleted from the syncrep queue if present.  
The queue was checked without SyncRepLock taken in exclusive mode, so it  
would have been possible for a backend to remove itself after a WAL  
sender already did the job.  Fix this issue based on a suggestion from  
Fujii Masao, by first checking the queue without the lock.  Then, if the  
backend is present in the queue, take the lock and perform an additional  
lookup check before doing the element deletion.  
  
Author: Dongming Liu  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M src/backend/replication/syncrep.c

Add some assertions to view reloption macros

commit   : 396773762425126a85243fc85a267d401496beb8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Nov 2019 13:16:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Nov 2019 13:16:21 +0100    

Click here for diff

In these macros, the rd_options pointer is cast to ViewOption *.  Add  
some assertions that the passed-in relation is actually a view before  
doing that.  
  
Author: Nikolay Shaplov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/3634983.eHpMQ1mJnI@x200m  

M src/include/utils/rel.h

PG_FINALLY

commit   : 604bd3671121b51f977de146ed95484c2297fb3e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Nov 2019 11:09:52 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Nov 2019 11:09:52 +0100    

Click here for diff

This gives an alternative way of catching exceptions, for the common  
case where the cleanup code is the same in the error and non-error  
cases.  So instead of  
  
    PG_TRY();  
    {  
        ... code that might throw ereport(ERROR) ...  
    }  
    PG_CATCH();  
    {  
        cleanup();  
	PG_RE_THROW();  
    }  
    PG_END_TRY();  
    cleanup();  
  
one can write  
  
    PG_TRY();  
    {  
        ... code that might throw ereport(ERROR) ...  
    }  
    PG_FINALLY();  
    {  
        cleanup();  
    }  
    PG_END_TRY();  
  
Discussion: https://www.postgresql.org/message-id/flat/95a822c3-728b-af0e-d7e5-71890507ae0c%402ndquadrant.com  

M contrib/auto_explain/auto_explain.c
M contrib/dblink/dblink.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/uavc.c
M src/backend/catalog/index.c
M src/backend/commands/async.c
M src/backend/commands/copy.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuum.c
M src/backend/libpq/be-fsstubs.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/xml.c
M src/include/utils/elog.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c

Add const qualifiers to internal range type APIs

commit   : 73025140885c889410b9bfc4a30a3866396fc5db    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Oct 2019 07:41:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Oct 2019 07:41:41 +0100    

Click here for diff

Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/dc9b45fa-b950-fadc-4751-85d6f729df55%402ndquadrant.com  

M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/include/utils/rangetypes.h

Fix typo in comment of syncrep.c

commit   : f921ea624eb8695c6ccaaf3410b9f9d9926d71c7    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 31 Oct 2019 10:22:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 31 Oct 2019 10:22:24 +0900    

Click here for diff

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

M src/backend/replication/syncrep.c

Remove one use of IDENT_USERNAME_MAX

commit   : c5e1df951d9d70ab7d53ce47caaf73f3b2d6b1e1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Oct 2019 11:01:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Oct 2019 11:01:44 +0100    

Click here for diff

IDENT_USERNAME_MAX is the maximum length of the information returned  
by an ident server, per RFC 1413.  Using it as the buffer size in peer  
authentication is inappropriate.  It was done here because of the  
historical relationship between peer and ident authentication.  To  
reduce confusion between the two authenticaton methods and disentangle  
their code, use a dynamically allocated buffer instead.  
  
Discussion: https://www.postgresql.org/message-id/flat/c798fba5-8b71-4f27-c78e-37714037ea31%402ndquadrant.com  

M src/backend/libpq/auth.c

Update code comments about peer authenticaton

commit   : 5cc1e64fb6f59aa8621caae03be36400807e3575    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Oct 2019 09:13:39 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Oct 2019 09:13:39 +0100    

Click here for diff

For historical reasons, the functions for peer authentication were  
grouped under ident authentication.  But they are really completely  
separate, so give them their own section headings.  

M src/backend/libpq/auth.c

pg_waldump: Fix --bkp-details to not issue spurious newlines for FPWs.

commit   : e4d92126fda1defd9be201b97b162d1568122064    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 29 Oct 2019 22:46:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 29 Oct 2019 22:46:40 -0700    

Click here for diff

The additional newline seems to have accidentally been introduced in  
2c03216d831, in 9.5. The newline is only issued when an FPW is  
present for the block reference.  
  
While there could be an argument that removing the newlines in the  
back branches could cause a problem for somebody parsing the  
pg_waldump output, the likelihood of that seems small enough. It seems  
at least equally likely that the randomness of when newlines are  
issued causes problems.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5, like 2c03216d831.  

M src/bin/pg_waldump/pg_waldump.c

pg_waldump: Fix small memory leak when rmgr->rm_identify returns NULL.

commit   : e0f76f204ccb870fc207546eaeae65abeacb7dad    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 29 Oct 2019 19:18:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 29 Oct 2019 19:18:07 -0700    

Click here for diff

This got broken in 604f7956b94, shortly after rm_identify's  
introduction.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5, where rm_identify was introduced  

M src/bin/pg_waldump/pg_waldump.c

Fix typos in the code

commit   : 6ca86bb7e9c72f428c7f4e3f2b48dd6c4084429c    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Oct 2019 10:03:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Oct 2019 10:03:00 +0900    

Click here for diff

Author: Vignesh C  
Reviewed-by: Dilip Kumar, Michael Paquier  
Discussion: https://postgr.es/m/CALDaNm0ni+GAOe4+fbXiOxNrVudajMYmhJFtXGX-zBPoN8ixhw@mail.gmail.com  

M contrib/pg_trgm/trgm_op.c
M contrib/pgcrypto/pgp-info.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/schema.c
M src/backend/access/common/detoast.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/replication/walreceiver.c
M src/backend/statistics/mcv.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/mmgr/freepage.c
M src/bin/pg_upgrade/parallel.c
M src/bin/psql/tab-complete.c
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/pgtypeslib/interval.c

Fix compiler warnings in ecpg tests

commit   : 517bf2d9107f0d45c5fea2e3904e8d3b10ce6bb2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Oct 2019 09:14:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Oct 2019 09:14:43 +0100    

Click here for diff

Under MinGW, when compiling the ecpg test files, you get compiler  
warnings about the use of %lld in printf().  
  
These files don't use our printf replacement or the c.h porting layer,  
so determine the appropriate format conversion the hard way.  
  
Reviewed-by: Michael Meskes <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/760c9dd1-2d80-c223-3f90-609b615f7918%402ndquadrant.com  

M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.stderr
M src/interfaces/ecpg/test/sql/sqlda.pgc

Fix handling of pg_class.relispartition at swap phase in REINDEX CONCURRENTLY

commit   : d80be6f2f6c9793b92fc87c61d9ae2bcea3db560    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Oct 2019 11:08:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Oct 2019 11:08:09 +0900    

Click here for diff

When cancelling REINDEX CONCURRENTLY after swapping the old and new  
indexes (for example interruption at step 5), the old index remains  
around and is marked as invalid.  The old index should also be manually  
droppable to clean up the parent relation from any invalid indexes still  
remaining.  For a partition index reindexed, pg_class.relispartition was  
not getting updated, causing the index to not be droppable as DROP INDEX  
would look for dependencies in a partition tree, which do not exist  
anymore after the swap phase is done.  
  
The fix here is simple: when swapping the old and new indexes, make sure  
that pg_class.relispartition is correctly switched, similarly to what is  
done for the index name.  
  
Reported-by: Justin Pryzby  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/catalog/index.c

Allow extracting fields from a ROW() expression in more cases.

commit   : 8b7a0f1d118282f612e5b9686d820edcddedd081    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Oct 2019 15:08:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Oct 2019 15:08:24 -0400    

Click here for diff

Teach get_expr_result_type() to manufacture a tuple descriptor directly  
from a RowExpr node.  If the RowExpr has type RECORD, this is the only  
way to get a tupdesc for its result, since even if the rowtype has been  
blessed, we don't have its typmod available at this point.  (If the  
RowExpr has some named composite type, we continue to let the existing  
code handle it, since the RowExpr might well not have the correct column  
names embedded in it.)  
  
This fixes assorted corner cases illustrated by the added regression  
tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/fmgr/funcapi.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

On Windows, use COMSPEC to find the location of cmd.exe.

commit   : f88544904e4b57b1a8e969a5d594288554417c88    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Oct 2019 14:15:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Oct 2019 14:15:03 -0400    

Click here for diff

Historically, psql consulted COMSPEC to spawn a shell in its \! command,  
but we just invoked "cmd" when spawning shells in pg_ctl and pg_regress.  
It seems better to rely on the environment variable, if it's set,  
in all cases.  
  
It's debatable whether this is a bug fix or just a behavioral change,  
so no back-patch.  
  
Juan José Santamaría Flecha  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c
M src/test/regress/pg_regress.c

Handle empty-string edge cases correctly in strpos().

commit   : bd1ef5799b04168d8a869197dd9b85935d5d5da9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Oct 2019 12:21:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Oct 2019 12:21:13 -0400    

Click here for diff

Commit 9556aa01c rearranged the innards of text_position() in a way  
that would make it not work for empty search strings.  Which is fine,  
because all callers of that code special-case an empty pattern in  
some way.  However, the primary use-case (text_position itself) got  
special-cased incorrectly: historically it's returned 1 not 0 for  
an empty search string.  Restore the historical behavior.  
  
Per complaint from Austin Drenski (via Shay Rojansky).  
Back-patch to v12 where it got broken.  
  
Discussion: https://postgr.es/m/CADT4RqAz7oN4vkPir86Kg1_mQBmBxCp-L_=9vRpgSNPJf0KRkw@mail.gmail.com  

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

Doc: Add missing step for pg_stat_progress_cluster

commit   : 61ecea45e50bcd3b87d4e905719e63e41d6321ce    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Oct 2019 14:23:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Oct 2019 14:23:42 +0900    

Click here for diff

There is a step to track when the new heap is written, but this was  
missing in the documentation.  
  
Author: Noriyoshi Shinoda  
Discussion: https://postgr.es/m/AT5PR8401MB06447FAE88E1592754E958B8EE640@AT5PR8401MB0644.NAMPRD84.PROD.OUTLOOK.COM  
Backpatch-through: 12  

M doc/src/sgml/monitoring.sgml

Fix dependency handling at swap phase of REINDEX CONCURRENTLY

commit   : 68ac9cf2499236996f3d4bf31f7f16d5bd3c77af    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Oct 2019 11:57:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Oct 2019 11:57:31 +0900    

Click here for diff

When swapping the dependencies of the old and new indexes, the code has  
been correctly switching all links in pg_depend from the old to the new  
index for both referencing and referenced entries.  However it forgot  
the fact that the new index may itself have existing entries in  
pg_depend, like references to the parent table attributes.  This  
resulted in duplicated entries in pg_depend after running REINDEX  
CONCURRENTLY.  
  
Fix this problem by removing any existing entries in pg_depend on the  
new index before switching the dependencies of the old index to the new  
one.  More regression tests are added to check the consistency of  
entries in pg_depend for indexes, including partition indexes.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/catalog/index.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix initialization of fake LSN for unlogged relations

commit   : 51970fa8df9b32b5501ca1cb9d5b805894c1e064    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 27 Oct 2019 13:54:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 27 Oct 2019 13:54:12 +0900    

Click here for diff

9155580 has changed the value of the first fake LSN for unlogged  
relations from 1 to FirstNormalUnloggedLSN (aka 1000), GiST requiring a  
non-zero LSN on some pages to allow an interlocking logic to work, but  
its value was still initialized to 1 at the beginning of recovery or  
after running pg_resetwal.  This fixes the initialization for both code  
paths.  
  
Author: Takayuki Tsunakawa  
Reviewed-by: Dilip Kumar, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/OSBPR01MB2503CE851940C17DE44AE3D9FE6F0@OSBPR01MB2503.jpnprd01.prod.outlook.com  
Backpatch-through: 12  

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

Fix copy-paste defect in comment.

commit   : b804521344fb366215900ac3f01314a1710bc6d8    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 26 Oct 2019 12:55:16 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 26 Oct 2019 12:55:16 -0700    

Click here for diff

Commit a7471bd85c05f849e88d6cfe9da3c795008e8f2e introduced it.  

M src/include/c.h

Update comment about __sync_lock_test_and_set() bug.

commit   : e653c714c25bb8bde0b80b3bf3a220704b71a106    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 26 Oct 2019 12:55:06 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 26 Oct 2019 12:55:06 -0700    

Click here for diff

State the earliest known fixed version, so we can someday judge the  
workaround to be obsolete.  

M src/include/port/atomics.h

Doc: improve documentation of configuration settings that have units.

commit   : cfb7559083436b802e7ecc5e3fa235057890265c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Oct 2019 12:30:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Oct 2019 12:30:41 -0400    

Click here for diff

When we added the GUC units feature, we didn't make any great effort  
to adjust the documentation of individual GUCs; they tended to still  
say things like "this is the number of milliseconds that ...", even  
though users might prefer to write some other units, and SHOW might  
even show the value in other units.  Commit 6c9fb69f2 made an effort  
to improve this situation, but I thought it made things less readable  
by injecting units information in mid-sentence.  It also wasn't very  
consistent, and did not touch all the GUCs that have units.  
  
To improve matters, standardize on the phrasing "If this value is  
specified without units, it is taken as <units>".  Also, try to  
standardize where this is mentioned, right before the specification  
of the default.  (In a couple of places, doing that would've required  
more rewriting than seemed justified, so I wasn't 100% consistent  
about that.)  I also tried to use the phrases "amount of time",  
"amount of memory", etc rather than describing the contents of GUCs  
in other ways, as those were the majority usage in places that weren't  
overcommitting to a particular unit.  (I left "length of time" alone  
in a couple of places, though.)  
  
I failed to resist the temptation to copy-edit some awkward text, too.  
  
Backpatch to v12, like 6c9fb69f2, mainly because v12 hasn't diverged  
much from HEAD yet.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Remove obsolete information schema tables

commit   : 2fc2a88e6722df40245d3ae2ec7f8fc1c6bf0596    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Oct 2019 21:11:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Oct 2019 21:11:48 +0200    

Click here for diff

Remove SQL_LANGUAGES, which was eliminated in SQL:2008, and  
SQL_PACKAGES and SQL_SIZING_PROFILES, which were eliminated in  
SQL:2011.  Since they were dropped by the SQL standard, the  
information in them was no longer updated and therefore no longer  
useful.  
  
This also removes the feature-package association information in  
sql_feature_packages.txt, but for the time begin we are keeping the  
information which features are in the Core package (that is, mandatory  
SQL features).  Maybe at some point someone wants to invent a way to  
store that that does not involve using the "package" mechanism  
anymore.  
  
Discussion https://www.postgresql.org/message-id/flat/91334220-7900-071b-9327-0c6ecd012017%402ndquadrant.com  

M doc/src/sgml/features.sgml
M doc/src/sgml/information_schema.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/sql_feature_packages.txt
M src/backend/catalog/sql_features.txt
M src/include/catalog/catversion.h
M src/test/regress/expected/sanity_check.out

Avoid failure when selecting a namespace node in XMLTABLE.

commit   : 592a16321bd760d21220d0b2648bf151065816a5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 15:22:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 15:22:40 -0400    

Click here for diff

It appears that libxml2 doesn't bother to set the "children" field of  
an XML_NAMESPACE_DECL node to null; that field just contains garbage.  
In v10 and v11, this can result in a crash in XMLTABLE().  The rewrite  
done in commit 251cf2e27 fixed this, somewhat accidentally, in v12.  
We're not going to back-patch 251cf2e27, however.  The case apparently  
doesn't have wide use, so rather than risk introducing other problems,  
just add a safety check to throw an error.  
  
Even though no bug manifests in v12/HEAD, add the relevant test case  
there too, to prevent future regressions.  
  
Chapman Flack (per private report)  

M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

doc: Use proper em and en dashes

commit   : cbe63d02d0f7d85ecbae7d8998f5edfe56d50b9d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Oct 2019 20:23:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Oct 2019 20:23:44 +0200    

Click here for diff

M doc/src/sgml/biblio.sgml
M doc/src/sgml/bki.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/datetime.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/history.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/legal.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/textsearch.sgml

Revert "Revert part of commit dddf4cdc3."

commit   : ee201520707596b058e6bbfab0a5e2006f3834c5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 12:18:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 12:18:11 -0400    

Click here for diff

This reverts commit c114229ca2519620703a4be4e38181290cad8c0a.  
Commit 1408d5d869925c8ea7ca01c2644e8903fbab23de should make it  
safe to include these headers in the natural order.  

M src/interfaces/ecpg/pgtypeslib/dt_common.c

Get rid of useless/dangerous redefinition of bool in ECPG.

commit   : 1408d5d869925c8ea7ca01c2644e8903fbab23de    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 12:17:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 12:17:41 -0400    

Click here for diff

pgtypeslib_extern.h contained fallback definitions of "bool", "FALSE",  
and "TRUE".  The latter two are just plain unused, and have been for  
awhile.  The former came into play only if there wasn't a macro  
definition of "bool", which is true only if we aren't using <stdbool.h>.  
However, it then defined bool as "char"; since commit d26a810eb that  
conflicts with c.h's desire to use "unsigned char".  We'd missed seeing  
any bad effects of that due to accidental header inclusion order choices,  
but dddf4cdc3 exposed that it was problematic.  
  
To fix, let's just get rid of these definitions.  They should not be  
needed because everyplace in Postgres should be relying on c.h to  
provide a definition for type bool.  (Note that despite its name,  
pgtypeslib_extern.h isn't exposed to any outside code; we don't  
install it.)  
  
This doesn't fully resolve the issue, because ecpglib.h is doing  
similar things, but that seems to require more thought to fix.  
  
Back-patch to v12 where d26a810eb came in, to forestall any unpleasant  
surprises from future back-patched bug fixes.  
  
Discussion: https://postgr.es/m/CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com  

M src/interfaces/ecpg/pgtypeslib/pgtypeslib_extern.h

Improve management of statement timeouts.

commit   : 22f6f2c1ccb56e0d6a159d4562418587e4b10e01    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 11:41:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 11:41:16 -0400    

Click here for diff

Commit f8e5f156b added private state in postgres.c to track whether  
a statement timeout is running.  This seems like bad design to me;  
timeout.c's private state should be the single source of truth about  
that.  We already fixed one bug associated with failure to keep those  
states in sync (cf. be42015fc), and I've got little faith that we  
won't find more in future.  So get rid of postgres.c's local variable  
by exposing a way to ask timeout.c whether a timeout is running.  
(Obviously, such an inquiry is subject to race conditions, but it  
seems fine for the purpose at hand.)  
  
To make get_timeout_active() as cheap as possible, add a flag in  
the per-timeout struct showing whether that timeout is active.  
This allows some small savings elsewhere in timeout.c, mainly  
elimination of unnecessary searches of the active_timeouts array.  
  
While at it, fix enable_statement_timeout to not call disable_timeout  
when statement_timeout is 0 and the timeout is not running.  This  
avoids a useless deschedule-and-reschedule-timeouts cycle, which  
represents a significant savings (at least one kernel call) when  
there is any other active timeout.  Right now, there usually isn't,  
but there are proposals around to change that.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c
M src/backend/utils/misc/timeout.c
M src/include/utils/timeout.h

Reset statement_timeout between queries of a multi-query string.

commit   : 2b2bacdca0100f50ba4f79cda53514b6e5114e8f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 11:15:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Oct 2019 11:15:50 -0400    

Click here for diff

Historically, we started the timer (if StatementTimeout > 0) at the  
beginning of a simple-Query message and usually let it run until the  
end, so that the timeout limit applied to the entire query string,  
and intra-string changes of the statement_timeout GUC had no effect.  
But, confusingly, a COMMIT within the string would reset the state  
and allow a fresh timeout cycle to start with the current setting.  
  
Commit f8e5f156b changed the behavior of statement_timeout for extended  
query protocol, and as an apparently-unintended side effect, a change in  
the statement_timeout GUC during a multi-statement simple-Query message  
might have an effect immediately --- but only if it was going from  
"disabled" to "enabled".  
  
This is all pretty confusing, not to mention completely undocumented.  
Let's change things so that the timeout is always reset between queries  
of a multi-query string, whether they're transaction control commands  
or not.  Thus the active timeout setting is applied to each query in  
the string, separately.  This costs a few more cycles if statement_timeout  
is active, but it provides much more intuitive behavior, especially if one  
changes statement_timeout in one of the queries of the string.  
  
Also, add something to the documentation to explain all this.  
  
Per bug #16035 from Raj Mohite.  Although this is a bug fix, I'm hesitant  
to back-patch it; conceivably somebody has worked out the old behavior  
and is depending on it.  (But note that this change should make the  
behavior less restrictive in most cases, since the timeout will now  
be applied to shorter segments of code.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/tcop/postgres.c

Revert part of commit dddf4cdc3.

commit   : c114229ca2519620703a4be4e38181290cad8c0a    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 25 Oct 2019 10:04:20 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 25 Oct 2019 10:04:20 +0530    

Click here for diff

The commit dddf4cdc3 tries to ensure that the Postgres header file  
inclusions are in order based on their ASCII value.  However, in one of  
the case there is a header file dependency due to which we can't maintain  
such order.  
  
Author: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/pgtypeslib/dt_common.c

Make the order of the header file includes consistent in non-backend modules.

commit   : dddf4cdc3300073ec04b2c3e482a4c1fa4b8191b    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 23 Oct 2019 09:38:53 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 23 Oct 2019 09:38:53 +0530    

Click here for diff

Similar to commit 7e735035f2, this commit makes the order of header file  
inclusion consistent for non-backend modules.  
  
In passing, fix the case where we were using angle brackets (<>) for the  
local module includes instead of quotes ("").  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com  

M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/common.c
M src/bin/psql/copy.c
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/bin/psql/input.c
M src/bin/psql/large_obj.c
M src/bin/psql/mainloop.c
M src/bin/psql/prompt.c
M src/bin/psql/startup.c
M src/bin/psql/variables.c
M src/common/f2s.c
M src/fe_utils/print.c
M src/fe_utils/recovery_gen.c
M src/fe_utils/string_utils.c
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/memory.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/ecpglib/sqlda.c
M src/interfaces/ecpg/ecpglib/typename.c
M src/interfaces/ecpg/pgtypeslib/common.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/c_keywords.c
M src/interfaces/ecpg/preproc/ecpg_keywords.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_handler.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_sse42.c
M src/port/tar.c
M src/test/isolation/isolationtester.c
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_shm_mq/setup.c
M src/test/regress/pg_regress.c
M src/test/regress/regress.c

Handle interrupts within a transaction context in REINDEX CONCURRENTLY

commit   : 8270a0d9a948944871dd35d9ff0d5c0d8d78623f    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Oct 2019 10:20:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Oct 2019 10:20:08 +0900    

Click here for diff

Phases 2 (building the new index) and 3 (validating the new index)  
checked for interrupts outside a transaction context, having as  
consequence to not release session-level locks taken on the parent  
relation and the old and new indexes processed.  This could for example  
be triggered with statement_timeout and a bad timing, and would issue  
confusing error messages when shutting down the session still holding  
the locks (note that an assertion failure would be triggered first), on  
top of more issues with concurrent sessions trying to take a lock that  
would interfere with the SHARE UPDATE EXCLUSIVE locks hold here.  
  
This moves all the interruption checks inside a transaction context.  
Note that I have manually tested all interruptions to make sure that  
invalid indexes can be cleaned up properly.  Partition indexes still  
have issues on their own with some missing dependency handling, which  
will be dealt with in a follow-up patch.  
  
Reported-by: Justin Pryzby  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/commands/indexcmds.c

Fix typo in xlog.c.

commit   : 3b0c59ac1c7d480821ed009b998dd6be7d2d851c    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 24 Oct 2019 14:13:36 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 24 Oct 2019 14:13:36 +0900    

Click here for diff

Author: Fujii Masao  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAHGQGwH7dtYvOZZ8c0AG5AJwH5pfiRdKaCptY1_RdHy0HYeRfQ@mail.gmail.com  

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

Make the order of the header file includes consistent in contrib modules.

commit   : 7e735035f208418f31b91846ae3e8a381edb3af3    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 23 Oct 2019 09:26:22 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 23 Oct 2019 09:26:22 +0530    

Click here for diff

The basic rule we follow here is to always first include 'postgres.h' or  
'postgres_fe.h' whichever is applicable, then system header includes and  
then Postgres header includes.  In this, we also follow that all the  
Postgres header includes are in order based on their ASCII value.  We  
generally follow these rules, but the code has deviated in many places.  
This commit makes it consistent just for contrib modules.  The later  
commits will enforce similar rules in other parts of code.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com  

M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvalidate.c
M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_utils_var.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/intarray/_int_bool.c
M contrib/intarray/_int_gin.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_op.c
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/_int_tool.c
M contrib/intarray/_intbig_gist.c
M contrib/isn/isn.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/crc32.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree_io.c
M contrib/ltree/ltree_op.c
M contrib/ltree_plpython/ltree_plpython.c
M contrib/oid2name/oid2name.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_standby/pg_standby.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_op.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgcrypto/crypt-md5.c
M contrib/pgcrypto/internal.c
M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/pgp-armor.c
M contrib/pgcrypto/pgp-cfb.c
M contrib/pgcrypto/pgp-compress.c
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp-encrypt.c
M contrib/pgcrypto/pgp-info.c
M contrib/pgcrypto/pgp-mpi-internal.c
M contrib/pgcrypto/pgp-mpi-openssl.c
M contrib/pgcrypto/pgp-mpi.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp-pubdec.c
M contrib/pgcrypto/pgp-pubenc.c
M contrib/pgcrypto/pgp-pubkey.c
M contrib/pgcrypto/pgp-s2k.c
M contrib/pgcrypto/pgp.c
M contrib/pgcrypto/px-crypt.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/shippable.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/uavc.c
M contrib/spi/moddatetime.c
M contrib/tablefunc/tablefunc.c
M contrib/tcn/tcn.c
M contrib/vacuumlo/vacuumlo.c

docs: fix wording of REFRESH CONCURRENTLY manual page

commit   : 59c2617af35f064e5d3ef39cfe94531f7459f3de    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 23 Oct 2019 20:29:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 23 Oct 2019 20:29:02 -0400    

Click here for diff

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

M doc/src/sgml/ref/refresh_materialized_view.sgml

pg_upgrade: adjust error output to use new database list format

commit   : 0c089d36e2bb07a8ccd575d456265e83b6697d00    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 23 Oct 2019 18:06:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 23 Oct 2019 18:06:38 -0400    

Click here for diff

Commit a524f50d0f added  
old_11_check_for_sql_identifier_data_type_usage(), but it did not use  
the clearer database error list format added to the master branch in  
commit 1634d36157.  This commit fixes that.  
  
Backpatch-through: master  

M src/bin/pg_upgrade/version.c

Acquire properly session-level lock on new index in REINDEX CONCURRENTLY

commit   : 5d3500da72611018f2280d6a31e58ccdb4b16152    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 23 Oct 2019 15:04:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 23 Oct 2019 15:04:48 +0900    

Click here for diff

In the first transaction run for REINDEX CONCURRENTLY, a thinko in the  
existing logic caused two session locks to be taken on the old index,  
causing the session lock on the newly-created index to be missed.  This  
made possible concurrent DDL commands (like ALTER INDEX) on the new  
index while REINDEX CONCURRENTLY was processing from the point where the  
first internal transaction committed.  
  
This issue has been discovered while digging into another bug.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/commands/indexcmds.c

Remove libpq-dist.rc

commit   : 508e84d79910cdb3b61fc410a245fd46e4fad30f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 23 Oct 2019 07:10:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 23 Oct 2019 07:10:09 +0200    

Click here for diff

The use of this was removed by  
6da56f3f84d430671d5edd8f9336bd744c089e31.  
  
Discussion: https://www.postgresql.org/message-id/87d95052-3780-b833-9953-27eab80186cf%402ndquadrant.com  

M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile

Remove last traces of --adduser/--no-adduser in createuser

commit   : 4fa5edcd1a45cb11bc52b612e12bb29ab39cb895    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 23 Oct 2019 12:27:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 23 Oct 2019 12:27:03 +0900    

Click here for diff

8ae0d47 marked those options as obsolete back in 2005, with the options  
removed from the documentation.  This removes the last references to  
both options in the code which were kept around for compatibility  
purposes with past commands.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/createuser.c

Fix thinkos from 4f4061b for libpq integer parsing

commit   : 57379cd5ac56e575630a5fee5777a1035d0a764a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 23 Oct 2019 11:34:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 23 Oct 2019 11:34:18 +0900    

Click here for diff

A check was redundant.  While on it, add an assertion to make sure that  
the parsing routine is never called with a NULL input.  All the code  
paths currently calling the parsing routine are careful with NULL inputs  
already, but future callers may forget that.  
  
Reported-by: Peter Eisentraut, Lars Kanis  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Clean up properly error_context_stack in autovacuum worker on exception

commit   : e3db3f829f605edc0675e5d308de97f444b53d4b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 23 Oct 2019 10:25:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 23 Oct 2019 10:25:06 +0900    

Click here for diff

Any callback set would have no meaning in the context of an exception.  
As an autovacuum worker exits quickly in this context, this could be  
only an issue within EmitErrorReport(), where the elog hook is for  
example called.  That's unlikely to going to be a problem, but let's be  
clean and consistent with other code paths handling exceptions.  This is  
present since 2909419, which introduced autovacuum.  
  
Author: Ashwin Agrawal  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CALfoeisM+_+dgmAdAOHAu0k-ZpEHHqSSG=GRf3pKJGm8OqWX0w@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/postmaster/autovacuum.c

Make command order in test more sensible

commit   : ad4b7aeb84434c958e2df76fa69b68493a889e4a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Oct 2019 10:35:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Oct 2019 10:35:54 +0200    

Click here for diff

Through several updates, the CREATE USER command has been separated  
from where the user is actually used in the test.  

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

Fix comment

commit   : f86f46d091a6876fbf28e0a4a87ca72b560cf77f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Oct 2019 09:58:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Oct 2019 09:58:20 +0200    

Click here for diff

The last argument of smgrextend() was renamed from isTemp to skipFsync  
in debcec7dc31a992703911a9953e299c8d730c778, but the comments at two  
call sites were not updated.  

M src/backend/access/heap/rewriteheap.c
M src/backend/catalog/storage.c

Refactor jsonpath's compareDatetime()

commit   : 52ad1e659967896ed153185328ffe806d69abcb6    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 21 Oct 2019 23:04:14 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 21 Oct 2019 23:04:14 +0300    

Click here for diff

This commit refactors come ridiculous coding in compareDatetime().  Also, it  
provides correct cross-datatype comparison even when one of values overflows  
during cast.  That eliminates dilemma on whether we should suppress overflow  
errors during cast.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/32308.1569455803%40sss.pgh.pa.us  
Discussion: https://postgr.es/m/a5629d0c-8162-7559-16aa-0c8390d6ba5f%40postgrespro.ru  
Author: Nikita Glukhov, Alexander Korotkov  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/date.h
M src/include/utils/timestamp.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql

Refactor timestamp2timestamptz_opt_error()

commit   : a6888fde7f0dbe865559b31ba2ce01ac1150debe    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 21 Oct 2019 23:03:55 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 21 Oct 2019 23:03:55 +0300    

Click here for diff

While casting from timestamp to timestamptz we do timestamp2tm() then  
tm2timestamp().  This commit eliminates call to tm2timestamp().  Instead, it  
directly applies timezone offset to the original timestamp value.  That makes  
upcoming datetime overflow handling in jsonpath easier.  That should also save  
us some CPU cycles.  
  
Discussion: https://postgr.es/m/CAPpHfdvRPRh_mTGar5WmDeRZ%3DU5dOXHdxspYYD%3D76m3knNGjXA%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Tom Lane  

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

commit   : db477b691dc4e80bc8379d976ef53a0aa0afe4c0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Oct 2019 14:18:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Oct 2019 14:18:01 -0400    

Click here for diff

It emerges that recent versions of Windows (at least 2016 Standard)  
spell this locale name as "Norwegian Bokmål_Norway.1252", defeating  
our mapping code that translates "Norwegian (Bokmål)_Norway" to  
something that's all-ASCII (cf commits db29620d4 and aa1d2fc5e).  
Add another mapping entry to handle this spelling.  
  
Per bug #16068 from Robert Ford.  Like the previous patches,  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/win32setlocale.c

Use CFLAGS_SL while probing linkability of libperl.

commit   : d995fd667f6d22307864afe18ae91950b23b5b53    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Oct 2019 13:52:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Oct 2019 13:52:25 -0400    

Click here for diff

On recent Red Hat platforms (at least RHEL 8 and Fedora 30, maybe older),  
configure's probe for libperl failed if the user forces CFLAGS to be -O0.  
This is because some code in perl's inline.h fails to be optimized away  
at -O0, and said code doesn't work if compiled without -fPIC.  
  
To fix, add CFLAGS_SL to the compile flags used during the libperl probe.  
This is a better simulation of the way that plperl is built, anyway,  
so it might forestall other issues in future.  
  
Per gripe from Kyotaro Horiguchi.  Back-patch to all supported branches,  
since people might want to build older branches on these platforms.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in

Select CFLAGS_SL at configure time, not in platform-specific Makefiles.

commit   : 44273ce4f664a1bb34ef8ea9359237344cd6aaec    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Oct 2019 12:32:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Oct 2019 12:32:35 -0400    

Click here for diff

Move the platform-dependent logic that sets CFLAGS_SL from  
src/makefiles/Makefile.foo to src/template/foo, so that the value  
is determined at configure time and thus is available while running  
configure's tests.  
  
On a couple of platforms this might save a few microseconds of build  
time by eliminating a test that make otherwise has to do over and over.  
Otherwise it's pretty much a wash for build purposes; in particular,  
this makes no difference to anyone who might be overriding CFLAGS_SL  
via a make option.  
  
This patch in itself does nothing with the value and thus should not  
change any behavior, though you'll probably have to re-run configure  
to get a correctly updated Makefile.global.  We'll use the new  
configure variable in a follow-on patch.  
  
Per gripe from Kyotaro Horiguchi.  Back-patch to all supported branches,  
because the follow-on patch is a portability bug fix.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/Makefile.global.in
M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.hpux
M src/makefiles/Makefile.linux
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd
M src/makefiles/Makefile.solaris
M src/makefiles/Makefile.win32
M src/template/aix
M src/template/cygwin
M src/template/darwin
M src/template/freebsd
M src/template/hpux
M src/template/linux
M src/template/netbsd
M src/template/openbsd
M src/template/solaris
M src/template/win32

Update obsolete comment.

commit   : 80831bcdbe80a6ca7f22105e32c2cbb54e125c4c    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 21 Oct 2019 17:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 21 Oct 2019 17:30:00 +0900    

Click here for diff

Commit b52b7dc25, which moved code creating PartitionBoundInfo in  
RelationBuildPartitionDesc() in partcache.c (relocated to partdesc.c  
afterwards) to partbounds.c, should have updated this, but didn't.  
  
Author: Etsuro Fujita  
Reviewed-by: Alvaro Herrera  
Backpatch-through: 12  
Discussion: https://postgr.es/m/CAPmGK16Uxr%3DPatiGyaRwiQVLB7Y-GqbkK3AxRLVYzU0Czv%3DsEw%40mail.gmail.com  

M src/backend/partitioning/partbounds.c

Fix memory leak introduced in commit 7df159a620.

commit   : 70a6c37d524cc2c29712424785be3d9e2e62f484    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 17 Oct 2019 08:45:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 17 Oct 2019 08:45:43 +0530    

Click here for diff

We memorize all internal and empty leaf pages in the 1st vacuum stage for  
gist indexes.  They are used in the 2nd stage, to delete all the empty  
pages.  There was a memory context page_set_context for this purpose, but  
we never used it.  
  
Reported-by: Amit Kapila  
Author: Dilip Kumar  
Reviewed-by: Amit Kapila  
Backpatch-through: 12, where it got introduced  
Discussion: https://postgr.es/m/CAA4eK1LGr+MN0xHZpJ2dfS8QNQ1a_aROKowZB+MPNep8FVtwAA@mail.gmail.com  

M src/backend/access/gist/gistvacuum.c

Fix error reporting of connect_timeout in libpq for value parsing

commit   : ba19a6b73c5bd771d8864171ede03503a9ff564e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 21 Oct 2019 11:39:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 21 Oct 2019 11:39:15 +0900    

Click here for diff

The logic was correctly detecting a parsing failure, but the parsing  
error did not get reported back to the client properly.  
  
Reported-by: Ed Morley  
Author: Lars Kanis  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Fix parsing of integer values for connection parameters in libpq

commit   : 4f4061b2dde178d2ab79d1ee3b1ae3c62c117926    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 21 Oct 2019 11:17:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 21 Oct 2019 11:17:13 +0900    

Click here for diff

Commit e7a2217 has introduced stricter checks for integer values in  
connection parameters for libpq.  However this failed to correctly check  
after trailing whitespaces, while leading whitespaces were discarded per  
the use of strtol(3).  This fixes and refactors the parsing logic to  
handle both cases consistently.  Note that trying to restrict the use of  
trailing whitespaces can easily break connection strings like in ECPG  
regression tests (these have allowed me to catch the parsing bug with  
connect_timeout).  
  
Author: Michael Paquier  
Reviewed-by: Lars Kanis  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Clean up MinGW def file generation

commit   : ea9e06ac66d3e9584950f52878c8e4b71f963610    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 20 Oct 2019 10:19:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 20 Oct 2019 10:19:13 +0200    

Click here for diff

There were some leftovers from ancient ad-hoc ways to build on  
Windows, prior to the standardization on MSVC and MinGW.  We don't  
need to build a lib$(NAME)ddll.def (debug build, as opposed to  
lib$(NAME)dll.def) for MinGW, since nothing uses that.  We also don't  
need to build the regular .def file during distprep, since the MinGW  
build environment is perfectly capable of creating that normally at  
build time.  
  
Discussion: https://www.postgresql.org/message-id/flat/0f9db9f8-47b8-a48b-6ccc-15b22b412316%402ndquadrant.com  

M src/Makefile.shlib
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/Makefile

Fix most -Wundef warnings

commit   : 5d3587d14b753cb25b0ebcd549d95e1b6ceebce4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 19 Oct 2019 18:21:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 19 Oct 2019 18:21:58 +0200    

Click here for diff

In some cases #if was used instead of #ifdef in an inconsistent style.  
Cleaning this up also helps when analyzing cases like  
38d8dce61fff09daae0edb6bcdd42b0c7f10ebcd where this makes a  
difference.  
  
There are no behavior changes here, but the change in pg_bswap.h would  
prevent possible accidental misuse by third-party code.  
  
Discussion: https://www.postgresql.org/message-id/flat/3b615ca5-c595-3f1d-fdf7-a429e564f614%402ndquadrant.com  

M contrib/hstore/hstore_compat.c
M contrib/pg_standby/pg_standby.c
M contrib/pgcrypto/imath.c
M src/backend/libpq/be-fsstubs.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/file/fd.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/mmgr/freepage.c
M src/include/port/pg_bswap.h
M src/port/snprintf.c
M src/port/win32error.c

Use standard compare_exchange loop style in ProcArrayGroupClearXid().

commit   : 48cc59ed24f95fa171b12ba1b461e6dc72d62b2b    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 18 Oct 2019 20:21:10 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 18 Oct 2019 20:21:10 -0700    

Click here for diff

Besides style, this might improve performance in the contended case.  
  
Reviewed by Amit Kapila.  
  
Discussion: https://postgr.es/m/[email protected]  

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

For all ppc compilers, implement compare_exchange and fetch_add with asm.

commit   : 30ee5d17c20dbb282a9952b3048d6ad52d56c371    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 18 Oct 2019 20:20:52 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 18 Oct 2019 20:20:52 -0700    

Click here for diff

This is more like how we handle s_lock.h and arch-x86.h.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/port/atomics.h
M src/include/port/atomics/arch-ppc.h
D src/include/port/atomics/generic-xlc.h
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

For PowerPC instruction "addi", use constraint "b".

commit   : 89b4d7744c80ecb3f6bdf8a07ca711a043718db3    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 18 Oct 2019 20:20:28 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 18 Oct 2019 20:20:28 -0700    

Click here for diff

Without "b", a variant of the tas() code miscompiles on macOS 10.4.  
This may also fix a compilation failure involving macOS 10.1.  Today's  
compilers have been allocating acceptable registers with or without this  
change, but this future-proofs the code by precisely conveying the  
acceptable registers.  Back-patch to 9.4 (all supported versions).  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/s_lock.h

Remove last traces of heap_open/close in the tree

commit   : f25968c49697db673f6cd2a07b3f7626779f1827    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 19 Oct 2019 11:18:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 19 Oct 2019 11:18:15 +0900    

Click here for diff

Since pluggable storage has been introduced, those two routines have  
been replaced by table_open/close, with some compatibility macros still  
present to allow extensions to compile correctly with v12.  
  
Some code paths using the old routines still remained, so replace them.  
Based on the discussion done, the consensus reached is that it is better  
to remove those compatibility macros so as nothing new uses the old  
routines, so remove also the compatibility macros.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/statscmds.c
M src/backend/optimizer/util/plancat.c
M src/include/access/table.h

Fix failure of archive recovery with recovery_min_apply_delay enabled.

commit   : ec1259e880dd0738a0b111e47d1b7153d3da20fd    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 18 Oct 2019 22:32:18 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 18 Oct 2019 22:32:18 +0900    

Click here for diff

recovery_min_apply_delay parameter is intended for use with streaming  
replication deployments. However, the document clearly explains that  
the parameter will be honored in all cases if it's specified. So it should  
take effect even if in archive recovery. But, previously, archive recovery  
with recovery_min_apply_delay enabled always failed, and caused assertion  
failure if --enable-caasert is enabled.  
  
The cause of this problem is that; the ownership of recoveryWakeupLatch  
that recovery_min_apply_delay uses was taken only when standby mode  
is requested. So unowned latch could be used in archive recovery, and  
which caused the failure.  
  
This commit changes recovery code so that the ownership of  
recoveryWakeupLatch is taken even in archive recovery. Which prevents  
archive recovery with recovery_min_apply_delay from failing.  
  
Back-patch to v9.4 where recovery_min_apply_delay was added.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwEyD6HdZLfdWc+95g=VQFPR4zQL4n+yHxQgGEGjaSVheQ@mail.gmail.com  

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

Make crash recovery ignore recovery_min_apply_delay setting.

commit   : 9b95a36be8be6c3a78b303bbe709c622dc312e87    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 18 Oct 2019 22:24:18 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 18 Oct 2019 22:24:18 +0900    

Click here for diff

In v11 or before, this setting could not take effect in crash recovery  
because it's specified in recovery.conf and crash recovery always  
starts without recovery.conf. But commit 2dedf4d9a8 integrated  
recovery.conf into postgresql.conf and which unexpectedly allowed  
this setting to take effect even in crash recovery. This is definitely  
not good behavior.  
  
To fix the issue, this commit makes crash recovery always ignore  
recovery_min_apply_delay setting.  
  
Back-patch to v12 where the issue was added.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwEyD6HdZLfdWc+95g=VQFPR4zQL4n+yHxQgGEGjaSVheQ@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c

Fix typo

commit   : 89403ed228583c80c608310e68020229818836e6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 18 Oct 2019 14:49:39 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 18 Oct 2019 14:49:39 +0200    

Click here for diff

Apparently while this code was being developed,  
ReindexRelationConcurrently operated on multiple relations.  The version  
that was ultimately pushed doesn't, so this comment's use of plural is  
inaccurate.  

M src/backend/commands/indexcmds.c

Update comments about progress reporting by index_drop

commit   : d2efb90dbad97828838ab356c03927b3dda65070    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 18 Oct 2019 07:18:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 18 Oct 2019 07:18:50 -0300    

Click here for diff

Michaël Paquier complained that index_drop is requesting progress  
reporting for non-obvious reasons, so let's add a comment to explain  
why.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c

Fix timeout handling in logical replication worker

commit   : 3f60f690fac1bf375b92cf2f8682e8fe8f690981    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Oct 2019 14:26:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Oct 2019 14:26:29 +0900    

Click here for diff

The timestamp tracking the last moment a message is received in a  
logical replication worker was initialized in each loop checking if a  
message was received or not, causing wal_receiver_timeout to be ignored  
in basically any logical replication deployments.  This also broke the  
ping sent to the server when reaching half of wal_receiver_timeout.  
  
This simply moves the initialization of the timestamp out of the apply  
loop to the beginning of LogicalRepApplyLoop().  
  
Reported-by: Jehan-Guillaume De Rorthais  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/CAOBaU_ZHESFcWva8jLjtZdCLspMj7vqaB2k++rjHLY897ZxbYw@mail.gmail.com  
Backpatch-through: 10  

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

Fix minor bug in logical-replication walsender shutdown

commit   : 38ddeab13b4b86161799c097dea4bdf9be60924a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Oct 2019 15:06:06 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Oct 2019 15:06:06 +0200    

Click here for diff

Logical walsender should exit when it catches up with sending WAL during  
shutdown; but there was a rare corner case when it failed to because of  
a race condition that puts it back to wait for more WAL instead -- but  
since there wasn't any, it'd not shut down immediately.  It would only  
continue the shutdown when wal_sender_timeout terminates the sleep,  
which causes annoying waits during shutdown procedure.  Restructure the  
code so that we no longer forget to set WalSndCaughtUp in that case.  
  
This was an oversight in commit c6c333436.  
  
Backpatch all the way down to 9.4.  
  
Author: Craig Ringer, Álvaro Herrera  
Discussion: https://postgr.es/m/CAMsr+YEuz4XwZX_QmnX_-2530XhyAmnK=zCmicEnq1vLr0aZ-g@mail.gmail.com  

M src/backend/replication/walsender.c

Fix parallel restore of FKs to partitioned tables

commit   : 1752e351639dcc68ea289cf91428246ed316d9b2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Oct 2019 09:58:01 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Oct 2019 09:58:01 +0200    

Click here for diff

When an FK constraint is created, it needs the index on the referenced  
table to exist and be valid.  When doing parallel pg_restore and the  
referenced table was partitioned, this condition can sometimes not be  
met, because pg_dump didn't emit sufficient object dependencies to  
ensure so; this means that parallel pg_restore would fail in certain  
conditions.  Fix by having pg_dump make the FK constraint object  
dependent on the partition attachment objects for the constraint's  
referenced index.  
  
This has been broken since f56f8f8da6af, so backpatch to Postgres 12.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/fe_utils/simple_list.c
M src/include/fe_utils/simple_list.h

When restoring GUCs in parallel workers, show an error context.

commit   : 3c8c55dd5445370c5cad3ae04de02caba7be7073    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 17 Oct 2019 13:24:50 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 17 Oct 2019 13:24:50 +1300    

Click here for diff

Otherwise it can be hard to see where an error is coming from, when  
the parallel worker sets all the GUCs that it received from the  
leader.  Bug #15726.  Back-patch to 9.5, where RestoreGUCState()  
appeared.  
  
Reported-by: Tiago Anastacio  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/15726-6d67e4fa14f027b3%40postgresql.org  

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

Fix bug that could try to freeze running multixacts.

commit   : 6bda2af039d45d9a136ddc04e2242163177ab5ad    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 17 Oct 2019 09:59:21 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 17 Oct 2019 09:59:21 +1300    

Click here for diff

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to  
try to freeze a multixact that is still running.  That was  
prevented by a check, but raised an error.  Repair.  
  
Back-patch all the way.  
  
Author: Nathan Bossart, Jeremy Schneider  
Reported-by: Jeremy Schneider  
Reviewed-by: Jim Nasby, Thomas Munro  
Discussion: https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com  

M src/backend/commands/vacuum.c

Fix crash when reporting CREATE INDEX progress

commit   : 0d21f919eb86cd3baa267844d111c6a5af480696    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 16 Oct 2019 14:51:34 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 16 Oct 2019 14:51:34 +0200    

Click here for diff

A race condition can make us try to dereference a NULL pointer to the  
PGPROC struct of a process that's already finished.  That results in  
crashes during REINDEX CONCURRENTLY and CREATE INDEX CONCURRENTLY.  
  
This was introduced in ab0dfc961b6a, so backpatch to pg12.  
  
Reported by: Justin Pryzby  
Reviewed-by: Michaël Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/indexcmds.c
M src/backend/storage/lmgr/lmgr.c

Improve the check for pg_catalog.unknown data type in pg_upgrade

commit   : a524f50d0fc6fe6f2146ce708c2c9576d3734da4    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 16 Oct 2019 13:23:18 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 16 Oct 2019 13:23:18 +0200    

Click here for diff

The pg_upgrade check for pg_catalog.unknown type when upgrading from 9.6  
had a couple of issues with domains and composite types - it detected  
even composite types unused in objects with storage. So for example this  
was enough to trigger an unnecessary pg_upgrade failure:  
  
  CREATE TYPE unknown_composite AS (u pg_catalog.unknown)  
  
On the other hand, this only happened with composite types directly on  
the pg_catalog.unknown data type, but not with a domain. So this was not  
detected  
  
  CREATE DOMAIN unknown_domain AS pg_catalog.unknown;  
  CREATE TYPE unknown_composite_2 AS (u unknown_domain);  
  
unlike the first example. These false positives and inconsistencies are  
unfortunate, but what's worse we've failed to detected objects using the  
pg_catalog.unknown type through a domain. So we missed cases like this  
  
  CREATE TABLE t (u unknown_composite_2);  
  
The consequence is clusters broken after a pg_upgrade.  
  
This fixes these false positives and false negatives by using the same  
recursive CTE introduced by eaf900e842 for sql_identifier. Backpatch all  
the way to 10, where the of pg_catalog.unknown data type was restricted.  
  
Author: Tomas Vondra  
Backpatch-to: 10-  
Discussion: https://postgr.es/m/16045-673e8fa6b5ace196%40postgresql.org  

M src/bin/pg_upgrade/version.c

Improve the check for pg_catalog.line data type in pg_upgrade

commit   : 8d48e6a7240cb0542577860e1bac768cd86fc633    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 16 Oct 2019 13:23:14 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 16 Oct 2019 13:23:14 +0200    

Click here for diff

The pg_upgrade check for pg_catalog.line data type when upgrading from  
9.3 had a couple of issues with domains and composite types. Firstly, it  
triggered false positives for composite types unused in objects with  
storage. This was enough to trigger an unnecessary pg_upgrade failure:  
  
  CREATE TYPE line_composite AS (l pg_catalog.line)  
  
On the other hand, this only happened with composite types directly on  
the pg_catalog.line data type, but not with a domain. So this was not  
detected  
  
  CREATE DOMAIN line_domain AS pg_catalog.line;  
  CREATE TYPE line_composite_2 AS (l line_domain);  
  
unlike the first example. These false positives and inconsistencies are  
unfortunate, but what's worse we've failed to detected objects using the  
pg_catalog.line data type through a domain. So we missed cases like this  
  
  CREATE TABLE t (l line_composite_2);  
  
The consequence is clusters broken after a pg_upgrade.  
  
This fixes these false positives and false negatives by using the same  
recursive CTE introduced by eaf900e842 for sql_identifier. 9.3 did not  
support domains on composite types, but we can still have multi-level  
composite types.  
  
Backpatch all the way to 9.4, where the format for pg_catalog.line data  
type changed.  
  
Author: Tomas Vondra  
Backpatch-to: 9.4-  
Discussion: https://postgr.es/m/16045-673e8fa6b5ace196%40postgresql.org  

M src/bin/pg_upgrade/version.c

Replace alter_table.sql test usage of event triggers.

commit   : ae5cae54ca6b1949829026b9fbb744c7f5a28bd5    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 16 Oct 2019 02:37:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 16 Oct 2019 02:37:34 -0700    

Click here for diff

The test in 93765bd956b added an event trigger to ensure that the  
tested table rewrites do not get optimized away (as happened in the  
past). But doing so would require running the tests in isolation, as  
otherwise the trigger might also fire in concurrent sessions, causing  
test failures there.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12, just as 93765bd956b  

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

commit   : 1de4fd10922b96b6d90838181c59c1a45f8a95f6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Oct 2019 15:10:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Oct 2019 15:10:14 +0900    

Click here for diff

Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm0LPk9vTGTBPBRv0=fX=94o4r6-DuBbHNeCN2AH5bufLw@mail.gmail.com  

M src/backend/utils/hash/pg_crc.c
M src/include/utils/pg_crc.h

Remove obsolete collation test.

commit   : cce95a2f029e546dc461d7ec1760e2c3a247b0e7    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 16 Oct 2019 17:55:51 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 16 Oct 2019 17:55:51 +1300    

Click here for diff

The previous commit forgot to remove this test, which no longer  
holds on all systems.  

M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/sql/collate.linux.utf8.sql

Use libc version as a collation version on glibc systems.

commit   : d5ac14f9ccdda036358c9059d4a29836ebc0c440    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 16 Oct 2019 16:51:40 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 16 Oct 2019 16:51:40 +1300    

Click here for diff

Using glibc's version string to detect potential collation definition  
changes is not 100% reliable, but it's better than nothing.  Currently  
this affects only collations explicitly provided by "libc".  More work  
will be needed to handle the default collation.  
  
Author: Thomas Munro, based on a suggestion from Christoph Berg  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/4b76c6d4-ae5e-0dc6-7d0d-b5c796a07e34%402ndquadrant.com  

M doc/src/sgml/ref/alter_collation.sgml
M src/backend/utils/adt/pg_locale.c
M src/bin/pg_dump/t/002_pg_dump.pl

Doc: Fix various inconsistencies

commit   : 4351142e5843dc9fcb080a51aa082d63be59a5ab    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Oct 2019 13:09:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Oct 2019 13:09:52 +0900    

Click here for diff

This fixes multiple areas of the documentation:  
- COPY for its past compatibility section.  
- SET ROLE mentioning INHERITS instead of INHERIT  
- PREPARE referring to stmt_name, that is not present.  
- Extension documentation about format name with upgrade scripts.  
  
Backpatch down to 9.4 for the relevant parts.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/extend.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/prepare.sgml
M doc/src/sgml/ref/set_role.sgml

Fix CLUSTER on expression indexes.

commit   : cef82eda1464193ab84a58610a388572d456c8c5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 15 Oct 2019 10:40:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 15 Oct 2019 10:40:13 -0700    

Click here for diff

Since the introduction of different slot types, in 1a0586de3657, we  
create a virtual slot in tuplesort_begin_cluster(). While that looks  
right, it unfortunately doesn't actually work, as ExecStoreHeapTuple()  
is used to store tuples in the slot. Unfortunately no regression tests  
for CLUSTER on expression indexes existed so far.  
  
Fix the slot type, and add bare bones tests for CLUSTER on expression  
indexes.  
  
Reported-By: Justin Pryzby  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12, like 1a0586de3657  

M src/backend/utils/sort/tuplesort.c
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Correct reference to pg_catalog.regtype in pg_upgrade query

commit   : 3a0e85739490e5cd50e5eba382ae3c9cc3bc2fca    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 15 Oct 2019 00:25:04 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 15 Oct 2019 00:25:04 +0200    

Click here for diff

The recursive CTE added in 0ccfc28223 referenced pg_catalog.regtype,  
without the schema part, unlike all other queries in pg_upgrade.  
  
Backpatch-to: 12  

M src/bin/pg_upgrade/version.c

Check for tables with sql_identifier during pg_upgrade

commit   : 0ccfc2822366f92c61cba96541d1c64d2b8b2086    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 14 Oct 2019 22:31:56 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 14 Oct 2019 22:31:56 +0200    

Click here for diff

Commit 7c15cef86d changed sql_identifier data type to be based on name  
instead of varchar.  Unfortunately, this breaks on-disk format for this  
data type.  Luckily, that should be a very rare problem, as this data  
type is used only in information_schema views, so this only affects user  
objects (tables, materialized views and indexes).  One way to end in  
such situation is to do CTAS with a query on those system views.  
  
There are two options to deal with this - we can either abort pg_upgrade  
if there are user objects with sql_identifier columns in pg_upgrade, or  
we could replace the sql_identifier type with varchar.  Considering how  
rare the issue is expected to be, and the complexity of replacing the  
data type (e.g. in matviews), we've decided to go with the simple check.  
  
The query is somewhat complex - the sql_identifier data type may be used  
indirectly - through a domain, a composite type or both, possibly in  
multiple levels.  Detecting this requires a recursive CTE.  
  
Backpatch to 12, where the sql_identifier definition changed.  
  
Reported-by: Hans Buschmann  
Author: Tomas Vondra  
Reviewed-by: Tom Lane  
Backpatch-to: 12  
Discussion: https://postgr.es/m/16045-673e8fa6b5ace196%40postgresql.org  

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

Update test output of sepgsql for ALTER TABLE COLUMN DROP

commit   : 14ac4237cba02f2766a7e6379468e71050de6fd2    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 14 Oct 2019 08:58:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 14 Oct 2019 08:58:38 +0900    

Click here for diff

1df5875 has changed the way dependencies are dropped for this command  
with inheritance trees, which impacts sepgsql.  This just updates the  
regression test output to take care of the failures and adapt to the new  
code.  
  
Reported by buildfarm member rhinoceros.  
  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M contrib/sepgsql/expected/ddl.out

Update unicode.org URLs

commit   : bdb839cbdebe851c200b2c7c03aec7483573d631    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Oct 2019 22:10:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Oct 2019 22:10:38 +0200    

Click here for diff

Use https, consistent host name, remove references to ftp.  Also  
update the URLs for CLDR, which has moved from Trac to GitHub.  

M contrib/unaccent/generate_unaccent_rules.py
M doc/src/sgml/acronyms.sgml
M doc/src/sgml/charset.sgml
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/common/unicode/Makefile
M src/common/unicode_norm.c

In the postmaster, rely on the signal infrastructure to block signals.

commit   : 9abb2bfc046070b22e3be28173a0736da31cab5a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Oct 2019 15:48:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Oct 2019 15:48:26 -0400    

Click here for diff

POSIX sigaction(2) can be told to block a set of signals while a  
signal handler executes.  Make use of that instead of manually  
blocking and unblocking signals in the postmaster's signal handlers.  
This should save a few cycles, and it also prevents recursive  
invocation of signal handlers when many signals arrive in close  
succession.  We have seen buildfarm failures that seem to be due to  
postmaster stack overflow caused by such recursion (exacerbated by  
a Linux PPC64 kernel bug).  
  
This doesn't change anything about the way that it works on Windows.  
Somebody might consider adjusting port/win32/signal.c to let it work  
similarly, but I'm not in a position to do that.  
  
For the moment, just apply to HEAD.  Possibly we should consider  
back-patching this, but it'd be good to let it age awhile first.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/pqsignal.c
M src/backend/postmaster/postmaster.c
M src/include/libpq/pqsignal.h
M src/include/port.h
M src/port/pqsignal.c

Revert "Hack pg_ctl to report postmaster's exit status."

commit   : f38291e927fa8c04eb772e6a17a3dd44da2b69e8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Oct 2019 12:56:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Oct 2019 12:56:16 -0400    

Click here for diff

This reverts commit 6a5084eed49552bfc8859c438c8d74ad09fc5d3f.  
We learned what we needed to know from that.  

M src/bin/pg_ctl/pg_ctl.c

Fix dependency handling of column drop with partitioned tables

commit   : 1df5875d39383b3981b804666ee1f4b0ff65943f    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 13 Oct 2019 17:51:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 13 Oct 2019 17:51:55 +0900    

Click here for diff

When dropping a column on a partitioned table which has one or more  
partitioned indexes, the operation was failing as dependencies with  
partitioned indexes using the column dropped were not getting removed in  
a way consistent with the columns involved across all the relations part  
of an inheritance tree.  
  
This commit refactors the code executing column drop so as all the  
columns from an inheritance tree to remove are gathered first, and  
dropped all at the end.  This way, we let the dependency machinery sort  
out by itself the deletion of all the columns with the partitioned  
indexes across a partition tree.  
  
This issue has been introduced by 1d92a0c, so backpatch down to  
REL_12_STABLE.  
  
Author: Amit Langote, Michael Paquier  
Reviewed-by: Álvaro Herrera, Ashutosh Sharma  
Discussion: https://postgr.es/m/CA+HiwqE9kuBsZ3b5pob2-cvE8ofzPWs-og+g8bKKGnu6b4-yTQ@mail.gmail.com  
Backpatch-through: 12  

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

Fix use of term "verifier"

commit   : b4675a8ae2d0aaafeb136c46c92bb56eaf018d32    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 12 Oct 2019 21:17:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 12 Oct 2019 21:17:34 +0200    

Click here for diff

Within the context of SCRAM, "verifier" has a specific meaning in the  
protocol, per RFCs.  The existing code used "verifier" differently, to  
mean whatever is or would be stored in pg_auth.rolpassword.  
  
Fix this by using the term "secret" for this, following RFC 5803.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/be397b06-6e4b-ba71-c7fb-54cae84a7e18%402ndquadrant.com  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/common/scram-common.c
M src/include/common/scram-common.h
M src/include/libpq/crypt.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/test/authentication/t/001_password.pl
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

AIX: Stop adding option -qsrcmsg.

commit   : 5f3d271d03b249f5c80e3d3ca946f62a33d7862f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 12 Oct 2019 00:21:47 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 12 Oct 2019 00:21:47 -0700    

Click here for diff

With xlc v16.1.0, it causes internal compiler errors.  With xlc versions  
not exhibiting that bug, removing -qsrcmsg merely changes the compiler  
error reporting format.  Back-patch to 9.4 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/template/aix

Make crash recovery ignore restore_command and recovery_end_command settings.

commit   : 20961ceaf0426c6fba40bb422cf111f704a00058    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 11 Oct 2019 15:47:59 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 11 Oct 2019 15:47:59 +0900    

Click here for diff

In v11 or before, those settings could not take effect in crash recovery  
because they are specified in recovery.conf and crash recovery always  
starts without recovery.conf. But commit 2dedf4d9a8 integrated  
recovery.conf into postgresql.conf and which unexpectedly allowed  
those settings to take effect even in crash recovery. This is definitely  
not good behavior.  
  
To fix the issue, this commit makes crash recovery always ignore  
restore_command and recovery_end_command settings.  
  
Back-patch to v12 where the issue was added.  
  
Author: Fujii Masao  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

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

Put back pqsignal() as an exported libpq symbol.

commit   : 06a367c382d0a3595238eff2e777222dbc91911b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Oct 2019 14:24:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Oct 2019 14:24:56 -0400    

Click here for diff

This reverts commit f7ab80285.  Per discussion, we can't remove an  
exported symbol without a SONAME bump, which we don't want to do.  
In particular that breaks usage of current libpq.so with pre-9.3  
versions of psql etc, which need libpq to export pqsignal().  
  
As noted in that commit message, exporting the symbol from libpgport.a  
won't work reliably; but actually we don't want to export src/port's  
implementation anyway.  Any pre-9.3 client is going to be expecting the  
definition that pqsignal() had before 9.3, which was that it didn't  
set SA_RESTART for SIGALRM.  Hence, put back pqsignal() in a separate  
source file in src/interfaces/libpq, and give it the old semantics.  
  
Back-patch to v12.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile
M src/interfaces/libpq/exports.txt
A src/interfaces/libpq/legacy-pqsignal.c

pg_upgrade: Clean up some redundant code

commit   : 3b5d3721c25ed1270832265c5475649c3baa0e26    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Oct 2019 10:51:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Oct 2019 10:51:11 +0200    

Click here for diff

No need to call exit() after pg_fatal().  Clean up a few stragglers  
for consistency.  

M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c

Fix table rewrites that include a column without a default.

commit   : 93765bd956bea26206043de8cbb0ae4b67e4df15    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 9 Oct 2019 22:00:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 9 Oct 2019 22:00:50 -0700    

Click here for diff

In c2fe139c201c I made ATRewriteTable() use tuple slots. Unfortunately  
I did not notice that columns can be added in a rewrite that do not  
have a default, when another column is added/altered requiring one.  
  
Initialize columns to NULL again, and add tests.  
  
Bug: #16038  
Reported-By: anonymous  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12, where the bug was introduced in c2fe139c201c  

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

Revert "Use libc version as a collation version on glibc systems."

commit   : 50518ec296aea3af3e00c43c2ccef74c96cb5762    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Oct 2019 21:36:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Oct 2019 21:36:01 +0200    

Click here for diff

This reverts commit 9f90b1d08d796a925808b24f77f624a0ff682c77.  
  
This needs some refinements in the pg_dump and pg_upgrade tests.  

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

Use libc version as a collation version on glibc systems.

commit   : 9f90b1d08d796a925808b24f77f624a0ff682c77    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Oct 2019 21:17:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Oct 2019 21:17:47 +0200    

Click here for diff

Using glibc's version number to detect potential collation definition  
changes is not 100% reliable, but it's better than nothing.  
  
Author: Thomas Munro  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/4b76c6d4-ae5e-0dc6-7d0d-b5c796a07e34%402ndquadrant.com  

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

Flush logical mapping files with fd opened for read/write at checkpoint

commit   : b8e19b932a99a7eb5a3bce84e74b0b7c093d0981    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 9 Oct 2019 13:30:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 9 Oct 2019 13:30:43 +0900    

Click here for diff

The file descriptor was opened with read-only to fsync a regular file,  
which would cause EBADFD errors on some platforms.  
  
This is similar to the recent fix done by a586cc4b (which was broken by  
me with 82a5649), except that I noticed this issue while monitoring the  
backend code for similar mistakes.  Backpatch to 9.4, as this has been  
introduced since logical decoding exists as of b89e151.  
  
Author: Michael Paquier  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

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

pg_upgrade: clarify the database names in error files

commit   : 1634d361577aab30c7d90336c96b969a2f5e5811    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 8 Oct 2019 22:16:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 8 Oct 2019 22:16:48 -0400    

Click here for diff

Previously, the "Database:" label in the error file was unclear if the  
label was a status report or the problem was _in_ the database.  New  
text is "In database:".  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: head  

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

doc: improve docs so config value default units are clearer

commit   : 6c9fb69f2bb589c210a114162e67c86476460453    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 8 Oct 2019 21:49:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 8 Oct 2019 21:49:08 -0400    

Click here for diff

Previously, our docs would say "Specifies the number of milliseconds"  
but it wasn't clear that "milliseconds" was merely the default unit.  
New text says "Specifies duration (defaults to milliseconds)", which is  
clearer.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 12  

M doc/src/sgml/config.sgml

Remove some code for old unsupported versions of MSVC

commit   : 38d8dce61fff09daae0edb6bcdd42b0c7f10ebcd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 8 Oct 2019 10:27:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 8 Oct 2019 10:27:30 +0200    

Click here for diff

As of d9dd406fe281d22d5238d3c26a7182543c711e74, we require MSVC 2013,  
which means _MSC_VER >= 1800.  This means that conditionals about  
older versions of _MSC_VER can be removed or simplified.  
  
Previous code was also in some cases handling MinGW, where _MSC_VER is  
not defined at all, incorrectly, such as in pg_ctl.c and win32_port.h,  
leading to some compiler warnings.  This should now be handled better.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/bin/pg_ctl/pg_ctl.c
M src/include/pg_config.h.win32
M src/include/port/win32.h
M src/include/port/win32_port.h
M src/include/utils/float.h
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.stderr
M src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc
M src/port/chklocale.c
M src/tools/msvc/Solution.pm

commit   : a7471bd85c05f849e88d6cfe9da3c795008e8f2e    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Oct 2019 14:31:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Oct 2019 14:31:30 +0900    

Click here for diff

Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm3Dy=dTdx8UCVw=DWbzLzmRUC1dkq45=heOZDUg3U_PtA@mail.gmail.com  

M src/backend/utils/mb/wchar.c
M src/include/c.h

Clarify some comments about ntstatus.h in win32_port.h

commit   : 491bb81fb803b0477062bb0a51edb752fa2cb396    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Oct 2019 13:59:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Oct 2019 13:59:53 +0900    

Click here for diff

Some comments in this file referred to outdated links.  This simplifies  
the outdated comment blocks and refreshes the links.  
  
Reported-by: Vignesh C  
Author: Juan José Santamaría Flecha  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port/win32_port.h

Improve test coverage of pg_rewind

commit   : 55ba56415bae6ac1f43c12d54537bd60eaa2153b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Oct 2019 11:46:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Oct 2019 11:46:30 +0900    

Click here for diff

This includes new TAP tests for a couple of areas not covered yet and  
some improvements:  
- More coverage for --no-ensure-shutdown, the enforced recovery step and  
--dry-run.  
- Failures with option combinations and basic option checks.  
- Removal of a duplicated comment.  
  
Author: Alexey Kondratov, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
A src/bin/pg_rewind/t/006_options.pl

docs: Improve A?synchronous Multimaster Replication descr.

commit   : 47eec34e4674e327ba7c2c57dda19241c889859e    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 7 Oct 2019 18:06:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 7 Oct 2019 18:06:08 -0400    

Click here for diff

The docs for sync and async multimaster replication were unclear about  
when to use it, and when it has benefits;  this change clarifies that.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

M doc/src/sgml/high-availability.sgml

docs: clarify that today/tomorrow/yesterday is at 00:00

commit   : cae078f3f98fa3614b12719d276db376df95d473    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 7 Oct 2019 17:26:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 7 Oct 2019 17:26:46 -0400    

Click here for diff

This should help people clearly know that these days start at midnight.  
  
Reported-by: David Harper  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

M doc/src/sgml/datatype.sgml

doc: move mention of log_min_error_statement in a better spot

commit   : 47571ec1e46994265961b9ddfb83cccb340e4aec    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 7 Oct 2019 14:33:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 7 Oct 2019 14:33:31 -0400    

Click here for diff

Previously it was mentioned in the lock_timeout docs in a confusing  
location.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

M doc/src/sgml/config.sgml

Check for too many postmaster children before spawning a bgworker.

commit   : 3887e9455f812035473eee1cba0cf9c237969998    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Oct 2019 12:39:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Oct 2019 12:39:09 -0400    

Click here for diff

The postmaster's code path for spawning a bgworker neglected to check  
whether we already have the max number of live child processes.  That's  
a bit hard to hit, since it would necessarily be a transient condition;  
but if we do, AssignPostmasterChildSlot() fails causing a postmaster  
crash, as seen in a report from Bhargav Kamineni.  
  
To fix, invoke canAcceptConnections() in the bgworker code path, as we  
do in the other code paths that spawn children.  Since we don't want  
the same pmState tests in this case, add a child-process-type parameter  
to canAcceptConnections() so that it can know what to do.  
  
Back-patch to 9.5.  In principle the same hazard exists in 9.4, but the  
code is enough different that this patch wouldn't quite fix it there.  
Given the tiny usage of bgworkers in that branch it doesn't seem worth  
creating a variant patch for it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Simplify PGAC_STRUCT_TIMEZONE Autoconf macro

commit   : 400d5ffcafa65e0f742dd29de83b035b8ea27c4a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Oct 2019 16:28:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Oct 2019 16:28:56 +0200    

Click here for diff

Since 63bd0db12199c5df043e1dea0f2b574f622b3a4c we don't use tzname  
anymore, so we don't need to check for it.  Instead, just keep the  
part of PGAC_STRUCT_TIMEZONE that we need, which is the check for  
struct tm.tm_zone.  
  
Discussion: https://www.postgresql.org/message-id/flat/5eb11a37-f3ca-5fb7-308f-4485dec25a2e%402ndquadrant.com  

M config/c-library.m4
M configure
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/pl/plpython/plpython.h

Remove use of deprecated Autoconf define

commit   : 4d7e5a5db01edaff749555220aa41eb35be06799    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Oct 2019 16:27:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Oct 2019 16:27:31 +0200    

Click here for diff

Change from HAVE_TM_ZONE to HAVE_STRUCT_TM_TM_ZONE.  

M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c

Hack pg_ctl to report postmaster's exit status.

commit   : 6a5084eed49552bfc8859c438c8d74ad09fc5d3f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 7 Oct 2019 10:39:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 7 Oct 2019 10:39:07 -0400    

Click here for diff

Temporarily change pg_ctl so that the postmaster's exit status will  
be printed (to the postmaster's stdout).  This is to help identify  
the cause of intermittent "postmaster exited during a parallel  
transaction" failures seen on a couple of buildfarm members.  This  
change degrades pg_ctl's functionality in a couple of minor ways,  
so we'll revert it once we've obtained the desired info.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

Fix incorrect use of term HEAD for Git

commit   : cc4ec2d29ac4f3b8335d1851627a9735b81beb50    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 7 Oct 2019 09:44:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 7 Oct 2019 09:44:17 +0200    

Click here for diff

HEAD as used here was CVS terminology.  Now we mean master.  

M src/tools/RELEASE_CHANGES
M src/tools/git_changelog

Improve handling and coverage of --no-ensure-shutdown in pg_rewind

commit   : caa078353ecd1f3b3681c0d4fa95ad4bb8c2308a    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 7 Oct 2019 09:07:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 7 Oct 2019 09:07:22 +0900    

Click here for diff

This includes a couple of changes around the new behavior of pg_rewind  
which enforces recovery to happen once on a cluster not shut down  
cleanly:  
- Some comments and documentation improvements.  
- Shutdown the cluster to rewind with immediate mode in all the tests,  
this allows to check after the forced recovery behavior which is wanted  
as new default.  
- Use -F for the forced recovery step, so as postgres does not use  
fsync.  This was useless as a final sync is done once the tool is done.  
  
Author: Michael Paquier  
Reviewed-by: Alexey Kondratov  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/RewindTest.pm

Doc: improve docs about pg_statistic_ext_data.

commit   : 732457b5d2521c6ccd6b3b096d7aba73fca2a38a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Oct 2019 14:14:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Oct 2019 14:14:45 -0400    

Click here for diff

Commit aa087ec64 was a bit over-hasty about the doc changes needed  
while splitting pg_statistic_ext_data off from pg_statistic_ext.  
It duplicated one para and inserted another in what seems to me  
to be the wrong section.  Fix that up, and in passing do some minor  
copy-editing.  
  
Per report from noborusai.  
  
Discussion: https://postgr.es/m/CAAM3qnLXLUz4mOBkqa8jxigpKhKNxzSuvwpjvCRPvO5EqWjxSg@mail.gmail.com  

M doc/src/sgml/catalogs.sgml

Avoid trying to release a List's initial allocation via repalloc().

commit   : ac12ab06a96179d44046494bc76ec53f30b5d30a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Oct 2019 12:06:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Oct 2019 12:06:30 -0400    

Click here for diff

Commit 1cff1b95a included some code that supposed it could repalloc()  
a memory chunk to a smaller size without risk of the chunk moving.  
That was not a great idea, because it depended on undocumented behavior  
of AllocSetRealloc, which commit c477f3e44 changed thereby breaking it.  
(Not to mention that this code ought to work with other memory context  
types, which might not work the same...)  So get rid of the repalloc  
calls, and instead just wipe the now-unused ListCell array and/or tell  
Valgrind it's NOACCESS, as if we'd freed it.  
  
In cases where the initial list allocation had been quite large, this  
could represent an annoying waste of space.  In principle we could  
ameliorate that by allocating the initial cell array separately when  
it exceeds some threshold.  But that would complicate new_list() which  
is hot code, and the returns would materialize only in narrow cases.  
On balance I don't think it'd be worth it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/list.c

Change MemoryContextMemAllocated to return Size

commit   : 36425ece5d6c78177cdc1453a9925a0bb85da59f    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 5 Oct 2019 20:49:39 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 5 Oct 2019 20:49:39 +0200    

Click here for diff

Commit f2369bc610 switched most of the memory accounting from int64 to  
Size, but it forgot to change the MemoryContextMemAllocated return type.  
So this fixes that omission.  
  
Discussion: https://www.postgresql.org/message-id/11238.1570200198%40sss.pgh.pa.us  

M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils.h

Report test_atomic_ops() failures consistently, via macros.

commit   : e800bd7414df3ce8170761e5b75b13e83f576988    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 5 Oct 2019 10:05:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 5 Oct 2019 10:05:05 -0700    

Click here for diff

This prints the unexpected value in more failure cases, and it removes  
forty-eight hand-maintained error messages.  Back-patch to 9.5, which  
introduced these tests.  
  
Reviewed (in an earlier version) by Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/regress.c

Avoid use of wildcard in pg_waldump's .gitignore.

commit   : d82f3909da11f9732fbc488333de0fdeb4d91ff5    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Oct 2019 12:26:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Oct 2019 12:26:55 -0400    

Click here for diff

This would be all right, maybe, if it didn't also match a file that  
definitely should not be ignored.  We don't add rmgrs so often that  
manual maintenance of this file list is impractical, so just write  
out the list.  
  
(I find the equivalent wildcard use in the Makefile pretty lazy and  
unsafe as well, but will leave that alone until it actually causes a  
problem.)  
  
Per bug #16042 from Denis Stuchalin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_waldump/.gitignore

Disable one more set of tests from c8841199509.

commit   : 3a68105154c3a35e4b107b41e2f54ec85fbe29f5    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 5 Oct 2019 08:05:11 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 5 Oct 2019 08:05:11 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.6-, just like c8841199509 and 6e61d75f525  

M src/test/isolation/expected/eval-plan-qual-trigger.out
M src/test/isolation/specs/eval-plan-qual-trigger.spec

Disable one set of tests from c8841199509.

commit   : 6e61d75f5258dc395c131ad5edd712852e29939e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 4 Oct 2019 21:11:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 4 Oct 2019 21:11:23 -0700    

Click here for diff

One of the upsert related tests is unstable (sometimes even hanging  
until isolationtester's step timeout is reached). Based on preliminary  
analysis that might be a problem outside of just that test, but not  
really related to EPQ and triggers.  Disable for now, to get the  
buildfarm greener again.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.6-, just like c8841199509.  

M src/test/isolation/expected/eval-plan-qual-trigger.out
M src/test/isolation/specs/eval-plan-qual-trigger.spec

Add isolation tests for the combination of EPQ and triggers.

commit   : c88411995098800e19e8507d4db19e86b09d73e4    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 4 Oct 2019 13:56:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 4 Oct 2019 13:56:04 -0700    

Click here for diff

As evidenced by bug #16036 this area is woefully under-tested. Add  
fairly extensive tests for the combination.  
  
Backpatch back to 9.6 - before that isolationtester was not capable  
enough. While we don't backpatch tests all the time, future fixes to  
trigger.c would potentially look different enough in 12+ from the  
earlier branches that introducing bugs during backpatching is more  
likely than normal. Also, it's just a crucial and undertested area of  
the code.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.6-, the earliest these tests work  

A src/test/isolation/expected/eval-plan-qual-trigger.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/eval-plan-qual-trigger.spec

Fix crash caused by EPQ happening with a before update trigger present.

commit   : d986d4e87f61c68f52c68ebc274960dc664b7b4e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 4 Oct 2019 11:59:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 4 Oct 2019 11:59:34 -0700    

Click here for diff

When ExecBRUpdateTriggers()'s GetTupleForTrigger() follows an EPQ  
chain the former needs to run the result tuple through the junkfilter  
again, and update the slot containing the new version of the tuple to  
contain that new version. The input tuple may already be in the  
junkfilter's output slot, which used to be OK - we don't need the  
previous version anymore. Unfortunately ff11e7f4b9ae started to use  
ExecCopySlot() to update newslot, and ExecCopySlot() doesn't support  
copying a slot into itself, leading to a slot in a corrupt  
state, which then can cause crashes or other symptoms.  
  
Fix this by skipping the ExecCopySlot() when copying into itself.  
  
While we could have easily made ExecCopySlot() handle that case, it  
seems better to add an assert forbidding doing so instead. As the goal  
of copying might be to make the contents of one slot independent from  
another, it seems failure prone to handle doing so silently.  
  
A follow-up commit will add tests for the obviously under-covered  
combination of EPQ and triggers. Done as a separate commit as it might  
make sense to backpatch them further than this bug.  
  
Also remove confusion with confusing variable names for slots in  
ExecBRDeleteTriggers() and ExecBRUpdateTriggers().  
  
Bug: #16036  
Reported-By: Антон Власов  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where ff11e7f4b9ae was merged  

M src/backend/commands/trigger.c
M src/include/executor/tuptable.h

Use a fd opened for read/write when syncing slots during startup, take 2.

commit   : a586cc4b6c568e88a459f1a69ac82aa42af7e5ba    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 4 Oct 2019 13:08:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 4 Oct 2019 13:08:51 -0700    

Click here for diff

Cribbing from dfbaed45975:  
    Some operating systems, including the reporter's windows, return EBADFD  
    or similar when fsync() is invoked on a O_RDONLY file descriptor.  
    Unfortunately RestoreSlotFromDisk() does exactly that; which causes  
    failures after restarts in at least some scenarios.  
  
    If you hit the bug the error message will be something like  
    ERROR: could not fsync file "pg_replslot/$name/state": Bad file descriptor  
  
    Simply use O_RDWR instead of O_RDONLY when opening the relevant file  
    descriptor to fix the bug.  
  
Unfortunately this fix was undone in 82a5649fb9db. Re-apply, and add a  
comment.  
  
Bug: 16039  
Reported-By: Hans Buschmann  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, as 82a5649fb9db  

M src/backend/replication/slot.c

Handle spaces in OpenSSL install location for MSVC

commit   : ad7595b890dbc26284bb0d784c2aaf1b9d6f903a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 4 Oct 2019 15:34:40 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 4 Oct 2019 15:34:40 -0400    

Click here for diff

First, make sure that the .exe name is quoted when trying to get the  
version number. Also, don't quote the lib name for using in the project  
files if it's already been quoted. This second change applies to all  
libraries, not just OpenSSL.  
  
This has clearly been broken forever, so backpatch to all live branches.  

M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm

Rename some toasting functions based on whether they are heap-specific.

commit   : 2e8b6bfa90b252b1e1758364de7deff067d6058a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Oct 2019 14:24:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Oct 2019 14:24:46 -0400    

Click here for diff

The old names for the attribute-detoasting functions names included  
the word "heap," which seems outdated now that the heap is only one of  
potentially many table access methods.  
  
On the other hand, toast_insert_or_update and toast_delete are  
heap-specific, so rename them by adding "heap_" as a prefix.  
  
Not all of the work of making the TOAST system fully accessible to AMs  
other than the heap is done yet, but there seems to be little harm in  
getting this renaming out of the way now. Commit  
8b94dab06617ef80a0901ab103ebd8754427ef5a already divided up the  
functions among various files partially according to whether it was  
intended that they should be heap-specific or AM-agnostic, so this is  
just clarifying the division contemplated by that commit.  
  
Patch by me, reviewed and tested by Prabhat Sabu, Thomas Munro,  
Andres Freund, and Álvaro Herrera.  
  
Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com  

M src/backend/access/common/detoast.c
M src/backend/access/common/indextuple.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/table/toast_helper.c
M src/backend/executor/tstoreReceiver.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/fmgr/fmgr.c
M src/include/access/detoast.h
M src/include/access/heaptoast.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/regress.c

Fix bitshiftright()'s zero-padding some more.

commit   : 61aa9f544a91f2908e4c7cd549907cdc5b6f1c82    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Oct 2019 10:34:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Oct 2019 10:34:21 -0400    

Click here for diff

Commit 5ac0d9360 failed to entirely fix bitshiftright's habit of  
leaving one-bits in the pad space that should be all zeroes,  
because in a moment of sheer brain fade I'd concluded that only  
the code path used for not-a-multiple-of-8 shift distances needed  
to be fixed.  Of course, a multiple-of-8 shift distance can also  
cause the problem, so we need to forcibly zero the extra bits  
in both cases.  
  
Per bug #16037 from Alexander Lakhin.  As before, back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Use Size instead of int64 to track allocated memory

commit   : f2369bc610a19563cc00054ccfe9089fac469641    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 4 Oct 2019 16:10:56 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 4 Oct 2019 16:10:56 +0200    

Click here for diff

Commit 5dd7fc1519 added block-level memory accounting, but used int64 variable to  
track the amount of allocated memory. That is incorrect, because we have Size for  
exactly these purposes, but it was mostly harmless until c477f3e449 which changed  
how we handle with repalloc() when downsizing the chunk. Previously we've ignored  
these cases and just kept using the original chunk, but now we need to update the  
accounting, and the code was doing this:  
  
    context->mem_allocated += blksize - oldblksize;  
  
Both blksize and oldblksize are Size (so unsigned) which means the subtraction  
underflows, producing a very high positive value. On 64-bit platforms (where Size  
has the same size as mem_alllocated) this happens to work because the result wraps  
to the right value, but on (some) 32-bit platforms this fails.  
  
This fixes two things - it changes mem_allocated (and related variables) to Size,  
and it splits the update to two separate steps, to prevent any underflows.  
  
Discussion: https://www.postgresql.org/message-id/15151.1570163761%40sss.pgh.pa.us  

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/include/nodes/memnodes.h

Remove AtSubStart_Notify.

commit   : 967e276e9f6b485c8577371713a323bf277b6902    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 4 Oct 2019 08:19:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 4 Oct 2019 08:19:25 -0400    

Click here for diff

Allocate notify-related state lazily instead. This makes trivial  
subtransactions noticeably faster.  
  
Patch by me, reviewed and tested by Dilip Kumar, Kyotaro Horiguchi,  
and Jeevan Ladhe.  
  
Discussion: https://postgr.es/m/CA+TgmobE1J22S1eC-6N-je9LgrcwZypkwp+zH6JXo9mc=4Nk3A@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/commands/async.c
M src/include/commands/async.h

Fix issues in pg_rewind with --no-ensure-shutdown/--write-recovery-conf

commit   : 6837632b758e0470a2692d9f8303e8aebd6fbd8f    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 4 Oct 2019 16:18:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 4 Oct 2019 16:18:29 +0900    

Click here for diff

This fixes two issues with recent features added in pg_rewind:  
- --dry-run should do nothing on the target directory, but 927474c  
forgot to consider that for --write-recovery-conf.  
- --no-ensure-shutdown was not actually working.  There is no test  
coverage for this option yet, but a subsequent patch will add that.  
  
Author: Alexey Kondratov  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/pg_rewind.c

Fix --dry-run mode of pg_rewind

commit   : 6f3823b03560589157d9dbdab623f603ef393d7c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 4 Oct 2019 09:14:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 4 Oct 2019 09:14:51 +0900    

Click here for diff

Even if --dry-run mode was specified, the control file was getting  
updated, preventing follow-up runs of pg_rewind to work properly on the  
target data folder.  The origin of the problem came from the refactoring  
done by ce6afc6.  
  
Author: Alexey Kondratov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/bin/pg_rewind/pg_rewind.c

Avoid unnecessary out-of-memory errors during encoding conversion.

commit   : 8e10405c745003c5c16acb2da847db9bed1a169e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Oct 2019 17:34:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Oct 2019 17:34:25 -0400    

Click here for diff

Encoding conversion uses the very simplistic rule that the output  
can't be more than 4X longer than the input, and palloc's a buffer  
of that size.  This results in failure to convert any string longer  
than 1/4 GB, which is becoming an annoying limitation.  
  
As a band-aid to improve matters, allow the allocated output buffer  
size to exceed 1GB.  We still insist that the final result fit into  
MaxAllocSize (1GB), though.  Perhaps it'd be safe to relax that  
restriction, but it'd require close analysis of all callers, which  
is daunting (not least because external modules might call these  
functions).  For the moment, this should allow a 2X to 4X improvement  
in the longest string we can convert, which is a useful gain in  
return for quite a simple patch.  
  
Also, once we have successfully converted a long string, repalloc  
the output down to the actual string length, returning the excess  
to the malloc pool.  This seems worth doing since we can usually  
expect to give back several MB if we take this path at all.  
  
This still leaves much to be desired, most notably that the assumption  
that MAX_CONVERSION_GROWTH == 4 is very fragile, and yet we have no  
guard code verifying that the output buffer isn't overrun.  Fixing  
that would require significant changes in the encoding conversion  
APIs, so it'll have to wait for some other day.  
  
The present patch seems safely back-patchable, so patch all supported  
branches.  
  
Alvaro Herrera and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mb/mbutils.c

Allow repalloc() to give back space when a large chunk is downsized.

commit   : c477f3e449d1a7322c2453e9cd9d6b710ae91577    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Oct 2019 13:56:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Oct 2019 13:56:26 -0400    

Click here for diff

Up to now, if you resized a large (>8K) palloc chunk down to a smaller  
size, aset.c made no attempt to return any space to the malloc pool.  
That's unpleasant if a really large allocation is resized to a  
significantly smaller size.  I think no such cases existed when this  
code was designed, and I'm not sure whether they're common even yet,  
but an upcoming fix to encoding conversion will certainly create such  
cases.  Therefore, fix AllocSetRealloc so that it gives realloc()  
a chance to do something with the block.  This doesn't noticeably  
increase complexity, we mostly just have to change the order in which  
the cases are considered.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Selectively include window frames in expression walks/mutates.

commit   : b7a1c5539ad34d7357e04cc58f9c02a101482737    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 3 Oct 2019 10:54:52 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 3 Oct 2019 10:54:52 +0100    

Click here for diff

query_tree_walker and query_tree_mutator were skipping the  
windowClause of the query, without regard for the fact that the  
startOffset and endOffset in a WindowClause node are expression trees  
that need to be processed. This was an oversight in commit ec4be2ee6  
from 2010 which added the expression fields; the main symptom is that  
function parameters in window frame clauses don't work in inlined  
functions.  
  
Fix (as conservatively as possible since this needs to not break  
existing out-of-tree callers) and add tests.  
  
Backpatch all the way, since this has been broken since 9.0.  
  
Per report from Alastair McKinley; fix by me with kibitzing and review  
from Tom Lane.  
  
Discussion: https://postgr.es/m/DB6PR0202MB2904E7FDDA9D81504D1E8C68E3800@DB6PR0202MB2904.eurprd02.prod.outlook.com  

M src/backend/catalog/dependency.c
M src/backend/nodes/nodeFuncs.c
M src/include/nodes/nodeFuncs.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

pgbench: add --partitions and --partition-method options.

commit   : b1c1aa53182372e907f3f7f090e7eb5f432a4c9a    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 1 Oct 2019 09:50:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 1 Oct 2019 09:50:26 +0530    

Click here for diff

These new options allow users to partition the pgbench_accounts table by  
specifying the number of partitions and partitioning method.  The values  
allowed for partitioning method are range and hash.  
  
This feature allows users to measure the overhead of partitioning if any.  
  
Author: Fabien COELHO  
Reviewed-by: Amit Kapila, Amit Langote, Dilip Kumar, Asif Rehman, and  
Alvaro Herrera  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1907230826190.7008@lancre  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl

Remove temporary WAL and history files at the end of archive recovery

commit   : df86e52cace2c4134db51de6665682fb985f3195    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 2 Oct 2019 15:53:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 2 Oct 2019 15:53:07 +0900    

Click here for diff

cbc55da has reworked the order of some actions at the end of archive  
recovery.  Unfortunately this overlooked the fact that the startup  
process needs to remove RECOVERYXLOG (for temporary WAL segment newly  
recovered from archives) and RECOVERYHISTORY (for temporary history  
file) at this step, leaving the files around even after recovery ended.  
  
Backpatch to 9.5, like the previous commit.  
  
Author: Sawada Masahiko  
Reviewed-by: Fujii Masao, Michael Paquier  
Discussion: https://postgr.es/m/CAD21AoBO_eDQub6zojFnWtnmutRBWvYf7=cW4Hsqj+U_R26w3Q@mail.gmail.com  
Backpatch-through: 9.5  

M src/backend/access/transam/xlog.c
M src/test/recovery/t/002_archiving.pl

Revert hooks for session start and end, take two

commit   : 9555cc8d2b02c4191d67ba39f589b39b01735518    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 2 Oct 2019 09:55:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 2 Oct 2019 09:55:27 +0900    

Click here for diff

The location of the session end hook has been chosen so as it is  
possible to allow modules to do their own transactions, however any  
trying to any any subsystem which went through before_shmem_exit()  
would cause issues, limiting the pluggability of the hook.  
  
Per discussion with Tom Lane and Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/tcop/tcopprot.h
M src/test/modules/Makefile
D src/test/modules/test_session_hooks/.gitignore
D src/test/modules/test_session_hooks/Makefile
D src/test/modules/test_session_hooks/README
D src/test/modules/test_session_hooks/expected/test_session_hooks.out
D src/test/modules/test_session_hooks/session_hooks.conf
D src/test/modules/test_session_hooks/sql/test_session_hooks.sql
D src/test/modules/test_session_hooks/test_session_hooks.c

Blind attempt to fix pglz_maximum_compressed_size

commit   : 540f31680913b4e11f2caa40cafeca269cfcb22f    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 1 Oct 2019 16:53:04 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 1 Oct 2019 16:53:04 +0200    

Click here for diff

Commit 11a078cf87 triggered failures on big-endian machines, and the  
only plausible place for an issue seems to be that TOAST_COMPRESS_SIZE  
calls VARSIZE instead of VARSIZE_ANY. So try fixing that blindly.  
  
Discussion: https://www.postgresql.org/message-id/20191001131803.j6uin7nho7t6vxzy%40development  

M src/include/access/toast_internals.h

Mark two variables in in aset.c with PG_USED_FOR_ASSERTS_ONLY

commit   : fa2fe04bf1d4d31e099808745974964f84eb4521    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 1 Oct 2019 14:39:06 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 1 Oct 2019 14:39:06 +0200    

Click here for diff

This fixes two compiler warnings about unused variables in non-assert builds,  
introduced by 5dd7fc1519461548eebf26c33eac6878ea3e8788.  

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

Optimize partial TOAST decompression

commit   : 11a078cf87ffb611d19c7dec6df68b41084ad9c9    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 1 Oct 2019 14:13:44 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 1 Oct 2019 14:13:44 +0200    

Click here for diff

Commit 4d0e994eed added support for partial TOAST decompression, so the  
decompression is interrupted after producing the requested prefix. For  
prefix and slices near the beginning of the entry, this may saves a lot  
of decompression work.  
  
That however only deals with decompression - the whole compressed entry  
was still fetched and re-assembled, even though the compression used  
only a small fraction of it. This commit improves that by computing how  
much compressed data may be needed to decompress the requested prefix,  
and then fetches only the necessary part.  
  
We always need to fetch a bit more compressed data than the requested  
(uncompressed) prefix, because the prefix may not be compressible at all  
and pglz itself adds a bit of overhead. That means this optimization is  
most effective when the requested prefix is much smaller than the whole  
compressed entry.  
  
Author: Binguo Bao  
Reviewed-by: Andrey Borodin, Tomas Vondra, Paul Ramsey  
Discussion: https://www.postgresql.org/message-id/flat/CAL-OGkthU9Gs7TZchf5OWaL-Gsi=hXqufTxKv9qpNG73d5na_g@mail.gmail.com  

M src/backend/access/common/detoast.c
M src/common/pg_lzcompress.c
M src/include/access/toast_internals.h
M src/include/common/pg_lzcompress.h

Fix test_session_hooks with parallel workers

commit   : 002962dc7293043126561b0d0df79d6c76251804    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 1 Oct 2019 15:19:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 1 Oct 2019 15:19:32 +0900    

Click here for diff

Several buildfarm machines have been complaining about the new module  
test_session_hooks to be unstable, like crake and thorntail.  The issue  
was that the module was trying to log some start and end session  
activity for parallel workers, which makes little sense as they don't  
support DML, so just prevent this pattern to happen in the module.  
  
This could be reproduced by enforcing force_parallel_mode=regress, which  
is the value used by some of the buildfarm members.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_session_hooks/test_session_hooks.c

Add hooks for session start and session end, take two

commit   : e788bd924c19e296bd34316e30e3ba1b68354e64    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 1 Oct 2019 12:15:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 1 Oct 2019 12:15:25 +0900    

Click here for diff

These hooks can be used in loadable modules.  A simple test module is  
included.  
  
The first attempt was done with cd8ce3a but we lacked handling for  
NO_INSTALLCHECK in the MSVC scripts (problem solved afterwards by  
431f1599) so the buildfarm got angry.  This also fixes a couple of  
issues noticed upon review compared to the first attempt, so the code  
has slightly changed, resulting in a more simple test module.  
  
Author: Fabrízio de Royes Mello, Yugo Nagata  
Reviewed-by: Andrew Dunstan, Michael Paquier, Aleksandr Parfenov  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/tcop/tcopprot.h
M src/test/modules/Makefile
A src/test/modules/test_session_hooks/.gitignore
A src/test/modules/test_session_hooks/Makefile
A src/test/modules/test_session_hooks/README
A src/test/modules/test_session_hooks/expected/test_session_hooks.out
A src/test/modules/test_session_hooks/session_hooks.conf
A src/test/modules/test_session_hooks/sql/test_session_hooks.sql
A src/test/modules/test_session_hooks/test_session_hooks.c

Fix confusing error caused by connection parameter channel_binding

commit   : 41a6de41ed697df5d84f3144c6c60b4a9725381f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 1 Oct 2019 10:56:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 1 Oct 2019 10:56:27 +0900    

Click here for diff

When using a client compiled without channel binding support (linking to  
OpenSSL 1.0.1 or older) to connect to a server which supports channel  
binding (linking to OpenSSL 1.0.2 or newer), libpq would generate a  
confusing error message with channel_binding=require for an SSL  
connection, where the server sends back SCRAM-SHA-256-PLUS:  
"channel binding is required, but server did not offer an authentication  
method that supports channel binding."  
  
This is confusing because the server did send a SASL mechanism able to  
support channel binding, but libpq was not able to detect that  
properly.  
  
The situation can be summarized as followed for the case described in  
the previous paragraph for the SASL mechanisms used with the various  
modes of channel_binding:  
1) Client supports channel binding.  
1-1) channel_binding = disable => OK, with SCRAM-SHA-256.  
1-2) channel_binding = prefer => OK, with SCRAM-SHA-256-PLUS.  
1-3) channel_binding = require => OK, with SCRAM-SHA-256-PLUS.  
2) Client does not support channel binding.  
2-1) channel_binding = disable => OK, with SCRAM-SHA-256.  
2-2) channel_binding = prefer => OK, with SCRAM-SHA-256.  
2-3) channel_binding = require => failure with new error message,  
instead of the confusing one.  
This commit updates case 2-3 to generate a better error message.  Note  
that the SSL TAP tests are not impacted as it is not possible to test  
with mixed versions of OpenSSL for the backend and libpq.  
  
Reported-by: Tom Lane  
Author: Michael Paquier  
Reviewed-by: Jeff Davis, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Add transparent block-level memory accounting

commit   : 5dd7fc1519461548eebf26c33eac6878ea3e8788    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 1 Oct 2019 03:13:39 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 1 Oct 2019 03:13:39 +0200    

Click here for diff

Adds accounting of memory allocated in a memory context. Compared to  
various ad hoc solutions, the main advantage is that the accounting is  
transparent and does not require direct control over allocations (this  
matters for use cases where the allocations happen in user code, like  
for example aggregate states allocated in a transition functions).  
  
To reduce overhead, the accounting happens at the block level (not for  
individual chunks) and only the context immediately owning the block is  
updated. When inquiring about amount of memory allocated in a context,  
we have to recursively walk all children contexts.  
  
This "lazy" accounting works well for cases with relatively small number  
of contexts in the relevant subtree and/or with infrequent inquiries.  
  
Author: Jeff Davis  
Reivewed-by: Tomas Vondra, Melanie Plageman, Soumyadeep Chakraborty  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/mmgr/README
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils.h

Don't generate EEOP_*_FETCHSOME operations for slots know to be virtual.

commit   : 36d22dd95bc87ca68e742da91f47f8826f8758c9    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 30 Sep 2019 16:06:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 30 Sep 2019 16:06:16 -0700    

Click here for diff

That avoids unnecessary work during both interpreted execution, and  
JIT compiled expression evaluation. Both benefit from fewer expression  
steps needing be processed, and for interpreted execution there now is  
a fastpath dedicated to just fetching a value from a virtual  
slot. That's e.g. beneficial for hashjoins over nodes that perform  
projections, as the hashed columns are currently fetched individually.  
  
Author: Soumyadeep Chakraborty, Andres Freund  
Discussion: https://postgr.es/m/CAE-ML+9OKSN71+mHtfMD-L24oDp8dGTfaVjDU6U+j+FNAW5kRQ@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c

Reduce code duplication for ExecJust*Var operations.

commit   : 34c9c53bb035ba92491006eb80f7a60527db367d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 30 Sep 2019 15:00:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 30 Sep 2019 15:00:21 -0700    

Click here for diff

This is mainly in preparation for adding further fastpath evaluation  
routines.  
  
Also reorder ExecJust*Var functions to be consistent with the order in  
which they're used.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/CAE-ML+9OKSN71+mHtfMD-L24oDp8dGTfaVjDU6U+j+FNAW5kRQ@mail.gmail.com  

M src/backend/executor/execExprInterp.c

Rely on plan_cache_mode to force generic plans in partition_prune test.

commit   : d52eaa094847d395f942827a6f413904e516994c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 17:14:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 17:14:00 -0400    

Click here for diff

This file had a very weird mix of tests that did "set plan_cache_mode =  
force_generic_plan" to get a generic plan, and tests that relied on  
using five dummy executions of a prepared statement.  Converting them  
all to rely on plan_cache_mode is more consistent and shaves off a  
noticeable fraction of the test script's runtime.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Suppress another CR in program output

commit   : 863fa43e32b02963f240864245c6c922f619459f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 30 Sep 2019 15:48:54 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 30 Sep 2019 15:48:54 -0400    

Click here for diff

This one was exposed by a12c75a10.  
  
Backpatch to release 11 where check_pg_config was introduced.  

M src/test/perl/TestLib.pm

commit   : 5daf682cfc974bf9095be527603c6410921892a9    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 30 Sep 2019 12:43:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 30 Sep 2019 12:43:09 -0700    

Click here for diff

The aforementioned commit orders the link to pgfeutils after libpq,  
which can fail because pgfeutils uses symbols from libpq.  
  
Per buildfarm animal jacana.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/Makefile

Doc: improve PREPARE documentation, cross-referencing to plan_cache_mode.

commit   : ce734aaec1891ca2180c269b4c9adbfb13ca4052    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 14:31:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 14:31:12 -0400    

Click here for diff

The behavior described in the PREPARE man page applies only for the  
default plan_cache_mode setting, so explain that properly.  Rewrite  
some of the text while I'm here.  Per suggestion from Bruce.  
  
Discussion: https://postgr.es/m/[email protected]  

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

docs: adjust multi-column most-common-value statistics

commit   : 7e0fb165dd2447f83464833e63e646d2771edb15    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 30 Sep 2019 13:44:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 30 Sep 2019 13:44:22 -0400    

Click here for diff

This commit adds a mention that the order of columns specified during  
multi-column most-common-value statistics is insignificant, and tries to  
simplify examples.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 12  

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

pg_rewind: test new --write-recovery-conf functionality

commit   : 7524c788743f387c20bd4719c7a0ef0887602930    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Sep 2019 14:04:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Sep 2019 14:04:00 -0300    

Click here for diff

Author: Alexey Kondratov  
Reviewed-by: Paul Guo  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/RewindTest.pm

pg_rewind: Allow writing recovery configuration

commit   : 927474ce1a2498ddb617c6113a88ca61fbba161d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Sep 2019 12:57:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Sep 2019 12:57:35 -0300    

Click here for diff

This is provided with a new switch --write-recovery-conf and reuses the  
pg_basebackup code.  
  
Author: Paul Guo, Jimmy Yih, Ashwin Agrawal  
Reviewed-by: Alexey Kondratov, Michaël Paquier, Álvaro Herrera  
Discussion: https://postgr.es/m/CAEET0ZEffUkXc48pg2iqARQgGRYDiiVxDu+yYek_bTwJF+q=Uw@mail.gmail.com  

M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h

Fix SSL test for libpq connection parameter channel_binding

commit   : a12c75a1048295f03cf85533d6dcab5072ba262b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 30 Sep 2019 13:11:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 30 Sep 2019 13:11:31 +0900    

Click here for diff

When compiling Postgres with OpenSSL 1.0.1 or older versions, SCRAM's  
channel binding cannot be supported as X509_get_signature_nid() is  
needed, which causes a regression test with channel_binding='require' to  
fail as the server cannot publish SCRAM-SHA-256-PLUS as SASL mechanism  
over an SSL connection.  
  
Fix the issue by using a method similar to c3d41cc, making the test  
result conditional.  The test passes if X509_get_signature_nid() is  
present, and when missing we test for a connection failure.  Testing a  
connection failure is more useful than skipping the test as we should  
fail the connection if channel binding is required by the client but the  
server does not support it.  
  
Reported-by: Tom Lane, Michael Paquier  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/002_scram.pl

Make crash recovery ignore recovery target settings.

commit   : 7acf8a876b7704ae162fc4f48ff97f4290fb0a61    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 30 Sep 2019 10:18:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 30 Sep 2019 10:18:15 +0900    

Click here for diff

In v11 or before, recovery target settings could not take effect in  
crash recovery because they are specified in recovery.conf and  
crash recovery always starts without recovery.conf. But commit  
2dedf4d9a8 integrated recovery.conf into postgresql.conf and  
which unexpectedly allowed recovery target settings to take effect  
even in crash recovery. This is definitely not good behavior.  
  
To fix the issue, this commit makes crash recovery always ignore  
recovery target settings.  
  
Back-patch to v12.  
  
Author: Peter Eisentraut  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

jit: Re-allow JIT compilation of execGrouping.c hashtable comparisons.

commit   : ac88807f9b227ddcd92b8be9a053094837c1b99a    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 29 Sep 2019 16:24:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 29 Sep 2019 16:24:32 -0700    

Click here for diff

In the course of 5567d12ce03, 356687bd8 and 317ffdfeaac, I changed  
BuildTupleHashTable[Ext]'s call to ExecBuildGroupingEqual to not pass  
in the parent node, but NULL. Which in turn prevents the tuple  
equality comparator from being JIT compiled.  While that fixes  
bug #15486, it is not actually necessary after all of the above commits,  
as we don't re-build the comparator when using the new  
BuildTupleHashTableExt() interface (as the content of the hashtable  
are reset, but the TupleHashTable itself is not).  
  
Therefore re-allow jit compilation for callers that use  
BuildTupleHashTableExt with a separate context for "metadata" and  
content.  
  
As in the previous commit, there's ongoing work to make this easier to  
test to prevent such regressions in the future, but that  
infrastructure is not going to be backpatchable.  
  
The performance impact of not JIT compiling hashtable equality  
comparators can be substantial e.g. for aggregation queries that  
aggregate a lot of input rows to few output rows (when there are a lot  
of output groups, there will be fewer comparisons).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11, just as 5567d12ce03  

M src/backend/executor/execGrouping.c

Fix determination when slot types for upper executor nodes are fixed.

commit   : 97e971ee05d5a0f6361ea34abf27059d762045a7    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 29 Sep 2019 15:24:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 29 Sep 2019 15:24:54 -0700    

Click here for diff

For many queries the fact that the tuple descriptor from the lower  
node was not taken into account when determining whether the type of a  
slot is fixed, lead to tuple deforming for such upper nodes not to be  
JIT accelerated.  
  
I broke this in 675af5c01e297.  
  
There is ongoing work to enable writing regression tests for related  
behavior (including a patch that would have detected this  
regression), by optionally showing such details in EXPLAIN. But as it  
seems unlikely that that will be suitable for stable branches, just  
merge the fix for now.  
  
While it's fairly close to the 12 release window, the fact that 11  
continues to perform JITed tuple deforming in these cases, that  
there's still cases where we do so in 12, and the fact that the  
performance regression can be sizable, weigh in favor of fixing it  
now.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where 675af5c01e297 was merged.  

M src/backend/executor/execExpr.c

Allow SSL TAP tests to run on Windows

commit   : 258bf86a9aec05b531c206a6e661ec8c0754e10f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 29 Sep 2019 17:32:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 29 Sep 2019 17:32:46 -0400    

Click here for diff

Windows does not enforce key file permissions checks in libpq, and psql  
can produce CRLF line endings on Windows.  
  
Backpatch to Release 12 (CRLF) and Release 11 (permissions check)  

M src/test/ssl/t/001_ssltests.pl

doc: Further clarify how recovery target parameters are applied

commit   : e04a53a6071d13ef4a13a41c6419d8e14c30b95c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:07:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:07:22 +0200    

Click here for diff

Recovery target parameters are all applied even in standby mode.  The  
previous documentation mostly wished they were not but this was never  
the case.  
  
Discussion: https://www.postgresql.org/message-id/flat/e445616d-023e-a268-8aa1-67b8b335340c%40pgmasters.net  

M doc/src/sgml/config.sgml

Fix bogus order of error checks in new channel_binding code.

commit   : 2c97f73468419672f2340afb24f1321695ee3002    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Sep 2019 12:35:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Sep 2019 12:35:53 -0400    

Click here for diff

Coverity pointed out that it's pretty silly to check for a null pointer  
after we've already dereferenced the pointer.  To fix, just swap the  
order of the two error checks.  Oversight in commit d6e612f83.  

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

commit   : 92f1545d6ea9fbfe4b47108028ccaae351a1480c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 09:50:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 09:50:36 +0200    

Click here for diff

Forward-patched from PostgreSQL 12 release notes patch, for  
consistency.  

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

Fix compilation with older OpenSSL versions

commit   : 4e6f101e921c9a7ff4e7fff847966b9cdd390753    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 28 Sep 2019 15:54:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 28 Sep 2019 15:54:02 +0200    

Click here for diff

Some older OpenSSL versions (0.9.8 branch) define TLS*_VERSION macros  
but not the corresponding SSL_OP_NO_* macro, which causes the code for  
handling ssl_min_protocol_version/ssl_max_protocol_version to fail to  
compile.  To fix, add more #ifdefs and error handling.  
  
Reported-by: Victor Wagner <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20190924101859.09383b4f%40fafnir.local.vm  

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

Improve stability of partition_prune regression test.

commit   : 4ea03f3f4eba3c76abae2e69bf48c921799a68a3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Sep 2019 13:33:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Sep 2019 13:33:34 -0400    

Click here for diff

This test already knew that, to get stable test output, it had to hide  
"loops" counts in EXPLAIN ANALYZE results.  But that's not nearly enough:  
if we get a smaller number of workers than we planned for, then the  
"Workers Launched" number will change, and so will all the rows and loops  
counts up to the Gather node.  This has resulted in repeated failures in  
the buildfarm, so adjust the test to filter out all these counts.  
  
(Really, we wouldn't bother with EXPLAIN ANALYZE at all here, except  
that currently the only way to verify that executor-time pruning has  
happened is to look for '(never executed)' annotations.  Those are  
stable and needn't be filtered out.)  
  
Back-patch to v11 where the test was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove code relevant to OpenSSL 0.9.6 in be/fe-secure-openssl.c

commit   : 55282fa20f46c193bd4a89ad5bcd048048a8734d    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 28 Sep 2019 15:22:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 28 Sep 2019 15:22:49 +0900    

Click here for diff

HEAD supports OpenSSL 0.9.8 and newer versions, and this code likely got  
forgotten as its surrounding comments mention an incorrect version  
number.  
  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

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

Make pg_regress.c unset PGDATABASE during make installcheck.

commit   : 5ee96b3e2221d154ffcb719bd2dee1179c53f821    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 18:19:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 18:19:37 -0400    

Click here for diff

For the most part, we leave libpq-controlling environment variables  
alone during "make installcheck", reasoning that connecting to the  
server the user expects us to connect to may depend on those variables.  
But that argument doesn't apply to PGDATABASE, since we always want  
to connect to a specific database name within the server.  And failing  
to unset it causes certain ECPG tests to fail, as various people have  
complained of in the past.  So let's unset it.  
  
Possibly this should be back-patched, but I'm disinclined to do that  
right before 12.0 release.  Maybe later.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Silence -Wmaybe-uninitialized compiler warnings in dbcommands.c.

commit   : 3f6b3be39ca91a62b88051a6b4fdf428a05c6b0d    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 27 Sep 2019 14:10:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 27 Sep 2019 14:10:16 -0700    

Click here for diff

When compiling postgres using gcc -O3, there are false-positive  
warnings about the now initialized variables. Silence them.  
  
Author: Peter Eisentraut, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/dbcommands.c

Have pg_rewind run crash recovery before rewinding

commit   : 5adafaf176d09ba5ea11ae128416fc5211469bc0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Sep 2019 16:40:01 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Sep 2019 16:40:01 -0300    

Click here for diff

If we don't do this, the rewind fails if the server wasn't cleanly shut  
down, which seems unhelpful serving no purpose.  
  
Also provide a new option --no-ensure-shutdown to suppress this  
behavior, for alleged advanced usage that prefers to avoid the crash  
recovery.  
  
Authors: Paul Guo, Jimmy Yih, Ashwin Agrawal  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CAEET0ZEffUkXc48pg2iqARQgGRYDiiVxDu+yYek_bTwJF+q=Uw@mail.gmail.com  

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

Fix implicit-fallthrough compiler warning introduced in 6dda292d4df82.

commit   : c967e13f4047ef6f3d91bcb1cff6d746322aff6d    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 27 Sep 2019 10:25:08 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 27 Sep 2019 10:25:08 -0700    

Click here for diff

For some reason at least gcc-9 warns about the fallthrough, even  
though it otherwise recognizes that elog(ERROR, ...) doesn't return.  
  
Author: Andres Freund  

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

ANALYZE a_star and its children to avoid plan instability in tests.

commit   : b9bffa004a9980ac235b6ff541ee2fe0e9800372    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:28:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:28:24 -0400    

Click here for diff

We've noted certain EXPLAIN queries on these tables occasionally showing  
unexpected plan choices.  This seems to happen because VACUUM sometimes  
fails to update relpages/reltuples for one of these single-page tables,  
due to bgwriter or checkpointer holding a pin on the lone page at just  
the wrong time.  To ensure those values get set, insert explicit ANALYZE  
operations on these tables after we finish populating them.  This  
doesn't seem to affect any other test cases, so it's a usable fix.  
  
Back-patch to v12.  In principle the issue exists further back, but  
we have not seen it before v12, so I won't risk back-patching further.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Finish reverting "Insert temporary debugging output in regression tests."

commit   : d9cacca2d139d9e0792544f773d2361d8478c131    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:20:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:20:09 -0400    

Click here for diff

This removes the last of the temporary debugging queries added to the  
regression tests by commit f03a9ca43.  We've pretty much convinced  
ourselves that the plan instability we were seeing is due to VACUUM  
sometimes failing to update relpages/reltuples for a single-page table,  
due to bgwriter or checkpointer holding a pin on that page at just the  
wrong time.  I'll push a workaround for that separately.  
  
Discussion: https://postgr.es/m/CA+hUKG+0CxrKRWRMf5ymN3gm+BECHna2B-q1w8onKBep4HasUw@mail.gmail.com  

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

commit   : 4fa1d89cba0f1feb5120e99eb01c152ba276c4e9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:01:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:01:36 -0400    

Click here for diff

The markup for optional parameters was neither correct nor consistent.  
In passing, fix a spelling mistake.  
  
Per report from Alex Macy.  Some of these mistakes are old, so  
back-patch as appropriate.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

doc: Add timeline as valid recovery target in standby.signal documentation

commit   : 775578a445bbbbfc43b1dcc1c3e2d3b4bdb35962    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 27 Sep 2019 16:21:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 27 Sep 2019 16:21:47 +0200    

Click here for diff

The documentation states that no target settings will be used when  
standby.signal is present, but this is not quite the case since  
recovery_target_timeline is a valid recovery target for a standby.  
  
Update the documentation with this exception.  
  
Author: David Steele <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/e445616d-023e-a268-8aa1-67b8b335340c%40pgmasters.net  

M doc/src/sgml/config.sgml

Add tab completion for EXPLAIN (SETTINGS) in psql

commit   : 4b011cad272e997935eb8d80ab741a40b395fdf5    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Sep 2019 12:53:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Sep 2019 12:53:43 +0900    

Click here for diff

Author: Justin Pryzby  
Reviewed-by: Tatsuro Yamada  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Fix oversight in commit 4429f6a9e3e12bb4af6e3677fbc78cd80f160252.

commit   : bb0e3ce8eb074cef7a88c20bfc34f7e0346312b1    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 18 Sep 2019 09:14:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 18 Sep 2019 09:14:26 +0530    

Click here for diff

The test name and the following test cases suggest the index created  
should be hash index, but it forgot to add 'using hash' in the test case.  
This in itself won't improve code coverage as there were some other tests  
which were covering the corresponding code.  However, it is better if the  
added tests serve their actual purpose.  
  
Reported-by: Paul A Jungwirth  
Author: Paul A Jungwirth  
Reviewed-by: Mahendra Singh  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/CA+renyV=Us-5XfMC25bNp-uWSj39XgHHmGE9Rh2cQKMegSj52g@mail.gmail.com  

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

Fix lockmode initialization for custom relation options

commit   : fbfa5664882c9b61428266e6fb0d48b0147c421a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Sep 2019 09:31:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Sep 2019 09:31:20 +0900    

Click here for diff

The code was enforcing AccessExclusiveLock for all custom relation  
options, which is incorrect as the APIs allow a custom lock level to be  
set.  
  
While on it, fix a couple of inconsistencies in the tests and the README  
of dummy_index_am.  
  
Oversights in commit 773df88.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/reloptions.c
M src/test/modules/dummy_index_am/README
M src/test/modules/dummy_index_am/expected/reloptions.out
M src/test/modules/dummy_index_am/sql/reloptions.sql

doc: Fix whitespace in markup

commit   : 8190164e82ae03bde80864ab0941794a90e70483    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 21:29:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 21:29:14 +0200    

Click here for diff

M doc/src/sgml/func.sgml

doc: Format example JSON data better

commit   : 6c3ef7482f2bdedc68146a4ffcba4b8b241b91a9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 21:27:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 21:27:34 +0200    

Click here for diff

M doc/src/sgml/func.sgml

doc: Update a confusing sentence about SQL/JSON

commit   : a4a5c0cf9cec3df2d1662a799c539c2cc84aa463    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 16:35:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 16:35:10 +0200    

Click here for diff

Author: Liudmila Mantrova <[email protected]>  
Reported-by: Jeff Janes <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAMkU%3D1wP-SO4KpiLxHJuPezTJCmK%3DJqefLXrr3eXFO7Qku%2BtMg%40mail.gmail.com  

M doc/src/sgml/json.sgml

doc: Update note about source code formatting

commit   : 49e36e7901c691fd7e80ba56465b649a211290cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 10:51:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 10:51:39 +0200    

Click here for diff

Update the note about why not to use // comments, even though it's now  
technically supported.  
  
The note about variable declarations was dropped here because it's  
addressed more properly later in the chapter.  
  
Discussion: https://www.postgresql.org/message-id/flat/156924954640.1117.6309209869705522549%40wrigleys.postgresql.org  

M doc/src/sgml/sources.sgml

doc: Reorder JSON functions documentation

commit   : a083657896c739909a25190ebd0032c01f6c8109    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 09:44:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 09:44:22 +0200    

Click here for diff

Put the description of the SQL/JSON path language after the  
description of the general JSON functions and operators, instead of  
before.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/func.sgml

Fix comment in xlogreader.c

commit   : 6e22813b2d6083afa2b5af1612a834b3ffae3389    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 26 Sep 2019 11:53:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 26 Sep 2019 11:53:37 +0900    

Click here for diff

This has been introduced by 709d003, that has moved readSegNo, readOff  
and readPageTLI into a new structure called WALOpenSegment initialized  
separately.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

Correctly cast types to Datum and back in compareDatetime()

commit   : 7881bb14f4b23e8dc8671938cfb3f34117c12d8b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 26 Sep 2019 02:06:45 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 26 Sep 2019 02:06:45 +0300    

Click here for diff

Discussion: https://postgr.es/m/CAPpHfdteFKW6MLpXM4md99m55YAuXs0n9_P2wiTq_EmG09doUA%40mail.gmail.com  

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

Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING DEFAULTS.

commit   : b81a9c2fc52509025c635fa08ecaec1bad21441b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Sep 2019 17:30:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Sep 2019 17:30:42 -0400    

Click here for diff

LIKE INCLUDING DEFAULTS tried to copy the attrdef expression without  
copying the state of the attgenerated column.  This is in fact wrong,  
because GENERATED and DEFAULT expressions are not the same kind of animal;  
one can contain Vars and the other not.  We *must* copy attgenerated  
when we're copying the attrdef expression.  Rearrange the if-tests  
so that the expression is copied only when the correct one of  
INCLUDING DEFAULTS and INCLUDING GENERATED has been specified.  
  
Per private report from Manuel Rigger.  
  
Tom Lane and Peter Eisentraut  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/sql/create_table_like.sql

Implement jsonpath .datetime() method

commit   : bffe1bd68457e43925c362d8728ce3b25bdf1c94    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:54:14 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:54:14 +0300    

Click here for diff

This commit implements jsonpath .datetime() method as it's specified in  
SQL/JSON standard.  There are no-argument and single-argument versions of  
this method.  No-argument version selects first of ISO datetime formats  
matching input string.  Single-argument version accepts template string as  
its argument.  
  
Additionally to .datetime() method itself this commit also implements  
comparison ability of resulting date and time values.  There is some difficulty  
because exising jsonb_path_*() functions are immutable, while comparison of  
timezoned and non-timezoned types involves current timezone.  At first, current  
timezone could be changes in session.  Moreover, timezones themselves are not  
immutable and could be updated.  This is why we let existing immutable functions  
throw errors on such non-immutable comparison.  In the same time this commit  
provides jsonb_path_*_tz() functions which are stable and support operations  
involving timezones.  As new functions are added to the system catalog,  
catversion is bumped.  
  
Support of .datetime() method was the only blocker prevents T832 from being  
marked as supported.  sql_features.txt is updated correspondingly.  
  
Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.  
Heavily revised by me.  Comments were adjusted by Liudmila Mantrova.  
  
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com  
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com  
Author: Alexander Korotkov, Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Liudmila Mantrova  
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut  

M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/errcodes.txt
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql
M src/test/regress/sql/jsonpath.sql

Allow datetime values in JsonbValue

commit   : 6dda292d4df82a9158d1acc93feecf3b84637b59    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:53:41 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:53:41 +0300    

Click here for diff

SQL/JSON standard allows manipulation with datetime values.  So, it appears to  
be convinient to allow datetime values to be represented in JsonbValue struct.  
These datetime values are allowed for temporary representation only.  During  
serialization datetime values are converted into strings.  
  
SQL/JSON requires writing timestamps with timezone in the same timezone offset  
as they were parsed.  This is why we allow storage of timezone offset in  
JsonbValue struct.  For the same reason timezone offset argument is added to  
JsonEncodeDateTime() function.  
  
Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.  
Revised by me.  Comments were adjusted by Liudmila Mantrova.  
  
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com  
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com  
Author: Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Liudmila Mantrova  
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h

Error suppression support for upcoming jsonpath .datetime() method

commit   : 5bc450629b31a0b6986e668056d5bd36792412d2    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:51:47 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:51:47 +0300    

Click here for diff

Add support of error suppression in some date and time manipulation functions  
as it's required for jsonpath .datetime() method support.  This commit doesn't  
use PG_TRY()/PG_CATCH() in order to implement that.  Instead, it provides  
internal versions of date and time functions used, which support error  
suppression.  
  
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com  
Author: Alexander Korotkov, Nikita Glukhov  
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/formatting.h
M src/include/utils/timestamp.h

Implement parse_datetime() function

commit   : 66c74f8b6e347ba5830bf06468bef8081601c187    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:50:55 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:50:55 +0300    

Click here for diff

This commit adds parse_datetime() function, which implements datetime  
parsing with extended features demanded by upcoming jsonpath .datetime()  
method:  
  
 * Dynamic type identification based on template string,  
 * Support for standard-conforming 'strict' mode,  
 * Timezone offset is returned as separate value.  
  
Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.  
Revised by me.  
  
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com  
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com  
Author: Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov  
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/formatting.c
M src/include/utils/date.h
M src/include/utils/formatting.h

Implement standard datetime parsing mode

commit   : 1a950f37d0a283f2a76bec63c05530ed6eb16de1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:44:48 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 21:44:48 +0300    

Click here for diff

SQL Standard 2016 defines rules for handling separators in datetime template  
strings, which are different to to_date()/to_timestamp() rules.  Standard  
allows only small set of separators and requires strict matching for them.  
  
Standard applies to jsonpath .datetime() method and CAST (... FORMAT ...) SQL  
clause.  We're not going to change handling of separators in existing  
to_date()/to_timestamp() functions, because their current behavior is familiar  
for users.  Standard behavior now available by special flag, which will be used  
in upcoming .datetime() jsonpath method.  
  
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com  
Author: Alexander Korotkov  

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

Update expected output for dummy_index_am

commit   : bd29cc1992df9a1b786ca36c05e8f590d3795d10    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Sep 2019 16:17:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Sep 2019 16:17:19 -0300    

Click here for diff

Forgot to add the file in the previous commit.  

M src/test/modules/dummy_index_am/expected/reloptions.out

Support reloptions of enum type

commit   : 773df883e8f7543958d0d719c025b5f47c5a67f0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Sep 2019 15:56:52 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Sep 2019 15:56:52 -0300    

Click here for diff

All our current in core relation options of type string (not many,  
admittedly) behave in reality like enums.  But after seeing an  
implementation for enum reloptions, it's clear that strings are messier,  
so introduce the new reloption type.  Switch all string options to be  
enums instead.  
  
Fortunately we have a recently introduced test module for reloptions, so  
we don't lose coverage of string reloptions, which may still be used by  
third-party modules.  
  
Authors: Nikolay Shaplov, Álvaro Herrera  
Reviewed-by: Nikita Glukhov, Aleksandr Parfenov  
Discussion: https://postgr.es/m/43332102.S2V5pIjXRx@x200m  

M src/backend/access/common/reloptions.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistutil.c
M src/backend/commands/view.c
M src/include/access/gist_private.h
M src/include/access/reloptions.h
M src/include/commands/view.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_index_am/sql/reloptions.sql
M src/test/regress/expected/gist.out
M src/test/regress/expected/updatable_views.out

Split out recovery confing-writing code from pg_basebackup

commit   : caba97a9d9f4d4fa2531985fd12d3cd823da06f3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 25 Sep 2019 14:35:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 25 Sep 2019 14:35:24 -0300    

Click here for diff

... into a new file, fe_utils/recovery_gen.c.  
  
This can later be used by pg_rewind.  
  
Authors: Paul Guo, Jimmy Yih, Ashwin Agrawal.  A few tweaks by Álvaro Herrera  
Reviewed-by: Michaël Paquier  
Discussion: https://postgr.es/m/CAEET0ZEffUkXc48pg2iqARQgGRYDiiVxDu+yYek_bTwJF+q=Uw@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c
M src/fe_utils/Makefile
A src/fe_utils/recovery_gen.c
A src/include/fe_utils/recovery_gen.h
M src/tools/msvc/Mkvcbuild.pm

commit   : f5daf7f3266ff5a92f1bf8d386bd5ac3d7d042d6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 13:44:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 13:44:30 +0900    

Click here for diff

Append node has been removed in v12 when there would be only one subnode  
under it.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqHhS62w8zUFXF4NBjvMboCXYnD-jWoWp-tfo2aHvP3Gxg@mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/ddl.sgml

Make more stable regression tests of dummy_index_am for string validations

commit   : e0afac124ec7026a49909436ebcfc2bd999852a8    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 12:48:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 12:48:26 +0900    

Click here for diff

Several buildfarm members (crake, loach and spurfowl) are complaining  
about two queries looking up at pg_class.reloptions which trigger the  
validation routines for string reloptions with default values.  This  
commit limits the routines to be triggered only when building an index  
with all custom options set in CREATE INDEX, which is sufficient for the  
coverage.  
  
Introduced by 640c198.  

M src/test/modules/dummy_index_am/expected/reloptions.out
M src/test/modules/dummy_index_am/sql/reloptions.sql

Add dummy_index_am to src/test/modules/

commit   : 640c19869f8c4b5c34d3982b5e1cd40e62abbb85    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 12:11:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 12:11:12 +0900    

Click here for diff

This includes more tests dedicated to relation options, bringing the  
coverage of this code close to 100%, and the module can be used for  
other purposes, like a base template for an index AM implementation.  
  
Author: Nikolay Sharplov, Michael Paquier  
Reviewed-by: Álvaro Herrera, Dent John  
Discussion: https://postgr.es/m/17071942.m9zZutALE6@x200m  

M src/test/modules/Makefile
A src/test/modules/dummy_index_am/.gitignore
A src/test/modules/dummy_index_am/Makefile
A src/test/modules/dummy_index_am/README
A src/test/modules/dummy_index_am/dummy_index_am–1.0.sql
A src/test/modules/dummy_index_am/dummy_index_am.c
A src/test/modules/dummy_index_am/dummy_index_am.control
A src/test/modules/dummy_index_am/expected/reloptions.out
A src/test/modules/dummy_index_am/sql/reloptions.sql
M src/tools/pgindent/typedefs.list

Allow definition of lock mode for custom reloptions

commit   : 69f94108079d70093b59096a3ae0ad82c842b4c0    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 10:13:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 10:13:52 +0900    

Click here for diff

Relation options can define a lock mode other than AccessExclusiveMode  
since 47167b7, but modules defining custom relation options did not  
really have a way to enforce that.  Correct that by extending the  
current API set so as modules can define a custom lock mode.  
  
Author: Michael Paquier  
Reviewed-by: Kuntal Ghosh  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blutils.c
M src/backend/access/common/reloptions.c
M src/include/access/reloptions.h

Fix failure with lock mode used for custom relation options

commit   : 736b84eede6cfdadf1114cf5a0e950d7f4986d82    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 10:07:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 10:07:23 +0900    

Click here for diff

In-core relation options can use a custom lock mode since 47167b7, that  
has lowered the lock available for some autovacuum parameters.  However  
it forgot to consider custom relation options.  This causes failures  
with ALTER TABLE SET when changing a custom relation option, as its lock  
is not defined.  The existing APIs to define a custom reloption does not  
allow to define a custom lock mode, so enforce its initialization to  
AccessExclusiveMode which should be safe enough in all cases.  An  
upcoming patch will extend the existing APIs to allow a custom lock mode  
to be defined.  
  
The problem can be reproduced with bloom indexes, so add a test there.  
  
Reported-by: Nikolay Sharplov  
Analyzed-by: Thomas Munro, Michael Paquier  
Author: Michael Paquier  
Reviewed-by: Kuntal Ghosh  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M contrib/bloom/expected/bloom.out
M contrib/bloom/sql/bloom.sql
M src/backend/access/common/reloptions.c

Fix bug in pairingheap_SpGistSearchItem_cmp()

commit   : 90c0987258264de07780f0329db2fce83098fba8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 01:47:36 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 01:47:36 +0300    

Click here for diff

Our item contains only so->numberOfNonNullOrderBys of distances.  Reflect that  
in the loop upper bound.  
  
Discussion: https://postgr.es/m/53536807-784c-e029-6e92-6da802ab8d60%40postgrespro.ru  
Author: Nikita Glukhov  
Backpatch-through: 12  

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

Rework WAL-reading supporting structs

commit   : 709d003fbd98b975a4fbcb4c5750fa6efaf9ad87    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 24 Sep 2019 16:08:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 24 Sep 2019 16:08:31 -0300    

Click here for diff

The state-tracking of WAL reading in various places was pretty messy,  
mostly because the ancient physical-replication WAL reading code wasn't  
using the XLogReader abstraction.  This led to some untidy code.  Make  
it prettier by creating two additional supporting structs,  
WALSegmentContext and WALOpenSegment which keep track of WAL-reading  
state.  This makes code cleaner, as well as supports more future  
cleanup.  
  
Author: Antonin Houska  
Reviewed-by: Álvaro Herrera and (older versions) Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/walsender.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h
M src/include/replication/logicalfuncs.h

Prevent bogus pullup of constant-valued functions returning composite.

commit   : a9ae99d0190960ce2d3dd3e5f10e7f4adc3cf203    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Sep 2019 12:11:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Sep 2019 12:11:32 -0400    

Click here for diff

Fix an oversight in commit 7266d0997: as it stood, the code failed  
when a function-in-FROM returns composite and can be simplified  
to a composite constant.  
  
For the moment, just test for composite result and abandon pullup  
if we see one.  To make it actually work, we'd have to decompose  
the composite constant into per-column constants; which is surely  
do-able, but I'm not convinced it's worth the code space.  
  
Per report from Raúl Marín Rodríguez.  
  
Discussion: https://postgr.es/m/CAM6_UM4isP+buRA5sWodO_MUEgutms-KDfnkwGmryc5DGj9XuQ@mail.gmail.com  

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

Speedup truncations of relation forks.

commit   : 6d05086c0a79e50d8e91ed953626ec7280cd2481    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 24 Sep 2019 17:31:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 24 Sep 2019 17:31:26 +0900    

Click here for diff

When a relation is truncated, shared_buffers needs to be scanned  
so that any buffers for the relation forks are invalidated in it.  
Previously, shared_buffers was scanned for each relation forks, i.e.,  
MAIN, FSM and VM, when VACUUM truncated off any empty pages  
at the end of relation or TRUNCATE truncated the relation in place.  
Since shared_buffers needed to be scanned multiple times,  
it could take a long time to finish those commands especially  
when shared_buffers was large.  
  
This commit changes the logic so that shared_buffers is scanned only  
one time for those three relation forks.  
  
Author: Kirk Jamison  
Reviewed-by: Masahiko Sawada, Thomas Munro, Alvaro Herrera, Takayuki Tsunakawa and Fujii Masao  
Discussion: https://postgr.es/m/D09B13F772D2274BB348A310EE3027C64E2067@g01jpexmbkw24  

M contrib/pg_visibility/pg_visibility.c
M src/backend/access/heap/visibilitymap.c
M src/backend/catalog/storage.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/smgr/smgr.c
M src/include/access/visibilitymap.h
M src/include/storage/bufmgr.h
M src/include/storage/freespace.h
M src/include/storage/smgr.h

Don't disable ccache when building with coverage support

commit   : 2e5c83acbb7b3916037b3e3a2f81ced10d413a3e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 24 Sep 2019 10:00:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 24 Sep 2019 10:00:56 +0200    

Click here for diff

This was working around a bug in ccache that was fixed in ccache  
3.2.2 (released 2015-05-10).  (Users of older ccache versions can  
continue to set CCACHE_DISABLE themselves.)  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/Makefile.global.in

Fix ExprState's tag to be of type NodeTag rather than Node.

commit   : 30d13796582fe13df0cbea1a8605d926a454d32f    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 23 Sep 2019 15:28:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 23 Sep 2019 15:28:13 -0700    

Click here for diff

This appears to have been an oversight in b8d7f053c5c2. As it's  
effectively harmless, though confusing, only fix in master.  
  
Author: Andres Freund  

M src/backend/executor/execExpr.c
M src/include/nodes/execnodes.h

Add libpq parameter 'channel_binding'.

commit   : d6e612f837e235db0411e8b67558c9a6b3e9f41f    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 23 Sep 2019 13:45:23 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 23 Sep 2019 13:45:23 -0700    

Click here for diff

Allow clients to require channel binding to enhance security against  
untrusted servers.  
  
Author: Jeff Davis  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/227015d8417f2b4fef03f8966dbfa5cbcc4f44da.camel%40j-davis.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/test/authentication/t/001_password.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/SSLServer.pm

Doc: clarify handling of duplicate elements in array containment tests.

commit   : 13cd97e6c8c9679a9b2384c22a4f0333b1a5cc55    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 12:37:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 12:37:04 -0400    

Click here for diff

The array <@ and @> operators do not worry about duplicates: if every  
member of array X matches some element of array Y, then X is contained  
in Y, even if several members of X get matched to the same Y member.  
This was not explicitly stated in the docs though, so improve matters.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Message style fixes

commit   : 887248e97e2da6f602ddf22aaaaf8cb41d0d010d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 13:37:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 13:37:33 +0200    

Click here for diff

M contrib/test_decoding/expected/slot.out
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/pg_aggregate.c
M src/backend/libpq/auth.c
M src/backend/replication/basebackup.c
M src/backend/replication/slotfuncs.c
M src/backend/storage/file/fd.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/misc/guc.c
M src/test/regress/expected/foreign_key.out

NLS: Fix backend gettext triggers

commit   : 467c1d9107e15a44a0ca3c46f0c7ebeeb7cfa208    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 09:04:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 09:04:20 +0200    

Click here for diff

The backend also needs to pull in translations from the frontend  
pg_log_*() functions, since some files in src/common/ use those.  

M src/nls-global.mk

Fix failure to zero-pad the result of bitshiftright().

commit   : 5ac0d93600c1a21db1c2a8fa29a253edca38415f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 17:45:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 17:45:59 -0400    

Click here for diff

If the bitstring length is not a multiple of 8, we'd shift the  
rightmost bits into the pad space, which must be zeroes --- bit_cmp,  
for one, depends on that.  This'd lead to the result failing to  
compare equal to what it should compare equal to, as reported in  
bug #16013 from Daryl Waycott.  
  
This is, if memory serves, not the first such bug in the bitstring  
functions.  In hopes of making it the last one, do a bit more work  
than minimally necessary to fix the bug:  
  
* Add assertion checks to bit_out() and varbit_out() to complain if  
they are given incorrectly-padded input.  This will improve the  
odds that manual testing of any new patch finds problems.  
  
* Encapsulate the padding-related logic in macros to make it  
easier to use.  
  
Also, remove unnecessary padding logic from bit_or() and bitxor().  
Somebody had already noted that we need not re-pad the result of  
bit_and() since the inputs are required to be the same length,  
but failed to extrapolate that to the other two.  
  
Also, move a comment block that once was near the head of varbit.c  
(but people kept putting other stuff in front of it), to put it in  
the header block.  
  
Note for the release notes: if anyone has inconsistent data as a  
result of saving the output of bitshiftright() in a table, it's  
possible to fix it with something like  
UPDATE mytab SET bitcol = ~(~bitcol) WHERE bitcol != ~(~bitcol);  
  
This has been broken since day one, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/varbit.c
M src/include/utils/varbit.h
M src/test/regress/expected/bit.out
M src/test/regress/sql/bit.sql

Fix typo in tts_virtual_copyslot.

commit   : 0a2f894c3c88e4693d7cd36cba1b136474c7ff89    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 14:21:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 14:21:07 -0400    

Click here for diff

The code used the destination slot's natts where it intended to  
use the source slot's natts.  Adding an Assert shows that there  
is no case in "make check-world" where these counts are different,  
so maybe this is a harmless bug, but it's still a bug.  
  
Takayuki Tsunakawa  
  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1FD34C0E@G01JPEXMBYT05  

M src/backend/executor/execTuples.c

Make some efficiency improvements in LISTEN/NOTIFY.

commit   : 51004c7172b5c35afac050f4d5849839a06e8d3b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 11:46:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 11:46:29 -0400    

Click here for diff

Move the responsibility for advancing the NOTIFY queue tail pointer  
from the listener(s) to the notification sender, and only have the  
sender do it once every few queue pages, rather than after every batch  
of notifications as at present.  This reduces the number of times we  
execute asyncQueueAdvanceTail, and reduces contention when there are  
multiple listeners (since that function requires exclusive lock).  
This change relies on the observation that we don't really need the tail  
pointer to be exactly up-to-date.  It's certainly not necessary to  
attempt to release disk space more often than once per SLRU segment.  
The only other usage of the tail pointer is that an incoming listener,  
if it's the only listener in its database, will need to scan the queue  
forward from the tail; but that's surely a less performance-critical  
path than routine sending and receiving of notifies.  We compromise by  
advancing the tail pointer after every 4 pages of output, so that it  
shouldn't get more than a few pages behind.  
  
Also, when sending signals to other backends after adding notify  
message(s) to the queue, recognize that only backends in our own  
database are going to care about those messages, so only such  
backends really need to be awakened promptly.  Backends in other  
databases should get kicked if they're well behind on reading the  
queue, else they'll hold back the global tail pointer; but wakening  
them for every single message is pointless.  This change can  
substantially reduce signal traffic if listeners are spread among  
many databases.  It won't help for the common case of only a single  
active database, but the extra check costs very little.  
  
Martijn van Oosterhout, with some adjustments by me  
  
Discussion: https://postgr.es/m/CADWG95vtRBFDdrx1JdT1_9nhOFw48KaeTev6F_LtDQAFVpSPhA@mail.gmail.com  
Discussion: https://postgr.es/m/CADWG95uFj8rLM52Er80JnhRsTbb_AqPP1ANHS8XQRGbqLrU+jA@mail.gmail.com  

M src/backend/commands/async.c

Remove removed file from nls.mk

commit   : 72c48c3fc31e3be090b1f70eb6d8222634ba4bde    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 21 Sep 2019 23:22:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 21 Sep 2019 23:22:15 +0200    

Click here for diff

part of revert "Add DECLARE STATEMENT support to ECPG."  

M src/interfaces/ecpg/ecpglib/nls.mk

Straighten out leakproofness markings on text comparison functions.

commit   : c160b8928c77cb52f52d7509465b6c7d8026bd27    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 16:56:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 16:56:30 -0400    

Click here for diff

Since we introduced the idea of leakproof functions, texteq and textne  
were marked leakproof but their sibling text comparison functions were  
not.  This inconsistency seemed justified because texteq/textne just  
relied on memcmp() and so could easily be seen to be leakproof, while  
the other comparison functions are far more complex and indeed can  
throw input-dependent errors.  
  
However, that argument crashed and burned with the addition of  
nondeterministic collations, because now texteq/textne may invoke  
the exact same varstr_cmp() infrastructure as the rest.  It makes no  
sense whatever to give them different leakproofness markings.  
  
After a certain amount of angst we've concluded that it's all right  
to consider varstr_cmp() to be leakproof, mostly because the other  
choice would be disastrous for performance of many queries where  
leakproofness matters.  The input-dependent errors should only be  
reachable for corrupt input data, or so we hope anyway; certainly,  
if they are reachable in practice, we've got problems with requirements  
as basic as maintaining a btree index on a text column.  
  
Hence, run around to all the SQL functions that derive from varstr_cmp()  
and mark them leakproof.  This should result in a useful gain in  
flexibility/performance for queries in which non-leakproofness degrades  
the efficiency of the query plan.  
  
Back-patch to v12 where nondeterministic collations were added.  
While this isn't an essential bug fix given the determination  
that varstr_cmp() is leakproof, we might as well apply it now that  
we've been forced into a post-beta4 catversion bump.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Fix up handling of nondeterministic collations with pattern_ops opclasses.

commit   : 2810396312664bdb941e549df7dfa75218d73a1c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 16:29:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 16:29:17 -0400    

Click here for diff

text_pattern_ops and its siblings can't be used with nondeterministic  
collations, because they use the text_eq operator which will not behave  
as bitwise equality if applied with a nondeterministic collation.  The  
initial implementation of that restriction was to insert a run-time test  
in the related comparison functions, but that is inefficient, may throw  
misleading errors, and will throw errors in some cases that would work.  
It seems sufficient to just prevent the combination during CREATE INDEX,  
so do that instead.  
  
Lacking any better way to identify the opclasses involved, we need to  
hard-wire tests for them, which requires hand-assigned values for their  
OIDs, which forces a catversion bump because they previously had OIDs  
that would be assigned automatically.  That's slightly annoying in the  
v12 branch, but fortunately we're not at rc1 yet, so just do it.  
  
Back-patch to v12 where nondeterministic collations were added.  
  
In passing, run make reformat-dat-files, which found some unrelated  
whitespace issues (slightly different ones in HEAD and v12).  
  
Peter Eisentraut, with small corrections by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_operator.dat

Update time zone data files to tzdata release 2019c.

commit   : df4fbcd8990e025d6701d0993f401d315cb619a2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 19:53:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 19:53:33 -0400    

Click here for diff

DST law changes in Fiji and Norfolk Island.  Historical corrections  
for Alberta, Austria, Belgium, British Columbia, Cambodia, Hong Kong,  
Indiana (Perry County), Kaliningrad, Kentucky, Michigan, Norfolk  
Island, South Korea, and Turkey.  

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

Split out code into new getKeyJsonValueFromContainer()

commit   : 1a2983231d9080bfa06cfbf38d5415b5d71eea91    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 20:18:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 20:18:11 -0300    

Click here for diff

The new function stashes its output value in a JsonbValue that can be  
passed in by the caller, which enables some of them to pass  
stack-allocated structs -- saving palloc cycles.  It also allows some  
callers that know they are handling a jsonb object to use this new jsonb  
object-specific API, instead of going through generic container  
findJsonbValueFromContainer.  
  
Author: Nikita Glukhov  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonb.h

Optimize get_jsonb_path_all avoiding an iterator

commit   : dbb9aeda9959d8a8f463e841b69dfa04afc67a3a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 19:18:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 19:18:24 -0300    

Click here for diff

Instead of creating an iterator object at each step down the JSONB  
object/array, we can just just examine its object/array flags, which is  
faster.  Also, use the recently introduced JsonbValueAsText instead of  
open-coding the same thing, for code simplicity.  
  
Author: Nikita Glukhov  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor code into new JsonbValueAsText, and use it more

commit   : abb014a63106653f2872a3b1662a79ab80d4dcbb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 18:34:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 18:34:31 -0300    

Click here for diff

jsonb_object_field_text and jsonb_array_element_text both contained  
identical copies of this code, so extract that into new routine  
JsonbValueAsText.  This can also be used in other places, to measurable  
performance benefit: the jsonb_each() and jsonb_array_elements()  
functions can use it for outputting text forms instead of their less  
efficient current implementation (because we no longer need to build  
intermediate a jsonb representation of each value).  
  
Author: Nikita Glukhov  
Discussion: https://postgr.es/m/[email protected]  

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

Fix some minor spec-compliance issues in jsonpath lexer.

commit   : e56cad84d542a8cc2056390a9c651118cfa6c89c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 14:22:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 14:22:58 -0400    

Click here for diff

Although the SQL/JSON tech report makes reference to ECMAScript which  
allows both single- and double-quoted strings, all the rest of the  
report speaks only of double-quoted string literals in jsonpaths.  
That's more compatible with JSON itself; moreover single-quoted strings  
are hard to use inside a jsonpath that is itself a single-quoted SQL  
literal.  So guess that the intent is to allow only double-quoted  
literals, and remove lexer support for single-quoted literals.  
It'll be less painful to add this again later if we're wrong, than to  
remove a shipped feature.  
  
Also, adjust the lexer so that unrecognized backslash sequences are  
treated as just meaning the escaped character, not as errors.  This  
change has much better support in the standards, as JSON, JavaScript  
and ECMAScript all make it plain that that's what's supposed to  
happen.  
  
Back-patch to v12.  
  
Discussion: https://postgr.es/m/CAPpHfdvDci4iqNF9fhRkTqhe-5_8HmzeLt56drH%[email protected]  

M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/jsonpath_encoding.out
M src/test/regress/expected/jsonpath_encoding_1.out
M src/test/regress/sql/jsonpath.sql
M src/test/regress/sql/jsonpath_encoding.sql

Revert "Add DECLARE STATEMENT support to ECPG."

commit   : 96b6c82c9dd4a6a91c7e54bf42d36da111959ec6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 12:47:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 12:47:21 -0400    

Click here for diff

This reverts commit bd7c95f0c1a38becffceb3ea7234d57167f6d4bf,  
along with assorted follow-on fixes.  There are some questions  
about the definition and implementation of that statement, and  
we don't have time to resolve them before v13 release.  Rather  
than ship the feature and then have backwards-compatibility  
concerns constraining any redesign, let's remove it for now  
and try again later.  
  
Discussion: https://postgr.es/m/TY2PR01MB2443EC8286995378AEB7D9F8F5B10@TY2PR01MB2443.jpnprd01.prod.outlook.com  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/connect.c
D src/interfaces/ecpg/ecpglib/cursor.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/exports.txt
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/include/ecpgerrno.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/ecpgtype.h
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.c
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/preproc_extern.h
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/ecpg_schedule
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/preproc-autoprep.c
M src/interfaces/ecpg/test/expected/preproc-cursor.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
M src/interfaces/ecpg/test/expected/sql-binary.c
D src/interfaces/ecpg/test/expected/sql-declare.c
D src/interfaces/ecpg/test/expected/sql-declare.stderr
D src/interfaces/ecpg/test/expected/sql-declare.stdout
M src/interfaces/ecpg/test/expected/sql-desc.c
M src/interfaces/ecpg/test/expected/sql-dyntest.c
M src/interfaces/ecpg/test/expected/sql-execute.c
M src/interfaces/ecpg/test/expected/sql-fetch.c
M src/interfaces/ecpg/test/expected/sql-oldexec.c
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/sql/.gitignore
M src/interfaces/ecpg/test/sql/Makefile
D src/interfaces/ecpg/test/sql/declare.pgc

Fix progress report of REINDEX INDEX

commit   : d1b0007639a1cefb5dcecf44999a4461f4c34089    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 12:53:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 12:53:58 -0300    

Click here for diff

I (Álvaro) broke that in commit 6212276e4343 -- forgot to set the  
necessary flag.  Repair.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqEaM2tV5awKhP1vSbgjQe_uXVU15Oi4sTgwgempwMiT8g@mail.gmail.com  

M src/backend/commands/indexcmds.c

Provide stable test for NULL-values in KNN SP-GiST

commit   : 5033e9580869fec514d787dc9d3b0b63cce0bcfb    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 15:31:12 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 15:31:12 +0300    

Click here for diff

f5f084fc3e has removed test because of its instability.  This commit provides  
alternative test with determined ordering using extra ORDER BY expression.  
  
Backpatch-through: 12  

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

Fix typo in commit 82fa3ff8672.

commit   : c53e40a132dca2ea8db73ce705a9019197ec338b    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 20 Sep 2019 07:38:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 20 Sep 2019 07:38:06 +0530    

Click here for diff

Reported-By: Kuntal Ghosh (off-list)  
Backpatch-through: 9.4, like 82fa3ff8672  

M doc/src/sgml/maintenance.sgml

Remove unstable KNN SP-GiST test

commit   : f5f084fc3ec516545d826e1e9b7ab4aabf612698    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 01:46:49 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 01:46:49 +0300    

Click here for diff

6cae9d2c10 introduced test for NULL values in KNN SP-GiST.  This test relies on  
undetermined ordering showing different results on various platforms.  This  
commit removes that test.  Will be replaced with better test later.  
  
Discussion: https://postgr.es/m/6d51305e1159241cabee132f7efc7eff%40xs4all.nl  
Backpatch-through: 12  

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

Fix freeing old values in index_store_float8_orderby_distances()

commit   : 8c8a267201bebb0edeaab2a76b7d3bcc9739924f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 01:10:56 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 01:10:56 +0300    

Click here for diff

6cae9d2c10 has added an error in freeing old values in  
index_store_float8_orderby_distances() function.  It looks for old value in  
scan->xs_orderbynulls[i] after setting a new value there.  
This commit fixes that.  Also it removes short-circuit in handling  
distances == NULL situation.  Now distances == NULL will be treated the same  
way as array with all null distances.  That is, previous values will be freed  
if any.  
  
Reported-by: Tom Lane, Nikita Glukhov  
Discussion: https://postgr.es/m/CAPpHfdu2wcoAVAm3Ek66rP%3Duo_C-D84%2B%2Buf1VEcbyi_caBXWCA%40mail.gmail.com  
Discussion: https://postgr.es/m/426580d3-a668-b9d1-7b8e-f74d1a6524e0%40postgrespro.ru  
Backpatch-through: 12  

M src/backend/access/index/indexam.c

Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

commit   : 6cae9d2c10e151f741e7bc64a8b70bb2615c367c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 19 Sep 2019 21:30:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 19 Sep 2019 21:30:19 +0300    

Click here for diff

This commit improves subject in two ways:  
  
 * It removes ugliness of 02f90879e7, which stores distance values and null  
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack  
   both distance value and null flag in IndexOrderByDistance struct.  Alignment  
   overhead should be negligible, because we typically deal with at most few  
   "col op const" expressions in ORDER BY clause.  
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these  
   expression are not passed to support functions, which can't deal with them.  
   Instead, NULL result is implicitly assumed.  It future we may decide to  
   teach support functions to deal with NULL arguments, but current solution is  
   bugfix suitable for backpatch.  
  
Reported-by: Nikita Glukhov  
Discussion: https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru  
Author: Nikita Glukhov  
Reviewed-by: Alexander Korotkov  
Backpatch-through: 9.4  

M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/access/index/indexam.c
M src/backend/access/spgist/spgscan.c
M src/include/access/genam.h
M src/include/access/gist_private.h
M src/include/access/spgist_private.h
M src/test/regress/expected/create_index_spgist.out
M src/test/regress/sql/create_index_spgist.sql
M src/tools/pgindent/typedefs.list

Doc: improve documentation around jsonpath regular expressions.

commit   : 0a97edb12ec44f8d2d8828cbca6dd7639408ac88    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Sep 2019 11:22:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Sep 2019 11:22:21 -0400    

Click here for diff

Provide some documentation about the differences between XQuery  
regular expressions and those supported by Spencer's regex engine.  
Since SQL now exposes XQuery regexps with the LIKE_REGEX operator,  
I made this a standalone section designed to help somebody who  
has to translate a LIKE_REGEX query to Postgres.  (Eventually we might  
extend Spencer's engine to allow precise implementation of XQuery,  
but not today.)  
  
Reference that in the jsonpath docs, provide definitions of the  
XQuery flag letters, and add a description of the JavaScript-inspired  
string literal syntax used within jsonpath.  Also point out explicitly  
that backslashes used within like_regex patterns will need to be doubled.  
  
This also syncs the docs with the decision implemented in commit  
d5b90cd64 to desupport XQuery's 'x' flag for now.  
  
Jonathan Katz and Tom Lane  
  
Discussion: https://postgr.es/m/CAPpHfdvDci4iqNF9fhRkTqhe-5_8HmzeLt56drH%[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

GSSAPI error message improvements

commit   : e1c8743e6ccd262df84fa2d80bf21d72115ac0d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 15:03:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 15:03:23 +0200    

Click here for diff

Make the error messages around GSSAPI encryption a bit clearer.  Tweak  
some messages to avoid plural problems.  
  
Also make a code change for clarity.  Using "conf" for "confidential"  
is quite confusing.  Using "conf_state" is perhaps not much better but  
that's what the GSSAPI documentation uses, so there is at least some  
hope of understanding it.  

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

Fix typo in commit 578b229718.

commit   : 70377cf4c6bf4eb4b2d1209752a300d5f3571145    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 Sep 2019 14:40:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 Sep 2019 14:40:09 +0530    

Click here for diff

Reported-by: Filip Rembiałkowski  
Author: Filip Rembiałkowski  
Backpatch-through: 12, where it was introduced  
Discussion: https://postgr.es/m/CAP_rwwmSNy1=_82rwGe3-X4PjWqPSFXtzNf43DCtGzD7SazdXA@mail.gmail.com  

M doc/src/sgml/ref/create_table_as.sgml

Revert change of ecpglib major version

commit   : 74f2a8aa27cb7bd2dbab3ed58e6b5c239a6b4a31    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 09:02:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 09:02:41 +0200    

Click here for diff

The major version of ecpglib was changed in  
bd7c95f0c1a38becffceb3ea7234d57167f6d4bf, apparently without  
justification.  Revert this, since nothing has changed in this library  
except some added functions.  
  
Discussion: https://www.postgresql.org/message-id/flat/48ee4c56-e1df-b39d-2cad-c7d80b120eb5%402ndquadrant.com  

M src/interfaces/ecpg/ecpglib/Makefile

Doc: Fix incorrect mention to connection_object in CONNECT command of ECPG

commit   : bec847d9e946ab6e05a2884e524c3cc8c52feebb    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Sep 2019 13:18:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Sep 2019 13:18:53 +0900    

Click here for diff

This fixes an inconsistency with this parameter name not listed in the  
command synopsis, and connection_name is the parameter name more  
commonly used in the docs for ECPG commands.  
  
Reported-by: Yusuke Egashita  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/ecpg.sgml

Doc: document autovacuum interruption.

commit   : 82fa3ff867219a212a467317a77011df29cb5903    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 Sep 2019 08:02:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 Sep 2019 08:02:12 +0530    

Click here for diff

It's important users be able to know (without looking at the source code)  
that running DDL or DDL-like commands can interrupt autovacuum which can  
lead to a lot of dead tuples and hence slower database operations.  
  
Reported-by: James Coleman  
Author: James Coleman  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/CAAaqYe-XYyNwML1=f=gnd0qWg46PnvD=BDrCZ5-L94B887XVxQ@mail.gmail.com  

M doc/src/sgml/maintenance.sgml

Redesign pageinspect function printing infomask bits

commit   : 58b4cb30a5bf52d71a4d0e5f9f7e1da3e64f67cc    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Sep 2019 11:01:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Sep 2019 11:01:52 +0900    

Click here for diff

After more discussion, the new function added by ddbd5d8 could have been  
designed in a better way.  Based on an idea from Álvaro, instead of  
returning one column which includes both the raw and combined flags, use  
two columns, with one for the raw flags and one for the combined flags.  
  
This also takes care of some issues with HEAP_LOCKED_UPGRADED and  
HEAP_XMAX_IS_LOCKED_ONLY which are not really combined flags as they  
depend on conditions defined by other raw bits, as mentioned by Amit.  
  
While on it, fix an extra issue with combined flags.  A combined flag  
was returned if at least one of its bits was set, but all its bits need  
to be set to include it in the result.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/pageinspect–1.7–1.8.sql
M contrib/pageinspect/sql/page.sql
M doc/src/sgml/pageinspect.sgml

Fix example program in docs too (??)

commit   : 59354ccef5d7671bb11982628d6ddd6fffbad2c4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Sep 2019 16:50:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Sep 2019 16:50:20 -0300    

Click here for diff

Fixup for previous commit: actually, the complete source for  
testlibpq3.c appears in SGML docs, so we need to patch that also.  
Go figure.  

M doc/src/sgml/libpq.sgml
M src/test/examples/testlibpq3.c

Fix testlibpq3

commit   : 9b8e99e905097e104c295bff1c47b6c0d652efdb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Sep 2019 16:29:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Sep 2019 16:29:55 -0300    

Click here for diff

The sample output assumes non-standard-conforming interpretation of  
backslashes in input literals, so the actual output didn't match.  
  
Noticed while perusing another patch that touches this file.  
  
Evidently this code is seldom checked, so I'm not going to bother  
backpatching this fix.  

M src/test/examples/testlibpq3.c
M src/test/examples/testlibpq3.sql

pg_upgrade/test.sh: Quote sed(1) argument

commit   : 32200c19dd8f084956d90e3c2cb5c2b8a8b90dfa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Sep 2019 11:24:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Sep 2019 11:24:12 -0300    

Click here for diff

Lack of quotes results in failure to run the test under older Solaris.  
  
Author: Marina Polyakova, Victor Wagner  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Remove unused smgrdounlinkfork() function.

commit   : 33a94bae605edf3ceda6751916f0b1af3e88630a    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 18 Sep 2019 21:05:33 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 18 Sep 2019 21:05:33 +0900    

Click here for diff

smgrdounlinkfork() became dead code as the result of commit ece01aae47,  
but it was left in place just in case we want it someday. However no users  
have appeared in 7 years, so it's time to remove this unused function.  
  
Author: Kirk Jamison  
Discussion: https://www.postgresql.org/message-id/D09B13F772D2274BB348A310EE3027C64E2067@g01jpexmbkw24  

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

Doc: Update FDW documentation about direct foreign table modification.

commit   : f9f2fda79658cc8f898c6fa7ba6da9a1f394cdee    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 18 Sep 2019 18:50:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 18 Sep 2019 18:50:00 +0900    

Click here for diff

1. Commit 7086be6e3 should have documented the limitation that the direct  
   modification is disabled when WCO constraints are present, but didn't,  
   which is definitely my fault.  Update the documentation (Postgres 9.6  
   onwards).  
  
2. Commit fc22b6623 should have documented the limitation that the direct  
   modification is disabled when generated columns are defined, but  
   didn't.  Update the documentation (Postgres 12 onwards).  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/CAPmGK14AYCPunLb6TRz1CQsW5Le01Z2ox8LSOKH0P-cOVDcQRA%40mail.gmail.com  

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

Add some const decorations to array constants

commit   : 48770492c3b796b251112fa9b74534f087c9f471    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Sep 2019 22:03:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Sep 2019 22:03:00 +0200    

Click here for diff

Author: Mark G <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAEeOP_YFVeFjq4zDZLDQbLSRFxBiTpwBQHxCNgGd%2Bp5VztTXyQ%40mail.gmail.com  

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

Fix bogus handling of XQuery regex option flags.

commit   : d5b90cd648558a4fd714b1396176ddb028ec28fc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Sep 2019 15:39:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Sep 2019 15:39:51 -0400    

Click here for diff

The SQL spec defers to XQuery to define what the option flags are  
for LIKE_REGEX patterns.  XQuery says that:  
* 's' allows the dot character to match newlines, which by  
  default it will not;  
* 'm' allows ^ and $ to match at newlines, not only at the  
  start/end of the whole string.  
Thus, these are *not* inverses as they are for the similarly-named  
POSIX options, and neither one corresponds to the POSIX 'n' option.  
Fortunately, Spencer's library does expose these two behaviors as  
separately twiddlable flags, so we just have to fix the mapping from  
JSP flag bits to REG flag bits.  I also chose to rename the symbol  
for 's' to DOTALL, to make it clearer that it's not the inverse  
of MLINE.  
  
Also, XQuery says that if the 'q' flag "is used together with the m, s,  
or x flag, that flag has no effect".  I read this as saying that 'q'  
overrides the other flags; whoever wrote our code seems to have read  
it backwards.  
  
Lastly, while XQuery's 'x' flag is related to what Spencer's code  
does for REG_EXPANDED, it's not the same or a subset.  It seems best  
to treat XQuery's 'x' as unimplemented for now.  Maybe later we can  
expand our regex code to offer 'x'-style parsing as a separate option.  
  
While at it, refactor the jsonpath code so that (a) there's only  
one copy of the flag transformation logic not two, and (b) the  
processing of flags is independent of the order in which the flags  
are written.  
  
We need some documentation updates to go with this, but I'll  
tackle that separately.  
  
Back-patch to v12 where this code originated.  
  
Discussion: https://postgr.es/m/CAPpHfdvDci4iqNF9fhRkTqhe-5_8HmzeLt56drH%[email protected]  
Reference: https://www.w3.org/TR/2017/REC-xpath-functions-31-20170321/#flags  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql

Remove mingwcompat.c

commit   : a25221f53c7960e00484c801f10d2e989b75a7f2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Sep 2019 11:32:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Sep 2019 11:32:33 +0200    

Click here for diff

We believe that the issues that this was working around have been  
fixed in MinGW more than 5 years ago, so this isn't necessary anymore.  
  
Discussion: https://www.postgresql.org/message-id/flat/20190719050830.GK1859%40paquier.xyz  

M src/backend/port/win32/Makefile
D src/backend/port/win32/mingwcompat.c

Support for SSSSS datetime format pattern

commit   : b64b857f50fb51da1588c54a56f8fc1c0d491058    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 16 Sep 2019 21:02:32 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 16 Sep 2019 21:02:32 +0300    

Click here for diff

SQL Standard 2016 defines SSSSS format pattern for seconds past midnight in  
jsonpath .datetime() method and CAST (... FORMAT ...) SQL clause.  In our  
datetime parsing engine we currently support it with SSSS name.  
  
This commit adds SSSSS as an alias for SSSS.  Alias is added in favor of  
upcoming jsonpath .datetime() method.  But it's also supported in to_date()/  
to_timestamp() as positive side effect.  
  
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com  
Author: Nikita Glukhov, Alexander Korotkov  
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/formatting.c
M src/test/regress/expected/horology.out
M src/test/regress/sql/horology.sql

Support for FF1-FF6 datetime format patterns

commit   : d589f94460c24d9b7ac21887d031818d6e3f354d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 16 Sep 2019 21:02:14 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 16 Sep 2019 21:02:14 +0300    

Click here for diff

SQL Standard 2016 defines FF1-FF9 format patters for fractions of seconds in  
jsonpath .datetime() method and CAST (... FORMAT ...) SQL clause.  Parsing  
engine of upcoming .datetime() method will be shared with to_date()/  
to_timestamp().  
  
This patch implements FF1-FF6 format patterns for upcoming jsonpath .datetime()  
method.  to_date()/to_timestamp() functions will also get support of this  
format patterns as positive side effect.  FF7-FF9 are not supported due to  
lack of precision in our internal timestamp representation.  
  
Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.  
Heavily revised by me.  
  
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com  
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com  
Author: Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov  
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/datetime.h
M src/test/regress/expected/horology.out
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/horology.sql
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Fix bogus sizeof calculations.

commit   : d8122578098d3ff20a9a12d25807e56cecac673c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Sep 2019 11:51:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Sep 2019 11:51:57 -0400    

Click here for diff

Noted by Coverity.  Typo in 27cc7cd2b, so back-patch to v12  
as that was.  

M src/backend/executor/execMain.c

Fix intermittent self-test failures caused by the stats_ext test.

commit   : 3d9a3ef5cbfc70bd2802c3f0da3fbc4e5abdf377    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 15 Sep 2019 13:13:59 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 15 Sep 2019 13:13:59 +0100    

Click here for diff

Commit d7f8d26d9 added new tests to the stats_ext regression test that  
included creating a view in the public schema, without realising that  
the stats_ext test runs in the same parallel group as the rules test,  
which makes doing that unsafe.  
  
This led to intermittent failures of the rules test on the buildfarm,  
although I wasn't able to reproduce that locally. Fix by creating the  
view in a different schema.  
  
Tomas Vondra and Dean Rasheed, report and diagnosis by Thomas Munro.  
  
Discussion: https://postgr.es/m/CA+hUKGKX9hFZrYA7rQzAMRE07L4hziCc-nO_b3taJpiuKyLLxg@mail.gmail.com  

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

Revert "For all ppc compilers, implement pg_atomic_fetch_add_ with inline asm."

commit   : 87e9fae0696d9e3ff70a1438775ad9f786b854a5    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 14 Sep 2019 19:38:41 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 14 Sep 2019 19:38:41 -0700    

Click here for diff

This reverts commit e7ff59686eacf5021fb84be921116986c3828d8a.  It  
defined pg_atomic_fetch_add_u32_impl() without defining  
pg_atomic_compare_exchange_u32_impl(), which is incompatible with  
src/include/port/atomics/fallback.h.  Per buildfarm member prairiedog.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/generic-xlc.h

For all ppc compilers, implement pg_atomic_fetch_add_ with inline asm.

commit   : e7ff59686eacf5021fb84be921116986c3828d8a    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:34:30 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:34:30 -0700    

Click here for diff

This is more like how we handle s_lock.h and arch-x86.h.  This does not  
materially affect code generation for gcc 7.2.0 or xlc 13.1.3.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/generic-xlc.h

Replace xlc __fetch_and_add() with inline asm.

commit   : dd50f1a43290bb3c67e24e808d4d8656e9532c9a    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:34:06 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:34:06 -0700    

Click here for diff

PostgreSQL has been unusable when built with xlc 13 and newer, which are  
incompatible with our use of __fetch_and_add().  Back-patch to 9.5,  
which introduced pg_atomic_fetch_add_u32().  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port/atomics/generic-xlc.h

Test pg_atomic_fetch_add_ with variable addend and 16-bit edge cases.

commit   : f380c5190134a4e928bf30a4ff9fec775cdcc692    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:33:30 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:33:30 -0700    

Click here for diff

Back-patch to 9.5, which introduced these functions.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/regress.c

Make tuplesort_set_bound() assertions more comprehensible, hopefully.

commit   : b360e0fcd7dcffe3238187209911a6f523057b0c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Sep 2019 16:56:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Sep 2019 16:56:58 -0400    

Click here for diff

Add the comments that I griped were missing.  Also re-order tests  
so that parallelism-related tests aren't randomly separated from  
each other.  
  
Discussion: https://postgr.es/m/CAAaqYe9GD__4Crm=ddz+-XXcNhfY_V5gFYdLdmkFNq=2VHO56Q@mail.gmail.com  

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

logical decoding: process ASSIGNMENT during snapshot build

commit   : bac2fae05c7737530a6fe8276cd27d210d25c6ac    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 16:36:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 16:36:28 -0300    

Click here for diff

Most WAL records are ignored in early SnapBuild snapshot build phases.  
But it's critical to process some of them, so that later messages have  
the correct transaction state after the snapshot is completely built; in  
particular, XLOG_XACT_ASSIGNMENT messages are critical in order for  
sub-transactions to be correctly assigned to their parent transactions,  
or at least one assert misbehaves, as reported by Ildar Musin.  
  
Diagnosed-by: Masahiko Sawada  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAONYFtOv+Er1p3WAuwUsy1zsCFrSYvpHLhapC_fMD-zNaRWxYg@mail.gmail.com  

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

Fix under-parenthesized macro definitions

commit   : ce5d04b6463d9f642e30d1f6abf45846e1255be0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 16:26:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 16:26:55 -0300    

Click here for diff

Lack of parens in the definitions could cause a statement using these  
macros to have unexpected semantics.  In current code no bug is  
apparent, but best to fix the definitions to avoid problems down the  
line.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/include/nodes/parsenodes.h

Fix progress reporting of CLUSTER / VACUUM FULL

commit   : 6212276e4343f729b0152e81824f850d1a21d57e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 14:51:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 14:51:13 -0300    

Click here for diff

The progress state was being clobbered once the first index completed  
being rebuilt, causing the final phases of the operation not show  
anything in the progress view.  This was inadvertently broken in  
03f9e5cba0ee, which added progress tracking for REINDEX.  
  
(The reason this bugfix is this small is that I had already noticed this  
problem when writing monitoring for CREATE INDEX, and had already worked  
around it, as can be seen in discussion starting at  
https://postgr.es/m/[email protected] Fixing the  
problem is just a matter of fixing one place touched by the REINDEX  
monitoring.)  
  
Reported by: Álvaro Herrera  
Author: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/include/nodes/parsenodes.h

Typo fixes for documentation

commit   : eb57bd9c1d83a20eaff559a53b2f584dcd0668a8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 13 Sep 2019 17:21:20 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 13 Sep 2019 17:21:20 +0300    

Click here for diff

Discussion: https://postgr.es/m/CAEkD-mDUZrRE%3Dk-FznEg4Ed2VdjpZCyHoyo%2Bp0%2B8KvHqR%3DpNVQ%40mail.gmail.com  
Author: Liudmila Mantrova, Alexander Lakhin  
Reviewed-by: Alexander Korotkov, Alvaro Herrera  
Backpatch-through: 12  

M doc/src/sgml/charset.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml

Documentation improvements to jsonpath

commit   : c30fc9ddd596f7981555318d1c236fc55279cac8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 13 Sep 2019 17:12:20 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 13 Sep 2019 17:12:20 +0300    

Click here for diff

Besides cosmetic improvements it removes statement that operators necessary  
need to be separated from operands with spaces, which is not really true.  
  
Discussion: https://postgr.es/m/CAEkD-mDUZrRE%3Dk-FznEg4Ed2VdjpZCyHoyo%2Bp0%2B8KvHqR%3DpNVQ%40mail.gmail.com  
Author: Liudmila Mantrova, Alexander Lakhin  
Reviewed-by: Alexander Korotkov, Alvaro Herrera  
Backpatch-through: 12  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

Add tab completion for CREATE OR REPLACE in psql.

commit   : fc16778873d081b07930d642622ee0cf22c3f9b7    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 13 Sep 2019 18:16:40 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 13 Sep 2019 18:16:40 +0900    

Click here for diff

Author: Shenhao Wang  
Discussion: https://postgr.es/m/63580B24E208E3429D94153A03C68E0901AA8002D5@G08CNEXMBPEKD02.g08.fujitsu.local  

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

Fix nbtree page split rmgr desc routine.

commit   : 3b6b54f178d7539354064727cca9b4ff2eca0fce    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 12 Sep 2019 15:45:08 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 12 Sep 2019 15:45:08 -0700    

Click here for diff

Include newitemoff in rmgr desc output for nbtree page split records.  
In passing, correct an obsolete comment that claimed that newitemoff is  
only logged for _L variant nbtree page split WAL records.  
  
Both issues were oversights in commit 2c03216d831, which revamped the  
WAL format.  
  
Author: Peter Geoghegan  
Backpatch: 9.5-, where the WAL format was revamped.  

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

Fix usage of whole-row variables in WCO and RLS policy expressions.

commit   : 7f1f72c44400e6fef3436b05f1ad0f6bacd03d96    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Sep 2019 18:29:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Sep 2019 18:29:17 -0400    

Click here for diff

Since WITH CHECK OPTION was introduced, ExecInitModifyTable has  
initialized WCO expressions with the wrong plan node as parent -- that is,  
it passed its input subplan not the ModifyTable node itself.  Up to now  
we thought this was harmless, but bug #16006 from Vinay Banakar shows it's  
not: if the input node is a SubqueryScan then ExecInitWholeRowVar can get  
confused into doing the wrong thing.  (The fact that ExecInitWholeRowVar  
contains such logic is certainly a horrid kluge that doesn't deserve to  
live, but figuring out another way to do that is a task for some other day.)  
  
Andres had already noticed the wrong-parent mistake and fixed it in commit  
148e632c0, but not being aware of any user-visible consequences, he quite  
reasonably didn't back-patch.  This patch is simply a back-patch of  
148e632c0, plus addition of a test case based on bug #16006.  I also added  
the test case to v12/HEAD, even though the bug is already fixed there.  
  
Back-patch to all supported branches.  9.4 lacks RLS policies so the  
new test case doesn't work there, but I'm pretty sure a test could be  
devised based on using a whole-row Var in a plain WITH CHECK OPTION  
condition.  (I lack the cycles to do so myself, though.)  
  
Andres Freund and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Reorder two nbtree.h function prototypes.

commit   : 614cdeaa8908f69ab0b97b688e9785147575c01f    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 12 Sep 2019 09:59:16 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 12 Sep 2019 09:59:16 -0700    

Click here for diff

Make the function prototype order consistent with the definition order  
in nbtinsert.c.  

M src/include/access/nbtree.h

Remove redundant _bt_truncate() comment paragraph.

commit   : 1b9becd43ccb7d48243882c021738c60d32c55aa    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 12 Sep 2019 09:51:27 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 12 Sep 2019 09:51:27 -0700    

Click here for diff

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

Merge two assertions to make comment clearer

commit   : bc98e1ea64627183746ecffcb957db147038134e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Sep 2019 10:34:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Sep 2019 10:34:50 -0300    

Click here for diff

Authored by Tom Lane, after a gripe from James Coleman.  
  
Discussion: https://postgr.es/m/CAAaqYe9GD__4Crm=ddz+-XXcNhfY_V5gFYdLdmkFNq=2VHO56Q@mail.gmail.com  

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

Doc: Update PL/pgSQL sample function in plpgsql.sgml.

commit   : 9b3c8f07ff3f7938696723405dc9c7b43dde4252    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 11 Sep 2019 10:25:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 11 Sep 2019 10:25:49 +0530    

Click here for diff

The example used to explain 'Looping Through Query Results' uses  
pseudo-materialized views.  Replace it with a more up-to-date example  
which does the same thing with actual materialized views, which have  
been available since PostgreSQL 9.3.  
  
In the passing, change '%' as format specifier instead of '%s' as is used  
in other examples in plpgsql.sgml.  
  
Reported-by: Ian Barwick  
Author: Ian Barwick  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml

Add to pageinspect function to make t_infomask/t_infomask2 human-readable

commit   : ddbd5d8731619ad3ab47ce325e8605422297a613    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Sep 2019 15:06:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Sep 2019 15:06:00 +0900    

Click here for diff

Flags of t_infomask and t_infomask2 for each tuple are already included  
in the information returned by heap_page_items as integers, and we  
lacked a way to make that information human-readable.  
  
Per discussion, the function includes an option which controls if  
combined flags should be decomposed or not.  The default is false, to  
not decompose combined flags.  
  
The module is bumped to version 1.8.  
  
Author: Craig Ringer, Sawada Masahiko  
Reviewed-by: Peter Geoghegan, Robert Haas, Álvaro Herrera, Moon Insung,  
Amit Kapila, Michael Paquier, Tomas Vondra  
Discussion: https://postgr.es/m/CAMsr+YEY7jeaXOb+oX+RhDyOFuTMdmHjGsBxL=igCm03J0go9Q@mail.gmail.com  

M contrib/pageinspect/Makefile
M contrib/pageinspect/expected/page.out
M contrib/pageinspect/heapfuncs.c
A contrib/pageinspect/pageinspect–1.7–1.8.sql
M contrib/pageinspect/pageinspect.control
M contrib/pageinspect/sql/page.sql
M doc/src/sgml/pageinspect.sgml

Improve coverage of psql for backslash commands with \if and \elif

commit   : aafe2762b152ffd4cb839d2a01df6cfcc3c6df6c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Sep 2019 10:35:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Sep 2019 10:35:13 +0900    

Click here for diff

This adds tests to cover more code paths to ignore backslash commands in  
false branches when using \if|\elif|\else, and improves the coverage of  
\elif.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1908281618520.28828@lancre  

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

Rearrange postmaster's startup sequence for better syslogger results.

commit   : 9a86f03b4e8c8f16eca7faebcb4a46330e431102    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Sep 2019 11:43:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Sep 2019 11:43:01 -0400    

Click here for diff

This is a second try at what commit 57431a911 tried to do, namely,  
launch the syslogger before we open postmaster sockets so that our  
messages about the sockets end up in the syslogger files.  That  
commit fell foul of a bunch of subtle issues caused by trying to  
launch a postmaster child process before creating shared memory.  
Rather than messing with that interaction, let's postpone opening  
the sockets till after we launch the syslogger.  
  
This would not have been terribly safe before commit 7de19fbc0,  
because we relied on socket opening to detect whether any competing  
postmasters were using the same port number.  But now that we choose  
IPC keys without regard to the port number, there's no interaction  
to worry about.  
  
Also delay creation of the external PID file (if requested) till after  
the sockets are open, since external code could plausibly be relying  
on that ordering of events.  And postpone most of the work of  
RemovePgTempFiles() so that that potentially-slow processing still  
happens after we make the external PID file.  We have to be a bit  
careful about that last though: as noted in the discussion subsequent to  
bug #15804, EXEC_BACKEND builds still have to clear the parameter-file  
temp dir before launching the syslogger.  
  
Patch by me; thanks to Michael Paquier for review/testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c
M src/backend/storage/file/fd.c
M src/include/storage/fd.h
M src/include/utils/pidfile.h

libpq docs: be clearer about conninfo's 'hostaddr'

commit   : 75f46eaee20c38b2a04f569e8a5fed4f63091bd3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Sep 2019 10:15:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Sep 2019 10:15:23 -0300    

Click here for diff

The previous wording was a bit too terse, too vague on the subject of  
'host' and 'hostaddr' in connection specifications, which has caused  
people to waste time trying to conform to rules because of  
misunderstanding the whole thing; this small change should make things  
clearer.  
  
Author: Robert Haas, stemming from Fabien Coelho's complaints  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1808201323020.13832@lancre  

M doc/src/sgml/libpq.sgml

Fix comment in psql's describe.c

commit   : 8a0deae8d9b6861265cf4ebf25a9e4385f4c7672    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Sep 2019 15:17:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Sep 2019 15:17:35 +0900    

Click here for diff

Procedures are supported since v11 and \dfp can be used since this  
version, but it was not mentioned as a supported option in the  
description of describeFunctions() which handles \df in psql.  
  
Extracted from a larger patch.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1908281618520.28828@lancre  

M src/bin/psql/describe.c

Expand properly list of TAP tests used for prove in vcregress.pl

commit   : 9d6e1ec5ceed1b7871fc2afd68898f0e876b60b9    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Sep 2019 11:07:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Sep 2019 11:07:18 +0900    

Click here for diff

Depending on the system used, t/*.pl may not be expanded into a list of  
tests which can be consumed by prove when attempting to run TAP tests on  
a given path.  Fix that by using glob() directly in the script, to make  
sure that a complete list of tests is provided.  This has not proved to  
be an issue with MSVC as the list was properly expanded, but it is on  
Linux with perl's system().  
  
This is extracted from a larger patch.  
  
Author: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M src/tools/msvc/vcregress.pl

Allow setting statistics target for extended statistics

commit   : d06215d03b50c264a0f31e335b895ee1b6753e68    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 10 Sep 2019 20:09:27 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 10 Sep 2019 20:09:27 +0200    

Click here for diff

When building statistics, we need to decide how many rows to sample and  
how accurate the resulting statistics should be. Until now, it was not  
possible to explicitly define statistics target for extended statistics  
objects, the value was always computed from the per-attribute targets  
with a fallback to the system-wide default statistics target.  
  
That's a bit inconvenient, as it ties together the statistics target set  
for per-column and extended statistics. In some cases it may be useful  
to require larger sample / higher accuracy for extended statics (or the  
other way around), but with this approach that's not possible.  
  
So this commit introduces a new command, allowing to specify statistics  
target for individual extended statistics objects, overriding the value  
derived from per-attribute targets (and the system default).  
  
  ALTER STATISTICS stat_name SET STATISTICS target_value;  
  
When determining statistics target for an extended statistics object we  
first look at this explicitly set value. When this value is -1, we fall  
back to the old formula, looking at the per-attribute targets first and  
then the system default. This means the behavior is backwards compatible  
with older PostgreSQL releases.  
  
Author: Tomas Vondra  
Discussion: https://postgr.es/m/20190618213357.vli3i23vpkset2xd@development  
Reviewed-by: Kirk Jamison, Dean Rasheed  

M doc/src/sgml/ref/alter_statistics.sgml
M src/backend/commands/analyze.c
M src/backend/commands/statscmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/tcop/utility.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/tab-complete.c
M src/include/catalog/pg_statistic_ext.h
M src/include/commands/defrem.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Reduce overhead of scanning the backend[] array in LISTEN/NOTIFY.

commit   : bca6e64354a2b8ed56751eb12bbf9429490c0811    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Sep 2019 18:15:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Sep 2019 18:15:17 -0400    

Click here for diff

Up to now, async.c scanned its whole array of per-backend state  
whenever it needed to find listening backends.  That's expensive  
if MaxBackends is large, so extend the data structure with list  
links that thread the active entries together.  
  
A downside of this change is that asyncQueueUnregister (unregister  
a listening backend at backend exit) now requires exclusive not shared  
lock, and it can take awhile if there are many other listening  
backends.  We could improve the latter issue by using a doubly- not  
singly-linked list, but it's probably not worth the storage space;  
typical usage patterns for LISTEN/NOTIFY have fairly long-lived  
listeners.  
  
In return for that, Exec_ListenPreCommit (initially register a  
listening backend), SignalBackends, and asyncQueueAdvanceTail  
get significantly faster when MaxBackends is much larger than  
the number of listening backends.  If most of the potential  
backend slots are listening, we don't win, but that's a case  
where the actual interprocess-signal overhead is going to swamp  
these considerations anyway.  
  
Martijn van Oosterhout, hacked a bit more by me  
  
Discussion: https://postgr.es/m/CADWG95vtRBFDdrx1JdT1_9nhOFw48KaeTev6F_LtDQAFVpSPhA@mail.gmail.com  

M src/backend/commands/async.c

Fix unaccent generation script in Windows

commit   : 0afc0a7841889c6221fd47430e72f4fe570833f4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Sep 2019 17:56:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Sep 2019 17:56:11 -0300    

Click here for diff

As originally coded, the script would fail on Windows 10 and Python 3  
because stdout would not be switched to UTF-8 only for Python 2.  This  
patch makes that apply to both versions.  
  
Also add python 2 compatibility markers so that we know what to remove  
once we drop support for that.  Also use a "with" clause to ensure file  
descriptor is closed promptly.  
  
Author: Hugh Ranalli, Ramanarayana  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CAKm4Xs7_61XMyOWmHs3n0mmkS0O4S0pvfWk=7cQ5P0gs177f7A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M contrib/unaccent/generate_unaccent_rules.py

Restructure libpq code to remove some duplicity

commit   : b438e7e7a1c58e0c20b5f46e73cbd713e8033c69    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Sep 2019 12:13:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Sep 2019 12:13:29 -0300    

Click here for diff

There was some duplicate code to run SHOW transaction_read_only to  
determine whether the server is read-write or read-only.  Reduce it by  
adding another state to the state machine.  
  
Author: Hari Babu Kommi  
Reviewed-by: Takayuki Tsunakawa, Álvaro Herrera  
Discussion: https://postgr.es/m/CAJrrPGe_qgdbbN+yBgEVpd+YLHXXjTruzk6RmTMhqrFig+32ag@mail.gmail.com  

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

Add _bt_binsrch() scantid assertion to nbtree.

commit   : 55d015bde05311cbaaf16424e3aa05c37946cd8a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 9 Sep 2019 11:41:19 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 9 Sep 2019 11:41:19 -0700    

Click here for diff

Assert that _bt_binsrch() binary searches with scantid set in insertion  
scankey cannot be performed on leaf pages.  Leaf-level binary searches  
where scantid is set must use _bt_binsrch_insert() instead.  
  
_bt_binsrch_insert() is likely to have additional responsibilities in  
the future, such as searching within GIN-style posting lists using  
scantid.  It seems like a good idea to tighten things up now.  

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

Be more careful about port selection in src/test/ldap/.

commit   : 3146f5257f16d34c95163974f42a13d99141b977    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Sep 2019 14:21:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Sep 2019 14:21:40 -0400    

Click here for diff

Don't just assume that the next port is free; it might not be, or  
if we're really unlucky it might even be out of the TCP range.  
Do it honestly with two get_free_port() calls instead.  
  
This is surely a pretty low-probability problem, but I think it  
explains a buildfarm failure seen today, so let's fix it.  
  
Back-patch to v11 where this script was added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Prevent msys2 conversion of "cmd /c" switch to a file path

commit   : 73ff3a0abbbcb2c623731b88f2d1334bc67e5820    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 9 Sep 2019 08:56:33 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 9 Sep 2019 08:56:33 -0400    

Click here for diff

Modern versions of msys2 have changed the treatment of "cmd /c" so that  
the runtime will try to convert the switch to a native file path. This  
patch adds a setting to inhibit that behaviour.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to all live branches.  

M src/bin/pg_upgrade/test.sh

commit   : 27cc7cd2bc8a5e8efc8279bc5d2a8ae42fd8ad33    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 5 Sep 2019 13:00:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 5 Sep 2019 13:00:20 -0700    

Click here for diff

In ad0bda5d24ea I changed the EvalPlanQual machinery to store  
substitution tuples in slot, instead of using plain HeapTuples. The  
main motivation for that was that using HeapTuples will be inefficient  
for future tableams.  But it turns out that that conversion was buggy  
for non-locking rowmarks - the wrong tuple descriptor was used to  
create the slot.  
  
As a secondary issue 5db6df0c0 changed ExecLockRows() to begin EPQ  
earlier, to allow to fetch the locked rows directly into the EPQ  
slots, instead of having to copy tuples around. Unfortunately, as Tom  
complained, that forces some expensive initialization to happen  
earlier.  
  
As a third issue, the test coverage for EPQ was clearly insufficient.  
  
Fixing the first issue is unfortunately not trivial: Non-locked row  
marks were fetched at the start of EPQ, and we don't have the type  
information for the rowmarks available at that point. While we could  
change that, it's not easy. It might be worthwhile to change that at  
some point, but to fix this bug, it seems better to delay fetching  
non-locking rowmarks when they're actually needed, rather than  
eagerly. They're referenced at most once, and in cases where EPQ  
fails, might never be referenced. Fetching them when needed also  
increases locality a bit.  
  
To be able to fetch rowmarks during execution, rather than  
initialization, we need to be able to access the active EPQState, as  
that contains necessary data. To do so move EPQ related data from  
EState to EPQState, and, only for EStates creates as part of EPQ,  
reference the associated EPQState from EState.  
  
To fix the second issue, change EPQ initialization to allow use of  
EvalPlanQualSlot() to be used before EvalPlanQualBegin() (but  
obviously still requiring EvalPlanQualInit() to have been done).  
  
As these changes made struct EState harder to understand, e.g. by  
adding multiple EStates, significantly reorder the members, and add a  
lot more comments.  
  
Also add a few more EPQ tests, including one that fails for the first  
issue above. More is needed.  
  
Reported-By: yi huang  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion:  
    https://postgr.es/m/CAHU7rYZo_C4ULsAx_LAj8az9zqgrD8WDd4hTegDTMM1LMqrBsg@mail.gmail.com  
    https://postgr.es/m/[email protected]  
Backpatch: 12-, where the EPQ changes were introduced  

M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execScan.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Fix handling of non-key columns get_index_column_opclass()

commit   : 7e04160390464cd39690d36054e0ac5e4f1bf227    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 9 Sep 2019 13:50:12 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 9 Sep 2019 13:50:12 +0300    

Click here for diff

f2e40380 introduces support of non-key attributes in GiST indexes.  Then if  
get_index_column_opclass() is asked by gistproperty() to get an opclass of  
non-key column, it returns garbage past oidvector value.  This commit fixes  
that by making get_index_column_opclass() return InvalidOid in this case.  
  
Discussion: https://postgr.es/m/20190902231948.GA5343%40alvherre.pgsql  
Author: Nikita Glukhov, Alexander Korotkov  
Backpatch-through: 12  

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

Improve new AND CHAIN tests

commit   : 89b160c32045dd85cc6f9ae6248e34a72931ac67    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 Sep 2019 10:30:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 Sep 2019 10:30:22 +0200    

Click here for diff

Tweak the tests so that we're not just testing the default setting of  
transaction_read_only.  
  
Reported-by: fn ln <[email protected]>  

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

Fix RelationIdGetRelation calls that weren't bothering with error checks.

commit   : 1192e3fb54ce57f57399490d70af617ebc12605c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Sep 2019 17:00:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Sep 2019 17:00:29 -0400    

Click here for diff

Some of these are quite old, but that doesn't make them not bugs.  
We'd rather report a failure via elog than SIGSEGV.  
  
While at it, uniformly spell the error check as !RelationIsValid(rel)  
rather than a bare rel == NULL test.  The machine code is the same  
but it seems better to be consistent.  
  
Coverity complained about this today, not sure why, because the  
mistake is in fact old.  

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

Fix handling of NULL distances in KNN-GiST

commit   : 02f90879e75b3d4ccdba1ec7c3cad6af08dff77d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 8 Sep 2019 21:13:40 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 8 Sep 2019 21:13:40 +0300    

Click here for diff

In order to implement NULL LAST semantic GiST previously assumed distance to  
the NULL value to be Inf.  However, our distance functions can return Inf and  
NaN for non-null values.  In such cases, NULL LAST semantic appears to be  
broken.  This commit fixes that by introducing separate array of null flags for  
distances.  
  
Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/CAPpHfdsNvNdA0DBS%2BwMpFrgwT6C3-q50sFVGLSiuWnV3FqOJuQ%40mail.gmail.com  
Author: Alexander Korotkov  
Backpatch-through: 9.4  

M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/access/index/indexam.c
M src/backend/access/spgist/spgscan.c
M src/include/access/genam.h
M src/include/access/gist_private.h
M src/test/regress/expected/create_index.out

Fix handling Inf and Nan values in GiST pairing heap comparator

commit   : e5d8f3596100da0d38a38513c69e803b7fe7041a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 8 Sep 2019 21:07:30 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 8 Sep 2019 21:07:30 +0300    

Click here for diff

Previously plain float comparison was used in GiST pairing heap.  Such  
comparison doesn't provide proper ordering for value sets containing Inf and Nan  
values.  This commit fixes that by usage of float8_cmp_internal().  Note, there  
is remaining problem with NULL distances, which are represented as Inf in  
pairing heap.  It would be fixes in subsequent commit.  
  
Backpatch to all supported versions.  
  
Reported-by: Andrey Borodin  
Discussion: https://postgr.es/m/CAPpHfdsNvNdA0DBS%2BwMpFrgwT6C3-q50sFVGLSiuWnV3FqOJuQ%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Heikki Linnakangas  
Backpatch-through: 9.4  

M src/backend/access/gist/gistscan.c
M src/test/regress/expected/create_index.out

Fix behavior of AND CHAIN outside of explicit transaction blocks

commit   : 862ef372d6b23629f93d4afc123ddd7d172501ac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 16:11:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 16:11:21 +0200    

Click here for diff

When using COMMIT AND CHAIN or ROLLBACK AND CHAIN not in an explicit  
transaction block, the previous implementation would leave a  
transaction block active in the ROLLBACK case but not the COMMIT case.  
To fix for now, error out when using these commands not in an explicit  
transaction block.  This restriction could be lifted if a sensible  
definition and implementation is found.  
  
Bug: #15977  
Author: fn ln <[email protected]>  
Reviewed-by: Fabien COELHO <[email protected]>  

M doc/src/sgml/ref/commit.sgml
M doc/src/sgml/ref/rollback.sgml
M src/backend/access/transam/xact.c
M src/test/regress/expected/transactions.out
M src/test/regress/sql/transactions.sql

doc: effective -> efficient

commit   : 0e777462121bd5b892c1621903d1953a49437290    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 11:10:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 11:10:49 +0200    

Click here for diff

M doc/src/sgml/json.sgml

doc: Clean up title case use

commit   : 8e929a4667a1f4f97c5447f54b8176b0ee15aa7d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 10:26:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 10:26:35 +0200    

Click here for diff

Note: Following existing practice, titles of formalpara and step are  
not titlecased.  

M doc/src/sgml/amcheck.sgml
M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/intro.sgml
M doc/src/sgml/jit.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/limits.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtesttiming.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/sourcerepo.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/tablesample-method.sgml
M doc/src/sgml/xaggr.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xindex.sgml
M doc/src/sgml/xoper.sgml
M doc/src/sgml/xtypes.sgml

Avoid using INFO elevel for what are fundamentally debug messages.

commit   : db438318997b75f4b40c61258da56384039fa43f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Sep 2019 19:03:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Sep 2019 19:03:11 -0400    

Click here for diff

Commit 6f6b99d13 stuck an INFO message into the fast path for  
checking partition constraints, for no very good reason except  
that it made it easy for the regression tests to verify that  
that path was taken.  Assorted later patches did likewise,  
increasing the unsuppressable-chatter level from ALTER TABLE  
even more.  This isn't good for the user experience, so let's  
drop these messages down to DEBUG1 where they belong.  So as  
not to have a loss of test coverage, create a TAP test that  
runs the relevant queries with client_min_messages = DEBUG1  
and greps for the expected messages.  
  
This testing method is a bit brute-force --- in particular,  
it duplicates the execution of a fair amount of the core  
create_table and alter_table tests.  We experimented with  
other solutions, but running any significant amount of  
standard testing with client_min_messages = DEBUG1 seems  
to have a lot of output-stability pitfalls, cf commits  
bbb96c370 and 5655565c0.  Possibly at some point we'll look  
into whether we can reduce the amount of test duplication.  
  
Backpatch into v12, because some of these messages are new  
in v12 and we don't really want to ship it that way.  
  
Sergei Kornilov  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/partitioning/partbounds.c
M src/test/modules/Makefile
A src/test/modules/test_misc/.gitignore
A src/test/modules/test_misc/Makefile
A src/test/modules/test_misc/README
A src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/tools/msvc/Mkvcbuild.pm

Fix issues around strictness of SIMILAR TO.

commit   : ca70bdaefea5188066b3c2a6eaaaa1cb8cb8ce06    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Sep 2019 14:21:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Sep 2019 14:21:59 -0400    

Click here for diff

As a result of some long-ago quick hacks, the SIMILAR TO operator  
and the corresponding flavor of substring() interpreted "ESCAPE NULL"  
as selecting the default escape character '\'.  This is both  
surprising and not per spec: the standard is clear that these  
functions should return NULL for NULL input.  
  
Additionally, because of inconsistency of the strictness markings  
of 3-argument substring() and similar_escape(), the planner could not  
inline the SQL definition of substring(), resulting in a substantial  
performance penalty compared to the underlying POSIX substring()  
function.  
  
The simplest fix for this would be to change the strictness marking  
of similar_escape(), but if we do that we risk breaking existing views  
that depend on that function.  Hence, leave similar_escape() as-is  
as a compatibility function, and instead invent a new function  
similar_to_escape() that comes in two strict variants.  
  
There are a couple of other behaviors in this area that are also  
not per spec, but they are documented and seem generally at least  
as sane as the spec's definition, so leave them alone.  But improve  
the documentation to describe them fully.  
  
Patch by me; thanks to Álvaro Herrera and Andrew Gierth for review  
and discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/parser/gram.y
M src/backend/utils/adt/regexp.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

Message style fixes

commit   : c5bc7050aff1d1bba6532377fe37b351581661a8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 16:12:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 16:12:28 +0200    

Click here for diff

M src/bin/psql/command.c
M src/bin/psql/help.c
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/test/expected/sql-declare.stderr
M src/interfaces/libpq/fe-connect.c

doc: Fix awkward markup

commit   : 021da890bcc129a9a1a4d996304cf437553f0937    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 22:19:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 22:19:53 +0200    

Click here for diff

M doc/src/sgml/ref/pg_dumpall.sgml

doc: Postgres -> PostgreSQL

commit   : c57dbc19896cb5a15e53099765c64517afdbab14    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 22:16:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 22:16:58 +0200    

Click here for diff

M doc/src/sgml/bki.sgml
M doc/src/sgml/installation.sgml

Always skip recovery SysV shared memory tests on Windows

commit   : 8e5ce1c3f837a8b9a5210b7224cb5e5ac3bfc751    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 6 Sep 2019 15:47:23 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 6 Sep 2019 15:47:23 -0400    

Click here for diff

The test for SysV support currently involves looking for the perl  
modules IPC::SharedMem and IPC::SysV. However, the perl on msys2 has  
these modules but the tests fail. Therefore, force skipping the tests on  
Windows platforms unconditionally.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/017_shm.pl

Doc: tweak installation doc edits made by commit 76c2af926.

commit   : 71a01086603cc3a27c0d6ae60228aeb13c32d359    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Sep 2019 11:24:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Sep 2019 11:24:36 -0400    

Click here for diff

We don't consider that building with MinGW is deprecated,  
so adjust some places that gave that impression.  
Per discussion with Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml
M doc/src/sgml/standalone-install.xml

Create an API for inserting and deleting rows in TOAST tables.

commit   : bd124996ef0d655f96a7d4df79611707091f1585    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Sep 2019 10:38:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Sep 2019 10:38:51 -0400    

Click here for diff

This moves much of the non-heap-specific logic from toast_delete and  
toast_insert_or_update into a helper functions accessible via a new  
header, toast_helper.h.  Using the functions in this module, a table  
AM can implement creation and deletion of TOAST table rows with  
much less code duplication than was possible heretofore.  Some  
table AMs won't want to use the TOAST logic at all, but for those  
that do this will make that easier.  
  
Patch by me, reviewed and tested by Prabhat Sabu, Thomas Munro,  
Andres Freund, and Álvaro Herrera.  
  
Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com  

M src/backend/access/heap/heaptoast.c
M src/backend/access/table/Makefile
A src/backend/access/table/toast_helper.c
A src/include/access/toast_helper.h
M src/tools/pgindent/typedefs.list

When performing a base backup, check for read errors.

commit   : 286af0ce12117bc673b97df6228d1a666594d247    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Sep 2019 08:22:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Sep 2019 08:22:32 -0400    

Click here for diff

The old code didn't differentiate between a read error and a  
concurrent truncation. fread reports both of these by returning 0;  
you have to use feof() or ferror() to distinguish between them,  
which this code did not do.  
  
It might be a better idea to use read() rather than fread() here,  
so that we can display a less-generic error message, but I'm not  
sure that would qualify as a back-patchable bug fix, so just do  
this much for now.  
  
Jeevan Chalke, reviewed by Jeevan Ladhe and by me.  
  
Discussion: http://postgr.es/m/CA+TgmobG4ywMzL5oQq2a8YKp8x2p3p1LOMMcGqpS7aekT9+ETA@mail.gmail.com  

M src/backend/replication/basebackup.c

libpq: ccache -> credential cache

commit   : 5599f40d259a275d3202b10aa6ffb9a36fd8a940    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 09:15:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 09:15:35 +0200    

Click here for diff

The term "ccache" is overloaded.  Let's be more clear, in case someone  
other than a Kerberos wizard has to read this code.  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h

Make pg_promote() detect postmaster death while waiting for promotion to end.

commit   : 946647f845d0b0762656a8e07055f501c4b29688    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 6 Sep 2019 14:27:25 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 6 Sep 2019 14:27:25 +0900    

Click here for diff

Previously even if postmaster died and WaitLatch() woke up with that event  
while pg_promote() was waiting for the standby promotion to finish,  
pg_promote() did nothing special and kept waiting until timeout occurred.  
This could cause a busy loop.  
  
This patch make pg_promote() return false immediately when postmaster  
dies, to avoid such a busy loop.  
  
Back-patch to v12 where pg_promote() was added.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwEs9ROgSp+QF+YdDU+xP8W=CY1k-_Ov-d_Z3JY+to3eXA@mail.gmail.com  

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

Make use of generic logging in vacuumlo and oid2name

commit   : fc8cb94bf451cd810ae5b1c1f90b977277247625    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 6 Sep 2019 14:00:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 6 Sep 2019 14:00:13 +0900    

Click here for diff

Doing the switch reduces the footprint of "progname" in both utilities  
for the messages produced.  This also cleans up a couple of  
inconsistencies in the message formats.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M contrib/oid2name/oid2name.c
M contrib/vacuumlo/vacuumlo.c

Use data directory inode number, not port, to select SysV resource keys.

commit   : 7de19fbc0b1a9172d0907017302b32846b2887b9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 Sep 2019 13:31:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 Sep 2019 13:31:41 -0400    

Click here for diff

This approach provides a much tighter binding between a data directory  
and the associated SysV shared memory block (and SysV or named-POSIX  
semaphores, if we're using those).  Key collisions are still possible,  
but only between data directories stored on different filesystems,  
so the situation should be negligible in practice.  More importantly,  
restarting the postmaster with a different port number no longer  
risks failing to identify a relevant shared memory block, even when  
postmaster.pid has been removed.  A standalone backend is likewise  
much more certain to detect conflicting leftover backends.  
  
(In the longer term, we might now think about deprecating the port as  
a cluster-wide value, so that one postmaster could support sockets  
with varying port numbers.  But that's for another day.)  
  
The hazards fixed here apply only on Unix systems; our Windows code  
paths already use identifiers derived from the data directory path  
name rather than the port.  
  
src/test/recovery/t/017_shm.pl, which intends to test key-collision  
cases, has been substantially rewritten since it can no longer use  
two postmasters with identical port numbers to trigger the case.  
Instead, use Perl's IPC::SharedMem module to create a conflicting  
shmem segment directly.  The test script will be skipped if that  
module is not available.  (This means that some older buildfarm  
members won't run it, but I don't think that that results in any  
meaningful coverage loss.)  
  
Patch by me; thanks to Noah Misch and Peter Eisentraut for discussion  
and review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/init/postinit.c
M src/include/storage/ipc.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/test/recovery/t/017_shm.pl

Split tuptoaster.c into three separate files.

commit   : 8b94dab06617ef80a0901ab103ebd8754427ef5a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 8 Jul 2019 11:58:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 8 Jul 2019 11:58:05 -0400    

Click here for diff

detoast.c/h contain functions required to detoast a datum, partially  
or completely, plus a few other utility functions for examining the  
size of toasted datums.  
  
toast_internals.c/h contain functions that are used internally to the  
TOAST subsystem but which (mostly) do not need to be accessed from  
outside.  
  
heaptoast.c/h contains code that is intrinsically specific to the  
heap AM, either because it operates on HeapTuples or is based on the  
layout of a heap page.  
  
detoast.c and toast_internals.c are placed in  
src/backend/access/common rather than src/backend/access/heap.  At  
present, both files still have dependencies on the heap, but that will  
be improved in a future commit.  
  
Patch by me, reviewed and tested by Prabhat Sabu, Thomas Munro,  
Andres Freund, and Álvaro Herrera.  
  
Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com  

M doc/src/sgml/storage.sgml
M src/backend/access/common/Makefile
A src/backend/access/common/detoast.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/reloptions.c
A src/backend/access/common/toast_internals.c
M src/backend/access/heap/Makefile
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
A src/backend/access/heap/heaptoast.c
M src/backend/access/heap/rewriteheap.c
D src/backend/access/heap/tuptoaster.c
M src/backend/access/transam/xlog.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execTuples.c
M src/backend/executor/tstoreReceiver.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/fmgr/fmgr.c
M src/bin/pg_resetwal/pg_resetwal.c
A src/include/access/detoast.h
R057 src/include/access/tuptoaster.h src/include/access/heaptoast.h
A src/include/access/toast_internals.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/regress.c

Use explicit_bzero

commit   : 74a308cf5221f491776fcdb4dc36eb61678dbc6f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Sep 2019 08:15:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Sep 2019 08:15:58 +0200    

Click here for diff

Use the explicit_bzero() function in places where it is important that  
security information such as passwords is cleared from memory.  There  
might be other places where it could be useful; this is just an  
initial collection.  
  
For platforms that don't have explicit_bzero(), provide various  
fallback implementations.  (explicit_bzero() itself isn't standard,  
but as Linux/glibc, FreeBSD, and OpenBSD have it, it's the most common  
spelling, so it makes sense to make that the invocation point.)  
  
Discussion: https://www.postgresql.org/message-id/flat/42d26bde-5d5b-c90d-87ae-6cab875f73be%402ndquadrant.com  

M configure
M configure.in
M src/backend/libpq/be-secure-common.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
M src/interfaces/libpq/fe-connect.c
A src/port/explicit_bzero.c
M src/tools/msvc/Mkvcbuild.pm

Fix thinko when ending progress report for a backend

commit   : ae060a52b2881ea842f596fa78b8d09f9a91b149    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Sep 2019 15:46:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Sep 2019 15:46:37 +0900    

Click here for diff

The logic ending progress reporting for a backend entry introduced by  
b6fb647 causes callers of pgstat_progress_end_command() to do some extra  
work when track_activities is enabled as the process fields are reset in  
the backend entry even if no command were started for reporting.  
  
This resets the fields only if a command is registered for progress  
reporting, and only if track_activities is enabled.  
  
Author: Masahiho Sawada  
Discussion: https://postgr.es/m/CAD21AoCry_vJ0E-m5oxJXGL3pnos-xYGCzF95rK5Bbi3Uf-rpA@mail.gmail.com  
Backpatch-through: 9.6  

M src/backend/postmaster/pgstat.c

Delay fsyncs of pg_basebackup until the end of backup

commit   : 522baf14847a7e4cc97c49c7b1c28d21bc33921f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Sep 2019 13:21:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Sep 2019 13:21:11 +0900    

Click here for diff

Since the addition of fsync requests in bc34223 to make base backup data  
consistent on disk once pg_basebackup finishes, each tablespace tar file  
is individually flushed once completed, with an additional flush of the  
parent directory when the base backup finishes.  While holding a  
connection to the server, a fsync request taking a long time may cause a  
failure of the base backup, which is annoying for any integration.  A  
recent example of breakage can involve tcp_user_timeout, but  
wal_sender_timeout can cause similar problems.  
  
While reviewing the code, there was a second issue causing too many  
fsync requests to be done for the same WAL data.  As recursive fsyncs  
are done at the end of the backup for both the plain and tar formats  
from the base target directory where everything is written, it is fine  
to disable fsyncs when fetching or streaming WAL.  
  
Reported-by: Ryohei Takahashi  
Author: Michael Paquier  
Reviewed-by: Ryohei Takahashi  
Discussion: https://postgr.es/m/OSBPR01MB4550DAE2F8C9502894A45AAB82BE0@OSBPR01MB4550.jpnprd01.prod.outlook.com  
Backpatch-through: 10  

M src/bin/pg_basebackup/pg_basebackup.c

Make XLogReaderInvalReadState static

commit   : 25dcc9d35dfeb027047ebaea9b27cda1eaa9b393    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 3 Sep 2019 17:41:43 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 3 Sep 2019 17:41:43 -0400    

Click here for diff

This function is only used by xlogreader.c itself, so there's no need to  
export it.  It was introduced by commit 3b02ea4f0780 with the apparent  
intention that it could be used externally, but I couldn't find any  
external code calling it.  
  
I (Álvaro) couldn't resist the urge to sort nearby function prototypes  
properly while at it.  
  
Author: Antonin Houska  
Discussion: https://postgr.es/m/[email protected]  

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

Remove 'msg' parameter from convert_tuples_by_name

commit   : fe66125974c58cc749ba441ff53e72216c819da0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 3 Sep 2019 14:47:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 3 Sep 2019 14:47:29 -0400    

Click here for diff

The message was included as a parameter when this function was added in  
dcb2bda9b704, but I don't think it has ever served any useful purpose.  
Let's stop spreading it pointlessly.  
  
Reviewed by Amit Langote and Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/tupconvert.c
M src/backend/catalog/partition.c
M src/backend/commands/analyze.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/tupconvert.h

Clarify pg_dump documentation

commit   : 10f55448965f9af3a62070dce840c5c701561630    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 14:25:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 14:25:26 +0200    

Click here for diff

Clarify in the help output and documentation that -n, -t etc. take a  
"pattern" rather than a "schema" or "table" etc.  This was especially  
confusing now that the new pg_dumpall --exclude-database option was  
documented with "pattern" and the others not, even though they all  
behave the same.  
  
Discussion: https://www.postgresql.org/message-id/flat/b85f3fa1-b350-38d1-1893-4f7911bd7310%402ndquadrant.com  

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

Improve base backup protocol documentation

commit   : bde8c2d319ab3ebaf9f07e5511e1142a38bab0e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 11:59:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 11:59:36 +0200    

Click here for diff

Document that the tablespace sizes are in units of kilobytes.  Make  
the pg_basebackup source code a bit clearer about this, too.  
  
Reviewed-by: Magnus Hagander <[email protected]>  

M doc/src/sgml/protocol.sgml
M src/bin/pg_basebackup/pg_basebackup.c

pg_checksums: Handle read and write returns correctly

commit   : 1d7a6e3eb45946db86d6d1776c55323740d955b0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 08:26:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 08:26:55 +0200    

Click here for diff

The read() return was not checking for errors, the write() return was  
not checking for short writes.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com  

M src/bin/pg_checksums/pg_checksums.c

Better error messages for short reads/writes in SLRU

commit   : 396e4afdbcbfd3398415f1a0a29668d6a24a2ddd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 08:26:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 08:26:55 +0200    

Click here for diff

This avoids getting a  
  
    Could not read from file ...: Success.  
  
for a short read or write (since errno is not set in that case).  
Instead, report a more specific error messages.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com  

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

Doc: Replace mention to "K bytes" by "kilobytes" in textsearch.sgml

commit   : 4e72a8e11e3440b10a10c8de4be2f6664ec41115    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Sep 2019 13:03:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Sep 2019 13:03:29 +0900    

Click here for diff

"kB" or "kilobyte" is used in the documentation.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/textsearch.sgml

Fix memory leak with lower, upper and initcap with ICU-provided collations

commit   : 3a54eb1a383411765deb66e6081568ae6f8d9132    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Sep 2019 12:30:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Sep 2019 12:30:53 +0900    

Click here for diff

The leak happens in str_tolower, str_toupper and str_initcap, which are  
used in several places including their equivalent SQL-level functions,  
and can only be triggered when using an ICU-provided collation when  
converting the input string.  
  
b615920 fixed a similar leak.  Backpatch down 10 where ICU collations  
have been introduced.  
  
Author: Konstantin Knizhnik  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

Avoid touching replica identity index in ExtractReplicaIdentity().

commit   : f63a5ead9d04467e1c1847bd5e3d87c4dca6cd35    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Sep 2019 16:10:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Sep 2019 16:10:37 -0400    

Click here for diff

In what seems like a fit of misplaced optimization,  
ExtractReplicaIdentity() accessed the relation's replica-identity  
index without taking any lock on it.  Usually, the surrounding query  
already holds some lock so this is safe enough ... but in the case  
of a previously-planned delete, there might be no existing lock.  
Given a suitable test case, this is exposed in v12 and HEAD by an  
assertion added by commit b04aeb0a0.  
  
The whole thing's rather poorly thought out anyway; rather than  
looking directly at the index, we should use the index-attributes  
bitmap that's held by the parent table's relcache entry, as the  
caller functions do.  This is more consistent and likely a bit  
faster, since it avoids a cache lookup.  Hence, change to doing it  
that way.  
  
While at it, rather than blithely assuming that the identity  
columns are non-null (with catastrophic results if that's wrong),  
add assertion checks that they aren't null.  Possibly those should  
be actual test-and-elog, but I'll leave it like this for now.  
  
In principle, this is a bug that's been there since this code was  
introduced (in 9.4).  In practice, the risk seems quite low, since  
we do have a lock on the index's parent table, so concurrent  
changes to the index's catalog entries seem unlikely.  Given the  
precedent that commit 9c703c169 wasn't back-patched, I won't risk  
back-patching this further than v12.  
  
Per report from Hadi Moshayedi.  
  
Discussion: https://postgr.es/m/CAK=1=Wrek44Ese1V7LjKiQS-Nd-5LgLi_5_CskGbpggKEf3tKQ@mail.gmail.com  

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

Handle corner cases correctly in psql's reconnection logic.

commit   : aef36238587c95934185d29ec94e970796f477d8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Sep 2019 14:02:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Sep 2019 14:02:45 -0400    

Click here for diff

After an unexpected connection loss and successful reconnection,  
psql neglected to resynchronize its internal state about the server,  
such as server version.  Ordinarily we'd be reconnecting to the same  
server and so this isn't really necessary, but there are scenarios  
where we do need to update --- one example is where we have a list  
of possible connection targets and they're not all alike.  
  
Define "resynchronize" as including connection_warnings(), so that  
this case acts the same as \connect.  This seems useful; for example,  
if the server version did change, the user might wish to know that.  
An attuned user might also notice that the new connection isn't  
SSL-encrypted, for example, though this approach isn't especially  
in-your-face about such changes.  Although this part is a behavioral  
change, it only affects interactive sessions, so it should not break  
any applications.  
  
Also, in do_connect, make sure that we desynchronize correctly when  
abandoning an old connection in non-interactive mode.  
  
These problems evidently are the result of people patching only one  
of the two places where psql deals with connection changes, so insert  
some cross-referencing comments in hopes of forestalling future bugs  
of the same ilk.  
  
Lastly, in Windows builds, issue codepage mismatch warnings only at  
startup, not during reconnections.  psql's codepage can't change  
during a reconnect, so complaining about it again seems like useless  
noise.  
  
Peter Billen and Tom Lane.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAMTXbE8e6U=EBQfNSe01Ej17CBStGiudMAGSOPaw-ALxM-5jXg@mail.gmail.com  

M src/bin/psql/command.c
M src/bin/psql/common.c

Add POD documentation to TestLib.pm

commit   : 6fcc40b1d4b91471f667fdf3ebe9665fbab95849    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 2 Sep 2019 13:37:57 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 2 Sep 2019 13:37:57 -0400    

Click here for diff

This module was pretty much undocumented.  Fix that.  
  
Inspired by a preliminary patch sent by Ramanarayana, heavily updated by  
Andrew Dunstan, and reviewed by Michael Paquier.  
  
Discussion: https://postgr.es/m/CAF6A77G_WJTwBV9SBxCnQfZB09hm1p1O3stZ6eE5QiYd=X84Jg@mail.gmail.com  

M src/test/perl/TestLib.pm

Add overflow-safe math inline functions for unsigned integers

commit   : 7dedfd22b79822b7f4210e6255b672ea82db6678    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 Sep 2019 09:38:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 Sep 2019 09:38:23 +0900    

Click here for diff

Similarly to the signed versions added in 4d6ad31, this adds a set of  
inline functions for overflow checks with unsigned integers, including  
uint16, uint32 and uint64.  This relies on compiler built-in overflow  
checks by default if available.  The behavior of unsigned integers is  
well-defined so the fallback implementations checks are simple for  
additions and subtractions.  Multiplications avoid division-based checks  
which are expensive if possible, still this can happen for uint64 if  
128-bit integers are not available.  
  
While on it, the code in common/int.h is reorganized to avoid too many  
duplicated comments.  The new macros will be used in a follow-up patch.  
  
All thanks to Andres Freund for the input provided.  
  
Author: Fabien Coelho, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/include/common/int.h

Fix compiler warning

commit   : 36515e4f14fc1b22787a54d5de45b1e6b5e6cd9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 1 Sep 2019 23:19:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 1 Sep 2019 23:19:51 +0200    

Click here for diff

Fix a warning about unused variable on Windows when using OpenSSL.  

M src/port/pg_strong_random.c

Doc: describe the "options" allowed in an ECPG connection target string.

commit   : 756349c87b853f83c21726c2029f840643485f7f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Aug 2019 14:05:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Aug 2019 14:05:32 -0400    

Click here for diff

These have been there a long time, but their format was never explained  
in the docs.  Per complaint from Yusuke Egashira.  
  
Discussion: https://postgr.es/m/848B1649C8A6274AA527C4472CA11EDD5FC70CBE@G01JPEXMBYT02  

M doc/src/sgml/ecpg.sgml

Cosmetic improvements for options-handling code in ECPGconnect().

commit   : b61a5e6a1f8d4d9e0bfe5d26bebfbb0687353c08    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Aug 2019 13:37:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Aug 2019 13:37:10 -0400    

Click here for diff

The comment describing the string format was a lie.  Make it agree with  
reality, add/improve some other comments, fix coding style for loops with  
empty bodies.  Also add an Assert that we counted parameters correctly,  
because the spread-out logic for that looks pretty fragile.  
  
No actual bugs fixed here, so no need to back-patch.  
  
Discussion: https://postgr.es/m/848B1649C8A6274AA527C4472CA11EDD5FC70CBE@G01JPEXMBYT02  

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

Doc: restructure documentation of the configure script's options.

commit   : 137b03b862c21b90a86732120d0c98480daf22de    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Aug 2019 15:44:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Aug 2019 15:44:00 -0400    

Click here for diff

The list of configure options has grown long, and there was next  
to no organization to it, never mind any indication of which options  
were interesting to most people.  Break it into several sub-sections  
to provide a bit of structure, and add some introductory text where  
it seems helpful to point people to particular options.  
  
I failed to resist the temptation to do a small amount of  
word-smithing on some of the option descriptions, too.  
But mostly this is reorganization and addition of intro text.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml

Doc: remove some long-obsolete information from installation.sgml.

commit   : 76c2af92666ea46bf893680e96079ecdc4e0e45d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Aug 2019 13:02:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Aug 2019 13:02:35 -0400    

Click here for diff

Section 16.2 pointed to platform-specific FAQ files that we removed  
way back in 8.4.  Section 16.7 contained a bunch of information about  
AIX and HPUX bugs that were squashed decades ago, plus discussions of  
old compiler versions that are certainly moot now that we require C99  
support.  Since we're obviously not maintaining this stuff carefully,  
just remove it.  The HPUX sub-section seems like it can go away  
entirely, since everything it said that was still applicable was  
redundant with material elsewhere in the chapter.  
  
In passing, I couldn't resist the temptation to do a small amount  
of copy-editing on nearby text.  
  
Back-patch to v12, since this stuff is surely obsolete in any  
branch that requires C99.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml

Error out on too many command-line arguments

commit   : 9684e426954921e8b2bfa367f9e6a4cbbf4ce5ff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Aug 2019 16:19:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Aug 2019 16:19:35 +0200    

Click here for diff

Fix up oid2name, pg_upgrade, and pgbench to error out on too many  
command-line arguments.  This makes it match the behavior of other  
PostgreSQL programs.  
  
Author: Peter Eisentraut, Ibrar Ahmed  
Discussion: https://www.postgresql.org/message-id/flat/f2554627-04e7-383a-ef01-ab99bb6a291c%402ndquadrant.com  

M contrib/oid2name/oid2name.c
M src/bin/pg_upgrade/option.c
M src/bin/pgbench/pgbench.c

Fix typos in regression test comments.

commit   : 317b3d7ae271eca64d49c9c0fddccc3b1e2cb1f6    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 29 Aug 2019 18:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 29 Aug 2019 18:45:00 +0900    

Click here for diff

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

Add .gitignore file forgotten in commit bde7493d1.

commit   : 744c848dce64fd55970fcf7e9039008cbff2627e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Aug 2019 12:59:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Aug 2019 12:59:47 -0400    

Click here for diff

A src/test/modules/test_ginpostinglist/.gitignore

Fix overflow check and comment in GIN posting list encoding.

commit   : bde7493d10898831100a0c6c233a5f3030bfcecd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Aug 2019 12:55:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Aug 2019 12:55:33 +0300    

Click here for diff

The comment did not match what the code actually did for integers with  
the 43rd bit set. You get an integer like that, if you have a posting  
list with two adjacent TIDs that are more than 2^31 blocks apart.  
According to the comment, we would store that in 6 bytes, with no  
continuation bit on the 6th byte, but in reality, the code encodes it  
using 7 bytes, with a continuation bit on the 6th byte as normal.  
  
The decoding routine also handled these 7-byte integers correctly, except  
for an overflow check that assumed that one integer needs at most 6 bytes.  
Fix the overflow check, and fix the comment to match what the code  
actually does. Also fix the comment that claimed that there are 17 unused  
bits in the 64-bit representation of an item pointer. In reality, there  
are 64-32-11=21.  
  
Fitting any item pointer into max 6 bytes was an important property when  
this was written, because in the old pre-9.4 format, item pointers were  
stored as plain arrays, with 6 bytes for every item pointer. The maximum  
of 6 bytes per integer in the new format guaranteed that we could convert  
any page from the old format to the new format after upgrade, so that the  
new format was never larger than the old format. But we hardly need to  
worry about that anymore, and running into that problem during upgrade,  
where an item pointer is expanded from 6 to 7 bytes such that the data  
doesn't fit on a page anymore, is implausible in practice anyway.  
  
Backpatch to all supported versions.  
  
This also includes a little test module to test these large distances  
between item pointers, without requiring a 16 TB table. It is not  
backpatched, I'm including it more for the benefit of future development  
of new posting list formats.  
  
Discussion: https://www.postgresql.org/message-id/33bfc20a-5c86-f50c-f5a5-58e9925d05ff%40iki.fi  
Reviewed-by: Masahiko Sawada, Alexander Korotkov  

M src/backend/access/gin/ginpostinglist.c
M src/test/modules/Makefile
A src/test/modules/test_ginpostinglist/Makefile
A src/test/modules/test_ginpostinglist/README
A src/test/modules/test_ginpostinglist/expected/test_ginpostinglist.out
A src/test/modules/test_ginpostinglist/sql/test_ginpostinglist.sql
A src/test/modules/test_ginpostinglist/test_ginpostinglist–1.0.sql
A src/test/modules/test_ginpostinglist/test_ginpostinglist.c
A src/test/modules/test_ginpostinglist/test_ginpostinglist.control

Avoid catalog lookups in RelationAllowsEarlyPruning().

commit   : 720b59b55b84c8a346098cdbf3d34c7e554b0bf5    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 28 Aug 2019 13:37:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 28 Aug 2019 13:37:03 +1200    

Click here for diff

RelationAllowsEarlyPruning() performed a catalog scan, but is used  
in two contexts where that was a bad idea:  
  
1.  In heap_page_prune_opt(), which runs very frequently in some large  
    scans.  This caused major performance problems in a field report  
    that was easy to reproduce.  
  
2.  In TestForOldSnapshot(), which runs while we hold a buffer content  
    lock.  It's not clear if this was guaranteed to be free of buffer  
    deadlock risk.  
  
The check was introduced in commit 2cc41acd8 and defended against a  
real problem: 9.6's hash indexes have no page LSN and so we can't  
allow early pruning (ie the snapshot-too-old feature).  We can remove  
the check from all later releases though: hash indexes are now logged,  
and there is no way to create UNLOGGED indexes on regular logged  
tables.  
  
If a future release allows such a combination, it might need to put  
a similar check in place, but it'll need some more thought.  
  
Back-patch to 10.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane, who spotted the second problem  
Discussion: https://postgr.es/m/CA%2BhUKGKT8oTkp5jw_U4p0S-7UG9zsvtw_M47Y285bER6a2gD%2Bg%40mail.gmail.com  
Discussion: https://postgr.es/m/CAA4eK1%2BWy%2BN4eE5zPm765h68LrkWc3Biu_8rzzi%2BOYX4j%2BiHRw%40mail.gmail.com  

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

Improve coverage of utils/float.h

commit   : 80d0e5ba3fe03890831b425e85d10150e226239e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Aug 2019 12:28:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Aug 2019 12:28:16 +0900    

Click here for diff

check_float4_val() checks after underflow and overflow of values  
converted from float8 to float4, but there has never been any regression  
tests for that.  This brings the coverage of float.h to 100%.  
  
Author: Movead Li  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/float4-misrounded-input.out
M src/test/regress/expected/float4.out
M src/test/regress/sql/float4.sql

Disable timeouts when running pg_rewind with online source cluster

commit   : be182e4f9e899a531094bee83b14fd434e52f7cb    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Aug 2019 11:47:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Aug 2019 11:47:35 +0900    

Click here for diff

In this case, the transfer uses a libpq connection, which is subject to  
the timeout parameters set at system level, and this can make the rewind  
operation suddenly canceled which is not good for automation.  One  
workaround to such issues would be to use PGOPTIONS to enforce the  
wanted timeout parameters, but that's annoying, and for example pg_dump,  
which can run potentially long-running queries disables all types of  
timeouts.  
  
lock_timeout and statement_timeout are the ones which can cause problems  
now.  Note that pg_rewind does not use transactions, so disabling  
idle_in_transaction_session_timeout is optional, but it feels safer to  
do so for the future.  
  
This is back-patched down to 9.5.  idle_in_transaction_session_timeout  
is only present since 9.6.  
  
Author: Alexander Kukushkin  
Discussion: https://postgr.es/m/CAFh8B=krcVXksxiwVQh1SoY+ziJ-JC=6FcuoBL3yce_40Es5_g@mail.gmail.com  
Backpatch-through: 9.5  

M src/bin/pg_rewind/libpq_fetch.c

Set application_name per-test in isolation and ecpg tests.

commit   : b1907d6882205319822c7452ce6b5e71ee2867be    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 19:49:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 19:49:09 -0400    

Click here for diff

Commit a4327296d taught pg_regress proper to do this, but  
missed the opportunity to do likewise in the isolationtester  
and ecpg variants of pg_regress.  Seems like this might be  
helpful for tracking down issues exposed by those tests.  

M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/test/isolation/isolation_main.c
M src/test/regress/pg_regress.c

Doc: improve documentation of pg_signal_backend default role.

commit   : 458f01e254e0f0b1ccab8e4589aa8495781a933a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 18:03:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 18:03:09 -0400    

Click here for diff

Give it an explanatory para like the other default roles have.  
Don't imply that it can send any signal whatever.  
  
In passing, reorder the table entries and explanatory paras  
for the default roles into some semblance of consistency.  
  
Ian Barwick, tweaked a bit by me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve what pg_strsignal prints if we haven't got strsignal(3).

commit   : c9bd7f4f2b0fc3b8291914a45cbf2a5270877ee6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 17:24:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 17:24:13 -0400    

Click here for diff

Turns out that returning "unrecognized signal" is confusing.  
Make it explicit that the platform lacks any support for signal names.  
(At least of the machines in the buildfarm, only HPUX lacks it.)  
  
Back-patch to v12 where we invented this function.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/pgstrsignal.c

Remove obsolete nbtree page deletion comment.

commit   : b8b3a276d453f5d561341021c93ec05b158f4c65    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 27 Aug 2019 14:01:43 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 27 Aug 2019 14:01:43 -0700    

Click here for diff

Commit efada2b8e92, which made the nbtree page deletion algorithm more  
robust, removed the concept of a half-dead internal page.  Remove a  
comment about half dead parent pages that was overlooked.  

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

Doc: clarify behavior of standard aggregates for null inputs.

commit   : da1b51ecc52ffdb3f8fb1cda1e15dc60ff00cd11    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 16:37:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 16:37:21 -0400    

Click here for diff

Section 4.2.7 says that unless otherwise specified, built-in  
aggregates ignore rows in which any input is null.  This is  
not true of the JSON aggregates, but it wasn't documented.  
Fix that.  
  
Of the other entries in table 9.55, some were explicit about  
ignoring nulls, and some weren't; for consistency and  
self-contained-ness, make them all say it explicitly.  
  
Per bug #15884 from Tim Möhlmann.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Add missing newline in help output.

commit   : d4b2425441b7ab298300142d64bb8020d38b290f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 15:14:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 15:14:55 -0400    

Click here for diff

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

M src/bin/pg_upgrade/option.c

Reject empty names and recursion in config-file include directives.

commit   : 6e42130568ad28bed857948f5a3192dbf01624dc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 14:44:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 14:44:26 -0400    

Click here for diff

An empty file name or subdirectory name leads join_path_components() to  
just produce the parent directory name, which leads to weird failures or  
recursive inclusions.  Let's throw a specific error for that.  It takes  
only slightly more code to detect all-blank names, so do so.  
  
Also, detect direct recursion, ie a file calling itself.  As coded  
this will also detect recursion via "include_dir '.'", which is  
perhaps more likely than explicitly including the file itself.  
  
Detecting indirect recursion would require API changes for guc-file.l  
functions, which seems not worth it since extensions might call them.  
The nesting depth limit will catch such cases eventually, just not  
with such an on-point error message.  
  
In passing, adjust the example usages in postgresql.conf.sample  
to perhaps eliminate the problem at the source: there's no reason  
for the examples to suggest that an empty value is valid.  
  
Per a trouble report from Brent Bates.  Back-patch to 9.5; the  
issue is old, but the code in 9.4 is enough different that the  
patch doesn't apply easily, and it doesn't seem worth the trouble  
to fix there.  
  
Ian Barwick and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/postgresql.conf.sample

Fix failure of --jobs with reindexdb and vacuumdb on Windows

commit   : 9acda731184c1ebdf99172cbb19d0404b7eebc37    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Aug 2019 09:11:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Aug 2019 09:11:31 +0900    

Click here for diff

FD_SETSIZE needs to be declared before winsock2.h, or it is possible to  
run into buffer overflow issues when using --jobs.  This is similar to  
pgbench's solution done in a23c641.  
  
This has been introduced by 71d84ef, and older versions have been using  
the default value of FD_SETSIZE, defined at 64.  
  
Per buildfarm member jacana, but this impacts all Windows animals  
running the TAP tests.  I have reproduced the failure locally to check  
the patch.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/bin/scripts/scripts_parallel.c

Fix 007_sync_rep.pl to notice failures in ALTER SYSTEM SET.

commit   : fb57f40eec503d637bf01c298f5cb2472f0d4fdb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Aug 2019 17:02:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Aug 2019 17:02:52 -0400    

Click here for diff

If a test case tried to set an invalid value of synchronous_standby_names,  
the test script didn't detect that, which seems like a bad idea.  
Noticed while testing a proposed patch that broke some of these  
test cases.  

M src/test/recovery/t/007_sync_rep.pl

Fix postmaster state machine to handle dead_end child crashes better.

commit   : ee3278239550ff0ec9df72dd798a480c82c2b723    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Aug 2019 15:59:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Aug 2019 15:59:44 -0400    

Click here for diff

A report from Alvaro Herrera shows that if we're in PM_STARTUP  
state, and we spawn a dead_end child to reject some incoming  
connection request, and that child dies with an unexpected exit  
code, the postmaster does not respond well.  We correctly send  
SIGQUIT to the startup process, but then:  
  
* if the startup process exits with nonzero exit code, as expected,  
we thought that that indicated a crash and aborted startup.  
  
* if the startup process exits with zero exit code, which is possible  
due to the inherent race condition, we'd advance to PM_RUN state  
which is fine --- but the code forgot that AbortStartTime would be  
nonzero in this situation.  We'd either die on the Asserts saying  
that it was zero, or perhaps misbehave later on.  (A quick look  
suggests that the only misbehavior might be busy-waiting due to  
DetermineSleepTime doing the wrong thing.)  
  
To fix the first point, adjust the state-machine logic to recognize  
that a nonzero exit code is expected after sending SIGQUIT, and have  
it transition to a state where we can restart the startup process.  
To fix the second point, change the Asserts to clear the variable  
rather than just claiming it should be clear already.  
  
Perhaps we could improve this further by not treating a crash of  
a dead_end child as a reason for panic'ing the database.  However,  
since those child processes are connected to shared memory, that  
seems a bit risky.  There are few good reasons for a dead_end child  
to report failure anyway (the cause of this in Alvaro's report is  
quite unclear).  On balance, therefore, a minimal fix seems best.  
  
This is an oversight in commit 45811be94.  While that was back-patched,  
I'm hesitant to back-patch this change.  The lack of reasons for a  
dead_end child to fail suggests that the case should be very rare in  
the field, which squares with the lack of reports; so it seems like  
this might not be worth the risk of introducing new issues.  In any  
case we can let it bake awhile in HEAD before considering a back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Make comment in fmgr.h match the one in fmgr.c.

commit   : 348778ddbc75eddaa7f9c7ce5b6adad8ada564e4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Aug 2019 14:32:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Aug 2019 14:32:40 -0400    

Click here for diff

Incompletely quoting an API spec does nobody any good.  Noted by  
Paul Jungwirth.  Looks like the discrepancy was my fault originally :-(  
  
Discussion: https://postgr.es/m/CA+renyU_J8TU_d3Kr0PkuOgFbpypextendu7a+_d5NOfVdvDeA@mail.gmail.com  

M src/include/fmgr.h

Fix gettext triggers specification

commit   : f2690338814738967d75cc1e35cc1cfac1a40710    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Aug 2019 19:04:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Aug 2019 19:04:35 +0200    

Click here for diff

In cc8d41511721d25d557fc02a46c053c0a602fed0, the arguments of  
warn_or_exit_horribly() were changed but this was not updated.  

M src/bin/pg_dump/nls.mk

Adjust to latest Msys2 kernel release number

commit   : c62b84437f52f0e23924268938916e90b8e5b9e6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 26 Aug 2019 08:11:27 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 26 Aug 2019 08:11:27 -0400    

Click here for diff

Previously 'uname -r' on Msys2 reported a kernele release starting with  
2. The latest version starts with 3. In commit 1638623f we specifically  
looked for one starting with 2. This is now changed to look for any  
digit between 2 and 9.  
  
backpatch to release 10.  

M src/bin/pg_dump/t/010_dump_connstr.pl

Treat MINGW and MSYS the same in pg_upgrade test script

commit   : acb96eb7d294a003a9392cdd445630ef137d9918    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 26 Aug 2019 07:44:34 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 26 Aug 2019 07:44:34 -0400    

Click here for diff

On msys2, 'uname -s' reports a string starting MSYS instead on MINGW  
as happens on msys1. Treat these both the same way. This reverts  
608a710195a4b in favor of a more general solution.  
  
Backpatch to all live branches.  

M src/bin/pg_upgrade/test.sh

Fix error handling of vacuumdb and reindexdb when running out of fds

commit   : 71d84efba714db3b8a330a54be15c4d385719ad6    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Aug 2019 11:14:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Aug 2019 11:14:18 +0900    

Click here for diff

When trying to use a high number of jobs, vacuumdb (and more recently  
reindexdb) has only checked for a maximum number of jobs used, causing  
confusing failures when running out of file descriptors when the jobs  
open connections to Postgres.  This commit changes the error handling so  
as we do not check anymore for a maximum number of allowed jobs when  
parsing the option value with FD_SETSIZE, but check instead if a file  
descriptor is within the supported range when opening the connections  
for the jobs so as this is detected at the earliest time possible.  
  
Also, improve the error message to give a hint about the number of jobs  
recommended, using a wording given by the reviewers of the patch.  
  
Reported-by: Andres Freund  
Author: Michael Paquier  
Reviewed-by: Andres Freund, Álvaro Herrera, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/bin/scripts/reindexdb.c
M src/bin/scripts/scripts_parallel.c
M src/bin/scripts/scripts_parallel.h
M src/bin/scripts/vacuumdb.c

Avoid platform-specific null pointer dereference in psql.

commit   : 6338fa3e715ad1cb12e0760bf73ffc2a906098ea    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Aug 2019 15:04:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Aug 2019 15:04:04 -0400    

Click here for diff

POSIX permits getopt() to advance optind beyond argc when the last  
argv entry is an option that requires an argument and hasn't got one.  
It seems that no major platforms actually do that, but musl does,  
so that something like "psql -f" would crash with that libc.  
Add a check that optind is in range before trying to look at the  
possibly-bogus option.  
  
Report and fix by Quentin Rameau.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/startup.c

Back off output precision in circle.sql regression test.

commit   : faee5a12ecf13190d7ca11d6dcc7078e494f46ca    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Aug 2019 12:14:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Aug 2019 12:14:50 -0400    

Click here for diff

We were setting extra_float_digits = 0 to avoid platform-dependent  
output in this test, but that's still able to expose platform-specific  
roundoff behavior in some new test cases added by commit a3d284485,  
as reported by Peter Eisentraut.  Reduce it to -1 to hide that.  
  
(Over in geometry.sql, we're using -3, which is an ancient decision  
dating to 337f73b1b.  I wonder whether that's overkill now.  But  
there's probably little value in trying to change it.)  
  
Back-patch to v12 where a3d284485 came in; there's no evidence that  
we have any platform-dependent issues here before that.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Don't rely on llvm::make_unique.

commit   : f493d98c167321e5d5c17dd7d795721045a81c97    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 25 Aug 2019 13:54:48 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 25 Aug 2019 13:54:48 +1200    

Click here for diff

Bleeding-edge LLVM has stopped supplying replacements for various  
C++14 library features, for people on older C++ versions.  Since we're  
not ready to require C++14 yet, just use plain old new instead of  
make_unique.  As revealed by buildfarm animal seawasp.  
  
Back-patch to 11.  
  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CA%2BhUKGJWG7unNqmkxg7nC5o3o-0p2XP6co4r%3D9epqYMm8UY4Mw%40mail.gmail.com  

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

Do more cleanup of isolation tests for test_decoding

commit   : 06fdc4e4d33c40dbf886565336574da5566878f4    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 24 Aug 2019 12:34:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 24 Aug 2019 12:34:37 +0900    

Click here for diff

989d23b has caused its tests to be broken as the module defines unused  
steps, turning the buildfarm red.  

M contrib/test_decoding/specs/concurrent_ddl_dml.spec
M contrib/test_decoding/specs/snapshot_transfer.spec

Explain subtlety in nbtree locking protocol.

commit   : 867d25ccb4c7f290d08c720622ecaae4afd1dc3f    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 23 Aug 2019 20:24:49 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 23 Aug 2019 20:24:49 -0700    

Click here for diff

The Postgres approach to coupling locks during an ascent of the tree is  
slightly different to the approach taken by Lehman and Yao.  Add a new  
paragraph to the "Differences to the Lehman & Yao algorithm" section of  
the nbtree README that explains the similarities and differences.  

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

Detect unused steps in isolation specs and do some cleanup

commit   : 989d23b04beac0c26f44c379b04ac781eaa4265e    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 24 Aug 2019 11:45:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 24 Aug 2019 11:45:05 +0900    

Click here for diff

This is useful for developers to find out if an isolation spec is  
over-engineered or if it needs more work by warning at the end of a  
test run if a step is not used, generating a failure with extra diffs.  
  
While on it, clean up all the specs which include steps not used in any  
permutations to simplify them.  
  
Author: Michael Paquier  
Reviewed-by: Asim Praveen, Melanie Plageman  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/isolationtester.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specs/freeze-the-dead.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.spec
M src/test/isolation/specs/sequence-ddl.spec
M src/test/isolation/specs/tuplelock-upgrade-no-deadlock.spec

Remove dry-run mode from isolationtester

commit   : 9903338b5ea59093d77cfe50ec0b1c22d4a7d843    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 24 Aug 2019 11:35:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 24 Aug 2019 11:35:43 +0900    

Click here for diff

The original purpose of the dry-run mode is to be able to print all the  
possible permutations from a spec file, but it has become less useful  
since isolation tests has improved regarding deadlock detection as one  
step not wanted by the author could block indefinitely now (originally  
the step blocked would have been detected rather quickly).  Per  
discussion, let's remove it.  
  
Author: Michael Paquier  
Reviewed-by: Asim Praveen, Melanie Plageman  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/isolationtester.c

Improve documentation of pageinspect

commit   : 292ae8af79b4f1b09a327d39e80ef70943a28194    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 23 Aug 2019 20:41:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 23 Aug 2019 20:41:06 +0900    

Click here for diff

This adds a section for heap-related functions.  These were previously  
mixed with functions having a more general purpose, leading to  
confusion.  While on it, add a query example for fsm_page_contents.  
  
Backpatch down to 10, where b5e3942 introduced the subsections for  
function types in pageinspect documentation.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDyM7E1+cK3-aWejxKTGC-wVVP2B+RnJhN6inXyeRmqzw@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/pageinspect.sgml

Update SQL conformance information

commit   : 21e60fa8fe296355dca96c451fb13119cc0e6bd2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 15:36:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 15:36:30 +0200    

Click here for diff

T612 has been fully supported since the major window function  
enhancements in PostgreSQL 11, but it wasn't updated at the time.  

M src/backend/catalog/sql_features.txt

Make SQL/JSON error code names match SQL standard

commit   : a00c53b0cbf06dd6c01f5a1d55ebe21310a250af    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 10:17:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 10:17:30 +0200    

Click here for diff

There were some minor differences that didn't seem necessary.  
  
Discussion: https://www.postgresql.org/message-id/flat/86b67eef-bb26-c97d-3e35-64f1fbd4f9fe%402ndquadrant.com  

M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/errcodes.txt

Doc: Remove mention to "Visual Studio Express 2019"

commit   : 37093766b2f489128564774995f02d4e7d00dccd    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Aug 2019 09:58:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Aug 2019 09:58:45 +0900    

Click here for diff

The "Express" flavor of Visual Studio exists up to 2017, and the  
documentation referred to "Express" for Visual Studio 2019.  
  
Author: Takuma Hoshiai  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/install-windows.sgml

Update comments on nbtree stack struct.

commit   : 091bd6befcb71feb58b1478e1b976c85ae504822    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 21 Aug 2019 13:50:27 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 21 Aug 2019 13:50:27 -0700    

Click here for diff

Adjust the struct comment that describes how page splits use their  
descent stack to cascade up the tree from the leaf level.  
  
In passing, fix up some unrelated nbtree comments that had typos or were  
obsolete.  

M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/include/access/nbtree.h

Remove configure detection of crypt()

commit   : c45643d618e35ec2fe91438df15abd4f3c0d85ca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Aug 2019 21:33:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Aug 2019 21:33:05 +0200    

Click here for diff

crypt() hasn't been needed since crypt detection was removed from  
PostgreSQL, so these configure checks are not necessary.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/21f88934-f00c-27f6-a9d8-7ea06d317781%402ndquadrant.com  

M configure
M configure.in
M src/backend/libpq/crypt.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
D src/port/crypt.c
M src/tools/msvc/Mkvcbuild.pm

Fix typo

commit   : 8f75e8e44609335e6bdd73123284682235f242a2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Aug 2019 11:12:44 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Aug 2019 11:12:44 -0400    

Click here for diff

In early development patches, "replication origins" were called "identifiers";  
almost everything was renamed, but these references to the old terminology  
went unnoticed.  
  
Reported-by: Craig Ringer  

M src/backend/replication/logical/origin.c
M src/include/catalog/pg_proc.dat

Remove unnecessary test dependency on the contents of pg_pltemplate.

commit   : bbd93667bde56d3900add55479759f33d20ece1e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Aug 2019 10:43:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Aug 2019 10:43:23 -0400    

Click here for diff

Using pg_pltemplate as test data was probably not very forward-looking,  
considering we've had many discussions around removing that catalog  
altogether.  Use a nearby temp table instead, to make these two test  
scripts more self-contained.  This is a better test case anyway, since  
it exercises the scenario where the entries in the anyarray column  
actually vary in type intra-query.  

M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Remove master/slave usage from plpgsql tests

commit   : 3f0f99125e5c0fd704de3c07abe691ebefc51a50    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Aug 2019 11:46:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Aug 2019 11:46:37 +0200    

Click here for diff

Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_trap.out
M src/pl/plpgsql/src/sql/plpgsql_trap.sql

Clean up some SCRAM attribute processing

commit   : db1f28917bac5e008dcb2653a54e73d2d0571e06    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Aug 2019 22:25:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Aug 2019 22:25:58 +0200    

Click here for diff

Correct the comment for read_any_attr().  Give a clearer error message  
when parsing at the end of the string, when the client-final-message  
does not contain a "p" attribute (for some reason).  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/2fb8a15b-de35-682d-a77b-edcc9c52fa12%402ndquadrant.com  

M src/backend/libpq/auth-scram.c

Fix bogus comment

commit   : f8cf524da15ec4d8fad26aeff44af9928d30eb3d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Aug 2019 16:04:09 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Aug 2019 16:04:09 -0400    

Click here for diff

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

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

Fix compilation failure of vacuumdb and reindexdb with OpenBSD

commit   : 56f8f9624ba050c7c47dd97547b7fafb866f2bdd    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Aug 2019 16:10:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Aug 2019 16:10:20 +0900    

Click here for diff

FD_SETSIZE is included in sys/select.h per POSIX, and this header  
inclusion has been moved to scripts_parallel.c as of 5f38403 without  
moving the variable, causing a compilation failure on recent versions of  
OpenBSD (6.6 was the version used in the report).  
  
In order to take care of the failure, move FD_SETSIZE directly to  
scripts_parallel.c with a wrapper controlling the maximum number of  
parallel slots supported, based on a suggestion by Andres Freund.  
  
While on it, reduce the maximum number to be less than FD_SETSIZE,  
leaving some room for stdin, stdout and such as they consume some file  
descriptors.  
  
The buildfarm did not complain about that, as it happens to only be  
an issue on recent versions of OpenBSD and there is no coverage in this  
area.  51c3e9f fixed a similar set of issues.  
  
Bug: #15964  
Reported-by: Sean Farrell  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/reindexdb.c
M src/bin/scripts/scripts_parallel.c
M src/bin/scripts/scripts_parallel.h
M src/bin/scripts/vacuumdb.c

Doc: Improve wording of multiple places in documentation

commit   : 0431a787469265776eeb9a472beb3457d2990edb    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Aug 2019 12:36:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Aug 2019 12:36:31 +0900    

Click here for diff

This has been found during its translation.  
  
Author: Liudmila Mantrova  
Discussion: https://postgr.es/m/CAEkD-mDJHV3bhgezu3MUafJLoAKsOOT86+wHukKU8_NeiJYhLQ@mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/storage.sgml

Restore json{b}_populate_record{set}'s ability to take type info from AS.

commit   : e136a0d8ca31d1c94b3f2868ae0e735b8d9ff12f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Aug 2019 18:00:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Aug 2019 18:00:57 -0400    

Click here for diff

If the record argument is NULL and has no declared type more concrete  
than RECORD, we can't extract useful information about the desired  
rowtype from it.  In this case, see if we're in FROM with an AS clause,  
and if so extract the needed rowtype info from AS.  
  
It worked like this before v11, but commit 37a795a60 removed the  
behavior, reasoning that it was undocumented, inefficient, and utterly  
not self-consistent.  If you want to take type info from an AS clause,  
you should be using the json_to_record() family of functions not the  
json_populate_record() family.  Also, it was already the case that  
the "populate" functions would fail for a null-valued RECORD input  
(with an unfriendly "record type has not been registered" error)  
when there wasn't an AS clause at hand, and it wasn't obvious that  
that behavior wasn't OK when there was one.  However, it emerges  
that some people were depending on this to work, and indeed the  
rather off-point error message you got if you left off AS encouraged  
slapping on AS without switching to the json_to_record() family.  
  
Hence, put back the fallback behavior of looking for AS.  While at it,  
improve the run-time error you get when there's no place to obtain type  
info; we can do a lot better than "record type has not been registered".  
(We can't, unfortunately, easily improve the parse-time error message  
that leads people down this path in the first place.)  
  
While at it, I refactored the code a bit to avoid duplicating the  
same logic in several different places.  
  
Per bug #15940 from Jaroslav Sivy.  Back-patch to v11 where the  
current coding came in.  (The pre-v11 deficiencies in this area  
aren't regressions, so we'll leave those branches alone.)  
  
Patch by me, based on preliminary analysis by Dmitry Dolgov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Add fmgr.h include to selfuncs.h.

commit   : 4c01a1110388661d8752fee35e9c5614aa4a2d32    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 19 Aug 2019 12:51:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 19 Aug 2019 12:51:38 -0700    

Click here for diff

Necessary after fb3b098f. That previously escaped notice, because all  
including sites already include fmgr.h some other way.  
  
Reported-By: Tom Lane  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/utils/selfuncs.h

Add "headerscheck" script to test header-file compilability under C.

commit   : 55ea109188474dae22d90f743d7189a8bdf94d49    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Aug 2019 14:22:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Aug 2019 14:22:56 -0400    

Click here for diff

We already had "cpluspluscheck", which served the dual purposes of  
verifying that headers compile standalone and that they compile as C++.  
However, C++ compilers don't have the exact same set of error conditions  
as C compilers, so this doesn't really prove that a header will compile  
standalone as C.  
  
Hence, add a second script that's largely similar but runs the C  
compiler not C++.  
  
Also add a bit more documentation than the none-at-all we had before.  
  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M src/tools/pginclude/README
M src/tools/pginclude/cpluspluscheck
A src/tools/pginclude/headerscheck

Use zic's new "-b slim" option to generate smaller timezone files.

commit   : a12079109686e75c833b0b04925af8cb2fa011c0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Aug 2019 13:17:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Aug 2019 13:17:02 -0400    

Click here for diff

IANA tzcode release 2019b adds an option that tells zic not to emit  
the old 32-bit section of the timezone files, and to skip some other  
space-wasting hacks needed for compatibility with old timezone client  
libraries.  Since we only expect our own code to use the timezone data  
we install, and our code is up-to-date with 2019b, there's no apparent  
reason not to generate the smallest possible files.  
  
Unfortunately, while the individual zone files do get significantly  
smaller in many cases, they were not that big to begin with; which  
means that no real space savings ensues on filesystems that don't  
optimize small files.  (For instance, on ext4 with 4K block size,  
"du" says the installed timezone tree is the same size as before.)  
Still, it seems worth making the change, if only because this is  
presumably the wave of the future.  At the very least, we'll save  
some cycles while reading a zone file.  
  
But given the marginal value and the fact that this is a new code  
path, it doesn't seem worth the risk of back-patching this change  
into stable branches.  Hence, unlike most of our timezone-related  
changes, apply to HEAD only.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/Makefile
M src/tools/msvc/Install.pm

Replace genetic algorithm ASCII-art with a real figure

commit   : 28b6ec1df64775db6d6eb47655141cda1240d901    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Aug 2019 12:05:38 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Aug 2019 12:05:38 -0400    

Click here for diff

Author: Jürgen Purtz  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/geqo.sgml
M doc/src/sgml/images/Makefile
A doc/src/sgml/images/genetic-algorithm.gv
A doc/src/sgml/images/genetic-algorithm.svg

doc: Fix image use in PDF build with vpath

commit   : a407012c07844b5d81012d6960c4b2ec11d6af9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Aug 2019 10:30:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Aug 2019 10:30:47 +0200    

Click here for diff

In a vpath build, we need to point to the source directory to allow  
FOP to find the images.  

M doc/src/sgml/Makefile

Fix tab completion for CREATE TYPE in psql

commit   : 71851e9ab7ac8409fabc6f64273149aa71fa29f5    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Aug 2019 16:33:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Aug 2019 16:33:24 +0900    

Click here for diff

Oversight in 7bdc655.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

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

Fix inconsistencies and typos in the tree, take 11

commit   : c96581abe418a3bf64b643aa4e27091d1eaea1c1    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Aug 2019 16:21:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Aug 2019 16:21:39 +0900    

Click here for diff

This fixes various typos in docs and comments, and removes some orphaned  
definitions.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/hstore_op.c
M doc/src/sgml/func.sgml
M doc/src/sgml/gist.sgml
M src/backend/access/heap/tuptoaster.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/vacuum.c
M src/backend/executor/execExpr.c
M src/backend/executor/nodeTidscan.c
M src/backend/port/win32/crashdump.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/walsender.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/file/fd.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/mmgr/freepage.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/include/access/brin_xlog.h
M src/include/access/heapam_xlog.h
M src/include/access/htup_details.h
M src/include/access/xlog_internal.h
M src/include/commands/explain.h
M src/include/fe_utils/psqlscan_int.h
M src/include/miscadmin.h
M src/include/replication/walreceiver.h
M src/include/storage/buf_internals.h
M src/interfaces/libpq/fe-protocol3.c
M src/pl/tcl/pltcl.c
M src/test/isolation/specs/freeze-the-dead.spec
M src/test/isolation/specs/read-only-anomaly-3.spec
M src/test/modules/test_rls_hooks/README
M src/test/thread/thread_test.c
M src/timezone/localtime.c
M src/tools/msvc/ecpg_regression.proj

Avoid conflicts with library versions of inet_net_ntop() and friends.

commit   : 927f34ce8a215c8b254136f710cca9ca4da1352c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 19:27:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 19:27:23 -0400    

Click here for diff

Prefix inet_net_ntop and sibling routines with "pg_" to ensure that  
they aren't mistaken for C-library functions.  This fixes warnings  
from cpluspluscheck on some platforms, and should help reduce reader  
confusion everywhere, since our functions aren't exactly interchangeable  
with the library versions (they may have different ideas about address  
family codes).  
  
This shouldn't be fixing any actual bugs, unless somebody's linker  
is misbehaving, so no need to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/inet_cidr_ntop.c
M src/backend/utils/adt/inet_net_pton.c
M src/backend/utils/adt/network.c
M src/include/port.h
M src/include/utils/builtins.h
M src/interfaces/libpq/fe-connect.c
M src/port/getaddrinfo.c
M src/port/inet_net_ntop.c

Fix incidental warnings from cpluspluscheck.

commit   : 232720be9b6412ec2b6bee405299bcbbbe700f0b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 19:01:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 19:01:40 -0400    

Click here for diff

Remove use of "register" keyword in hashfn.c.  It's obsolescent  
according to recent C++ compilers, and no modern C compiler pays  
much attention to it either.  
  
Also fix one cosmetic warning about signed vs unsigned comparison.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/hash/hashfn.c
M src/include/utils/expandeddatum.h
M src/include/utils/hashutils.h

Fix failure-to-compile-standalone in scripts_parallel.h.

commit   : 5f110933e1145ad40116cf3c67a454cb6cb71cc2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 18:01:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 18:01:01 -0400    

Click here for diff

Needs libpq-fe.h for references to PGConn.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/scripts_parallel.h

Fix failure-to-compile-standalone in ecpg's dt.h.

commit   : 5c66e99178c2f72042034cceb6bc4902650a2608    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 17:51:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 17:51:35 -0400    

Click here for diff

This has to have <time.h>, or the references to "struct tm" don't  
mean what they should.  
  
We have some other recently-introduced issues of the same ilk,  
but this one seems old.  No backpatch though, as it's only a  
latent problem for most purposes.  

M src/interfaces/ecpg/pgtypeslib/dt.h

Disallow changing an inherited column's type if not all parents changed.

commit   : 4d4c66addfd4da51b0e4be456d6109bea4539fac    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 17:11:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 17:11:57 -0400    

Click here for diff

If a table inherits from multiple unrelated parents, we must disallow  
changing the type of a column inherited from multiple such parents, else  
it would be out of step with the other parents.  However, it's possible  
for the column to ultimately be inherited from just one common ancestor,  
in which case a change starting from that ancestor should still be  
allowed.  (I would not be excited about preserving that option, were  
it not that we have regression test cases exercising it already ...)  
  
It's slightly annoying that this patch looks different from the logic  
with the same end goal in renameatt(), and more annoying that it  
requires an extra syscache lookup to make the test.  However, the  
recursion logic is quite different in the two functions, and a  
back-patched bug fix is no place to be trying to unify them.  
  
Per report from Manuel Rigger.  Back-patch to 9.5.  The bug exists in  
9.4 too (and doubtless much further back); but the way the recursion  
is done in 9.4 is a good bit different, so that substantial refactoring  
would be needed to fix it in 9.4.  I'm disinclined to do that, or risk  
introducing new bugs, for a bug that has escaped notice for this long.  
  
Discussion: https://postgr.es/m/CA+u7OA4qogDv9rz1HAb-ADxttXYPqQdUdPY_yd4kCzywNxRQXA@mail.gmail.com  

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

Remove obsolete reference to Irix

commit   : 7e78c872dd5b0f53bbeed90c2b6e610c14e9be4b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 18 Aug 2019 06:53:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 18 Aug 2019 06:53:28 +0200    

Click here for diff

M config/programs.m4
M configure

Make deadlock-parallel isolation test more robust.

commit   : 9be4ce4fa33594e035eb421894247e5af61393ce    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Aug 2019 18:15:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Aug 2019 18:15:38 -0400    

Click here for diff

This test failed fairly reproducibly on some CLOBBER_CACHE_ALWAYS  
buildfarm animals.  The cause seems to be that if a parallel worker  
is slow enough to reach its lock wait, it may not be released by  
the first deadlock check run, and then later deadlock checks might  
decide to unblock the d2 session instead of the d1 session, leaving  
us in an undetected deadlock state (since the isolationtester client  
is waiting for d1 to complete first).  
  
Fix by introducing an additional lock wait at the end of the d2a1  
step, ensuring that the deadlock checker will recognize that d1  
has to be unblocked before d2a1 completes.  
  
Also reduce max_parallel_workers_per_gather to 3 in this test.  With the  
default max_worker_processes value, we were only getting one parallel  
worker for the d2a1 step, which is not the case I hoped to test.  We  
should get 3 for d1a2 and 2 for d2a1, as the code stands; and maybe 3  
for d2a1 if somebody figures out why the last parallel worker slot isn't  
free already.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/deadlock-parallel.out
M src/test/isolation/specs/deadlock-parallel.spec

Improve Assert output

commit   : d78d452bc5ac46a970e4fca2b31f3d533815c39a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Aug 2019 12:36:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Aug 2019 12:36:30 +0200    

Click here for diff

If an assertion expression contained a macro, the failed assertion  
message would print the expanded macro, which is usually unhelpful and  
confusing.  Restructure the Assert macros to not expand any macros  
when constructing the failure message.  
  
This also fixes that the existing output for Assert et al. shows  
the *inverted* condition, which is also confusing and not how  
assertions usually work.  
  
Discussion: https://www.postgresql.org/message-id/flat/6c68efe3-117a-dcc1-73d4-18ba1ec532e2%402ndquadrant.com  

M src/include/c.h

Add default_table_access_method to postgresql.conf.sample.

commit   : f7db0ac7d5b6ba9728616a1cc36288cb4f817e66    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 15:24:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 15:24:22 -0700    

Click here for diff

Reported-By: Heikki Linnakangas  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where pluggable table access methods were introduced  

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

Add missing fmgr.h include.

commit   : 00a5c4c17b76b2d68fab70ec0be0960590a3a7fe    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 15:19:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 15:19:50 -0700    

Click here for diff

M src/test/modules/dummy_seclabel/dummy_seclabel.c

Remove fmgr.h includes from headers that don't really need it.

commit   : fb3b098fe88441f9531a5169008ea17eac01301f    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 10:35:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 10:35:31 -0700    

Click here for diff

Most of the fmgr.h includes were obsoleted by 352a24a1f9d6f7d4abb1. A  
few others can be obsoleted using the underlying struct type in an  
implementation detail.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/printsimple.c
M src/backend/nodes/makefuncs.c
M src/backend/replication/logical/logical.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/access/brin.h
M src/include/access/gist_private.h
M src/include/access/hash.h
M src/include/access/spgist.h
M src/include/commands/async.h
M src/include/executor/executor.h
M src/include/jit/llvmjit_emit.h
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/pgstat.h
M src/include/replication/origin.h
M src/include/replication/slot.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/utils/bytea.h
M src/include/utils/formatting.h
M src/include/utils/rel.h
M src/include/utils/snapmgr.h
M src/include/utils/tuplesort.h

Don't include utils/array.h from acl.h.

commit   : 6a04d345fd8094058f08344af93022566222733a    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 10:33:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 10:33:30 -0700    

Click here for diff

For most uses of acl.h the details of how "Acl" internally looks like  
are irrelevant. It might make sense to move a lot of the  
implementation details into a separate header at a later point.  
  
The main motivation of this change is to avoid including fmgr.h (via  
array.h, which needs it for exposed structs) in a lot of files that  
otherwise don't need it. A subsequent commit will remove the fmgr.h  
include from a lot of files.  
  
Directly include utils/array.h and utils/expandeddatum.h from the  
files that need them, but previously included them indirectly, via  
acl.h.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/hashfuncs.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/partitioning/partprune.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/tsvector_op.c
M src/include/catalog/objectaddress.h
M src/include/utils/acl.h
M src/include/utils/array.h

Remove redundant prototypes for SQL callable functions.

commit   : 0ae2dc4db2ae9940ab2bb1e4f4c0ff27f09f8aae    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 10:16:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 10:16:42 -0700    

Click here for diff

These aren't needed after 352a24a1f9d6. The remaining prototypes are  
not defined on the SQL level.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/pg_publication.h
M src/include/executor/nodeAgg.h

Remove useless bms_free() calls in build_child_join_rel().

commit   : 076e9d42099d092475ea9eaa2902ba101a27a585    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 16 Aug 2019 14:35:55 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 16 Aug 2019 14:35:55 +0900    

Click here for diff

These seem to be leftovers from the original partitionwise-join patch,  
perhaps.  
  
Discussion: https://postgr.es/m/CAPmGK145YiMTPRnvev1dLz8na_-0aZ=Xyqn8f2QsJFBUTObNow@mail.gmail.com  

M src/backend/optimizer/util/relnode.c

Prevent possible double-free when update trigger returns old tuple.

commit   : 1ced082b95b339e49fc3d9f15474f816e7a9cfb1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 20:04:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 20:04:19 -0400    

Click here for diff

This is a variant of the problem fixed in commit 25b692568, which  
unfortunately we failed to detect at the time.  If an update trigger  
returns the "old" tuple, as it's entitled to do, then a subsequent  
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"  
equal to "trigtuple" and would fail to notice that it shouldn't  
free that.  
  
In addition to fixing the code, extend the test case added by  
25b692568 so that it covers multiple-trigger-iterations cases.  
  
This problem does not manifest in v12/HEAD, as a result of the  
relevant code having been largely rewritten for slotification.  
However, include the test case into v12/HEAD anyway, since this  
is clearly an area that someone could break again in future.  
  
Per report from Piotr Gabriel Kosinski.  Back-patch into all  
supported branches, since the bug seems quite old.  
  
Diagnosis and code fix by Thomas Munro, test case by me.  
  
Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com  

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

Fix plpgsql to re-look-up composite type names at need.

commit   : fe9b7b2fe5973309c0a5f7d9240dde91aeeb94aa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 15:21:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 15:21:47 -0400    

Click here for diff

Commit 4b93f5799 rearranged things in plpgsql to make it cope better with  
composite types changing underneath it intra-session.  However, I failed to  
consider the case of a composite type being dropped and recreated entirely.  
In my defense, the previous coding didn't consider that possibility at all  
either --- but it would accidentally work so long as you didn't change the  
type's field list, because the built-at-compile-time list of component  
variables would then still match the type's new definition.  The new  
coding, however, occasionally tries to re-look-up the type by OID, and  
then fails to find the dropped type.  
  
To fix this, we need to save the TypeName struct, and then redo the type  
OID lookup from that.  Of course that's expensive, so we don't want to do  
it every time we need the type OID.  This can be fixed in the same way that  
4b93f5799 dealt with changes to composite types' definitions: keep an eye  
on the type's typcache entry to see if its tupledesc has been invalidated.  
(Perhaps, at some point, this mechanism should be generalized so it can  
work for non-composite types too; but for now, plpgsql only tries to  
cope with intra-session redefinitions of composites.)  
  
I'm slightly hesitant to back-patch this into v11, because it changes  
the contents of struct PLpgSQL_type as well as the signature of  
plpgsql_build_datatype(), so in principle it could break code that is  
poking into the innards of plpgsql.  However, the only popular extension  
of that ilk is pldebugger, and it doesn't seem to be affected.  Since  
this is a regression for people who were relying on the old behavior,  
it seems worth taking the small risk of causing compatibility issues.  
  
Per bug #15913 from Daniel Fiori.  Back-patch to v11 where 4b93f5799  
came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/typcache.c
M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_comp.c
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_record.sql

Use a hash table to de-duplicate NOTIFY events faster.

commit   : bb5ae8f6c4161e1742a90f27b697eeb14812e65f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 12:22:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 12:22:12 -0400    

Click here for diff

Previously, async.c got rid of duplicate notifications by scanning  
the list of pending events to compare each one to the proposed new  
event.  This works okay for very small numbers of distinct events,  
but degrades as O(N^2) for many events.  We can improve matters by  
using a hash table to probe for duplicates.  So as not to add a  
lot of overhead for the simple cases that the code did handle well  
before, create the hash table only once a (sub)transaction has  
queued more than 16 distinct notify events.  
  
A downside is that we now have to do per-event work to propagate  
a successful subtransaction's notify events up to its parent.  
(But this isn't significant unless the subtransaction had many  
events, in which case the O(N^2) behavior would have been in  
play already, so we still come out ahead.)  
  
We can make some lemonade out of this lemon, though: since we must  
examine each event anyway, it's now possible to de-duplicate events  
fully, rather than skipping that for events merged up from  
subtransactions.  Hence, remove the old weasel wording in notify.sgml  
about whether de-duplication happens or not, and adjust the test  
case in async-notify.spec that exhibited the old behavior.  
  
While at it, rearrange the definition of struct Notification to make  
it more compact and require just one palloc per event, rather than  
two or three.  This saves space when there are a lot of events,  
in fact more than enough to buy back the space needed for the hash  
table.  
  
Patch by me, based on discussions around a different patch  
submitted by Filip Rembiałkowski.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/notify.sgml
M src/backend/commands/async.c
M src/test/isolation/expected/async-notify.out

Doc: improve documentation about postgresql.auto.conf.

commit   : 45aaaa42fefad6e2f164647e373346a5a4123dad    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 11:14:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 11:14:26 -0400    

Click here for diff

Clarify what external tools can do to this file, and add a bit  
of detail about what ALTER SYSTEM itself does.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Fix ALTER SYSTEM to cope with duplicate entries in postgresql.auto.conf.

commit   : f1bf619acdff15b88b5729f8de6df4eed609b3a0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Aug 2019 15:09:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Aug 2019 15:09:19 -0400    

Click here for diff

ALTER SYSTEM itself normally won't make duplicate entries (although  
up till this patch, it was possible to confuse it by writing case  
variants of a GUC's name).  However, if some external tool has appended  
entries to the file, that could result in duplicate entries for a single  
GUC name.  In such a situation, ALTER SYSTEM did exactly the wrong thing,  
because it replaced or removed only the first matching entry, leaving  
the later one(s) still there and hence still determining the active value.  
  
This patch fixes that by making ALTER SYSTEM sweep through the file and  
remove all matching entries, then (if not ALTER SYSTEM RESET) append the  
new setting to the end.  This means entries will be in order of last  
setting rather than first setting, but that shouldn't hurt anything.  
  
Also, make the comparisons case-insensitive so that the right things  
happen if you do, say, ALTER SYSTEM SET "TimeZone" = 'whatever'.  
  
This has been broken since ALTER SYSTEM was invented, so back-patch  
to all supported branches.  
  
Ian Barwick, with minor mods by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove block number field from nbtree stack.

commit   : 9c02cf56614366769682bb8b3f4e9eecf8f237c4    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 14 Aug 2019 11:32:35 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 14 Aug 2019 11:32:35 -0700    

Click here for diff

The initial value of the nbtree stack downlink block number field  
recorded during an initial descent of the tree wasn't actually used.  
Both _bt_getstackbuf() callers overwrote the value with their own value.  
  
Remove the block number field from the stack struct, and add a child  
block number argument to _bt_getstackbuf() in its place.  This makes the  
overall design of _bt_getstackbuf() clearer.  
  
Author: Peter Geoghegan  
Reviewed-By: Anastasia Lubennikova  
Discussion: https://postgr.es/m/CAH2-Wzmx+UbXt2YNOUCZ-a04VdXU=S=OHuAuD7Z8uQq-PXTYUg@mail.gmail.com  

M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/include/access/nbtree.h

initdb: Remove obsolete locale handling

commit   : fded4773eb60541c6e7dbcf09c9bcb1cd36a063b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Aug 2019 06:50:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Aug 2019 06:50:47 +0200    

Click here for diff

The method of passing LC_COLLATE and LC_CTYPE to the backend during  
initdb is obsolete as of 61d967498802ab86d8897cb3c61740d7e9d712f6.  
This can all be removed.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/eeaf2f99-a1a6-8aca-3f43-9ab0b2fb112a%402ndquadrant.com  

M src/backend/main/main.c
M src/bin/initdb/initdb.c

Fix random regression failure in test case "collate.icu.utf8"

commit   : 96e7e1bc08919ceb34d95140834f0db94266da2e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Aug 2019 13:37:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Aug 2019 13:37:48 +0900    

Click here for diff

This is a fix similar to 2d7d67cc, where slight plan alteration can  
cause a random failure of this regression test because of an incorect  
tuple ordering, except that this one involves lookups of pg_type.  
Similarly to the other case, add ORDER BY clauses to ensure the output  
order.  
  
The failure has been seen at least once on buildfarm member skink.  
  
Reported-by: Thomas Munro  
Discussion: https://postgr.es/m/CA+hUKGLjR9ZBvhXcr9b-NSBHPw9aRgbjyzGE+kqLsT4vwX+nkQ@mail.gmail.com  
Backpatch-through: 12  

M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Remove obsolete nbtree README commentary.

commit   : 68ef887842ff716097bbb1bad86a40bb62247061    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 13 Aug 2019 17:16:44 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 13 Aug 2019 17:16:44 -0700    

Click here for diff

Commit d2086b08b02 removed almost all cases where nbtree must release a  
read buffer lock and acquire a write buffer lock instead, so remaining  
cases in which that's still necessary are not notable enough to appear  
in the nbtree README.  
  
More importantly, holding on to a buffer pin in cases where nbtree must  
trade a read lock for a write lock is very unlikely to save any I/O.  
This seems to have been a long overlooked throwback to a time when  
nbtree cared about write-ordering dependencies, and performed  
synchronous buffer writes.  It hasn't worked that way in many years.  

M src/backend/access/nbtree/README

Un-break pg_dump for pre-8.3 source servers.

commit   : 31d43710fb069a5c2be6ec1dbc9fa7261cf9feff    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Aug 2019 16:57:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Aug 2019 16:57:58 -0400    

Click here for diff

Commit 07b39083c inserted an unconditional reference to pg_opfamily,  
which of course fails on servers predating that catalog.  Fortunately,  
the case it's trying to solve can't occur on such old servers (AFAIK).  
Hence, just skip the additional code when the source predates 8.3.  
  
Per bug #15955 from sly.  Back-patch to all supported branches,  
like the previous patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Use PageIndexTupleOverwrite() within nbtree.

commit   : af0ba49809b57203d87702b315b64f1fd53c728d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 13 Aug 2019 11:54:26 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 13 Aug 2019 11:54:26 -0700    

Click here for diff

Use the PageIndexTupleOverwrite() bufpage.c routine within nbtree  
instead of deleting a tuple and re-inserting its replacement.  This  
makes the intent of affected code slightly clearer.  It also makes  
CREATE INDEX slightly faster, since there is no longer a need to shift  
every leaf page's line pointer array back and forth during index builds.  
  
Author: Peter Geoghegan, Anastasia Lubennikova  
Reviewed-By: Anastasia Lubennikova  
Discussion: https://postgr.es/m/CAH2-Wz=Zk=B9+Vwm376WuO7YTjFc2SSskifQm4Nme3RRRPtOSQ@mail.gmail.com  

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

Don't constraint-exclude partitioned tables as much

commit   : 815ef2f568c754dcb539cca574f1982317d74db6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 13 Aug 2019 10:26:04 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 13 Aug 2019 10:26:04 -0400    

Click here for diff

We only need to invoke constraint exclusion on partitioned tables when  
they are a partition, and they themselves contain a default partition;  
it's not necessary otherwise, and it's expensive, so avoid it.  Also, we  
were trying once for each clause separately, but we can do it for all  
the clauses at once.  
  
While at it, centralize setting of RelOptInfo->partition_qual instead of  
computing it in slightly different ways in different places.  
  
Per complaints from Simon Riggs about 4e85642d935e; reviewed by Yuzuko  
Hosoya, Kyotaro Horiguchi.  
  
Author: Amit Langote.  I (Álvaro) again mangled the patch somewhat.  
Discussion: https://postgr.es/m/CANP8+j+tMCY=nEcQeqQam85=uopLBtX-2vHiLD2bbp7iQQUKpA@mail.gmail.com  

M src/backend/optimizer/util/plancat.c
M src/backend/partitioning/partprune.c

Update to DocBook 4.5

commit   : 416c75cf38fbf58f4589fb27b520b64092a7ceff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Aug 2019 08:38:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Aug 2019 08:38:21 +0200    

Click here for diff

This moves us to the latest minor version of DocBook 4.  It requires  
no markup changes.  

M configure
M configure.in
M doc/src/sgml/docguide.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/standalone-install.xml
M doc/src/sgml/standalone-profile.xsl

Fix inconsistencies and typos in the tree, take 10

commit   : 66bde49d96a9ddacc49dcbdf1b47b5bd6e31ead5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 13 Aug 2019 13:53:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 13 Aug 2019 13:53:41 +0900    

Click here for diff

This addresses some issues with unnecessary code comments, fixes various  
typos in docs and comments, and removes some orphaned structures and  
definitions.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M contrib/fuzzystrmatch/dmetaphone.c
M contrib/ltree/ltxtquery_io.c
M contrib/pgcrypto/internal.c
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp-encrypt.c
M contrib/pgcrypto/pgp.h
M contrib/sepgsql/label.c
M contrib/sepgsql/selinux.c
M contrib/spi/refint.example
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/sources.sgml
M src/backend/access/brin/brin_revmap.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/catalog.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/cluster.c
M src/backend/commands/sequence.c
M src/backend/executor/spi.c
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/optimizer/path/costsize.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/port/posix_sema.c
M src/backend/port/win32/signal.c
M src/backend/postmaster/checkpointer.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/worker.c
M src/backend/replication/slot.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/misc/check_guc
M src/backend/utils/mmgr/slab.c
M src/backend/utils/sort/tuplesort.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/include/access/brin_revmap.h
M src/include/access/hash_xlog.h
M src/include/access/reloptions.h
M src/include/access/xlogreader.h
M src/include/catalog/namespace.h
M src/include/nodes/nodes.h
M src/include/port/win32_port.h
M src/include/rewrite/prs2lock.h
M src/include/storage/standbydefs.h
M src/include/utils/elog.h
M src/include/utils/guc.h
M src/include/utils/rel.h
M src/include/utils/selfuncs.h
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/libpq/libpq-fe.h
M src/pl/plpython/plpy_subxactobject.c
M src/port/getaddrinfo.c
M src/test/isolation/specs/sequence-ddl.spec
M src/test/recovery/t/012_subtransactions.pl
M src/test/regress/.gitignore
M src/timezone/pgtz.c
M src/tools/pgindent/README

Fix random regression failure in test case "temp"

commit   : 2d7d67cc74d0f59e76464bd5009bc74f1591018e    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 13 Aug 2019 10:55:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 13 Aug 2019 10:55:19 +0900    

Click here for diff

This test case could fail because of an incorrect result ordering when  
looking up at pg_class entries.  This commit adds an ORDER BY to the  
culprit query.  The cause of the failure was likely caused by a plan  
switch.  By default, the planner would likely choose an index-only scan  
or an index scan, but even a small change in the startup cost could have  
caused a bitmap heap scan to be chosen, causing the failure.  
  
While on it, switch some filtering quals to a regular expression as per  
an idea of Tom Lane.  As previously shaped, the quals would have  
selected any relations whose name begins with "temp".  And that could  
cause failures if another test running in parallel began to use similar  
relation names.  
  
Per report from buildfarm member anole, though the failure was very  
rare.  This test has been introduced by 319a810, so backpatch down to  
v10.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

amcheck: Skip unlogged relations during recovery.

commit   : 6754fe65a4c68c1e3b179080ab62c2f3ff6d877c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 12 Aug 2019 15:21:32 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 12 Aug 2019 15:21:32 -0700    

Click here for diff

contrib/amcheck failed to consider the possibility that unlogged  
relations will not have any main relation fork files when running in hot  
standby mode.  This led to low-level "can't happen" errors that complain  
about the absence of a relfilenode file.  
  
To fix, simply skip verification of unlogged index relations during  
recovery.  In passing, add a direct check for the presence of a main  
fork just before verification proper begins, so that we cleanly verify  
the presence of the main relation fork file.  
  
Author: Andrey Borodin, Peter Geoghegan  
Reported-By: Andrey Borodin  
Diagnosed-By: Andrey Borodin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-, where amcheck was introduced.  

M contrib/amcheck/verify_nbtree.c

Fix planner's test for case-foldable characters in ILIKE with ICU.

commit   : 03c811a483b243952874d8e2b3f0c2e3793bc952    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Aug 2019 13:15:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Aug 2019 13:15:47 -0400    

Click here for diff

As coded, the ICU-collation path in pattern_char_isalpha() failed  
to consider regular ASCII letters to be case-varying.  This led to  
like_fixed_prefix treating too much of an ILIKE pattern as being a  
fixed prefix, so that indexscans derived from an ILIKE clause might  
miss entries that they should find.  
  
Per bug #15892 from James Inform.  This is an oversight in the original  
ICU patch (commit eccfef81e), so back-patch to v10 where that came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove EState.es_range_table_array.

commit   : 3c926587b5928795e54dfea65c712a604f63cdeb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Aug 2019 11:58:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Aug 2019 11:58:35 -0400    

Click here for diff

Now that list_nth is O(1), there's no good reason to maintain a  
separate array of RTE pointers rather than indexing into  
estate->es_range_table.  Deleting the array doesn't save all that  
much either; but just on cleanliness grounds, it's better not to  
have duplicate representations of the identical information.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rationalize use of list_concat + list_copy combinations.

commit   : 5ee190f8ec37c1bbfb3061e18304e155d600bc8e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Aug 2019 11:20:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Aug 2019 11:20:18 -0400    

Click here for diff

In the wake of commit 1cff1b95a, the result of list_concat no longer  
shares the ListCells of the second input.  Therefore, we can replace  
"list_concat(x, list_copy(y))" with just "list_concat(x, y)".  
  
To improve call sites that were list_copy'ing the first argument,  
or both arguments, invent "list_concat_copy()" which produces a new  
list sharing no ListCells with either input.  (This is a bit faster  
than "list_concat(list_copy(x), y)" because it makes the result list  
the right size to start with.)  
  
In call sites that were not list_copy'ing the second argument, the new  
semantics mean that we are usually leaking the second List's storage,  
since typically there is no remaining pointer to it.  We considered  
inventing another list_copy variant that would list_free the second  
input, but concluded that for most call sites it isn't worth worrying  
about, given the relative compactness of the new List representation.  
(Note that in cases where such leakage would happen, the old code  
already leaked the second List's header; so we're only discussing  
the size of the leak not whether there is one.  I did adjust two or  
three places that had been troubling to free that header so that  
they manually free the whole second List.)  
  
Patch by me; thanks to David Rowley for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/indexcmds.c
M src/backend/executor/functions.c
M src/backend/nodes/list.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/partitioning/partprune.c
M src/backend/replication/syncrep.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/pg_list.h

Fix string comparison in jsonpath

commit   : 251c8e39bc6b0a3ff1620d9ac10888a7660e6b88    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 12 Aug 2019 06:19:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 12 Aug 2019 06:19:19 +0300    

Click here for diff

Take into account pg_server_to_any() may return input string "as is".  
  
Reported-by: Andrew Dunstan, Thomas Munro  
Discussion: https://postgr.es/m/0ed83a33-d900-466a-880a-70ef456c721f%402ndQuadrant.com  
Author: Alexander Korotkov, Thomas Munro  
Backpatch-through: 12  

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

Partially revert "Insert temporary debugging output in regression tests."

commit   : b43f7c117e667fb51df36ca62e6c86054b0f8d03    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Aug 2019 18:55:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Aug 2019 18:55:32 -0400    

Click here for diff

This reverts much of commit f03a9ca4366d064d89b7cf7ed75d4e43f2ed0667,  
but leaves the relpages/reltuples probe in select_parallel.sql.  
The pg_stat_all_tables probes are unstable enough to be annoying,  
and it no longer seems likely that they will teach us anything more  
about the underlying problem.  I'd still like some more confirmation  
though that the observed plan instability is caused by VACUUM leaving  
relpages/reltuples as zero for one of these tables.  
  
Discussion: https://postgr.es/m/CA+hUKG+0CxrKRWRMf5ymN3gm+BECHna2B-q1w8onKBep4HasUw@mail.gmail.com  

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

Adjust string comparison in jsonpath

commit   : d54ceb9e176152f930e60709e07c636e8e5414f5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 11 Aug 2019 22:54:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 11 Aug 2019 22:54:53 +0300    

Click here for diff

We have implemented jsonpath string comparison using default database locale.  
However, standard requires us to compare Unicode codepoints.  This commit  
implements that, but for performance reasons we still use per-byte comparison  
for "==" operator.  Thus, for consistency other comparison operators do per-byte  
comparison if Unicode codepoints appear to be equal.  
  
In some edge cases, when same Unicode codepoints have different binary  
representations in database encoding, we diverge standard to achieve better  
performance of "==" operator.  In future to implement strict standard  
conformance, we can do normalization of input JSON strings.  
  
Original patch was written by Nikita Glukhov, rewritten by me.  
  
Reported-by: Markus Winand  
Discussion: https://postgr.es/m/8B7FA3B4-328D-43D7-95A8-37B8891B8C78%40winand.at  
Author: Nikita Glukhov, Alexander Korotkov  
Backpatch-through: 12  

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

Fix "ANALYZE t, t" inside a transaction block.

commit   : cabe0f298ea7efade11d8171c617e668934d0d09    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Aug 2019 11:30:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Aug 2019 11:30:11 -0400    

Click here for diff

This failed with either "tuple already updated by self" or "duplicate  
key value violates unique constraint", depending on whether the table  
had previously been analyzed or not.  The reason is that ANALYZE tried  
to insert or update the same pg_statistic rows twice, and there was no  
CommandCounterIncrement between.  So add one.  The same case works fine  
outside a transaction block, because then there's a whole transaction  
boundary between, as a consequence of the way VACUUM works.  
  
This issue has been latent all along, but the problem was unreachable  
before commit 11d8d72c2 added the ability to specify multiple tables  
in ANALYZE.  We could, perhaps, alternatively fix it by adding code to  
de-duplicate the list of VacuumRelations --- but that would add a  
lot of overhead to work around dumb commands, so it's not attractive.  
  
Per bug #15946 from Yaroslav Schekin.  Back-patch to v11.  
  
(Note: in v11 I also back-patched the test added by commit 23224563d;  
otherwise the problem doesn't manifest in the test I added, because  
"vactst" is empty when the tests for multiple ANALYZE targets are  
reached.  That seems like not a very good thing anyway, so I did this  
rather than rethinking the choice of test case.)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rename tuplesort.c's SortTuple.tupindex field.

commit   : d8cd68c8d472292ef8943a765bd1c69c0d4d61d8    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 9 Aug 2019 17:06:45 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 9 Aug 2019 17:06:45 -0700    

Click here for diff

Rename the "tupindex" field from tuplesort.c's SortTuple struct to  
"srctape", since it can only ever be used to store a source/input tape  
number when merging external sort runs.  This has been the case since  
commit 8b304b8b72b, which removed replacement selection sort from  
tuplesort.c.  

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

Fix SIGSEGV in pruning for ScalarArrayOp with constant-null array.

commit   : 0662eb6219f1f4bafc1916a0bf2813cdc58e5eca    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Aug 2019 13:20:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Aug 2019 13:20:28 -0400    

Click here for diff

Not much to be said here: commit 9fdb675fc should have checked  
constisnull, didn't.  
  
Per report from Piotr Włodarczyk.  Back-patch to v11 where  
bug was introduced.  
  
Discussion: https://postgr.es/m/CAP-dhMr+vRpwizEYjUjsiZ1vwqpohTm+3Pbdt6Pr7FEgPq9R0Q@mail.gmail.com  

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

Cosmetic improvements in setup of planner's per-RTE arrays.

commit   : 1661a4050593a472c369a6660ffec05b6b837c57    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Aug 2019 12:33:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Aug 2019 12:33:43 -0400    

Click here for diff

Merge setup_append_rel_array into setup_simple_rel_arrays.  There's no  
particularly good reason to keep them separate, and it's inconsistent  
with the lack of separation in expand_planner_arrays.  The only apparent  
benefit was that the fast path for trivial queries in query_planner()  
doesn't need to set up the append_rel_array; but all we're saving there  
is an if-test and NULL assignment, which surely ought to be negligible.  
  
Also improve some obsolete comments.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/pathnode.h

Refactor logic to remove trailing CR/LF characters from strings

commit   : b8f2da0ac5a24f669c8d320c58646759b8fc69a5    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Aug 2019 11:05:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Aug 2019 11:05:14 +0900    

Click here for diff

b654714 has reworked the way trailing CR/LF characters are removed from  
strings.  This commit introduces a new routine in common/string.c and  
refactors the code so as the logic is in a single place, mostly.  
  
Author: Michael Paquier  
Reviewed-by: Bruce Momjian  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-common.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/option.c
M src/bin/psql/prompt.c
M src/common/string.c
M src/include/common/string.h
M src/interfaces/libpq/fe-connect.c

Update obsolete tuplesort READTUP() comment.

commit   : 28b901f73a3924187988bfaac57d20e422a432c3    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 8 Aug 2019 13:20:44 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 8 Aug 2019 13:20:44 -0700    

Click here for diff

READTUP() routines do not and cannot use the resettable "tuplecontext"  
memory context, since it is deleted when merging begins.  Update an  
obsolete comment that claimed otherwise.  This was an oversight in  
commit e94568ecc10.  
  
In passing, fix an unrelated tuplesort typo.  

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

Clarify the default partition's role

commit   : 956451e8bc9face2241d9a785e0d236a92f8e210    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 8 Aug 2019 16:03:14 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 8 Aug 2019 16:03:14 -0400    

Click here for diff

Reviewed by Tom Lane and Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_table.sgml

Fix certificate subjects in ldap test

commit   : 15077ab63f29fd85ff519d1c456fda614774d28b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 8 Aug 2019 14:57:48 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 8 Aug 2019 14:57:48 -0400    

Click here for diff

openssl doesn't like lower case subject attribute names. Error observed  
in buildfarm results.  
  
Backpatch to release 11.  

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

initdb: Use varargs macro for PG_CMD_PRINTF

commit   : 43211c2a02f39d6568496168413dc00e0399dc2e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Aug 2019 08:47:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Aug 2019 08:47:55 +0200    

Click here for diff

I left PG_CMD_PUTS around even though it could be handled by  
PG_CMD_PRINTF since PG_CMD_PUTS is sometimes called with non-literal  
arguments, and so that would create a potential problem if such a  
string contained percent signs.  
  
Reviewed-by: Tom Lane <[email protected]>  

M src/bin/initdb/initdb.c

Doc: document permissions required for ANALYZE.

commit   : e94cd0a8eb831d3ad756ad5f1e69b05392038355    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Aug 2019 18:09:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Aug 2019 18:09:28 -0400    

Click here for diff

VACUUM's reference page had this text, but ANALYZE's didn't.  That's  
a clear oversight given that section 5.7 explicitly delegates the  
responsibility to define permissions requirements to the individual  
commands' man pages.  
  
Per gripe from Isaac Morland.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAMsGm5fp3oBUs-2iRfii0iEO=fZuJALVyM2zJLhNTjG34gpAVQ@mail.gmail.com  

M doc/src/sgml/ref/analyze.sgml

Remove unnecessary #include <limits.h>

commit   : e1f4c481b995d0f4ef9570aaf9638fe06bc5d742    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Aug 2019 16:55:31 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Aug 2019 16:55:31 -0400    

Click here for diff

This include was probably copied from tuplestore.c, but it's not needed.  
  
Extracted from a larger patch submitted by vignesh C <[email protected]>  
  
Discussion: https://postgr.es/m/CALDaNm1B9naPDTm3ox1m_yZvOm3KA5S4kZQSWWAeLHAQ=3gV1Q@mail.gmail.com  

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

Add comment on no default partition with hash partitioning

commit   : 12afc7145c03c212f26fea3a99e016da6a1c919c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Aug 2019 12:27:47 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Aug 2019 12:27:47 -0400    

Click here for diff

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

M src/backend/parser/parse_utilcmd.c

Apply constraint exclusion more generally in partitioning

commit   : 4e85642d935eb13341584df7776eb76585d45819    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Aug 2019 12:21:22 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Aug 2019 12:21:22 -0400    

Click here for diff

We were applying constraint exclusion on the partition constraint when  
generating pruning steps for a clause, but only for the rather  
restricted situation of them being boolean OR operators; however it is  
possible to have differently shaped clauses that also benefit from  
constraint exclusion.  This applies particularly to the default  
partition since their constraints are in essence a long list of OR'ed  
subclauses ... but it applies to other cases too.  So in certain cases  
we're scanning partitions that we don't need to.  
  
Remove the specialized code in OR clauses, and add a generally  
applicable test of the clause refuting the partition constraint; mark  
the whole pruning operation as contradictory if it hits.  
  
This has the unwanted side-effect of testing some (most? all?)  
constraints more than once if constraint_exclusion=on.  That seems  
unavoidable as far as I can tell without some additional work, but  
that's not the recommended setting for that parameter anyway.  
However, because this imposes additional processing cost for all  
queries using partitioned tables, I decided not to backpatch this  
change.  
  
Author: Amit Langote, Yuzuko Hosoya, Álvaro Herrera  
Reviewers: Shawn Wang, Thibaut Madeleine, Yoshikazu Imai, Kyotaro  
Horiguchi; they were also uncredited reviewers for commit 489247b0e615.  
Discussion: https://postgr.es/m/[email protected]  

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

Fix some typos in jsonpath documentation

commit   : 1f33f211bc531d257f84fefb9208dd43e8718972    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 7 Aug 2019 16:06:45 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 7 Aug 2019 16:06:45 +0300    

Click here for diff

Discussion: https://postgr.es/m/8B7FA3B4-328D-43D7-95A8-37B8891B8C78%40winand.at  
Author: Markus Winand  
Backpatch-through: 12  

M doc/src/sgml/func.sgml

Fix typos in comments.

commit   : 68343b4ad75305391b38f4b42734dc07f2fe7ee2    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 7 Aug 2019 19:05:17 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 7 Aug 2019 19:05:17 +0900    

Click here for diff

M src/backend/partitioning/partbounds.c

Fix predicate-locking of HOT updated rows.

commit   : 1169fcf129f41762fa8a2d82b52eabd788b3a4de    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Aug 2019 12:40:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Aug 2019 12:40:49 +0300    

Click here for diff

In serializable mode, heap_hot_search_buffer() incorrectly acquired a  
predicate lock on the root tuple, not the returned tuple that satisfied  
the visibility checks. As explained in README-SSI, the predicate lock does  
not need to be copied or extended to other tuple versions, but for that to  
work, the correct, visible, tuple version must be locked in the first  
place.  
  
The original SSI commit had this bug in it, but it was fixed back in 2013,  
in commit 81fbbfe335. But unfortunately, it was reintroduced a few months  
later in commit b89e151054. Wising up from that, add a regression test  
to cover this, so that it doesn't get reintroduced again. Also, move the  
code that sets 't_self', so that it happens at the same time that the  
other HeapTuple fields are set, to make it more clear that all the code in  
the loop operate on the "current" tuple in the chain, not the root tuple.  
  
Bug spotted by Andres Freund, analysis and original fix by Thomas Munro,  
test case and some additional changes to the fix by Heikki Linnakangas.  
Backpatch to all supported versions (9.4).  
  
Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de  

M src/backend/access/heap/heapam.c
A src/test/isolation/expected/predicate-lock-hot-tuple.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/predicate-lock-hot-tuple.spec

Fix some incorrect parsing of time with time zone strings

commit   : 64579be64a3811d08ea7ccf92b1a443d76b96412    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Aug 2019 18:16:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Aug 2019 18:16:31 +0900    

Click here for diff

When parsing a timetz string with a dynamic timezone abbreviation or a  
timezone not specified, it was possible to generate incorrect timestamps  
based on a date which uses some non-initialized variables if the input  
string did not specify fully a date to parse.  This is already checked  
when a full timezone spec is included in the input string, but the two  
other cases mentioned above missed the same checks.  
  
This gets fixed by generating an error as this input is invalid, or in  
short when a date is not fully specified.  
  
Valgrind was complaining about this problem.  
  
Bug: #15910  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

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

Adjust tuple data lookup logic in multi-insert logical decoding

commit   : 75c1921cd6c868c5995b88113b4463a4830b9a27    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Aug 2019 10:28:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Aug 2019 10:28:16 +0900    

Click here for diff

As of now, logical decoding of a multi-insert has been scanning all  
xl_multi_insert_tuple entries only if XLH_INSERT_CONTAINS_NEW_TUPLE was  
getting set in the record.  This is not an issue on HEAD as multi-insert  
records are not used for system catalogs, but the logical decoding logic  
includes all the code necessary to handle that properly, except that the  
code missed to iterate correctly over all xl_multi_insert_tuple entries  
when the flag is not set.  Hence, when trying to use multi-insert for  
system catalogs, an assertion would be triggered.  
  
An upcoming patch is going to make use of multi-insert for system  
catalogs, and this fixes the logic to make sure that all entries are  
scanned correctly without softening the existing assertions.  
  
Reported-by: Daniel Gustafsson  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

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

Fix intarray's GiST opclasses to not fail for empty arrays with <@.

commit   : efc77cf5f1deb96a5233c04d287ead01ee7b260d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Aug 2019 18:04:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Aug 2019 18:04:51 -0400    

Click here for diff

contrib/intarray considers "arraycol <@ constant-array" to be indexable,  
but its GiST opclass code fails to reliably find index entries for empty  
array values (which of course should trivially match such queries).  
This is because the test condition to see whether we should descend  
through a non-leaf node is wrong.  
  
Unfortunately, empty array entries could be anywhere in the index,  
as these index opclasses are currently designed.  So there's no way  
to fix this except by lobotomizing <@ indexscans to scan the whole  
index ... which is what this patch does.  That's pretty unfortunate:  
the performance is now actually worse than a seqscan, in most cases.  
We'd be better off to remove <@ from the GiST opclasses entirely,  
and perhaps a future non-back-patchable patch will do so.  
  
In the meantime, applications whose performance is adversely impacted  
have a couple of options.  They could switch to a GIN index, which  
doesn't have this bug, or they could replace "arraycol <@ constant-array"  
with "arraycol <@ constant-array AND arraycol && constant-array".  
That will provide about the same performance as before, and it will find  
all non-empty subsets of the given constant-array, which is all that  
could reliably be expected of the query before.  
  
While at it, add some more regression test cases to improve code  
coverage of contrib/intarray.  
  
In passing, adjust resize_intArrayType so that when it's returning an  
empty array, it uses construct_empty_array for that rather than  
cowboy hacking on the input array.  While the hack produces an array  
that looks valid for most purposes, it isn't bitwise equal to empty  
arrays produced by other code paths, which could have subtle odd  
effects.  I don't think this code path is performance-critical  
enough to justify such shortcuts.  (Back-patch this part only as far  
as v11; before commit 01783ac36 we were not careful about this in  
other intarray code paths either.)  
  
Back-patch the <@ fixes to all supported versions, since this was  
broken from day one.  
  
Patch by me; thanks to Alexander Korotkov for review.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Save Kerberos and LDAP daemon logs where the buildfarm can find them.

commit   : 4ecd05cb771313d8e4d4007ec02408e5f18de5d2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Aug 2019 17:08:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Aug 2019 17:08:07 -0400    

Click here for diff

src/test/kerberos and src/test/ldap try to run private authentication  
servers, which of course might fail.  The logs from these servers  
were being dropped into the tmp_check/ subdirectory, but they should  
be put in tmp_check/log/, because the buildfarm will only capture  
log files in that subdirectory.  Without the log output there's  
little hope of diagnosing buildfarm failures related to these servers.  
  
Backpatch to v11 where these test suites were added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo in pathnode.c

commit   : 940c8b01b071b777ed56c086c383e054fbd0456e    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Aug 2019 18:11:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Aug 2019 18:11:02 +0900    

Click here for diff

Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqFhZ6ABoz-i=JZ5wMMyz-orx4asjR0og9qBtgEwOww6Yg@mail.gmail.com  

M src/backend/optimizer/util/pathnode.c

Show specific OID suggestion in unused_oids output.

commit   : 98eab30b93d52a114bd65e154cda3402d0630667    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 5 Aug 2019 11:47:34 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 5 Aug 2019 11:47:34 -0700    

Click here for diff

Commit a6417078 established a new project policy around OID assignment:  
new patches are encouraged to choose a random OID in the 8000..9999  
range when a manually-assigned OID is required (if multiple OIDs are  
required, a consecutive block of OIDs starting from the random point  
should be used).  Catalog entries added by committed patches that use  
OIDs from this "unstable" range are renumbered after feature freeze.  
This practice minimizes OID collisions among concurrently-developed  
patches.  
  
Show a specific random OID suggestion when the unused_oids script is  
run.  This makes it easy for patch authors to use a random OID from the  
unstable range, per the new policy.  
  
Author: Julien Rouhaud, Peter Geoghegan  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/CAH2-WzkkRs2ScmuBQ7xWi7xzp7fC1B3w0Nt8X+n4rBw5k+Z=zA@mail.gmail.com  

M src/include/catalog/unused_oids

Fix choice of comparison operators for cross-type hashed subplans.

commit   : 4766dce0dd1a1a26db253dfc81773a2c55cd2555    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Aug 2019 11:20:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Aug 2019 11:20:21 -0400    

Click here for diff

Commit bf6c614a2 rearranged the lookup of the comparison operators  
needed in a hashed subplan, and in so doing, broke the cross-type  
case: it caused the original LHS-vs-RHS operator to be used to compare  
hash table entries too (which of course are all of the RHS type).  
This leads to C functions being passed a Datum that is not of the  
type they expect, with the usual hazards of crashes and unauthorized  
server memory disclosure.  
  
For the set of hashable cross-type operators present in v11 core  
Postgres, this bug is nearly harmless on 64-bit machines, which  
may explain why it escaped earlier detection.  But it is a live  
security hazard on 32-bit machines; and of course there may be  
extensions that add more hashable cross-type operators, which  
would increase the risk.  
  
Reported by Andreas Seltenreich.  Back-patch to v11 where the  
problem came in.  
  
Security: CVE-2019-10209  

M src/backend/executor/nodeSubplan.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Require the schema qualification in pg_temp.type_name(arg).

commit   : ffa2d37e5fbd1243f918f622113d6e371667e5a0    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Aug 2019 07:48:41 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Aug 2019 07:48:41 -0700    

Click here for diff

Commit aa27977fe21a7dfa4da4376ad66ae37cb8f0d0b5 introduced this  
restriction for pg_temp.function_name(arg); do likewise for types  
created in temporary schemas.  Programs that this breaks should add  
"pg_temp." schema qualification or switch to arg::type_name syntax.  
Back-patch to 9.4 (all supported versions).  
  
Reviewed by Tom Lane.  Reported by Tom Lane.  
  
Security: CVE-2019-10208  

M doc/src/sgml/config.sgml
M src/backend/catalog/namespace.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_type.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/namespace.h
M src/include/parser/parse_type.h
M src/test/regress/expected/temp.out
M src/test/regress/sql/temp.sql

Add safeguards in LSN, numeric and float calculation for custom errors

commit   : a76cfba663ceab79b891cc81a5f941051755b3b0    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Aug 2019 15:35:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Aug 2019 15:35:16 +0900    

Click here for diff

Those data types use parsing and/or calculation wrapper routines which  
can generate some generic error messages in the event of a failure.  The  
caller of these routines can also pass a pointer variable settable by  
the routine to track if an error has happened, letting the caller decide  
what to do in the event of an error and what error message to generate.  
  
Those routines have been slacking the initialization of the tracking  
flag, which can be confusing when reading the code, so add some  
safeguards against calls of these parsing routines which could lead to a  
dubious result.  
  
The LSN parsing gains an assertion to make sure that the tracking flag  
is set, while numeric and float paths initialize the flag to a saner  
state.  
  
Author: Jeevan Ladhe  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/CAOgcT0NOM9oR0Hag_3VpyW0uF3iCU=BDUFSPfk9JrWXRcWQHqw@mail.gmail.com  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pg_lsn.c

Fix tab completion for ALTER LANGUAGE in psql

commit   : 05ba8370b8e4b5c8f3dd51986b9fdeb43fed5610    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Aug 2019 14:27:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Aug 2019 14:27:20 +0900    

Click here for diff

OWNER_TO was used for the completion, which is not a supported grammar,  
but OWNER TO is.  
  
This error has been introduced by d37b816, so backpatch down to 9.6.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

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

Fix inconsistencies and typos in the tree, take 9

commit   : 8548ddc61b5858b6466e69f66a6b1a7ea9daef06    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Aug 2019 12:14:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Aug 2019 12:14:58 +0900    

Click here for diff

This addresses more issues with code comments, variable names and  
unreferenced variables.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_standby/pg_standby.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/px.h
M contrib/pgcrypto/sha1.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/sepgsql.h
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/libpq.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/sslinfo.sgml
M src/backend/access/gin/README
M src/backend/access/gin/ginbtree.c
M src/backend/access/gist/gistget.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/transam/README
M src/backend/access/transam/clog.c
M src/backend/access/transam/multixact.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/objectaddress.c
M src/backend/commands/copy.c
M src/backend/commands/define.c
M src/backend/commands/prepare.c
M src/backend/commands/vacuum.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/params.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/plan/planner.c
M src/backend/parser/parse_oper.c
M src/backend/postmaster/pgstat.c
M src/backend/regex/regcomp.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/psql/describe.h
M src/common/unicode/norm_test.c
M src/include/access/commit_ts.h
M src/include/access/gin_private.h
M src/include/access/hash.h
M src/include/access/nbtxlog.h
M src/include/access/xloginsert.h
M src/include/catalog/catversion.h
M src/include/commands/extension.h
M src/include/commands/tablecmds.h
M src/include/executor/execExpr.h
M src/include/mb/pg_wchar.h
M src/include/parser/parse_func.h
M src/include/port/atomics.h
M src/include/storage/itemptr.h
M src/include/storage/off.h
M src/include/storage/proc.h
M src/include/utils/jsonapi.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_procedure.c
M src/test/isolation/Makefile
M src/tools/msvc/Project.pm

Revert "Add log_statement_sample_rate parameter"

commit   : 75506195da81d75597a4025b72f8367e6c45f60d    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 4 Aug 2019 20:29:00 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 4 Aug 2019 20:29:00 +0200    

Click here for diff

This reverts commit 88bdbd3f746049834ae3cc972e6e650586ec3c9d.  
  
As committed, statement sampling used the existing duration threshold  
(log_min_duration_statement) when decide which statements to sample.  
The issue is that even the longest statements are subject to sampling,  
and so may not end up logged. An improvement was proposed, introducing  
a second duration threshold, but it would not be backwards compatible.  
So we've decided to revert this feature - the separate threshold should  
be part of the feature itself.  
  
Discussion: https://postgr.es/m/CAFj8pRDS8tQ3Wviw9%3DAvODyUciPSrGeMhJi_WPE%2BEB8%2B4gLL-Q%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc.h

Revert "Silence compiler warning"

commit   : 4f9ed8f3c5ef0034c98dd34549f85d8c72aab9ad    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 4 Aug 2019 20:19:54 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 4 Aug 2019 20:19:54 +0200    

Click here for diff

This reverts commit 9dc122585551516309c9362e673effdbf3bd79bd.  
  
As committed, statement sampling used the existing duration threshold  
(log_min_duration_statement) when decide which statements to sample.  
The issue is that even the longest statements are subject to sampling,  
and so may not end up logged. An improvement was proposed, introducing  
a second duration threshold, but it would not be backwards compatible.  
So we've decided to revert this feature - the separate threshold should  
be part of the feature itself.  
  
Discussion: https://postgr.es/m/CAFj8pRDS8tQ3Wviw9%3DAvODyUciPSrGeMhJi_WPE%2BEB8%2B4gLL-Q%40mail.gmail.com  

M src/backend/tcop/postgres.c

Fix handling of "undef" in contrib/jsonb_plperl.

commit   : e0f5048851ff88a53630a0c121a1cd15f6a2f1cd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 14:05:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 14:05:34 -0400    

Click here for diff

Perl has multiple internal representations of "undef", and just  
testing for SvTYPE(x) == SVt_NULL doesn't recognize all of them,  
leading to "cannot transform this Perl type to jsonb" errors.  
Use the approved test SvOK() instead.  
  
Report and patch by Ivan Panchenko.  Back-patch to v11 where  
this module was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/jsonb_plperl/expected/jsonb_plperl.out
M contrib/jsonb_plperl/expected/jsonb_plperlu.out
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plperl/sql/jsonb_plperl.sql
M contrib/jsonb_plperl/sql/jsonb_plperlu.sql

Avoid picking already-bound TCP ports in kerberos and ldap test suites.

commit   : 803466b6ffaa2e5b94d8ce4d7fffa8185f2a0184    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 13:07:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 13:07:12 -0400    

Click here for diff

src/test/kerberos and src/test/ldap need to run a private authentication  
server of the relevant type, for which they need a free TCP port.  
They were just picking a random port number in 48K-64K, which works  
except when something's already using the particular port.  Notably,  
the probability of failure rises dramatically if one simply runs those  
tests in a tight loop, because each test cycle leaves behind a bunch of  
high ports that are transiently in TIME_WAIT state.  
  
To fix, split out the code that PostgresNode.pm already had for  
identifying a free TCP port number, so that it can be invoked to choose  
a port for the KDC or LDAP server.  This isn't 100% bulletproof, since  
conceivably something else on the machine could grab the port between  
the time we check and the time we actually start the server.  But that's  
a pretty short window, so in practice this should be good enough.  
  
Back-patch to v11 where these test suites were added.  
  
Patch by me, reviewed by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/perl/PostgresNode.pm

Improve pruning of a default partition

commit   : 489247b0e615592111226297a0564e11616361a5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Aug 2019 11:18:45 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Aug 2019 11:18:45 -0400    

Click here for diff

When querying a partitioned table containing a default partition, we  
were wrongly deciding to include it in the scan too early in the  
process, failing to exclude it in some cases.  If we reinterpret the  
PruneStepResult.scan_default flag slightly, we can do a better job at  
detecting that it can be excluded.  The change is that we avoid setting  
the flag for that pruning step unless the step absolutely requires the  
default partition to be scanned (in contrast with the previous  
arrangement, which was to set it unless the step was able to prune it).  
So get_matching_partitions() must explicitly check the partition that  
each returned bound value corresponds to in order to determine whether  
the default one needs to be included, rather than relying on the flag  
from the final step result.  
  
Author: Yuzuko Hosoya <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor BuildIndexInfo() with the new makeIndexInfo()

commit   : 69edf4f8802247209e77f69e089799b3d83c13a4    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 4 Aug 2019 11:18:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 4 Aug 2019 11:18:57 +0900    

Click here for diff

This portion of the code got forgotten in 7cce159 which has introduced a  
new routine to build this node, and this finishes the unification of the  
places where IndexInfo is initialized.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c

Fix representation of hash keys in Hash/HashJoin nodes.

commit   : 2abd7ae9b20bcd810d4f19d28aefb97048813825    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 2 Aug 2019 00:02:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 2 Aug 2019 00:02:46 -0700    

Click here for diff

In 5f32b29c1819 I changed the creation of HashState.hashkeys to  
actually use HashState as the parent (instead of HashJoinState, which  
was incorrect, as they were executed below HashState), to fix the  
problem of hashkeys expressions otherwise relying on slot types  
appropriate for HashJoinState, rather than HashState as would be  
correct. That reliance was only introduced in 12, which is why it  
previously worked to use HashJoinState as the parent (although I'd be  
unsurprised if there were problematic cases).  
  
Unfortunately that's not a sufficient solution, because before this  
commit, the to-be-hashed expressions referenced inner/outer as  
appropriate for the HashJoin, not Hash. That didn't have obvious bad  
consequences, because the slots containing the tuples were put into  
ecxt_innertuple when hashing a tuple for HashState (even though Hash  
doesn't have an inner plan).  
  
There are less common cases where this can cause visible problems  
however (rather than just confusion when inspecting such executor  
trees). E.g. "ERROR: bogus varno: 65000", when explaining queries  
containing a HashJoin where the subsidiary Hash node's hash keys  
reference a subplan. While normally hashkeys aren't displayed by  
EXPLAIN, if one of those expressions references a subplan, that  
subplan may be printed as part of the Hash node - which then failed  
because an inner plan was referenced, and Hash doesn't have that.  
  
It seems quite possible that there's other broken cases, too.  
  
Fix the problem by properly splitting the expression for the HashJoin  
and Hash nodes at plan time, and have them reference the proper  
subsidiary node. While other workarounds are possible, fixing this  
correctly seems easy enough. It was a pretty ugly hack to have  
ExecInitHashJoin put the expression into the already initialized  
HashState, in the first place.  
  
I decided to not just split inner/outer hashkeys inside  
make_hashjoin(), but also to separate out hashoperators and  
hashcollations at plan time. Otherwise we would have ended up having  
two very similar loops, one at plan time and the other during executor  
startup. The work seems to more appropriately belong to plan time,  
anyway.  
  
Reported-By: Nikita Glukhov, Alexander Korotkov  
Author: Andres Freund  
Reviewed-By: Tom Lane, in an earlier version  
Discussion: https://postgr.es/m/CAPpHfdvGVegF_TKKRiBrSmatJL2dR9uwFCuR+teQ_8tEXU8mxg@mail.gmail.com  
Backpatch: 12-  

M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

Fix format truncation issue from ECPG test

commit   : a9f301df0e76c38d4544477c1b3e5e29d57904e6    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 2 Aug 2019 09:51:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 2 Aug 2019 09:51:12 +0900    

Click here for diff

This fixes one warning generated by GCC and present in the test case  
array part of ECPG.  This likely got missed in past fixes like 3a4b891  
because the compilation of those tests is not done by default.  
  
Reported-by: Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/expected/sql-array.c
M src/interfaces/ecpg/test/sql/array.pgc

Allow simplehash to use already-calculated hash values.

commit   : 6ae4e8eae78e0781633f7b40a1b5cc189bc40923    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 1 Aug 2019 14:52:43 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 1 Aug 2019 14:52:43 -0700    

Click here for diff

Add _lookup_hash and _insert_hash functions for callers that have  
already calculated the hash value of the key.  
  
The immediate use case is for hash algorithms that write to disk in  
partitions. The hash value can be calculated once, used to perform a  
lookup, used to select the partition, then written to the partition  
along with the tuple. When the tuple is read back, the hash value does  
not need to be recalculated.  
  
Author: Jeff Davis  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/48abe675e1330f0c264ab2fe0d4ff23eb244f9ef.camel%40j-davis.com  

M src/include/lib/simplehash.h

Allow functions-in-FROM to be pulled up if they reduce to constants.

commit   : 7266d0997dd2a0632da38a594c78e25ff21df67e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Aug 2019 18:50:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Aug 2019 18:50:22 -0400    

Click here for diff

This allows simplification of the plan tree in some common usage  
patterns: we can get rid of a join to the function RTE.  
  
In principle we could pull up any immutable expression, but restricting  
it to Consts avoids the risk that multiple evaluations of the expression  
might cost more than we can save.  (Possibly this could be improved in  
future --- but we've more or less promised people that putting a function  
in FROM guarantees single evaluation, so we'd have to tread carefully.)  
  
To do this, we need to rearrange when eval_const_expressions()  
happens for expressions in function RTEs.  I moved it to  
inline_set_returning_functions(), which already has to iterate over  
every function RTE, and in consequence renamed that function to  
preprocess_function_rtes().  A useful consequence is that  
inline_set_returning_function() no longer has to do this for itself,  
simplifying that code.  
  
In passing, break out pull_up_simple_subquery's code that knows where  
everything that needs pullup_replace_vars() processing is, so that  
the new pull_up_constant_function() routine can share it.  We'd  
gotten away with one-and-a-half copies of that code so far, since  
pull_up_simple_values() could assume that a lot of cases didn't apply  
to it --- but I don't think pull_up_constant_function() can make any  
simplifying assumptions.  Might as well make pull_up_simple_values()  
use it too.  
  
(Possibly this refactoring should go further: maybe we could share  
some of the code to fill in the pullup_replace_vars_context struct?  
For now, I left it that the callers fill that completely.)  
  
Note: the one existing test case that this patch changes has to be  
changed because inlining its function RTEs would destroy the point  
of the test, namely to check join order.  
  
Alexander Kuzmenkov and Aleksandr Parfenov, reviewed by  
Antonin Houska and Anastasia Lubennikova, and whacked around  
some more by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/include/optimizer/prep.h
M src/test/regress/expected/join.out
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/tsearch.sql

Bump catversion.

commit   : a8d6a95eb992e942838e41029537564d81c4a50e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 1 Aug 2019 12:29:19 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 1 Aug 2019 12:29:19 -0700    

Click here for diff

Oversight in commit 71dcd743.  

M src/include/catalog/catversion.h

Add sort support routine for the inet data type.

commit   : 71dcd7438664d81235c72337cbbbfa780f7a0630    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 1 Aug 2019 09:34:14 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 1 Aug 2019 09:34:14 -0700    

Click here for diff

Add sort support for inet, including support for abbreviated keys.  
Testing has shown that this reduces the time taken to sort medium to  
large inet/cidr inputs by ~50-60% in realistic cases.  
  
Author: Brandur Leach  
Reviewed-By: Peter Geoghegan, Edmund Horner  
Discussion: https://postgr.es/m/CABR_9B-PQ8o2MZNJ88wo6r-NxW2EFG70M96Wmcgf99G6HUQ3sw@mail.gmail.com  

M src/backend/utils/adt/network.c
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/inet.out
M src/test/regress/sql/inet.sql

Add an isolation test to exercise parallel-worker deadlock resolution.

commit   : da9456d22a7697ef2c5ba9dd1402d948b2ec7f09    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Aug 2019 11:50:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Aug 2019 11:50:00 -0400    

Click here for diff

Commit a1c1af2a1 added logic in the deadlock checker to handle lock  
grouping, but it was very poorly tested, as evidenced by the bug  
fixed in 3420851a2.  Add a test case that exercises that a bit better  
(and catches the bug --- if you revert 3420851a2, this will hang).  
  
Since it's pretty hard to get parallel workers to take exclusive  
regular locks that their parents don't already have, this test operates  
by creating a deadlock among advisory locks taken in parallel workers.  
To make that happen, we must override the parallel-safety labeling of  
the advisory-lock functions, which we do by putting them in mislabeled,  
non-inlinable wrapper functions.  
  
We also have to remove the redundant PreventAdvisoryLocksInParallelMode  
checks in lockfuncs.c.  That seems fine though; if some user accidentally  
does what this test is intentionally doing, not much harm will ensue.  
(If there are any remaining bugs that are reachable that way, they're  
probably reachable in other ways too.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/lockfuncs.c
A src/test/isolation/expected/deadlock-parallel.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/deadlock-parallel.spec

Mark advisory-lock functions as parallel restricted, not parallel unsafe.

commit   : 4886da8327507dddd830786b0c7aaa9cfc480b4b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Aug 2019 11:36:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Aug 2019 11:36:21 -0400    

Click here for diff

There seems no good reason not to allow a parallel leader to execute  
these functions.  (The workers still can't, though.  Although the code  
would work, any such lock would go away at worker exit, which is not  
the documented behavior of advisory locks.)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add error codes to some corruption log messages

commit   : fd6ec93bf890314ac694dc8a7f3c45702ecc1bbd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Aug 2019 11:05:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Aug 2019 11:05:08 +0200    

Click here for diff

In some cases we have elog(ERROR) while corruption is certain and we  
can give a clear error code ERRCODE_DATA_CORRUPTED or  
ERRCODE_INDEX_CORRUPTED.  
  
Author: Andrey Borodin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c

Fix handling of previous password hooks in passwordcheck

commit   : b2a3d706b8d76b9d65e953942fc1ccafe892f692    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 1 Aug 2019 09:37:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 1 Aug 2019 09:37:28 +0900    

Click here for diff

When piling up loading of modules using check_password_hook_type,  
loading passwordcheck would remove any trace of a previously-loaded  
hook.  Unloading the module would also cause previous hooks to be  
entirely gone.  
  
Reported-by: Rafael Castro  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M contrib/passwordcheck/passwordcheck.c

Fix pg_dump's handling of dependencies for custom opclasses.

commit   : 07b39083c2aca003c4b1f289d7dc2368b5e2297a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Jul 2019 15:42:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Jul 2019 15:42:49 -0400    

Click here for diff

Since pg_dump doesn't treat the member operators and functions of operator  
classes/families (that is, the pg_amop and pg_amproc entries, not the  
underlying operators/functions) as separate dumpable objects, it missed  
their dependency information.  I think this was safe when the code was  
designed, because the default object sorting rule emits operators and  
functions before opclasses, and there were no dependency types that could  
mess that up.  However, the introduction of range types in 9.2 broke it:  
now a type can have a dependency on an opclass, allowing dependency rules  
to push the opclass before the type and hence before custom operators.  
Lacking any information showing that it shouldn't do so, pg_dump emitted  
the objects in the wrong order.  
  
Fix by teaching getDependencies() to translate pg_depend entries for  
pg_amop/amproc rows to look like dependencies for their parent opfamily.  
  
I added a regression test for this in HEAD/v12, but not further back;  
life is too short to fight with 002_pg_dump.pl.  
  
Per bug #15934 from Tom Gottfried.  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/t/002_pg_dump.pl

Run UTF8-requiring collation tests by default

commit   : f140007050a2ba874b85c4578d8417828f4b64b6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 31 Jul 2019 09:42:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 31 Jul 2019 09:42:15 +0200    

Click here for diff

The tests collate.icu.utf8 and collate.linux.utf8 were previously only  
run when explicitly selected via EXTRA_TESTS.  They require a UTF8  
database, because the error messages in the expected files refer to  
that, and they use some non-ASCII characters in the tests.  Since  
users can select any locale and encoding for the regression test run,  
it was not possible to include these tests automatically.  
  
To fix, use psql's \if facility to check various prerequisites such as  
platform and the server encoding and quit the tests at the very  
beginning if the configuration is not adequate.  We then need to  
maintain alternative expected files for these tests, but they are very  
tiny and never need to change after this.  
  
These two tests are now run automatically as part of the regression  
tests.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/052295c2-a2e1-9a21-bd36-8fbff8686cf3%402ndquadrant.com  

M doc/src/sgml/regress.sgml
M src/test/regress/expected/collate.icu.utf8.out
A src/test/regress/expected/collate.icu.utf8_1.out
M src/test/regress/expected/collate.linux.utf8.out
A src/test/regress/expected/collate.linux.utf8_1.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/collate.linux.utf8.sql

Remove superfluous newlines in function prototypes.

commit   : 870b1d6800cc2173ab672449047efbc30bdc1b57    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 31 Jul 2019 00:05:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 31 Jul 2019 00:05:21 -0700    

Click here for diff

These were introduced by pgindent due to fixe to broken  
indentation (c.f. 8255c7a5eeba8). Previously the mis-indentation of  
function prototypes was creatively used to reduce indentation in a few  
places.  
  
As that formatting only exists in master and REL_12_STABLE, it seems  
better to fix it in both, rather than having some odd indentation in  
v12 that somebody might copy for future patches or such.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-  

M src/backend/commands/event_trigger.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/libpq/auth.c
M src/backend/storage/ipc/sinval.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/access/gist_private.h
M src/include/replication/logical.h
M src/include/replication/reorderbuffer.h
M src/include/storage/sinval.h
M src/include/utils/guc.h

Remove superfluous semicolon.

commit   : 6384e87be28ee8d69ef11e49413b115506a3c6d3    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Jul 2019 18:29:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Jul 2019 18:29:55 -0700    

Click here for diff

Author: Andres Freund  

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

Remove orphaned structure member in pgcrypto

commit   : 652a8947d981db0367bcff5b123545eba0049878    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 31 Jul 2019 10:18:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 31 Jul 2019 10:18:29 +0900    

Click here for diff

int_name has never been used for digest lookups since its introduction  
in e94dd6a.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/pgp.c

Allow table AM's to use rd_amcache, too.

commit   : a29834beb1deeb0aa06742dd77ba1d21b444ca44    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jul 2019 21:43:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jul 2019 21:43:27 +0300    

Click here for diff

The rd_amcache allows an index AM to cache arbitrary information in a  
relcache entry. This commit moves the cleanup of rd_amcache so that it  
can also be used by table AMs. Nothing takes advantage of that yet, but  
I'm sure it'll come handy for anyone writing new table AMs.  
  
Backpatch to v12, where table AM interface was introduced.  
  
Reviewed-by: Julien Rouhaud  

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

Print WAL position correctly in pg_rewind error message.

commit   : d8b094dabb0fa16388340ca823d0a38285d2d6ce    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jul 2019 21:14:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jul 2019 21:14:14 +0300    

Click here for diff

This has been wrong ever since pg_rewind was added. The if-branch just  
above this, where we print the same error with an extra message supplied  
by XLogReadRecord() got this right, but the variable name was wrong in the  
else-branch. As a consequence, the error printed the WAL position as  
0/0 if there was an error reading a WAL file.  
  
Backpatch to 9.5, where pg_rewind was added.  

M src/bin/pg_rewind/parsexlog.c

Don't build extended statistics on inheritance trees

commit   : 14ef15a22246ca17c949e7a9d1abe14c8874d743    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 30 Jul 2019 19:17:12 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 30 Jul 2019 19:17:12 +0200    

Click here for diff

When performing ANALYZE on inheritance trees, we collect two samples for  
each relation - one for the relation alone, and one for the inheritance  
subtree (relation and its child relations). And then we build statistics  
on each sample, so for each relation we get two sets of statistics.  
  
For regular (per-column) statistics this works fine, because the catalog  
includes a flag differentiating statistics built from those two samples.  
But we don't have such flag in the extended statistics catalogs, and we  
ended up updating the same row twice, triggering this error:  
  
  ERROR:  tuple already updated by self  
  
The simplest solution is to disable extended statistics on inheritance  
trees, which is what this commit is doing. In the future we may need to  
do something similar to per-column statistics, but that requires adding a  
flag to the catalog - and that's not backpatchable. Moreover, the current  
selectivity estimation code only works with individual relations, so  
building statistics on inheritance trees would be pointless anyway.  
  
Author: Tomas Vondra  
Backpatch-to: 10-  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Justin Pryzby  

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

Fix memory leak coming from simple lists built in reindexdb

commit   : 04cf0bfc90dfae89a794d2bdd88fe3b8e313798e    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 30 Jul 2019 10:54:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 30 Jul 2019 10:54:48 +0900    

Click here for diff

When building a list of relations for a parallel processing of a schema  
or a database (or just a single-entry list for the non-parallel case  
with the database name), the list is allocated and built on-the-fly for  
each database processed, leaking after one database-level reindex is  
done.  This accumulates leaks when processing all databases, and could  
become a visible issue with thousands of relations.  
  
This is fixed by introducing a new routine in simple_list.c to free all  
the elements in a simple list made of strings or OIDs.  The header of  
the list may be using a variable declaration or an allocated pointer,  
so we don't have a routine to free this part to keep the interface  
simple.  
  
Per report from coverity for an issue introduced by 5ab892c, and  
valgrind complains about the leak as well.  The idea to introduce a new  
routine in simple_list.c is from Tom Lane.  
  
Author: Michael Paquier  
Reviewed-by: Tom Lane  

M src/bin/scripts/reindexdb.c
M src/fe_utils/simple_list.c
M src/include/fe_utils/simple_list.h

Fix busted logic for parallel lock grouping in TopoSort().

commit   : 3420851a2c2d2ac49b8ba53ccec5d02aa1e6a272    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jul 2019 18:49:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jul 2019 18:49:04 -0400    

Click here for diff

A "break" statement erroneously left behind by commit a1c1af2a1  
caused TopoSort to do the wrong thing if a lock's wait list  
contained multiple members of the same locking group.  
  
Because parallel workers don't normally need any locks not already  
taken by their leader, this is very hard --- maybe impossible ---  
to hit in production.  Still, if it did happen, the queries involved  
in an otherwise-resolvable deadlock would block until canceled.  
  
In addition to removing the bogus "break", add an Assert showing  
that the conflicting uses of the beforeConstraints[] array (for both  
counts and flags) don't overlap, and add some commentary explaining  
why not; because it's not obvious without explanation, IMHO.  
  
Original report and patch from Rui Hai Jiang; additional assert  
and commentary by me.  Back-patch to 9.6 where the bug came in.  
  
Discussion: https://postgr.es/m/CAEri+mLd3bpHLyW+a9pSe1y=aEkeuJpwBSwvo-+m4n7-ceRmXw@mail.gmail.com  

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

Handle fsync failures in pg_receivewal and pg_recvlogical

commit   : 1e2fddfa33d3c7cc93ca3ee0f32852699bd3e012    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jul 2019 07:41:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jul 2019 07:41:06 +0200    

Click here for diff

It is not safe to simply report an fsync error and continue.  We must  
exit the program instead.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Sehrope Sarkuni <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

Fix inconsistencies and typos in the tree

commit   : eb43f3d19324d7e5376b1f57fc2e5c142a6b5f3d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Jul 2019 12:28:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Jul 2019 12:28:30 +0900    

Click here for diff

This is numbered take 8, and addresses again a set of issues with code  
comments, variable names and unreferenced variables.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/pgp-decrypt.c
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/xplang.sgml
M src/Makefile.global.in
M src/backend/access/common/bufmask.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/pg_aggregate.c
M src/backend/commands/dbcommands.c
M src/backend/commands/operatorcmds.c
M src/backend/libpq/auth.c
M src/backend/postmaster/bgwriter.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/smgr/md.c
M src/backend/tcop/pquery.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/mmgr/aset.c
M src/bin/initdb/initdb.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pgevent/README
M src/common/unicode_norm.c
M src/include/access/gist_private.h
M src/include/commands/dbcommands.h
M src/include/replication/logicalproto.h
M src/include/statistics/statistics.h
M src/include/storage/bufpage.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/interfaces/libpq/fe-exec.c
M src/pl/plperl/plperl.c
D src/tools/FAQ2txt

Fix handling of expressions and predicates in REINDEX CONCURRENTLY

commit   : 7cce159349ccdb39ade07f869f08e4929ef2fe0b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Jul 2019 09:58:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Jul 2019 09:58:49 +0900    

Click here for diff

When copying the definition of an index rebuilt concurrently for the new  
entry, the index information was taken directly from the old index using  
the relation cache.  In this case, predicates and expressions have  
some post-processing to prepare things for the planner, which loses some  
information including the collations added in any of them.  
  
This inconsistency can cause issues when attempting for example a table  
rewrite, and makes the new indexes rebuilt concurrently inconsistent  
with the old entries.  
  
In order to fix the problem, fetch expressions and predicates directly  
from the catalog of the old entry, and fill in IndexInfo for the new  
index with that.  This makes the process more consistent with  
DefineIndex(), and the code is refactored with the addition of a routine  
to create an IndexInfo node.  
  
Reported-by: Manuel Rigger  
Author: Michael Paquier  
Discussion: https://postgr.es/m/CA+u7OA5Hp0ra235F3czPom_FyAd-3+XwSJmX95r1+sRPOJc9VQ@mail.gmail.com  
Backpatch-through: 12  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/nodes/makefuncs.c
M src/include/nodes/makefuncs.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Avoid macro clash with LLVM 9.

commit   : a2a777d011971ace3a349a3f02b1bf6eeea07bf2    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 29 Jul 2019 10:12:37 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 29 Jul 2019 10:12:37 +1200    

Click here for diff

Early previews of LLVM 9 reveal that our Min() macro causes compiler  
errors in LLVM headers reached by the #include directives in  
llvmjit_inline.cpp.  Let's just undefine it.  Per buildfarm animal  
seawasp.  Back-patch to 11.  
  
Reviewed-by: Fabien Coelho, Tom Lane  
Discussion: https://postgr.es/m/20190606173216.GA6306%40alvherre.pgsql  

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

Improve test coverage for LISTEN/NOTIFY.

commit   : b10f40bf0e4516d7832db8ccbe5f76319ad08682    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Jul 2019 12:02:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Jul 2019 12:02:27 -0400    

Click here for diff

We had no actual end-to-end test of NOTIFY message delivery.  In the  
core async.sql regression test, testing this is problematic because psql  
traditionally prints the PID of the sending backend, making the output  
unstable.  We also have an isolation test script, but it likewise  
failed to prove that delivery worked, because isolationtester.c had  
no provisions for detecting/reporting NOTIFY messages.  
  
Hence, add such provisions to isolationtester.c, and extend  
async-notify.spec to include direct tests of basic NOTIFY functionality.  
  
I also added tests showing that NOTIFY de-duplicates messages normally,  
but not across subtransaction boundaries.  (That's the historical  
behavior since we introduced subtransactions, though perhaps we ought  
to change it.)  
  
Patch by me, with suggestions/review by Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/async-notify.out
M src/test/isolation/isolationtester.c
M src/test/isolation/specs/async-notify.spec

Doc: Fix event trigger firing table

commit   : 44460d7017cde005d7a2e246db0b32375bfec15d    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 28 Jul 2019 22:02:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 28 Jul 2019 22:02:15 +0900    

Click here for diff

The table has not been updated for some commands introduced in recent  
releases, so refresh it.  While on it, reorder entries alphabetically.  
  
Backpatch all the way down for all the commands which have gone  
missing.  
  
Reported-by: Jeremy Smith  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/event-trigger.sgml

Fix typo in fd.c

commit   : b7a82317b66362880c16f1bd49573ab34f0dad1f    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 28 Jul 2019 16:21:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 28 Jul 2019 16:21:53 +0900    

Click here for diff

The frontend version of walkdir() is defined in file_utils.c, and not  
initdb.c.  
  
Author: Sehrope Sarkuni  
Discussion: https://postgr.es/m/CAH7T-artawnBt4=KODNCD8Mt2ZX4CCjJT8c=_=950xjutcRZ4Q@mail.gmail.com  

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

Fix isolationtester race condition for notices sent before blocking.

commit   : 30717637c1c58fcd02980a6752c7e13c9de12b69    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Jul 2019 20:21:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Jul 2019 20:21:54 -0400    

Click here for diff

If a test sends a notice just before blocking, it's possible on  
slow machines for isolationtester to detect the blocked state before  
it's consumed the notice.  (For this to happen, the notice would have  
to arrive after isolationtester has waited for data for 10ms, so on  
fast/lightly-loaded machines it's hard to reproduce the failure.)  
But, if we have seen the backend as blocked, it's certainly already  
sent any notices it's going to send.  Therefore, one more round of  
PQconsumeInput and PQisBusy should be enough to collect and process  
any such notices.  
  
This appears to explain the instability noted in commit ebd499282, so undo  
the hack therein to not print notices from insert-conflict-specconflict.  
  
Patch by me, diagnosis by Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/isolationtester.c
M src/test/isolation/specs/insert-conflict-specconflict.spec

Don't drop NOTICE messages in isolation tests.

commit   : ebd49928215e3854d91167e798949a75b34958d0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Jul 2019 15:59:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Jul 2019 15:59:57 -0400    

Click here for diff

For its entire existence, isolationtester.c has forced client_min_messages  
to WARNING, but that seems like a very poor choice of test design.  It  
should be up to individual test scripts to manage whether they emit notices  
and to ensure that the results are stable.  (There were no NOTICE messages  
in the original set of isolation tests, so this was certainly dead code  
when committed, but perhaps it was needed at some earlier point.)  
  
It's possible that the original motivation was due to platform-dependent  
variations in the timing of stdout vs. stderr output.  That should be  
moot since commits 73bcb76b7/6eda3e9c2, but just in case, adjust  
isotesterNoticeProcessor to print to stdout not stderr.  (stderr seems  
like the wrong thing anyway: it should be for error printouts not expected  
test output.)  
  
Testing shows that the notices in insert-conflict-specconflict are indeed  
a bit timing-unstable on very slow machines, so hide them; maybe we can  
improve that later.  Also, make the notices in plpgsql-toast a bit less  
verbose than the original code would've had them.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/plpgsql-toast.out
M src/test/isolation/isolationtester.c
M src/test/isolation/specs/insert-conflict-specconflict.spec
M src/test/isolation/specs/plpgsql-toast.spec

Add support for --jobs in reindexdb

commit   : 5ab892c391c6bc54a00e7a8de5cab077cabace6a    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 27 Jul 2019 22:21:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 27 Jul 2019 22:21:18 +0900    

Click here for diff

When doing a schema-level or a database-level operation, a list of  
relations to build is created which gets processed in parallel using  
multiple connections, based on the recent refactoring for parallel slots  
in src/bin/scripts/.  System catalogs are processed first in a  
serialized fashion to prevent deadlocks, followed by the rest done in  
parallel.  
  
This new option is not compatible with --system as reindexing system  
catalogs in parallel can lead to deadlocks, and with --index as there is  
no conflict handling for indexes rebuilt in parallel depending in the  
same relation.  
  
Author: Julien Rouhaud  
Reviewed-by: Sergei Kornilov, Michael Paquier  
Discussion: https://postgr.es/m/CAOBaU_YrnH_Jqo46NhaJ7uRBiWWEcS40VNRQxgFbqYo9kApUsg@mail.gmail.com  

M doc/src/sgml/ref/reindexdb.sgml
M src/bin/scripts/Makefile
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/090_reindexdb.pl

pg_upgrade: Update obsolescent documentation note

commit   : 4552c0f566667160ab3eeaf1620ebb969c1e7eb0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 08:26:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 08:26:33 +0200    

Click here for diff

Recently released xfsprogs 5.1.0 has reflink support enabled by  
default, so the note that it's not enabled by default can be removed.  

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

pg_upgrade: Default new bindir to pg_upgrade location

commit   : 959f6d6a1821b7d9068244f500dd80953e768d16    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 07:56:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 07:56:20 +0200    

Click here for diff

Make the directory where the pg_upgrade binary resides the default for  
new bindir, as running the pg_upgrade binary from where the new  
cluster is installed is a very common scenario.  Setting this as the  
defauly bindir for the new cluster will remove the need to provide it  
explicitly via -B in many cases.  
  
To support directories being missing from option parsing, extend the  
directory check with a missingOk mode where the path must be filled at  
a later point before being used.  Also move the exec_path check to  
earlier in setup to make sure we know the new cluster bindir when we  
scan for required executables.  
  
This removes the exec_path from the OSInfo struct as it is not used  
anywhere.  
  
Author: Daniel Gustafsson <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/test.sh
M src/tools/msvc/vcregress.pl

pg_upgrade: Check all used executables

commit   : 0befb4f31386efb622e4df9f3a313aa1f2e17899    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 07:48:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 07:48:08 +0200    

Click here for diff

Expand the validate_exec() calls to cover all the used binaries.  
  
Author: Daniel Gustafsson <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_upgrade/exec.c

Fix typo in pg_upgrade file header

commit   : 28cb0555c1153a0dcdf1c908d7265acafa413b57    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 07:46:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 07:46:02 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/bin/pg_upgrade/option.c

Don't uselessly escape a string that doesn't need escaping

commit   : 0994cfc0ac853de4245f003698160fe1b8c577bd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jul 2019 17:46:40 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jul 2019 17:46:40 -0400    

Click here for diff

Per gripe from Ian Barwick  
  
Co-authored-by: Ian Barwick <[email protected]>  
Discussion: https://postgr.es/m/CABvVfJWNnNKb8cHsTLhkTsvL1+G6BVcV+57+w1JZ61p8YGPdWQ@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Tweak our special-case logic for the IANA "Factory" timezone.

commit   : 8ab66081ca496fd74c406e435e20f4264881a02d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 13:07:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 13:07:08 -0400    

Click here for diff

pg_timezone_names() tries to avoid showing the "Factory" zone in  
the view, mainly because that has traditionally had a very long  
"abbreviation" such as "Local time zone must be set--see zic manual page",  
so that showing it messes up psql's formatting of the whole view.  
Since tzdb version 2016g, IANA instead uses the abbreviation "-00",  
which is sane enough that there's no reason to discriminate against it.  
  
On the other hand, it emerges that FreeBSD and possibly other packagers  
are so wedded to backwards compatibility that they hack the IANA data  
to keep the old spelling --- and not just that old spelling, but even  
older spellings that IANA used back in the stone age.  This caused the  
filter logic to fail to suppress "Factory" at all on such platforms,  
though the formatting problem is definitely real in that case.  
  
To solve both problems, get rid of the hard-wired assumption about  
exactly what Factory's abbreviation is, and instead reject abbreviations  
exceeding 31 characters.  This will allow Factory to appear in the view  
if and only if it's using the modern abbreviation.  
  
In passing, simplify the code we add to zic.c to support "zic -P"  
to remove its now-obsolete hacks to not print the Factory zone's  
abbreviation.  Unlike pg_timezone_names(), there's no reason for  
that code to support old/nonstandard timezone data.  
  
Since we generally prefer to keep timezone-related behavior the  
same in all branches, and since this is arguably a bug fix,  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/datetime.c
M src/timezone/zic.c

Avoid choosing "localtime" or "posixrules" as TimeZone during initdb.

commit   : 3754113f33651965d92aaad6f393757ac0cf8333    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 12:45:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 12:45:32 -0400    

Click here for diff

Some platforms create a file named "localtime" in the system  
timezone directory, making it a copy or link to the active time  
zone file.  If Postgres is built with --with-system-tzdata, initdb  
will see that file as an exact match to localtime(3)'s behavior,  
and it may decide that "localtime" is the most preferred spelling of  
the active zone.  That's a very bad choice though, because it's  
neither informative, nor portable, nor stable if someone changes  
the system timezone setting.  Extend the preference logic added by  
commit e3846a00c so that we will prefer any other zone file that  
matches localtime's behavior over "localtime".  
  
On the same logic, also discriminate against "posixrules", which  
is another not-really-a-zone file that is often present in the  
timezone directory.  (Since we install "posixrules" but not  
"localtime", this change can affect the behavior of Postgres  
with or without --with-system-tzdata.)  
  
Note that this change doesn't prevent anyone from choosing these  
pseudo-zones if they really want to (i.e., by setting TZ for initdb,  
or modifying the timezone GUC later on).  It just prevents initdb  
from preferring these zone names when there are multiple matches to  
localtime's behavior.  
  
Since we generally prefer to keep timezone-related behavior the  
same in all branches, and since this is arguably a bug fix,  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CADT4RqCCnj6FKLisvT8tTPfTP4azPhhDFJqDF1JfBbOH5w4oyQ@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/findtimezone.c

Fix loss of fractional digits for large values in cash_numeric().

commit   : b9d2c5c7ac800bf20ea6cd4c556b6b3305863a8e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 11:59:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 11:59:00 -0400    

Click here for diff

Money values exceeding about 18 digits (depending on lc_monetary)  
could be inaccurately converted to numeric, due to select_div_scale()  
deciding it didn't need to compute any fractional digits.  Force  
its hand by setting the dscale of one division input to equal the  
number of fractional digits we need.  
  
In passing, rearrange the logic to not do useless work in locales  
where money values are considered integral.  
  
Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Make libpq documentation navigable between functions

commit   : e829337d42d0e3c73ba9f380e81e51aab4865f8f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 17:23:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 17:23:36 +0200    

Click here for diff

Turn most mentions of libpq functions into links.  At id attributes to  
most libpq functions, where not existing yet, so that they can be  
linked to.  (In a handful of cases there were problems with the PDF  
processing toolchain, so those instances were not changed.)  
  
Author: Fabien COELHO <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1905121032330.27203@lancre  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/lobj.sgml

doc: Fix some markup whitespace issues

commit   : f4100839a00a9fffb19e70ed2e3c6a73ce2a5259    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 16:50:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 16:50:42 +0200    

Click here for diff

When making an xref to a varlistentry, the stylesheets use the first  
<term> as the link text.  In the cases fixed here, the <term> element  
contained extra whitespace that ended up being part of the link text,  
which looked strange in the output in some cases.  This whitespace is  
significant, so remove it since we don't want it.  

M doc/src/sgml/libpq.sgml

doc: Add support for xref to command and function elements

commit   : 2e32a7711a8a6e3020c9fb431705dadaed305120    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jul 2019 14:04:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jul 2019 14:04:48 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/517abe28-8a93-5b7a-ff40-b1fd61d33b26%402ndquadrant.com  

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

doc: Change libpq function ids to mixed case

commit   : d0f5d25b393747157d35c775e0942a0c68957823    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 14:43:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 14:43:13 +0200    

Click here for diff

The ids for linking to libpq functions were previously all lower-case.  
Change to mixed-case, matching the actual function name, for easier  
readability in the source.  The output isn't changed in a significant  
way, since the ids are converted to lower or upper case for file names  
and anchors.  

M doc/src/sgml/func.sgml
M doc/src/sgml/libpq.sgml

Fix LDAP test instability.

commit   : 27cd521e6e7084516fbc5e5a8492316b3ba8c25c    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 26 Jul 2019 10:01:18 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 26 Jul 2019 10:01:18 +1200    

Click here for diff

After starting slapd, wait until it can accept a connection before  
beginning the real test work.  This avoids occasional test failures.  
Back-patch to 11, where the LDAP tests arrived.  
  
Author: Thomas Munro  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/20190719033013.GI1859%40paquier.xyz  

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

Add missing (COSTS OFF) to EXPLAIN added in previous commit.

commit   : f63d9e68d4132a4608e9f50782aaacbe5ed6f57a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Jul 2019 14:52:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Jul 2019 14:52:36 -0700    

Click here for diff

Backpatch: 12-, like the previous commit  

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

Fix slot type handling for Agg nodes performing internal sorts.

commit   : af3deff3f2ac79585481181cb198b04c67486c09    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Jul 2019 14:22:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Jul 2019 14:22:52 -0700    

Click here for diff

Since 15d8f8312 we assert that - and since 7ef04e4d2cb2, 4da597edf1  
rely on - the slot type for an expression's  
ecxt_{outer,inner,scan}tuple not changing, unless explicitly flagged  
as such. That allows to either skip deforming (for a virtual tuple  
slot) or optimize the code for JIT accelerated deforming  
appropriately (for other known slot types).  
  
This assumption was sometimes violated for grouping sets, when  
nodeAgg.c internally uses tuplesorts, and the child node doesn't  
return a TTSOpsMinimalTuple type slot. Detect that case, and flag that  
the outer slot might not be "fixed".  
  
It's probably worthwhile to optimize this further in the future, and  
more granularly determine whether the slot is fixed. As we already  
instantiate per-phase transition and equal expressions, we could  
cheaply set the slot type appropriately for each phase.  But that's a  
separate change from this bugfix.  
  
This commit does include a very minor optimization by avoiding to  
create a slot for handling tuplesorts, if no such sorts are  
performed. Previously we created that slot unnecessarily in the common  
case of computing all grouping sets via hashing. The code looked too  
confusing without that, as the conditions for needing a sort slot and  
flagging that the slot type isn't fixed, are the same.  
  
Reported-By: Ashutosh Sharma  
Author: Andres Freund  
Discussion: https://postgr.es/m/CAE9k0PmNaMD2oHTEAhRyxnxpaDaYkuBYkLa1dpOpn=RS0iS2AQ@mail.gmail.com  
Backpatch: 12-, where the bug was introduced in 15d8f8312  

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

Fix syntax error in commit 20e99cddd.

commit   : cb9bb15783f2d6b2e66f7c18bc35e849df623dfa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 14:42:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 14:42:02 -0400    

Click here for diff

Per buildfarm.  

M src/tools/msvc/MSBuildProject.pm

Fix failures to ignore \r when reading Windows-style newlines.

commit   : b654714f9bcfb4443bcc531c32f059fd85f798ec    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 12:10:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 12:10:54 -0400    

Click here for diff

libpq failed to ignore Windows-style newlines in connection service files.  
This normally wasn't a problem on Windows itself, because fgets() would  
convert \r\n to just \n.  But if libpq were running inside a program that  
changes the default fopen mode to binary, it would see the \r's and think  
they were data.  In any case, it's project policy to ignore \r in text  
files unconditionally, because people sometimes try to use files with  
DOS-style newlines on Unix machines, where the C library won't hide that  
from us.  
  
Hence, adjust parseServiceFile() to ignore \r as well as \n at the end of  
the line.  In HEAD, go a little further and make it ignore all trailing  
whitespace, to match what it's always done with leading whitespace.  
  
In HEAD, also run around and fix up everyplace where we have  
newline-chomping code to make all those places look consistent and  
uniformly drop \r.  It is not clear whether any of those changes are  
fixing live bugs.  Most of the non-cosmetic changes are in places that  
are reading popen output, and the jury is still out as to whether popen  
on Windows can return \r\n.  (The Windows-specific code in pipe_read_line  
seems to think so, but our lack of support for this elsewhere suggests  
maybe it's not a problem in practice.)  Hence, I desisted from applying  
those changes to back branches, except in run_ssl_passphrase_command()  
which is new enough and little-tested enough that we'd probably not have  
heard about any problems there.  
  
Tom Lane and Michael Paquier, per bug #15827 from Jorge Gustavo Rocha.  
Back-patch the parseServiceFile() change to all supported branches,  
and the run_ssl_passphrase_command() change to v11 where that was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-common.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/option.c
M src/bin/psql/prompt.c
M src/interfaces/libpq/fe-connect.c
M src/port/sprompt.c

Honor MSVC WindowsSDKVersion if set

commit   : 20e99cdddbd3b55257827d621c2f9c592521cd4b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jul 2019 11:24:23 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jul 2019 11:24:23 -0400    

Click here for diff

Add a line to the project file setting the target SDK. Otherwise, in for  
example VS2017, if the default but optional 8.1 SDK is not installed the  
build will fail.  
  
Patch from Peifeng Qiu, slightly edited by me.  
  
Discussion: https://postgr.es/m/CABmtVJhw1boP_bd4=b3Qv5YnqEdL696NtHFi2ruiyQ6mFHkeQQ@mail.gmail.com  
  
Backpatch to all live branches.  

M src/tools/msvc/MSBuildProject.pm

Fix contrib/sepgsql test policy to work with latest SELinux releases.

commit   : f5a4ab23e42ac35862e3f7dc021a41f41a34386c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 11:02:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 11:02:43 -0400    

Click here for diff

As of Fedora 30, it seems that the system-provided macros for setting  
up user privileges in SELinux policies don't grant the ability to read  
/etc/passwd, as they formerly did.  This restriction breaks psql  
(which tries to use getpwuid() to obtain the user name it's running  
under) and thereby the contrib/sepgsql regression test.  Add explicit  
specifications that we need the right to read /etc/passwd.  
  
Mike Palmiotto, per a report from me.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/sepgsql-regtest.te

doc: Fix typo

commit   : 35a34e62ed4974b9178a2dc924d645d6a12e7e9a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 13:58:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 13:58:53 +0200    

Click here for diff

M doc/src/sgml/libpq.sgml

Fix system column accesses in ON CONFLICT ... RETURNING.

commit   : ecbdd009344d3a00733e4382f50137b5e0248ce8    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 24 Jul 2019 18:45:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 24 Jul 2019 18:45:58 -0700    

Click here for diff

After 277cb789836 ON CONFLICT ... SET ... RETURNING failed with  
ERROR:  virtual tuple table slot does not have system attributes  
when taking the update path, as the slot used to insert into the  
table (and then process RETURNING) was defined to be a virtual slot in  
that commit. Virtual slots don't support system columns except for  
tableoid and ctid, as the other system columns are AM dependent.  
  
Fix that by using a slot of the table's type. Add tests for system  
column accesses in ON CONFLICT ...  RETURNING.  
  
Reported-By: Roby, bisected to the relevant commit by Jeff Janes  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where the bug was introduced in 277cb789836  

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

Fix failure with pgperlcritic from the TAP test of synchronous replication

commit   : c8e177f0bba6bcd9db7180580d58968974d8f6a9    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 25 Jul 2019 07:55:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 25 Jul 2019 07:55:23 +0900    

Click here for diff

Oversight in 7d81bdc, which introduced a new routine in perl lacking a  
return clause.  Per buildfarm member crake.  
  
Backpatch down to 9.6 like its parent.  
  
Reported-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/test/recovery/t/007_sync_rep.pl

Fix infelicities in describeOneTableDetails' partitioned-table handling.

commit   : 4e784f35145bc6e01d54282afe10d9bb5200ebfe    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Jul 2019 18:14:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Jul 2019 18:14:26 -0400    

Click here for diff

describeOneTableDetails issued a partition-constraint-fetching query  
for every table, even ones it knows perfectly well are not partitions.  
  
To add insult to injury, it then proceeded to leak the empty PGresult  
if the table wasn't a partition.  Doing that a lot of times might  
amount to a meaningful leak, so this seems like a back-patchable bug.  
  
Fix that, and also fix a related PGresult leak in the partition-parent  
case (though that leak would occur only if we got no row, which is  
unexpected).  
  
Minor code beautification too, to make this code look more like the  
pre-existing code around it.  
  
Back-patch the whole change into v12.  However, the fact that we already  
know whether the table is a partition dates only to commit 1af25ca0c;  
back-patching the relevant changes from that is probably more churn  
than is justified in released branches.  Hence, in v11 and v10, just  
do the minimum to fix the PGresult leaks.  
  
Noted while messing around with adjacent code for yesterday's \d  
improvements.  

M src/bin/psql/describe.c

Use full 64-bit XID for checking if a deleted GiST page is old enough.

commit   : 6655a7299d835dea9e8e0ba69cc5284611b96f29    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Jul 2019 20:24:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Jul 2019 20:24:07 +0300    

Click here for diff

Otherwise, after a deleted page gets even older, it becomes unrecyclable  
again. B-tree has the same problem, and has had since time immemorial,  
but let's at least fix this in GiST, where this is new.  
  
Backpatch to v12, where GiST page deletion was introduced.  
  
Reviewed-by: Andrey Borodin  
Discussion: https://www.postgresql.org/message-id/835A15A5-F1B4-4446-A711-BF48357EB602%40yandex-team.ru  

M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/utils/time/snapmgr.c
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/utils/snapmgr.h

Refactor checks for deleted GiST pages.

commit   : 9eb5607e69933f0a88b6774d1ba728f27afdbd3d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Jul 2019 20:24:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Jul 2019 20:24:05 +0300    

Click here for diff

The explicit check in gistScanPage() isn't currently really necessary, as  
a deleted page is always empty, so the loop would fall through without  
doing anything, anyway. But it's a marginal optimization, and it gives a  
nice place to attach a comment to explain how it works.  
  
Backpatch to v12, where GiST page deletion was introduced.  
  
Reviewed-by: Andrey Borodin  
Discussion: https://www.postgresql.org/message-id/835A15A5-F1B4-4446-A711-BF48357EB602%40yandex-team.ru  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c

Don't assume expr is available in pgbench tests

commit   : 1a721248f3899ccf8c0c7512b91d8458f2394aeb    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 24 Jul 2019 11:41:39 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 24 Jul 2019 11:41:39 -0400    

Click here for diff

Windows hosts do not normally come with expr, so instead of using that  
to test the \setshell command, use echo instead, which is fairly  
universally available.  
  
Backpatch to release 11, where this came in.  
  
Problem found by me, patch by Fabien Coelho.  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Doc: Clarify interactions of pg_receivewal with remote_apply

commit   : fd7d387e0548fd371c06a91d75bc4632541ccfdd    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Jul 2019 11:25:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Jul 2019 11:25:43 +0900    

Click here for diff

Using pg_receivewal with synchronous_commit = remote_apply set in the  
backend is incompatible if pg_receivewal is a synchronous standby as it  
never applies WAL, so document this problem and solutions to it.  
  
Backpatch to 9.6, where remote_apply has been added.  
  
Author: Robert Haas, Jesper Pedersen  
Reviewed-by: Laurenz Albe, Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/ref/pg_receivewal.sgml

Improve stability of TAP test for synchronous replication

commit   : 7d81bdc8c0ce838efa248928065e9b2da829f981    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Jul 2019 10:53:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Jul 2019 10:53:39 +0900    

Click here for diff

Slow buildfarm machines have run into issues with this TAP test caused  
by a race condition related to the startup of a set of standbys, where  
it is possible to finish with an unexpected order in the WAL sender  
array of the primary.  
  
This closes the race condition by making sure that any standby started  
is registered into the WAL sender array of the primary before starting  
the next one based on lookups of pg_stat_replication.  
  
Backpatch down to 9.6 where the test has been introduced.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Noah Misch  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/test/recovery/t/007_sync_rep.pl

Check that partitions are not in use when dropping constraints

commit   : 5562272a4229cfa57354aa203cffd36b4e7f70cb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 23 Jul 2019 17:22:15 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 23 Jul 2019 17:22:15 -0400    

Click here for diff

If the user creates a deferred constraint in a partition, and in a  
transaction they cause the constraint's trigger execution to be deferred  
until commit time *and* drop the constraint, then when commit time comes  
the queued trigger will fail to run because the trigger object will have  
been dropped.  
  
This is explained because when a constraint gets dropped in a  
partitioned table, the recursion to drop the ones in partitions is done  
by the dependency mechanism, not by ALTER TABLE traversing the recursion  
tree as in all other cases.  In the non-partitioned case, this problem  
is avoided by checking that the table is not "in use" by alter-table;  
other alter-table subcommands that recurse to partitions do that check  
for each partition.  But the dependency mechanism doesn't have a way to  
do that.  Fix the problem by applying the same check to all partitions  
during ALTER TABLE's "prep" phase, which correctly raises the necessary  
error.  
  
Reported-by: Rajkumar Raghuwanshi <[email protected]>  
Discussion: https://postgr.es/m/CAKcux6nZiO9-eEpr1ZD84bT1mBoVmeZkfont8iSpcmYrjhGWgA@mail.gmail.com  

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

Improve psql's \d output for partitioned indexes.

commit   : 24f62e93f314c107b4fa679869e5ba9adb2d545f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Jul 2019 17:04:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Jul 2019 17:04:21 -0400    

Click here for diff

Include partitioning information much as we do for partitioned tables.  
(However, \d+ doesn't show the partition bounds, because those are  
not stored for indexes.)  
  
In passing, fix a couple of queries to look less messy in -E output.  
  
Also, add some tests for \d on tables with nondefault tablespaces.  
(Somebody previously added a rather silly number of tests for \d  
on partitioned indexes, yet completely neglected other cases.)  
  
Justin Pryzby, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Improve psql's \d output for TOAST tables.

commit   : eb5472da9f83c2e432ac27a053929947e354d20c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Jul 2019 15:25:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Jul 2019 15:25:56 -0400    

Click here for diff

Add the name of the owning table to the footers for a TOAST table.  
Also, show all the same footers as for a regular table (in practice,  
this adds the index and perhaps the tablespace and access method).  
  
Justin Pryzby, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add CREATE DATABASE LOCALE option

commit   : 06140c201b982436974d71e756d7331767a41e57    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jul 2019 14:40:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jul 2019 14:40:42 +0200    

Click here for diff

This sets both LC_COLLATE and LC_CTYPE with one option.  Similar  
behavior is already supported in initdb, CREATE COLLATION, and  
createdb.  
  
Reviewed-by: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d9d5043a-dc70-da8a-0166-1e218e6e34d4%402ndquadrant.com  

M doc/src/sgml/ref/create_database.sgml
M src/backend/commands/dbcommands.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl

Remove more progname references in vacuumdb.c

commit   : 3cae75f4209bcbb06285544de0f1c59f717a3159    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Jul 2019 14:29:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Jul 2019 14:29:34 +0900    

Click here for diff

Oversight in 5f384037.  
  
Author: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/vacuumdb.c

Install dependencies to prevent dropping partition key columns.

commit   : a0555ddab9b672a04681ce0d9f6c94104c01b15f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Jul 2019 14:55:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Jul 2019 14:55:22 -0400    

Click here for diff

The logic in ATExecDropColumn that rejects dropping partition key  
columns is quite an inadequate defense, because it doesn't execute  
in cases where a column needs to be dropped due to cascade from  
something that only the column, not the whole partitioned table,  
depends on.  That leaves us with a badly broken partitioned table;  
even an attempt to load its relcache entry will fail.  
  
We really need to have explicit pg_depend entries that show that the  
column can't be dropped without dropping the whole table.  Hence,  
add those entries.  In v12 and HEAD, bump catversion to ensure that  
partitioned tables will have such entries.  We can't do that in  
released branches of course, so in v10 and v11 this patch affords  
protection only to partitioned tables created after the patch is  
installed.  Given the lack of field complaints (this bug was found  
by fuzz-testing not by end users), that's probably good enough.  
  
In passing, fix ATExecDropColumn and ATPrepAlterColumnType  
messages to be more specific about which partition key column  
they're complaining about.  
  
Per report from Manuel Rigger.  Back-patch to v10 where partitioned  
tables were added.  
  
Discussion: https://postgr.es/m/CA+u7OA4JKCPFrdrAbOs7XBiCyD61XJxeNav4LefkSmBLQ-Vobg@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/bin/pg_dump/pg_dump_sort.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Revert "initdb: Change authentication defaults"

commit   : 7961886580a594e519ca7ed1811b464206738be5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jul 2019 19:28:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jul 2019 19:28:25 +0200    

Click here for diff

This reverts commit 09f08930f0f6fd4a7350ac02f29124b919727198.  
  
The buildfarm client needs some adjustments first.  

M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/standalone-install.xml
M src/bin/initdb/initdb.c
M src/include/port.h
M src/test/regress/pg_regress.c

initdb: Change authentication defaults

commit   : 09f08930f0f6fd4a7350ac02f29124b919727198    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jul 2019 14:40:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jul 2019 14:40:55 +0200    

Click here for diff

Change the defaults for the pg_hba.conf generated by initdb to "peer"  
for local (if supported, else "md5") and "md5" for host.  
  
(Changing from "md5" to SCRAM is left as a separate exercise.)  
  
"peer" is currently not supported on AIX, HP-UX, and Windows.  Users  
on those operating systems will now either have to provide a password  
to initdb or choose a different authentication method when running  
initdb.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/bec17f0a-ddb1-8b95-5e69-368d9d0a3390%40postgresql.org  

M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/standalone-install.xml
M src/bin/initdb/initdb.c
M src/include/port.h
M src/test/regress/pg_regress.c

Use appendBinaryStringInfo in more places where the length is known

commit   : 1e6a759838f7c104f3cd1fe6981a98780da4131b    
  
author   : David Rowley <[email protected]>    
date     : Tue, 23 Jul 2019 00:14:11 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 23 Jul 2019 00:14:11 +1200    

Click here for diff

When we already know the length that we're going to append, then it  
makes sense to use appendBinaryStringInfo instead of  
appendStringInfoString so that the append can be performed with a simple  
memcpy() using a known length rather than having to first perform a  
strlen() call to obtain the length.  
  
Discussion: https://postgr.es/m/CAKJS1f8+FRAM1s5+mAa3isajeEoAaicJ=4e0WzrH3tAusbbiMQ@mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/xml.c

Make identity sequence management more robust

commit   : 19781729f789f3c6b2540e02b96f8aa500460322    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jul 2019 12:05:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jul 2019 12:05:03 +0200    

Click here for diff

Some code could get confused when certain catalog state involving both  
identity and serial sequences was present, perhaps during an attempt  
to upgrade the latter to the former.  Specifically, dropping the  
default of a serial column maintains the ownership of the sequence by  
the column, and so it would then be possible to afterwards make the  
column an identity column that would now own two sequences.  This  
causes the code that looks up the identity sequence to error out,  
making the new identity column inoperable until the ownership of the  
previous sequence is released.  
  
To fix this, make the identity sequence lookup only consider sequences  
with the appropriate dependency type for an identity sequence, so it  
only ever finds one (unless something else is broken).  In the above  
example, the old serial sequence would then be ignored.  Reorganize  
the various owned-sequence-lookup functions a bit to make this  
clearer.  
  
Reported-by: Laurenz Albe <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/pg_depend.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteHandler.c
M src/include/catalog/dependency.h
M src/test/regress/expected/identity.out
M src/test/regress/sql/identity.sql

Make better use of the new List implementation in a couple of places

commit   : efdcca55a3df27a12efb84a18bce6ea739927b80    
  
author   : David Rowley <[email protected]>    
date     : Mon, 22 Jul 2019 19:03:12 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 22 Jul 2019 19:03:12 +1200    

Click here for diff

In nodeAppend.c and nodeMergeAppend.c there were some foreach loops which  
looped over the list of subplans and only performed any work if the  
subplan index was found in a Bitmapset.  With the old linked list  
implementation of List, this form made sense as accessing the Nth list  
element was O(N).  However, thanks to 1cff1b95a we now have array-based  
lists, so accessing the Nth element has become O(1).  
  
Here we make the most of the O(1) lookups and just loop over the set  
members of the Bitmapset with bms_next_member().  This performs slightly  
better when a small number of the list items are in the Bitmapset.  Micro  
benchmarks show that when the Bitmapset contains all or most of the list  
items then the new code is ever so slightly slower.  In practice, the cost  
is so small that it's drowned out by various other things such as locking  
the relations belonging to each subplan, etc.  
  
The primary goal here is to leave better code examples around which benefit  
better from the new list implementation.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAKJS1f8ZcsLVgkF4wOfRyMYTcPgLFiUAOedFC+U2vK_aFZk-BA@mail.gmail.com  

M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c

Fix inconsistencies and typos in the tree

commit   : 23bccc823d434d9dcf3c12622fe260d9235baae2    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Jul 2019 10:01:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Jul 2019 10:01:50 +0900    

Click here for diff

This is numbered take 7, and addresses a set of issues with code  
comments, variable names and unreferenced variables.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M contrib/jsonb_plperl/jsonb_plperlu–1.0.sql
M contrib/pgcrypto/pgp-compress.c
M doc/src/sgml/problems.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/index/genam.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/xlog.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/spi.c
M src/backend/partitioning/partbounds.c
M src/backend/port/win32_sema.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/time/snapmgr.c
M src/common/md5.c
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/heapam_xlog.h
M src/include/access/spgist_private.h
M src/include/access/xact.h
M src/include/executor/nodeAgg.h
M src/include/mb/pg_wchar.h
M src/include/pg_config.h.win32
M src/include/utils/formatting.h
M src/include/utils/jsonb.h
M src/include/utils/relcache.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/tcl/pltcl.c
M src/test/recovery/t/011_crash_recovery.pl

Adjust overly strict Assert

commit   : e1a0f6a983068675813074847e1d0d61bd37ac0e    
  
author   : David Rowley <[email protected]>    
date     : Mon, 22 Jul 2019 10:29:41 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 22 Jul 2019 10:29:41 +1200    

Click here for diff

3373c7155 changed how we determine EquivalenceClasses for relations and  
added an Assert to ensure all relations mentioned in each EC's ec_relids  
was a RELOPT_BASEREL.  However, the join removal code may remove a LEFT  
JOIN and since it does not clean up EC members belonging to the removed  
relations it can leave RELOPT_DEADREL rels in ec_relids.  
  
Fix this by adjusting the Assert to allow RELOPT_DEADREL rels too.  
  
Reported-by: sqlsmith via Andreas Seltenreich  
Discussion: https://postgr.es/m/[email protected]  

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

Remove no-longer-helpful reliance on fixed-size local array.

commit   : 330cafdfaa11ebe53e3e59688acac1577ae0cb34    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 Jul 2019 11:42:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 Jul 2019 11:42:11 -0400    

Click here for diff

Coverity complained about this code, apparently because it uses a local  
array of size FUNC_MAX_ARGS without a guard that the input argument list  
is no longer than that.  (Not sure why it complained today, since this  
code's been the same for a long time; possibly it re-analyzed everything  
the List API change touched?)  
  
Rather than add a guard, though, let's just get rid of the local array  
altogether.  It was only there to avoid list_nth() calls, and those are  
no longer expensive.  

M src/backend/parser/parse_func.c

Fix compilation warning of pg_basebackup with MinGW

commit   : 90317ab7e64bd2d855c73a6ba579de6d04a7b25c    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 21 Jul 2019 22:27:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 21 Jul 2019 22:27:11 +0900    

Click here for diff

Several buildfarm members have been complaining about that with gcc,  
like jacana.  Weirdly enough, Visual Studio's compilers do not find this  
issue.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c

Speed up finding EquivalenceClasses for a given set of rels

commit   : 3373c7155350cf6fcd51dd090f29e1332901e329    
  
author   : David Rowley <[email protected]>    
date     : Sun, 21 Jul 2019 17:30:58 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 21 Jul 2019 17:30:58 +1200    

Click here for diff

Previously in order to determine which ECs a relation had members in, we  
had to loop over all ECs stored in PlannerInfo's eq_classes and check if  
ec_relids mentioned the relation.  For the most part, this was fine, as  
generally, unless queries were fairly complex, the overhead of performing  
the lookup would have not been that significant.  However, when queries  
contained large numbers of joins and ECs, the overhead to find the set of  
classes matching a given set of relations could become a significant  
portion of the overall planning effort.  
  
Here we allow a much more efficient method to access the ECs which match a  
given relation or set of relations.  A new Bitmapset field in RelOptInfo  
now exists to store the indexes into PlannerInfo's eq_classes list which  
each relation is mentioned in.  This allows very fast lookups to find all  
ECs belonging to a single relation.  When we need to lookup ECs belonging  
to a given pair of relations, we can simply bitwise-AND the Bitmapsets from  
each relation and use the result to perform the lookup.  
  
We also take the opportunity to write a new implementation of  
generate_join_implied_equalities which makes use of the new indexes.  
generate_join_implied_equalities_for_ecs must remain as is as it can be  
given a custom list of ECs, which we can't easily determine the indexes of.  
  
This was originally intended to fix the performance penalty of looking up  
foreign keys matching a join condition which was introduced by 100340e2d.  
However, we're speeding up much more than just that here.  
  
Author: David Rowley, Tom Lane  
Reviewed-by: Tom Lane, Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h

Don't rely on estimates for amcheck Bloom filters.

commit   : 894af78f185afee221a6762a1a49057043b7bbf5    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 20 Jul 2019 11:11:55 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 20 Jul 2019 11:11:55 -0700    

Click here for diff

Solely relying on a relation's reltuples/relpages estimate to size the  
Bloom filters used by amcheck verification makes verification less  
effective when the estimates are very stale.  In extreme cases,  
verification options that use Bloom filters internally could be totally  
ineffective, without users receiving any clear indication that certain  
types of corruption might easily be missed.  
  
To fix, use RelationGetNumberOfBlocks() instead of relpages to size the  
downlink block Bloom filter.  Use the same RelationGetNumberOfBlocks()  
value to derive a minimum size for the heapallindexed Bloom filter,  
rather than completely trusting reltuples.  Verification will still be  
reasonably effective when the projected/estimated number of Bloom filter  
elements is at least 1/5 of the final number of elements, which is  
assured by the new sizing logic.  
  
Reported-By: Alexander Korotkov  
Discussion: https://postgr.es/m/CAH2-Wzk0ke2J42KrNYBKu0Xovjy-sU5ub7PWjgpbsKdAQcL4OA@mail.gmail.com  
Backpatch: 11-, where downlink/heapallindexed verification were added.  

M contrib/amcheck/verify_nbtree.c

Use column collation for extended statistics

commit   : a63378a03ec0a53c7c579dfdb3abff57811d8ced    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 18 Jul 2019 12:28:16 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 18 Jul 2019 12:28:16 +0200    

Click here for diff

The current extended statistics code was a bit confused which collation  
to use.  When building the statistics, the collations defined as default  
for the data types were used (since commit 5e0928005).  The MCV code was  
however using the column collations for MCV serialization, and then  
DEFAULT_COLLATION_OID when computing estimates. So overall the code was  
using all three possible options, inconsistently.  
  
This uses the column colation everywhere - this makes it consistent with  
what 5e0928005 did for regular stats.  We however do not track the  
collations in a catalog, because we can derive them from column-level  
information.  This may need to change in the future, e.g. after allowing  
statistics on expressions.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  
Backpatch-to: 12  

M src/backend/commands/statscmds.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c

Rework examine_opclause_expression to use varonleft

commit   : e38a55ba46bbd2510baccdbaa01298cbca972b88    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 19 Jul 2019 16:28:28 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 19 Jul 2019 16:28:28 +0200    

Click here for diff

The examine_opclause_expression function needs to return information on  
which side of the operator we found the Var, but the variable was called  
"isgt" which is rather misleading (it assumes the operator is either  
less-than or greater-than, but it may be equality or something else).  
Other places in the planner use a variable called "varonleft" for this  
purpose, so just adopt the same convention here.  
  
The code also assumed we don't care about this flag for equality, as  
(Var = Const) and (Const = Var) should be the same thing. But that does  
not work for cross-type operators, in which case we need to pass the  
parameters to the procedure in the right order. So just use the same  
code for all types of expressions.  
  
This means we don't need to care about the selectivity estimation  
function anymore, at least not in this code. We should only get the  
supported cases here (thanks to statext_is_compatible_clause).  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  
Backpatch-to: 12  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/include/statistics/extended_stats_internal.h

pg_stat_statements: add missing check for pgss_enabled().

commit   : 6f40ee4f837ec1ac59c8ddc73b67a04978a184d5    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 19 Jul 2019 13:24:33 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 19 Jul 2019 13:24:33 -0700    

Click here for diff

Make pgss_post_parse_analyze() more consistent with the other hooks,  
and avoid unnecessary overhead when pg_stat_statements.track=none.  
  
Author: Raymond Martin  
Reviewed-by: Fabien COELHO  
Discussion: https://postgr.es/m/BN8PR21MB1217B003C4F79DE230AA36B9B1580%40BN8PR21MB1217.namprd21.prod.outlook.com  

M contrib/pg_stat_statements/pg_stat_statements.c

Silence compiler warning, hopefully.

commit   : 421466863548de58199c7c6ececaae6b5f621b2f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Jul 2019 14:48:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Jul 2019 14:48:57 -0400    

Click here for diff

Absorb commit e5e04c962a5d12eebbf867ca25905b3ccc34cbe0 from upstream  
IANA code, in hopes of silencing warnings from MSVC about negating  
a bool value.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/zic.c

Doc: clarify when table rewrites happen with column addition and DEFAULT

commit   : 1300fa66b2f3d0dcd2eed7a5eff9e3fc22807f7c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Jul 2019 11:42:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Jul 2019 11:42:33 +0900    

Click here for diff

16828d5 has improved ALTER TABLE so as a column addition does not  
require a rewrite for a non-NULL default with constant expressions, but  
one spot in the documentation did not get updated consistently.  
The documentation also now clarifies the fact that this does not apply  
if the expression is volatile, where a table rewrite is still required.  
  
Reported-by: Daniel Westermann  
Author: Ian Barwick  
Reviewed-by: Michael Paquier, Daniel Westermann  
Discussion: https://postgr.es/m/DB6PR0902MB2184C7D5645CF15D75EB7957D2CF0@DB6PR0902MB2184.eurprd09.prod.outlook.com  
Backpatch-through: 11  

M doc/src/sgml/ddl.sgml

Refactor parallelization processing code in src/bin/scripts/

commit   : 5f3840370b63fdf17f704a285623ccc233fa8d4f    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Jul 2019 09:31:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Jul 2019 09:31:58 +0900    

Click here for diff

The existing facility of vacuumdb to handle parallel connections into a  
given database with an authentication set is moved to a common file in  
src/bin/scripts/, named scripts_parallel.c.  This introduces a set of  
routines to initialize, wait and terminate a set of connections,  
simplifying a bit the code of vacuumdb on the way.  More routines  
related to result handling and database connection are moved to  
common.c.  
  
The initial plan is to use that for reindexdb, but it could be applied  
to other tools like clusterdb.  
  
While on it, clean up a set of variables "progname" which were defined  
as routine arguments for error messages.  Since most of the callers have  
switched to pg_log_error() and such there is no need for this variable.  
  
Author: Julien Rouhaud  
Reviewed-by: Michael Paquier, Álvaro Herrera  
Discussion: https://postgr.es/m/CAOBaU_YrnH_Jqo46NhaJ7uRBiWWEcS40VNRQxgFbqYo9kApUsg@mail.gmail.com  

M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/reindexdb.c
A src/bin/scripts/scripts_parallel.c
A src/bin/scripts/scripts_parallel.h
M src/bin/scripts/vacuumdb.c

Fix error in commit e6feef57.

commit   : b538c90b1bded5464787e2b8e4431302d24eb601    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 18 Jul 2019 16:38:39 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 18 Jul 2019 16:38:39 -0700    

Click here for diff

I was careless passing a datum directly to DATE_NOT_FINITE without  
calling DatumGetDateADT() first.  
  
Backpatch-through: 9.4  

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

Fix typo in mvdistinct.c

commit   : 70a33b21099c046dc38f07ffb02b1e0cf2aff91d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Jul 2019 08:50:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Jul 2019 08:50:14 +0900    

Click here for diff

Noticed while browsing the code.  

M src/backend/statistics/mvdistinct.c

Fix daterange canonicalization for +/- infinity.

commit   : e6feef571a016c9dac52a01aebad484768eb5c68    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 18 Jul 2019 12:42:39 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 18 Jul 2019 12:42:39 -0700    

Click here for diff

The values 'infinity' and '-infinity' are a part of the DATE type  
itself, so a bound of the date 'infinity' is not the same as an  
unbounded/infinite range. However, it is still wrong to try to  
canonicalize such values, because adding or subtracting one has no  
effect. Fix by treating 'infinity' and '-infinity' the same as  
unbounded ranges for the purposes of canonicalization (but not other  
purposes).  
  
Backpatch to all versions because it is inconsistent with the  
documented behavior. Note that this could be an incompatibility for  
applications relying on the behavior contrary to the documentation.  
  
Author: Laurenz Albe  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/77f24ea19ab802bc9bc60ddbb8977ee2d646aec1.camel%40cybertec.at  
Backpatch-through: 9.4  

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

Fix nbtree metapage cache upgrade bug.

commit   : d004147eb3ece6b5981dbdd3d918ffc3f23fc505    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 18 Jul 2019 13:22:56 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 18 Jul 2019 13:22:56 -0700    

Click here for diff

Commit 857f9c36cda, which taught nbtree VACUUM to avoid unnecessary  
index scans, bumped the nbtree version number from 2 to 3, while adding  
the ability for nbtree indexes to be upgraded on-the-fly.  Various  
assertions that assumed that an nbtree index was always on version 2 had  
to be changed to accept any supported version (version 2 or 3 on  
Postgres 11).  
  
However, a few assertions were missed in the initial commit, all of  
which were in code paths that cache a local copy of the metapage  
metadata, where the index had been expected to be on the current version  
(no longer version 2) as a generic sanity check.  Rather than simply  
update the assertions, follow-up commit 0a64b45152b intentionally made  
the metapage caching code update the per-backend cached metadata version  
without changing the on-disk version at the same time.  This could even  
happen when the planner needed to determine the height of a B-Tree for  
costing purposes.  The assertions only fail on Postgres v12 when  
upgrading from v10, because they were adjusted to use the authoritative  
shared memory metapage by v12's commit dd299df8.  
  
To fix, remove the cache-only upgrade mechanism entirely, and update the  
assertions themselves to accept any supported version (go back to using  
the cached version in v12).  The fix is almost a full revert of commit  
0a64b45152b on the v11 branch.  
  
VACUUM only considers the authoritative metapage, and never bothers with  
a locally cached version, whereas everywhere else isn't interested in  
the metapage fields that were added by commit 857f9c36cda.  It seems  
unlikely that this bug has affected any user on v11.  
  
Reported-By: Christoph Berg  
Bug: #15896  
Discussion: https://postgr.es/m/15896-5b25e260fdb0b081%40postgresql.org  
Backpatch: 11-, where VACUUM was taught to avoid unnecessary index scans.  

M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/nbtree.h

Further adjust SPITupleTable to provide a public row-count field.

commit   : bc8393cf27731055467a83068c680c86f9c112ea    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Jul 2019 10:37:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Jul 2019 10:37:13 -0400    

Click here for diff

Now that commit fec0778c8 drew a clear line between public and private  
fields in SPITupleTable, it seems pretty silly that the count of valid  
tuples isn't on the public side of that line.  The reason why not was  
that there wasn't such a count.  For reasons lost in the mists of time,  
spi.c preferred to keep a count of remaining free entries in the array.  
But that seems pretty pointless: it's unlike the way we handle similar  
code everywhere else, and it involves extra subtractions that surely  
outweigh having to do a comparison rather than test-for-zero to check  
for array-full.  
  
Hence, rearrange so that this code does the expansible array logic  
the same as everywhere else, with a count of valid entries alongside  
the allocated array length.  And document the count as public.  
  
I looked for core-code callers where it would make sense to start  
relying on tuptable->numvals rather than the separate SPI_processed  
variable.  Right now there don't seem to be places where it'd be  
a win to do so without more code restructuring than I care to  
undertake today.  In principle, though, having SPITupleTables be  
fully self-contained should be helpful down the line.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/spi.sgml
M src/backend/executor/spi.c
M src/include/executor/spi.h

Simplify bitmap updates in multivariate MCV code

commit   : 7d24f6a49076f975ca87926b3cde8fdea3448ecb    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 17 Jul 2019 18:16:50 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 17 Jul 2019 18:16:50 +0200    

Click here for diff

When evaluating clauses on a multivariate MCV list, we build a bitmap  
tracking how the clauses match each item of the MCV list.  When updating  
the bitmap we need to consider the current value (tracking how the item  
matches preceding clauses), match for the current clause and whether the  
clauses are connected by AND or OR.  
  
Until now the logic was copied on every place updating the bitmap, which  
was not quite readable.  So just move it to a separate function and call  
it where needed.  
  
Backpatch to 12, where the code was introduced. While not a bugfix, this  
should make maintenance and future backpatches easier.  
  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  

M src/backend/statistics/mcv.c

Fix handling of NULLs in MCV items and constants

commit   : e4deae7396f2a5576c0c8289e2bfc005ed3d6989    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 15 Jul 2019 02:00:31 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 15 Jul 2019 02:00:31 +0200    

Click here for diff

There were two issues in how the extended statistics handled NULL values  
in opclauses. Firstly, the code was oblivious to the possibility that  
Const may be NULL (constisnull=true) in which case the constvalue is  
undefined. We need to treat this as a mismatch, and not call the proc.  
  
Secondly, the MCV item itself may contain NULL values too - the code  
already did check that, and updated the match bitmap accordingly, but  
failed to ensure we won't call the operator procedure anyway. It did  
work for AND-clauses, because in that case false in the bitmap stops  
evaluation of further clauses. But for OR-clauses ir was not easy to  
get incorrect estimates or even trigger a crash.  
  
This fixes both issues by extending the existing check so that it looks  
at constisnull too, and making sure it skips calling the procedure.  
  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  

M src/backend/statistics/mcv.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix handling of opclauses in extended statistics

commit   : e8b6ae2130e3a95bb776708a9a7c9cb21fe8ac87    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 13 Jul 2019 00:12:16 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 13 Jul 2019 00:12:16 +0200    

Click here for diff

We expect opclauses to have exactly one Var and one Const, but the code  
was checking the Const by calling is_pseudo_constant_clause() which is  
incorrect - we need a proper constant.  
  
Fixed by using plain IsA(x,Const) to check type of the node. We need to  
do these checks in two places, so move it into a separate function that  
can be called in both places.  
  
Reported by Andreas Seltenreich, based on crash reported by sqlsmith.  
  
Backpatch to v12, where this code was introduced.  
  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  
Backpatch-to: 12  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/include/statistics/extended_stats_internal.h

Remove unnecessary TYPECACHE_GT_OPR lookup

commit   : a4303a078c661ebafe8c8c2167b2ad9bf16b32ce    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 17 Jul 2019 18:13:39 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 17 Jul 2019 18:13:39 +0200    

Click here for diff

The TYPECACHE_GT_OPR is not needed (it used to be in older version of  
the MCV code), but the compiler failed to detect this as the result was  
used in a fmgr_info() call, populating a FmgrInfo entry.  
  
Backpatch to v12, where this code was introduced.  
  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  
Backpatch-to: 12  

M src/backend/statistics/mcv.c

tableam: comment improvements.

commit   : 21039555cdec75836d246fcbcd4b44ee63dabfad    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 17 Jul 2019 19:39:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 17 Jul 2019 19:39:54 -0700    

Click here for diff

Author: Brad DeJong  
Discussion: https://postgr.es/m/CAJnrtnxDYOQFsDfWz2iri0T_fFL2ZbbzgCOE=4yaMcszgcsf4A@mail.gmail.com  
Backpatch: 12-  

M src/include/access/tableam.h

Simplify description of --data-checksums in documentation of initdb

commit   : 1c1602b8b685a68796f8ba48e41f778c0c42ba43    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jul 2019 10:05:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jul 2019 10:05:59 +0900    

Click here for diff

The documentation mentioned that data checksums cannot be changed after  
initialization, which is not true as pg_checksums can do that with its  
--enable option introduced in v12.  This simply removes the sentence  
telling so.  
  
Reported-by: Basil Bourque  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Update time zone data files to tzdata release 2019b.

commit   : 93907478e15f5762800b6acbe2eff03167843874    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 19:15:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 19:15:21 -0400    

Click here for diff

Brazil no longer observes DST.  
Historical corrections for Palestine, Hong Kong, and Italy.  

M src/timezone/data/tzdata.zi

Sync our copy of the timezone library with IANA release tzcode2019b.

commit   : f285322f9cd3145ea2e5b870e6ba7e0c641422ac    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 18:26:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 18:26:23 -0400    

Click here for diff

A large fraction of this diff is just due to upstream's somewhat  
random decision to rename a bunch of internal variables and struct  
fields.  However, there is an interesting new feature in zic:  
it's grown a "-b slim" option that emits zone files without 32-bit  
data and other backwards-compatibility hacks.  We should consider  
whether we wish to enable that.  

M src/timezone/README
M src/timezone/localtime.c
M src/timezone/pgtz.h
M src/timezone/tzfile.h
M src/timezone/zic.c

Clarify the distinction between public and private SPITupleTable fields.

commit   : fec0778c8098cebec2d5cb3674ac7151d8d95638    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 14:55:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 14:55:13 -0400    

Click here for diff

The fields that we consider public are "tupdesc" and "vals", which  
historically are in the middle of the struct.  Move them to the front  
(this should be perfectly safe to do in HEAD) and add comments to make  
it quite clear which fields are public or not.  
  
Also adjust spi.sgml's documentation of the struct to match.  
That doc had bit-rotted somewhat, as it was missing some fields.  
(Arguably we should just remove all the private fields from the docs,  
but for now I refrained.)  
  
Daniel Gustafsson, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/spi.sgml
M src/include/executor/spi.h

Doc: explain where to find Makefile used to build sepgsql-regtest.pp.

commit   : 860c095fd548cd25586e4273e9b489082b4ffa13    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 13:13:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 13:13:15 -0400    

Click here for diff

At least on Fedora and RHEL, it's not in the same RPM that's needed  
for building sepgsql itself.  Today is the second or third time I've  
had to rediscover how to install that, so let's document it this time.  

M doc/src/sgml/sepgsql.sgml

Fix sepgsql test results for commit d97b714a2.

commit   : 82c8a3c52adfd993b72289bfa8739f97216a06df    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 13:04:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 13:04:59 -0400    

Click here for diff

The aggregate-order difference explained in my previous commit  
turns out to also affect the order of log entries emitted in the  
contrib/sepgsql regression test.  Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/expected/misc.out

Avoid using lcons and list_delete_first where it's easy to do so.

commit   : d97b714a219959a50f9e7b37ded674f5132f93f3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 11:15:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 11:15:28 -0400    

Click here for diff

Formerly, lcons was about the same speed as lappend, but with the new  
List implementation, that's not so; with a long List, data movement  
imposes an O(N) cost on lcons and list_delete_first, but not lappend.  
  
Hence, invent list_delete_last with semantics parallel to  
list_delete_first (but O(1) cost), and change various places to use  
lappend and list_delete_last where this can be done without much  
violence to the code logic.  
  
There are quite a few places that construct result lists using lcons not  
lappend.  Some have semantic rationales for that; I added comments about  
it to a couple that didn't have them already.  In many such places though,  
I think the coding is that way only because back in the dark ages lcons  
was faster than lappend.  Hence, switch to lappend where this can be done  
without causing semantic changes.  
  
In ExecInitExprRec(), this results in aggregates and window functions that  
are in the same plan node being executed in a different order than before.  
Generally, the executions of such functions ought to be independent of  
each other, so this shouldn't result in visibly different query results.  
But if you push it, as one regression test case does, you can show that  
the order is different.  The new order seems saner; it's closer to  
the order of the functions in the query text.  And we never documented  
or promised anything about this, anyway.  
  
Also, in gistfinishsplit(), don't bother building a reverse-order list;  
it's easy now to iterate backwards through the original list.  
  
It'd be possible to go further towards removing uses of lcons and  
list_delete_first, but it'd require more extensive logic changes,  
and I'm not convinced it's worth it.  Most of the remaining uses  
deal with queues that probably never get long enough to be worth  
sweating over.  (Actually, I doubt that any of the changes in this  
patch will have measurable performance effects either.  But better  
to have good examples than bad ones in the code base.)  
  
Patch by me, thanks to David Rowley and Daniel Gustafsson for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gist/gist.c
M src/backend/catalog/heap.c
M src/backend/commands/cluster.c
M src/backend/commands/lockcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execExpr.c
M src/backend/nodes/list.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_agg.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/pg_list.h
M src/test/regress/expected/aggregates.out

Move some md.c-specific logic from smgr.c to md.c.

commit   : dfd0121dc73aab491bcaad2d2b7a2a749389add8    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 17 Jul 2019 12:14:08 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 17 Jul 2019 12:14:08 +1200    

Click here for diff

Potential future SMGR implementations may not want to create  
tablespace directories when creating an SMGR relation.  Move that  
logic to mdcreate().  Move the initialization of md-specific  
data structures from smgropen() to a new callback mdopen().  
  
Author: Thomas Munro  
Reviewed-by: Shawn Debnath (as part of an earlier patch set)  
Discussion: https://postgr.es/m/CA%2BhUKG%2BOZqOiOuDm5tC5DyQZtJ3FH4%2BFSVMqtdC4P1atpJ%2Bqhg%40mail.gmail.com  

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

Fix thinko in construction of old_conpfeqop list.

commit   : 3093eb2b83645a083a47ea62769ffd89e31f3664    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 18:17:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 18:17:47 -0400    

Click here for diff

This should lappend the OIDs, not lcons them; the existing code produced  
a list in reversed order.  This is harmless for single-key FKs or FKs  
where all the key columns are of the same type, which probably explains  
how it went unnoticed.  But if those conditions are not met,  
ATAddForeignKeyConstraint would make the wrong decision about whether an  
existing FK needs to be revalidated.  I think it would almost always err  
in the safe direction by revalidating a constraint that didn't need it.  
You could imagine scenarios where the pfeqop check was fooled by  
swapping the types of two FK columns in one ALTER TABLE, but that case  
would probably be rejected by other tests, so it might be impossible to  
get to the worst-case scenario where an FK should be revalidated and  
isn't.  (And even then, it's likely to be fine, unless there are weird  
inconsistencies in the equality behavior of the replacement types.)  
However, this is a performance bug at least.  
  
Noted while poking around to see whether lcons calls could be converted  
to lappend.  
  
This bug is old, dating to commit cb3a7c2b9, so back-patch to all  
supported branches.  

M src/backend/commands/tablecmds.c

Remove lappend_cell...() family of List functions.

commit   : c245776906b065fcd59831a25c3b24ad3ddcd849    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 13:12:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 13:12:24 -0400    

Click here for diff

It seems worth getting rid of these functions because they require the  
caller to retain a ListCell pointer into a List that it's modifying,  
which is a dangerous practice with the new List implementation.  
(The only other List-modifying function that takes a ListCell pointer  
as input is list_delete_cell, which nowadays is preferentially used  
via the constrained API foreach_delete_current.)  
  
There was only one remaining caller of these functions after commit  
2f5b8eb5a, and that was some fairly ugly GEQO code that can be much  
more clearly expressed using a list-index variable and list_insert_nth.  
Hence, rewrite that code, and remove the functions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/list.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/include/nodes/pg_list.h

Clean up some ad-hoc code for sorting and de-duplicating Lists.

commit   : 2f5b8eb5a28b4e6de9d20cc7d2c6028c6c7a8aa8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 12:04:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 12:04:06 -0400    

Click here for diff

heap.c and relcache.c contained nearly identical copies of logic  
to insert OIDs into an OID list while preserving the list's OID  
ordering (and rejecting duplicates, in one case but not the other).  
  
The comments argue that this is faster than qsort for small numbers  
of OIDs, which is at best unproven, and seems even less likely to be  
true now that lappend_cell_oid has to move data around.  In any case  
it's ugly and hard-to-follow code, and if we do have a lot of OIDs  
to consider, it's O(N^2).  
  
Hence, replace with simply lappend'ing OIDs to a List, then list_sort  
the completed List, then remove adjacent duplicates if necessary.  
This is demonstrably O(N log N) and it's much simpler for the  
callers.  It's possible that this would be somewhat inefficient  
if there were a very large number of duplicates, but that seems  
unlikely in the existing usage.  
  
This adds list_deduplicate_oid and list_oid_cmp infrastructure  
to list.c.  I didn't bother with equivalent functionality for  
integer or pointer Lists, but such could always be added later  
if we find a use for it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/nodes/list.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/pg_list.h

Redesign the API for list sorting (list_qsort becomes list_sort).

commit   : 569ed7f48312c70ed4a79daec1d7688fda4e74ac    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 11:51:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 11:51:44 -0400    

Click here for diff

In the wake of commit 1cff1b95a, the obvious way to sort a List  
is to apply qsort() directly to the array of ListCells.  list_qsort  
was building an intermediate array of pointers-to-ListCells, which  
we no longer need, but getting rid of it forces an API change:  
the comparator functions need to do one less level of indirection.  
  
Since we're having to touch the callers anyway, let's do two additional  
changes: sort the given list in-place rather than making a copy (as  
none of the existing callers have any use for the copying behavior),  
and rename list_qsort to list_sort.  It was argued that the old name  
exposes more about the implementation than it should, which I find  
pretty questionable, but a better reason to rename it is to be sure  
we get the attention of any external callers about the need to fix  
their comparator functions.  
  
While we're at it, change four existing callers of qsort() to use  
list_sort instead; previously, they all had local reinventions  
of list_qsort, ie build-an-array-from-a-List-and-qsort-it.  
(There are some other places where changing to list_sort perhaps  
would be worthwhile, but they're less obviously wins.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/list.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/parse_agg.c
M src/backend/replication/basebackup.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/rewrite/rowsecurity.c
M src/include/nodes/pg_list.h

Fix inconsistencies and typos in the tree

commit   : 0896ae561b6c799d45cb61d8a3b18fbb442130a7    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 16 Jul 2019 13:23:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 16 Jul 2019 13:23:53 +0900    

Click here for diff

This is numbered take 7, and addresses a set of issues around:  
- Fixes for typos and incorrect reference names.  
- Removal of unneeded comments.  
- Removal of unreferenced functions and structures.  
- Fixes regarding variable name consistency.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M contrib/cube/cube.c
M contrib/intarray/_int.h
M contrib/ltree/ltxtquery_io.c
M contrib/pgstattuple/pgstatindex.c
M doc/src/sgml/gist.sgml
M src/backend/access/gin/README
M src/backend/access/gin/ginfast.c
M src/backend/access/gist/README
M src/backend/access/gist/gist.c
M src/backend/access/nbtree/README
M src/backend/access/spgist/spgscan.c
M src/backend/access/transam/clog.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/namespace.c
M src/backend/executor/nodeAgg.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/parse_agg.c
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/fd.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/inet_cidr_ntop.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/mmgr/dsa.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_upgrade/pg_upgrade.c
M src/include/access/gist_private.h
M src/include/access/xlog_internal.h
M src/include/foreign/foreign.h
M src/include/postmaster/postmaster.h
M src/include/storage/fsm_internals.h
M src/include/storage/predicate_internals.h
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/port/thread.c
M src/test/perl/TestLib.pm

Remove dead code.

commit   : 4c3d05d875dd173a81a995c6e14d69496b467eec    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Jul 2019 23:27:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Jul 2019 23:27:13 -0400    

Click here for diff

These memory context switches are useless in the wake of commit  
1cff1b95a.  Noted by Jesper Pedersen.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/async.c

doc: mention pg_reload_conf() for reloading the config file

commit   : c6bce6ebb668c7da03d01244d34cac0335561103    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 15 Jul 2019 20:57:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 15 Jul 2019 20:57:24 -0400    

Click here for diff

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

M doc/src/sgml/client-auth.sgml

Provide pgbench --show-script to dump built-in scripts.

commit   : 5823677acc567d7790cc68972de12f6718913d7d    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 16 Jul 2019 11:53:12 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 16 Jul 2019 11:53:12 +1200    

Click here for diff

Author: Fabien Coelho  
Reviewed-by: Ibrar Ahmed  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081737390.5867%40lancre  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/002_pgbench_no_server.pl

Report the time taken by pgbench initialization steps.

commit   : ce8f946764005e1bde5a538542205e55f81bb6cc    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 16 Jul 2019 11:31:44 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 16 Jul 2019 11:31:44 +1200    

Click here for diff

Author: Fabien Coelho  
Reviewed-by: Ibrar Ahmed  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904061810510.3678%40lancre  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Correct nbtsplitloc.c comment.

commit   : bfdbac2ab3ef1a12a7de231552b128ed83ad00bb    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 15 Jul 2019 14:35:06 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 15 Jul 2019 14:35:06 -0700    

Click here for diff

The logic just added by commit e3899ffd falls back on a 50:50 page split  
in the event of a new item that's just to the right of our provisional  
"many duplicates" split point.  Fix a comment that incorrectly claimed  
that the new item had to be just to the left of our provisional split  
point.  
  
Backpatch: 12-, just like commit e3899ffd.  

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

Fix pathological nbtree split point choice issue.

commit   : e3899ffd8beafdaaa037b503163a9f572e9fc729    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 15 Jul 2019 13:19:13 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 15 Jul 2019 13:19:13 -0700    

Click here for diff

Specific ever-decreasing insertion patterns could cause successive  
unbalanced nbtree page splits.  Problem cases involve a large group of  
duplicates to the left, and ever-decreasing insertions to the right.  
  
To fix, detect the situation by considering the newitem offset before  
performing a split using nbtsplitloc.c's "many duplicates" strategy.  If  
the new item was inserted just to the right of our provisional "many  
duplicates" split point, infer ever-decreasing insertions and fall back  
on a 50:50 (space delta optimal) split.  This seems to barely affect  
cases that already had acceptable space utilization.  
  
An alternative fix also seems possible.  Instead of changing  
nbtsplitloc.c split choice logic, we could instead teach _bt_truncate()  
to generate a new value for new high keys by interpolating from the  
lastleft and firstright key values.  That would certainly be a more  
elegant fix, but it isn't suitable for backpatching.  
  
Discussion: https://postgr.es/m/CAH2-WznCNvhZpxa__GqAa1fgQ9uYdVc=_apArkW2nc-K3O7_NA@mail.gmail.com  
Backpatch: 12-, where the nbtree page split enhancements were introduced.  

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

Represent Lists as expansible arrays, not chains of cons-cells.

commit   : 1cff1b95ab6ddae32faa3efe0d95a820dbfdc164    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Jul 2019 13:41:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Jul 2019 13:41:58 -0400    

Click here for diff

Originally, Postgres Lists were a more or less exact reimplementation of  
Lisp lists, which consist of chains of separately-allocated cons cells,  
each having a value and a next-cell link.  We'd hacked that once before  
(commit d0b4399d8) to add a separate List header, but the data was still  
in cons cells.  That makes some operations -- notably list_nth() -- O(N),  
and it's bulky because of the next-cell pointers and per-cell palloc  
overhead, and it's very cache-unfriendly if the cons cells end up  
scattered around rather than being adjacent.  
  
In this rewrite, we still have List headers, but the data is in a  
resizable array of values, with no next-cell links.  Now we need at  
most two palloc's per List, and often only one, since we can allocate  
some values in the same palloc call as the List header.  (Of course,  
extending an existing List may require repalloc's to enlarge the array.  
But this involves just O(log N) allocations not O(N).)  
  
Of course this is not without downsides.  The key difficulty is that  
addition or deletion of a list entry may now cause other entries to  
move, which it did not before.  
  
For example, that breaks foreach() and sister macros, which historically  
used a pointer to the current cons-cell as loop state.  We can repair  
those macros transparently by making their actual loop state be an  
integer list index; the exposed "ListCell *" pointer is no longer state  
carried across loop iterations, but is just a derived value.  (In  
practice, modern compilers can optimize things back to having just one  
loop state value, at least for simple cases with inline loop bodies.)  
In principle, this is a semantics change for cases where the loop body  
inserts or deletes list entries ahead of the current loop index; but  
I found no such cases in the Postgres code.  
  
The change is not at all transparent for code that doesn't use foreach()  
but chases lists "by hand" using lnext().  The largest share of such  
code in the backend is in loops that were maintaining "prev" and "next"  
variables in addition to the current-cell pointer, in order to delete  
list cells efficiently using list_delete_cell().  However, we no longer  
need a previous-cell pointer to delete a list cell efficiently.  Keeping  
a next-cell pointer doesn't work, as explained above, but we can improve  
matters by changing such code to use a regular foreach() loop and then  
using the new macro foreach_delete_current() to delete the current cell.  
(This macro knows how to update the associated foreach loop's state so  
that no cells will be missed in the traversal.)  
  
There remains a nontrivial risk of code assuming that a ListCell *  
pointer will remain good over an operation that could now move the list  
contents.  To help catch such errors, list.c can be compiled with a new  
define symbol DEBUG_LIST_MEMORY_USAGE that forcibly moves list contents  
whenever that could possibly happen.  This makes list operations  
significantly more expensive so it's not normally turned on (though it  
is on by default if USE_VALGRIND is on).  
  
There are two notable API differences from the previous code:  
  
* lnext() now requires the List's header pointer in addition to the  
current cell's address.  
  
* list_delete_cell() no longer requires a previous-cell argument.  
  
These changes are somewhat unfortunate, but on the other hand code using  
either function needs inspection to see if it is assuming anything  
it shouldn't, so it's not all bad.  
  
Programmers should be aware of these significant performance changes:  
  
* list_nth() and related functions are now O(1); so there's no  
major access-speed difference between a list and an array.  
  
* Inserting or deleting a list element now takes time proportional to  
the distance to the end of the list, due to moving the array elements.  
(However, it typically *doesn't* require palloc or pfree, so except in  
long lists it's probably still faster than before.)  Notably, lcons()  
used to be about the same cost as lappend(), but that's no longer true  
if the list is long.  Code that uses lcons() and list_delete_first()  
to maintain a stack might usefully be rewritten to push and pop at the  
end of the list rather than the beginning.  
  
* There are now list_insert_nth...() and list_delete_nth...() functions  
that add or remove a list cell identified by index.  These have the  
data-movement penalty explained above, but there's no search penalty.  
  
* list_concat() and variants now copy the second list's data into  
storage belonging to the first list, so there is no longer any  
sharing of cells between the input lists.  The second argument is  
now declared "const List *" to reflect that it isn't changed.  
  
This patch just does the minimum needed to get the new implementation  
in place and fix bugs exposed by the regression tests.  As suggested  
by the foregoing, there's a fair amount of followup work remaining to  
do.  
  
Also, the ENABLE_LIST_COMPAT macros are finally removed in this  
commit.  Code using those should have been gone a dozen years ago.  
  
Patch by me; thanks to David Rowley, Jesper Pedersen, and others  
for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/file_fdw/file_fdw.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/postgres_fdw/deparse.c
M contrib/sepgsql/label.c
M contrib/sepgsql/uavc.c
M src/backend/access/common/printtup.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/view.c
M src/backend/executor/execJunk.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/list.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/print.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/replication/basebackup.c
M src/backend/replication/syncrep.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/mbutils.c
M src/include/nodes/pg_list.h
M src/pl/plpgsql/src/pl_exec.c

Provide XLogRecGetFullXid().

commit   : 67b9b3ca328392f9afc4e66fe03564f5fc87feff    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 15 Jul 2019 17:03:46 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 15 Jul 2019 17:03:46 +1200    

Click here for diff

In order to be able to work with FullTransactionId values during replay  
without increasing the size of the WAL, infer the epoch.  In general we  
can't do that safely, but during replay we can because we know that  
nextFullXid can't advance concurrently.  
  
Prevent frontend code from seeing this new function, due to the above  
restriction.  Perhaps in future it will be possible to extract the value  
entirely from independent WAL records, and then this restriction can be  
lifted.  
  
Author: Thomas Munro, based on earlier code from Andres Freund  
Discussion: https://postgr.es/m/CA%2BhUKG%2BmLmuDjMi6o1dxkKvGRL56Y2Rz%2BiXAcrZV03G9ZuFQ8Q%40mail.gmail.com  

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

Add gen_random_uuid function

commit   : 5925e5549890416bcf588334d9d0bc99f8ad6c7f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jul 2019 14:30:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jul 2019 14:30:27 +0200    

Click here for diff

This adds a built-in function to generate UUIDs.  
  
PostgreSQL hasn't had a built-in function to generate a UUID yet,  
relying on external modules such as uuid-ossp and pgcrypto to provide  
one.  Now that we have a strong random number generator built-in, we  
can easily provide a version 4 (random) UUID generation function.  
  
This patch takes the existing function gen_random_uuid() from pgcrypto  
and makes it a built-in function.  The pgcrypto implementation now  
internally redirects to the built-in one.  
  
Reviewed-by: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/pgcrypto/pgcrypto.c
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/uuid-ossp.sgml
M src/backend/utils/adt/uuid.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/uuid.out
M src/test/regress/sql/uuid.sql

Forgotten catversion bump

commit   : 565f3390005318ea4c982b8d054d56e9fe5a6454    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 14 Jul 2019 15:22:21 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 14 Jul 2019 15:22:21 +0300    

Click here for diff

6254c55f81, c085e1c1cb and 075f0a880f all change system catalog.  But  
catversion bump is missed in all of them.  So, do catversion bump now.  
  
Also, I need mention patch reviewer Fabien Coelho, who has been missed in  
commit messages of 6254c55f81, c085e1c1cb and 075f0a880f.  

M src/include/catalog/catversion.h

Add support for <-> (box, point) operator to SP-GiST box_ops

commit   : 075f0a880fbf790f4a3dcac83e2d5125bcad9646    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 14 Jul 2019 14:57:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 14 Jul 2019 14:57:53 +0300    

Click here for diff

Opclass support functions already can handle this operator, just catalog  
adjustment appears to be required.  
  
Discussion: https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru  
Author: Nikita Glukhov  
Reviewed-by: Tom Lane, Alexander Korotkov  

M doc/src/sgml/spgist.sgml
M src/include/catalog/pg_amop.dat
M src/test/regress/expected/box.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/box.sql

Add support for <-> (box, point) operator to GiST box_ops

commit   : c085e1c1cb4e29637552f5d250d45ad0cb83e5cf    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 14 Jul 2019 14:56:18 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 14 Jul 2019 14:56:18 +0300    

Click here for diff

Index-based calculation of this operator is exact.  So, signature of  
gist_bbox_distance() function is changes so that caller is responsible for  
setting *recheck flag.  
  
Discussion: https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru  
Author: Nikita Glukhov  
Reviewed-by: Tom Lane, Alexander Korotkov  

M doc/src/sgml/gist.sgml
M src/backend/access/gist/gistproc.c
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/gist.out
M src/test/regress/sql/gist.sql

Add missing commutators for distance operators

commit   : 6254c55f815623bb74e2cf27562437dc3b2aa2c8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 14 Jul 2019 14:55:01 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 14 Jul 2019 14:55:01 +0300    

Click here for diff

Some of <-> operators between geometric types have their commutators missed.  
This commit adds them.  The motivation is upcoming kNN support for some of those  
operators.  
  
Discussion: https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru  
Author: Nikita Glukhov  
Reviewed-by: Tom Lane, Alexander Korotkov  

M src/backend/utils/adt/geo_ops.c
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/geometry.out
M src/test/regress/sql/geometry.sql

Teach pg_stat_statements not to ignore FOR UPDATE clauses

commit   : 6e74c64bcf61eab94091f6b17dfd0ab585b1a77e    
  
author   : Andrew Gierth <[email protected]>    
date     : Sun, 14 Jul 2019 12:07:40 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sun, 14 Jul 2019 12:07:40 +0100    

Click here for diff

Performance of a SELECT FOR UPDATE may be quite distinct from the  
non-UPDATE version of the query, so treat all of the FOR UPDATE clause  
as being significant for distinguishing queries.  
  
Andrew Gierth and Vik Fearing, reviewed by Sergei Kornilov, Thomas  
Munro, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/sql/pg_stat_statements.sql

Fix documentation for pgbench tpcb-like.

commit   : 0369f4736665864edd7bf43736df190afa223c4c    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 14 Jul 2019 14:19:54 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 14 Jul 2019 14:19:54 +1200    

Click here for diff

We choose a random value for delta, not balance.  Back-patch to 9.6 where  
the mistake arrived.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081752210.5867@lancre  

M doc/src/sgml/ref/pgbench.sgml

Revive test of concurrent OID generation.

commit   : 8a0cbb88524e8b6121597285b811640ee793b3e8    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 13 Jul 2019 13:34:22 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 13 Jul 2019 13:34:22 -0700    

Click here for diff

Commit 578b229718e8f15fa779e20f086c4b6bb3776106 replaced it with a  
concurrent "nextval" test.  That version does not detect PostgreSQL's  
incompatibility with xlc 13.1.3, so bring back an OID-based test that  
does.  Back-patch to v12, where that commit first appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix some inconsistencies in MSVC scripts

commit   : 39aadc984221f57ce7dc11dd3c8c719e10198549    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 13 Jul 2019 16:51:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 13 Jul 2019 16:51:31 +0900    

Click here for diff

In configure scripts, --with-ossp-uuid is obsolete is replaced by  
--with-uuid, and it needs to specify a path to its library builds when  
building with the MSVC scripts.  --with-perl needs also to specify a  
path.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl

Fix and improve several places in the docs

commit   : 170d11b8e7cb9df96a7ee0b8140d28536d55fe3e    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 13 Jul 2019 14:43:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 13 Jul 2019 14:43:29 +0900    

Click here for diff

This adds some missing markups, fixes a couple of incorrect ones and  
clarifies some documentation in various places.  
  
Author: Liudmila Mantrova  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M doc/src/sgml/backup.sgml
M doc/src/sgml/biblio.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/reindex.sgml

Fix tab completion for UPDATE.

commit   : 5b51bbfbd52a444a490247e66751d6a47d2ba7dd    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 15:56:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 15:56:20 +1200    

Click here for diff

Previously it suggested an extra "=" after "SET x=".  
  
Reported-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CA%2BhUKGLk%3D0yLDjfviONJLzcHEzygj%3Dx6VbGH43LnXbBUvQb52g%40mail.gmail.com  

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

Tab completion for CREATE TYPE.

commit   : 7bdc6556fb325582b02e9a6931c38f873a0c46a0    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 15:51:52 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 15:51:52 +1200    

Click here for diff

Author: Thomas Munro  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CA%2BhUKGLk%3D0yLDjfviONJLzcHEzygj%3Dx6VbGH43LnXbBUvQb52g%40mail.gmail.com  

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

Forward received condition variable signals on cancel.

commit   : b91dd9de5ea0839d0d248ebbe8cb926c3df52c7c    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 13:55:10 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 13:55:10 +1200    

Click here for diff

After a process decides not to wait for a condition variable, it can  
still consume a signal before it reaches ConditionVariableCancelSleep().  
In that case, pass the signal on to another waiter if possible, so that  
a signal doesn't go missing when there is another process ready to  
receive it.  
  
Author: Thomas Munro  
Reviewed-by: Shawn Debnath  
Discussion: https://postgr.es/m/CA%2BhUKGLQ_RW%2BXs8znDn36e-%2Bmq2--zrPemBqTQ8eKT-VO1OF4Q%40mail.gmail.com  

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

Introduce timed waits for condition variables.

commit   : 1321509fa43293615c4e5fa5dc8eed5286f479b1    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 13:40:36 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 13:40:36 +1200    

Click here for diff

Provide ConditionVariableTimedSleep(), like ConditionVariableSleep()  
but with a timeout argument.  
  
Author: Shawn Debnath  
Reviewed-by: Kyotaro Horiguchi, Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  

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

Warn if wal_level is too low when creating a publication.

commit   : b31fbe852c095a827caade2e0702f8a215053bea    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 10:35:34 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 13 Jul 2019 10:35:34 +1200    

Click here for diff

Provide a hint to users that they need to increase wal_level before  
subscriptions can work.  
  
Author: Lucas Viecelli, with some adjustments by Thomas Munro  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAPjy-57rn5Y9g4e5u--eSOP-7P4QrE9uOZmT2ZcUebF8qxsYhg%40mail.gmail.com  

M src/backend/commands/publicationcmds.c
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql

Fix get_actual_variable_range() to cope with broken HOT chains.

commit   : d3751adcf14d3baacc9738ee9ce869dc1c31d7ad    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Jul 2019 16:24:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Jul 2019 16:24:59 -0400    

Click here for diff

Commit 3ca930fc3 modified get_actual_variable_range() to use a new  
"SnapshotNonVacuumable" snapshot type for selecting tuples that it  
would consider valid.  However, because that snapshot type can accept  
recently-dead tuples, this caused a bug when using a recently-created  
index: we might accept a recently-dead tuple that is an early member  
of a broken HOT chain and does not actually match the index entry.  
Then, the data extracted from the heap tuple would not necessarily be  
an endpoint value of the column; it could even be NULL, leading to  
get_actual_variable_range() itself reporting "found unexpected null  
value in index".  Even without an error, this could lead to poor  
plan choices due to an erroneous notion of the endpoint value.  
  
We can improve matters by changing the code to use the index-only  
scan technique (which didn't exist when get_actual_variable_range was  
originally written).  If any of the tuples in a HOT chain are live  
enough to satisfy SnapshotNonVacuumable, we take the data from the  
index entry, ignoring what is in the heap.  This fixes the problem  
without changing the live-vs-dead-tuple behavior from what was  
intended by commit 3ca930fc3.  
  
A side benefit is that for static tables we might not have to touch  
the heap at all (when the extremal value is in an all-visible page).  
In addition, we can save some overhead by not having to create a  
complete ExecutorState, and we don't need to run FormIndexDatum,  
avoiding more cycles as well as the possibility of failure for  
indexes on expressions.  (I'm not sure that this code would ever  
be used to determine the extreme value of an expression, in the  
current state of the planner; but it's definitely possible that  
lower-order columns of the selected index could be expressions.  
So one could construct perhaps-artificial examples in which the  
old code unexpectedly failed due to trying to compute an  
expression's value for a now-dead row.)  
  
Per report from Manuel Rigger.  Back-patch to v11 where commit  
3ca930fc3 came in.  
  
Discussion: https://postgr.es/m/CA+u7OA7W4NWEhCvftdV6_8bbm2vgypi5nuxfnSEJQqVKFSUoMg@mail.gmail.com  

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

Fix RANGE partition pruning with multiple boolean partition keys

commit   : cfde23493938b543d281c509527f0f5b16fca9ff    
  
author   : David Rowley <[email protected]>    
date     : Fri, 12 Jul 2019 19:12:38 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 12 Jul 2019 19:12:38 +1200    

Click here for diff

match_clause_to_partition_key incorrectly would return  
PARTCLAUSE_UNSUPPORTED if a bool qual could not be matched to the current  
partition key.  This was a problem, as it causes the calling function to  
discard the qual and not try to match it to any other partition key.  If  
there was another partition key which did match this qual, then the qual  
would not be checked again and we could fail to prune some partitions.  
  
The worst this could do was to cause partitions not to be pruned when they  
could have been, so there was no danger of incorrect query results here.  
  
Fix this by changing match_boolean_partition_clause to have it return a  
PartClauseMatchStatus rather than a boolean value.  This allows it to  
communicate if the qual is unsupported or if it just does not match this  
particular partition key, previously these two cases were treated the  
same.  Now, if match_clause_to_partition_key is unable to match the qual  
to any other qual type then we can simply return the value from the  
match_boolean_partition_clause call so that the calling function properly  
treats the qual as either unmatched or unsupported.  
  
Reported-by: Rares Salcudean  
Reviewed-by: Amit Langote  
Backpatch-through: 11 where partition pruning was introduced  
Discussion: https://postgr.es/m/CAHp_FN2xwEznH6oyS0hNTuUUZKp5PvegcVv=Co6nBXJ+mC7Y5w@mail.gmail.com  

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

Fixes for jsonpath filter expression elements table in docs

commit   : 0cea6eb5a5f2948c411706cabfde32ce61df0d7a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 11 Jul 2019 18:18:15 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 11 Jul 2019 18:18:15 +0300    

Click here for diff

Reported-by: Thom Brown  
Discussion: https://postgr.es/m/CAA-aLv4Tggy6Z3kaG9n%2B3SHwOVGN2Yj_MJXfdfwjH_jBNZzJNA%40mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/func.sgml

Reduce memory consumption for multi-statement query strings.

commit   : b5810de3f4eb0e7b242d31db93a46957d56ea8b4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Jul 2019 14:32:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Jul 2019 14:32:28 -0400    

Click here for diff

Previously, exec_simple_query always ran parse analysis, rewrite, and  
planning in MessageContext, allowing all the data generated thereby  
to persist until the end of processing of the whole query string.  
That's fine for single-command strings, but if a client sends many  
commands in a single simple-Query message, this strategy could result  
in annoying memory bloat, as complained of by Andreas Seltenreich.  
  
To fix, create a child context to do this work in, and reclaim it  
after each command.  But we only do so for parsetrees that are not  
last in their query string.  That avoids adding any memory management  
overhead for the typical case of a single-command string.  Memory  
allocated for the last parsetree would be freed immediately after  
finishing the command string anyway.  
  
Similarly, adjust extension.c's execute_sql_string() to reclaim memory  
after each command.  In that usage, multi-command strings are the norm,  
so it's a bit surprising that no one has yet complained of bloat ---  
especially since the bloat extended to whatever data ProcessUtility  
execution might leak.  
  
Amit Langote, reviewed by Julien Rouhaud  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/extension.c
M src/backend/tcop/postgres.c

docs: remove pg_roles mention of the oid column being displayed

commit   : 909a7b6b8ecd6bf87bb44cb014ed593e9789af11    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Jul 2019 14:24:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Jul 2019 14:24:36 -0400    

Click here for diff

It is now always displayed in PG 12+.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Ian Barwick  
  
Backpatch-through: 12  

M doc/src/sgml/catalogs.sgml

Mention limitation of unique in partitioned tables

commit   : ec4eaab78b078b9326296236f184773590a92ca3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 10 Jul 2019 08:58:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 10 Jul 2019 08:58:41 -0400    

Click here for diff

Per gripe from Phil Bayer.  
  
Authors: Amit Langote and others  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Fix variable initialization when using buffering build with GiST

commit   : fa19a08d71fbeefc39415d9c6c70128460d41f94    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 10 Jul 2019 15:14:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 10 Jul 2019 15:14:54 +0900    

Click here for diff

This can cause valgrind to complain, as the flag marking a buffer as a  
temporary copy was not getting initialized.  
  
While on it, fill in with zeros newly-created buffer pages.  This does  
not matter when loading a block from a temporary file, but it makes the  
push of an index tuple into a new buffer page safer.  
  
This has been introduced by 1d27dcf, so backpatch all the way down to  
9.4.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M src/backend/access/gist/gistbuildbuffers.c

Assorted fixes for jsonpath documentation

commit   : 5a7d697a39365d9762afa8e618bcbdcf592966fa    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 10 Jul 2019 07:46:16 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 10 Jul 2019 07:46:16 +0300    

Click here for diff

This commit contains assorted fixes for jsonpath documentation including:  
grammar fixes, incorrect examples fixes as well as wording improvements.  
  
Discussion: https://postgr.es/m/CAA-aLv4VVX%3Db9RK5hkfPXJczqaiTdqO04teW9i0wiQVhdKcqzw%40mail.gmail.com  
Author: Liudmila Mantrova  
Reviewed-by: Alexander Korotkov  
Reported-by: Thom Brown  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

Fix missing calls to table_finish_bulk_insert during COPY, take 2

commit   : f7c830f1ab2645236ac2d6103fb3a88518bdc4fc    
  
author   : David Rowley <[email protected]>    
date     : Wed, 10 Jul 2019 16:03:04 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 10 Jul 2019 16:03:04 +1200    

Click here for diff

86b85044e abstracted calls to heap functions in COPY FROM to support a  
generic table AM.  However, when performing a copy into a partitioned  
table, this commit neglected to call table_finish_bulk_insert for each  
partition.  Before 86b85044e, when we always called the heap functions,  
there was no need to call heapam_finish_bulk_insert for partitions since  
it only did any work when performing a copy without WAL.  For partitioned  
tables, this was unsupported anyway, so there was no issue.  With  
pluggable storage, we can't make any assumptions about what the table AM  
might want to do in its equivalent function, so we'd better ensure we  
always call table_finish_bulk_insert each partition that's received a row.  
  
For now, we make the table_finish_bulk_insert call whenever we evict a  
CopyMultiInsertBuffer out of the CopyMultiInsertInfo.  This does mean  
that it's possible that we call table_finish_bulk_insert multiple times  
per partition, which is not a problem other than being an inefficiency.  
Improving this requires a more invasive patch, so let's leave that for  
another day.  
  
This also changes things so that we no longer needlessly call  
table_finish_bulk_insert when performing a COPY FROM for a non-partitioned  
table when not using multi-inserts.  
  
Reported-by: Robert Haas  
Backpatch-through: 12  
Discussion: https://postgr.es/m/CA+TgmoYK=6BpxiJ0tN-p9wtH0BTAfbdxzHhwou0mdud4+BkYuQ@mail.gmail.com  

M src/backend/commands/copy.c

Fix few typos and minor wordsmithing in tableam comments.

commit   : bd56cd75d2cee28c4acd1cd76af57664e622d21f    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 10 Jul 2019 07:52:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 10 Jul 2019 07:52:51 +0530    

Click here for diff

Reported-by: Ashwin Agrawal  
Author: Ashwin Agrawal  
Reviewed-by: Amit Kapila  
Backpatch-through: 12, where it was introduced  
Discussion: https://postgr.es/m/CALfoeisgdZhYDrJOukaBzvXfJOK2FQ0szVMK7dzmcy6w93iDUA@mail.gmail.com  

M src/include/access/tableam.h

Pass QueryEnvironment down to EvalPlanQual's EState.

commit   : f5825853e3afdb4df4767d30cbfdd375b45d1f2a    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 10 Jul 2019 10:15:32 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 10 Jul 2019 10:15:32 +1200    

Click here for diff

Otherwise the executor can't see trigger transition tables during  
EPQ evaluation.  Fixes bug #15900 and almost certainly also #15720.  
Back-patch to 10, where trigger transition tables landed.  
  
Author: Alex Aktsipetrov  
Reviewed-by: Thomas Munro, Tom Lane  
Discussion: https://postgr.es/m/15900-bc482754fe8d7415%40postgresql.org  
Discussion: https://postgr.es/m/15720-38c2b29e5d720187%40postgresql.org  

M src/backend/executor/execMain.c

Propagate trigger arguments to partitions

commit   : 2c84ea6cf994f5853de0f03600aa5df8156cf9f4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 9 Jul 2019 17:16:36 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 9 Jul 2019 17:16:36 -0400    

Click here for diff

We were creating the cloned triggers with an empty list of arguments,  
losing the ones that had been specified by the user when creating the  
trigger in the partitioned table.  Repair.  
  
This was forgotten in commit 86f575948c77.  
  
Author: Patrick McHardy  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Message style improvements

commit   : e435c1e7d9d88264453c30f8d1969cb836a60509    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Jul 2019 15:47:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Jul 2019 15:47:09 +0200    

Click here for diff

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/option.c

Force hash joins to be enabled in the hash join regression tests.

commit   : cba0fe024e35839688e3a3d256d1dcdf50baadaf    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 9 Jul 2019 18:11:01 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 9 Jul 2019 18:11:01 +1200    

Click here for diff

Otherwise the regressplans.sh tests generate extremely slow nested  
loop joins.  Back-patch to 11 where the hash join tests came in.  
  
Reported-by: Michael Paquier  
Discussion: https://postgr.es/m/20190708055256.GB2709%40paquier.xyz  

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

doc: adjust to_timestamp()/to_date() wording

commit   : 38c268dde0ae749a93acd750afd1aad9c8f01049    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 8 Jul 2019 23:04:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 8 Jul 2019 23:04:02 -0400    

Click here for diff

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

M doc/src/sgml/func.sgml

Adjust ssl_ciphers to be specific to OpenSSL

commit   : ba0934251823145461b208d55d8c003576bbfd62    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 8 Jul 2019 19:39:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 8 Jul 2019 19:39:48 -0400    

Click here for diff

Syntax is OpenSSL-specific, so only use it for OpenSSL.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Daniel Gustafsson  
  
Backpatch-through: head  

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

Remove unused C structure member

commit   : 481837783bee98795379153e7b60405f21fdb38b    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 8 Jul 2019 19:31:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 8 Jul 2019 19:31:16 -0400    

Click here for diff

Remove quote_all_identifiers from struct _dumpOptions.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Arthur Zakirov  
  
Backpatch-through: head  

M src/bin/pg_dump/pg_backup.h

tableam: Provide helper functions for relation sizing.

commit   : 554106b1163853757b72ce14d7db5050c32bfa6a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 8 Jul 2019 14:51:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 8 Jul 2019 14:51:53 -0400    

Click here for diff

Most block-based table AMs will need the exact same implementation of  
the relation_size callback as the heap, and if they use a standard  
page layout, they will likely need an implementation of the  
relation_estimate_size callback that is very similar to that of the  
heap.  Rearrange to facilitate code reuse.  
  
Patch by me, reviewed by Michael Paquier, Daniel Gustafsson, and  
Álvaro Herrera.  
  
Discussion: http://postgr.es/m/CA+TgmoZ6DBPnP1E-vRpQZUJQijJFD54F+SR_pxGiAAS-MyrigA@mail.gmail.com  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/include/access/tableam.h

doc: Clarify logical replication documentation

commit   : 482501d433b9f218d5a117571f1df9aebefe68bb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Jul 2019 14:28:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Jul 2019 14:28:42 +0200    

Click here for diff

Document that the data types of replicated tables do not need to  
match.  The documentation previously claimed that they had to match.  
  
Author: Robert Treat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAJSLCQ13==D8Ka2YLyctTm0Y+8MhGYcX_zj7fU0rqRzhcV++3w@mail.gmail.com  

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

Fix inconsistencies in the code

commit   : 6b8548964bccd0f2e65c687d591b7345d5146bfa    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Jul 2019 13:15:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Jul 2019 13:15:09 +0900    

Click here for diff

This addresses a couple of issues in the code:  
- Typos and inconsistencies in comments and function declarations.  
- Removal of unreferenced function declarations.  
- Removal of unnecessary compile flags.  
- A cleanup error in regressplans.sh.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M contrib/cube/cube.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/gist.sgml
M src/backend/access/transam/multixact.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/executor/README
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/lib/dshash.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/basebackup.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/misc/tzparser.c
M src/bin/pg_dump/pg_backup_db.c
M src/include/access/heapam.h
M src/include/access/timeline.h
M src/include/executor/executor.h
M src/include/executor/tablefunc.h
M src/include/nodes/execnodes.h
M src/include/partitioning/partprune.h
M src/include/port/atomics/generic-acc.h
M src/interfaces/ecpg/compatlib/exports.txt
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/regressplans.sh
M src/tools/msvc/Mkvcbuild.pm

Use consistent style for checking return from system calls

commit   : 7e9a4c5c3dca0d9637812d8991e96fc8f46800d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 23:18:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 23:18:46 +0200    

Click here for diff

Use  
  
    if (something() != 0)  
        error ...  
  
instead of just  
  
    if (something)  
        error ...  
  
The latter is not incorrect, but it's a bit confusing and not the  
common style.  
  
Discussion: https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/libpq/be-fsstubs.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/utils/cache/relmapper.c
M src/common/controldata_utils.c
M src/interfaces/libpq/fe-lobj.c

Remove more unreferenced function declarations

commit   : d1a040543b49e0aad273e7766cd7e2fcf2b781fa    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 7 Jul 2019 09:58:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 7 Jul 2019 09:58:33 +0900    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDuAYsRb3Q9aobkFZ6DZMWxsyg4HOmgkwgeWNfSkTwGxw@mail.gmail.com  

M src/bin/pg_dump/pg_backup_archiver.h
M src/include/bootstrap/bootstrap.h
M src/include/utils/rel.h
M src/interfaces/libpq/libpq-int.h

In pg_log_generic(), be more paranoid about preserving errno.

commit   : fb30c9c1c5c36989d6b93906986358cb96936d64    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Jul 2019 11:25:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Jul 2019 11:25:37 -0400    

Click here for diff

This code failed to account for the possibility that malloc() would  
change errno, resulting in wrong output for %m, not to mention the  
possibility of message truncation.  Such a change is obviously  
expected when malloc fails, but there's reason to fear that on some  
platforms even a successful malloc call can modify errno.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/logging.c

Add missing source files to nls.mk

commit   : b33283c36409aef7eddb5ba92bdd9300dd45d974    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 15:02:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 15:02:53 +0200    

Click here for diff

M src/interfaces/ecpg/ecpglib/nls.mk
M src/interfaces/libpq/nls.mk

psql: Fix logging output format

commit   : 3f3542621f131379e32e9283d40853cb6d03a97f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 14:58:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 14:58:08 +0200    

Click here for diff

In normal interactive mode, psql's log messages accidentally got a  
"psql:" prefix that was not supposed to be there.  This only happened  
if there was no .psqlrc file being read, so it wasn't discovered for a  
while.  Fix this by adding the appropriate logging format  
configuration call in the right code path.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/psql/startup.c

Add missing assertions for required table am callbacks.

commit   : 78d41f6c9b0e1c4bd28f9b80cd07c7530660312f    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 6 Jul 2019 11:41:23 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 6 Jul 2019 11:41:23 +0530    

Click here for diff

Reported-by: Ashwin Agrawal  
Author: Ashwin Agrawal  
Reviewed-by: Amit Kapila  
Backpatch-through: 12, where it was introduced  
Discussion: https://postgr.es/m/CALfoeisgdZhYDrJOukaBzvXfJOK2FQ0szVMK7dzmcy6w93iDUA@mail.gmail.com  

M src/backend/access/table/tableamapi.c

Add some test cases to improve test coverage of parse_expr.c.

commit   : cf20cc00a99155a8e41a1bb2a1e498624c86db29    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2019 23:56:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2019 23:56:34 -0400    

Click here for diff

I chanced to notice while thumbing through lcov reports that we had  
exactly no coverage of BETWEEN SYMMETRIC, nor of current_time(N) and  
localtime(N).  Improve that.  
  
parse_expr.c still has a pretty awful coverage number, but a large part  
of that is due to lack of coverage of the operator_precedence_warning  
logic.  I have zero desire to write tests for that; I think ripping it  
out would be more sensible at this point.  

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

Remove unreferenced function declarations.

commit   : 79b94716e72086b07549b1c867a8ecdea6bae77e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2019 19:28:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2019 19:28:45 -0400    

Click here for diff

These seem to be leftovers from old patches, perhaps.  
  
Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoDuAYsRb3Q9aobkFZ6DZMWxsyg4HOmgkwgeWNfSkTwGxw@mail.gmail.com  

M src/include/access/transam.h
M src/include/commands/tablecmds.h
M src/include/utils/dsa.h

Remove dead encoding-conversion functions.

commit   : 0ab1a2e39b6f65b0f6a5879605ddbf12f9f50de4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2019 14:17:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2019 14:17:27 -0400    

Click here for diff

The code for conversions SQL_ASCII <-> MULE_INTERNAL and  
SQL_ASCII <-> UTF8 was unreachable, because we long ago changed  
the wrapper functions pg_do_encoding_conversion() et al so that  
they have hard-wired behaviors for conversions involving SQL_ASCII.  
(At least some of those fast paths date back to 2002, though it  
looks like we may not have been totally consistent about this until  
later.)  Given the lack of complaints, nobody is dissatisfied with  
this state of affairs.  Hence, let's just remove the unreachable code.  
  
Also, change CREATE CONVERSION so that it rejects attempts to  
define such conversions.  Since we consider that SQL_ASCII represents  
lack of knowledge about the encoding in use, such a conversion would  
be semantically dubious even if it were reachable.  
  
Adjust a couple of regression test cases that had randomly decided  
to rely on these conversion functions rather than any other ones.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/create_conversion.sgml
M src/backend/commands/conversioncmds.c
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
D src/backend/utils/mb/conversion_procs/ascii_and_mic/Makefile
D src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
D src/backend/utils/mb/conversion_procs/utf8_and_ascii/Makefile
D src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_proc.dat
M src/include/mb/pg_wchar.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/object_address.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/object_address.sql

Remove unused variable in statext_mcv_serialize()

commit   : ef777cb093e8cb45dd3ae9d3f1499c765147c1dd    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Jul 2019 18:06:02 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Jul 2019 18:06:02 +0200    

Click here for diff

The itemlen variable used to be referenced in multiple places, but since  
reworking the serialization code it's used only in one assert. Fixed by  
removing the variable and calling the macro from the assert directly.  
  
Backpatch to 12, where this code was introduced.  
  
Reported-by: Jeff Janes  
Discussion: https://postgr.es/m/CAMkU=1zc_ovH9NZd_9ovuiEWkF9yX06URUDdXCmgDydf-bqB5A@mail.gmail.com  

M src/backend/statistics/mcv.c

Add \warn command to psql.

commit   : 02e95a5049f7933cbde1dacf401604ea3fc02aa5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2019 12:32:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2019 12:32:36 -0400    

Click here for diff

This is like \echo except that the text is sent to stderr not stdout.  
  
In passing, fix a pre-existing bug in \echo and \qecho: per documentation  
the -n switch should only be recognized when it is the first argument,  
but actually any argument matching "-n" was treated as a switch.  
(Should we back-patch that?)  
  
David Fetter (bug fix by me), reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve comment in postgresql.conf.sample.

commit   : e8fdcacc6cbeed7d1a2175c5eddf0b162e0cb7c4    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Jul 2019 20:59:29 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Jul 2019 20:59:29 +1200    

Click here for diff

The Unix manual section that "man tcp" appears in varies, so let's  
just leave it out of the command to run.  

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

doc: Spell checking

commit   : 594df378ffb04a72b713a13cc0a7166b3bced7b7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Jul 2019 08:33:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Jul 2019 08:33:51 +0200    

Click here for diff

M doc/src/sgml/btree.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/xfunc.sgml

Add min() and max() aggregates for pg_lsn

commit   : 313f87a17155a6dbd27a3ce687cf59bd171fe75e    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Jul 2019 12:21:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Jul 2019 12:21:11 +0900    

Click here for diff

This is useful for monitoring, when it comes for example to calculations  
of WAL retention with replication slots and delays with a set of  
standbys.  
  
Bump catalog version.  
  
Author: Fabrízio de Royes Mello  
Reviewed-by: Surafel Temesgen  
Discussion: https://postgr.es/m/CAFcNs+oc8ZoHhowA4rR1GGCgG8QNgK_TOwPRVYQo5rYy8_PXzA@mail.gmail.com  

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

Update hardcoded DH parameters to IANA standards

commit   : 8a810a177c80909b71e9fb3760a1d56ed988638a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Jul 2019 10:47:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Jul 2019 10:47:32 +0900    

Click here for diff

The source defining the current fallback and hardcoded DH parameters  
has disappeared from the web a long time ago, and RFC 3526 defines the  
most current Diffie-Hellman MODP groups, so update to those new values.  
  
Author: Daniel Gustafsson  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/include/libpq/libpq-be.h

Simplify pg_mcv_list (de)serialization

commit   : 08aa131c7a72195113ab3a7b191fe8014dd3a898    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Jul 2019 00:45:20 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Jul 2019 00:45:20 +0200    

Click here for diff

The serialization format of multivariate MCV lists included alignment in  
order to allow direct access to part of the serialized data, but despite  
multiple fixes (see for example commits d85e0f366a and ea4e1c0e8f) this  
proved to be problematic.  
  
This commit abandons alignment in the serialized format, and just copies  
everything during deserialization.  We now also track amount of memory  
needed after deserialization (including alignment), which allows us to  
deserialize the MCV list in a single pass.  
  
Bump catversion, as this affects contents of pg_statistic_ext_data.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Author: Tomas Vondra  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/mcv.c
M src/include/catalog/catversion.h
M src/include/statistics/extended_stats_internal.h

Fix pg_mcv_list_items() to produce text[]

commit   : 4d66285adc6bb4f9e4fd394d478d663cbccb5fc8    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 4 Jul 2019 23:43:04 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 4 Jul 2019 23:43:04 +0200    

Click here for diff

The function pg_mcv_list_items() returns values stored in MCV items. The  
items may contain columns with different data types, so the function was  
generating text array-like representation, but in an ad-hoc way without  
properly escaping various characters etc.  
  
Fixed by simply building a text[] array, which also makes it easier to  
use from queries etc.  
  
Requires changes to pg_proc entry, so bump catversion.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Author: Tomas Vondra  
Reviewed-by: Dean Rasheed  
Discussion: https://postgr.es/m/20190618205920.qtlzcu73whfpfqne@development  

M src/backend/statistics/mcv.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats_ext.out

Speed-up build of MCV lists with many distinct values

commit   : e365a581c246a8e18f38cc530013391329dcdb02    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 4 Jul 2019 23:02:02 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 4 Jul 2019 23:02:02 +0200    

Click here for diff

When building multi-column MCV lists, we compute base frequency for each  
item, i.e. a product of per-column frequencies for values from the item.  
As a value may be in multiple groups, the code was scanning the whole  
array of groups while adding items to the MCV list.  This works fine as  
long as the number of distinct groups is small, but it's easy to trigger  
trigger O(N^2) behavior, especially after increasing statistics target.  
  
This commit precomputes frequencies for values in all columns, so that  
when computing the base frequency it's enough to make a simple bsearch  
lookup in the array.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Discussion: https://postgr.es/m/20190618205920.qtlzcu73whfpfqne@development  

M src/backend/statistics/mcv.c

Remove unnecessary casts from size_t to int

commit   : d5ab9df7774b4570ff50e64b7fa3ba8295596d06    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Jun 2019 14:32:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Jun 2019 14:32:54 +0200    

Click here for diff

We can use the %zu format specifier directly, no need to cast to int.  

M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.trailer

Unwind some workarounds for lack of portable int64 format specifier

commit   : 6a1cd8b9236dcfa91b40af3a8337859e16ba7113    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Jun 2019 14:14:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Jun 2019 14:14:29 +0200    

Click here for diff

Because there is no portable int64/uint64 format specifier and we  
can't stick macros like INT64_FORMAT into the middle of a translatable  
string, we have been using various workarounds that put the number to  
be printed into a string buffer first.  Now that we always use our own  
sprintf(), we can rely on %lld and %llu to work, so we can use those.  
  
This patch undoes this workaround in a few places where it was  
egregiously verbose.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAH2-Wz%3DWbNxc5ob5NJ9yqo2RMJ0q4HXDS30GVCobeCvC9A1L9A%40mail.gmail.com  

M src/backend/access/transam/xlogreader.c
M src/backend/replication/basebackup.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_test_timing/pg_test_timing.c

Sync our Snowball stemmer dictionaries with current upstream

commit   : 7b925e12703652fef63a2fbbb28d3407b2971d6e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jul 2019 13:10:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jul 2019 13:10:41 +0200    

Click here for diff

The main change is a new stemmer for Greek.  There are minor changes  
in the Danish and French stemmers.  
  
Author: Panagiotis Mavrogiorgos <[email protected]>  

M doc/src/sgml/textsearch.sgml
M src/backend/snowball/Makefile
M src/backend/snowball/README
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c
M src/backend/snowball/libstemmer/stem_UTF_8_danish.c
M src/backend/snowball/libstemmer/stem_UTF_8_french.c
A src/backend/snowball/libstemmer/stem_UTF_8_greek.c
M src/backend/snowball/libstemmer/utilities.c
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/snowball/libstemmer/api.h
A src/include/snowball/libstemmer/stem_UTF_8_greek.h

Clean up whitespace a bit

commit   : dedb6e0143554e76d4d11376d65c0aa68f8412d4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jul 2019 12:31:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Jul 2019 12:31:08 +0200    

Click here for diff

M src/backend/snowball/Makefile

Introduce safer encoding and decoding routines for base64.c

commit   : cfc40d384ae51ea2886d599d2008ae57b529e6ea    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Jul 2019 16:08:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Jul 2019 16:08:09 +0900    

Click here for diff

This is a follow-up refactoring after 09ec55b and b674211, which has  
proved that the encoding and decoding routines used by SCRAM have a  
poor interface when it comes to check after buffer overflows.  This adds  
an extra argument in the shape of the length of the result buffer for  
each routine, which is used for overflow checks when encoding or  
decoding an input string.  The original idea comes from Tom Lane.  
  
As a result of that, the encoding routine can now fail, so all its  
callers are adjusted to generate proper error messages in case of  
problems.  
  
On failure, the result buffer gets zeroed.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth-scram.c
M src/common/base64.c
M src/common/scram-common.c
M src/include/common/base64.h
M src/interfaces/libpq/fe-auth-scram.c

Simplify TAP tests of pg_dump for connection strings

commit   : d5ab9a891cb590aad4278026b2edda685f2524a2    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Jul 2019 11:33:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Jul 2019 11:33:42 +0900    

Click here for diff

The last set of scenarios did an initialization of nodes followed by an  
extra command to set up the authentication policy with pg_regress  
--config-auth.  This configuration step can be integrated directly using  
the option auth_extra from PostgresNode::init when initializing the  
node, saving from one extra command.  On Windows, this also restricts  
more pg_ident.conf for the SSPI user mapping by removing the entry of  
the OS user running the test, which is not needed anyway.  
  
Note that IPC::Run mishandles double quotes, hence the restore user name  
is changed to map with that.  This was already done in the test as a  
later step, but not in a consistent way, causing the switch to use  
auth_extra to fail.  
  
Found while reviewing ca129e5.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/t/010_dump_connstr.pl

Use appendStringInfoString and appendPQExpBufferStr where possible

commit   : 8abc13a88938ef473b8a486186f1b96630450728    
  
author   : David Rowley <[email protected]>    
date     : Thu, 4 Jul 2019 13:01:13 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 4 Jul 2019 13:01:13 +1200    

Click here for diff

This changes various places where appendPQExpBuffer was used in places  
where it was possible to use appendPQExpBufferStr, and likewise for  
appendStringInfo and appendStringInfoString.  This is really just a  
stylistic improvement, but there are also small performance gains to be  
had from doing this.  
  
Discussion: http://postgr.es/m/CAKJS1f9P=M-3ULmPvr8iCno8yvfDViHibJjpriHU8+SXUgeZ=w@mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M contrib/sepgsql/selinux.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/commands/explain.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/dump.c
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/string_utils.c
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-protocol3.c

Ensure plpgsql result tuples have the right composite type marking.

commit   : 5683b34956b4e8da9dccadc2e3a53b86104ebb33    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jul 2019 18:08:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jul 2019 18:08:53 -0400    

Click here for diff

A function that is declared to return a named composite type must  
return tuple datums that are physically marked as having that type.  
The plpgsql code path that allowed directly returning an expanded-record  
datum forgot to check that, so that an expanded record marked as type  
RECORDOID could be returned if it had a physically-compatible tupdesc.  
This'd be harmless, I think, if the record value never escaped the  
current session --- but it's possible for it to get stored into a table,  
and then subsequent sessions can't interpret the anonymous record type.  
  
Fix by flattening the record into a tuple datum and overwriting its  
type/typmod fields, if its declared type doesn't match the function's  
declared type.  (In principle it might be possible to just change the  
expanded record's stored type ID info, but there are enough tricky  
consequences that I didn't want to mess with that, especially not in  
a back-patched bug fix.)  
  
Per bug report from Steve Rogerson.  Back-patch to v11 where the bug  
was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_record.sql

Doc: document table persistence display in \dt+.

commit   : 03e7b302b1d5a67758e756b1f64686c29d37558f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jul 2019 12:18:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jul 2019 12:18:10 -0400    

Click here for diff

Forgotten in commit 9a2ea6183.  

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

commit   : 9a2ea618323a4cf8ca7eb6a828b08c6e39b95cdd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jul 2019 11:46:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jul 2019 11:46:34 -0400    

Click here for diff

In verbose mode, listTables() now emits a "Persistence" column  
showing whether the table/index/view/etc is permanent, temporary,  
or unlogged.  
  
David Fetter, reviewed by Fabien Coelho and Rafia Sabih  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Don't remove surplus columns from GROUP BY for inheritance parents

commit   : a5be4062f7bf2ae9487c5a31ee337a56425cdc84    
  
author   : David Rowley <[email protected]>    
date     : Wed, 3 Jul 2019 23:44:54 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 3 Jul 2019 23:44:54 +1200    

Click here for diff

d4c3a156c added code to remove columns that were not part of a table's  
PRIMARY KEY constraint from the GROUP BY clause when all the primary key  
columns were present in the group by.  This is fine to do since we know  
that there will only be one row per group coming from this relation.  
However, the logic failed to consider inheritance parent relations.  These  
can have child relations without a primary key, but even if they did, they  
could duplicate one of the parent's rows or one from another child  
relation.  In this case, those additional GROUP BY columns are required.  
  
Fix this by disabling the optimization for inheritance parent tables.  
In v11 and beyond, partitioned tables are fine since partitions cannot  
overlap and before v11 partitioned tables could not have a primary key.  
  
Reported-by: Manuel Rigger  
Discussion: http://postgr.es/m/CA+u7OA7VLKf_vEr6kLF3MnWSA9LToJYncgpNX2tQ-oWzYCBQAw@mail.gmail.com  
Backpatch-through: 9.6  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

postgres_fdw: Remove redundancy in postgresAcquireSampleRowsFunc().

commit   : 2a1612104cadbfdc739ff0370f279779f323c3b5    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 3 Jul 2019 17:51:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 3 Jul 2019 17:51:00 +0900    

Click here for diff

Previously, in the loop in postgresAcquireSampleRowsFunc() to iterate  
fetching rows from a given remote table, we redundantly 1) determined the  
fetch size by parsing the table's server/table-level options and then 2)  
constructed the fetch command; remove that redundancy.  
  
Author: Etsuro Fujita  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/CAPmGK17_urk9qkLV65_iYMFw64z5qhdfhY=tMVV6Jg4KNYx8+w@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c

Fix small memory leak in ecpglib ecpg_update_declare_statement() is called the second time.

commit   : e72489e101b21c328e3d10ca64e5367c60f424a5    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 2 Jul 2019 03:51:13 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 2 Jul 2019 03:51:13 +0200    

Click here for diff

Author: "Zhang, Jie" <[email protected]>  

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

Use strtoint() instead of strtol() in pgtypeslib where the result is stored in an int variable.

commit   : 8372e3c98fbbd529e4545c4d7982e278e118958e    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 2 Jul 2019 03:42:09 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 2 Jul 2019 03:42:09 +0200    

Click here for diff

Author: Yang Xiao <[email protected]>  

M src/interfaces/ecpg/pgtypeslib/dt_common.c

Made ecpg compatibility mode and run-time behaviour options case insensitive.

commit   : 75220fb62b1387b61f92c42b1bd147cb30607012    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 2 Jul 2019 03:34:58 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 2 Jul 2019 03:34:58 +0200    

Click here for diff

M src/interfaces/ecpg/preproc/ecpg.c

Fix accidentally swapped error message arguments

commit   : 84c41ae81bdf15cac71cc5ae0af69b4815594522    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2019 23:44:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2019 23:44:30 +0100    

Click here for diff

Author: Alexey Kondratov <[email protected]>  

M src/bin/initdb/initdb.c

Remove redundant newlines from error messages

commit   : 24c7000f64487323fedb52b8aeadf2c84274dcf5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2019 23:18:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2019 23:18:43 +0100    

Click here for diff

These are no longer needed/allowed with the new logging API.  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/pg_rewind.c

Don't treat complete_from_const as equivalent to complete_from_list.

commit   : b4771d7c7f37d19e2879b18e288f681849d55806    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 14:04:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 14:04:42 -0400    

Click here for diff

Commit 4f3b38fe2 supposed that complete_from_const() is equivalent to  
the one-element-list case of complete_from_list(), but that's not  
really true at all.  complete_from_const() supposes that the completion  
is certain enough to justify wiping out whatever the user typed, while  
complete_from_list() will only provide completions that match the  
word-so-far.  
  
In practice, given the lame parsing technology used by tab-complete.c,  
it's fairly hard to believe that we're *ever* certain enough about  
a completion to justify auto-correcting user input that doesn't match.  
  
Hence, remove the inappropriate unification of the two cases.  
As things now stand, complete_from_const() is used only for the  
situation where we have no matches and we need to keep readline  
from applying its default complete-with-file-names behavior.  
  
This (mis?) behavior actually exists much further back, but  
I'm hesitant to change it in released branches.  It's not too  
late for v12, though, especially seeing that the aforesaid  
commit is new in v12.  
  
Per gripe from Ken Tanzer.  
  
Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com  

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

Fix tab completion of "SET variable TO|=" to not offer bogus completions.

commit   : 0ec3e13c69779117c8cfa39adcc6863631dedd44    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 13:35:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 13:35:14 -0400    

Click here for diff

Don't think that the context "UPDATE tab SET var =" is a GUC-setting  
command.  
  
If we have "SET var =" but the "var" is not a known GUC variable,  
don't offer any completions.  The most likely explanation is that  
we've misparsed the context and it's not really a GUC-setting command.  
  
Per gripe from Ken Tanzer.  Back-patch to 9.6.  The issue exists  
further back, but before 9.6 the code looks very different and it  
doesn't actually know whether the "var" name matches anything,  
so I desisted from trying to fix it.  
  
Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com  

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

Simplify psql \d's rule for ordering the indexes of a table.

commit   : 4d6603f28dfc4a1cab0d7d317855d935e314297a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 12:32:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 12:32:49 -0400    

Click here for diff

The previous rule was "primary key (if any) first, then other unique  
indexes in name order, then all other indexes in name order".  
But the preference for unique indexes seems a bit obsolete since the  
introduction of exclusion constraints.   It's no longer the case  
that unique indexes are the only ones that constrain what data can  
be in the table, and it's hard to see what other rationale there is  
for separating out unique indexes.  Other new features like the  
possibility for some indexes to be INVALID (hence, not constraining  
anything) make this even shakier.  
  
Hence, simplify the sort order to be "primary key (if any) first,  
then all other indexes in name order".  
  
No documentation change, since this was never documented anyway.  
A couple of existing regression test cases change output, though.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/replica_identity.out

Remove obsolete nbtree "get root" comment.

commit   : 66c5bd3a6fd8a4c317412838ab3870ab251833b6    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 1 Jul 2019 22:28:08 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 1 Jul 2019 22:28:08 -0700    

Click here for diff

Remove a very old Berkeley era comment that doesn't seem to have  
anything to do with the current locking considerations within  
_bt_getroot().  
  
Discussion: https://postgr.es/m/CAH2-WzmA2H+rL-xxF5o6QhMD+9x6cJTnz2Mr3Li_pbPBmqoTBQ@mail.gmail.com  

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

Add support for Visual Studio 2019 in build scripts

commit   : 2b1394fc2b52a2573d08aa626e7b49568f27464e    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Jul 2019 14:02:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Jul 2019 14:02:33 +0900    

Click here for diff

This fixes at the same time a set of inconsistencies in the  
documentation and the scripts related to the versions of Windows SDK  
supported.  
  
Author: Haribabu Kommi  
Reviewed-by: Andrew Dunstan, Juan José Santamaría Flecha, Michael  
Paquier  
Discussion: https://postgr.es/m/CAJrrPGcfqXhfPyMrny9apoDU7M1t59dzVAvoJ9AeAh5BJi+UzA@mail.gmail.com  

M doc/src/sgml/install-windows.sgml
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/README
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm

Refactor code of reindexdb for query generation

commit   : 9adda24543e354317abf5400d7e7d3961a93bce6    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Jul 2019 11:36:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Jul 2019 11:36:53 +0900    

Click here for diff

This merges the portion related to REINDEX SYSTEM into the routine  
already available for all the other reindex types, making the query  
generation cleaner.  While on it, change the handling of the reindex  
types using an enum, which allows to get rid of the hardcoded strings  
used directly in the query generation present for the same purpose (aka  
"TABLE", "DATABASE", etc.).  
  
Per discussion with Julien Rouhaud, Tom Lane, Alvaro Herrera and me.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/CAOBaU_bSmSik_WRK9niDnm-3NkNZky6+uKxkmQwvthZvMWpS5A@mail.gmail.com  

M src/bin/scripts/reindexdb.c
M src/tools/pgindent/typedefs.list

Remove support for non-ELF BSD systems

commit   : c72f9b9502eadb6b84c6681cdb3bff12b35d3c8a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2019 23:46:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2019 23:46:24 +0100    

Click here for diff

This is long obsolete.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M configure
M configure.in
M src/Makefile.global.in
M src/Makefile.shlib
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd

Stamp HEAD as 13devel.

commit   : 615cebc94b5ef8fbe353e3c8b838b1e97bcdfd49    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2019 12:50:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2019 12:50:55 -0400    

Click here for diff

Let the hacking begin ...  

M configure
M configure.in
M doc/src/sgml/filelist.sgml
D doc/src/sgml/release-12.sgml
A doc/src/sgml/release-13.sgml
M doc/src/sgml/release.sgml
M src/include/pg_config.h.win32
M src/interfaces/libpq/libpq.rc.in
M src/port/win32ver.rc
M src/tools/git_changelog
M src/tools/version_stamp.pl