PostgreSQL 13.0 (upcoming) commit log

doc: Update the layout of "Viewing Statistics" section.

commit   : 92f9468657f0916ce8589e13d5ebda60c7973c31    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 29 May 2020 17:14:33 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/6f8a482c-b3fa-4ed9-21c3-6d222a2cb87d@oss.nttdata.com  

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 <andres@anarazel.de>    
date     : Thu, 28 May 2020 15:08:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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 <sbjesse@gmail.com>  
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 <mail@joeconway.com>    
date     : Thu, 28 May 2020 13:44:54 -0400    
  
committer: Joe Conway <mail@joeconway.com>    
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 <mail@joeconway.com>    
date     : Thu, 28 May 2020 13:16:47 -0400    
  
committer: Joe Conway <mail@joeconway.com>    
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 <heikki.linnakangas@iki.fi>    
date     : Thu, 28 May 2020 12:37:00 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
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 <heikki.linnakangas@iki.fi>    
date     : Thu, 28 May 2020 12:35:18 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
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 <michael@paquier.xyz>    
date     : Thu, 28 May 2020 16:40:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200525234944.GA1573@paquier.xyz  

M src/include/access/xlogreader.h

Fix some mentions to memory units in postgresql.conf.sample

commit   : 55ca50deb8ffaec3b81d83c9f54c94f7e519f3a6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 28 May 2020 15:39:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <peter@eisentraut.org>    
date     : Wed, 27 May 2020 16:07:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <jdavis@postgresql.org>    
date     : Tue, 26 May 2020 16:06:30 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Tue, 26 May 2020 15:58:39 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <peter@eisentraut.org>    
date     : Tue, 26 May 2020 14:09:36 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <bruce@momjian.us>    
date     : Mon, 25 May 2020 21:53:53 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 25 May 2020 21:53:53 -0400    

Click here for diff

Reported-by: Daniel Gustafsson  
  
Discussion: https://postgr.es/m/54F7560D-498A-4E51-BAA4-17D4AAB2AA57@yesql.se  
  
Backpatch-through: master  

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

gss: add missing references to hostgssenc and hostnogssenc

commit   : ac5852fb3042a4562e8a8bab26aaa00fa8183068    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 25 May 2020 20:19:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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/20200421182736.GG19613@momjian.us  
  
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 <noah@leadboat.com>    
date     : Mon, 25 May 2020 16:23:48 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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 <noah@leadboat.com>    
date     : Mon, 25 May 2020 16:21:04 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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 <michael@paquier.xyz>    
date     : Mon, 25 May 2020 15:18:11 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/de7279d4-7ea0-037f-d7d2-1161682339db@2ndquadrant.com  

M doc/src/sgml/catalogs.sgml

Add missing invocations to object access hooks

commit   : a995b371ae29de2d38c4b7881cf414b1560e9746    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 23 May 2020 14:03:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/435CD295-F409-44E0-91EC-DF32C7AFCD76@enterprisedb.com  

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 <alvherre@alvh.no-ip.org>    
date     : Fri, 22 May 2020 17:39:16 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <fujii@postgresql.org>    
date     : Fri, 22 May 2020 23:33:58 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Fri, 22 May 2020 10:36:49 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <efujita@postgresql.org>    
date     : Fri, 22 May 2020 15:45:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
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 <bruce@momjian.us>    
date     : Thu, 21 May 2020 22:07:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Thu, 21 May 2020 20:34:37 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Thu, 21 May 2020 20:28:38 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Thu, 21 May 2020 19:49:30 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 21 May 2020 19:49:30 -0400    

Click here for diff

Discussion: https://postgr.es/m/2304.1586532634@sss.pgh.pa.us  
  
Backpatch-through: 9.5  

M doc/src/sgml/indices.sgml

Doc: Describe CREATE INDEX deduplication strategy.

commit   : 449e14a5618432f01066c33055229b96666bd925    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 21 May 2020 13:36:45 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <noah@leadboat.com>    
date     : Thu, 21 May 2020 08:31:16 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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 <michael@paquier.xyz>    
date     : Thu, 21 May 2020 15:49:20 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/935443BA-D42E-4CE0-B181-1AD79E6DD45A@yesql.se  

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

Fix MSVC installations with multiple "configure" files detected

commit   : d2a9959907a03682f4fe182086f9936aca6b2a4f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 21 May 2020 14:41:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/16343-f638f67e7e52b86c@postgresql.org  
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 <alvherre@alvh.no-ip.org>    
date     : Wed, 20 May 2020 14:35:39 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/642e9fbc-b832-698b-9a8f-d626afd7014d@postgrespro.ru  

M doc/src/sgml/ddl.sgml

Doc: Fix description of pg_class.relreplident

commit   : 39cb2ee09cf900454c1bf14f56048b40c840a490    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 20 May 2020 14:20:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/ad1a0badc32658b1bbb07aa312346a1d@postgrespro.ru  
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 <michael@paquier.xyz>    
date     : Wed, 20 May 2020 09:12:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/c049ffcf-d2fe-90f7-c8ba-0741035aa6a7@oss.nttdata.com  

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

part_strategy does not need its very own keyword classification.

commit   : c7d65a252cdb7219deb48899fa643c5fd2cc3877    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 May 2020 20:09:59 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <pg@bowt.ie>    
date     : Tue, 19 May 2020 15:04:34 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <alvherre@alvh.no-ip.org>    
date     : Mon, 18 May 2020 19:28:46 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/6aa690ef-551d-e24f-2690-c38c2442947c@postgresfriends.org  

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 <tgl@sss.pgh.pa.us>    
date     : Mon, 18 May 2020 16:09:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 18 May 2020 13:21:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/2CA1BA9F-CDF9-41BE-96A1-2EFD2A3EA6CA@yesql.se  

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 <bruce@momjian.us>    
date     : Mon, 18 May 2020 10:20:09 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 18 May 2020 10:20:09 -0400    

Click here for diff

Reported-by: Daniel Gustafsson  
  
Discussion: https://postgr.es/m/0A9D816E-F49C-470B-A23F-8B4AF999382B@yesql.se  

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

Translation updates

commit   : ac449d88016080663dbc1cd48004b5a481c034ce    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 18 May 2020 12:49:30 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <magnus@hagander.net>    
date     : Mon, 18 May 2020 11:55:11 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
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 <akapila@postgresql.org>    
date     : Mon, 18 May 2020 07:53:26 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <akorotkov@postgresql.org>    
date     : Sun, 17 May 2020 13:02:16 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <akorotkov@postgresql.org>    
date     : Sun, 17 May 2020 12:53:34 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <akorotkov@postgresql.org>    
date     : Sun, 17 May 2020 12:41:19 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <alvherre@alvh.no-ip.org>    
date     : Sat, 16 May 2020 22:19:02 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 16 May 2020 22:19:02 -0400    

Click here for diff

Author: Erik Rijkers <er@xs4all.nl>  
Discussion: https://postgr.es/m/508f2fb1764c3bd518ee96a4f2247d6f@xs4all.nl  

M doc/src/sgml/glossary.sgml

Mop-up for wait event naming issues.

commit   : 3048898e73c75f54bb259323382e0e7f6368cb6f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 16 May 2020 21:00:05 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/4505.1589640417@sss.pgh.pa.us  

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 <michael@paquier.xyz>    
date     : Sun, 17 May 2020 09:22:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200515090817.GA212736@paquier.xyz  

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 <tgl@sss.pgh.pa.us>    
date     : Sat, 16 May 2020 19:44:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <andrew@dunslane.net>    
date     : Sat, 16 May 2020 16:20:43 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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/981DE552-E399-45C2-9F60-3F0E3770CC61@yesql.se  

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 <alvherre@alvh.no-ip.org>    
date     : Sat, 16 May 2020 15:10:36 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Sat, 16 May 2020 11:54:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200114221814.GA19630@alvherre.pgsql  

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 <tgl@sss.pgh.pa.us>    
date     : Sat, 16 May 2020 11:49:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200114221814.GA19630@alvherre.pgsql  

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 <michael@paquier.xyz>    
date     : Sat, 16 May 2020 18:15:18 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 15 May 2020 21:47:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/24595.1589326879@sss.pgh.pa.us  

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 <alvherre@alvh.no-ip.org>    
date     : Fri, 15 May 2020 19:59:29 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <bossartn@amazon.com>  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/C04FC24E-903D-4423-B312-6910E4D846E5@amazon.com  

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 <tgl@sss.pgh.pa.us>    
date     : Fri, 15 May 2020 19:55:56 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/28683.1589405363@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Fri, 15 May 2020 19:05:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 15 May 2020 18:11:03 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/28683.1589405363@sss.pgh.pa.us  

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 <alvherre@alvh.no-ip.org>    
date     : Fri, 15 May 2020 18:05:34 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <alvherre@alvh.no-ip.org>    
date     : Fri, 15 May 2020 16:50:34 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <masahiko.sawada@2ndquadrant.com>  
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 15 May 2020 14:28:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/28683.1589405363@sss.pgh.pa.us  

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 <alvherre@alvh.no-ip.org>    
date     : Fri, 15 May 2020 13:24:22 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <juergen@purtz.de>  
Co-authored-by: Erik Rijkers <er@xs4all.nl>  
Co-authored-by: Laurenz Albe <laurenz.albe@cybertec.at>  
Discussion: https://postgr.es/m/7b9b469e804777ac9df4d37716db935e@xs4all.nl  

M doc/src/sgml/glossary.sgml

doc: PG 13 rels: use xref labels referencing ref/*.sgml files

commit   : 6755b618997424b9e651126f59bf4109d680fffe    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 15 May 2020 12:47:07 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Fri, 15 May 2020 12:38:40 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Fri, 15 May 2020 12:05:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Fri, 15 May 2020 11:21:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Fri, 15 May 2020 10:57:14 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Fri, 15 May 2020 10:40:09 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Fri, 15 May 2020 09:55:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Fri, 15 May 2020 08:52:24 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Fri, 15 May 2020 08:29:57 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <akapila@postgresql.org>    
date     : Fri, 15 May 2020 08:10:00 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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/7bcfc39d4176faf85ab317d0c26786953646a411.camel@cybertec.at  

M src/backend/commands/copy.c

commit   : 39e7bcbbff82e25441529349134bf41fc336169b    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 14 May 2020 22:36:21 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <michael@paquier.xyz>    
date     : Fri, 15 May 2020 08:19:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 14 May 2020 18:44:18 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/6916.1589146280@sss.pgh.pa.us  

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

Doc: tweak examples to silence line-too-long PDF build warnings.

commit   : 3d14c174cbbb6f83d8ac63fa7d0e1f42e0ae8d30    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 14 May 2020 18:13:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/6916.1589146280@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Thu, 14 May 2020 13:06:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <bruce@momjian.us>    
date     : Thu, 14 May 2020 11:51:09 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 14 May 2020 11:10:31 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/9056.1589419765@sss.pgh.pa.us  

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 <michael@paquier.xyz>    
date     : Thu, 14 May 2020 20:14:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/401F9024-20EA-4239-83C4-6B7AD35F94BD@yesql.se  

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 <heikki.linnakangas@iki.fi>    
date     : Thu, 14 May 2020 13:53:16 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
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/22108CF6-228B-45CF-9CDA-5C5F658DCC22@yesql.se  

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 <akorotkov@postgresql.org>    
date     : Thu, 14 May 2020 12:44:44 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <heikki.linnakangas@iki.fi>    
date     : Thu, 14 May 2020 08:39:26 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
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 <akapila@postgresql.org>    
date     : Thu, 14 May 2020 09:23:56 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <noah@leadboat.com>    
date     : Wed, 13 May 2020 20:42:09 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20200502221647.GA3941274@rfd.leadboat.com  

M src/bin/pg_basebackup/pg_recvlogical.c

In successful pg_recvlogical, end PGRES_COPY_OUT cleanly.

commit   : 8222a9d9a12356349114ec275b01a1a58da2b941    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Wed, 13 May 2020 20:42:09 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2020 23:36:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/6916.1589146280@sss.pgh.pa.us  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/monitoring.sgml

Doc: reformat catalog/view description tables.

commit   : a042750646db7ea28ff722855cf163401761937f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2020 23:03:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/12984.1588643549@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2020 22:48:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/8367.1589391884@sss.pgh.pa.us  

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 <bruce@momjian.us>    
date     : Wed, 13 May 2020 22:48:11 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <alvherre@alvh.no-ip.org>    
date     : Wed, 13 May 2020 15:31:14 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/31166.1589378554@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2020 13:08:12 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/3618.1589313035@sss.pgh.pa.us  

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 <alvherre@alvh.no-ip.org>    
date     : Wed, 13 May 2020 12:17:08 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/20200511203336.GA9913@alvherre.pgsql  

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 <fujii@postgresql.org>    
date     : Wed, 13 May 2020 22:20:37 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/b8784fe6-1401-ab35-aa14-d57b5bb8e312@oss.nttdata.com  

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

Initialize SLRU stats entries to zero.

commit   : f3d23d83ef9a33344391acbaa92a6235a4350791    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 13 May 2020 22:19:25 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/976bbb73-a112-de3c-c488-b34b64609793@oss.nttdata.com  

M src/backend/postmaster/pgstat.c

docs: PG 13 relnotes: adjust wal_skip_threshold and UTF8 items

commit   : ac3a4866c0bf1d7a14009f18d3b42ffcb063a7e9    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 12 May 2020 17:17:12 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <alvherre@alvh.no-ip.org>    
date     : Tue, 12 May 2020 16:15:55 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <alvherre@alvh.no-ip.org>    
date     : Tue, 12 May 2020 16:01:52 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <rjuju123@gmail.com>  
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/20200412081825.qyo5vwwco3fv4gdo@nol  
Discussion: https://postgr.es/m/flat/E1fDenm-0000C8-IJ@gemulon.postgresql.org  

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 <tomas.vondra@postgresql.org>    
date     : Tue, 12 May 2020 20:04:39 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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/20200419023625.GP26953@telsasoft.com  

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 <tomas.vondra@postgresql.org>    
date     : Tue, 12 May 2020 19:37:13 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 12 May 2020 19:37:13 +0200    

Click here for diff

Author: Justin Pryzby, James Coleman  
Discussion: https://postgr.es/m/20200419023625.GP26953@telsasoft.com  

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 <tgl@sss.pgh.pa.us>    
date     : Tue, 12 May 2020 13:03:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <efujita@postgresql.org>    
date     : Tue, 12 May 2020 19:55:55 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Tue, 12 May 2020 14:43:57 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200511.101619.2043820539323292957.horikyota.ntt@gmail.com  

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

Correct standbycheck regression test output.

commit   : 81ec990a23b9cbfaa5684e90091164f1d85f24d3    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 12 May 2020 13:56:19 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <bruce@momjian.us>    
date     : Mon, 11 May 2020 22:58:47 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2020 20:41:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/6916.1589146280@sss.pgh.pa.us  

M doc/src/sgml/mvcc.sgml

doc: PG 13 relnotes: add duplicate btree optimization details

commit   : aa976d3b9004bd2c275e4ad17fa897ce5fe5127e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 11 May 2020 21:24:08 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Mon, 11 May 2020 21:19:57 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2020 20:03:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/6916.1589146280@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2020 14:15:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/14480.1589154358@sss.pgh.pa.us  

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 <pg@bowt.ie>    
date     : Mon, 11 May 2020 11:01:07 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <alvherre@alvh.no-ip.org>    
date     : Mon, 11 May 2020 12:46:41 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <ah@cybertec.at>  
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 <peter@eisentraut.org>    
date     : Mon, 11 May 2020 13:14:32 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Sun, 10 May 2020 16:20:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <michael@paquier.xyz>    
date     : Sun, 10 May 2020 10:58:54 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <tgl@sss.pgh.pa.us>    
date     : Sat, 9 May 2020 19:09:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Sat, 9 May 2020 16:28:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tomas.vondra@postgresql.org>    
date     : Sat, 9 May 2020 19:41:42 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tomas.vondra@postgresql.org>    
date     : Sat, 9 May 2020 19:41:36 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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/20200414065336.GI1492@paquier.xyz  

M src/backend/executor/nodeIncrementalSort.c

Fix handling of REWIND/MARK/BACKWARD in incremental sort

commit   : c4427226483c78618ba45eff34917400a77718a5    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 9 May 2020 19:41:18 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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/20200414065336.GI1492@paquier.xyz  

M src/backend/executor/nodeIncrementalSort.c

Update oidjoins regression test for v13.

commit   : 6c298881c20797ac424558b9ff68d9781e03f6c4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 9 May 2020 13:05:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <alvherre@alvh.no-ip.org>    
date     : Fri, 8 May 2020 19:38:46 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <euler.taveira@2ndquadrant.com>  
Discussion: https://postgr.es/m/CAH503wA_VOrcKL_43p9atRejCDYmOZ8MzfK9S6TJrQqBqNeAXA@mail.gmail.com  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  

M src/bin/pg_dump/pg_backup_directory.c

Rework XLogReader callback system

commit   : b060dbe0001a1d6bf26cd294710f3cb203868d46    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 8 May 2020 15:30:34 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <alvherre@alvh.no-ip.org>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20200422175754.GA19858@alvherre.pgsql  

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 <peter@eisentraut.org>    
date     : Fri, 8 May 2020 20:35:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <peter@eisentraut.org>    
date     : Fri, 8 May 2020 13:33:00 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <peter@eisentraut.org>    
date     : Wed, 6 May 2020 16:25:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <peter@eisentraut.org>    
date     : Thu, 9 Apr 2020 14:10:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <akapila@postgresql.org>    
date     : Fri, 8 May 2020 08:33:05 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Fri, 8 May 2020 10:36:40 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/d11b0c910b63684424e06772eb844ab5@oss.nttdata.com  

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

Refactor nbtree deletion INCOMPLETE_SPLIT check.

commit   : cd8c73a38a23c364e71973d6832a585616d24756    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 7 May 2020 16:08:54 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 7 May 2020 15:59:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 7 May 2020 14:25:18 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <bruce@momjian.us>    
date     : Thu, 7 May 2020 13:06:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Thu, 7 May 2020 10:01:22 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Thu, 7 May 2020 09:00:24 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Wed, 6 May 2020 19:34:22 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 6 May 2020 19:34:22 -0400    

Click here for diff

Reported-by: Andrey M. Borodin  
  
Discussion: https://postgr.es/m/D49B37B1-E2B9-4F67-8C6C-5CFD4015E8C5@yandex-team.ru  

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

pgbench: document that the default data loading is client-side

commit   : c3d1fdb59891e78df9ffb89b3e8bea780bd90568    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 6 May 2020 19:07:29 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 6 May 2020 15:58:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <alvherre@alvh.no-ip.org>    
date     : Wed, 6 May 2020 12:29:41 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 6 May 2020 12:23:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <michael@paquier.xyz>    
date     : Wed, 6 May 2020 21:08:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200430150608.6dc6b8c4@antares.wagner.home  
Backpatch-through: 9.5  

M src/tools/msvc/Mkvcbuild.pm

doc: PG 13 relnotes, fix markup

commit   : 7dc37ccea8599f460ec95b8a0208e2047a6fb4bf    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 5 May 2020 17:45:34 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Tue, 5 May 2020 17:43:27 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <pg@bowt.ie>    
date     : Tue, 5 May 2020 14:42:10 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <pg@bowt.ie>    
date     : Tue, 5 May 2020 14:36:54 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <bruce@momjian.us>    
date     : Tue, 5 May 2020 17:21:57 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Tue, 5 May 2020 16:31:44 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 5 May 2020 16:06:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16404-4603a99603fbd04c@postgresql.org  

M doc/src/sgml/config.sgml

doc: PG 13 release note adjustments, Justin Pryzby v2

commit   : 98c017c5760c1107a846c85eb20a1b3b80cad8c7    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 5 May 2020 14:40:27 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Tue, 5 May 2020 13:18:05 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 5 May 2020 13:10:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200504115649.GA77072@gate.oper.dinoex.org  

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 <bruce@momjian.us>    
date     : Tue, 5 May 2020 12:42:55 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Tue, 5 May 2020 11:42:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Tue, 5 May 2020 10:33:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Tue, 5 May 2020 10:32:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <peter@eisentraut.org>    
date     : Tue, 5 May 2020 08:49:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <michael@paquier.xyz>    
date     : Tue, 5 May 2020 14:16:01 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/ECEBD212-7101-41EB-84F3-2F356E4B6401@yesql.se  

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 <bruce@momjian.us>    
date     : Mon, 4 May 2020 23:09:45 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <akapila@postgresql.org>    
date     : Tue, 5 May 2020 08:00:53 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 4 May 2020 16:16:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <pg@bowt.ie>    
date     : Mon, 4 May 2020 11:23:44 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 4 May 2020 13:48:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 4 May 2020 12:18:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <akorotkov@postgresql.org>    
date     : Sun, 3 May 2020 12:19:31 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Sun, 3 May 2020 10:45:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <pg@bowt.ie>    
date     : Sat, 2 May 2020 14:04:33 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <sfrost@snowman.net>    
date     : Sat, 2 May 2020 11:39:26 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
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/87h82kzwqn.fsf@news-spur.riddles.org.uk  
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 <tomas.vondra@postgresql.org>    
date     : Sat, 2 May 2020 15:30:10 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tomas.vondra@postgresql.org>    
date     : Sat, 2 May 2020 15:26:47 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Sat, 2 May 2020 10:33:10 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tomas.vondra@postgresql.org>    
date     : Sat, 2 May 2020 01:25:00 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tomas.vondra@postgresql.org>    
date     : Sat, 2 May 2020 00:36:25 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 1 May 2020 17:28:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 1 May 2020 16:16:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <pg@bowt.ie>    
date     : Fri, 1 May 2020 12:19:44 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <pg@bowt.ie>    
date     : Fri, 1 May 2020 10:03:38 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <pg@bowt.ie>    
date     : Fri, 1 May 2020 09:51:09 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <pg@bowt.ie>    
date     : Fri, 1 May 2020 08:39:52 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <peter@eisentraut.org>    
date     : Fri, 1 May 2020 11:49:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <michael@paquier.xyz>    
date     : Fri, 1 May 2020 17:40:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <pg@bowt.ie>    
date     : Thu, 30 Apr 2020 14:33:13 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <pg@bowt.ie>    
date     : Thu, 30 Apr 2020 12:31:56 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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/21800dbe-a13e-22f7-d423-b81db9d249f5@2ndquadrant.com  

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

Doc: update sections 9.14 - 9.16 for new function table layout.

commit   : 30e82f1bc9888d7f84bdcad33f460dd8db752b08    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 30 Apr 2020 12:53:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <peter@eisentraut.org>    
date     : Thu, 30 Apr 2020 09:34:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <peter@eisentraut.org>    
date     : Thu, 30 Apr 2020 09:06:49 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <michael@paquier.xyz>    
date     : Thu, 30 Apr 2020 13:39:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/b319e449-318d-e691-4997-1327e166fcc4@2ndquadrant.com  

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 <tgl@sss.pgh.pa.us>    
date     : Thu, 30 Apr 2020 00:34:05 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/5561.1587922854@sss.pgh.pa.us  

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 <pg@bowt.ie>    
date     : Wed, 29 Apr 2020 18:17:49 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <michael@paquier.xyz>    
date     : Thu, 30 Apr 2020 08:14:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/14BFD060-8C9D-43B4-897D-D5D9AA6FC92B@yesql.se  

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

Fix checkpoint signalling

commit   : 1816a1c6ffe46782eee9a16a974b4aa3f4b8457b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 29 Apr 2020 18:46:42 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <horikyota.ntt@gmail.com>  
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/20200408.141956.891237856186513376.horikyota.ntt@gmail.com  

M src/backend/postmaster/checkpointer.c
M src/test/recovery/t/019_replslot_limit.pl

Fix typo

commit   : fef819ac534d6efb9608fa0bbb93c6fe6c87440e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Apr 2020 10:13:25 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <alvherre@alvh.no-ip.org>    
date     : Tue, 28 Apr 2020 20:39:04 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <horikyota.ntt@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/20200408.093710.447591748588426656.horikyota.ntt@gmail.com  

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 <pg@bowt.ie>    
date     : Tue, 28 Apr 2020 16:12:56 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <peter@eisentraut.org>    
date     : Tue, 28 Apr 2020 13:35:40 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <akorotkov@postgresql.org>    
date     : Tue, 28 Apr 2020 11:07:56 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Tue, 28 Apr 2020 07:55:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200424034248.GL33034@paquier.xyz  

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

Fix bogus tar-file padding logic for standby.signal.

commit   : 0278d3f79a30cd9ccd6646b8447b25c60ae7d01d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 27 Apr 2020 13:04:35 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 27 Apr 2020 12:21:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16388-98cffba38d0b7e6e@postgresql.org  

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 <tgl@sss.pgh.pa.us>    
date     : Mon, 27 Apr 2020 11:00:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/10598.1587928415@sss.pgh.pa.us  

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 <peter@eisentraut.org>    
date     : Mon, 27 Apr 2020 14:24:20 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <michael@paquier.xyz>    
date     : Mon, 27 Apr 2020 14:59:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 27 Apr 2020 14:59:36 +0900    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/20200408165653.GF2228@telsasoft.com  

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 <tgl@sss.pgh.pa.us>    
date     : Sun, 26 Apr 2020 11:45:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <peter@eisentraut.org>    
date     : Sun, 26 Apr 2020 13:48:33 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <noah@leadboat.com>    
date     : Sat, 25 Apr 2020 18:45:27 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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 <pg@bowt.ie>    
date     : Sat, 25 Apr 2020 16:45:20 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <pg@bowt.ie>    
date     : Sat, 25 Apr 2020 14:17:02 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <noah@leadboat.com>    
date     : Sat, 25 Apr 2020 10:18:12 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20200418070142.GA1075445@rfd.leadboat.com  

M src/backend/replication/walsender.c

Revert "When WalSndCaughtUp, sleep only in WalSndWaitForWal()."

commit   : 72a3dc321d76c93842d502793f93b9dc2d2305b2    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 25 Apr 2020 10:17:26 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20200417054146.GA1061007@rfd.leadboat.com  

M src/backend/replication/walsender.c

Fix error case for CREATE ROLE ... IN ROLE.

commit   : d9a4cce29d563e4e6f6eec8b807736d98b1ad553    
  
author   : Andrew Gierth <rhodiumtoad@postgresql.org>    
date     : Sat, 25 Apr 2020 05:09:30 +0100    
  
committer: Andrew Gierth <rhodiumtoad@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 24 Apr 2020 17:53:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/5752.1587740484@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Fri, 24 Apr 2020 17:21:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/5752.1587740484@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Fri, 24 Apr 2020 15:51:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <bruce@momjian.us>    
date     : Fri, 24 Apr 2020 15:16:04 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <rhaas@postgresql.org>    
date     : Fri, 24 Apr 2020 14:08:29 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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/20200405193118.alprgmozhxcfabkw@alap3.anarazel.de  

M src/bin/pg_verifybackup/parse_manifest.h

Repair performance regression in information_schema.triggers view.

commit   : baf17ad9dff4552b7e494d3f574972c21d9f90bc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 24 Apr 2020 12:02:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/5891.1587594470@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Fri, 24 Apr 2020 10:54:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <peter@eisentraut.org>    
date     : Fri, 24 Apr 2020 09:33:22 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <michael@paquier.xyz>    
date     : Fri, 24 Apr 2020 11:33:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200424005929.GK33034@paquier.xyz  
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 <michael@paquier.xyz>    
date     : Fri, 24 Apr 2020 08:48:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 23 Apr 2020 15:38:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/6631.1587565046@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Thu, 23 Apr 2020 15:27:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/8936216c-3492-3f6e-634b-d638fddc5f91@gmail.com  

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 <tgl@sss.pgh.pa.us>    
date     : Thu, 23 Apr 2020 15:12:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <rhaas@postgresql.org>    
date     : Thu, 23 Apr 2020 09:47:50 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <rhaas@postgresql.org>    
date     : Thu, 23 Apr 2020 08:44:06 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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/20200418125713.GG350229@paquier.xyz  

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 <andres@anarazel.de>    
date     : Wed, 22 Apr 2020 19:52:07 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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 <fujii@postgresql.org>    
date     : Thu, 23 Apr 2020 11:32:17 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/ff4710f7-2331-4f6b-012e-d76da3275e91@oss.nttdata.com  

M src/bin/pg_verifybackup/pg_verifybackup.c

Doc: improve description of geometric multiplication/division.

commit   : 1cc34640cabcb32b4f062673cce1d6b1819d492d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2020 21:32:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/158110996889.1089.4224139874633222837@wrigleys.postgresql.org  

M doc/src/sgml/func.sgml

nbtree: Rename BT_RESERVED_OFFSET_MASK.

commit   : 48107e396f75ea65192153707a8c476f66b59061    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 22 Apr 2020 16:09:55 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tomas.vondra@postgresql.org>    
date     : Thu, 23 Apr 2020 00:15:24 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <bruce@momjian.us>    
date     : Wed, 22 Apr 2020 16:23:19 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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: taf1@cornell.edu  
  
Discussion: https://postgr.es/m/158506544539.679.2278386310645558048@wrigleys.postgresql.org  
  
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2020 15:27:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2020 14:43:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/158110996889.1089.4224139874633222837@wrigleys.postgresql.org  

M doc/src/sgml/func.sgml

Remove bogus Assert in foreign key cloning code

commit   : 9f2c4edec2e2182a2fef8495efdaf90a65d64e6c    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 22 Apr 2020 22:12:19 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Tue, 21 Apr 2020 19:57:33 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <michael@paquier.xyz>    
date     : Wed, 22 Apr 2020 08:08:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200421.150830.1410714948345179794.horikyota.ntt@gmail.com  

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 <alvherre@alvh.no-ip.org>    
date     : Tue, 21 Apr 2020 18:37:26 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/20200419002206.GM26953@telsasoft.com  

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 <michael@paquier.xyz>    
date     : Wed, 22 Apr 2020 07:27:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <alvherre@alvh.no-ip.org>    
date     : Tue, 21 Apr 2020 17:14:18 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <alvherre@alvh.no-ip.org>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://postgr.es/m/20200421162038.GA18628@alvherre.pgsql  

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 <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2020 15:58:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16378-7a70ca41b3ec2009@postgresql.org  

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 <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2020 14:23:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <alvherre@alvh.no-ip.org>    
date     : Tue, 21 Apr 2020 13:57:00 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <pryzby@telsasoft.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://www.postgresql.org/message-id/flat/20200408152412.GZ2228@telsasoft.com  

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 <pg@bowt.ie>    
date     : Tue, 21 Apr 2020 09:59:24 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2020 12:56:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/9d3b0959-95d6-c37e-2c0b-287bcfe5c705@postgrespro.ru  

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

Clean up cpluspluscheck violation.

commit   : 9d25e1aa311c0f0c77155382e6608545b7bf579c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2020 11:21:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2020 11:13:05 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/27239.1587415696@sss.pgh.pa.us  

M src/include/replication/basebackup.h

Mention pg_promote() as a method to trigger promotion in documentation.

commit   : 67f82e966b524fc0eb44024976c5178612a77fc8    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 Apr 2020 14:05:43 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/de0068417a9f4046bac693cbcc00bdc9@oss.nttdata.com  

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 <bruce@momjian.us>    
date     : Mon, 20 Apr 2020 21:41:13 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 20 Apr 2020 21:41:13 -0400    

Click here for diff

Reported-by: Jürgen Purtz  
  
Discussion: https://postgr.es/m/709d7809-d7f4-8175-47f3-4d131341bba8@purtz.de  
  
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Apr 2020 18:44:12 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <rhaas@postgresql.org>    
date     : Mon, 20 Apr 2020 14:37:38 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <alvherre@alvh.no-ip.org>    
date     : Mon, 20 Apr 2020 13:42:41 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <ibrar.ahmad@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
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 <alvherre@alvh.no-ip.org>    
date     : Mon, 20 Apr 2020 13:42:12 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/20200217225333.GA30974@alvherre.pgsql  
Reviewed-by: ahsan hadi <ahsan.hadi@gmail.com>  
Reviewed-by: Ibrar Ahmed <ibrar.ahmad@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  

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 <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Apr 2020 12:29:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <magnus@hagander.net>    
date     : Mon, 20 Apr 2020 12:53:40 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
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/13145F2F-8458-4977-9D2D-7B2E862E5722@yandex-team.ru  

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 <tgl@sss.pgh.pa.us>    
date     : Sun, 19 Apr 2020 17:44:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <jdavis@postgresql.org>    
date     : Sun, 19 Apr 2020 10:32:26 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Sun, 19 Apr 2020 12:17:02 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <peter@eisentraut.org>    
date     : Sun, 19 Apr 2020 14:59:29 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Sat, 18 Apr 2020 15:36:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/31464.1587156281@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Sat, 18 Apr 2020 14:02:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/21519.1585272409@sss.pgh.pa.us  

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 <drowley@postgresql.org>    
date     : Sat, 18 Apr 2020 14:10:37 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
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/16369-5845a6f1bef59884@postgresql.org  
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 17 Apr 2020 20:50:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/8691.1586798003@sss.pgh.pa.us  

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 <andrew@dunslane.net>    
date     : Fri, 17 Apr 2020 16:53:01 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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 <andrew@dunslane.net>    
date     : Fri, 17 Apr 2020 15:57:19 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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 <andrew@dunslane.net>    
date     : Fri, 17 Apr 2020 14:44:33 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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 <andrew@dunslane.net>    
date     : Fri, 17 Apr 2020 14:11:18 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 17 Apr 2020 13:41:59 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200417.151831.1153577605111650154.horikyota.ntt@gmail.com  

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 <fujii@postgresql.org>    
date     : Fri, 17 Apr 2020 18:37:38 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/951743d0-fd7e-8e2b-d489-1368a58b7304@oss.nttdata.com  

M doc/src/sgml/backup-manifest.sgml

Fix minor memory leak in pg_basebackup and pg_receivewal

commit   : 198efe774b0d2065d828cf7822376a2871c671fc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 17 Apr 2020 10:45:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <drowley@postgresql.org>    
date     : Fri, 17 Apr 2020 10:29:49 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 16 Apr 2020 14:45:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <akapila@postgresql.org>    
date     : Thu, 16 Apr 2020 10:44:03 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Thu, 16 Apr 2020 13:57:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200410080910.GZ1606@paquier.xyz  

M src/bin/pg_basebackup/pg_basebackup.c

Slightly simplify nbtree split point choice loop.

commit   : f0ca378d4c139eda99ef14998115c1674dac3fc5    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 15 Apr 2020 15:47:26 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <michael@paquier.xyz>    
date     : Wed, 15 Apr 2020 15:56:01 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <fujii@postgresql.org>    
date     : Wed, 15 Apr 2020 11:15:12 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/01e3ed3a-8729-5aaa-ca84-e60e3ca59db8@oss.nttdata.com  

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 <pg@bowt.ie>    
date     : Tue, 14 Apr 2020 14:38:28 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 14 Apr 2020 17:30:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <andrew@dunslane.net>    
date     : Tue, 14 Apr 2020 16:55:34 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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/27481.1586618092@sss.pgh.pa.us  

M src/tools/perlcheck/perlcriticrc

Set Perl search path more idiomatically

commit   : e60c6f6ea17b50833242653fe2781f6d47429540    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 14 Apr 2020 16:47:07 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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 <rhaas@postgresql.org>    
date     : Tue, 14 Apr 2020 13:41:32 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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/20200327203225.hcm6ag4grwsiruea@alap3.anarazel.de  

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 <pg@bowt.ie>    
date     : Tue, 14 Apr 2020 09:33:18 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <michael@paquier.xyz>    
date     : Tue, 14 Apr 2020 14:45:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200408165653.GF2228@telsasoft.com  

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 <pg@bowt.ie>    
date     : Mon, 13 Apr 2020 21:11:03 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <akapila@postgresql.org>    
date     : Tue, 14 Apr 2020 08:10:27 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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/20200322021801.GB2563@telsasoft.com  

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 <pg@bowt.ie>    
date     : Mon, 13 Apr 2020 19:26:41 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <noah@leadboat.com>    
date     : Mon, 13 Apr 2020 18:47:28 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20200414013849.GA886648@rfd.leadboat.com  

M src/test/recovery/t/010_logical_decoding_timelines.pl

Silence Perl warning

commit   : e56d717d8a23c48e4ab27b6bd6815c50dc3a378a    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 13 Apr 2020 19:54:09 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <alvherre@alvh.no-ip.org>  
Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>  
Discussion: https://postgr.es/m/E1jO1VT-0008Qk-TM@gemulon.postgresql.org  

M doc/src/sgml/mk_feature_tables.pl

Harmonize nbtree page split point code.

commit   : bc3087b626d1073c9b7c9687b334785909ca2237    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 13 Apr 2020 16:39:55 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <andrew@dunslane.net>    
date     : Mon, 13 Apr 2020 12:06:11 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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/20200412074245.GB623763@rfd.leadboat.com  

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 <andrew@dunslane.net>    
date     : Mon, 13 Apr 2020 11:55:45 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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/20200412074245.GB623763@rfd.leadboat.com  

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 <andrew@dunslane.net>    
date     : Mon, 13 Apr 2020 11:46:18 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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 <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2020 10:48:23 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <akapila@postgresql.org>    
date     : Mon, 13 Apr 2020 15:31:16 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Mon, 13 Apr 2020 10:21:15 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Sun, 12 Apr 2020 18:03:20 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/9326.1581457869@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Sun, 12 Apr 2020 14:03:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/9326.1581457869@sss.pgh.pa.us  

M doc/src/sgml/func.sgml
M doc/src/sgml/postgres.sgml

Rename pg_validatebackup to pg_verifybackup.

commit   : dbc60c5593f26dc777a3be032bff4fb4eab1ddd1    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Sun, 12 Apr 2020 11:26:05 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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/172c9d9b-1d0a-1b94-1456-376b1e017322@2ndquadrant.com  
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 <pg@bowt.ie>    
date     : Sat, 11 Apr 2020 21:07:20 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tgl@sss.pgh.pa.us>    
date     : Sat, 11 Apr 2020 15:02:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <noah@leadboat.com>    
date     : Sat, 11 Apr 2020 10:30:12 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20200406085420.GC162712@rfd.leadboat.com  

M src/backend/executor/execReplication.c

When WalSndCaughtUp, sleep only in WalSndWaitForWal().

commit   : 421685812290406daea58b78dfab0346eb683bbb    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 11 Apr 2020 10:30:00 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20200406063649.GA3738151@rfd.leadboat.com  

M src/backend/replication/walsender.c

Make EXPLAIN report maximum hashtable usage across multiple rescans.

commit   : 969f9d0b4ba574bb8df65683dbf7a09c030f3e67    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 11 Apr 2020 12:39:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200323165059.GA24950@alvherre.pgsql  

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 <tgl@sss.pgh.pa.us>    
date     : Sat, 11 Apr 2020 12:29:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200323165059.GA24950@alvherre.pgsql  

M src/backend/executor/nodeHashjoin.c

Fix RELCACHE_FORCE_RELEASE issue

commit   : 12fb189bfeaf03faea5b6f15544c1f71e9ef4677    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 11 Apr 2020 15:07:25 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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/04d78603-edae-9243-9dde-fe3037176a7d@2ndquadrant.com  

M src/backend/replication/pgoutput/pgoutput.c

Fix relcache reference leak

commit   : 5a1d0c9925fbda9ec434061dee74b1b5d9a16038    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 11 Apr 2020 09:44:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <rhodiumtoad@postgresql.org>    
date     : Sat, 11 Apr 2020 08:04:57 +0100    
  
committer: Andrew Gierth <rhodiumtoad@postgresql.org>    
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 <pg@bowt.ie>    
date     : Fri, 10 Apr 2020 17:44:08 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 10 Apr 2020 13:12:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/834603375.3470346.1586482852542@mail.yahoo.com  

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

Suppress unused-variable warning.

commit   : 401418ca6a689f772cbfa1aedc7485cbbcde7a94    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 10 Apr 2020 12:00:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 10 Apr 2020 10:44:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/158647836143.655.9853963229391401576@wrigleys.postgresql.org  

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 <michael@paquier.xyz>    
date     : Fri, 10 Apr 2020 11:18:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200408165653.GF2228@telsasoft.com  

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 <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Apr 2020 17:28:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/E1jM1Sa-0003mS-99@gemulon.postgresql.org  

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

Further cleanup of ts_headline code.

commit   : 2e0e409e3cbab4f4ac01a6f70931817cfd2bdcb1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Apr 2020 15:38:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16345-2e0cf5cddbdcd3b4@postgresql.org  

M src/backend/tsearch/wparser_def.c

Doc: improve documentation about ts_headline() function.

commit   : a4d4f59196ea8745fe4c048085d6d2bd66e8e7d8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Apr 2020 15:11:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Apr 2020 13:19:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16345-2e0cf5cddbdcd3b4@postgresql.org  

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 <tgl@sss.pgh.pa.us>    
date     : Thu, 9 Apr 2020 12:36:59 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16345-2e0cf5cddbdcd3b4@postgresql.org  

M src/backend/tsearch/wparser_def.c

Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue

commit   : e92e4a2b68fe877677278c1300db1780956c984e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 Apr 2020 16:17:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <ewaldo@healthetechs.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  

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 <fujii@postgresql.org>    
date     : Thu, 9 Apr 2020 22:38:24 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/78f76a3d-1a28-a97d-0394-5c96985dd1c0@oss.nttdata.com  

M doc/src/sgml/ref/pg_validatebackup.sgml

Exclude backup_manifest file that existed in database, from BASE_BACKUP.

commit   : 1ec50a81ec0acd452c7520de19e607a6de8fba5e    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 9 Apr 2020 22:37:11 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/78f76a3d-1a28-a97d-0394-5c96985dd1c0@oss.nttdata.com  

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 <akapila@postgresql.org>    
date     : Thu, 9 Apr 2020 09:49:30 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Thu, 9 Apr 2020 12:56:36 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/1585857868967-0.post@n3.nabble.com  

M doc/src/sgml/pgstatstatements.sgml

Msys2 tweaks for pg_validatebackup corruption test

commit   : c3e4cbaab936a17b579d85c5ff28bcb2251736d0    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 8 Apr 2020 17:50:55 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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/7330a7c7-ce5f-9769-39a1-bdb0b32bb4a6@2ndQuadrant.com  

M src/bin/pg_validatebackup/t/003_corruption.pl

createuser: Change a fprintf to pg_log_error

commit   : f45b8e51b6838ab820df13983c194f737be48778    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Apr 2020 19:19:45 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tomas.vondra@postgresql.org>    
date     : Wed, 8 Apr 2020 18:30:11 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 8 Apr 2020 11:23:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16346-6210ad7a0ea81be1@postgresql.org  

M src/bin/pg_dump/pg_backup_archiver.c

Rationalize GetWalRcv{Write,Flush}RecPtr().

commit   : d140f2f3e225ea53e2d92ab6833b8c186c90666c    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2020 23:45:09 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <alvherre@2ndquadrant.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
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 <peter@eisentraut.org>    
date     : Wed, 8 Apr 2020 09:59:27 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <amitlangote09@gmail.com>  
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>  
Reviewed-by: Petr Jelinek <petr@2ndquadrant.com>  
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 <akorotkov@postgresql.org>    
date     : Wed, 8 Apr 2020 11:37:27 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <drowley@postgresql.org>    
date     : Wed, 8 Apr 2020 18:29:51 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Wed, 8 Apr 2020 15:04:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/16325-809194cf742313ab@postgresql.org  
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 <drowley@postgresql.org>    
date     : Wed, 8 Apr 2020 16:55:03 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
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 <jdavis@postgresql.org>    
date     : Tue, 7 Apr 2020 20:42:04 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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/412a3fbf306f84d8d78c4009e11791867e62b87c.camel@j-davis.com  

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 <drowley@postgresql.org>    
date     : Wed, 8 Apr 2020 16:22:52 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 8 Apr 2020 00:10:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <alvherre@alvh.no-ip.org>    
date     : Tue, 7 Apr 2020 19:16:37 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/20200407232602.GA21559@alvherre.pgsql  

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

Support PrefetchBuffer() in recovery.

commit   : 3985b600f57d75b9743d86430cb5c21370057a23    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2020 13:36:45 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <alvherre@2ndquadrant.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 7 Apr 2020 22:12:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <efujita@postgresql.org>    
date     : Wed, 8 Apr 2020 10:25:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 7 Apr 2020 20:50:02 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/332c47fa-d951-7574-b5cc-a8f7f7201202@highgo.ca  

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 <andres@anarazel.de>    
date     : Tue, 7 Apr 2020 17:36:23 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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/20200301083601.ews6hz5dduc3w2se@alap3.anarazel.de  

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 <tomas.vondra@postgresql.org>    
date     : Wed, 8 Apr 2020 02:06:00 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <andres@anarazel.de>    
date     : Mon, 6 Apr 2020 21:28:55 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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/20200406025651.fpzdb5yyb7qyhqko@alap3.anarazel.de  

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

Appease perlcritic

commit   : 7e2ffb3885007183af7b161e046e126be2cfba12    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 7 Apr 2020 18:58:19 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <pg@bowt.ie>    
date     : Tue, 7 Apr 2020 15:56:52 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <alvherre@alvh.no-ip.org>    
date     : Tue, 7 Apr 2020 18:35:00 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <horiguchi.kyotaro@lab.ntt.co.jp>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/20170228.122736.123383594.horiguchi.kyotaro@lab.ntt.co.jp  

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 <tgl@sss.pgh.pa.us>    
date     : Tue, 7 Apr 2020 17:46:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <akorotkov@postgresql.org>    
date     : Tue, 7 Apr 2020 23:51:10 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <alvherre@alvh.no-ip.org>    
date     : Tue, 7 Apr 2020 16:22:13 -0400    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <surafel3000@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Tomas Vondra <tomas.vondra@2ndquadrant.com>  
Discussion: https://postgr.es/m/CALAY4q9ky7rD_A4vf=FVQvCGngm3LOes-ky0J6euMrg=_Se+ag@mail.gmail.com  
Discussion: https://postgr.es/m/87o8wvz253.fsf@news-spur.riddles.org.uk  

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 <tgl@sss.pgh.pa.us>    
date     : Tue, 7 Apr 2020 15:57:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200312115135445367128@highgo.ca  

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 <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2020 19:20:20 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2020 18:03:24 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Wed, 8 Apr 2020 00:49:29 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/16159-f5a34a3a04dc67e0@postgresql.org  
Discussion: https://postgr.es/m/20200129.120222.1476610231001551715.horikyota.ntt@gmail.com  

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

Consider Incremental Sort paths at additional places

commit   : ba3e76cc571eba3dea19c9465ff15ac3ac186576    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2020 16:43:18 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2020 22:22:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/12222.1586223974@sss.pgh.pa.us  

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 <tmunro@postgresql.org>    
date     : Tue, 7 Apr 2020 11:33:56 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <masao.fujii@oss.nttdata.com>  
Reviewed-by: Takao Fujii <btfujiitkp@oss.nttdata.com>  
Reviewed-by: Yoshikazu Imai <imai.yoshikazu@fujitsu.com>  
Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>  
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 <tmunro@postgresql.org>    
date     : Tue, 7 Apr 2020 11:08:14 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <masao.fujii@oss.nttdata.com>  
Reviewed-by: Takao Fujii <btfujiitkp@oss.nttdata.com>  
Reviewed-by: Yoshikazu Imai <imai.yoshikazu@fujitsu.com>  
Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>  
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 <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2020 01:16:57 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tomas.vondra@postgresql.org>    
date     : Mon, 6 Apr 2020 23:58:10 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <pg@bowt.ie>    
date     : Mon, 6 Apr 2020 14:46:33 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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/c4e38e9a-0f9c-8e53-e639-adf343f94472@postgrespro.ru  

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

Fix show_incremental_sort_info with force_parallel_mode

commit   : 7d6d82a52493ad47c57662d0ac6758da551e87a5    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 6 Apr 2020 23:19:13 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tomas.vondra@postgresql.org>    
date     : Mon, 6 Apr 2020 21:33:28 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2020 12:00:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/30675.1586111599@sss.pgh.pa.us  

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 <peter@eisentraut.org>    
date     : Mon, 6 Apr 2020 15:15:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <amitlangote09@gmail.com>  
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>  
Reviewed-by: Petr Jelinek <petr@2ndquadrant.com>  
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 <akapila@postgresql.org>    
date     : Mon, 6 Apr 2020 16:24:51 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Mon, 6 Apr 2020 11:44:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200202161718.GI13621@telsasoft.com  

M src/backend/commands/cluster.c

Add the option to report WAL usage in EXPLAIN and auto_explain.

commit   : 33e05f89c53e5a1533d624046bb6fb0da7bb7141    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 6 Apr 2020 08:02:15 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Mon, 6 Apr 2020 11:03:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200202161718.GI13621@telsasoft.com  
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 <andres@anarazel.de>    
date     : Sun, 5 Apr 2020 18:23:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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/20200327182217.ubrrl32lyfhxfwk5@alap3.anarazel.de  

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 <andres@anarazel.de>    
date     : Sun, 5 Apr 2020 17:47:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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/20200328213023.s4eyijhdosuc4vcj@alap3.anarazel.de  
Backpatch: 9.5-  

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

Fix recently introduced typo.

commit   : 549a3e23c3d618103487161b19dbbf8fd2206a5c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2020 12:03:09 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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 <peter@eisentraut.org>    
date     : Sun, 5 Apr 2020 10:02:00 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <michael@paquier.xyz>  

M src/backend/replication/slot.c

Further improve stability fix for partition_aggregate test.

commit   : 18d85e9b8a2b784bcee350c59cf20c5c697a1c1f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 5 Apr 2020 00:53:25 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/24467.1585838693@sss.pgh.pa.us  

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 <akapila@postgresql.org>    
date     : Sun, 5 Apr 2020 07:34:04 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <noah@leadboat.com>    
date     : Sat, 4 Apr 2020 15:45:45 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20200404223212.GC3442685@rfd.leadboat.com  

M src/test/recovery/t/018_wal_optimize.pl

Remove bogus Assert, add some regression test cases showing why.

commit   : 07871d40c72e498b6e034eb674df5d8d206976bc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 4 Apr 2020 18:03:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <noah@leadboat.com>    
date     : Sat, 4 Apr 2020 12:25:34 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20150702220524.GA9392@svana.org  

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 <peter@eisentraut.org>    
date     : Sat, 4 Apr 2020 09:08:12 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <akapila@postgresql.org>    
date     : Sat, 4 Apr 2020 10:02:08 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <jdavis@postgresql.org>    
date     : Fri, 3 Apr 2020 19:52:16 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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/20200325220936.il3ni2fj2j2b45y5@alap3.anarazel.de  

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

Fix resource management bug with replication=database.

commit   : 3e0d80fd8d3dd4f999e0d3aa3e591f480d8ad1fd    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 22:28:37 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 20:15:27 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 19:51:18 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 19:51:18 -0400    

Click here for diff

Report by Tom Lane.  
  
Discussion: http://postgr.es/m/22394.1585951968@sss.pgh.pa.us  

M src/bin/pg_validatebackup/Makefile

pg_validatebackup: Adjust TAP tests to undo permissions change.

commit   : 19c0422ad012636d00ba221bd7052cb71448efca    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 19:01:59 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 17:16:31 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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/20200403205412.GA8279@alvherre.pgsql  

M src/bin/pg_validatebackup/t/003_corruption.pl

commit   : 0568e7a2a4f133a7c16776bcae92c53fcf247b73    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 3 Apr 2020 17:00:25 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 15:40:35 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 15:28:59 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 14:59:47 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Sat, 4 Apr 2020 03:13:17 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/16109-26a1a88651e90608@postgresql.org  

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 <tgl@sss.pgh.pa.us>    
date     : Fri, 3 Apr 2020 13:15:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <fujii@postgresql.org>    
date     : Sat, 4 Apr 2020 01:25:44 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/20200403025751.GB1759@paquier.xyz  

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 <alvherre@alvh.no-ip.org>    
date     : Fri, 3 Apr 2020 13:23:20 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <corey.huinker@gmail.com>  
Co-authored-by: Jürgen Purtz <juergen@purtz.de>  
Co-authored-by: Roger Harkavy <rogerharkavy@gmail.com>  
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
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 <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 11:58:58 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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/d332b8f0-0c72-3cd6-6945-7a86a503662a@oss.nttdata.com  

M src/bin/pg_waldump/pg_waldump.c

Add checksum helper functions.

commit   : c12e43a2e0d45a6b59f2cea53f1b82e52fdcff7a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 3 Apr 2020 11:50:38 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Fri, 3 Apr 2020 11:24:56 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16340-591c7449dc7c8c47@postgresql.org  

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 <fujii@postgresql.org>    
date     : Fri, 3 Apr 2020 12:20:42 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Fri, 3 Apr 2020 12:15:56 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Fri, 3 Apr 2020 11:45:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <fujii@postgresql.org>    
date     : Fri, 3 Apr 2020 11:27:09 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/16109-26a1a88651e90608@postgresql.org  

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 <rhaas@postgresql.org>    
date     : Thu, 2 Apr 2020 20:25:04 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
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/20200330020814.nspra4mvby42yoa4@alap3.anarazel.de  

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 <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Apr 2020 19:43:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/24467.1585838693@sss.pgh.pa.us  

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 <bruce@momjian.us>    
date     : Thu, 2 Apr 2020 17:42:09 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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/a1ffbfda-59d2-5732-e5fb-3df8582b6434@2ndquadrant.com  
  
Backpatch-through: 9.5  

M doc/src/sgml/pgbuffercache.sgml

commit   : c713dc2f7be314ee541f0abd170b69c90d8bfb14    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 2 Apr 2020 17:27:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 2 Apr 2020 17:27:43 -0400    

Click here for diff

Reported-by: Peter Eisentraut  
  
Discussion: https://postgr.es/m/750b8832-d123-7f9b-931e-43ce8321b2d7@2ndquadrant.com  
  
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Apr 2020 15:04:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/b10493cc-a399-a03a-67c7-068f2791ee50@imap.cc  

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 <tomas.vondra@postgresql.org>    
date     : Thu, 2 Apr 2020 14:26:27 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <drowley@postgresql.org>    
date     : Thu, 2 Apr 2020 21:26:54 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
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/22297.1585797192@sss.pgh.pa.us  

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 <peter@eisentraut.org>    
date     : Thu, 26 Mar 2020 08:14:00 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <daniel@manitou-mail.org>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Discussion: https://www.postgresql.org/message-id/flat/c1909f27-c269-2ed9-12f8-3ab72c8caf7a@2ndquadrant.com  

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 <peter@eisentraut.org>    
date     : Thu, 2 Apr 2020 08:56:12 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <peter@eisentraut.org>    
date     : Thu, 2 Apr 2020 08:01:30 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <peter@eisentraut.org>    
date     : Thu, 2 Apr 2020 07:52:20 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tmunro@postgresql.org>    
date     : Thu, 2 Apr 2020 16:44:11 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <akapila@postgresql.org>    
date     : Thu, 2 Apr 2020 08:04:58 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Thu, 2 Apr 2020 11:20:19 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <tomas.vondra@postgresql.org>    
date     : Thu, 2 Apr 2020 02:11:38 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 1 Apr 2020 19:44:17 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 1 Apr 2020 17:31:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 1 Apr 2020 14:49:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/D9C3CEF7-04E8-47A1-8300-CA1DCD5ED40D@gmail.com  

M src/backend/commands/indexcmds.c

Improve selectivity estimation for assorted match-style operators.

commit   : a80818605e5447b9b846590c3d3fab99060cb53e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 1 Apr 2020 10:32:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/12237.1582833074@sss.pgh.pa.us  

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 <peter@eisentraut.org>    
date     : Wed, 1 Apr 2020 15:31:47 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 1 Apr 2020 15:31:47 +0200    

Click here for diff

This unifies some duplicate code.  
  
Author: Amit Langote <amitlangote09@gmail.com>  
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 <peter@eisentraut.org>    
date     : Wed, 1 Apr 2020 14:43:45 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <akorotkov@postgresql.org>    
date     : Wed, 1 Apr 2020 15:07:53 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <akorotkov@postgresql.org>    
date     : Wed, 1 Apr 2020 15:01:26 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <akorotkov@postgresql.org>    
date     : Wed, 1 Apr 2020 14:42:17 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Wed, 1 Apr 2020 14:45:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/16330-b34835d83619e25d@postgresql.org  
Backpatch-through: 12  

M src/bin/psql/command.c

Fix coverity complaint about commit 40d964ec99.

commit   : 2401d93718310237b3cb1ff914abc1bcbdd8e1dc    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 1 Apr 2020 09:28:13 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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/20200329224818.6phnhv7o2q2rfovf@alap3.anarazel.de  

M src/backend/commands/vacuum.c

psql: do file completion for \gx

commit   : 08481eedd186ea5c22eef86e85cacacbc715f995    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 23:01:34 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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/eca20529-0b06-b493-ee38-f071a75dcd5b@postgresfriends.org  
  
Backpatch-through: 10  

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

Add -c/--restore-target-wal to pg_rewind

commit   : a7e8ece41cf7a96d8a9c4c037cdfef304d950831    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 1 Apr 2020 10:57:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/a3acff50-5a0d-9a2c-b3b2-ee36168955c1@postgrespro.ru  

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 <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 18:44:29 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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/158032651854.19851.16261832706661813796@wrigleys.postgresql.org  
  
Backpatch-through: 9.5  

M doc/src/sgml/func.sgml

doc: clarify hierarchy of objects: global, db, schema, etc.

commit   : 009e422c1b6854870b6b7f6ba0b7e2816395d933    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 18:10:39 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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: jbird@nuna.com  
  
Discussion: https://postgr.es/m/158057750885.1123.2806779262588618988@wrigleys.postgresql.org  
  
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 <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 17:57:44 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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: me@sillymon.ch  
  
Discussion: https://postgr.es/m/158074944048.1095.4309647363871637715@wrigleys.postgresql.org  
  
Backpatch-through: 9.5  

M doc/src/sgml/mvcc.sgml

Add CREATE INDEX deduplication assertions.

commit   : 7dbe290da446544a04ace7d342841070f062a0ed    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 31 Mar 2020 14:38:39 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 17:32:00 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Thu, 12 Mar 2020 15:42:35 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 17:16:33 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 17:16:33 -0400    

Click here for diff

Without the namespace, the table name could be ambiguous.  
  
Reported-by: adunham@arbormetrix.com  
  
Discussion: https://postgr.es/m/158155175140.23798.2189464781144503491@wrigleys.postgresql.org  
  
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 <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 17:07:43 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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: mib@nic.at  
  
Discussion: https://postgr.es/m/158089540905.1098.15071165437284409576@wrigleys.postgresql.org  
  
Backpatch-through: 10  

M doc/src/sgml/ddl.sgml

Fix race condition in statext_store().

commit   : fe3036527a1ff715bceb22ff5cba919001262a71    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2020 17:06:22 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 16:31:44 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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/968d4724-8e58-788f-7c45-f7b1813824cc@imap.cc  
  
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2020 16:09:17 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/15012.1585623298@sss.pgh.pa.us  

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 <alvherre@alvh.no-ip.org>    
date     : Tue, 31 Mar 2020 16:37:24 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/20181120050744.GJ4400@paquier.xyz  

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 <fujii@postgresql.org>    
date     : Wed, 1 Apr 2020 03:35:13 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/19168211580382043@myt5-b646bde4b8f3.qloud-c.yandex.net  

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

Allow ecpg to be built stand-alone, allow parallel libpq make

commit   : 051fd5e0f99b14d7bd76fb800bd077bf394fecd5    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 31 Mar 2020 14:17:32 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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/E5Dc85EGUY4wyG8cjAU0qoEdCJxGK_qhW1s9qSuYq9A@mail.gmail.com  
  
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2020 12:57:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200308173103.GC1357@telsasoft.com  

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

Fix lquery's NOT handling, and add ability to quantify non-'*' items.

commit   : 70dc4c509b330fdd965d795e8d7f41f09d56c9ae    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2020 11:14:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2020 10:30:59 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/15582.1585529626@sss.pgh.pa.us  

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 <akorotkov@postgresql.org>    
date     : Tue, 31 Mar 2020 17:51:57 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <magnus@hagander.net>    
date     : Tue, 31 Mar 2020 16:00:06 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Tue, 31 Mar 2020 16:00:06 +0200    

Click here for diff

Author: Daniel Gustafsson <daniel@yesql.se>  

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 <peter@eisentraut.org>    
date     : Tue, 31 Mar 2020 08:40:32 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <dean.a.rasheed@gmail.com>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>  
Reviewed-by: Vik Fearing <vik@postgresfriends.org>  
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 <michael@paquier.xyz>    
date     : Tue, 31 Mar 2020 15:33:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/a3acff50-5a0d-9a2c-b3b2-ee36168955c1@postgrespro.ru  

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 <peter@eisentraut.org>    
date     : Tue, 31 Mar 2020 08:25:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <akapila@postgresql.org>    
date     : Tue, 31 Mar 2020 09:34:49 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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/20191120210600.GC30362@telsasoft.com  

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

Further simplify nbtree high key truncation.

commit   : f01157e2ac8ac4dff8ba159c36edf2fdb7d6704e    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 30 Mar 2020 17:34:12 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <michael@paquier.xyz>    
date     : Tue, 31 Mar 2020 08:27:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <pg@bowt.ie>    
date     : Mon, 30 Mar 2020 15:52:39 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <andres@anarazel.de>    
date     : Mon, 30 Mar 2020 13:51:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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 <akorotkov@postgresql.org>    
date     : Mon, 30 Mar 2020 23:45:03 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <akorotkov@postgresql.org>    
date     : Mon, 30 Mar 2020 23:40:22 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <pg@bowt.ie>    
date     : Mon, 30 Mar 2020 12:03:59 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <akorotkov@postgresql.org>    
date     : Mon, 30 Mar 2020 19:17:11 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Mon, 30 Mar 2020 17:30:44 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <andrew.dunstan@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/flat/54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com  

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 <tgl@sss.pgh.pa.us>    
date     : Mon, 30 Mar 2020 11:14:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/24905.1585445371@sss.pgh.pa.us  

M src/port/chklocale.c

Attempt to fix unstable regression tests, take 2

commit   : 24566b359d095c3800c2a326d88a595722813f58    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 30 Mar 2020 23:41:11 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Mon, 30 Mar 2020 17:35:03 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Mon, 30 Mar 2020 09:19:40 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <sk@zsrv.org>  
Reviewed-by: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/4ad69a4c-cc9b-0dfe-0352-8b1b0cd36c7b@2ndquadrant.com  

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 <peter@eisentraut.org>    
date     : Mon, 30 Mar 2020 08:55:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <fujii@postgresql.org>    
date     : Mon, 30 Mar 2020 13:51:05 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/1583789487074-0.post@n3.nabble.com  

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 <fujii@postgresql.org>    
date     : Mon, 30 Mar 2020 12:15:26 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/bdfee4e0-a304-2498-8da5-3cb52c0a193e@oss.nttdata.com  

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 <akapila@postgresql.org>    
date     : Mon, 30 Mar 2020 07:33:38 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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/20191120210600.GC30362@telsasoft.com  

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

Cosmetic improvements in ltree code.

commit   : 2743d9ae4a490a7d96b5c19d50694bd101a87dc8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 29 Mar 2020 19:14:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Sun, 29 Mar 2020 18:54:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <peter@eisentraut.org>    
date     : Sun, 29 Mar 2020 11:13:27 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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/bbdcce43-bd2e-5599-641b-9b44b9e0add4@2ndquadrant.com  

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 <peter@eisentraut.org>    
date     : Sun, 29 Mar 2020 09:25:40 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <andrew.dunstan@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/flat/54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com  

M src/test/regress/pg_regress.c

Update SQL features

commit   : b79911dc8c0dc3b864999b9a17333716d602c6a0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 29 Mar 2020 08:56:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <drowley@postgresql.org>    
date     : Sun, 29 Mar 2020 19:36:20 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
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 <pg@bowt.ie>    
date     : Sat, 28 Mar 2020 20:25:03 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tgl@sss.pgh.pa.us>    
date     : Sat, 28 Mar 2020 18:31:05 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Sat, 28 Mar 2020 17:09:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <andres@anarazel.de>    
date     : Sat, 28 Mar 2020 11:52:11 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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/20200229052459.wzhqnbhrriezg4v2@alap3.anarazel.de  
Backpatch: 9.5-  

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

Fix costing for disk-based hash aggregation.

commit   : 7351bfeda33b60b69c15791c7eb77a127546df26    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Sat, 28 Mar 2020 10:53:01 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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 <dean.a.rasheed@gmail.com>    
date     : Sat, 28 Mar 2020 14:37:53 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
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 <peter@eisentraut.org>    
date     : Sat, 28 Mar 2020 13:01:42 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <andrew.dunstan@2ndquadrant.com>  
Discussion: https://www.postgresql.org/message-id/flat/54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com  

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 <dean.a.rasheed@gmail.com>    
date     : Sat, 28 Mar 2020 12:48:34 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
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 <peter@eisentraut.org>    
date     : Sat, 28 Mar 2020 08:46:18 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <drowley@postgresql.org>    
date     : Sat, 28 Mar 2020 19:20:12 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
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 <pg@bowt.ie>    
date     : Fri, 27 Mar 2020 16:44:52 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <alvherre@alvh.no-ip.org>    
date     : Fri, 27 Mar 2020 19:43:41 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <sk@zsrv.org>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/19513901543181143@sas1-19a94364928d.qloud-c.yandex.net  

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 <alvherre@alvh.no-ip.org>    
date     : Fri, 27 Mar 2020 16:04:52 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <sk@zsrv.org>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/20200122055510.GH174860@paquier.xyz  

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 <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Mar 2020 14:47:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/7072.1585332104@sss.pgh.pa.us  

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 <peter@eisentraut.org>    
date     : Fri, 27 Mar 2020 08:36:08 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Mar 2020 18:58:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Mar 2020 18:06:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/10353.1585247879@sss.pgh.pa.us  

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 <magnus@hagander.net>    
date     : Thu, 26 Mar 2020 15:05:54 +0100    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Thu, 26 Mar 2020 15:05:54 +0100    

Click here for diff

Author: Daniel Gustafsson <daniel@yesql.se>  

M src/backend/storage/page/README

Drop slot's LWLock before returning from SaveSlotToPath()

commit   : 49bf81536e242f079bfbce6e8f95f53f18207dd5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 26 Mar 2020 11:51:39 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <pavan.deolasee@2ndquadrant.com>  
Reported-by: Craig Ringer <craig@2ndquadrant.com>  
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2020 22:05:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <andrew@dunslane.net>    
date     : Wed, 25 Mar 2020 21:14:14 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2020 19:37:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <andrew@dunslane.net>    
date     : Wed, 25 Mar 2020 17:13:17 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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/04116472-818b-5859-1d74-3d995aab2252@2ndQuadrant.com  

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 <alvherre@alvh.no-ip.org>    
date     : Wed, 25 Mar 2020 15:14:14 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <alvherre@alvh.no-ip.org>    
date     : Wed, 25 Mar 2020 13:19:31 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <luis.carril@swarm64.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Surafel Temesgen <surafel3000@gmail.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@2ndQuadrant.com>  
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 <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2020 11:57:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <peter@eisentraut.org>    
date     : Wed, 25 Mar 2020 14:23:25 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tgl@sss.pgh.pa.us>  
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 <peter@eisentraut.org>    
date     : Wed, 25 Mar 2020 08:46:41 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tmunro@postgresql.org>    
date     : Wed, 25 Mar 2020 15:56:00 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <juanjo.santamaria@gmail.com>  
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 <tmunro@postgresql.org>    
date     : Wed, 25 Mar 2020 15:53:24 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <peter.eisentraut@2ndquadrant.com>  
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 <jdavis@postgresql.org>    
date     : Tue, 24 Mar 2020 18:19:51 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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 <jdavis@postgresql.org>    
date     : Tue, 24 Mar 2020 18:19:34 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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 <pg@bowt.ie>    
date     : Tue, 24 Mar 2020 14:58:27 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <andres@anarazel.de>    
date     : Tue, 24 Mar 2020 12:14:18 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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 <peter@eisentraut.org>    
date     : Tue, 24 Mar 2020 19:29:34 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 24 Mar 2020 12:08:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 24 Mar 2020 11:48:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <peter@eisentraut.org>    
date     : Tue, 24 Mar 2020 16:01:06 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <er@xs4all.nl>  

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

Doc: fix broken markup.

commit   : ab3e4fbd5421e9b3203de9ebf6a741eebab2ab94    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 24 Mar 2020 10:27:02 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/2e3dc9e4bfa4802d2c9f5fe15bde44de@xs4all.nl  

M doc/src/sgml/monitoring.sgml

Some refactoring of logical/worker.c

commit   : 97ee604d9bcedf0066986521a7ee15e3aa87be34    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Mar 2020 14:00:58 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <amitlangote09@gmail.com>  
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>  
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 <peter@eisentraut.org>    
date     : Tue, 24 Mar 2020 08:49:52 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <daniel@manitou-mail.org>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Discussion: https://www.postgresql.org/message-id/flat/c1909f27-c269-2ed9-12f8-3ab72c8caf7a@2ndquadrant.com  

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 <andres@anarazel.de>    
date     : Mon, 23 Mar 2020 22:19:56 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 23 Mar 2020 22:19:56 -0700    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/20200321040750.GD13662@telsasoft.com  

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 <fujii@postgresql.org>    
date     : Tue, 24 Mar 2020 12:46:48 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/00c194b2-dbbb-2e8a-5b39-13f14048ef0a@oss.nttdata.com  

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 <michael@paquier.xyz>    
date     : Tue, 24 Mar 2020 12:13:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/a3acff50-5a0d-9a2c-b3b2-ee36168955c1@postgrespro.ru  

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 <fujii@postgresql.org>    
date     : Tue, 24 Mar 2020 11:12:21 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/f0651f8c-9c96-9f29-0ff9-80414a15308a@oss.nttdata.com  

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 <jdavis@postgresql.org>    
date     : Mon, 23 Mar 2020 18:55:12 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 23 Mar 2020 18:55:12 -0700    

Click here for diff

Discussion: https://postgr.es/m/23196.1584943506@sss.pgh.pa.us  

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 <fujii@postgresql.org>    
date     : Tue, 24 Mar 2020 10:43:41 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <jdavis@postgresql.org>    
date     : Mon, 23 Mar 2020 13:56:28 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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/20200319064222.GR26184@telsasoft.com  

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 <bruce@momjian.us>    
date     : Mon, 23 Mar 2020 18:38:42 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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 <andres@anarazel.de>    
date     : Mon, 23 Mar 2020 14:48:19 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
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/16293-26f5777d10143a66@postgresql.org  
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 <akorotkov@postgresql.org>    
date     : Tue, 24 Mar 2020 00:54:33 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2020 12:42:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2020 11:58:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/16304-c662b00a1322db7f@postgresql.org  

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 <michael@paquier.xyz>    
date     : Mon, 23 Mar 2020 13:38:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <michael@paquier.xyz>    
date     : Mon, 23 Mar 2020 12:52:37 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200313115033.GA183471@paquier.xyz  

M src/include/c.h

Add object names to partition integrity violations.

commit   : 33753ac9d7bc83dd9ccee9d5e678ed78a0725b4e    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 23 Mar 2020 08:09:15 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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/0aa113a3-3c7f-db48-bcd8-f9290b2269ae@gmail.com  

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 <michael@paquier.xyz>    
date     : Mon, 23 Mar 2020 11:01:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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/20200114035420.GE1515@paquier.xyz  

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 <noah@leadboat.com>    
date     : Sun, 22 Mar 2020 09:24:09 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20200321224920.GB1763544@rfd.leadboat.com  

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 <tgl@sss.pgh.pa.us>    
date     : Sat, 21 Mar 2020 18:28:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <noah@leadboat.com>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20150702220524.GA9392@svana.org  

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 <noah@leadboat.com>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20191118045434.GA1173436@rfd.leadboat.com  

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

During heap rebuild, lock any TOAST index until end of transaction.

commit   : e629a01f6973688f77ecff964d9d6bea9bc4b374    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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/20191226001521.GA1772687@rfd.leadboat.com  

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 <noah@leadboat.com>    
date     : Sat, 21 Mar 2020 09:38:26 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
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 <akapila@postgresql.org>    
date     : Sat, 21 Mar 2020 08:48:06 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <bruce@momjian.us>    
date     : Fri, 20 Mar 2020 20:19:32 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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: axykon@gmail.com  
  
Discussion: https://postgr.es/m/158316348159.30450.16075357948244298217@wrigleys.postgresql.org  
  
Backpatch-through: 9.5  

M doc/src/sgml/textsearch.sgml

Fix bogus last-minute edit in 4e62091341b4

commit   : 069b750ca764a85324a138c22c3ece5cf13d684f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 20 Mar 2020 18:11:28 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <alvherre@alvh.no-ip.org>    
date     : Fri, 20 Mar 2020 17:21:00 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <andrew@dunslane.net>    
date     : Fri, 20 Mar 2020 13:55:15 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
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 <peter@eisentraut.org>    
date     : Fri, 20 Mar 2020 16:04:15 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <daniel@manitou-mail.org>  
Author: David Zhang <david.zhang@highgo.ca>  
Discussion: https://www.postgresql.org/message-id/flat/9a0b3c8d-ee14-4b1d-9d0a-2c993bdabacc@manitou-mail.org  

M src/bin/psql/common.c

Allow relation extension lock to conflict among parallel group members.

commit   : 85f6b49c2c53fb1e08d918ec9305faac13cf7ad6    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 20 Mar 2020 08:20:56 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <pg@bowt.ie>    
date     : Thu, 19 Mar 2020 14:56:56 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <jdavis@postgresql.org>    
date     : Thu, 19 Mar 2020 11:20:39 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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 <bruce@momjian.us>    
date     : Thu, 19 Mar 2020 15:20:55 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
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/87pne2w98h.fsf@wibble.ilmari.org  
  
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 <akorotkov@postgresql.org>    
date     : Thu, 19 Mar 2020 21:40:45 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Mar 2020 11:43:11 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <fujii@postgresql.org>    
date     : Thu, 19 Mar 2020 17:09:00 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <peter@eisentraut.org>    
date     : Thu, 19 Mar 2020 08:17:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <amitlangote09@gmail.com>  
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 <fujii@postgresql.org>    
date     : Thu, 19 Mar 2020 15:32:55 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/124997ee-096a-5d09-d8da-2c7a57d0816e@oss.nttdata.com  

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 <akapila@postgresql.org>    
date     : Thu, 19 Mar 2020 08:11:45 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <pg@bowt.ie>    
date     : Wed, 18 Mar 2020 18:17:37 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <michael@paquier.xyz>    
date     : Thu, 19 Mar 2020 09:51:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <jdavis@postgresql.org>    
date     : Wed, 18 Mar 2020 15:42:02 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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/507ac540ec7c20136364b5272acbcd4574aa76ef.camel@j-davis.com  

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 <jdavis@postgresql.org>    
date     : Wed, 18 Mar 2020 15:39:14 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
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/ec63d70b668818255486a83ffadc3aec492c1f57.camel@j-davis.com  

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 <alvherre@alvh.no-ip.org>    
date     : Wed, 18 Mar 2020 18:58:05 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/20200227165158.GA2071@alvherre.pgsql  

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 <pg@bowt.ie>    
date     : Wed, 18 Mar 2020 14:42:49 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <peter@eisentraut.org>    
date     : Wed, 18 Mar 2020 21:20:01 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tomas.vondra@postgresql.org>    
date     : Wed, 18 Mar 2020 16:48:12 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <noriyoshi.shinoda@hpe.com>  

M doc/src/sgml/catalogs.sgml

Recognize some OR clauses as compatible with functional dependencies

commit   : ccaa3569f58796868303629bc2d63ddddb599b38    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 18 Mar 2020 16:41:45 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Wed, 18 Mar 2020 23:07:17 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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/124997ee-096a-5d09-d8da-2c7a57d0816e@oss.nttdata.com  

M doc/src/sgml/monitoring.sgml

doc: Update documentation about reg* types

commit   : 8408e3a557ad26a7e88f867a425b2b9a86c4fa04    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2020 14:51:37 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
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 <tomas.vondra@postgresql.org>    
date     : Wed, 18 Mar 2020 13:38:49 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Wed, 18 Mar 2020 18:28:22 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <akapila@postgresql.org>    
date     : Wed, 18 Mar 2020 09:27:14 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <michael@paquier.xyz>    
date     : Wed, 18 Mar 2020 11:13:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
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 <akapila@postgresql.org>    
date     : Wed, 18 Mar 2020 07:20:17 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
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 <pg@bowt.ie>    
date     : Tue, 17 Mar 2020 18:39:26 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tmunro@postgresql.org>    
date     : Wed, 18 Mar 2020 12:48:13 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <horikyota.ntt@gmail.com>  
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 <tmunro@postgresql.org>    
date     : Wed, 18 Mar 2020 12:43:05 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <a.korotkov@postgrespro.ru>  
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 17 Mar 2020 19:36:41 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/24137.1584139352@sss.pgh.pa.us  

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 <pg@bowt.ie>    
date     : Tue, 17 Mar 2020 15:53:05 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 17 Mar 2020 18:29:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/21569.1584314271@sss.pgh.pa.us  

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 <alvherre@alvh.no-ip.org>    
date     : Tue, 17 Mar 2020 18:18:01 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/20191115214102.GA15616@alvherre.pgsql  

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 <alvherre@alvh.no-ip.org>    
date     : Tue, 17 Mar 2020 16:13:18 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 17 Mar 2020 15:05:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <tgl@sss.pgh.pa.us>    
date     : Tue, 17 Mar 2020 14:54:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/21569.1584314271@sss.pgh.pa.us  

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 <tgl@sss.pgh.pa.us>    
date     : Tue, 17 Mar 2020 12:09:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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 <fujii@postgresql.org>    
date     : Tue, 17 Mar 2020 16:06:59 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <fujii@postgresql.org>    
date     : Tue, 17 Mar 2020 12:06:22 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
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 <tgl@sss.pgh.pa.us>    
date     : Mon, 16 Mar 2020 21:36:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200308173103.GC1357@telsasoft.com  

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 <tgl@sss.pgh.pa.us>    
date     : Mon, 16 Mar 2020 21:05:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
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/20200308173103.GC1357@telsasoft.com  

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 <pg@bowt.ie>    
date     : Mon, 16 Mar 2020 15:51:06 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <alvherre@alvh.no-ip.org>    
date     : Mon, 16 Mar 2020 19:12:14 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <pryzby@telsasoft.com>  
Discussion: https://postgr.es/m/20200305161838.GJ684@telsasoft.com  

M doc/src/sgml/func.sgml

Update comment

commit   : b234b567ed740aae368672670d8d03640e884f1f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 16 Mar 2020 18:38:28 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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/DA9A5554-AADD-4F33-96F9-A1066EC9CAB5@enterprisedb.com>  

M src/include/tcop/cmdtaglist.h

Plug memory leak

commit   : 046001fe3cf59e19b2e8c24b82fb2e9b8ab6edd4    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 16 Mar 2020 16:27:13 -0300    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
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 <pg@bowt.ie>    
date     : Mon, 16 Mar 2020 12:00:10 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
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 <tmunro@postgresql.org>    
date     : Mon, 16 Mar 2020 12:31:34 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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 <tmunro@postgresql.org>    
date     : Mon, 16 Mar 2020 11:43:18 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
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