PostgreSQL 12.0 commit log

Stamp 12.0.

commit   : ad1f2885b8c82e0c2d56d7974f012cbecce17a17    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 16:03:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 16:03:42 -0400    

Click here for diff

M configure
M configure.in
M src/include/pg_config.h.win32

Suppress another CR in program output

commit   : b60f9afcf4bfe6b1ff73b49b9bab20dde356c7f4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 30 Sep 2019 15:48:54 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 30 Sep 2019 15:48:54 -0400    

Click here for diff

This one was exposed by a12c75a10.  
  
Backpatch to release 11 where check_pg_config was introduced.  

M src/test/perl/TestLib.pm

Doc: improve PREPARE documentation, cross-referencing to plan_cache_mode.

commit   : ca0b3828504a51247607913e16f45c635ec168b6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 14:31:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 14:31:12 -0400    

Click here for diff

The behavior described in the PREPARE man page applies only for the  
default plan_cache_mode setting, so explain that properly.  Rewrite  
some of the text while I'm here.  Per suggestion from Bruce.  
  
Discussion: https://postgr.es/m/[email protected]  

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

docs: adjust multi-column most-common-value statistics

commit   : 737f226842748cf946cad3bd30aadfd0c03ad16f    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 30 Sep 2019 13:44:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 30 Sep 2019 13:44:22 -0400    

Click here for diff

This commit adds a mention that the order of columns specified during  
multi-column most-common-value statistics is insignificant, and tries to  
simplify examples.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 12  

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

Doc: update v12 release notes.

commit   : 9d42df74a3ad0379fe90e56c92eecac6957876f3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 12:03:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Sep 2019 12:03:28 -0400    

Click here for diff

Set the release date, make a few adjustments for recent commits.  

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

Make crash recovery ignore recovery target settings.

commit   : 4af2ac3deeca24d3b8cb1abeb49bd62a7d013fa3    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 30 Sep 2019 10:18:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 30 Sep 2019 10:18:15 +0900    

Click here for diff

In v11 or before, recovery target settings could not take effect in  
crash recovery because they are specified in recovery.conf and  
crash recovery always starts without recovery.conf. But commit  
2dedf4d9a8 integrated recovery.conf into postgresql.conf and  
which unexpectedly allowed recovery target settings to take effect  
even in crash recovery. This is definitely not good behavior.  
  
To fix the issue, this commit makes crash recovery always ignore  
recovery target settings.  
  
Back-patch to v12.  
  
Author: Peter Eisentraut  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

jit: Re-allow JIT compilation of execGrouping.c hashtable comparisons.

commit   : 2ce9bca36458a1f1907c82eb2e9bd642cb1fca26    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 29 Sep 2019 16:27:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 29 Sep 2019 16:27:18 -0700    

Click here for diff

In the course of 5567d12ce03, 356687bd8 and 317ffdfeaac, I changed  
BuildTupleHashTable[Ext]'s call to ExecBuildGroupingEqual to not pass  
in the parent node, but NULL. Which in turn prevents the tuple  
equality comparator from being JIT compiled.  While that fixes  
bug #15486, it is not actually necessary after all of the above commits,  
as we don't re-build the comparator when using the new  
BuildTupleHashTableExt() interface (as the content of the hashtable  
are reset, but the TupleHashTable itself is not).  
  
Therefore re-allow jit compilation for callers that use  
BuildTupleHashTableExt with a separate context for "metadata" and  
content.  
  
As in the previous commit, there's ongoing work to make this easier to  
test to prevent such regressions in the future, but that  
infrastructure is not going to be backpatchable.  
  
The performance impact of not JIT compiling hashtable equality  
comparators can be substantial e.g. for aggregation queries that  
aggregate a lot of input rows to few output rows (when there are a lot  
of output groups, there will be fewer comparisons).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11, just as 5567d12ce03  

M src/backend/executor/execGrouping.c

Fix determination when slot types for upper executor nodes are fixed.

commit   : 6cf74f1bbd6545321d9e2929c7618550863f72d1    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 29 Sep 2019 15:24:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 29 Sep 2019 15:24:54 -0700    

Click here for diff

For many queries the fact that the tuple descriptor from the lower  
node was not taken into account when determining whether the type of a  
slot is fixed, lead to tuple deforming for such upper nodes not to be  
JIT accelerated.  
  
I broke this in 675af5c01e297.  
  
There is ongoing work to enable writing regression tests for related  
behavior (including a patch that would have detected this  
regression), by optionally showing such details in EXPLAIN. But as it  
seems unlikely that that will be suitable for stable branches, just  
merge the fix for now.  
  
While it's fairly close to the 12 release window, the fact that 11  
continues to perform JITed tuple deforming in these cases, that  
there's still cases where we do so in 12, and the fact that the  
performance regression can be sizable, weigh in favor of fixing it  
now.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where 675af5c01e297 was merged.  

M src/backend/executor/execExpr.c

Translation updates

commit   : 3c70de2e12b9ef10925a57a350dffc01b95e067e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:46:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:46:15 +0200    

Click here for diff

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

M src/backend/nls.mk
M src/backend/po/de.po
D src/backend/po/id.po
D src/backend/po/pt_BR.po
M src/backend/po/sv.po
M src/bin/initdb/nls.mk
M src/bin/initdb/po/cs.po
M src/bin/initdb/po/fr.po
D src/bin/initdb/po/he.po
D src/bin/initdb/po/it.po
D src/bin/initdb/po/ko.po
D src/bin/initdb/po/pl.po
D src/bin/initdb/po/pt_BR.po
D src/bin/initdb/po/vi.po
M src/bin/pg_archivecleanup/nls.mk
A src/bin/pg_archivecleanup/po/cs.po
D src/bin/pg_archivecleanup/po/ko.po
D src/bin/pg_archivecleanup/po/pl.po
D src/bin/pg_archivecleanup/po/vi.po
M src/bin/pg_basebackup/nls.mk
A src/bin/pg_basebackup/po/cs.po
D src/bin/pg_basebackup/po/fr.po
D src/bin/pg_basebackup/po/he.po
D src/bin/pg_basebackup/po/it.po
D src/bin/pg_basebackup/po/ko.po
D src/bin/pg_basebackup/po/pl.po
D src/bin/pg_basebackup/po/pt_BR.po
D src/bin/pg_basebackup/po/vi.po
M src/bin/pg_checksums/nls.mk
A src/bin/pg_checksums/po/cs.po
M src/bin/pg_config/nls.mk
M src/bin/pg_config/po/cs.po
D src/bin/pg_config/po/nb.po
D src/bin/pg_config/po/ta.po
M src/bin/pg_controldata/nls.mk
M src/bin/pg_controldata/po/cs.po
D src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_ctl/nls.mk
M src/bin/pg_ctl/po/cs.po
D src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_dump/nls.mk
M src/bin/pg_dump/po/cs.po
D src/bin/pg_dump/po/fr.po
D src/bin/pg_dump/po/he.po
D src/bin/pg_dump/po/it.po
D src/bin/pg_dump/po/ko.po
D src/bin/pg_dump/po/pl.po
D src/bin/pg_dump/po/pt_BR.po
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_resetwal/po/cs.po
D src/bin/pg_resetwal/po/fr.po
D src/bin/pg_resetwal/po/it.po
D src/bin/pg_resetwal/po/ko.po
D src/bin/pg_resetwal/po/pl.po
D src/bin/pg_resetwal/po/pt_BR.po
M src/bin/pg_rewind/nls.mk
A src/bin/pg_rewind/po/cs.po
D src/bin/pg_rewind/po/fr.po
D src/bin/pg_rewind/po/it.po
D src/bin/pg_rewind/po/ko.po
D src/bin/pg_rewind/po/pl.po
D src/bin/pg_rewind/po/pt_BR.po
M src/bin/pg_upgrade/po/cs.po
M src/bin/pg_waldump/nls.mk
A src/bin/pg_waldump/po/cs.po
D src/bin/pg_waldump/po/ko.po
D src/bin/pg_waldump/po/vi.po
M src/bin/psql/nls.mk
M src/bin/psql/po/cs.po
M src/bin/psql/po/fr.po
D src/bin/psql/po/he.po
D src/bin/psql/po/ko.po
D src/bin/psql/po/pl.po
D src/bin/psql/po/pt_BR.po
D src/bin/psql/po/zh_TW.po
M src/bin/scripts/nls.mk
M src/bin/scripts/po/cs.po
D src/bin/scripts/po/fr.po
D src/bin/scripts/po/he.po
D src/bin/scripts/po/it.po
D src/bin/scripts/po/ko.po
D src/bin/scripts/po/pl.po
D src/bin/scripts/po/pt_BR.po
M src/interfaces/ecpg/ecpglib/po/fr.po
M src/interfaces/ecpg/preproc/po/cs.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/libpq/nls.mk
M src/interfaces/libpq/po/cs.po
D src/interfaces/libpq/po/pl.po
D src/interfaces/libpq/po/pt_BR.po
M src/interfaces/libpq/po/sv.po
D src/interfaces/libpq/po/zh_TW.po
M src/pl/plperl/nls.mk
M src/pl/plperl/po/cs.po
D src/pl/plperl/po/zh_TW.po
M src/pl/plpgsql/src/nls.mk
M src/pl/plpgsql/src/po/cs.po
D src/pl/plpgsql/src/po/ro.po
D src/pl/plpgsql/src/po/zh_TW.po
M src/pl/plpython/po/cs.po
M src/pl/tcl/nls.mk
M src/pl/tcl/po/cs.po
D src/pl/tcl/po/pt_BR.po
D src/pl/tcl/po/ro.po
D src/pl/tcl/po/zh_TW.po

Update list of acknowledgments in release notes

commit   : f0eadaa717eae75392d03479aea282bc752df276    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:38:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:38:51 +0200    

Click here for diff

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

Allow SSL TAP tests to run on Windows

commit   : 63d3e1142a0554c33818741d44926fc036a0499b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 29 Sep 2019 17:32:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 29 Sep 2019 17:32:46 -0400    

Click here for diff

Windows does not enforce key file permissions checks in libpq, and psql  
can produce CRLF line endings on Windows.  
  
Backpatch to Release 12 (CRLF) and Release 11 (permissions check)  

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

doc: Clarify release notes item

commit   : bba1baecb7b07dff33e4c5d32253db5f4c1a0507    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:29:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:29:45 +0200    

Click here for diff

Reported-by: Justin Pryzby <[email protected]>  

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

doc: Further clarify how recovery target parameters are applied

commit   : a7e5ae53cbe7bd88102b38d5f6e15f5adc94e15c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:07:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 23:07:22 +0200    

Click here for diff

Recovery target parameters are all applied even in standby mode.  The  
previous documentation mostly wished they were not but this was never  
the case.  
  
Discussion: https://www.postgresql.org/message-id/flat/e445616d-023e-a268-8aa1-67b8b335340c%40pgmasters.net  

M doc/src/sgml/config.sgml

doc: Release notes refinements

commit   : 3e3e32a1c160ec4e2342068515dfaf1dd04c6078    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 09:50:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 29 Sep 2019 09:50:36 +0200    

Click here for diff

In particular, make some more precise links for some major items.  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/release-12.sgml

Fix compilation with older OpenSSL versions

commit   : a430c7b4afe8278223541d3efee2281ee9135c1d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 28 Sep 2019 15:54:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 28 Sep 2019 15:54:02 +0200    

Click here for diff

Some older OpenSSL versions (0.9.8 branch) define TLS*_VERSION macros  
but not the corresponding SSL_OP_NO_* macro, which causes the code for  
handling ssl_min_protocol_version/ssl_max_protocol_version to fail to  
compile.  To fix, add more #ifdefs and error handling.  
  
Reported-by: Victor Wagner <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20190924101859.09383b4f%40fafnir.local.vm  

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

Improve stability of partition_prune regression test.

commit   : 9de7ea6aca5a394dbddac4b13b475b313e352b3f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 28 Sep 2019 13:33:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 28 Sep 2019 13:33:34 -0400    

Click here for diff

This test already knew that, to get stable test output, it had to hide  
"loops" counts in EXPLAIN ANALYZE results.  But that's not nearly enough:  
if we get a smaller number of workers than we planned for, then the  
"Workers Launched" number will change, and so will all the rows and loops  
counts up to the Gather node.  This has resulted in repeated failures in  
the buildfarm, so adjust the test to filter out all these counts.  
  
(Really, we wouldn't bother with EXPLAIN ANALYZE at all here, except  
that currently the only way to verify that executor-time pruning has  
happened is to look for '(never executed)' annotations.  Those are  
stable and needn't be filtered out.)  
  
Back-patch to v11 where the test was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

ANALYZE a_star and its children to avoid plan instability in tests.

commit   : e40f3c7472036f5a06897a11ac79fd26ec2ccf7d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:28:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:28:25 -0400    

Click here for diff

We've noted certain EXPLAIN queries on these tables occasionally showing  
unexpected plan choices.  This seems to happen because VACUUM sometimes  
fails to update relpages/reltuples for one of these single-page tables,  
due to bgwriter or checkpointer holding a pin on the lone page at just  
the wrong time.  To ensure those values get set, insert explicit ANALYZE  
operations on these tables after we finish populating them.  This  
doesn't seem to affect any other test cases, so it's a usable fix.  
  
Back-patch to v12.  In principle the issue exists further back, but  
we have not seen it before v12, so I won't risk back-patching further.  
  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : b34bc87030655a677b0a4d6317bfe3a6a7d10546    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:01:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Sep 2019 11:01:36 -0400    

Click here for diff

The markup for optional parameters was neither correct nor consistent.  
In passing, fix a spelling mistake.  
  
Per report from Alex Macy.  Some of these mistakes are old, so  
back-patch as appropriate.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

doc: Add timeline as valid recovery target in standby.signal documentation

commit   : a37980d4282436b4019a8e427b02919b04cb625a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 27 Sep 2019 16:21:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 27 Sep 2019 16:21:47 +0200    

Click here for diff

The documentation states that no target settings will be used when  
standby.signal is present, but this is not quite the case since  
recovery_target_timeline is a valid recovery target for a standby.  
  
Update the documentation with this exception.  
  
Author: David Steele <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/e445616d-023e-a268-8aa1-67b8b335340c%40pgmasters.net  

M doc/src/sgml/config.sgml

Add tab completion for EXPLAIN (SETTINGS) in psql

commit   : 268c4e9d4d88f5b4baca88ef31e914a1ac1fb7e9    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Sep 2019 12:53:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Sep 2019 12:53:57 +0900    

Click here for diff

Author: Justin Pryzby  
Reviewed-by: Tatsuro Yamada  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Fix oversight in commit 4429f6a9e3e12bb4af6e3677fbc78cd80f160252.

commit   : fb341a7db9ba03f365bd02dc47123fbad6cc3761    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 18 Sep 2019 09:14:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 18 Sep 2019 09:14:26 +0530    

Click here for diff

The test name and the following test cases suggest the index created  
should be hash index, but it forgot to add 'using hash' in the test case.  
This in itself won't improve code coverage as there were some other tests  
which were covering the corresponding code.  However, it is better if the  
added tests serve their actual purpose.  
  
Reported-by: Paul A Jungwirth  
Author: Paul A Jungwirth  
Reviewed-by: Mahendra Singh  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/CA+renyV=Us-5XfMC25bNp-uWSj39XgHHmGE9Rh2cQKMegSj52g@mail.gmail.com  

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

doc: Fix whitespace in markup

commit   : d10475a0433291bfd136df6edb06497af0f52cb8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 21:29:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 21:29:14 +0200    

Click here for diff

M doc/src/sgml/func.sgml

doc: Format example JSON data better

commit   : 79504cfe1b23cd22c78dd5786f81f40905c5cce0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 21:27:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 21:27:34 +0200    

Click here for diff

M doc/src/sgml/func.sgml

doc: Update a confusing sentence about SQL/JSON

commit   : baca53d3dca701e6a8b04a1b2dd0ed603289fbf0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 16:35:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 16:35:10 +0200    

Click here for diff

Author: Liudmila Mantrova <[email protected]>  
Reported-by: Jeff Janes <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAMkU%3D1wP-SO4KpiLxHJuPezTJCmK%3DJqefLXrr3eXFO7Qku%2BtMg%40mail.gmail.com  

M doc/src/sgml/json.sgml

doc: Update note about source code formatting

commit   : b4d615aaa1ecedcf1e2ca415cd2893d1f18aeeca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 10:51:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 10:51:39 +0200    

Click here for diff

Update the note about why not to use // comments, even though it's now  
technically supported.  
  
The note about variable declarations was dropped here because it's  
addressed more properly later in the chapter.  
  
Discussion: https://www.postgresql.org/message-id/flat/156924954640.1117.6309209869705522549%40wrigleys.postgresql.org  

M doc/src/sgml/sources.sgml

doc: Reorder JSON functions documentation

commit   : 66e0ea75bb9d4b40c734067dd7c7e1fc804a88cb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 09:42:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Sep 2019 09:42:19 +0200    

Click here for diff

Put the description of the SQL/JSON path language after the  
description of the general JSON functions and operators, instead of  
before.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/func.sgml

Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING DEFAULTS.

commit   : 658d391d87c13a4b27425a2fd014f2162956ad4d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Sep 2019 17:30:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Sep 2019 17:30:42 -0400    

Click here for diff

LIKE INCLUDING DEFAULTS tried to copy the attrdef expression without  
copying the state of the attgenerated column.  This is in fact wrong,  
because GENERATED and DEFAULT expressions are not the same kind of animal;  
one can contain Vars and the other not.  We *must* copy attgenerated  
when we're copying the attrdef expression.  Rearrange the if-tests  
so that the expression is copied only when the correct one of  
INCLUDING DEFAULTS and INCLUDING GENERATED has been specified.  
  
Per private report from Manuel Rigger.  
  
Tom Lane and Peter Eisentraut  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/sql/create_table_like.sql

commit   : 37ad1266147626bfe505b2c5b016497605915a8e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 13:44:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 13:44:43 +0900    

Click here for diff

Append node has been removed in v12 when there would be only one subnode  
under it.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqHhS62w8zUFXF4NBjvMboCXYnD-jWoWp-tfo2aHvP3Gxg@mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/ddl.sgml

Fix failure with lock mode used for custom relation options

commit   : 707f38e38e8d4ee891bf52c2f9684f87c72b5234    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 10:08:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Sep 2019 10:08:26 +0900    

Click here for diff

In-core relation options can use a custom lock mode since 47167b7, that  
has lowered the lock available for some autovacuum parameters.  However  
it forgot to consider custom relation options.  This causes failures  
with ALTER TABLE SET when changing a custom relation option, as its lock  
is not defined.  The existing APIs to define a custom reloption does not  
allow to define a custom lock mode, so enforce its initialization to  
AccessExclusiveMode which should be safe enough in all cases.  An  
upcoming patch will extend the existing APIs to allow a custom lock mode  
to be defined.  
  
The problem can be reproduced with bloom indexes, so add a test there.  
  
Reported-by: Nikolay Sharplov  
Analyzed-by: Thomas Munro, Michael Paquier  
Author: Michael Paquier  
Reviewed-by: Kuntal Ghosh  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M contrib/bloom/expected/bloom.out
M contrib/bloom/sql/bloom.sql
M src/backend/access/common/reloptions.c

Fix bug in pairingheap_SpGistSearchItem_cmp()

commit   : 8728552b291b8fe3778346fb4d4b7d1c8743f708    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 01:47:36 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 25 Sep 2019 01:47:36 +0300    

Click here for diff

Our item contains only so->numberOfNonNullOrderBys of distances.  Reflect that  
in the loop upper bound.  
  
Discussion: https://postgr.es/m/53536807-784c-e029-6e92-6da802ab8d60%40postgrespro.ru  
Author: Nikita Glukhov  
Backpatch-through: 12  

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

Stamp 12rc1.

commit   : 17822c0e4f5ab8093e78f665c9e44766ae648a44    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 16:24:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 16:24:42 -0400    

Click here for diff

M configure
M configure.in
M src/include/pg_config.h.win32

Doc: more contributor name cleanup.

commit   : 53c89aed7b38ab412fddc1d6118822ce5d962acd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 13:04:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 13:04:52 -0400    

Click here for diff

Further adjust Japanese names, per advice from Etsuro Fujita.  
  
Discussion: https://postgr.es/m/CAPmGK15XT8eCwn1j3tB3CnOn2q6ksHNKwKjDrEcca5ZEfG0tng@mail.gmail.com  

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

Doc: clarify handling of duplicate elements in array containment tests.

commit   : 216bcf583802011365b8bb038b4e73f143e857b2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 12:37:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 12:37:04 -0400    

Click here for diff

The array <@ and @> operators do not worry about duplicates: if every  
member of array X matches some element of array Y, then X is contained  
in Y, even if several members of X get matched to the same Y member.  
This was not explicitly stated in the docs though, so improve matters.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Doc: proofreading for v12 release notes.

commit   : a25fb9ceb1a63d4383370d4a017aa572d8e99b42    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 10:40:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 10:40:42 -0400    

Click here for diff

Mostly markup improvements, with a couple of grammar fixes.  
  
Liudmila Mantrova  
  
Discussion: https://postgr.es/m/CAEkD-mDxVV1Hrxzo3-hPaS5b1s-+Gin+9Cbu2eMBqRovRVjC0w@mail.gmail.com  

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

Doc: clean up some issues with spellings of contributor names.

commit   : ac8fb2c7e25ce6062d063c56b3c20d24ca581751    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 10:32:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Sep 2019 10:32:02 -0400    

Click here for diff

In the v12 contributors list, remove a couple of duplicates  
that had crept in due to variant spellings of a person's name.  
Try to standardize Japanese names as given-name-first.  
  
Alexander Lakhin  
  
Discussion: https://postgr.es/m/[email protected]  

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

Translation updates

commit   : 8cdd1c4d07a70df0963a26da2533d4c10852504f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 15:30:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 15:30:41 +0200    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/ru.po
M src/bin/initdb/po/ru.po
M src/bin/pg_archivecleanup/po/ru.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_checksums/nls.mk
A src/bin/pg_checksums/po/ru.po
M src/bin/pg_config/po/ru.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_resetwal/po/ru.po
M src/bin/pg_rewind/po/ru.po
M src/bin/pg_test_fsync/po/ru.po
M src/bin/pg_test_timing/po/ru.po
M src/bin/pg_upgrade/po/ru.po
M src/bin/pg_waldump/po/ru.po
M src/bin/psql/po/ru.po
M src/bin/scripts/po/ru.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/ru.po
M src/pl/plperl/po/ru.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpython/po/ru.po
M src/pl/tcl/po/ru.po

Message style fixes

commit   : 516a4c116c5c4206388828f7e2b4e75fa1b1fc87    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 13:37:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 13:37:33 +0200    

Click here for diff

M contrib/test_decoding/expected/slot.out
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/pg_aggregate.c
M src/backend/libpq/auth.c
M src/backend/replication/basebackup.c
M src/backend/replication/slotfuncs.c
M src/backend/storage/file/fd.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/misc/guc.c
M src/test/regress/expected/foreign_key.out

NLS: Fix backend gettext triggers

commit   : 84eb871647b3cc88c89d26d25f0cd84a8ac200fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 09:04:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 Sep 2019 09:04:20 +0200    

Click here for diff

The backend also needs to pull in translations from the frontend  
pg_log_*() functions, since some files in src/common/ use those.  

M src/nls-global.mk

Fix failure to zero-pad the result of bitshiftright().

commit   : 860216efa10a0b8ba54b84aa370ba5cbc27dd32a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 17:46:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 17:46:00 -0400    

Click here for diff

If the bitstring length is not a multiple of 8, we'd shift the  
rightmost bits into the pad space, which must be zeroes --- bit_cmp,  
for one, depends on that.  This'd lead to the result failing to  
compare equal to what it should compare equal to, as reported in  
bug #16013 from Daryl Waycott.  
  
This is, if memory serves, not the first such bug in the bitstring  
functions.  In hopes of making it the last one, do a bit more work  
than minimally necessary to fix the bug:  
  
* Add assertion checks to bit_out() and varbit_out() to complain if  
they are given incorrectly-padded input.  This will improve the  
odds that manual testing of any new patch finds problems.  
  
* Encapsulate the padding-related logic in macros to make it  
easier to use.  
  
Also, remove unnecessary padding logic from bit_or() and bitxor().  
Somebody had already noted that we need not re-pad the result of  
bit_and() since the inputs are required to be the same length,  
but failed to extrapolate that to the other two.  
  
Also, move a comment block that once was near the head of varbit.c  
(but people kept putting other stuff in front of it), to put it in  
the header block.  
  
Note for the release notes: if anyone has inconsistent data as a  
result of saving the output of bitshiftright() in a table, it's  
possible to fix it with something like  
UPDATE mytab SET bitcol = ~(~bitcol) WHERE bitcol != ~(~bitcol);  
  
This has been broken since day one, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/varbit.c
M src/include/utils/varbit.h
M src/test/regress/expected/bit.out
M src/test/regress/sql/bit.sql

Fix typo in tts_virtual_copyslot.

commit   : 308813846e737f7d92ffb4e033d65e3df6cbddba    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 14:21:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 22 Sep 2019 14:21:07 -0400    

Click here for diff

The code used the destination slot's natts where it intended to  
use the source slot's natts.  Adding an Assert shows that there  
is no case in "make check-world" where these counts are different,  
so maybe this is a harmless bug, but it's still a bug.  
  
Takayuki Tsunakawa  
  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1FD34C0E@G01JPEXMBYT05  

M src/backend/executor/execTuples.c

Remove removed file from nls.mk

commit   : ee98adede535ed6bd584857d7f5095328a1ce78c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 21 Sep 2019 23:22:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 21 Sep 2019 23:22:15 +0200    

Click here for diff

part of revert "Add DECLARE STATEMENT support to ECPG."  

M src/interfaces/ecpg/ecpglib/nls.mk

Update list of acknowledgments in release notes

commit   : 87b601605467812c48675a0ec127707bf381cda2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 21 Sep 2019 22:51:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 21 Sep 2019 22:51:54 +0200    

Click here for diff

current through 25f9368304e41c8837f59e94b161f07ac4c7d622  

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

Straighten out leakproofness markings on text comparison functions.

commit   : d9110d7e14819c10049c9beb1034958787c77e79    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 16:56:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 16:56:30 -0400    

Click here for diff

Since we introduced the idea of leakproof functions, texteq and textne  
were marked leakproof but their sibling text comparison functions were  
not.  This inconsistency seemed justified because texteq/textne just  
relied on memcmp() and so could easily be seen to be leakproof, while  
the other comparison functions are far more complex and indeed can  
throw input-dependent errors.  
  
However, that argument crashed and burned with the addition of  
nondeterministic collations, because now texteq/textne may invoke  
the exact same varstr_cmp() infrastructure as the rest.  It makes no  
sense whatever to give them different leakproofness markings.  
  
After a certain amount of angst we've concluded that it's all right  
to consider varstr_cmp() to be leakproof, mostly because the other  
choice would be disastrous for performance of many queries where  
leakproofness matters.  The input-dependent errors should only be  
reachable for corrupt input data, or so we hope anyway; certainly,  
if they are reachable in practice, we've got problems with requirements  
as basic as maintaining a btree index on a text column.  
  
Hence, run around to all the SQL functions that derive from varstr_cmp()  
and mark them leakproof.  This should result in a useful gain in  
flexibility/performance for queries in which non-leakproofness degrades  
the efficiency of the query plan.  
  
Back-patch to v12 where nondeterministic collations were added.  
While this isn't an essential bug fix given the determination  
that varstr_cmp() is leakproof, we might as well apply it now that  
we've been forced into a post-beta4 catversion bump.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Fix up handling of nondeterministic collations with pattern_ops opclasses.

commit   : d3c61e88d94cba2070574dccbfba06bbc738c876    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 16:29:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 16:29:17 -0400    

Click here for diff

text_pattern_ops and its siblings can't be used with nondeterministic  
collations, because they use the text_eq operator which will not behave  
as bitwise equality if applied with a nondeterministic collation.  The  
initial implementation of that restriction was to insert a run-time test  
in the related comparison functions, but that is inefficient, may throw  
misleading errors, and will throw errors in some cases that would work.  
It seems sufficient to just prevent the combination during CREATE INDEX,  
so do that instead.  
  
Lacking any better way to identify the opclasses involved, we need to  
hard-wire tests for them, which requires hand-assigned values for their  
OIDs, which forces a catversion bump because they previously had OIDs  
that would be assigned automatically.  That's slightly annoying in the  
v12 branch, but fortunately we're not at rc1 yet, so just do it.  
  
Back-patch to v12 where nondeterministic collations were added.  
  
In passing, run make reformat-dat-files, which found some unrelated  
whitespace issues (slightly different ones in HEAD and v12).  
  
Peter Eisentraut, with small corrections by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_proc.dat

Doc: updates for v12 release notes.

commit   : 25f9368304e41c8837f59e94b161f07ac4c7d622    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 15:23:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Sep 2019 15:23:53 -0400    

Click here for diff

Remove mention of ECPG's DECLARE STATEMENT, since that was reverted  
yesterday.  Rewrite some other entries per suggestions from Peter  
Eisentraut.  Make a couple of desultory wording and markup adjustments.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update time zone data files to tzdata release 2019c.

commit   : 2966e30e553b12d2d25aea184f52f9c6ffbcee51    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 19:53:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 19:53:33 -0400    

Click here for diff

DST law changes in Fiji and Norfolk Island.  Historical corrections  
for Alberta, Austria, Belgium, British Columbia, Cambodia, Hong Kong,  
Indiana (Perry County), Kaliningrad, Kentucky, Michigan, Norfolk  
Island, South Korea, and Turkey.  

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

Fix some minor spec-compliance issues in jsonpath lexer.

commit   : 5f3bec0769c1d3c345ee2de30de271dce4feb469    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 14:22:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 14:22:58 -0400    

Click here for diff

Although the SQL/JSON tech report makes reference to ECMAScript which  
allows both single- and double-quoted strings, all the rest of the  
report speaks only of double-quoted string literals in jsonpaths.  
That's more compatible with JSON itself; moreover single-quoted strings  
are hard to use inside a jsonpath that is itself a single-quoted SQL  
literal.  So guess that the intent is to allow only double-quoted  
literals, and remove lexer support for single-quoted literals.  
It'll be less painful to add this again later if we're wrong, than to  
remove a shipped feature.  
  
Also, adjust the lexer so that unrecognized backslash sequences are  
treated as just meaning the escaped character, not as errors.  This  
change has much better support in the standards, as JSON, JavaScript  
and ECMAScript all make it plain that that's what's supposed to  
happen.  
  
Back-patch to v12.  
  
Discussion: https://postgr.es/m/CAPpHfdvDci4iqNF9fhRkTqhe-5_8HmzeLt56drH%[email protected]  

M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/jsonpath_encoding.out
M src/test/regress/expected/jsonpath_encoding_1.out
M src/test/regress/sql/jsonpath.sql
M src/test/regress/sql/jsonpath_encoding.sql

Revert "Add DECLARE STATEMENT support to ECPG."

commit   : 08e04a5f99d50285edf8e89a18da67ce2d75d676    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 12:47:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Sep 2019 12:47:21 -0400    

Click here for diff

This reverts commit bd7c95f0c1a38becffceb3ea7234d57167f6d4bf,  
along with assorted follow-on fixes.  There are some questions  
about the definition and implementation of that statement, and  
we don't have time to resolve them before v13 release.  Rather  
than ship the feature and then have backwards-compatibility  
concerns constraining any redesign, let's remove it for now  
and try again later.  
  
Discussion: https://postgr.es/m/TY2PR01MB2443EC8286995378AEB7D9F8F5B10@TY2PR01MB2443.jpnprd01.prod.outlook.com  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/connect.c
D src/interfaces/ecpg/ecpglib/cursor.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/exports.txt
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/include/ecpgerrno.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/ecpgtype.h
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/ecpg_schedule
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/preproc-autoprep.c
M src/interfaces/ecpg/test/expected/preproc-cursor.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
M src/interfaces/ecpg/test/expected/sql-binary.c
D src/interfaces/ecpg/test/expected/sql-declare.c
D src/interfaces/ecpg/test/expected/sql-declare.stderr
D src/interfaces/ecpg/test/expected/sql-declare.stdout
M src/interfaces/ecpg/test/expected/sql-desc.c
M src/interfaces/ecpg/test/expected/sql-dyntest.c
M src/interfaces/ecpg/test/expected/sql-execute.c
M src/interfaces/ecpg/test/expected/sql-fetch.c
M src/interfaces/ecpg/test/expected/sql-oldexec.c
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/sql/.gitignore
M src/interfaces/ecpg/test/sql/Makefile
D src/interfaces/ecpg/test/sql/declare.pgc

Fix progress report of REINDEX INDEX

commit   : c3c131e295af6530381a8ace749c81fcc8930059    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 12:53:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 Sep 2019 12:53:58 -0300    

Click here for diff

I (Álvaro) broke that in commit 6212276e4343 -- forgot to set the  
necessary flag.  Repair.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqEaM2tV5awKhP1vSbgjQe_uXVU15Oi4sTgwgempwMiT8g@mail.gmail.com  

M src/backend/commands/indexcmds.c

Provide stable test for NULL-values in KNN SP-GiST

commit   : d75386a3fd34d8902667474318c2ebe40978de32    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 15:31:12 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 15:31:12 +0300    

Click here for diff

f5f084fc3e has removed test because of its instability.  This commit provides  
alternative test with determined ordering using extra ORDER BY expression.  
  
Backpatch-through: 12  

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

Fix typo in commit 82fa3ff8672.

commit   : 09f8106b968e10c7855c0a9fd07dd3520d30e4eb    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 20 Sep 2019 07:38:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 20 Sep 2019 07:38:06 +0530    

Click here for diff

Reported-By: Kuntal Ghosh (off-list)  
Backpatch-through: 9.4, like 82fa3ff8672  

M doc/src/sgml/maintenance.sgml

Remove unstable KNN SP-GiST test

commit   : 340536dd489286d0f98878843390d92ddc593be0    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 01:46:49 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 01:46:49 +0300    

Click here for diff

6cae9d2c10 introduced test for NULL values in KNN SP-GiST.  This test relies on  
undetermined ordering showing different results on various platforms.  This  
commit removes that test.  Will be replaced with better test later.  
  
Discussion: https://postgr.es/m/6d51305e1159241cabee132f7efc7eff%40xs4all.nl  
Backpatch-through: 12  

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

Fix freeing old values in index_store_float8_orderby_distances()

commit   : 8c58e480d9ddecbe94badc737d60c866974144b5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 01:10:56 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 20 Sep 2019 01:10:56 +0300    

Click here for diff

6cae9d2c10 has added an error in freeing old values in  
index_store_float8_orderby_distances() function.  It looks for old value in  
scan->xs_orderbynulls[i] after setting a new value there.  
This commit fixes that.  Also it removes short-circuit in handling  
distances == NULL situation.  Now distances == NULL will be treated the same  
way as array with all null distances.  That is, previous values will be freed  
if any.  
  
Reported-by: Tom Lane, Nikita Glukhov  
Discussion: https://postgr.es/m/CAPpHfdu2wcoAVAm3Ek66rP%3Duo_C-D84%2B%2Buf1VEcbyi_caBXWCA%40mail.gmail.com  
Discussion: https://postgr.es/m/426580d3-a668-b9d1-7b8e-f74d1a6524e0%40postgrespro.ru  
Backpatch-through: 12  

M src/backend/access/index/indexam.c

Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

commit   : 31cbd760578fc0aeb87db11422c32afaf5de129b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 19 Sep 2019 21:30:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 19 Sep 2019 21:30:19 +0300    

Click here for diff

This commit improves subject in two ways:  
  
 * It removes ugliness of 02f90879e7, which stores distance values and null  
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack  
   both distance value and null flag in IndexOrderByDistance struct.  Alignment  
   overhead should be negligible, because we typically deal with at most few  
   "col op const" expressions in ORDER BY clause.  
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these  
   expression are not passed to support functions, which can't deal with them.  
   Instead, NULL result is implicitly assumed.  It future we may decide to  
   teach support functions to deal with NULL arguments, but current solution is  
   bugfix suitable for backpatch.  
  
Reported-by: Nikita Glukhov  
Discussion: https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru  
Author: Nikita Glukhov  
Reviewed-by: Alexander Korotkov  
Backpatch-through: 9.4  

M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/access/index/indexam.c
M src/backend/access/spgist/spgscan.c
M src/include/access/genam.h
M src/include/access/gist_private.h
M src/include/access/spgist_private.h
M src/test/regress/expected/create_index_spgist.out
M src/test/regress/sql/create_index_spgist.sql
M src/tools/pgindent/typedefs.list

Doc: improve documentation around jsonpath regular expressions.

commit   : b9cf94c8c2496af30dcdf7cea083463f6464dff0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Sep 2019 11:22:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Sep 2019 11:22:21 -0400    

Click here for diff

Provide some documentation about the differences between XQuery  
regular expressions and those supported by Spencer's regex engine.  
Since SQL now exposes XQuery regexps with the LIKE_REGEX operator,  
I made this a standalone section designed to help somebody who  
has to translate a LIKE_REGEX query to Postgres.  (Eventually we might  
extend Spencer's engine to allow precise implementation of XQuery,  
but not today.)  
  
Reference that in the jsonpath docs, provide definitions of the  
XQuery flag letters, and add a description of the JavaScript-inspired  
string literal syntax used within jsonpath.  Also point out explicitly  
that backslashes used within like_regex patterns will need to be doubled.  
  
This also syncs the docs with the decision implemented in commit  
d5b90cd64 to desupport XQuery's 'x' flag for now.  
  
Jonathan Katz and Tom Lane  
  
Discussion: https://postgr.es/m/CAPpHfdvDci4iqNF9fhRkTqhe-5_8HmzeLt56drH%[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

GSSAPI error message improvements

commit   : 596cf9e806826936869f62232bd011687c467965    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 15:03:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 15:03:23 +0200    

Click here for diff

Make the error messages around GSSAPI encryption a bit clearer.  Tweak  
some messages to avoid plural problems.  
  
Also make a code change for clarity.  Using "conf" for "confidential"  
is quite confusing.  Using "conf_state" is perhaps not much better but  
that's what the GSSAPI documentation uses, so there is at least some  
hope of understanding it.  

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

doc: Improve a release notes item

commit   : 9c4f20066fb20197dfc20e3cf31aa3c890f3646b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 11:46:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 11:46:40 +0200    

Click here for diff

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

Fix typo in commit 578b229718.

commit   : a4188a65be9426136fc176430ea646cb0fa04fff    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 Sep 2019 14:40:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 Sep 2019 14:40:09 +0530    

Click here for diff

Reported-by: Filip Rembiałkowski  
Author: Filip Rembiałkowski  
Backpatch-through: 12, where it was introduced  
Discussion: https://postgr.es/m/CAP_rwwmSNy1=_82rwGe3-X4PjWqPSFXtzNf43DCtGzD7SazdXA@mail.gmail.com  

M doc/src/sgml/ref/create_table_as.sgml

doc: Some release notes tweaking

commit   : 1aaa3ee34466780d6f050b7d4aa5cc69935c08b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 09:58:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 09:58:43 +0200    

Click here for diff

Improve the LDAP DNS SRV item.  

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

Revert change of ecpglib major version

commit   : fbd1cb2fd9796a08a198d929774280ecce933057    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 09:02:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Sep 2019 09:02:41 +0200    

Click here for diff

The major version of ecpglib was changed in  
bd7c95f0c1a38becffceb3ea7234d57167f6d4bf, apparently without  
justification.  Revert this, since nothing has changed in this library  
except some added functions.  
  
Discussion: https://www.postgresql.org/message-id/flat/48ee4c56-e1df-b39d-2cad-c7d80b120eb5%402ndquadrant.com  

M src/interfaces/ecpg/ecpglib/Makefile

Doc: Fix incorrect mention to connection_object in CONNECT command of ECPG

commit   : ae2d826922b745ea2c77c51019948ccf4309f50f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Sep 2019 13:19:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Sep 2019 13:19:00 +0900    

Click here for diff

This fixes an inconsistency with this parameter name not listed in the  
command synopsis, and connection_name is the parameter name more  
commonly used in the docs for ECPG commands.  
  
Reported-by: Yusuke Egashita  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/ecpg.sgml

Doc: document autovacuum interruption.

commit   : 62ed5e77f3dc6d8c65d917b60dc8512ddd6fd18e    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 Sep 2019 08:02:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 Sep 2019 08:02:12 +0530    

Click here for diff

It's important users be able to know (without looking at the source code)  
that running DDL or DDL-like commands can interrupt autovacuum which can  
lead to a lot of dead tuples and hence slower database operations.  
  
Reported-by: James Coleman  
Author: James Coleman  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/CAAaqYe-XYyNwML1=f=gnd0qWg46PnvD=BDrCZ5-L94B887XVxQ@mail.gmail.com  

M doc/src/sgml/maintenance.sgml

pg_upgrade/test.sh: Quote sed(1) argument

commit   : cb23c63bc6de3ecef2a6a9d58d44640865472da4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 Sep 2019 11:24:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 Sep 2019 11:24:12 -0300    

Click here for diff

Lack of quotes results in failure to run the test under older Solaris.  
  
Author: Marina Polyakova, Victor Wagner  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Doc: Update FDW documentation about direct foreign table modification.

commit   : 68c3c493674d81131c8f2685b91ec8de4fdcb862    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 18 Sep 2019 18:50:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 18 Sep 2019 18:50:01 +0900    

Click here for diff

1. Commit 7086be6e3 should have documented the limitation that the direct  
   modification is disabled when WCO constraints are present, but didn't,  
   which is definitely my fault.  Update the documentation (Postgres 9.6  
   onwards).  
  
2. Commit fc22b6623 should have documented the limitation that the direct  
   modification is disabled when generated columns are defined, but  
   didn't.  Update the documentation (Postgres 12 onwards).  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/CAPmGK14AYCPunLb6TRz1CQsW5Le01Z2ox8LSOKH0P-cOVDcQRA%40mail.gmail.com  

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

Fix bogus handling of XQuery regex option flags.

commit   : 14888145420802a32ec018246e12f3b377c61c29    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Sep 2019 15:39:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Sep 2019 15:39:51 -0400    

Click here for diff

The SQL spec defers to XQuery to define what the option flags are  
for LIKE_REGEX patterns.  XQuery says that:  
* 's' allows the dot character to match newlines, which by  
  default it will not;  
* 'm' allows ^ and $ to match at newlines, not only at the  
  start/end of the whole string.  
Thus, these are *not* inverses as they are for the similarly-named  
POSIX options, and neither one corresponds to the POSIX 'n' option.  
Fortunately, Spencer's library does expose these two behaviors as  
separately twiddlable flags, so we just have to fix the mapping from  
JSP flag bits to REG flag bits.  I also chose to rename the symbol  
for 's' to DOTALL, to make it clearer that it's not the inverse  
of MLINE.  
  
Also, XQuery says that if the 'q' flag "is used together with the m, s,  
or x flag, that flag has no effect".  I read this as saying that 'q'  
overrides the other flags; whoever wrote our code seems to have read  
it backwards.  
  
Lastly, while XQuery's 'x' flag is related to what Spencer's code  
does for REG_EXPANDED, it's not the same or a subset.  It seems best  
to treat XQuery's 'x' as unimplemented for now.  Maybe later we can  
expand our regex code to offer 'x'-style parsing as a separate option.  
  
While at it, refactor the jsonpath code so that (a) there's only  
one copy of the flag transformation logic not two, and (b) the  
processing of flags is independent of the order in which the flags  
are written.  
  
We need some documentation updates to go with this, but I'll  
tackle that separately.  
  
Back-patch to v12 where this code originated.  
  
Discussion: https://postgr.es/m/CAPpHfdvDci4iqNF9fhRkTqhe-5_8HmzeLt56drH%[email protected]  
Reference: https://www.w3.org/TR/2017/REC-xpath-functions-31-20170321/#flags  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql

Fix bogus sizeof calculations.

commit   : 27bc87985c4135f27bdcddd905baad3b62a3f03a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 15 Sep 2019 11:51:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 15 Sep 2019 11:51:57 -0400    

Click here for diff

Noted by Coverity.  Typo in 27cc7cd2b, so back-patch to v12  
as that was.  

M src/backend/executor/execMain.c

Fix intermittent self-test failures caused by the stats_ext test.

commit   : 5576cbc8ff1f8b34e519e54ef43de68ed1b2f93e    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 15 Sep 2019 13:16:59 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 15 Sep 2019 13:16:59 +0100    

Click here for diff

Commit d7f8d26d9 added new tests to the stats_ext regression test that  
included creating a view in the public schema, without realising that  
the stats_ext test runs in the same parallel group as the rules test,  
which makes doing that unsafe.  
  
This led to intermittent failures of the rules test on the buildfarm,  
although I wasn't able to reproduce that locally. Fix by creating the  
view in a different schema.  
  
Tomas Vondra and Dean Rasheed, report and diagnosis by Thomas Munro.  
  
Discussion: https://postgr.es/m/CA+hUKGKX9hFZrYA7rQzAMRE07L4hziCc-nO_b3taJpiuKyLLxg@mail.gmail.com  

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

Replace xlc __fetch_and_add() with inline asm.

commit   : 1c6b62a7d0e57bf9ac7a91d47484b1ea9f2857cd    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:34:06 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:34:06 -0700    

Click here for diff

PostgreSQL has been unusable when built with xlc 13 and newer, which are  
incompatible with our use of __fetch_and_add().  Back-patch to 9.5,  
which introduced pg_atomic_fetch_add_u32().  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port/atomics/generic-xlc.h

Test pg_atomic_fetch_add_ with variable addend and 16-bit edge cases.

commit   : 5b5b0f721d9cece8fb68ecdd1d53c3bffe6e753c    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:33:30 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 13 Sep 2019 19:33:30 -0700    

Click here for diff

Back-patch to 9.5, which introduced these functions.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/regress.c

logical decoding: process ASSIGNMENT during snapshot build

commit   : 96b5033e117141eecf3782ee555f39b3006a732f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 16:36:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 16:36:28 -0300    

Click here for diff

Most WAL records are ignored in early SnapBuild snapshot build phases.  
But it's critical to process some of them, so that later messages have  
the correct transaction state after the snapshot is completely built; in  
particular, XLOG_XACT_ASSIGNMENT messages are critical in order for  
sub-transactions to be correctly assigned to their parent transactions,  
or at least one assert misbehaves, as reported by Ildar Musin.  
  
Diagnosed-by: Masahiko Sawada  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAONYFtOv+Er1p3WAuwUsy1zsCFrSYvpHLhapC_fMD-zNaRWxYg@mail.gmail.com  

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

Fix under-parenthesized macro definitions

commit   : a0a40f611e9af81507a48f7fd96833ad57c8e4ae    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 16:26:55 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 16:26:55 -0300    

Click here for diff

Lack of parens in the definitions could cause a statement using these  
macros to have unexpected semantics.  In current code no bug is  
apparent, but best to fix the definitions to avoid problems down the  
line.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/include/nodes/parsenodes.h

Fix progress reporting of CLUSTER / VACUUM FULL

commit   : da47e43dc32e3c5916396f0cbcfa974b371e4875    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 14:51:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Sep 2019 14:51:13 -0300    

Click here for diff

The progress state was being clobbered once the first index completed  
being rebuilt, causing the final phases of the operation not show  
anything in the progress view.  This was inadvertently broken in  
03f9e5cba0ee, which added progress tracking for REINDEX.  
  
(The reason this bugfix is this small is that I had already noticed this  
problem when writing monitoring for CREATE INDEX, and had already worked  
around it, as can be seen in discussion starting at  
https://postgr.es/m/[email protected] Fixing the  
problem is just a matter of fixing one place touched by the REINDEX  
monitoring.)  
  
Reported by: Álvaro Herrera  
Author: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/include/nodes/parsenodes.h

Typo fixes for documentation

commit   : 6eb9b20bb7dd770c78bf43b205b98e15972e2341    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 13 Sep 2019 17:21:20 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 13 Sep 2019 17:21:20 +0300    

Click here for diff

Discussion: https://postgr.es/m/CAEkD-mDUZrRE%3Dk-FznEg4Ed2VdjpZCyHoyo%2Bp0%2B8KvHqR%3DpNVQ%40mail.gmail.com  
Author: Liudmila Mantrova, Alexander Lakhin  
Reviewed-by: Alexander Korotkov, Alvaro Herrera  
Backpatch-through: 12  

M doc/src/sgml/charset.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml

Documentation improvements to jsonpath

commit   : 9f771868c446c44dae6b97c68eeb1b19da32c50a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 13 Sep 2019 17:12:20 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 13 Sep 2019 17:12:20 +0300    

Click here for diff

Besides cosmetic improvements it removes statement that operators necessary  
need to be separated from operands with spaces, which is not really true.  
  
Discussion: https://postgr.es/m/CAEkD-mDUZrRE%3Dk-FznEg4Ed2VdjpZCyHoyo%2Bp0%2B8KvHqR%3DpNVQ%40mail.gmail.com  
Author: Liudmila Mantrova, Alexander Lakhin  
Reviewed-by: Alexander Korotkov, Alvaro Herrera  
Backpatch-through: 12  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

Fix nbtree page split rmgr desc routine.

commit   : 3097a0d6e9e28137691a2e89949f1b525160de2d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 12 Sep 2019 15:45:07 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 12 Sep 2019 15:45:07 -0700    

Click here for diff

Include newitemoff in rmgr desc output for nbtree page split records.  
In passing, correct an obsolete comment that claimed that newitemoff is  
only logged for _L variant nbtree page split WAL records.  
  
Both issues were oversights in commit 2c03216d831, which revamped the  
WAL format.  
  
Author: Peter Geoghegan  
Backpatch: 9.5-, where the WAL format was revamped.  

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

Fix usage of whole-row variables in WCO and RLS policy expressions.

commit   : 5e9b18c78789aa905d7aba8e0f0729e965aa32fd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Sep 2019 18:29:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Sep 2019 18:29:17 -0400    

Click here for diff

Since WITH CHECK OPTION was introduced, ExecInitModifyTable has  
initialized WCO expressions with the wrong plan node as parent -- that is,  
it passed its input subplan not the ModifyTable node itself.  Up to now  
we thought this was harmless, but bug #16006 from Vinay Banakar shows it's  
not: if the input node is a SubqueryScan then ExecInitWholeRowVar can get  
confused into doing the wrong thing.  (The fact that ExecInitWholeRowVar  
contains such logic is certainly a horrid kluge that doesn't deserve to  
live, but figuring out another way to do that is a task for some other day.)  
  
Andres had already noticed the wrong-parent mistake and fixed it in commit  
148e632c0, but not being aware of any user-visible consequences, he quite  
reasonably didn't back-patch.  This patch is simply a back-patch of  
148e632c0, plus addition of a test case based on bug #16006.  I also added  
the test case to v12/HEAD, even though the bug is already fixed there.  
  
Back-patch to all supported branches.  9.4 lacks RLS policies so the  
new test case doesn't work there, but I'm pretty sure a test could be  
devised based on using a whole-row Var in a plain WITH CHECK OPTION  
condition.  (I lack the cycles to do so myself, though.)  
  
Andres Freund and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: Update PL/pgSQL sample function in plpgsql.sgml.

commit   : fef55c569eeda4286451f4fb884ad7d3b1de29fd    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 11 Sep 2019 10:25:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 11 Sep 2019 10:25:49 +0530    

Click here for diff

The example used to explain 'Looping Through Query Results' uses  
pseudo-materialized views.  Replace it with a more up-to-date example  
which does the same thing with actual materialized views, which have  
been available since PostgreSQL 9.3.  
  
In the passing, change '%' as format specifier instead of '%s' as is used  
in other examples in plpgsql.sgml.  
  
Reported-by: Ian Barwick  
Author: Ian Barwick  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml

Expand properly list of TAP tests used for prove in vcregress.pl

commit   : dc92bf5cad7ccae294ec7055382c7727726702cc    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Sep 2019 11:07:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Sep 2019 11:07:25 +0900    

Click here for diff

Depending on the system used, t/*.pl may not be expanded into a list of  
tests which can be consumed by prove when attempting to run TAP tests on  
a given path.  Fix that by using glob() directly in the script, to make  
sure that a complete list of tests is provided.  This has not proved to  
be an issue with MSVC as the list was properly expanded, but it is on  
Linux with perl's system().  
  
This is extracted from a larger patch.  
  
Author: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M src/tools/msvc/vcregress.pl

Don't drop NOTICE messages in isolation tests.

commit   : b1016834d325dff5eb168e5f6f261462eb6f1d56    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Sep 2019 12:04:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Sep 2019 12:04:57 -0400    

Click here for diff

For its entire existence, isolationtester.c has forced client_min_messages  
to WARNING, but that seems like a very poor choice of test design.  It  
should be up to individual test scripts to manage whether they emit notices  
and to ensure that the results are stable.  (There were no NOTICE messages  
in the original set of isolation tests, so this was certainly dead code  
when committed, but perhaps it was needed at some earlier point.)  
  
It's possible that the original motivation was due to platform-dependent  
variations in the timing of stdout vs. stderr output.  That should be  
moot since commits 73bcb76b7/6eda3e9c2, but just in case, adjust  
isotesterNoticeProcessor to print to stdout not stderr.  (stderr seems  
like the wrong thing anyway: it should be for error printouts not expected  
test output.)  
  
Back-patch of commit ebd499282 into v12.  I'll separately push this  
into older branches, but this is as much change as v12 needs.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/expected/plpgsql-toast.out
M src/test/isolation/isolationtester.c
M src/test/isolation/specs/plpgsql-toast.spec

Fix isolationtester race condition for notices sent before blocking.

commit   : 97fb88ea4a646343d5f0a8cd65b7e5f598785cb4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Sep 2019 22:53:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Sep 2019 22:53:51 -0400    

Click here for diff

If a test sends a notice just before blocking, it's possible on  
slow machines for isolationtester to detect the blocked state before  
it's consumed the notice.  (For this to happen, the notice would have  
to arrive after isolationtester has waited for data for 10ms, so on  
fast/lightly-loaded machines it's hard to reproduce the failure.)  
But, if we have seen the backend as blocked, it's certainly already  
sent any notices it's going to send.  Therefore, one more round of  
PQconsumeInput and PQisBusy should be enough to collect and process  
any such notices.  
  
Back-patch of 30717637c into v12.  We're still discussing whether  
to back-patch this further and/or back-patch some other recent  
isolationtester fixes, but this much is provably necessary to  
make the test cases added by 27cc7cd2b stable in v12.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/isolationtester.c

Stamp 12beta4.

commit   : 84bb33c4804ea26b3f23df875701731bd01d3f0a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Sep 2019 16:24:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Sep 2019 16:24:29 -0400    

Click here for diff

M configure
M configure.in
M src/include/pg_config.h.win32

Be more careful about port selection in src/test/ldap/.

commit   : 5348e22b969f6af8bd4400256a6a190721a01f34    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Sep 2019 14:21:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Sep 2019 14:21:40 -0400    

Click here for diff

Don't just assume that the next port is free; it might not be, or  
if we're really unlucky it might even be out of the TCP range.  
Do it honestly with two get_free_port() calls instead.  
  
This is surely a pretty low-probability problem, but I think it  
explains a buildfarm failure seen today, so let's fix it.  
  
Back-patch to v11 where this script was added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Prevent msys2 conversion of "cmd /c" switch to a file path

commit   : 9668b02f80425dc72116101cb368c6ac1cc210a1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 9 Sep 2019 08:56:33 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 9 Sep 2019 08:56:33 -0400    

Click here for diff

Modern versions of msys2 have changed the treatment of "cmd /c" so that  
the runtime will try to convert the switch to a native file path. This  
patch adds a setting to inhibit that behaviour.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to all live branches.  

M src/bin/pg_upgrade/test.sh

Always skip recovery SysV shared memory tests on Windows

commit   : 7d49803259de7514e16dfdf2b6a36e7b514f0505    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 9 Sep 2019 08:42:06 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 9 Sep 2019 08:42:06 -0400    

Click here for diff

These tests were disabled on git master in commit 8e5ce1c3f8. This does  
the same thing on the back branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/017_shm.pl

commit   : 3fb307bc4a76815f96fec28a0d1525ab3fbbcfb4    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 9 Sep 2019 05:21:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 9 Sep 2019 05:21:30 -0700    

Click here for diff

In ad0bda5d24ea I changed the EvalPlanQual machinery to store  
substitution tuples in slot, instead of using plain HeapTuples. The  
main motivation for that was that using HeapTuples will be inefficient  
for future tableams.  But it turns out that that conversion was buggy  
for non-locking rowmarks - the wrong tuple descriptor was used to  
create the slot.  
  
As a secondary issue 5db6df0c0 changed ExecLockRows() to begin EPQ  
earlier, to allow to fetch the locked rows directly into the EPQ  
slots, instead of having to copy tuples around. Unfortunately, as Tom  
complained, that forces some expensive initialization to happen  
earlier.  
  
As a third issue, the test coverage for EPQ was clearly insufficient.  
  
Fixing the first issue is unfortunately not trivial: Non-locked row  
marks were fetched at the start of EPQ, and we don't have the type  
information for the rowmarks available at that point. While we could  
change that, it's not easy. It might be worthwhile to change that at  
some point, but to fix this bug, it seems better to delay fetching  
non-locking rowmarks when they're actually needed, rather than  
eagerly. They're referenced at most once, and in cases where EPQ  
fails, might never be referenced. Fetching them when needed also  
increases locality a bit.  
  
To be able to fetch rowmarks during execution, rather than  
initialization, we need to be able to access the active EPQState, as  
that contains necessary data. To do so move EPQ related data from  
EState to EPQState, and, only for EStates creates as part of EPQ,  
reference the associated EPQState from EState.  
  
To fix the second issue, change EPQ initialization to allow use of  
EvalPlanQualSlot() to be used before EvalPlanQualBegin() (but  
obviously still requiring EvalPlanQualInit() to have been done).  
  
As these changes made struct EState harder to understand, e.g. by  
adding multiple EStates, significantly reorder the members, and add a  
lot more comments.  
  
Also add a few more EPQ tests, including one that fails for the first  
issue above. More is needed.  
  
Reported-By: yi huang  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion:  
    https://postgr.es/m/CAHU7rYZo_C4ULsAx_LAj8az9zqgrD8WDd4hTegDTMM1LMqrBsg@mail.gmail.com  
    https://postgr.es/m/[email protected]  
Backpatch: 12-, where the EPQ changes were introduced  

M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execScan.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Fix handling of non-key columns get_index_column_opclass()

commit   : c6ce5f71b08235f9ed8e0206267ae560ea1ebc91    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 9 Sep 2019 13:50:12 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 9 Sep 2019 13:50:12 +0300    

Click here for diff

f2e40380 introduces support of non-key attributes in GiST indexes.  Then if  
get_index_column_opclass() is asked by gistproperty() to get an opclass of  
non-key column, it returns garbage past oidvector value.  This commit fixes  
that by making get_index_column_opclass() return InvalidOid in this case.  
  
Discussion: https://postgr.es/m/20190902231948.GA5343%40alvherre.pgsql  
Author: Nikita Glukhov, Alexander Korotkov  
Backpatch-through: 12  

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

Translation updates

commit   : 55a808c1a899380bff3340ed8d896d06f0b19f9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 Sep 2019 11:34:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 Sep 2019 11:34:06 +0200    

Click here for diff

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

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

Improve new AND CHAIN tests

commit   : ef48a0573bf0fc5c7e23f077788a055aad9f5e9e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 Sep 2019 10:30:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 Sep 2019 10:30:22 +0200    

Click here for diff

Tweak the tests so that we're not just testing the default setting of  
transaction_read_only.  
  
Reported-by: fn ln <[email protected]>  

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

Fix RelationIdGetRelation calls that weren't bothering with error checks.

commit   : 2403e54fff3b47735fc1a77c51e407c3596d3331    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Sep 2019 17:00:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Sep 2019 17:00:29 -0400    

Click here for diff

Some of these are quite old, but that doesn't make them not bugs.  
We'd rather report a failure via elog than SIGSEGV.  
  
While at it, uniformly spell the error check as !RelationIsValid(rel)  
rather than a bare rel == NULL test.  The machine code is the same  
but it seems better to be consistent.  
  
Coverity complained about this today, not sure why, because the  
mistake is in fact old.  

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

Fix handling of NULL distances in KNN-GiST

commit   : e6af7b367cf46fc385307efcef5a1fece0e5fef3    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 8 Sep 2019 21:13:40 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 8 Sep 2019 21:13:40 +0300    

Click here for diff

In order to implement NULL LAST semantic GiST previously assumed distance to  
the NULL value to be Inf.  However, our distance functions can return Inf and  
NaN for non-null values.  In such cases, NULL LAST semantic appears to be  
broken.  This commit fixes that by introducing separate array of null flags for  
distances.  
  
Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/CAPpHfdsNvNdA0DBS%2BwMpFrgwT6C3-q50sFVGLSiuWnV3FqOJuQ%40mail.gmail.com  
Author: Alexander Korotkov  
Backpatch-through: 9.4  

M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/access/index/indexam.c
M src/backend/access/spgist/spgscan.c
M src/include/access/genam.h
M src/include/access/gist_private.h
M src/test/regress/expected/create_index.out

Fix handling Inf and Nan values in GiST pairing heap comparator

commit   : bc67f4189a7a3381db76dbfeafca463187bfe87a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 8 Sep 2019 21:07:30 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 8 Sep 2019 21:07:30 +0300    

Click here for diff

Previously plain float comparison was used in GiST pairing heap.  Such  
comparison doesn't provide proper ordering for value sets containing Inf and Nan  
values.  This commit fixes that by usage of float8_cmp_internal().  Note, there  
is remaining problem with NULL distances, which are represented as Inf in  
pairing heap.  It would be fixes in subsequent commit.  
  
Backpatch to all supported versions.  
  
Reported-by: Andrey Borodin  
Discussion: https://postgr.es/m/CAPpHfdsNvNdA0DBS%2BwMpFrgwT6C3-q50sFVGLSiuWnV3FqOJuQ%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Heikki Linnakangas  
Backpatch-through: 9.4  

M src/backend/access/gist/gistscan.c
M src/test/regress/expected/create_index.out

Fix behavior of AND CHAIN outside of explicit transaction blocks

commit   : b6d72ddd5fbf3f6eb79597ab0c8ec3aaa7c16805    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 16:11:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 16:11:21 +0200    

Click here for diff

When using COMMIT AND CHAIN or ROLLBACK AND CHAIN not in an explicit  
transaction block, the previous implementation would leave a  
transaction block active in the ROLLBACK case but not the COMMIT case.  
To fix for now, error out when using these commands not in an explicit  
transaction block.  This restriction could be lifted if a sensible  
definition and implementation is found.  
  
Bug: #15977  
Author: fn ln <[email protected]>  
Reviewed-by: Fabien COELHO <[email protected]>  

M doc/src/sgml/ref/commit.sgml
M doc/src/sgml/ref/rollback.sgml
M src/backend/access/transam/xact.c
M src/test/regress/expected/transactions.out
M src/test/regress/sql/transactions.sql

doc: effective -> efficient

commit   : 422910423b6cba6abc3790b8f20854c9e78e04a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 11:10:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 11:10:49 +0200    

Click here for diff

M doc/src/sgml/json.sgml

doc: Clean up title case use

commit   : eecd7c3d2b44094d00e967c7283fc2236d8def5d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 10:26:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Sep 2019 10:26:35 +0200    

Click here for diff

Note: Following existing practice, titles of formalpara and step are  
not titlecased.  

M doc/src/sgml/amcheck.sgml
M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/intro.sgml
M doc/src/sgml/jit.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/limits.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgtesttiming.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/sourcerepo.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/tablesample-method.sgml
M doc/src/sgml/xaggr.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xindex.sgml
M doc/src/sgml/xoper.sgml
M doc/src/sgml/xtypes.sgml

Avoid using INFO elevel for what are fundamentally debug messages.

commit   : 121e3ceed6d93c2891208005f0b270ee80dc13e7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Sep 2019 19:03:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Sep 2019 19:03:11 -0400    

Click here for diff

Commit 6f6b99d13 stuck an INFO message into the fast path for  
checking partition constraints, for no very good reason except  
that it made it easy for the regression tests to verify that  
that path was taken.  Assorted later patches did likewise,  
increasing the unsuppressable-chatter level from ALTER TABLE  
even more.  This isn't good for the user experience, so let's  
drop these messages down to DEBUG1 where they belong.  So as  
not to have a loss of test coverage, create a TAP test that  
runs the relevant queries with client_min_messages = DEBUG1  
and greps for the expected messages.  
  
This testing method is a bit brute-force --- in particular,  
it duplicates the execution of a fair amount of the core  
create_table and alter_table tests.  We experimented with  
other solutions, but running any significant amount of  
standard testing with client_min_messages = DEBUG1 seems  
to have a lot of output-stability pitfalls, cf commits  
bbb96c370 and 5655565c0.  Possibly at some point we'll look  
into whether we can reduce the amount of test duplication.  
  
Backpatch into v12, because some of these messages are new  
in v12 and we don't really want to ship it that way.  
  
Sergei Kornilov  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/partitioning/partbounds.c
M src/test/modules/Makefile
A src/test/modules/test_misc/.gitignore
A src/test/modules/test_misc/Makefile
A src/test/modules/test_misc/README
A src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/tools/msvc/Mkvcbuild.pm

Doc: make an editing pass over the v12 release notes.

commit   : b6a4d0498757a6e345e07b2a84eb8333f5e5235e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Sep 2019 11:21:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Sep 2019 11:21:24 -0400    

Click here for diff

Copy-edit or rewrite some items, add some items that I thought  
deserved documenting, remove some others that didn't (notably,  
I'm not on board with documenting documentation changes), fix  
some poorly-pointed links, move some items to other sections,  
etc etc.  

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

Message style fixes

commit   : 2552c78c18a1cb11d0f49a3af0660a477f81839d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 16:12:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 16:12:28 +0200    

Click here for diff

M src/bin/psql/command.c
M src/bin/psql/help.c
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/test/expected/sql-declare.stderr
M src/interfaces/libpq/fe-connect.c

doc: Fix awkward markup

commit   : ce35a265a438813cd337307b6997a58ac87bf9c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 22:19:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 22:19:53 +0200    

Click here for diff

M doc/src/sgml/ref/pg_dumpall.sgml

doc: Postgres -> PostgreSQL

commit   : 69116b743af01bd0ab87b5dfc7395029002e23a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 22:16:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 22:16:58 +0200    

Click here for diff

M doc/src/sgml/bki.sgml
M doc/src/sgml/installation.sgml

Update v12 release notes through today, and add major-enhancements list.

commit   : 700a1ac073730eca8b2d2235ced133f563a26a1b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Sep 2019 15:15:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Sep 2019 15:15:38 -0400    

Click here for diff

I still want to review the rest of the notes, but this seems like the  
minimum work required to prepare for beta4.  
  
Major-enhancements text, and a couple of other fixes, from Jonathan Katz  
(with minor copy-editing by me).  

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

Doc: tweak installation doc edits made by commit 76c2af926.

commit   : d1da0bc92c3124de44fca5989ed4506a30bb1a6a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Sep 2019 11:24:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Sep 2019 11:24:36 -0400    

Click here for diff

We don't consider that building with MinGW is deprecated,  
so adjust some places that gave that impression.  
Per discussion with Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml
M doc/src/sgml/standalone-install.xml

When performing a base backup, check for read errors.

commit   : ce5542d4025321273d7d0915fb76977937da6994    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 Sep 2019 08:22:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 Sep 2019 08:22:32 -0400    

Click here for diff

The old code didn't differentiate between a read error and a  
concurrent truncation. fread reports both of these by returning 0;  
you have to use feof() or ferror() to distinguish between them,  
which this code did not do.  
  
It might be a better idea to use read() rather than fread() here,  
so that we can display a less-generic error message, but I'm not  
sure that would qualify as a back-patchable bug fix, so just do  
this much for now.  
  
Jeevan Chalke, reviewed by Jeevan Ladhe and by me.  
  
Discussion: http://postgr.es/m/CA+TgmobG4ywMzL5oQq2a8YKp8x2p3p1LOMMcGqpS7aekT9+ETA@mail.gmail.com  

M src/backend/replication/basebackup.c

libpq: ccache -> credential cache

commit   : d57a931a85dff67fb7447da5f252bb9a9ecbb6d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 09:15:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Sep 2019 09:15:35 +0200    

Click here for diff

The term "ccache" is overloaded.  Let's be more clear, in case someone  
other than a Kerberos wizard has to read this code.  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h

Make pg_promote() detect postmaster death while waiting for promotion to end.

commit   : 7aa815a7aadd0dcc0515dfc3a88677deb0ca11ff    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 6 Sep 2019 14:27:25 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 6 Sep 2019 14:27:25 +0900    

Click here for diff

Previously even if postmaster died and WaitLatch() woke up with that event  
while pg_promote() was waiting for the standby promotion to finish,  
pg_promote() did nothing special and kept waiting until timeout occurred.  
This could cause a busy loop.  
  
This patch make pg_promote() return false immediately when postmaster  
dies, to avoid such a busy loop.  
  
Back-patch to v12 where pg_promote() was added.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwEs9ROgSp+QF+YdDU+xP8W=CY1k-_Ov-d_Z3JY+to3eXA@mail.gmail.com  

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

Fix thinko when ending progress report for a backend

commit   : 4c3e750ab4b5f1900abfa7000aad5e6322f47b5d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Sep 2019 15:46:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Sep 2019 15:46:45 +0900    

Click here for diff

The logic ending progress reporting for a backend entry introduced by  
b6fb647 causes callers of pgstat_progress_end_command() to do some extra  
work when track_activities is enabled as the process fields are reset in  
the backend entry even if no command were started for reporting.  
  
This resets the fields only if a command is registered for progress  
reporting, and only if track_activities is enabled.  
  
Author: Masahiho Sawada  
Discussion: https://postgr.es/m/CAD21AoCry_vJ0E-m5oxJXGL3pnos-xYGCzF95rK5Bbi3Uf-rpA@mail.gmail.com  
Backpatch-through: 9.6  

M src/backend/postmaster/pgstat.c

Delay fsyncs of pg_basebackup until the end of backup

commit   : 64eb426afc344600d7d4b9944ed7c3be7ed1812d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Sep 2019 13:23:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Sep 2019 13:23:41 +0900    

Click here for diff

Since the addition of fsync requests in bc34223 to make base backup data  
consistent on disk once pg_basebackup finishes, each tablespace tar file  
is individually flushed once completed, with an additional flush of the  
parent directory when the base backup finishes.  While holding a  
connection to the server, a fsync request taking a long time may cause a  
failure of the base backup, which is annoying for any integration.  A  
recent example of breakage can involve tcp_user_timeout, but  
wal_sender_timeout can cause similar problems.  
  
While reviewing the code, there was a second issue causing too many  
fsync requests to be done for the same WAL data.  As recursive fsyncs  
are done at the end of the backup for both the plain and tar formats  
from the base target directory where everything is written, it is fine  
to disable fsyncs when fetching or streaming WAL.  
  
Reported-by: Ryohei Takahashi  
Author: Michael Paquier  
Reviewed-by: Ryohei Takahashi  
Discussion: https://postgr.es/m/OSBPR01MB4550DAE2F8C9502894A45AAB82BE0@OSBPR01MB4550.jpnprd01.prod.outlook.com  
Backpatch-through: 10  

M src/bin/pg_basebackup/pg_basebackup.c

Clarify pg_dump documentation

commit   : 73687190d1e750b4ff94dd0213af7f5f4d3026a7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 14:25:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 14:25:26 +0200    

Click here for diff

Clarify in the help output and documentation that -n, -t etc. take a  
"pattern" rather than a "schema" or "table" etc.  This was especially  
confusing now that the new pg_dumpall --exclude-database option was  
documented with "pattern" and the others not, even though they all  
behave the same.  
  
Discussion: https://www.postgresql.org/message-id/flat/b85f3fa1-b350-38d1-1893-4f7911bd7310%402ndquadrant.com  

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

pg_checksums: Handle read and write returns correctly

commit   : 3e20b7fa408f1b5a1bf17120b55b5473e82a7e63    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 08:26:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 08:26:55 +0200    

Click here for diff

The read() return was not checking for errors, the write() return was  
not checking for short writes.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com  

M src/bin/pg_checksums/pg_checksums.c

Better error messages for short reads/writes in SLRU

commit   : 6ef121647f7f29b59b86eca3dee9b90548245a3a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 08:26:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Sep 2019 08:26:55 +0200    

Click here for diff

This avoids getting a  
  
    Could not read from file ...: Success.  
  
for a short read or write (since errno is not set in that case).  
Instead, report a more specific error messages.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com  

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

Fix memory leak with lower, upper and initcap with ICU-provided collations

commit   : 5380719f931a101a6e83efc7a1664e42bd6bf6c3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 3 Sep 2019 12:31:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 3 Sep 2019 12:31:03 +0900    

Click here for diff

The leak happens in str_tolower, str_toupper and str_initcap, which are  
used in several places including their equivalent SQL-level functions,  
and can only be triggered when using an ICU-provided collation when  
converting the input string.  
  
b615920 fixed a similar leak.  Backpatch down 10 where ICU collations  
have been introduced.  
  
Author: Konstantin Knizhnik  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

Avoid touching replica identity index in ExtractReplicaIdentity().

commit   : aad0926ebbe96fbbc3c963b58f2abbcf81895a06    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Sep 2019 16:10:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Sep 2019 16:10:37 -0400    

Click here for diff

In what seems like a fit of misplaced optimization,  
ExtractReplicaIdentity() accessed the relation's replica-identity  
index without taking any lock on it.  Usually, the surrounding query  
already holds some lock so this is safe enough ... but in the case  
of a previously-planned delete, there might be no existing lock.  
Given a suitable test case, this is exposed in v12 and HEAD by an  
assertion added by commit b04aeb0a0.  
  
The whole thing's rather poorly thought out anyway; rather than  
looking directly at the index, we should use the index-attributes  
bitmap that's held by the parent table's relcache entry, as the  
caller functions do.  This is more consistent and likely a bit  
faster, since it avoids a cache lookup.  Hence, change to doing it  
that way.  
  
While at it, rather than blithely assuming that the identity  
columns are non-null (with catastrophic results if that's wrong),  
add assertion checks that they aren't null.  Possibly those should  
be actual test-and-elog, but I'll leave it like this for now.  
  
In principle, this is a bug that's been there since this code was  
introduced (in 9.4).  In practice, the risk seems quite low, since  
we do have a lock on the index's parent table, so concurrent  
changes to the index's catalog entries seem unlikely.  Given the  
precedent that commit 9c703c169 wasn't back-patched, I won't risk  
back-patching this further than v12.  
  
Per report from Hadi Moshayedi.  
  
Discussion: https://postgr.es/m/CAK=1=Wrek44Ese1V7LjKiQS-Nd-5LgLi_5_CskGbpggKEf3tKQ@mail.gmail.com  

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

Handle corner cases correctly in psql's reconnection logic.

commit   : 90433c38ec5a2c3da576d9526370bcc3057ee9fb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Sep 2019 14:02:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Sep 2019 14:02:45 -0400    

Click here for diff

After an unexpected connection loss and successful reconnection,  
psql neglected to resynchronize its internal state about the server,  
such as server version.  Ordinarily we'd be reconnecting to the same  
server and so this isn't really necessary, but there are scenarios  
where we do need to update --- one example is where we have a list  
of possible connection targets and they're not all alike.  
  
Define "resynchronize" as including connection_warnings(), so that  
this case acts the same as \connect.  This seems useful; for example,  
if the server version did change, the user might wish to know that.  
An attuned user might also notice that the new connection isn't  
SSL-encrypted, for example, though this approach isn't especially  
in-your-face about such changes.  Although this part is a behavioral  
change, it only affects interactive sessions, so it should not break  
any applications.  
  
Also, in do_connect, make sure that we desynchronize correctly when  
abandoning an old connection in non-interactive mode.  
  
These problems evidently are the result of people patching only one  
of the two places where psql deals with connection changes, so insert  
some cross-referencing comments in hopes of forestalling future bugs  
of the same ilk.  
  
Lastly, in Windows builds, issue codepage mismatch warnings only at  
startup, not during reconnections.  psql's codepage can't change  
during a reconnect, so complaining about it again seems like useless  
noise.  
  
Peter Billen and Tom Lane.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAMTXbE8e6U=EBQfNSe01Ej17CBStGiudMAGSOPaw-ALxM-5jXg@mail.gmail.com  

M src/bin/psql/command.c
M src/bin/psql/common.c

Doc: describe the "options" allowed in an ECPG connection target string.

commit   : 5eec908c3c2e2d328e0b1bee76881f0d63cedd1f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Aug 2019 14:05:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Aug 2019 14:05:32 -0400    

Click here for diff

These have been there a long time, but their format was never explained  
in the docs.  Per complaint from Yusuke Egashira.  
  
Discussion: https://postgr.es/m/848B1649C8A6274AA527C4472CA11EDD5FC70CBE@G01JPEXMBYT02  

M doc/src/sgml/ecpg.sgml

Doc: remove some long-obsolete information from installation.sgml.

commit   : 359209835223db95fa589064d8f7548e17da287c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Aug 2019 13:02:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Aug 2019 13:02:35 -0400    

Click here for diff

Section 16.2 pointed to platform-specific FAQ files that we removed  
way back in 8.4.  Section 16.7 contained a bunch of information about  
AIX and HPUX bugs that were squashed decades ago, plus discussions of  
old compiler versions that are certainly moot now that we require C99  
support.  Since we're obviously not maintaining this stuff carefully,  
just remove it.  The HPUX sub-section seems like it can go away  
entirely, since everything it said that was still applicable was  
redundant with material elsewhere in the chapter.  
  
In passing, I couldn't resist the temptation to do a small amount  
of copy-editing on nearby text.  
  
Back-patch to v12, since this stuff is surely obsolete in any  
branch that requires C99.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml

Fix typos in regression test comments.

commit   : 8ff5de1c7aa2439ae69f53efd61390026505aee4    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 29 Aug 2019 18:45:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 29 Aug 2019 18:45:01 +0900    

Click here for diff

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

Fix overflow check and comment in GIN posting list encoding.

commit   : 6b7819a0bd01ebe4ede13bf84dbd51b524eb128a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Aug 2019 12:55:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Aug 2019 12:55:33 +0300    

Click here for diff

The comment did not match what the code actually did for integers with  
the 43rd bit set. You get an integer like that, if you have a posting  
list with two adjacent TIDs that are more than 2^31 blocks apart.  
According to the comment, we would store that in 6 bytes, with no  
continuation bit on the 6th byte, but in reality, the code encodes it  
using 7 bytes, with a continuation bit on the 6th byte as normal.  
  
The decoding routine also handled these 7-byte integers correctly, except  
for an overflow check that assumed that one integer needs at most 6 bytes.  
Fix the overflow check, and fix the comment to match what the code  
actually does. Also fix the comment that claimed that there are 17 unused  
bits in the 64-bit representation of an item pointer. In reality, there  
are 64-32-11=21.  
  
Fitting any item pointer into max 6 bytes was an important property when  
this was written, because in the old pre-9.4 format, item pointers were  
stored as plain arrays, with 6 bytes for every item pointer. The maximum  
of 6 bytes per integer in the new format guaranteed that we could convert  
any page from the old format to the new format after upgrade, so that the  
new format was never larger than the old format. But we hardly need to  
worry about that anymore, and running into that problem during upgrade,  
where an item pointer is expanded from 6 to 7 bytes such that the data  
doesn't fit on a page anymore, is implausible in practice anyway.  
  
Backpatch to all supported versions.  
  
This also includes a little test module to test these large distances  
between item pointers, without requiring a 16 TB table. It is not  
backpatched, I'm including it more for the benefit of future development  
of new posting list formats.  
  
Discussion: https://www.postgresql.org/message-id/33bfc20a-5c86-f50c-f5a5-58e9925d05ff%40iki.fi  
Reviewed-by: Masahiko Sawada, Alexander Korotkov  

M src/backend/access/gin/ginpostinglist.c

Avoid catalog lookups in RelationAllowsEarlyPruning().

commit   : 8cc6016a8cd43f84998f57e277a988be651e2e6d    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 28 Aug 2019 13:37:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 28 Aug 2019 13:37:03 +1200    

Click here for diff

RelationAllowsEarlyPruning() performed a catalog scan, but is used  
in two contexts where that was a bad idea:  
  
1.  In heap_page_prune_opt(), which runs very frequently in some large  
    scans.  This caused major performance problems in a field report  
    that was easy to reproduce.  
  
2.  In TestForOldSnapshot(), which runs while we hold a buffer content  
    lock.  It's not clear if this was guaranteed to be free of buffer  
    deadlock risk.  
  
The check was introduced in commit 2cc41acd8 and defended against a  
real problem: 9.6's hash indexes have no page LSN and so we can't  
allow early pruning (ie the snapshot-too-old feature).  We can remove  
the check from all later releases though: hash indexes are now logged,  
and there is no way to create UNLOGGED indexes on regular logged  
tables.  
  
If a future release allows such a combination, it might need to put  
a similar check in place, but it'll need some more thought.  
  
Back-patch to 10.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane, who spotted the second problem  
Discussion: https://postgr.es/m/CA%2BhUKGKT8oTkp5jw_U4p0S-7UG9zsvtw_M47Y285bER6a2gD%2Bg%40mail.gmail.com  
Discussion: https://postgr.es/m/CAA4eK1%2BWy%2BN4eE5zPm765h68LrkWc3Biu_8rzzi%2BOYX4j%2BiHRw%40mail.gmail.com  

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

Disable timeouts when running pg_rewind with online source cluster

commit   : e96f524433dbc562d708c4d09d8455b6bc953613    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Aug 2019 11:48:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Aug 2019 11:48:15 +0900    

Click here for diff

In this case, the transfer uses a libpq connection, which is subject to  
the timeout parameters set at system level, and this can make the rewind  
operation suddenly canceled which is not good for automation.  One  
workaround to such issues would be to use PGOPTIONS to enforce the  
wanted timeout parameters, but that's annoying, and for example pg_dump,  
which can run potentially long-running queries disables all types of  
timeouts.  
  
lock_timeout and statement_timeout are the ones which can cause problems  
now.  Note that pg_rewind does not use transactions, so disabling  
idle_in_transaction_session_timeout is optional, but it feels safer to  
do so for the future.  
  
This is back-patched down to 9.5.  idle_in_transaction_session_timeout  
is only present since 9.6.  
  
Author: Alexander Kukushkin  
Discussion: https://postgr.es/m/CAFh8B=krcVXksxiwVQh1SoY+ziJ-JC=6FcuoBL3yce_40Es5_g@mail.gmail.com  
Backpatch-through: 9.5  

M src/bin/pg_rewind/libpq_fetch.c

Doc: improve documentation of pg_signal_backend default role.

commit   : 11f6271b87fab08eea23a31ceaa6b14cdc2e8a6c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 18:03:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 18:03:09 -0400    

Click here for diff

Give it an explanatory para like the other default roles have.  
Don't imply that it can send any signal whatever.  
  
In passing, reorder the table entries and explanatory paras  
for the default roles into some semblance of consistency.  
  
Ian Barwick, tweaked a bit by me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve what pg_strsignal prints if we haven't got strsignal(3).

commit   : 7570df0f3b6d873cd060b3271b5f7b90cbcfb66c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 17:24:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 17:24:13 -0400    

Click here for diff

Turns out that returning "unrecognized signal" is confusing.  
Make it explicit that the platform lacks any support for signal names.  
(At least of the machines in the buildfarm, only HPUX lacks it.)  
  
Back-patch to v12 where we invented this function.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/pgstrsignal.c

Doc: clarify behavior of standard aggregates for null inputs.

commit   : c0222c2c9b8145a0ccbee7d801db848e871f2e14    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 16:37:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 16:37:22 -0400    

Click here for diff

Section 4.2.7 says that unless otherwise specified, built-in  
aggregates ignore rows in which any input is null.  This is  
not true of the JSON aggregates, but it wasn't documented.  
Fix that.  
  
Of the other entries in table 9.55, some were explicit about  
ignoring nulls, and some weren't; for consistency and  
self-contained-ness, make them all say it explicitly.  
  
Per bug #15884 from Tim Möhlmann.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Reject empty names and recursion in config-file include directives.

commit   : 1510339dce3c70757a87be3880e102e0511bf288    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 14:44:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Aug 2019 14:44:26 -0400    

Click here for diff

An empty file name or subdirectory name leads join_path_components() to  
just produce the parent directory name, which leads to weird failures or  
recursive inclusions.  Let's throw a specific error for that.  It takes  
only slightly more code to detect all-blank names, so do so.  
  
Also, detect direct recursion, ie a file calling itself.  As coded  
this will also detect recursion via "include_dir '.'", which is  
perhaps more likely than explicitly including the file itself.  
  
Detecting indirect recursion would require API changes for guc-file.l  
functions, which seems not worth it since extensions might call them.  
The nesting depth limit will catch such cases eventually, just not  
with such an on-point error message.  
  
In passing, adjust the example usages in postgresql.conf.sample  
to perhaps eliminate the problem at the source: there's no reason  
for the examples to suggest that an empty value is valid.  
  
Per a trouble report from Brent Bates.  Back-patch to 9.5; the  
issue is old, but the code in 9.4 is enough different that the  
patch doesn't apply easily, and it doesn't seem worth the trouble  
to fix there.  
  
Ian Barwick and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/postgresql.conf.sample

Fix failure of --jobs with vacuumdb on Windows

commit   : b783a38d4580d807210e26c2c09eb77b66d7286f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Aug 2019 09:11:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Aug 2019 09:11:38 +0900    

Click here for diff

FD_SETSIZE needs to be declared before winsock2.h, or it is possible to  
run into buffer overflow issues when using --jobs.  This is similar to  
pgbench's solution done in a23c641.  
  
This has been introduced by 71d84ef, and older versions have been using  
the default value of FD_SETSIZE, defined at 64.  
  
Per buildfarm member jacana, but this impacts all Windows animals  
running the TAP tests.  I have reproduced the failure locally to check  
the patch.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/bin/scripts/vacuumdb.c

Fix gettext triggers specification

commit   : 6bdd9fb003e26201c4ae6293a9f3b239140b6598    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Aug 2019 19:04:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Aug 2019 19:04:35 +0200    

Click here for diff

In cc8d41511721d25d557fc02a46c053c0a602fed0, the arguments of  
warn_or_exit_horribly() were changed but this was not updated.  

M src/bin/pg_dump/nls.mk

Adjust to latest Msys2 kernel release number

commit   : 97205d04e79ded73ba7fe0196f7817f89a405303    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 26 Aug 2019 08:11:27 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 26 Aug 2019 08:11:27 -0400    

Click here for diff

Previously 'uname -r' on Msys2 reported a kernele release starting with  
2. The latest version starts with 3. In commit 1638623f we specifically  
looked for one starting with 2. This is now changed to look for any  
digit between 2 and 9.  
  
backpatch to release 10.  

M src/bin/pg_dump/t/010_dump_connstr.pl

Treat MINGW and MSYS the same in pg_upgrade test script

commit   : 67d5af3f42b72270b0c5a2c36c1f378ab908671a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 26 Aug 2019 07:44:34 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 26 Aug 2019 07:44:34 -0400    

Click here for diff

On msys2, 'uname -s' reports a string starting MSYS instead on MINGW  
as happens on msys1. Treat these both the same way. This reverts  
608a710195a4b in favor of a more general solution.  
  
Backpatch to all live branches.  

M src/bin/pg_upgrade/test.sh

Fix error handling of vacuumdb when running out of fds

commit   : 63fc3b124008fa626b9f2e57f2211b9c3fb9a4ba    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Aug 2019 11:14:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Aug 2019 11:14:24 +0900    

Click here for diff

When trying to use a high number of jobs, vacuumdb has only checked for  
a maximum number of jobs used, causing confusing failures when running  
out of file descriptors when the jobs open connections to Postgres.  
This commit changes the error handling so as we do not check anymore for  
a maximum number of allowed jobs when parsing the option value with  
FD_SETSIZE, but check instead if a file descriptor is within the  
supported range when opening the connections for the jobs so as this is  
detected at the earliest time possible.  
  
Also, improve the error message to give a hint about the number of jobs  
recommended, using a wording given by the reviewers of the patch.  
  
Reported-by: Andres Freund  
Author: Michael Paquier  
Reviewed-by: Andres Freund, Álvaro Herrera, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/bin/scripts/vacuumdb.c

Avoid platform-specific null pointer dereference in psql.

commit   : 363382521eb26106587c7dab7f439636c3a6876a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Aug 2019 15:04:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Aug 2019 15:04:04 -0400    

Click here for diff

POSIX permits getopt() to advance optind beyond argc when the last  
argv entry is an option that requires an argument and hasn't got one.  
It seems that no major platforms actually do that, but musl does,  
so that something like "psql -f" would crash with that libc.  
Add a check that optind is in range before trying to look at the  
possibly-bogus option.  
  
Report and fix by Quentin Rameau.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/startup.c

Back off output precision in circle.sql regression test.

commit   : cd714b3507c914e78d47352d1e126b4bec4380ad    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Aug 2019 12:14:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Aug 2019 12:14:50 -0400    

Click here for diff

We were setting extra_float_digits = 0 to avoid platform-dependent  
output in this test, but that's still able to expose platform-specific  
roundoff behavior in some new test cases added by commit a3d284485,  
as reported by Peter Eisentraut.  Reduce it to -1 to hide that.  
  
(Over in geometry.sql, we're using -3, which is an ancient decision  
dating to 337f73b1b.  I wonder whether that's overkill now.  But  
there's probably little value in trying to change it.)  
  
Back-patch to v12 where a3d284485 came in; there's no evidence that  
we have any platform-dependent issues here before that.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Don't rely on llvm::make_unique.

commit   : 54ff1c34f11b3f899be66fa55f85dbace83be741    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 25 Aug 2019 13:54:48 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 25 Aug 2019 13:54:48 +1200    

Click here for diff

Bleeding-edge LLVM has stopped supplying replacements for various  
C++14 library features, for people on older C++ versions.  Since we're  
not ready to require C++14 yet, just use plain old new instead of  
make_unique.  As revealed by buildfarm animal seawasp.  
  
Back-patch to 11.  
  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CA%2BhUKGJWG7unNqmkxg7nC5o3o-0p2XP6co4r%3D9epqYMm8UY4Mw%40mail.gmail.com  

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

Improve documentation of pageinspect

commit   : 08e68825c1d6cc87606e592a8080fece5da3fd31    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 23 Aug 2019 20:41:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 23 Aug 2019 20:41:13 +0900    

Click here for diff

This adds a section for heap-related functions.  These were previously  
mixed with functions having a more general purpose, leading to  
confusion.  While on it, add a query example for fsm_page_contents.  
  
Backpatch down to 10, where b5e3942 introduced the subsections for  
function types in pageinspect documentation.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDyM7E1+cK3-aWejxKTGC-wVVP2B+RnJhN6inXyeRmqzw@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/pageinspect.sgml

doc: PG 12 relnotes, correct pg_stat_database.datoid to be datid

commit   : ea4aa9801f9cb9f42255657c387e7594d6717cf8    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 22 Aug 2019 20:19:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 22 Aug 2019 20:19:20 -0400    

Click here for diff

Previous column name was incorrect.  
  
Reported-by: Justin Pryzby  
  
Backpatch-through: 12  

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

Fixes for "Glyph not available" warnings from FOP

commit   : 73ebfb10d0410af6b95a288f48b9fae3648bd3c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 22:36:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 22:36:45 +0200    

Click here for diff

see d315639c82e8a2cfd1d1b98b7acf0f6c033ab955  

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

Add list of acknowledgments to release notes

commit   : f87b986e7d9fb47bd7dae77c26a79698d5297ab5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 22:35:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 22:35:00 +0200    

Click here for diff

This contains all individuals mentioned in the commit messages during  
PostgreSQL 12 development.  
  
current through 068bc300c6ed5333d9561e55cb5f45d17de88422  

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

Make SQL/JSON error code names match SQL standard

commit   : 04f576a999e052187c3ff3bac4965fcd63b34820    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 10:17:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Aug 2019 10:17:30 +0200    

Click here for diff

There were some minor differences that didn't seem necessary.  
  
Discussion: https://www.postgresql.org/message-id/flat/86b67eef-bb26-c97d-3e35-64f1fbd4f9fe%402ndquadrant.com  

M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/errcodes.txt

Doc: Remove mention to "Visual Studio Express 2019"

commit   : 39511da1c0143c246c2c759cbde673a8b2ea404f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Aug 2019 09:59:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Aug 2019 09:59:16 +0900    

Click here for diff

The "Express" flavor of Visual Studio exists up to 2017, and the  
documentation referred to "Express" for Visual Studio 2019.  
  
Author: Takuma Hoshiai  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/install-windows.sgml

Fix typo

commit   : d60ec8fe529850d10c3422086912056c5af4e61c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Aug 2019 11:12:44 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Aug 2019 11:12:44 -0400    

Click here for diff

In early development patches, "replication origins" were called "identifiers";  
almost everything was renamed, but these references to the old terminology  
went unnoticed.  
  
Reported-by: Craig Ringer  

M src/backend/replication/logical/origin.c
M src/include/catalog/pg_proc.dat

Fix bogus comment

commit   : 068bc300c6ed5333d9561e55cb5f45d17de88422    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Aug 2019 16:04:09 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Aug 2019 16:04:09 -0400    

Click here for diff

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

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

Doc: Fix various typos

commit   : d38753c6f79d1eb7d3096ff777ec6df0bc7e5008    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Aug 2019 13:45:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Aug 2019 13:45:53 +0900    

Click here for diff

All those fixes are already included on HEAD thanks to for example  
c96581a and 66bde49, and have gone missing on back-branches.  
  
Author: Alexander Lakhin, Liudmila Mantrova  
Discussion: https://postgr.es/m/CAEkD-mDJHV3bhgezu3MUafJLoAKsOOT86+wHukKU8_NeiJYhLQ@mail.gmail.com  
Backpatch-through: 9.4  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/custom-scan.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/problems.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/sslinfo.sgml
M doc/src/sgml/xplang.sgml

Doc: Improve wording of multiple places in documentation

commit   : b298e37013683f896b0a224eee50937730faeca8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Aug 2019 12:37:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Aug 2019 12:37:30 +0900    

Click here for diff

This has been found during its translation.  
  
Author: Liudmila Mantrova  
Discussion: https://postgr.es/m/CAEkD-mDJHV3bhgezu3MUafJLoAKsOOT86+wHukKU8_NeiJYhLQ@mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/storage.sgml

Restore json{b}_populate_record{set}'s ability to take type info from AS.

commit   : cdc8d371e27d534626b19e0810a8de74a31e2c91    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Aug 2019 18:00:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Aug 2019 18:00:57 -0400    

Click here for diff

If the record argument is NULL and has no declared type more concrete  
than RECORD, we can't extract useful information about the desired  
rowtype from it.  In this case, see if we're in FROM with an AS clause,  
and if so extract the needed rowtype info from AS.  
  
It worked like this before v11, but commit 37a795a60 removed the  
behavior, reasoning that it was undocumented, inefficient, and utterly  
not self-consistent.  If you want to take type info from an AS clause,  
you should be using the json_to_record() family of functions not the  
json_populate_record() family.  Also, it was already the case that  
the "populate" functions would fail for a null-valued RECORD input  
(with an unfriendly "record type has not been registered" error)  
when there wasn't an AS clause at hand, and it wasn't obvious that  
that behavior wasn't OK when there was one.  However, it emerges  
that some people were depending on this to work, and indeed the  
rather off-point error message you got if you left off AS encouraged  
slapping on AS without switching to the json_to_record() family.  
  
Hence, put back the fallback behavior of looking for AS.  While at it,  
improve the run-time error you get when there's no place to obtain type  
info; we can do a lot better than "record type has not been registered".  
(We can't, unfortunately, easily improve the parse-time error message  
that leads people down this path in the first place.)  
  
While at it, I refactored the code a bit to avoid duplicating the  
same logic in several different places.  
  
Per bug #15940 from Jaroslav Sivy.  Back-patch to v11 where the  
current coding came in.  (The pre-v11 deficiencies in this area  
aren't regressions, so we'll leave those branches alone.)  
  
Patch by me, based on preliminary analysis by Dmitry Dolgov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

doc: Fix image use in PDF build with vpath

commit   : 842ac79407a1368308beff230d3e83aad6d82b75    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Aug 2019 10:30:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Aug 2019 10:30:47 +0200    

Click here for diff

In a vpath build, we need to point to the source directory to allow  
FOP to find the images.  

M doc/src/sgml/Makefile

Disallow changing an inherited column's type if not all parents changed.

commit   : 328c3f6f96a4d7cdc368264a97d03c9b75ad54ea    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 17:11:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 18 Aug 2019 17:11:57 -0400    

Click here for diff

If a table inherits from multiple unrelated parents, we must disallow  
changing the type of a column inherited from multiple such parents, else  
it would be out of step with the other parents.  However, it's possible  
for the column to ultimately be inherited from just one common ancestor,  
in which case a change starting from that ancestor should still be  
allowed.  (I would not be excited about preserving that option, were  
it not that we have regression test cases exercising it already ...)  
  
It's slightly annoying that this patch looks different from the logic  
with the same end goal in renameatt(), and more annoying that it  
requires an extra syscache lookup to make the test.  However, the  
recursion logic is quite different in the two functions, and a  
back-patched bug fix is no place to be trying to unify them.  
  
Per report from Manuel Rigger.  Back-patch to 9.5.  The bug exists in  
9.4 too (and doubtless much further back); but the way the recursion  
is done in 9.4 is a good bit different, so that substantial refactoring  
would be needed to fix it in 9.4.  I'm disinclined to do that, or risk  
introducing new bugs, for a bug that has escaped notice for this long.  
  
Discussion: https://postgr.es/m/CA+u7OA4qogDv9rz1HAb-ADxttXYPqQdUdPY_yd4kCzywNxRQXA@mail.gmail.com  

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

Add default_table_access_method to postgresql.conf.sample.

commit   : 3a5c08aa02677a4fef40de78e88fc95a3d6ac1e0    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 15:24:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Aug 2019 15:24:22 -0700    

Click here for diff

Reported-By: Heikki Linnakangas  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where pluggable table access methods were introduced  

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

Prevent possible double-free when update trigger returns old tuple.

commit   : 03813a50efa563f19110013b06e80f08d4f49cf5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 20:04:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 20:04:19 -0400    

Click here for diff

This is a variant of the problem fixed in commit 25b692568, which  
unfortunately we failed to detect at the time.  If an update trigger  
returns the "old" tuple, as it's entitled to do, then a subsequent  
iteration of the loop in ExecBRUpdateTriggers would have "oldtuple"  
equal to "trigtuple" and would fail to notice that it shouldn't  
free that.  
  
In addition to fixing the code, extend the test case added by  
25b692568 so that it covers multiple-trigger-iterations cases.  
  
This problem does not manifest in v12/HEAD, as a result of the  
relevant code having been largely rewritten for slotification.  
However, include the test case into v12/HEAD anyway, since this  
is clearly an area that someone could break again in future.  
  
Per report from Piotr Gabriel Kosinski.  Back-patch into all  
supported branches, since the bug seems quite old.  
  
Diagnosis and code fix by Thomas Munro, test case by me.  
  
Discussion: https://postgr.es/m/CAFMLSdP0rd7LqC3j-H6Fh51FYSt5A10DDh-3=W4PPc4LLUQ8YQ@mail.gmail.com  

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

Fix plpgsql to re-look-up composite type names at need.

commit   : a4504696e1ed04a112d312e0934dd324e90675e7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 15:21:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 15:21:47 -0400    

Click here for diff

Commit 4b93f5799 rearranged things in plpgsql to make it cope better with  
composite types changing underneath it intra-session.  However, I failed to  
consider the case of a composite type being dropped and recreated entirely.  
In my defense, the previous coding didn't consider that possibility at all  
either --- but it would accidentally work so long as you didn't change the  
type's field list, because the built-at-compile-time list of component  
variables would then still match the type's new definition.  The new  
coding, however, occasionally tries to re-look-up the type by OID, and  
then fails to find the dropped type.  
  
To fix this, we need to save the TypeName struct, and then redo the type  
OID lookup from that.  Of course that's expensive, so we don't want to do  
it every time we need the type OID.  This can be fixed in the same way that  
4b93f5799 dealt with changes to composite types' definitions: keep an eye  
on the type's typcache entry to see if its tupledesc has been invalidated.  
(Perhaps, at some point, this mechanism should be generalized so it can  
work for non-composite types too; but for now, plpgsql only tries to  
cope with intra-session redefinitions of composites.)  
  
I'm slightly hesitant to back-patch this into v11, because it changes  
the contents of struct PLpgSQL_type as well as the signature of  
plpgsql_build_datatype(), so in principle it could break code that is  
poking into the innards of plpgsql.  However, the only popular extension  
of that ilk is pldebugger, and it doesn't seem to be affected.  Since  
this is a regression for people who were relying on the old behavior,  
it seems worth taking the small risk of causing compatibility issues.  
  
Per bug #15913 from Daniel Fiori.  Back-patch to v11 where 4b93f5799  
came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/typcache.c
M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_record.sql

Doc: improve documentation about postgresql.auto.conf.

commit   : 372d6a8918e03f182242b260902dd47e5c5dd6e5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 11:14:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Aug 2019 11:14:26 -0400    

Click here for diff

Clarify what external tools can do to this file, and add a bit  
of detail about what ALTER SYSTEM itself does.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Fix ALTER SYSTEM to cope with duplicate entries in postgresql.auto.conf.

commit   : 75b2f011f642bbc7fab8352f4bcfb6e3fc494e7a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Aug 2019 15:09:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Aug 2019 15:09:20 -0400    

Click here for diff

ALTER SYSTEM itself normally won't make duplicate entries (although  
up till this patch, it was possible to confuse it by writing case  
variants of a GUC's name).  However, if some external tool has appended  
entries to the file, that could result in duplicate entries for a single  
GUC name.  In such a situation, ALTER SYSTEM did exactly the wrong thing,  
because it replaced or removed only the first matching entry, leaving  
the later one(s) still there and hence still determining the active value.  
  
This patch fixes that by making ALTER SYSTEM sweep through the file and  
remove all matching entries, then (if not ALTER SYSTEM RESET) append the  
new setting to the end.  This means entries will be in order of last  
setting rather than first setting, but that shouldn't hurt anything.  
  
Also, make the comparisons case-insensitive so that the right things  
happen if you do, say, ALTER SYSTEM SET "TimeZone" = 'whatever'.  
  
This has been broken since ALTER SYSTEM was invented, so back-patch  
to all supported branches.  
  
Ian Barwick, with minor mods by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix random regression failure in test case "collate.icu.utf8"

commit   : b626483bd97be374ad827f800171478773ad8282    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Aug 2019 13:38:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Aug 2019 13:38:16 +0900    

Click here for diff

This is a fix similar to 2d7d67cc, where slight plan alteration can  
cause a random failure of this regression test because of an incorect  
tuple ordering, except that this one involves lookups of pg_type.  
Similarly to the other case, add ORDER BY clauses to ensure the output  
order.  
  
The failure has been seen at least once on buildfarm member skink.  
  
Reported-by: Thomas Munro  
Discussion: https://postgr.es/m/CA+hUKGLjR9ZBvhXcr9b-NSBHPw9aRgbjyzGE+kqLsT4vwX+nkQ@mail.gmail.com  
Backpatch-through: 12  

M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Un-break pg_dump for pre-8.3 source servers.

commit   : 6844adba54f7d96f30f834efc6d9aa1e52e5672d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Aug 2019 16:57:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Aug 2019 16:57:58 -0400    

Click here for diff

Commit 07b39083c inserted an unconditional reference to pg_opfamily,  
which of course fails on servers predating that catalog.  Fortunately,  
the case it's trying to solve can't occur on such old servers (AFAIK).  
Hence, just skip the additional code when the source predates 8.3.  
  
Per bug #15955 from sly.  Back-patch to all supported branches,  
like the previous patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Fix random regression failure in test case "temp"

commit   : 4c0b9cf9e073ca2dc95a75fe983d90fd518864fb    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 13 Aug 2019 10:55:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 13 Aug 2019 10:55:58 +0900    

Click here for diff

This test case could fail because of an incorrect result ordering when  
looking up at pg_class entries.  This commit adds an ORDER BY to the  
culprit query.  The cause of the failure was likely caused by a plan  
switch.  By default, the planner would likely choose an index-only scan  
or an index scan, but even a small change in the startup cost could have  
caused a bitmap heap scan to be chosen, causing the failure.  
  
While on it, switch some filtering quals to a regular expression as per  
an idea of Tom Lane.  As previously shaped, the quals would have  
selected any relations whose name begins with "temp".  And that could  
cause failures if another test running in parallel began to use similar  
relation names.  
  
Per report from buildfarm member anole, though the failure was very  
rare.  This test has been introduced by 319a810, so backpatch down to  
v10.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

amcheck: Skip unlogged relations during recovery.

commit   : a05fa2c0e77535470b6ee1029671eb41c612f4ef    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 12 Aug 2019 15:21:30 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 12 Aug 2019 15:21:30 -0700    

Click here for diff

contrib/amcheck failed to consider the possibility that unlogged  
relations will not have any main relation fork files when running in hot  
standby mode.  This led to low-level "can't happen" errors that complain  
about the absence of a relfilenode file.  
  
To fix, simply skip verification of unlogged index relations during  
recovery.  In passing, add a direct check for the presence of a main  
fork just before verification proper begins, so that we cleanly verify  
the presence of the main relation fork file.  
  
Author: Andrey Borodin, Peter Geoghegan  
Reported-By: Andrey Borodin  
Diagnosed-By: Andrey Borodin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-, where amcheck was introduced.  

M contrib/amcheck/verify_nbtree.c

Fix planner's test for case-foldable characters in ILIKE with ICU.

commit   : c0c12ce391d89328640dd948b82466c308d85415    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Aug 2019 13:15:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Aug 2019 13:15:47 -0400    

Click here for diff

As coded, the ICU-collation path in pattern_char_isalpha() failed  
to consider regular ASCII letters to be case-varying.  This led to  
like_fixed_prefix treating too much of an ILIKE pattern as being a  
fixed prefix, so that indexscans derived from an ILIKE clause might  
miss entries that they should find.  
  
Per bug #15892 from James Inform.  This is an oversight in the original  
ICU patch (commit eccfef81e), so back-patch to v10 where that came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix string comparison in jsonpath

commit   : de0dc0b758ed7452ceee756d9d620c4393b3cb53    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 12 Aug 2019 06:19:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 12 Aug 2019 06:19:19 +0300    

Click here for diff

Take into account pg_server_to_any() may return input string "as is".  
  
Reported-by: Andrew Dunstan, Thomas Munro  
Discussion: https://postgr.es/m/0ed83a33-d900-466a-880a-70ef456c721f%402ndQuadrant.com  
Author: Alexander Korotkov, Thomas Munro  
Backpatch-through: 12  

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

Adjust string comparison in jsonpath

commit   : 3218ff5c6aea5841ab547ecca26927716419fe4b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 11 Aug 2019 22:54:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 11 Aug 2019 22:54:53 +0300    

Click here for diff

We have implemented jsonpath string comparison using default database locale.  
However, standard requires us to compare Unicode codepoints.  This commit  
implements that, but for performance reasons we still use per-byte comparison  
for "==" operator.  Thus, for consistency other comparison operators do per-byte  
comparison if Unicode codepoints appear to be equal.  
  
In some edge cases, when same Unicode codepoints have different binary  
representations in database encoding, we diverge standard to achieve better  
performance of "==" operator.  In future to implement strict standard  
conformance, we can do normalization of input JSON strings.  
  
Original patch was written by Nikita Glukhov, rewritten by me.  
  
Reported-by: Markus Winand  
Discussion: https://postgr.es/m/8B7FA3B4-328D-43D7-95A8-37B8891B8C78%40winand.at  
Author: Nikita Glukhov, Alexander Korotkov  
Backpatch-through: 12  

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

Fix "ANALYZE t, t" inside a transaction block.

commit   : 6ce0366be2a3f92a46202acaba40be3aa72fa073    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Aug 2019 11:30:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Aug 2019 11:30:11 -0400    

Click here for diff

This failed with either "tuple already updated by self" or "duplicate  
key value violates unique constraint", depending on whether the table  
had previously been analyzed or not.  The reason is that ANALYZE tried  
to insert or update the same pg_statistic rows twice, and there was no  
CommandCounterIncrement between.  So add one.  The same case works fine  
outside a transaction block, because then there's a whole transaction  
boundary between, as a consequence of the way VACUUM works.  
  
This issue has been latent all along, but the problem was unreachable  
before commit 11d8d72c2 added the ability to specify multiple tables  
in ANALYZE.  We could, perhaps, alternatively fix it by adding code to  
de-duplicate the list of VacuumRelations --- but that would add a  
lot of overhead to work around dumb commands, so it's not attractive.  
  
Per bug #15946 from Yaroslav Schekin.  Back-patch to v11.  
  
(Note: in v11 I also back-patched the test added by commit 23224563d;  
otherwise the problem doesn't manifest in the test I added, because  
"vactst" is empty when the tests for multiple ANALYZE targets are  
reached.  That seems like not a very good thing anyway, so I did this  
rather than rethinking the choice of test case.)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix SIGSEGV in pruning for ScalarArrayOp with constant-null array.

commit   : 59d3789294cf6d42325e92486b053f1ee5934eb8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Aug 2019 13:20:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Aug 2019 13:20:28 -0400    

Click here for diff

Not much to be said here: commit 9fdb675fc should have checked  
constisnull, didn't.  
  
Per report from Piotr Włodarczyk.  Back-patch to v11 where  
bug was introduced.  
  
Discussion: https://postgr.es/m/CAP-dhMr+vRpwizEYjUjsiZ1vwqpohTm+3Pbdt6Pr7FEgPq9R0Q@mail.gmail.com  

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

Clarify the default partition's role

commit   : edc793d374af50df76efb0a7622b78f58f0d8124    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 8 Aug 2019 16:03:14 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 8 Aug 2019 16:03:14 -0400    

Click here for diff

Reviewed by Tom Lane and Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_table.sgml

Fix certificate subjects in ldap test

commit   : 4116420baeae614a2711e156f0c4e58adad172ba    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 8 Aug 2019 14:57:48 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 8 Aug 2019 14:57:48 -0400    

Click here for diff

openssl doesn't like lower case subject attribute names. Error observed  
in buildfarm results.  
  
Backpatch to release 11.  

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

Doc: document permissions required for ANALYZE.

commit   : a1008caf0ac6960cb32b8a4c9b24d371db2a32b3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Aug 2019 18:09:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Aug 2019 18:09:28 -0400    

Click here for diff

VACUUM's reference page had this text, but ANALYZE's didn't.  That's  
a clear oversight given that section 5.7 explicitly delegates the  
responsibility to define permissions requirements to the individual  
commands' man pages.  
  
Per gripe from Isaac Morland.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAMsGm5fp3oBUs-2iRfii0iEO=fZuJALVyM2zJLhNTjG34gpAVQ@mail.gmail.com  

M doc/src/sgml/ref/analyze.sgml

Fix some typos in jsonpath documentation

commit   : 53d467246589de631ce1846105f990099219e737    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 7 Aug 2019 16:06:45 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 7 Aug 2019 16:06:45 +0300    

Click here for diff

Discussion: https://postgr.es/m/8B7FA3B4-328D-43D7-95A8-37B8891B8C78%40winand.at  
Author: Markus Winand  
Backpatch-through: 12  

M doc/src/sgml/func.sgml

Fix typos in comments.

commit   : ca8a57b6369322b5ffd915c130da5e902d7f970c    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 7 Aug 2019 19:05:18 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 7 Aug 2019 19:05:18 +0900    

Click here for diff

M src/backend/partitioning/partbounds.c

Fix predicate-locking of HOT updated rows.

commit   : f8d30182b121f0c38695498d6d386ffa96858e76    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Aug 2019 12:40:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 7 Aug 2019 12:40:49 +0300    

Click here for diff

In serializable mode, heap_hot_search_buffer() incorrectly acquired a  
predicate lock on the root tuple, not the returned tuple that satisfied  
the visibility checks. As explained in README-SSI, the predicate lock does  
not need to be copied or extended to other tuple versions, but for that to  
work, the correct, visible, tuple version must be locked in the first  
place.  
  
The original SSI commit had this bug in it, but it was fixed back in 2013,  
in commit 81fbbfe335. But unfortunately, it was reintroduced a few months  
later in commit b89e151054. Wising up from that, add a regression test  
to cover this, so that it doesn't get reintroduced again. Also, move the  
code that sets 't_self', so that it happens at the same time that the  
other HeapTuple fields are set, to make it more clear that all the code in  
the loop operate on the "current" tuple in the chain, not the root tuple.  
  
Bug spotted by Andres Freund, analysis and original fix by Thomas Munro,  
test case and some additional changes to the fix by Heikki Linnakangas.  
Backpatch to all supported versions (9.4).  
  
Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de  

M src/backend/access/heap/heapam.c
A src/test/isolation/expected/predicate-lock-hot-tuple.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/predicate-lock-hot-tuple.spec

Fix some incorrect parsing of time with time zone strings

commit   : d8652ec55513260a1ae478f80ae3d7da6eb795e0    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Aug 2019 18:17:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Aug 2019 18:17:34 +0900    

Click here for diff

When parsing a timetz string with a dynamic timezone abbreviation or a  
timezone not specified, it was possible to generate incorrect timestamps  
based on a date which uses some non-initialized variables if the input  
string did not specify fully a date to parse.  This is already checked  
when a full timezone spec is included in the input string, but the two  
other cases mentioned above missed the same checks.  
  
This gets fixed by generating an error as this input is invalid, or in  
short when a date is not fully specified.  
  
Valgrind was complaining about this problem.  
  
Bug: #15910  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

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

Fix intarray's GiST opclasses to not fail for empty arrays with <@.

commit   : 2f76f4182935c56c897463447ae18f8c2308637a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Aug 2019 18:04:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Aug 2019 18:04:51 -0400    

Click here for diff

contrib/intarray considers "arraycol <@ constant-array" to be indexable,  
but its GiST opclass code fails to reliably find index entries for empty  
array values (which of course should trivially match such queries).  
This is because the test condition to see whether we should descend  
through a non-leaf node is wrong.  
  
Unfortunately, empty array entries could be anywhere in the index,  
as these index opclasses are currently designed.  So there's no way  
to fix this except by lobotomizing <@ indexscans to scan the whole  
index ... which is what this patch does.  That's pretty unfortunate:  
the performance is now actually worse than a seqscan, in most cases.  
We'd be better off to remove <@ from the GiST opclasses entirely,  
and perhaps a future non-back-patchable patch will do so.  
  
In the meantime, applications whose performance is adversely impacted  
have a couple of options.  They could switch to a GIN index, which  
doesn't have this bug, or they could replace "arraycol <@ constant-array"  
with "arraycol <@ constant-array AND arraycol && constant-array".  
That will provide about the same performance as before, and it will find  
all non-empty subsets of the given constant-array, which is all that  
could reliably be expected of the query before.  
  
While at it, add some more regression test cases to improve code  
coverage of contrib/intarray.  
  
In passing, adjust resize_intArrayType so that when it's returning an  
empty array, it uses construct_empty_array for that rather than  
cowboy hacking on the input array.  While the hack produces an array  
that looks valid for most purposes, it isn't bitwise equal to empty  
arrays produced by other code paths, which could have subtle odd  
effects.  I don't think this code path is performance-critical  
enough to justify such shortcuts.  (Back-patch this part only as far  
as v11; before commit 01783ac36 we were not careful about this in  
other intarray code paths either.)  
  
Back-patch the <@ fixes to all supported versions, since this was  
broken from day one.  
  
Patch by me; thanks to Alexander Korotkov for review.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Save Kerberos and LDAP daemon logs where the buildfarm can find them.

commit   : 514e7e911fc205e0143167e99dcd8fe56d69e071    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Aug 2019 17:08:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Aug 2019 17:08:07 -0400    

Click here for diff

src/test/kerberos and src/test/ldap try to run private authentication  
servers, which of course might fail.  The logs from these servers  
were being dropped into the tmp_check/ subdirectory, but they should  
be put in tmp_check/log/, because the buildfarm will only capture  
log files in that subdirectory.  Without the log output there's  
little hope of diagnosing buildfarm failures related to these servers.  
  
Backpatch to v11 where these test suites were added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Stamp 12beta3.

commit   : 7c45b994f125257be86df27583a6502348785186    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Aug 2019 17:10:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Aug 2019 17:10:44 -0400    

Click here for diff

M configure
M configure.in
M src/include/pg_config.h.win32

Fix choice of comparison operators for cross-type hashed subplans.

commit   : de4b75c1549ac0baf45b4bcb8d49e2fac90ac43a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Aug 2019 11:20:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Aug 2019 11:20:21 -0400    

Click here for diff

Commit bf6c614a2 rearranged the lookup of the comparison operators  
needed in a hashed subplan, and in so doing, broke the cross-type  
case: it caused the original LHS-vs-RHS operator to be used to compare  
hash table entries too (which of course are all of the RHS type).  
This leads to C functions being passed a Datum that is not of the  
type they expect, with the usual hazards of crashes and unauthorized  
server memory disclosure.  
  
For the set of hashable cross-type operators present in v11 core  
Postgres, this bug is nearly harmless on 64-bit machines, which  
may explain why it escaped earlier detection.  But it is a live  
security hazard on 32-bit machines; and of course there may be  
extensions that add more hashable cross-type operators, which  
would increase the risk.  
  
Reported by Andreas Seltenreich.  Back-patch to v11 where the  
problem came in.  
  
Security: CVE-2019-10209  

M src/backend/executor/nodeSubplan.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Require the schema qualification in pg_temp.type_name(arg).

commit   : 9993fa9dd25d01e99748869b1fb1d6f4dc03960e    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 5 Aug 2019 07:48:41 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 5 Aug 2019 07:48:41 -0700    

Click here for diff

Commit aa27977fe21a7dfa4da4376ad66ae37cb8f0d0b5 introduced this  
restriction for pg_temp.function_name(arg); do likewise for types  
created in temporary schemas.  Programs that this breaks should add  
"pg_temp." schema qualification or switch to arg::type_name syntax.  
Back-patch to 9.4 (all supported versions).  
  
Reviewed by Tom Lane.  Reported by Tom Lane.  
  
Security: CVE-2019-10208  

M doc/src/sgml/config.sgml
M src/backend/catalog/namespace.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_type.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/namespace.h
M src/include/parser/parse_type.h
M src/test/regress/expected/temp.out
M src/test/regress/sql/temp.sql

Translation updates

commit   : 106c6635b5d9ca37b856bbd27560050c438a8ec9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Aug 2019 15:54:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Aug 2019 15:54:23 +0200    

Click here for diff

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

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

Fix tab completion for ALTER LANGUAGE in psql

commit   : 159e4bf7406f0cd46aae3f3873d28bdc63c110bf    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Aug 2019 14:30:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Aug 2019 14:30:05 +0900    

Click here for diff

OWNER_TO was used for the completion, which is not a supported grammar,  
but OWNER TO is.  
  
This error has been introduced by d37b816, so backpatch down to 9.6.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

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

Adjust v12 release notes for reversion of log_statement_sample_rate.

commit   : 2c133db2b42029a7df7d5d6cde48a898c6ca3ef0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 18:11:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 18:11:22 -0400    

Click here for diff

Necessary, not optional, because dangling link prevents relnotes from  
building.  

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

Revert "Add log_statement_sample_rate parameter"

commit   : d5f53a8e26caf7931db6ad3939cd34d36ea54d91    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 4 Aug 2019 20:29:00 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 4 Aug 2019 20:29:00 +0200    

Click here for diff

This reverts commit 88bdbd3f746049834ae3cc972e6e650586ec3c9d.  
  
As committed, statement sampling used the existing duration threshold  
(log_min_duration_statement) when decide which statements to sample.  
The issue is that even the longest statements are subject to sampling,  
and so may not end up logged. An improvement was proposed, introducing  
a second duration threshold, but it would not be backwards compatible.  
So we've decided to revert this feature - the separate threshold should  
be part of the feature itself.  
  
Discussion: https://postgr.es/m/CAFj8pRDS8tQ3Wviw9%3DAvODyUciPSrGeMhJi_WPE%2BEB8%2B4gLL-Q%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc.h

Revert "Silence compiler warning"

commit   : d8453ccfbfd6bb1782e71beb28acf4025a9a01ce    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 4 Aug 2019 20:19:54 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 4 Aug 2019 20:19:54 +0200    

Click here for diff

This reverts commit 9dc122585551516309c9362e673effdbf3bd79bd.  
  
As committed, statement sampling used the existing duration threshold  
(log_min_duration_statement) when decide which statements to sample.  
The issue is that even the longest statements are subject to sampling,  
and so may not end up logged. An improvement was proposed, introducing  
a second duration threshold, but it would not be backwards compatible.  
So we've decided to revert this feature - the separate threshold should  
be part of the feature itself.  
  
Discussion: https://postgr.es/m/CAFj8pRDS8tQ3Wviw9%3DAvODyUciPSrGeMhJi_WPE%2BEB8%2B4gLL-Q%40mail.gmail.com  

M src/backend/tcop/postgres.c

Fix handling of "undef" in contrib/jsonb_plperl.

commit   : df521ab79547b82471126e54e9dc7fead4a5a4fb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 14:05:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 14:05:35 -0400    

Click here for diff

Perl has multiple internal representations of "undef", and just  
testing for SvTYPE(x) == SVt_NULL doesn't recognize all of them,  
leading to "cannot transform this Perl type to jsonb" errors.  
Use the approved test SvOK() instead.  
  
Report and patch by Ivan Panchenko.  Back-patch to v11 where  
this module was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/jsonb_plperl/expected/jsonb_plperl.out
M contrib/jsonb_plperl/expected/jsonb_plperlu.out
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plperl/sql/jsonb_plperl.sql
M contrib/jsonb_plperl/sql/jsonb_plperlu.sql

Avoid picking already-bound TCP ports in kerberos and ldap test suites.

commit   : 4844c6303296d4fa2c9cc800685e4f404dfa5396    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 13:07:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Aug 2019 13:07:12 -0400    

Click here for diff

src/test/kerberos and src/test/ldap need to run a private authentication  
server of the relevant type, for which they need a free TCP port.  
They were just picking a random port number in 48K-64K, which works  
except when something's already using the particular port.  Notably,  
the probability of failure rises dramatically if one simply runs those  
tests in a tight loop, because each test cycle leaves behind a bunch of  
high ports that are transiently in TIME_WAIT state.  
  
To fix, split out the code that PostgresNode.pm already had for  
identifying a free TCP port number, so that it can be invoked to choose  
a port for the KDC or LDAP server.  This isn't 100% bulletproof, since  
conceivably something else on the machine could grab the port between  
the time we check and the time we actually start the server.  But that's  
a pretty short window, so in practice this should be good enough.  
  
Back-patch to v11 where these test suites were added.  
  
Patch by me, reviewed by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/perl/PostgresNode.pm

Improve pruning of a default partition

commit   : 86544071484a48c753e719e0c7c9cf816a59a65e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Aug 2019 11:18:45 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Aug 2019 11:18:45 -0400    

Click here for diff

When querying a partitioned table containing a default partition, we  
were wrongly deciding to include it in the scan too early in the  
process, failing to exclude it in some cases.  If we reinterpret the  
PruneStepResult.scan_default flag slightly, we can do a better job at  
detecting that it can be excluded.  The change is that we avoid setting  
the flag for that pruning step unless the step absolutely requires the  
default partition to be scanned (in contrast with the previous  
arrangement, which was to set it unless the step was able to prune it).  
So get_matching_partitions() must explicitly check the partition that  
each returned bound value corresponds to in order to determine whether  
the default one needs to be included, rather than relying on the flag  
from the final step result.  
  
Author: Yuzuko Hosoya <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Make relnote item wording consistent

commit   : d58c9c0e9f408da7e9bf1901a39ab1ff12f310c0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Aug 2019 01:30:12 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Aug 2019 01:30:12 -0400    

Click here for diff

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

Fix representation of hash keys in Hash/HashJoin nodes.

commit   : a668bc75996daaa155442915c73a2c4dab2ac999    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 2 Aug 2019 00:02:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 2 Aug 2019 00:02:49 -0700    

Click here for diff

In 5f32b29c1819 I changed the creation of HashState.hashkeys to  
actually use HashState as the parent (instead of HashJoinState, which  
was incorrect, as they were executed below HashState), to fix the  
problem of hashkeys expressions otherwise relying on slot types  
appropriate for HashJoinState, rather than HashState as would be  
correct. That reliance was only introduced in 12, which is why it  
previously worked to use HashJoinState as the parent (although I'd be  
unsurprised if there were problematic cases).  
  
Unfortunately that's not a sufficient solution, because before this  
commit, the to-be-hashed expressions referenced inner/outer as  
appropriate for the HashJoin, not Hash. That didn't have obvious bad  
consequences, because the slots containing the tuples were put into  
ecxt_innertuple when hashing a tuple for HashState (even though Hash  
doesn't have an inner plan).  
  
There are less common cases where this can cause visible problems  
however (rather than just confusion when inspecting such executor  
trees). E.g. "ERROR: bogus varno: 65000", when explaining queries  
containing a HashJoin where the subsidiary Hash node's hash keys  
reference a subplan. While normally hashkeys aren't displayed by  
EXPLAIN, if one of those expressions references a subplan, that  
subplan may be printed as part of the Hash node - which then failed  
because an inner plan was referenced, and Hash doesn't have that.  
  
It seems quite possible that there's other broken cases, too.  
  
Fix the problem by properly splitting the expression for the HashJoin  
and Hash nodes at plan time, and have them reference the proper  
subsidiary node. While other workarounds are possible, fixing this  
correctly seems easy enough. It was a pretty ugly hack to have  
ExecInitHashJoin put the expression into the already initialized  
HashState, in the first place.  
  
I decided to not just split inner/outer hashkeys inside  
make_hashjoin(), but also to separate out hashoperators and  
hashcollations at plan time. Otherwise we would have ended up having  
two very similar loops, one at plan time and the other during executor  
startup. The work seems to more appropriately belong to plan time,  
anyway.  
  
Reported-By: Nikita Glukhov, Alexander Korotkov  
Author: Andres Freund  
Reviewed-By: Tom Lane, in an earlier version  
Discussion: https://postgr.es/m/CAPpHfdvGVegF_TKKRiBrSmatJL2dR9uwFCuR+teQ_8tEXU8mxg@mail.gmail.com  
Backpatch: 12-  

M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

Fix handling of previous password hooks in passwordcheck

commit   : 20f5cb19582e62e5664e87f7d6963cb8db1628f9    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 1 Aug 2019 09:37:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 1 Aug 2019 09:37:48 +0900    

Click here for diff

When piling up loading of modules using check_password_hook_type,  
loading passwordcheck would remove any trace of a previously-loaded  
hook.  Unloading the module would also cause previous hooks to be  
entirely gone.  
  
Reported-by: Rafael Castro  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M contrib/passwordcheck/passwordcheck.c

Fix pg_dump's handling of dependencies for custom opclasses.

commit   : 408f759380c723b94e9fb8b523aa02509e1e1d6e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Jul 2019 15:42:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Jul 2019 15:42:50 -0400    

Click here for diff

Since pg_dump doesn't treat the member operators and functions of operator  
classes/families (that is, the pg_amop and pg_amproc entries, not the  
underlying operators/functions) as separate dumpable objects, it missed  
their dependency information.  I think this was safe when the code was  
designed, because the default object sorting rule emits operators and  
functions before opclasses, and there were no dependency types that could  
mess that up.  However, the introduction of range types in 9.2 broke it:  
now a type can have a dependency on an opclass, allowing dependency rules  
to push the opclass before the type and hence before custom operators.  
Lacking any information showing that it shouldn't do so, pg_dump emitted  
the objects in the wrong order.  
  
Fix by teaching getDependencies() to translate pg_depend entries for  
pg_amop/amproc rows to look like dependencies for their parent opfamily.  
  
I added a regression test for this in HEAD/v12, but not further back;  
life is too short to fight with 002_pg_dump.pl.  
  
Per bug #15934 from Tom Gottfried.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove superfluous newlines in function prototypes.

commit   : c4b7bb3cf19f5d847544de93c36329de8e59193b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 31 Jul 2019 00:05:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 31 Jul 2019 00:05:21 -0700    

Click here for diff

These were introduced by pgindent due to fixe to broken  
indentation (c.f. 8255c7a5eeba8). Previously the mis-indentation of  
function prototypes was creatively used to reduce indentation in a few  
places.  
  
As that formatting only exists in master and REL_12_STABLE, it seems  
better to fix it in both, rather than having some odd indentation in  
v12 that somebody might copy for future patches or such.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-  

M src/backend/commands/event_trigger.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/libpq/auth.c
M src/backend/storage/ipc/sinval.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/access/gist_private.h
M src/include/replication/logical.h
M src/include/replication/reorderbuffer.h
M src/include/storage/sinval.h
M src/include/utils/guc.h

Allow table AM's to use rd_amcache, too.

commit   : 394f7500ae8f4afc158273d642f5ce87af3a7309    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jul 2019 21:43:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jul 2019 21:43:27 +0300    

Click here for diff

The rd_amcache allows an index AM to cache arbitrary information in a  
relcache entry. This commit moves the cleanup of rd_amcache so that it  
can also be used by table AMs. Nothing takes advantage of that yet, but  
I'm sure it'll come handy for anyone writing new table AMs.  
  
Backpatch to v12, where table AM interface was introduced.  
  
Reviewed-by: Julien Rouhaud  

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

Print WAL position correctly in pg_rewind error message.

commit   : 718e313244a9376d823b5efe421eb079474a6b20    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jul 2019 21:14:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 30 Jul 2019 21:14:14 +0300    

Click here for diff

This has been wrong ever since pg_rewind was added. The if-branch just  
above this, where we print the same error with an extra message supplied  
by XLogReadRecord() got this right, but the variable name was wrong in the  
else-branch. As a consequence, the error printed the WAL position as  
0/0 if there was an error reading a WAL file.  
  
Backpatch to 9.5, where pg_rewind was added.  

M src/bin/pg_rewind/parsexlog.c

Don't build extended statistics on inheritance trees

commit   : e1947f6c3ed8bda397295f555fa9e3fe39d50143    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 30 Jul 2019 19:17:12 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 30 Jul 2019 19:17:12 +0200    

Click here for diff

When performing ANALYZE on inheritance trees, we collect two samples for  
each relation - one for the relation alone, and one for the inheritance  
subtree (relation and its child relations). And then we build statistics  
on each sample, so for each relation we get two sets of statistics.  
  
For regular (per-column) statistics this works fine, because the catalog  
includes a flag differentiating statistics built from those two samples.  
But we don't have such flag in the extended statistics catalogs, and we  
ended up updating the same row twice, triggering this error:  
  
  ERROR:  tuple already updated by self  
  
The simplest solution is to disable extended statistics on inheritance  
trees, which is what this commit is doing. In the future we may need to  
do something similar to per-column statistics, but that requires adding a  
flag to the catalog - and that's not backpatchable. Moreover, the current  
selectivity estimation code only works with individual relations, so  
building statistics on inheritance trees would be pointless anyway.  
  
Author: Tomas Vondra  
Backpatch-to: 10-  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: Justin Pryzby  

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

Fix busted logic for parallel lock grouping in TopoSort().

commit   : d933816c04c64326419bbcd89dc17a4e310f950b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jul 2019 18:49:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jul 2019 18:49:04 -0400    

Click here for diff

A "break" statement erroneously left behind by commit a1c1af2a1  
caused TopoSort to do the wrong thing if a lock's wait list  
contained multiple members of the same locking group.  
  
Because parallel workers don't normally need any locks not already  
taken by their leader, this is very hard --- maybe impossible ---  
to hit in production.  Still, if it did happen, the queries involved  
in an otherwise-resolvable deadlock would block until canceled.  
  
In addition to removing the bogus "break", add an Assert showing  
that the conflicting uses of the beforeConstraints[] array (for both  
counts and flags) don't overlap, and add some commentary explaining  
why not; because it's not obvious without explanation, IMHO.  
  
Original report and patch from Rui Hai Jiang; additional assert  
and commentary by me.  Back-patch to 9.6 where the bug came in.  
  
Discussion: https://postgr.es/m/CAEri+mLd3bpHLyW+a9pSe1y=aEkeuJpwBSwvo-+m4n7-ceRmXw@mail.gmail.com  

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

Fix handling of expressions and predicates in REINDEX CONCURRENTLY

commit   : 28bbf7a81b3a30504cc7dfdbd76b410d1f127b8e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Jul 2019 09:58:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Jul 2019 09:58:49 +0900    

Click here for diff

When copying the definition of an index rebuilt concurrently for the new  
entry, the index information was taken directly from the old index using  
the relation cache.  In this case, predicates and expressions have  
some post-processing to prepare things for the planner, which loses some  
information including the collations added in any of them.  
  
This inconsistency can cause issues when attempting for example a table  
rewrite, and makes the new indexes rebuilt concurrently inconsistent  
with the old entries.  
  
In order to fix the problem, fetch expressions and predicates directly  
from the catalog of the old entry, and fill in IndexInfo for the new  
index with that.  This makes the process more consistent with  
DefineIndex(), and the code is refactored with the addition of a routine  
to create an IndexInfo node.  
  
Reported-by: Manuel Rigger  
Author: Michael Paquier  
Discussion: https://postgr.es/m/CA+u7OA5Hp0ra235F3czPom_FyAd-3+XwSJmX95r1+sRPOJc9VQ@mail.gmail.com  
Backpatch-through: 12  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/nodes/makefuncs.c
M src/include/nodes/makefuncs.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Avoid macro clash with LLVM 9.

commit   : 180825fe43ece9bf13c27929b7fdeec5a457e9c3    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 29 Jul 2019 10:12:37 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 29 Jul 2019 10:12:37 +1200    

Click here for diff

Early previews of LLVM 9 reveal that our Min() macro causes compiler  
errors in LLVM headers reached by the #include directives in  
llvmjit_inline.cpp.  Let's just undefine it.  Per buildfarm animal  
seawasp.  Back-patch to 11.  
  
Reviewed-by: Fabien Coelho, Tom Lane  
Discussion: https://postgr.es/m/20190606173216.GA6306%40alvherre.pgsql  

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

Doc: Fix event trigger firing table

commit   : e396d1ee7db5027302bc8ce129b435dee13723a4    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 28 Jul 2019 22:02:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 28 Jul 2019 22:02:30 +0900    

Click here for diff

The table has not been updated for some commands introduced in recent  
releases, so refresh it.  While on it, reorder entries alphabetically.  
  
Backpatch all the way down for all the commands which have gone  
missing.  
  
Reported-by: Jeremy Smith  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/event-trigger.sgml

pg_upgrade: Update obsolescent documentation note

commit   : 66190f371d8a6fd7d2ab50187041ce1da44cbb3b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 08:26:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Jul 2019 08:26:33 +0200    

Click here for diff

Recently released xfsprogs 5.1.0 has reflink support enabled by  
default, so the note that it's not enabled by default can be removed.  

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

Don't uselessly escape a string that doesn't need escaping

commit   : 5ac684381df1783b0855d3b53b1c6d4736843695    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jul 2019 17:46:40 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jul 2019 17:46:40 -0400    

Click here for diff

Per gripe from Ian Barwick  
  
Co-authored-by: Ian Barwick <[email protected]>  
Discussion: https://postgr.es/m/CABvVfJWNnNKb8cHsTLhkTsvL1+G6BVcV+57+w1JZ61p8YGPdWQ@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Tweak our special-case logic for the IANA "Factory" timezone.

commit   : d095b2fe676a929837715ece04ae19e0d8a1dcc3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 13:07:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 13:07:08 -0400    

Click here for diff

pg_timezone_names() tries to avoid showing the "Factory" zone in  
the view, mainly because that has traditionally had a very long  
"abbreviation" such as "Local time zone must be set--see zic manual page",  
so that showing it messes up psql's formatting of the whole view.  
Since tzdb version 2016g, IANA instead uses the abbreviation "-00",  
which is sane enough that there's no reason to discriminate against it.  
  
On the other hand, it emerges that FreeBSD and possibly other packagers  
are so wedded to backwards compatibility that they hack the IANA data  
to keep the old spelling --- and not just that old spelling, but even  
older spellings that IANA used back in the stone age.  This caused the  
filter logic to fail to suppress "Factory" at all on such platforms,  
though the formatting problem is definitely real in that case.  
  
To solve both problems, get rid of the hard-wired assumption about  
exactly what Factory's abbreviation is, and instead reject abbreviations  
exceeding 31 characters.  This will allow Factory to appear in the view  
if and only if it's using the modern abbreviation.  
  
In passing, simplify the code we add to zic.c to support "zic -P"  
to remove its now-obsolete hacks to not print the Factory zone's  
abbreviation.  Unlike pg_timezone_names(), there's no reason for  
that code to support old/nonstandard timezone data.  
  
Since we generally prefer to keep timezone-related behavior the  
same in all branches, and since this is arguably a bug fix,  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/datetime.c
M src/timezone/zic.c

Avoid choosing "localtime" or "posixrules" as TimeZone during initdb.

commit   : e31dfe99c8c686726c09c4bdf9d4e2c78fd5fc37    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 12:45:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 12:45:32 -0400    

Click here for diff

Some platforms create a file named "localtime" in the system  
timezone directory, making it a copy or link to the active time  
zone file.  If Postgres is built with --with-system-tzdata, initdb  
will see that file as an exact match to localtime(3)'s behavior,  
and it may decide that "localtime" is the most preferred spelling of  
the active zone.  That's a very bad choice though, because it's  
neither informative, nor portable, nor stable if someone changes  
the system timezone setting.  Extend the preference logic added by  
commit e3846a00c so that we will prefer any other zone file that  
matches localtime's behavior over "localtime".  
  
On the same logic, also discriminate against "posixrules", which  
is another not-really-a-zone file that is often present in the  
timezone directory.  (Since we install "posixrules" but not  
"localtime", this change can affect the behavior of Postgres  
with or without --with-system-tzdata.)  
  
Note that this change doesn't prevent anyone from choosing these  
pseudo-zones if they really want to (i.e., by setting TZ for initdb,  
or modifying the timezone GUC later on).  It just prevents initdb  
from preferring these zone names when there are multiple matches to  
localtime's behavior.  
  
Since we generally prefer to keep timezone-related behavior the  
same in all branches, and since this is arguably a bug fix,  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CADT4RqCCnj6FKLisvT8tTPfTP4azPhhDFJqDF1JfBbOH5w4oyQ@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/findtimezone.c

Fix loss of fractional digits for large values in cash_numeric().

commit   : 01e0538e8b12591283835a2ff629428262684574    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 11:59:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jul 2019 11:59:00 -0400    

Click here for diff

Money values exceeding about 18 digits (depending on lc_monetary)  
could be inaccurately converted to numeric, due to select_div_scale()  
deciding it didn't need to compute any fractional digits.  Force  
its hand by setting the dscale of one division input to equal the  
number of fractional digits we need.  
  
In passing, rearrange the logic to not do useless work in locales  
where money values are considered integral.  
  
Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: PG 12 relnotes - add item about amcheck index root check

commit   : ba2347a6d985afc19d4c8e8e84b16a28ed4df137    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 25 Jul 2019 21:37:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 25 Jul 2019 21:37:04 -0400    

Click here for diff

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

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

doc: PG 12 relnotes, add item - pg_test_fsync fix on Windows

commit   : 551394ff3a35090873f359995568b661c60a7376    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 25 Jul 2019 21:05:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 25 Jul 2019 21:05:51 -0400    

Click here for diff

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

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

Fix LDAP test instability.

commit   : 3964d3bce9ca1e45301f99800fc798768f7b57ac    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 26 Jul 2019 10:01:18 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 26 Jul 2019 10:01:18 +1200    

Click here for diff

After starting slapd, wait until it can accept a connection before  
beginning the real test work.  This avoids occasional test failures.  
Back-patch to 11, where the LDAP tests arrived.  
  
Author: Thomas Munro  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/20190719033013.GI1859%40paquier.xyz  

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

Add missing (COSTS OFF) to EXPLAIN added in previous commit.

commit   : c4944a93eb526f3799a36f30d46d6e765108b2b4    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Jul 2019 14:50:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Jul 2019 14:50:48 -0700    

Click here for diff

Backpatch: 12-, like the previous commit  

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

Fix slot type handling for Agg nodes performing internal sorts.

commit   : 8677c62eaeea002712dd71dc678a7a0566e59858    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 25 Jul 2019 14:22:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 25 Jul 2019 14:22:52 -0700    

Click here for diff

Since 15d8f8312 we assert that - and since 7ef04e4d2cb2, 4da597edf1  
rely on - the slot type for an expression's  
ecxt_{outer,inner,scan}tuple not changing, unless explicitly flagged  
as such. That allows to either skip deforming (for a virtual tuple  
slot) or optimize the code for JIT accelerated deforming  
appropriately (for other known slot types).  
  
This assumption was sometimes violated for grouping sets, when  
nodeAgg.c internally uses tuplesorts, and the child node doesn't  
return a TTSOpsMinimalTuple type slot. Detect that case, and flag that  
the outer slot might not be "fixed".  
  
It's probably worthwhile to optimize this further in the future, and  
more granularly determine whether the slot is fixed. As we already  
instantiate per-phase transition and equal expressions, we could  
cheaply set the slot type appropriately for each phase.  But that's a  
separate change from this bugfix.  
  
This commit does include a very minor optimization by avoiding to  
create a slot for handling tuplesorts, if no such sorts are  
performed. Previously we created that slot unnecessarily in the common  
case of computing all grouping sets via hashing. The code looked too  
confusing without that, as the conditions for needing a sort slot and  
flagging that the slot type isn't fixed, are the same.  
  
Reported-By: Ashutosh Sharma  
Author: Andres Freund  
Discussion: https://postgr.es/m/CAE9k0PmNaMD2oHTEAhRyxnxpaDaYkuBYkLa1dpOpn=RS0iS2AQ@mail.gmail.com  
Backpatch: 12-, where the bug was introduced in 15d8f8312  

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

Fix syntax error in commit 20e99cddd.

commit   : b2453704673469ffd34ed13a642e3edc936f5a24    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 14:42:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 14:42:02 -0400    

Click here for diff

Per buildfarm.  

M src/tools/msvc/MSBuildProject.pm

Fix failures to ignore \r when reading Windows-style newlines.

commit   : c58cf97f2fc464e15f0cca95b9d31b7224d48ecd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 12:10:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 12:10:54 -0400    

Click here for diff

libpq failed to ignore Windows-style newlines in connection service files.  
This normally wasn't a problem on Windows itself, because fgets() would  
convert \r\n to just \n.  But if libpq were running inside a program that  
changes the default fopen mode to binary, it would see the \r's and think  
they were data.  In any case, it's project policy to ignore \r in text  
files unconditionally, because people sometimes try to use files with  
DOS-style newlines on Unix machines, where the C library won't hide that  
from us.  
  
Hence, adjust parseServiceFile() to ignore \r as well as \n at the end of  
the line.  In HEAD, go a little further and make it ignore all trailing  
whitespace, to match what it's always done with leading whitespace.  
  
In HEAD, also run around and fix up everyplace where we have  
newline-chomping code to make all those places look consistent and  
uniformly drop \r.  It is not clear whether any of those changes are  
fixing live bugs.  Most of the non-cosmetic changes are in places that  
are reading popen output, and the jury is still out as to whether popen  
on Windows can return \r\n.  (The Windows-specific code in pipe_read_line  
seems to think so, but our lack of support for this elsewhere suggests  
maybe it's not a problem in practice.)  Hence, I desisted from applying  
those changes to back branches, except in run_ssl_passphrase_command()  
which is new enough and little-tested enough that we'd probably not have  
heard about any problems there.  
  
Tom Lane and Michael Paquier, per bug #15827 from Jorge Gustavo Rocha.  
Back-patch the parseServiceFile() change to all supported branches,  
and the run_ssl_passphrase_command() change to v11 where that was added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Honor MSVC WindowsSDKVersion if set

commit   : 6e5417d7737bdcc26ca7889210f275a8e46591b0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jul 2019 11:24:23 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jul 2019 11:24:23 -0400    

Click here for diff

Add a line to the project file setting the target SDK. Otherwise, in for  
example VS2017, if the default but optional 8.1 SDK is not installed the  
build will fail.  
  
Patch from Peifeng Qiu, slightly edited by me.  
  
Discussion: https://postgr.es/m/CABmtVJhw1boP_bd4=b3Qv5YnqEdL696NtHFi2ruiyQ6mFHkeQQ@mail.gmail.com  
  
Backpatch to all live branches.  

M src/tools/msvc/MSBuildProject.pm

Fix contrib/sepgsql test policy to work with latest SELinux releases.

commit   : 665329abe7effa688dd96b34a0130109b669d36d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 11:02:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jul 2019 11:02:43 -0400    

Click here for diff

As of Fedora 30, it seems that the system-provided macros for setting  
up user privileges in SELinux policies don't grant the ability to read  
/etc/passwd, as they formerly did.  This restriction breaks psql  
(which tries to use getpwuid() to obtain the user name it's running  
under) and thereby the contrib/sepgsql regression test.  Add explicit  
specifications that we need the right to read /etc/passwd.  
  
Mike Palmiotto, per a report from me.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/sepgsql-regtest.te

doc: Fix typo

commit   : 2e60117aa9152ca11b54e95a41f72f71a2387f33    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 13:58:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jul 2019 13:58:53 +0200    

Click here for diff

M doc/src/sgml/libpq.sgml

Fix system column accesses in ON CONFLICT ... RETURNING.

commit   : f9257cffef3bb16aba2dbbe05fd8bf0afaa6b1f2    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 24 Jul 2019 18:45:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 24 Jul 2019 18:45:58 -0700    

Click here for diff

After 277cb789836 ON CONFLICT ... SET ... RETURNING failed with  
ERROR:  virtual tuple table slot does not have system attributes  
when taking the update path, as the slot used to insert into the  
table (and then process RETURNING) was defined to be a virtual slot in  
that commit. Virtual slots don't support system columns except for  
tableoid and ctid, as the other system columns are AM dependent.  
  
Fix that by using a slot of the table's type. Add tests for system  
column accesses in ON CONFLICT ...  RETURNING.  
  
Reported-By: Roby, bisected to the relevant commit by Jeff Janes  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where the bug was introduced in 277cb789836  

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

Fix failure with pgperlcritic from the TAP test of synchronous replication

commit   : 24a6b6af650132094f7f8547458a3835cf01be7f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 25 Jul 2019 07:55:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 25 Jul 2019 07:55:28 +0900    

Click here for diff

Oversight in 7d81bdc, which introduced a new routine in perl lacking a  
return clause.  Per buildfarm member crake.  
  
Backpatch down to 9.6 like its parent.  
  
Reported-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/test/recovery/t/007_sync_rep.pl

Fix infelicities in describeOneTableDetails' partitioned-table handling.

commit   : d16e514befb5fdcf59bb404e828d3ce88a829b8e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Jul 2019 18:14:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Jul 2019 18:14:26 -0400    

Click here for diff

describeOneTableDetails issued a partition-constraint-fetching query  
for every table, even ones it knows perfectly well are not partitions.  
  
To add insult to injury, it then proceeded to leak the empty PGresult  
if the table wasn't a partition.  Doing that a lot of times might  
amount to a meaningful leak, so this seems like a back-patchable bug.  
  
Fix that, and also fix a related PGresult leak in the partition-parent  
case (though that leak would occur only if we got no row, which is  
unexpected).  
  
Minor code beautification too, to make this code look more like the  
pre-existing code around it.  
  
Back-patch the whole change into v12.  However, the fact that we already  
know whether the table is a partition dates only to commit 1af25ca0c;  
back-patching the relevant changes from that is probably more churn  
than is justified in released branches.  Hence, in v11 and v10, just  
do the minimum to fix the PGresult leaks.  
  
Noted while messing around with adjacent code for yesterday's \d  
improvements.  

M src/bin/psql/describe.c

Use full 64-bit XID for checking if a deleted GiST page is old enough.

commit   : fb5344c969af77bb78bc2a643fb75b9f8fea72dd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Jul 2019 20:24:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Jul 2019 20:24:07 +0300    

Click here for diff

Otherwise, after a deleted page gets even older, it becomes unrecyclable  
again. B-tree has the same problem, and has had since time immemorial,  
but let's at least fix this in GiST, where this is new.  
  
Backpatch to v12, where GiST page deletion was introduced.  
  
Reviewed-by: Andrey Borodin  
Discussion: https://www.postgresql.org/message-id/835A15A5-F1B4-4446-A711-BF48357EB602%40yandex-team.ru  

M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/utils/time/snapmgr.c
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/utils/snapmgr.h

Refactor checks for deleted GiST pages.

commit   : e2e992c93145cfc0e3563fb84efd25b390a84bb9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Jul 2019 20:24:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Jul 2019 20:24:05 +0300    

Click here for diff

The explicit check in gistScanPage() isn't currently really necessary, as  
a deleted page is always empty, so the loop would fall through without  
doing anything, anyway. But it's a marginal optimization, and it gives a  
nice place to attach a comment to explain how it works.  
  
Backpatch to v12, where GiST page deletion was introduced.  
  
Reviewed-by: Andrey Borodin  
Discussion: https://www.postgresql.org/message-id/835A15A5-F1B4-4446-A711-BF48357EB602%40yandex-team.ru  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c

Don't assume expr is available in pgbench tests

commit   : bfa4263e7119685cddb08ed2e2b3462157d4d453    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 24 Jul 2019 11:41:39 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 24 Jul 2019 11:41:39 -0400    

Click here for diff

Windows hosts do not normally come with expr, so instead of using that  
to test the \setshell command, use echo instead, which is fairly  
universally available.  
  
Backpatch to release 11, where this came in.  
  
Problem found by me, patch by Fabien Coelho.  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Doc: Clarify interactions of pg_receivewal with remote_apply

commit   : a15a40aaaedfa01f41471f74aa8ac44168603fb9    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Jul 2019 11:26:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Jul 2019 11:26:24 +0900    

Click here for diff

Using pg_receivewal with synchronous_commit = remote_apply set in the  
backend is incompatible if pg_receivewal is a synchronous standby as it  
never applies WAL, so document this problem and solutions to it.  
  
Backpatch to 9.6, where remote_apply has been added.  
  
Author: Robert Haas, Jesper Pedersen  
Reviewed-by: Laurenz Albe, Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/ref/pg_receivewal.sgml

Improve stability of TAP test for synchronous replication

commit   : 0ceb28da06152cbf69c7e9a71c09e9de47783472    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Jul 2019 10:54:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Jul 2019 10:54:20 +0900    

Click here for diff

Slow buildfarm machines have run into issues with this TAP test caused  
by a race condition related to the startup of a set of standbys, where  
it is possible to finish with an unexpected order in the WAL sender  
array of the primary.  
  
This closes the race condition by making sure that any standby started  
is registered into the WAL sender array of the primary before starting  
the next one based on lookups of pg_stat_replication.  
  
Backpatch down to 9.6 where the test has been introduced.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Noah Misch  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/test/recovery/t/007_sync_rep.pl

Check that partitions are not in use when dropping constraints

commit   : 3ffe655c0af03cb4d5aab18da2aaa7022d207bf3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 23 Jul 2019 17:22:15 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 23 Jul 2019 17:22:15 -0400    

Click here for diff

If the user creates a deferred constraint in a partition, and in a  
transaction they cause the constraint's trigger execution to be deferred  
until commit time *and* drop the constraint, then when commit time comes  
the queued trigger will fail to run because the trigger object will have  
been dropped.  
  
This is explained because when a constraint gets dropped in a  
partitioned table, the recursion to drop the ones in partitions is done  
by the dependency mechanism, not by ALTER TABLE traversing the recursion  
tree as in all other cases.  In the non-partitioned case, this problem  
is avoided by checking that the table is not "in use" by alter-table;  
other alter-table subcommands that recurse to partitions do that check  
for each partition.  But the dependency mechanism doesn't have a way to  
do that.  Fix the problem by applying the same check to all partitions  
during ALTER TABLE's "prep" phase, which correctly raises the necessary  
error.  
  
Reported-by: Rajkumar Raghuwanshi <[email protected]>  
Discussion: https://postgr.es/m/CAKcux6nZiO9-eEpr1ZD84bT1mBoVmeZkfont8iSpcmYrjhGWgA@mail.gmail.com  

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

Install dependencies to prevent dropping partition key columns.

commit   : 79e573fa4986be54c30d1313709c26c2a34488c8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Jul 2019 14:55:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Jul 2019 14:55:23 -0400    

Click here for diff

The logic in ATExecDropColumn that rejects dropping partition key  
columns is quite an inadequate defense, because it doesn't execute  
in cases where a column needs to be dropped due to cascade from  
something that only the column, not the whole partitioned table,  
depends on.  That leaves us with a badly broken partitioned table;  
even an attempt to load its relcache entry will fail.  
  
We really need to have explicit pg_depend entries that show that the  
column can't be dropped without dropping the whole table.  Hence,  
add those entries.  In v12 and HEAD, bump catversion to ensure that  
partitioned tables will have such entries.  We can't do that in  
released branches of course, so in v10 and v11 this patch affords  
protection only to partitioned tables created after the patch is  
installed.  Given the lack of field complaints (this bug was found  
by fuzz-testing not by end users), that's probably good enough.  
  
In passing, fix ATExecDropColumn and ATPrepAlterColumnType  
messages to be more specific about which partition key column  
they're complaining about.  
  
Per report from Manuel Rigger.  Back-patch to v10 where partitioned  
tables were added.  
  
Discussion: https://postgr.es/m/CA+u7OA4JKCPFrdrAbOs7XBiCyD61XJxeNav4LefkSmBLQ-Vobg@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/bin/pg_dump/pg_dump_sort.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Don't rely on estimates for amcheck Bloom filters.

commit   : 980224b4a23056de76d902b539980868d33d1b8d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 20 Jul 2019 11:11:54 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 20 Jul 2019 11:11:54 -0700    

Click here for diff

Solely relying on a relation's reltuples/relpages estimate to size the  
Bloom filters used by amcheck verification makes verification less  
effective when the estimates are very stale.  In extreme cases,  
verification options that use Bloom filters internally could be totally  
ineffective, without users receiving any clear indication that certain  
types of corruption might easily be missed.  
  
To fix, use RelationGetNumberOfBlocks() instead of relpages to size the  
downlink block Bloom filter.  Use the same RelationGetNumberOfBlocks()  
value to derive a minimum size for the heapallindexed Bloom filter,  
rather than completely trusting reltuples.  Verification will still be  
reasonably effective when the projected/estimated number of Bloom filter  
elements is at least 1/5 of the final number of elements, which is  
assured by the new sizing logic.  
  
Reported-By: Alexander Korotkov  
Discussion: https://postgr.es/m/CAH2-Wzk0ke2J42KrNYBKu0Xovjy-sU5ub7PWjgpbsKdAQcL4OA@mail.gmail.com  
Backpatch: 11-, where downlink/heapallindexed verification were added.  

M contrib/amcheck/verify_nbtree.c

Use column collation for extended statistics

commit   : 5a8ee9f2dbe040b9a0cb7f73a4376633f93b4ab4    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 18 Jul 2019 12:28:16 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 18 Jul 2019 12:28:16 +0200    

Click here for diff

The current extended statistics code was a bit confused which collation  
to use.  When building the statistics, the collations defined as default  
for the data types were used (since commit 5e0928005).  The MCV code was  
however using the column collations for MCV serialization, and then  
DEFAULT_COLLATION_OID when computing estimates. So overall the code was  
using all three possible options, inconsistently.  
  
This uses the column colation everywhere - this makes it consistent with  
what 5e0928005 did for regular stats.  We however do not track the  
collations in a catalog, because we can derive them from column-level  
information.  This may need to change in the future, e.g. after allowing  
statistics on expressions.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  
Backpatch-to: 12  

M src/backend/commands/statscmds.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c

Rework examine_opclause_expression to use varonleft

commit   : fc4faea17971a927daf936a4b17564140ee412f6    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 19 Jul 2019 16:28:28 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 19 Jul 2019 16:28:28 +0200    

Click here for diff

The examine_opclause_expression function needs to return information on  
which side of the operator we found the Var, but the variable was called  
"isgt" which is rather misleading (it assumes the operator is either  
less-than or greater-than, but it may be equality or something else).  
Other places in the planner use a variable called "varonleft" for this  
purpose, so just adopt the same convention here.  
  
The code also assumed we don't care about this flag for equality, as  
(Var = Const) and (Const = Var) should be the same thing. But that does  
not work for cross-type operators, in which case we need to pass the  
parameters to the procedure in the right order. So just use the same  
code for all types of expressions.  
  
This means we don't need to care about the selectivity estimation  
function anymore, at least not in this code. We should only get the  
supported cases here (thanks to statext_is_compatible_clause).  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  
Backpatch-to: 12  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/include/statistics/extended_stats_internal.h

Silence compiler warning, hopefully.

commit   : 533522846ba050efe9df740e5916ced87144c8f2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Jul 2019 14:48:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Jul 2019 14:48:57 -0400    

Click here for diff

Absorb commit e5e04c962a5d12eebbf867ca25905b3ccc34cbe0 from upstream  
IANA code, in hopes of silencing warnings from MSVC about negating  
a bool value.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/zic.c

Doc: clarify when table rewrites happen with column addition and DEFAULT

commit   : b990cc38dc64f3333c1c61aba247bfbaea1475f8    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Jul 2019 11:43:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Jul 2019 11:43:05 +0900    

Click here for diff

16828d5 has improved ALTER TABLE so as a column addition does not  
require a rewrite for a non-NULL default with constant expressions, but  
one spot in the documentation did not get updated consistently.  
The documentation also now clarifies the fact that this does not apply  
if the expression is volatile, where a table rewrite is still required.  
  
Reported-by: Daniel Westermann  
Author: Ian Barwick  
Reviewed-by: Michael Paquier, Daniel Westermann  
Discussion: https://postgr.es/m/DB6PR0902MB2184C7D5645CF15D75EB7957D2CF0@DB6PR0902MB2184.eurprd09.prod.outlook.com  
Backpatch-through: 11  

M doc/src/sgml/ddl.sgml

Fix error in commit e6feef57.

commit   : 5245552ddbc43b7705389cae9c5095e687a3c950    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 18 Jul 2019 17:26:56 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 18 Jul 2019 17:26:56 -0700    

Click here for diff

I was careless passing a datum directly to DATE_NOT_FINITE without  
calling DatumGetDateADT() first.  
  
Backpatch-through: 9.4  

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

Fix daterange canonicalization for +/- infinity.

commit   : 613eabcd51c3adec50e28c1f151d574db5a05a9e    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 18 Jul 2019 17:26:47 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 18 Jul 2019 17:26:47 -0700    

Click here for diff

The values 'infinity' and '-infinity' are a part of the DATE type  
itself, so a bound of the date 'infinity' is not the same as an  
unbounded/infinite range. However, it is still wrong to try to  
canonicalize such values, because adding or subtracting one has no  
effect. Fix by treating 'infinity' and '-infinity' the same as  
unbounded ranges for the purposes of canonicalization (but not other  
purposes).  
  
Backpatch to all versions because it is inconsistent with the  
documented behavior. Note that this could be an incompatibility for  
applications relying on the behavior contrary to the documentation.  
  
Author: Laurenz Albe  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/77f24ea19ab802bc9bc60ddbb8977ee2d646aec1.camel%40cybertec.at  
Backpatch-through: 9.4  

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

Fix nbtree metapage cache upgrade bug.

commit   : 7772dece98506233f40c6751e5adb7983a0c1635    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 18 Jul 2019 13:22:54 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 18 Jul 2019 13:22:54 -0700    

Click here for diff

Commit 857f9c36cda, which taught nbtree VACUUM to avoid unnecessary  
index scans, bumped the nbtree version number from 2 to 3, while adding  
the ability for nbtree indexes to be upgraded on-the-fly.  Various  
assertions that assumed that an nbtree index was always on version 2 had  
to be changed to accept any supported version (version 2 or 3 on  
Postgres 11).  
  
However, a few assertions were missed in the initial commit, all of  
which were in code paths that cache a local copy of the metapage  
metadata, where the index had been expected to be on the current version  
(no longer version 2) as a generic sanity check.  Rather than simply  
update the assertions, follow-up commit 0a64b45152b intentionally made  
the metapage caching code update the per-backend cached metadata version  
without changing the on-disk version at the same time.  This could even  
happen when the planner needed to determine the height of a B-Tree for  
costing purposes.  The assertions only fail on Postgres v12 when  
upgrading from v10, because they were adjusted to use the authoritative  
shared memory metapage by v12's commit dd299df8.  
  
To fix, remove the cache-only upgrade mechanism entirely, and update the  
assertions themselves to accept any supported version (go back to using  
the cached version in v12).  The fix is almost a full revert of commit  
0a64b45152b on the v11 branch.  
  
VACUUM only considers the authoritative metapage, and never bothers with  
a locally cached version, whereas everywhere else isn't interested in  
the metapage fields that were added by commit 857f9c36cda.  It seems  
unlikely that this bug has affected any user on v11.  
  
Reported-By: Christoph Berg  
Bug: #15896  
Discussion: https://postgr.es/m/15896-5b25e260fdb0b081%40postgresql.org  
Backpatch: 11-, where VACUUM was taught to avoid unnecessary index scans.  

M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/nbtree.h

Simplify bitmap updates in multivariate MCV code

commit   : 79d3a1e52a3c1706cbabb00aec9175da7055319d    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 17 Jul 2019 18:16:50 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 17 Jul 2019 18:16:50 +0200    

Click here for diff

When evaluating clauses on a multivariate MCV list, we build a bitmap  
tracking how the clauses match each item of the MCV list.  When updating  
the bitmap we need to consider the current value (tracking how the item  
matches preceding clauses), match for the current clause and whether the  
clauses are connected by AND or OR.  
  
Until now the logic was copied on every place updating the bitmap, which  
was not quite readable.  So just move it to a separate function and call  
it where needed.  
  
Backpatch to 12, where the code was introduced. While not a bugfix, this  
should make maintenance and future backpatches easier.  
  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  

M src/backend/statistics/mcv.c

Fix handling of NULLs in MCV items and constants

commit   : 1c2acc32dc6cb15c6ea038a954af9a4db8d01f08    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 15 Jul 2019 02:00:31 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 15 Jul 2019 02:00:31 +0200    

Click here for diff

There were two issues in how the extended statistics handled NULL values  
in opclauses. Firstly, the code was oblivious to the possibility that  
Const may be NULL (constisnull=true) in which case the constvalue is  
undefined. We need to treat this as a mismatch, and not call the proc.  
  
Secondly, the MCV item itself may contain NULL values too - the code  
already did check that, and updated the match bitmap accordingly, but  
failed to ensure we won't call the operator procedure anyway. It did  
work for AND-clauses, because in that case false in the bitmap stops  
evaluation of further clauses. But for OR-clauses ir was not easy to  
get incorrect estimates or even trigger a crash.  
  
This fixes both issues by extending the existing check so that it looks  
at constisnull too, and making sure it skips calling the procedure.  
  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  

M src/backend/statistics/mcv.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix handling of opclauses in extended statistics

commit   : 42276976a1437c88fb6176fc1a876fd79a139eb0    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 13 Jul 2019 00:12:16 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 13 Jul 2019 00:12:16 +0200    

Click here for diff

We expect opclauses to have exactly one Var and one Const, but the code  
was checking the Const by calling is_pseudo_constant_clause() which is  
incorrect - we need a proper constant.  
  
Fixed by using plain IsA(x,Const) to check type of the node. We need to  
do these checks in two places, so move it into a separate function that  
can be called in both places.  
  
Reported by Andreas Seltenreich, based on crash reported by sqlsmith.  
  
Backpatch to v12, where this code was introduced.  
  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  
Backpatch-to: 12  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/include/statistics/extended_stats_internal.h

Remove unnecessary TYPECACHE_GT_OPR lookup

commit   : 3944e855bc5bee32d99a9ba2245a026d4bafe282    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 17 Jul 2019 18:13:39 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 17 Jul 2019 18:13:39 +0200    

Click here for diff

The TYPECACHE_GT_OPR is not needed (it used to be in older version of  
the MCV code), but the compiler failed to detect this as the result was  
used in a fmgr_info() call, populating a FmgrInfo entry.  
  
Backpatch to v12, where this code was introduced.  
  
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu  
Backpatch-to: 12  

M src/backend/statistics/mcv.c

tableam: comment improvements.

commit   : fa7bb9345370ab69cac24b7213262f36567d9c9c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 17 Jul 2019 19:39:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 17 Jul 2019 19:39:54 -0700    

Click here for diff

Author: Brad DeJong  
Discussion: https://postgr.es/m/CAJnrtnxDYOQFsDfWz2iri0T_fFL2ZbbzgCOE=4yaMcszgcsf4A@mail.gmail.com  
Backpatch: 12-  

M src/include/access/tableam.h

Simplify description of --data-checksums in documentation of initdb

commit   : 4ed6001d7889f534e052e67e39acc2eb477fc645    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jul 2019 10:06:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jul 2019 10:06:50 +0900    

Click here for diff

The documentation mentioned that data checksums cannot be changed after  
initialization, which is not true as pg_checksums can do that with its  
--enable option introduced in v12.  This simply removes the sentence  
telling so.  
  
Reported-by: Basil Bourque  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Update time zone data files to tzdata release 2019b.

commit   : d4f283162e8d09ca39085b2745e99543990e1d06    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 19:15:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 19:15:21 -0400    

Click here for diff

Brazil no longer observes DST.  
Historical corrections for Palestine, Hong Kong, and Italy.  

M src/timezone/data/tzdata.zi

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

commit   : 59cea8f36be725533a0f94607f498b7628aa4b9d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 18:26:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Jul 2019 18:26:23 -0400    

Click here for diff

A large fraction of this diff is just due to upstream's somewhat  
random decision to rename a bunch of internal variables and struct  
fields.  However, there is an interesting new feature in zic:  
it's grown a "-b slim" option that emits zone files without 32-bit  
data and other backwards-compatibility hacks.  We should consider  
whether we wish to enable that.  

M src/timezone/README
M src/timezone/localtime.c
M src/timezone/pgtz.h
M src/timezone/tzfile.h
M src/timezone/zic.c

Fix thinko in construction of old_conpfeqop list.

commit   : e0d13dc6fd71cc647af8aaa82179f1b878f41437    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 18:17:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Jul 2019 18:17:47 -0400    

Click here for diff

This should lappend the OIDs, not lcons them; the existing code produced  
a list in reversed order.  This is harmless for single-key FKs or FKs  
where all the key columns are of the same type, which probably explains  
how it went unnoticed.  But if those conditions are not met,  
ATAddForeignKeyConstraint would make the wrong decision about whether an  
existing FK needs to be revalidated.  I think it would almost always err  
in the safe direction by revalidating a constraint that didn't need it.  
You could imagine scenarios where the pfeqop check was fooled by  
swapping the types of two FK columns in one ALTER TABLE, but that case  
would probably be rejected by other tests, so it might be impossible to  
get to the worst-case scenario where an FK should be revalidated and  
isn't.  (And even then, it's likely to be fine, unless there are weird  
inconsistencies in the equality behavior of the replacement types.)  
However, this is a performance bug at least.  
  
Noted while poking around to see whether lcons calls could be converted  
to lappend.  
  
This bug is old, dating to commit cb3a7c2b9, so back-patch to all  
supported branches.  

M src/backend/commands/tablecmds.c

doc: Fix Tamil language mention in PG 12 docs

commit   : 178ca6b26c3d59ff330b229f11fca89001749ea1    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 15 Jul 2019 21:18:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 15 Jul 2019 21:18:49 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CACPNZCs2c7yLGKhtcL=h9OmZdwQQDshFs9Bxypo=Fc5b0TVsMQ@mail.gmail.com  
  
Backpatch-through: 12  

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

doc: mention pg_reload_conf() for reloading the config file

commit   : d116ebca6ccc3712dadd024be3d14852c7e03984    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 15 Jul 2019 20:57:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 15 Jul 2019 20:57:24 -0400    

Click here for diff

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

M doc/src/sgml/client-auth.sgml

Correct nbtsplitloc.c comment.

commit   : ac37bd51a4227683529f37148d6aefc95c837abb    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 15 Jul 2019 14:35:05 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 15 Jul 2019 14:35:05 -0700    

Click here for diff

The logic just added by commit e3899ffd falls back on a 50:50 page split  
in the event of a new item that's just to the right of our provisional  
"many duplicates" split point.  Fix a comment that incorrectly claimed  
that the new item had to be just to the left of our provisional split  
point.  
  
Backpatch: 12-, just like commit e3899ffd.  

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

Fix pathological nbtree split point choice issue.

commit   : 2f23453e492955c32d952bc1cff651e66657d32b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 15 Jul 2019 13:19:12 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 15 Jul 2019 13:19:12 -0700    

Click here for diff

Specific ever-decreasing insertion patterns could cause successive  
unbalanced nbtree page splits.  Problem cases involve a large group of  
duplicates to the left, and ever-decreasing insertions to the right.  
  
To fix, detect the situation by considering the newitem offset before  
performing a split using nbtsplitloc.c's "many duplicates" strategy.  If  
the new item was inserted just to the right of our provisional "many  
duplicates" split point, infer ever-decreasing insertions and fall back  
on a 50:50 (space delta optimal) split.  This seems to barely affect  
cases that already had acceptable space utilization.  
  
An alternative fix also seems possible.  Instead of changing  
nbtsplitloc.c split choice logic, we could instead teach _bt_truncate()  
to generate a new value for new high keys by interpolating from the  
lastleft and firstright key values.  That would certainly be a more  
elegant fix, but it isn't suitable for backpatching.  
  
Discussion: https://postgr.es/m/CAH2-WznCNvhZpxa__GqAa1fgQ9uYdVc=_apArkW2nc-K3O7_NA@mail.gmail.com  
Backpatch: 12-, where the nbtree page split enhancements were introduced.  

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

Fix documentation for pgbench tpcb-like.

commit   : dd5e47a92cfce52e3e35233a33b190ea498eed84    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 14 Jul 2019 14:19:54 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 14 Jul 2019 14:19:54 +1200    

Click here for diff

We choose a random value for delta, not balance.  Back-patch to 9.6 where  
the mistake arrived.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081752210.5867@lancre  

M doc/src/sgml/ref/pgbench.sgml

Revive test of concurrent OID generation.

commit   : dffb891d78cb0db0db010c2f263b8cff72e03aaa    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 13 Jul 2019 13:34:22 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 13 Jul 2019 13:34:22 -0700    

Click here for diff

Commit 578b229718e8f15fa779e20f086c4b6bb3776106 replaced it with a  
concurrent "nextval" test.  That version does not detect PostgreSQL's  
incompatibility with xlc 13.1.3, so bring back an OID-based test that  
does.  Back-patch to v12, where that commit first appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix and improve several places in the docs

commit   : de14e54d7bd71f9256aae08dec832af25da3fd35    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 13 Jul 2019 14:43:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 13 Jul 2019 14:43:48 +0900    

Click here for diff

This adds some missing markups, fixes a couple of incorrect ones and  
clarifies some documentation in various places.  
  
Author: Liudmila Mantrova  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M doc/src/sgml/backup.sgml
M doc/src/sgml/biblio.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/reindex.sgml

Fix get_actual_variable_range() to cope with broken HOT chains.

commit   : cee976c4e8c4d97286a015ab54aa859faf839b54    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Jul 2019 16:24:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Jul 2019 16:24:59 -0400    

Click here for diff

Commit 3ca930fc3 modified get_actual_variable_range() to use a new  
"SnapshotNonVacuumable" snapshot type for selecting tuples that it  
would consider valid.  However, because that snapshot type can accept  
recently-dead tuples, this caused a bug when using a recently-created  
index: we might accept a recently-dead tuple that is an early member  
of a broken HOT chain and does not actually match the index entry.  
Then, the data extracted from the heap tuple would not necessarily be  
an endpoint value of the column; it could even be NULL, leading to  
get_actual_variable_range() itself reporting "found unexpected null  
value in index".  Even without an error, this could lead to poor  
plan choices due to an erroneous notion of the endpoint value.  
  
We can improve matters by changing the code to use the index-only  
scan technique (which didn't exist when get_actual_variable_range was  
originally written).  If any of the tuples in a HOT chain are live  
enough to satisfy SnapshotNonVacuumable, we take the data from the  
index entry, ignoring what is in the heap.  This fixes the problem  
without changing the live-vs-dead-tuple behavior from what was  
intended by commit 3ca930fc3.  
  
A side benefit is that for static tables we might not have to touch  
the heap at all (when the extremal value is in an all-visible page).  
In addition, we can save some overhead by not having to create a  
complete ExecutorState, and we don't need to run FormIndexDatum,  
avoiding more cycles as well as the possibility of failure for  
indexes on expressions.  (I'm not sure that this code would ever  
be used to determine the extreme value of an expression, in the  
current state of the planner; but it's definitely possible that  
lower-order columns of the selected index could be expressions.  
So one could construct perhaps-artificial examples in which the  
old code unexpectedly failed due to trying to compute an  
expression's value for a now-dead row.)  
  
Per report from Manuel Rigger.  Back-patch to v11 where commit  
3ca930fc3 came in.  
  
Discussion: https://postgr.es/m/CA+u7OA7W4NWEhCvftdV6_8bbm2vgypi5nuxfnSEJQqVKFSUoMg@mail.gmail.com  

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

Fix RANGE partition pruning with multiple boolean partition keys

commit   : 30a268ed2e2944b3902d3e10a9876e498a0c12b9    
  
author   : David Rowley <[email protected]>    
date     : Fri, 12 Jul 2019 19:11:45 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 12 Jul 2019 19:11:45 +1200    

Click here for diff

match_clause_to_partition_key incorrectly would return  
PARTCLAUSE_UNSUPPORTED if a bool qual could not be matched to the current  
partition key.  This was a problem, as it causes the calling function to  
discard the qual and not try to match it to any other partition key.  If  
there was another partition key which did match this qual, then the qual  
would not be checked again and we could fail to prune some partitions.  
  
The worst this could do was to cause partitions not to be pruned when they  
could have been, so there was no danger of incorrect query results here.  
  
Fix this by changing match_boolean_partition_clause to have it return a  
PartClauseMatchStatus rather than a boolean value.  This allows it to  
communicate if the qual is unsupported or if it just does not match this  
particular partition key, previously these two cases were treated the  
same.  Now, if match_clause_to_partition_key is unable to match the qual  
to any other qual type then we can simply return the value from the  
match_boolean_partition_clause call so that the calling function properly  
treats the qual as either unmatched or unsupported.  
  
Reported-by: Rares Salcudean  
Reviewed-by: Amit Langote  
Backpatch-through: 11 where partition pruning was introduced  
Discussion: https://postgr.es/m/CAHp_FN2xwEznH6oyS0hNTuUUZKp5PvegcVv=Co6nBXJ+mC7Y5w@mail.gmail.com  

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

Fixes for jsonpath filter expression elements table in docs

commit   : 1ed89826b82c693c311d9974f3f3138013f1b929    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 11 Jul 2019 18:18:15 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 11 Jul 2019 18:18:15 +0300    

Click here for diff

Reported-by: Thom Brown  
Discussion: https://postgr.es/m/CAA-aLv4Tggy6Z3kaG9n%2B3SHwOVGN2Yj_MJXfdfwjH_jBNZzJNA%40mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/func.sgml

docs: remove pg_roles mention of the oid column being displayed

commit   : ff597b656febe152b1650fc5619e57fbd1364c2c    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 10 Jul 2019 14:24:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 10 Jul 2019 14:24:36 -0400    

Click here for diff

It is now always displayed in PG 12+.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Ian Barwick  
  
Backpatch-through: 12  

M doc/src/sgml/catalogs.sgml

Mention limitation of unique in partitioned tables

commit   : 220857a87508fdac3fd4caf5f344a8fe9e70702d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 10 Jul 2019 08:58:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 10 Jul 2019 08:58:41 -0400    

Click here for diff

Per gripe from Phil Bayer.  
  
Authors: Amit Langote and others  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Assorted fixes for jsonpath documentation

commit   : a5c2f3a346fcda21d3dc9227b2c07854a7973729    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 10 Jul 2019 15:43:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 10 Jul 2019 15:43:53 +0300    

Click here for diff

This commit contains assorted fixes for jsonpath documentation including:  
grammar fixes, incorrect examples fixes as well as wording improvements.  
  
Discussion: https://postgr.es/m/CAA-aLv4VVX%3Db9RK5hkfPXJczqaiTdqO04teW9i0wiQVhdKcqzw%40mail.gmail.com  
Author: Liudmila Mantrova  
Reviewed-by: Alexander Korotkov  
Reported-by: Thom Brown  
Backpatch-through: 12  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

Fix variable initialization when using buffering build with GiST

commit   : 4d713595914beb705539ca5cd09c8b3a95f65c70    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 10 Jul 2019 15:15:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 10 Jul 2019 15:15:03 +0900    

Click here for diff

This can cause valgrind to complain, as the flag marking a buffer as a  
temporary copy was not getting initialized.  
  
While on it, fill in with zeros newly-created buffer pages.  This does  
not matter when loading a block from a temporary file, but it makes the  
push of an index tuple into a new buffer page safer.  
  
This has been introduced by 1d27dcf, so backpatch all the way down to  
9.4.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M src/backend/access/gist/gistbuildbuffers.c

Fix missing calls to table_finish_bulk_insert during COPY, take 2

commit   : b8ef33b2d14519da0d038e9d63f51a6714ef764a    
  
author   : David Rowley <[email protected]>    
date     : Wed, 10 Jul 2019 16:02:18 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 10 Jul 2019 16:02:18 +1200    

Click here for diff

86b85044e abstracted calls to heap functions in COPY FROM to support a  
generic table AM.  However, when performing a copy into a partitioned  
table, this commit neglected to call table_finish_bulk_insert for each  
partition.  Before 86b85044e, when we always called the heap functions,  
there was no need to call heapam_finish_bulk_insert for partitions since  
it only did any work when performing a copy without WAL.  For partitioned  
tables, this was unsupported anyway, so there was no issue.  With  
pluggable storage, we can't make any assumptions about what the table AM  
might want to do in its equivalent function, so we'd better ensure we  
always call table_finish_bulk_insert each partition that's received a row.  
  
For now, we make the table_finish_bulk_insert call whenever we evict a  
CopyMultiInsertBuffer out of the CopyMultiInsertInfo.  This does mean  
that it's possible that we call table_finish_bulk_insert multiple times  
per partition, which is not a problem other than being an inefficiency.  
Improving this requires a more invasive patch, so let's leave that for  
another day.  
  
This also changes things so that we no longer needlessly call  
table_finish_bulk_insert when performing a COPY FROM for a non-partitioned  
table when not using multi-inserts.  
  
Reported-by: Robert Haas  
Backpatch-through: 12  
Discussion: https://postgr.es/m/CA+TgmoYK=6BpxiJ0tN-p9wtH0BTAfbdxzHhwou0mdud4+BkYuQ@mail.gmail.com  

M src/backend/commands/copy.c

Fix few typos and minor word smithing in tableam comments.

commit   : e33a1435be55f1f9aecff0337ed96f7e5092b146    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 10 Jul 2019 07:59:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 10 Jul 2019 07:59:51 +0530    

Click here for diff

Reported-by: Ashwin Agrawal  
Author: Ashwin Agrawal  
Reviewed-by: Amit Kapila  
Backpatch-through: 12, where it was introduced  
Discussion: https://postgr.es/m/CALfoeisgdZhYDrJOukaBzvXfJOK2FQ0szVMK7dzmcy6w93iDUA@mail.gmail.com  

M src/include/access/tableam.h

Pass QueryEnvironment down to EvalPlanQual's EState.

commit   : abbb2e14321313374c5fff3d3ecb626d98ee353e    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 10 Jul 2019 10:15:43 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 10 Jul 2019 10:15:43 +1200    

Click here for diff

Otherwise the executor can't see trigger transition tables during  
EPQ evaluation.  Fixes bug #15900 and almost certainly also #15720.  
Back-patch to 10, where trigger transition tables landed.  
  
Author: Alex Aktsipetrov  
Reviewed-by: Thomas Munro, Tom Lane  
Discussion: https://postgr.es/m/15900-bc482754fe8d7415%40postgresql.org  
Discussion: https://postgr.es/m/15720-38c2b29e5d720187%40postgresql.org  

M src/backend/executor/execMain.c

Propagate trigger arguments to partitions

commit   : ae0a2945b45ce63b7945284a7ddbb3e1c286fe95    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 9 Jul 2019 17:16:36 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 9 Jul 2019 17:16:36 -0400    

Click here for diff

We were creating the cloned triggers with an empty list of arguments,  
losing the ones that had been specified by the user when creating the  
trigger in the partitioned table.  Repair.  
  
This was forgotten in commit 86f575948c77.  
  
Author: Patrick McHardy  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Message style improvements

commit   : 48d6d5a2afa59c4cf83cad6719cbbf298ef27c08    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Jul 2019 15:47:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Jul 2019 15:47:09 +0200    

Click here for diff

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/option.c

Force hash joins to be enabled in the hash join regression tests.

commit   : 5526baf54902a56c5bc1b4abe625acb33d7357bf    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 9 Jul 2019 18:11:01 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 9 Jul 2019 18:11:01 +1200    

Click here for diff

Otherwise the regressplans.sh tests generate extremely slow nested  
loop joins.  Back-patch to 11 where the hash join tests came in.  
  
Reported-by: Michael Paquier  
Discussion: https://postgr.es/m/20190708055256.GB2709%40paquier.xyz  

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

doc: adjust to_timestamp()/to_date() wording

commit   : d0217d5ef2b8c44fa786f7f96c514684a0a04b28    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 8 Jul 2019 23:04:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 8 Jul 2019 23:04:02 -0400    

Click here for diff

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

M doc/src/sgml/func.sgml

doc: Clarify logical replication documentation

commit   : 0d67263563517131c5cf9ba6df46fc2541bc7d9e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Jul 2019 14:28:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Jul 2019 14:28:42 +0200    

Click here for diff

Document that the data types of replicated tables do not need to  
match.  The documentation previously claimed that they had to match.  
  
Author: Robert Treat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAJSLCQ13==D8Ka2YLyctTm0Y+8MhGYcX_zj7fU0rqRzhcV++3w@mail.gmail.com  

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

Fix small memory leak in ecpglib ecpg_update_declare_statement() is called the second time.

commit   : 58006f8041fffc9260b92fc2cb3a571aaa6c6d22    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 2 Jul 2019 03:51:13 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 2 Jul 2019 03:51:13 +0200    

Click here for diff

Author: "Zhang, Jie" <[email protected]>  

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

In pg_log_generic(), be more paranoid about preserving errno.

commit   : cf665ad4c89eb9b20285dc04aec906d46ed810d2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Jul 2019 11:25:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Jul 2019 11:25:37 -0400    

Click here for diff

This code failed to account for the possibility that malloc() would  
change errno, resulting in wrong output for %m, not to mention the  
possibility of message truncation.  Such a change is obviously  
expected when malloc fails, but there's reason to fear that on some  
platforms even a successful malloc call can modify errno.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/logging.c

Add missing source files to nls.mk

commit   : c8e0997239840888a974624b0ab020177357f0ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 15:02:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 15:02:53 +0200    

Click here for diff

M src/interfaces/ecpg/ecpglib/nls.mk
M src/interfaces/libpq/nls.mk

psql: Fix logging output format

commit   : d8ec5ebaea4455a5b19fa1bc8ec6eb299e93e835    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 14:58:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 6 Jul 2019 14:58:08 +0200    

Click here for diff

In normal interactive mode, psql's log messages accidentally got a  
"psql:" prefix that was not supposed to be there.  This only happened  
if there was no .psqlrc file being read, so it wasn't discovered for a  
while.  Fix this by adding the appropriate logging format  
configuration call in the right code path.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/psql/startup.c

Add missing assertions for required table am callbacks.

commit   : e5eba10d79bd8d919a5e8594d809cd99abd09f01    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 6 Jul 2019 11:45:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 6 Jul 2019 11:45:39 +0530    

Click here for diff

Reported-by: Ashwin Agrawal  
Author: Ashwin Agrawal  
Reviewed-by: Amit Kapila  
Backpatch-through: 12, where it was introduced  
Discussion: https://postgr.es/m/CALfoeisgdZhYDrJOukaBzvXfJOK2FQ0szVMK7dzmcy6w93iDUA@mail.gmail.com  

M src/backend/access/table/tableamapi.c

Remove unused variable in statext_mcv_serialize()

commit   : a5dc37866add6552834ec5af6a0053f521fbcc62    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Jul 2019 18:06:02 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Jul 2019 18:06:02 +0200    

Click here for diff

The itemlen variable used to be referenced in multiple places, but since  
reworking the serialization code it's used only in one assert. Fixed by  
removing the variable and calling the macro from the assert directly.  
  
Backpatch to 12, where this code was introduced.  
  
Reported-by: Jeff Janes  
Discussion: https://postgr.es/m/CAMkU=1zc_ovH9NZd_9ovuiEWkF9yX06URUDdXCmgDydf-bqB5A@mail.gmail.com  

M src/backend/statistics/mcv.c

Simplify pg_mcv_list (de)serialization

commit   : e74d141d0d97a7a9f059cdb3cd91ff52599a629b    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 5 Jul 2019 00:45:20 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 5 Jul 2019 00:45:20 +0200    

Click here for diff

The serialization format of multivariate MCV lists included alignment in  
order to allow direct access to part of the serialized data, but despite  
multiple fixes (see for example commits d85e0f366a and ea4e1c0e8f) this  
proved to be problematic.  
  
This commit abandons alignment in the serialized format, and just copies  
everything during deserialization.  We now also track amount of memory  
needed after deserialization (including alignment), which allows us to  
deserialize the MCV list in a single pass.  
  
Bump catversion, as this affects contents of pg_statistic_ext_data.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Author: Tomas Vondra  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/mcv.c
M src/include/catalog/catversion.h
M src/include/statistics/extended_stats_internal.h

Fix pg_mcv_list_items() to produce text[]

commit   : cc052b423ad7dc92abb3461a096408c3997c36e1    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 4 Jul 2019 23:43:04 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 4 Jul 2019 23:43:04 +0200    

Click here for diff

The function pg_mcv_list_items() returns values stored in MCV items. The  
items may contain columns with different data types, so the function was  
generating text array-like representation, but in an ad-hoc way without  
properly escaping various characters etc.  
  
Fixed by simply building a text[] array, which also makes it easier to  
use from queries etc.  
  
Requires changes to pg_proc entry, so bump catversion.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Author: Tomas Vondra  
Reviewed-by: Dean Rasheed  
Discussion: https://postgr.es/m/20190618205920.qtlzcu73whfpfqne@development  

M src/backend/statistics/mcv.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats_ext.out

Speed-up build of MCV lists with many distinct values

commit   : 57f459cf6c48e78aa321ac88418815fc65197517    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 4 Jul 2019 23:02:02 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 4 Jul 2019 23:02:02 +0200    

Click here for diff

When building multi-column MCV lists, we compute base frequency for each  
item, i.e. a product of per-column frequencies for values from the item.  
As a value may be in multiple groups, the code was scanning the whole  
array of groups while adding items to the MCV list.  This works fine as  
long as the number of distinct groups is small, but it's easy to trigger  
trigger O(N^2) behavior, especially after increasing statistics target.  
  
This commit precomputes frequencies for values in all columns, so that  
when computing the base frequency it's enough to make a simple bsearch  
lookup in the array.  
  
Backpatch to 12, where multi-column MCV lists were introduced.  
  
Discussion: https://postgr.es/m/20190618205920.qtlzcu73whfpfqne@development  

M src/backend/statistics/mcv.c

doc: Spell checking

commit   : 1970da1a0a7e9793d1676341fcb0c9a01f3db0dc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Jul 2019 08:33:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Jul 2019 08:33:51 +0200    

Click here for diff

M doc/src/sgml/btree.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gin.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/release-12.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/xfunc.sgml

Ensure plpgsql result tuples have the right composite type marking.

commit   : 1dd8cf1b46a2e4ef68fc39771c21b8b737cf58b1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Jul 2019 18:08:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Jul 2019 18:08:53 -0400    

Click here for diff

A function that is declared to return a named composite type must  
return tuple datums that are physically marked as having that type.  
The plpgsql code path that allowed directly returning an expanded-record  
datum forgot to check that, so that an expanded record marked as type  
RECORDOID could be returned if it had a physically-compatible tupdesc.  
This'd be harmless, I think, if the record value never escaped the  
current session --- but it's possible for it to get stored into a table,  
and then subsequent sessions can't interpret the anonymous record type.  
  
Fix by flattening the record into a tuple datum and overwriting its  
type/typmod fields, if its declared type doesn't match the function's  
declared type.  (In principle it might be possible to just change the  
expanded record's stored type ID info, but there are enough tricky  
consequences that I didn't want to mess with that, especially not in  
a back-patched bug fix.)  
  
Per bug report from Steve Rogerson.  Back-patch to v11 where the bug  
was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_record.sql

Don't remove surplus columns from GROUP BY for inheritance parents

commit   : 0cce43a716b40c555892b1d22b41d390ef524ec8    
  
author   : David Rowley <[email protected]>    
date     : Wed, 3 Jul 2019 23:45:25 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 3 Jul 2019 23:45:25 +1200    

Click here for diff

d4c3a156c added code to remove columns that were not part of a table's  
PRIMARY KEY constraint from the GROUP BY clause when all the primary key  
columns were present in the group by.  This is fine to do since we know  
that there will only be one row per group coming from this relation.  
However, the logic failed to consider inheritance parent relations.  These  
can have child relations without a primary key, but even if they did, they  
could duplicate one of the parent's rows or one from another child  
relation.  In this case, those additional GROUP BY columns are required.  
  
Fix this by disabling the optimization for inheritance parent tables.  
In v11 and beyond, partitioned tables are fine since partitions cannot  
overlap and before v11 partitioned tables could not have a primary key.  
  
Reported-by: Manuel Rigger  
Discussion: http://postgr.es/m/CA+u7OA7VLKf_vEr6kLF3MnWSA9LToJYncgpNX2tQ-oWzYCBQAw@mail.gmail.com  
Backpatch-through: 9.6  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Add support for Visual Studio 2019 in build scripts

commit   : f2d069ce95b13f7ebfc4998ed708e3693166f46d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 3 Jul 2019 08:57:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 3 Jul 2019 08:57:22 +0900    

Click here for diff

This fixes at the same time a set of inconsistencies in the  
documentation and the scripts related to the versions of Windows SDK  
supported.  
  
Author: Haribabu Kommi  
Reviewed-by: Andrew Dunstan, Juan José Santamaría Flecha, Michael  
Paquier  
Discussion: https://postgr.es/m/CAJrrPGcfqXhfPyMrny9apoDU7M1t59dzVAvoJ9AeAh5BJi+UzA@mail.gmail.com  
Backpatch-through: 9.4  

M doc/src/sgml/install-windows.sgml
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/README
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm

Fix accidentally swapped error message arguments

commit   : 91be5387c20dbd9a015b37064cb789a368974b00    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2019 23:44:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2019 23:44:30 +0100    

Click here for diff

Author: Alexey Kondratov <[email protected]>  

M src/bin/initdb/initdb.c

Remove redundant newlines from error messages

commit   : 7956d7ac9811a6e97b3aef2ad00272c0b72dc7da    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2019 23:18:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2019 23:18:43 +0100    

Click here for diff

These are no longer needed/allowed with the new logging API.  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/pg_rewind.c

Don't treat complete_from_const as equivalent to complete_from_list.

commit   : a4ce93395ef7bced5fae3fbb46d52d0cf6eba2c6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 14:04:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 14:04:42 -0400    

Click here for diff

Commit 4f3b38fe2 supposed that complete_from_const() is equivalent to  
the one-element-list case of complete_from_list(), but that's not  
really true at all.  complete_from_const() supposes that the completion  
is certain enough to justify wiping out whatever the user typed, while  
complete_from_list() will only provide completions that match the  
word-so-far.  
  
In practice, given the lame parsing technology used by tab-complete.c,  
it's fairly hard to believe that we're *ever* certain enough about  
a completion to justify auto-correcting user input that doesn't match.  
  
Hence, remove the inappropriate unification of the two cases.  
As things now stand, complete_from_const() is used only for the  
situation where we have no matches and we need to keep readline  
from applying its default complete-with-file-names behavior.  
  
This (mis?) behavior actually exists much further back, but  
I'm hesitant to change it in released branches.  It's not too  
late for v12, though, especially seeing that the aforesaid  
commit is new in v12.  
  
Per gripe from Ken Tanzer.  
  
Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com  

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

Fix tab completion of "SET variable TO|=" to not offer bogus completions.

commit   : 4f3648de2a0bcd6eae89cb5cb0d177a672c9e239    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 13:35:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Jul 2019 13:35:14 -0400    

Click here for diff

Don't think that the context "UPDATE tab SET var =" is a GUC-setting  
command.  
  
If we have "SET var =" but the "var" is not a known GUC variable,  
don't offer any completions.  The most likely explanation is that  
we've misparsed the context and it's not really a GUC-setting command.  
  
Per gripe from Ken Tanzer.  Back-patch to 9.6.  The issue exists  
further back, but before 9.6 the code looks very different and it  
doesn't actually know whether the "var" name matches anything,  
so I desisted from trying to fix it.  
  
Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com  

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

Revert "Insert temporary debugging output in regression tests."

commit   : d4b090f54fe8147157485b2c9b7753731e611354    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2019 19:46:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2019 19:46:04 -0400    

Click here for diff

This reverts commit f03a9ca4366d064d89b7cf7ed75d4e43f2ed0667,  
in the v12 branch only.  We don't want to ship v12 with that,  
since it causes occasional test failures (as a result of statistics  
transmission not being entirely reliable).  
  
I'll leave it in HEAD though, in hopes that we'll eventually  
capture an instance of the original problematic behavior.  

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

pgindent run prior to branching v12.

commit   : 9e1c9f959422192bbe1b842a2a1ffaf76b080196    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2019 12:37:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2019 12:37:52 -0400    

Click here for diff

pgperltidy and reformat-dat-files too, though the latter didn't  
find anything to change.  

M contrib/postgres_fdw/postgres_fdw.h
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/findtimezone.c
M src/include/catalog/pg_statistic_ext_data.h
M src/tools/msvc/Mkvcbuild.pm
M src/tools/pgindent/README
M src/tools/pgindent/typedefs.list

Doc: remove obsolete description of oid column as being "hidden".

commit   : 145b18688c04963efcab8ef3e7e10659bf783eb1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2019 12:09:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2019 12:09:06 -0400    

Click here for diff

Looks like one copy of this text didn't get updated.  
  
Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml

Revert fix missing call to table_finish_bulk_insert during COPY

commit   : f5db56fc4d6e95c582b61c99328ea0702b869fa0    
  
author   : David Rowley <[email protected]>    
date     : Tue, 2 Jul 2019 03:44:56 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 2 Jul 2019 03:44:56 +1200    

Click here for diff

This reverts commits 4de60244e and b2d69806d. Further thought is  
required to make this work properly.  

M src/backend/commands/copy.c

Remove surplus call to table_finish_bulk_insert

commit   : b2d69806d8cc902802a7b56ba37fb7c55e58b0ed    
  
author   : David Rowley <[email protected]>    
date     : Tue, 2 Jul 2019 03:07:15 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 2 Jul 2019 03:07:15 +1200    

Click here for diff

4de60244e added the call to table_finish_bulk_insert to the  
CopyMultiInsertBufferCleanup function.  We use a CopyMultiInsertBuffer even  
for non-partitioned tables, so having the cleanup do that meant we would  
call table_finsh_bulk_insert twice when performing COPY FROM with  
a non-partitioned table.  
  
Here we can just remove the direct call in CopyFrom and let  
CopyMultiInsertBufferCleanup handle the call instead.  

M src/backend/commands/copy.c

Fix missing call to table_finish_bulk_insert during COPY

commit   : 4de60244e2fcdeb100afc7f8bf5c28b32923a637    
  
author   : David Rowley <[email protected]>    
date     : Tue, 2 Jul 2019 01:23:26 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 2 Jul 2019 01:23:26 +1200    

Click here for diff

86b85044e abstracted calls to heap functions in COPY FROM to support a  
generic table AM.  However, when performing a copy into a partitioned  
table, this commit neglected to call table_finish_bulk_insert for each  
partition.  Before 86b85044e, when we always called the heap functions,  
there was no need to call heapam_finish_bulk_insert for partitions since  
it only did any work when performing a copy without WAL. For partitioned  
tables, this was unsupported anyway, so there was no issue. With pluggable  
storage, we can't make any assumptions about what the table AM might want  
to do in its equivalent function, so we'd better ensure we always call  
table_finish_bulk_insert each partition that's received a row.  
  
For now, we make the table_finish_bulk_insert call whenever we evict a  
CopyMultiInsertBuffer out of the CopyMultiInsertInfo.  This does mean  
that it's possible that we call table_finish_bulk_insert multiple times  
per partition, which is not a problem other than being an inefficiency.  
Improving this requires a more invasive patch, so let's leave that for  
another day.  
  
In passing, move the table_finish_bulk_insert for the target of the COPY  
command so that it's only called when we're actually performing bulk  
inserts.  We don't need to call this when inserting 1 row at a time.  
  
Reported-by: Robert Haas  
Discussion: https://postgr.es/m/CA+TgmoYK=6BpxiJ0tN-p9wtH0BTAfbdxzHhwou0mdud4+BkYuQ@mail.gmail.com  

M src/backend/commands/copy.c

Convert some stragglers to new frontend logging API

commit   : 95bbe5d82e428db342fa3ec60b95f1b9873741e5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2019 13:34:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2019 13:34:31 +0200    

Click here for diff

M src/bin/initdb/initdb.c

Add missing serial commas

commit   : 1b29e990e352885642149262859b83c19d362405    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2019 13:07:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2019 13:07:14 +0200    

Click here for diff

M src/backend/catalog/pg_proc.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl

Fix many typos and inconsistencies

commit   : c74d49d41c9e0fabeb1179dcabfb3137833ed831    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2019 10:00:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2019 10:00:23 +0900    

Click here for diff

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

M contrib/bloom/blutils.c
M contrib/intarray/_int_selfuncs.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgcrypto/crypt-des.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/diskusage.sgml
M src/backend/access/brin/brin_tuple.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/catalog/heap.c
M src/backend/executor/execExpr.c
M src/backend/libpq/be-fsstubs.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_target.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/ipc/barrier.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/include/access/attnum.h
M src/include/access/hash.h
M src/include/commands/event_trigger.h
M src/include/commands/extension.h
M src/include/executor/nodeCustom.h
M src/include/funcapi.h
M src/include/nodes/primnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/storage/fd.h
M src/include/storage/proc.h
M src/include/tcop/tcopprot.h
M src/include/utils/inval.h
M src/include/utils/sortsupport.h
M src/interfaces/libpq/fe-auth.c

Don't read fields of a misaligned ExpandedObjectHeader or AnyArrayType.

commit   : 459c3cdb4ad8323bfe6bcae0186a3831e0c89c94    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 30 Jun 2019 17:34:17 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 30 Jun 2019 17:34:17 -0700    

Click here for diff

UBSan complains about this.  Instead, cast to a suitable type requiring  
only 4-byte alignment.  DatumGetAnyArrayP() already assumes one can cast  
between AnyArrayType and ArrayType, so this doesn't introduce a new  
assumption.  Back-patch to 9.5, where AnyArrayType was introduced.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/arrayfuncs.c
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/expandeddatum.h

Repair logic for reordering grouping sets optimization.

commit   : da53be23d1c5e529675e958eaee54cfed4e4dbac    
  
author   : Andrew Gierth <[email protected]>    
date     : Sun, 30 Jun 2019 23:49:13 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sun, 30 Jun 2019 23:49:13 +0100    

Click here for diff

The logic in reorder_grouping_sets to order grouping set elements to  
match a pre-specified sort ordering was defective, resulting in  
unnecessary sort nodes (though the query output would still be  
correct). Repair, simplifying the code a little, and add a test.  
  
Per report from Richard Guo, though I didn't use their patch. Original  
bug seems to have been my fault.  
  
Backpatch back to 9.5 where grouping sets were introduced.  
  
Discussion: https://postgr.es/m/CAN_9JTzyjGcUjiBHxLsgqfk7PkdLGXiM=pwM+=ph2LsWw0WO1A@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

Exclude new src/test/modules/unsafe_tests directory from MSVC build.

commit   : c000a47ad1fdd4fb92c7068279d97e0c3db4f8eb    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2019 14:05:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2019 14:05:24 -0400    

Click here for diff

There's nothing to build here, and that was confusing AddContrib().  
Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Blind attempt to fix SSPI-auth case in 010_dump_connstr.pl.

commit   : 681cca86f5071379c4a8599ef9387b666b7e6879    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2019 13:34:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2019 13:34:45 -0400    

Click here for diff

Up to now, pg_regress --config-auth had a hard-wired assumption  
that the target cluster uses the default bootstrap superuser name.  
pg_dump's 010_dump_connstr.pl TAP test uses non-default superuser  
names, and was klugily getting around the restriction by listing  
the desired superuser name as a role to "create".  This is pretty  
confusing (or at least, it confused me).  Let's make it clearer by  
allowing --config-auth mode to be told the bootstrap superuser name.  
Repurpose the existing --user switch for that, since it has no  
other function in --config-auth mode.  
  
Per buildfarm.  I don't have an environment at hand in which I can  
test this fix, but the buildfarm should soon show if it works.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/t/010_dump_connstr.pl
M src/test/regress/pg_regress.c

Move rolenames test out of the core regression tests.

commit   : c91504b958e1647f87ffb7168e61db75ca09b928    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2019 12:51:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2019 12:51:08 -0400    

Click here for diff

This test script is unsafe to run in "make installcheck" mode for  
(at least) two reasons: it creates and destroys some role names  
that don't follow the "regress_xxx" naming convention, and it  
sets and then resets the application_name GUC attached to every  
existing role.  While we've not had complaints, these surely are  
not good things to do within a production installation, and  
regress.sgml pretty clearly implies that we won't do them.  
  
Rather than lose test coverage altogether, let's just move this  
script somewhere where it will get run by "make check" but not  
"make installcheck".  src/test/modules/ already has that property.  
  
Since it seems likely that we'll want other regression tests in  
future that also exceed the constraints of "make installcheck",  
create a generically-named src/test/modules/unsafe_tests/  
directory to hold them.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/Makefile
A src/test/modules/unsafe_tests/.gitignore
A src/test/modules/unsafe_tests/Makefile
A src/test/modules/unsafe_tests/README
R100 src/test/regress/expected/rolenames.out src/test/modules/unsafe_tests/expected/rolenames.out
R100 src/test/regress/sql/rolenames.sql src/test/modules/unsafe_tests/sql/rolenames.sql
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule

Fix breakage introduced in pg_lsn_in()

commit   : 2e810508f6b0d89621094445620a1bea3ceff3f1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 30 Jun 2019 13:25:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 30 Jun 2019 13:25:33 +0200    

Click here for diff

Using PG_RETURN_LSN() from non-fmgr pg_lsn_in_internal() happened to  
work on some platforms, but should just be a plain "return".  

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

Don't call data type input functions in GUC check hooks

commit   : 21f428ebde39339487c271a830fed135d6032d73    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 30 Jun 2019 10:15:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 30 Jun 2019 10:15:25 +0200    

Click here for diff

Instead of calling pg_lsn_in() in check_recovery_target_lsn and  
timestamptz_in() in check_recovery_target_time, reorganize the  
respective code so that we don't raise any errors in the check hooks.  
The previous code tried to use PG_TRY/PG_CATCH to handle errors in a  
way that is not safe, so now the code contains no ereport() calls and  
can operate safely within the GUC error handling system.  
  
Moreover, since the interpretation of the recovery_target_time string  
may depend on the time zone, we cannot do the final processing of that  
string until all the GUC processing is done.  Instead,  
check_recovery_target_time() now does some parsing for syntax  
checking, but the actual conversion to a timestamptz value is done  
later in the recovery code that uses it.  
  
Reported-by: Andres Freund <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20190611061115.njjwkagvxp4qujhp%40alap3.anarazel.de  

M src/backend/access/transam/xlog.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/misc/guc.c
M src/include/access/xlog.h
M src/include/utils/pg_lsn.h

Remove explicit error handling for obsolete date/time values

commit   : 666cbae16da46b833f57ef8b12ff0bf215684d9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jun 2019 11:29:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jun 2019 11:29:53 +0200    

Click here for diff

The date/time values 'current', 'invalid', and 'undefined' were  
removed a long time ago, but the code still contains explicit error  
handling for the transition.  To simplify the code and avoid having to  
handle these values everywhere, just remove the recognition of these  
tokens altogether now.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/datetime.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/test/regress/expected/date.out
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/date.sql
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Add an enforcement mechanism for global object names in regression tests.

commit   : 54100f5c6052404f68de9ce7310ceb61f1c291f8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Jun 2019 11:34:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Jun 2019 11:34:00 -0400    

Click here for diff

In commit 18555b132 we tentatively established a rule that regression  
tests should use names containing "regression" for databases, and names  
starting with "regress_" for all other globally-visible object names, so  
as to circumscribe the side-effects that "make installcheck" could have  
on an existing installation.  
  
This commit adds a simple enforcement mechanism for that rule: if the code  
is compiled with ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS defined, it  
will emit a warning (not an error) whenever a database, role, tablespace,  
subscription, or replication origin name is created that doesn't obey the  
rule.  Running one or more buildfarm members with that symbol defined  
should be enough to catch new violations, at least in the regular  
regression tests.  Most TAP tests wouldn't notice such warnings, but  
that's actually fine because TAP tests don't execute against an existing  
server anyway.  
  
Since it's already the case that running src/test/modules/ tests in  
installcheck mode is deprecated, we can use that as a home for tests  
that seem unsafe to run against an existing server, such as tests that  
might have side-effects on existing roles.  Document that (though this  
commit doesn't in itself make it any less safe than before).  
  
Update regress.sgml to define these restrictions more clearly, and  
to clean up assorted lack-of-up-to-date-ness in its descriptions of  
the available regression tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/regress.sgml
M src/backend/commands/alter.c
M src/backend/commands/dbcommands.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/user.c
M src/backend/replication/logical/origin.c
M src/test/modules/README

Fix regression tests to use only global names beginning with "regress_".

commit   : ca129e58c01f29ef24a734313ff315933b3d5b67    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Jun 2019 11:09:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Jun 2019 11:09:03 -0400    

Click here for diff

In commit 18555b132 we tentatively established a rule that regression  
tests should use names containing "regression" for databases, and names  
starting with "regress_" for all other globally-visible object names, so  
as to circumscribe the side-effects that "make installcheck" could have on  
an existing installation.  However, no enforcement mechanism was created,  
so it's unsurprising that some new violations have crept in since then.  
  
In fact, a whole new *category* of violations has crept in, to wit we now  
also have globally-visible subscription and replication origin names, and  
"make installcheck" could very easily clobber user-created objects of  
those types.  So it's past time to do something about this.  
  
This commit sanitizes the tests enough that they will pass (i.e. not  
generate any visible warnings) with the enforcement mechanism I'll add  
in the next commit.  There are some TAP tests that still trigger the  
warnings, but the warnings do not cause test failure.  Since these tests  
do not actually run against a pre-existing installation, there's no need  
to worry whether they could conflict with user-created objects.  
  
The problem with rolenames.sql testing special role names like "user"  
is still there, and is dealt with only very cosmetically in this patch  
(by hiding the warnings :-().  What we actually need to do to be safe is  
to take that test script out of "make installcheck" altogether, but that  
seems like material for a separate patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/expected/rewrite.out
M contrib/test_decoding/sql/replorigin.sql
M contrib/test_decoding/sql/rewrite.sql
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_upgrade/test.sh
M src/test/regress/expected/object_address.out
M src/test/regress/expected/rolenames.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/rolenames.sql
M src/test/regress/sql/subscription.sql

Disallow user-created replication origins named "pg_xxx".

commit   : a1e61badf97bc446053145ba40de6db835678ce3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Jun 2019 10:30:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Jun 2019 10:30:08 -0400    

Click here for diff

Since we generate such names internally, it seems like a good idea  
to have a policy of disallowing them for user use, as we do for many  
other object types.  Otherwise attempts to use them will randomly  
fail due to collisions with internally-generated names.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove unnecessary header from be-secure-gssapi.c

commit   : c0faa727507ed34db0d02769d21bbaaf9605e2e4    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 29 Jun 2019 11:14:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 29 Jun 2019 11:14:21 +0900    

Click here for diff

libpq/libpq-be.h is included by libpq/libpq.h so there is no need to  
explicitly include it separately.  
  
Author: Daniel Gustafsson  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

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

Fix for dropped columns in a partitioned table's default partition

commit   : 23cccb17fe0bbb5df86780da5c346cc060c21421    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 28 Jun 2019 14:51:08 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 28 Jun 2019 14:51:08 -0400    

Click here for diff

We forgot to map column numbers to/from the default partition for  
various operations, leading to valid cases failing with spurious  
errors, such as  
ERROR:  attribute N of type some_partition has been dropped  
  
It was also possible that the search for conflicting rows in the default  
partition when attaching another partition would fail to detect some.  
Secondarily, it was also possible that such a search should be skipped  
(because the constraint was implied) but wasn't.  
  
Fix all this by mapping column numbers when necessary.  
  
Reported by: Daniel Wilches  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Fix misleading comment in nodeIndexonlyscan.c.

commit   : 74b7cc8c02137f059703972aa14445b1e073f005    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 28 Jun 2019 11:11:26 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 28 Jun 2019 11:11:26 +1200    

Click here for diff

The stated reason for acquiring predicate locks on heap pages hasn't  
existed since commit c01262a8, so fix the comment.  Perhaps in a later  
release we'll also be able to change the code to use tuple locks.  
  
Back-patch all the way.  
  
Reviewed-by: Ashwin Agrawal  
Discussion: https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com  

M src/backend/executor/nodeIndexonlyscan.c

Update reference to sampling algorithm in analyze.c

commit   : 69fd82fedd746b82427097883daf2921dd77584e    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 27 Jun 2019 17:41:29 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 27 Jun 2019 17:41:29 +0200    

Click here for diff

Commit 83e176ec1 moved row sampling functions from analyze.c to  
utils/misc/sampling.c, but failed to update comment referring to  
the sampling algorithm from Jeff Vitter's paper. Correct the  
comment by pointing to utils/misc/sampling.c.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/CAPmGK154gp%2BQd%3DcorQOv%2BPmbyVyZBjp_%2Bhb766UJeD1e_ie6XQ%40mail.gmail.com  

M src/backend/commands/analyze.c

Fix use-after-free introduced in 55ed3defc966

commit   : 050098b14e33a5d3dfabf172ebbddd20c6bb4665    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 27 Jun 2019 11:57:10 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 27 Jun 2019 11:57:10 -0400    

Click here for diff

Evidenced by failure under RELCACHE_FORCE_RELEASE (buildfarm member  
prion).  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqGV=k_Eh4jBiQw66ivvdG+EUkrEYeHTYL1SvDj_YOYV0g@mail.gmail.com  

M src/backend/commands/indexcmds.c

Update comment

commit   : f2f0082ef5969b57d0b52d0c2e891872ed1b0a51    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Jun 2019 15:57:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Jun 2019 15:57:14 +0200    

Click here for diff

Function was renamed/replaced in  
c2fe139c201c48f1133e9fbea2dd99b8efe2fadd but the header comment was  
not updated.  

M src/backend/access/index/indexam.c

Remove remaining traces of Rand_OpenSSL() from the tree

commit   : 322c5bfdc3d76f6463768ecd8fced30c881b8be5    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Jun 2019 08:25:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Jun 2019 08:25:26 +0900    

Click here for diff

fe0a0b5 has removed the last use of this routine from pgcrypto, leading  
to a useless symbol definition and an extra configure check.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in

Fix partitioned index creation with foreign partitions

commit   : 55ed3defc966cf718fe1e8c0efe964580bb23351    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jun 2019 18:38:51 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jun 2019 18:38:51 -0400    

Click here for diff

When a partitioned tables contains foreign tables as partitions, it is  
not possible to implement unique or primary key indexes -- but when  
regular indexes are created, there is no reason to do anything other  
than ignoring such partitions.  We were raising errors upon encountering  
the foreign partitions, which is unfriendly and doesn't protect against  
any actual problems.  
  
Relax this restriction so that index creation is allowed on partitioned  
tables containing foreign partitions, becoming a no-op on them.  (We may  
later want to redefine this so that the FDW is told to create the  
indexes on the foreign side.)  This applies to CREATE INDEX, as well as  
ALTER TABLE / ATTACH PARTITION and CREATE TABLE / PARTITION OF.  
  
Backpatch to 11, where indexes on partitioned tables were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  
Author: Álvaro Herrera  
Reviewed-by: Amit Langote  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/tcop/utility.c
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Follow the rule that regression-test-created roles are named "regress_xxx".

commit   : 65e6d42140c8d9918638b9f73528288ab980af82    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Jun 2019 23:06:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Jun 2019 23:06:17 -0400    

Click here for diff

contrib/amcheck didn't get the memo either.  

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

Follow the rule that regression-test-created roles are named "regress_xxx".

commit   : c360477d2e2f65fdea64aa8bc94a6286d0883f7a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Jun 2019 22:53:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Jun 2019 22:53:42 -0400    

Click here for diff

Commit 1c5d9270e had not gotten the word about this.  (For previous  
context, see 18555b132.)  

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

Add support for OpenSSL 1.1.0 and newer versions in MSVC scripts

commit   : d993e0fb82ffaa15be72c1ac10403bfa06708069    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Jun 2019 10:44:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Jun 2019 10:44:46 +0900    

Click here for diff

Up to now, the MSVC build scripts are able to support only one fixed  
version of OpenSSL, and they lacked logic to detect the version of  
OpenSSL a given compilation of Postgres is linking to (currently 1.0.2,  
the latest LTS of upstream which will be EOL'd at the end of 2019).  
  
This commit adds more logic to detect the version of OpenSSL used by a  
build and makes use of it to add support for compilation with OpenSSL  
1.1.0 which requires a new set of compilation flags to work properly.  
  
The supported OpenSSL installers have changed their library layer with  
various library renames with the upgrade to 1.1.0, making the logic a  
bit more complicated.  The scripts are now able to adapt to the new  
world order.  
  
Reported-by: Sergey Pashkov  
Author: Juan José Santamaría Flecha, Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Solution.pm

Add toast-level reloption for vacuum_index_cleanup

commit   : ce59b75d449d9152667ce3e9eab33ef2872bfd98    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Jun 2019 09:09:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Jun 2019 09:09:27 +0900    

Click here for diff

a96c41f has introduced the option for heap, but it still lacked the  
variant to control the behavior for toast relations.  
  
While on it, refactor the tests so as they stress more scenarios with  
the various values that vacuum_index_cleanup can use.  It would be  
useful to couple those tests with pageinspect to check that pages are  
actually cleaned up, but this is left for later.  
  
Author: Masahiko Sawada, Michael Paquier  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAD21AoCqs8iN04RX=i1KtLSaX5RrTEM04b7NHYps4+rqtpWNEg@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/bin/psql/tab-complete.c
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Don't unset MAKEFLAGS in non-GNU Makefile.

commit   : 0089c3059cb6b3dd20cf072f26d1a7a33412df39    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Jun 2019 09:29:53 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Jun 2019 09:29:53 +1200    

Click here for diff

It's useful to be able to pass down options like -s and -j.  
  
Back-patch to 9.5, like commit a76200de.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2Be1M8-BbL%3DPqhTp6oO6XPO6%2Bs9WGQMLfbuZ%3DG9CtzyXg%40mail.gmail.com  

M Makefile

Remove misleading comment from pathnodes.h.

commit   : a2dec374807565f6337915fb236bb3ae37af0644    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Jun 2019 09:17:04 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Jun 2019 09:17:04 +1200    

Click here for diff

As of commit e5253fdc, it is no longer true that the leader always  
executes the subplan of a Gather Merge node.  Remove comment to that  
effect.  
  
Back-patch to 11.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJEaZJYezXAOutuiWT%2BfxCA44%2BoKtVPAND2ubLiigR%3D-w%40mail.gmail.com  

M src/include/nodes/pathnodes.h

Purely-cosmetic adjustments in tablecmds.c.

commit   : ccfcc8fdbd9bdbfd18fda5d7c698af8d175f5319    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Jun 2019 17:19:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Jun 2019 17:19:32 -0400    

Click here for diff

Move ATExecAlterColumnGenericOptions away from where it was unthinkingly  
dropped, in the middle of a lot of ALTER COLUMN TYPE code.  I don't have  
any high principles about where to put it instead, so let's just put it  
after ALTER COLUMN TYPE and before ALTER OWNER, matching existing  
decisions about how to order related code stanzas.  
  
Also add the minimal function header comment that the original author  
was too cool to bother with.  
  
Along the way, upgrade header comments for nearby ALTER COLUMN TYPE  
functions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Update unicode_norm_table.h to Unicode 12.1.0

commit   : 82be666ee36842af2a1b81e570bd5578f264de65    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 22:15:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 22:15:43 +0200    

Click here for diff

M src/include/common/unicode_norm_table.h

Make script output more pgindent compatible

commit   : 2cadefbb97ff8e5566476780dc200db06af6ba09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 22:09:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 22:09:50 +0200    

Click here for diff

M src/common/unicode/generate-unicode_norm_table.pl

Correct script name in README file

commit   : eb8d05bfeca416a970cc33af5915ec7b4f4a2f69    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 22:09:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 22:09:29 +0200    

Click here for diff

M src/common/unicode/README

Further fix ALTER COLUMN TYPE's handling of indexes and index constraints.

commit   : f946a409143d01951411382fbc3c91c7eb640094    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Jun 2019 16:43:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Jun 2019 16:43:05 -0400    

Click here for diff

This patch reverts all the code changes of commit e76de8861, which turns  
out to have been seriously misguided.  We can't wait till later to compute  
the definition string for an index; we must capture that before applying  
the data type change for any column it depends on, else ruleutils.c will  
deliverr wrong/misleading results.  (This fine point was documented  
nowhere, of course.)  
  
I'd also managed to forget that ATExecAlterColumnType executes once per  
ALTER COLUMN TYPE clause, not once per statement; which resulted in the  
code being basically completely broken for any case in which multiple ALTER  
COLUMN TYPE clauses are applied to a table having non-constraint indexes  
that must be rebuilt.  Through very bad luck, none of the existing test  
cases nor the ones added by e76de8861 caught that, but of course it was  
soon found in the field.  
  
The previous patch also had an implicit assumption that if a constraint's  
index had a dependency on a table column, so would the constraint --- but  
that isn't actually true, so it didn't fix such cases.  
  
Instead of trying to delete unneeded index dependencies later, do the  
is-there-a-constraint lookup immediately on seeing an index dependency,  
and switch to remembering the constraint if so.  In the unusual case of  
multiple column dependencies for a constraint index, this will result in  
duplicate constraint lookups, but that's not that horrible compared to all  
the other work that happens here.  Besides, such cases did not work at all  
before, so it's hard to argue that they're performance-critical for anyone.  
  
Per bug #15865 from Keith Fiske.  As before, back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Correct obsolete amcheck comments.

commit   : b00326df7ad4ab7d21aad3b6fe6558ea6b61897d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 24 Jun 2019 10:31:58 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 24 Jun 2019 10:31:58 -0700    

Click here for diff

Oversight in commit dd299df8.  

M contrib/amcheck/verify_nbtree.c

Drop test user when done with it.

commit   : f31111bbe81db0e84fb486c6423a234c47091b30    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Jun 2019 12:36:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Jun 2019 12:36:51 -0400    

Click here for diff

Commit d7f8d26d9 added a test case that created a user, but forgot  
to drop it again.  This is no good; for one thing, it causes repeated  
"make installcheck" runs to fail.  

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

Upgrade internal error message to external

commit   : 12e037e2090b1a6446376814ea0419463b02c254    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 24 Jun 2019 10:39:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 24 Jun 2019 10:39:12 +0200    

Click here for diff

As part of REINDEX CONCURRENTLY, this formerly internal-only error  
message becomes potentially user-visible (see regression tests), so  
change from errmsg_internal() to errmsg(), and update comment.  

M src/backend/catalog/index.c

Don't call PG_RETURN_BOOL() in a function not returning Datum.

commit   : 9a81c9fa3f6a2f57b9db2a1ce5584c85fc1d977e    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 23 Jun 2019 12:02:19 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 23 Jun 2019 12:02:19 -0700    

Click here for diff

This code is new in v12, and the defect probably was not user-visible.  

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

Add security checks to the multivariate MCV estimation code.

commit   : d7f8d26d9f4c0a574250ec53a03b3dc08d13796c    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 23 Jun 2019 18:50:08 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 23 Jun 2019 18:50:08 +0100    

Click here for diff

The multivariate MCV estimation code may run user-defined operators on  
the values in the MCV list, which means that those operators may  
potentially leak the values from the MCV list. Guard against leaking  
data to unprivileged users by checking that the user has SELECT  
privileges on the table or all of the columns referred to by the  
statistics.  
  
Additionally, if there are any securityQuals on the RTE (either due to  
RLS policies on the table, or accessing the table via a security  
barrier view), not all rows may be visible to the current user, even  
if they have table or column privileges. Thus we further insist that  
the operator be leakproof in this case.  
  
Dean Rasheed, reviewed by Tomas Vondra.  
  
Discussion: https://postgr.es/m/CAEZATCUhT9rt7Ui=Vdx4N==VV5XOK5dsXfnGgVOz_JhAicB=ZA@mail.gmail.com  

M src/backend/statistics/extended_stats.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Remove unnecessary comment.

commit   : 89ff7c08eee355195eba6f544d28584e61200665    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 23 Jun 2019 22:19:59 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 23 Jun 2019 22:19:59 +1200    

Click here for diff

Author: Vik Fearing  
Discussion: https://postgr.es/m/150d3e9f-c7ec-3fb3-4fdb-def47c4144af%402ndquadrant.com  

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

Fix spinlock assembly code for MIPS so it works on MIPS r6.

commit   : 1323bfce55109dd54ee164828aab7983d3020a25    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jun 2019 20:31:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Jun 2019 20:31:50 -0400    

Click here for diff

Original MIPS-I processors didn't have the LL/SC instructions (nor any  
other userland synchronization primitive).  If the build toolchain  
targets that ISA variant by default, as an astonishingly large fraction  
of MIPS platforms still do, the assembler won't take LL/SC without  
coercion in the form of a ".set mips2" instruction.  But we issued that  
unconditionally, making it an ISA downgrade for chips later than MIPS2.  
That breaks things for the latest MIPS r6 ISA, which encodes these  
instructions differently.  Adjust the code so we don't change ISA level  
if it's >= 2.  
  
Note that this patch doesn't change what happens on an actual MIPS-I  
processor: either the kernel will emulate these instructions  
transparently, or you'll get a SIGILL failure.  That tradeoff seemed  
fine in 2002 when this code was added (cf 3cbe6b247), and it's even  
more so today when MIPS-I is basically extinct.  But let's add a  
comment about that.  
  
YunQiang Su (with cosmetic adjustments by me).  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/s_lock.h

Consolidate methods for translating a Perl path to a Windows path.

commit   : 660a2b19038b2f6b9f6bcb2c3297a47d5e3557a8    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 21 Jun 2019 20:34:23 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 21 Jun 2019 20:34:23 -0700    

Click here for diff

This fixes some TAP suites when using msys Perl and a builddir located  
in an msys mount point other than "/".  For example, builddir=/c/pg  
exhibited the problem, since /c/pg falls in mount point "/c".  
Back-patch to 9.6, where tests first started to perform such  
translations.  In back branches, offer both new and old APIs.  
  
Reviewed by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_checksums/t/002_actions.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/TestLib.pm
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/017_shm.pl

Remove obsolete comments about sempahores from proc.c.

commit   : 25b93a2967a4ebfb90168ca087026cc697fc4b77    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 21 Jun 2019 10:57:07 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 21 Jun 2019 10:57:07 +1200    

Click here for diff

Commit 6753333f switched from a semaphore-based wait to a latch-based  
wait for ProcSleep()/ProcWakeup(), but left behind some stray references  
to semaphores.  
  
Back-patch to 9.5.  
  
Reviewed-by: Daniel Gustafsson, Michael Paquier  
Discussion: https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=AFXc1aHuce32tKiQrdEA@mail.gmail.com  

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

Rework some error strings for REINDEX CONCURRENTLY with system catalogs

commit   : 20e1cc898da6f82b5680973c107e8a96d46caf01    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 20 Jun 2019 13:28:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 20 Jun 2019 13:28:12 +0900    

Click here for diff

This makes the whole user experience more consistent when bumping into  
failures, and more in line with the rewording done via 508300e.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Fix description of pg_class.relam for table access methods

commit   : 252f9a2580b013fe45ba28bb6d7a4994abc93bb5    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 20 Jun 2019 13:04:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 20 Jun 2019 13:04:56 +0900    

Click here for diff

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

M doc/src/sgml/catalogs.sgml

pg_upgrade: Improve error messages

commit   : cd917ffb9a43e9e4699c2a89d495ee02a8701034    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 21:49:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 21:49:03 +0200    

Click here for diff

Make wording more accurate and add strerror() information.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/option.c

pg_upgrade: Improve invalid option handling

commit   : aba78ab4a9509e7ed92acefd707a99425568f49f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 21:43:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 21:43:31 +0200    

Click here for diff

Currently, calling pg_upgrade with an invalid command-line option  
aborts pg_upgrade but leaves a pg_upgrade_internal.log file lying  
around.  Reorder things a bit so that that file is not created until  
all the options have been parsed.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/pg_upgrade/option.c

Fix description for $varname jsonpath variable

commit   : dfd79e2d0e8f399785ca2f7c659b45fd620cba17    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 19 Jun 2019 22:41:12 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 19 Jun 2019 22:41:12 +0300    

Click here for diff

The description is ended part way and PASSING clause is not implemented yet.  
But the variables might be passed as parameters to several jsonpath functions.  
So, complete the description based on the current implementation, leaving  
description of PASSING clause in TODO.  
  
Discussion: https://postgr.es/m/CAKPRHz%2BxOuQSSvkuB1mCQjedd%2BB2B1Vnkrq0E-pLmoXyTO%2Bz9Q%40mail.gmail.com  
Author: Kyotaro Horiguchi, Alexander Korotkov  

M doc/src/sgml/json.sgml

Improve documentation for jsonpath like_regex predicate

commit   : 1ff8dc9f19ddf00e3ad69d7141f78341769cd8a3    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 19 Jun 2019 22:41:05 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 19 Jun 2019 22:41:05 +0300    

Click here for diff

Reference posix regex documentation section and list supported flags.  
  
Discussion: https://postgr.es/m/CAKPRHz%2BxOuQSSvkuB1mCQjedd%2BB2B1Vnkrq0E-pLmoXyTO%2Bz9Q%40mail.gmail.com  
Author: Kyotaro Horiguchi, Alexander Korotkov  

M doc/src/sgml/func.sgml

Support 'q' flag in jsonpath 'like_regex' predicate

commit   : 261a5c1928566f938cbda0f62dc16f6a2d1e871d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 19 Jun 2019 22:40:58 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 19 Jun 2019 22:40:58 +0300    

Click here for diff

SQL/JSON standard defines that jsonpath 'like_regex' predicate should support  
the same set of flags as XQuery/XPath.  It appears that implementation of 'q'  
flag was missed.  This commit fixes that.  
  
Discussion: https://postgr.es/m/CAPpHfdtyfPsxLYiTjp5Ov8T5xGsB5t3CwE5%2B3PS%3DLLwA%2BxTJog%40mail.gmail.com  
Author: Nikita Glukhov, Alexander Korotkov  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql
M src/test/regress/sql/jsonpath.sql

Update list of combining characters

commit   : d8594d123c155aeecd47fc2450f62f5100b2fbf0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 21:35:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 21:35:41 +0200    

Click here for diff

The list of combining characters to ignore for calculating the display  
width of a string (used for example by psql) was wildly outdated and  
incorrect.  
  
Discussion: https://www.postgresql.org/message-id/flat/bbb19114-af1e-513b-08a9-61272794bd5c%402ndquadrant.com  

M src/backend/utils/mb/wchar.c

Add XSL stylesheet to fix up SVG files

commit   : ac5bb8f275dd9b2746fe6d433f1c08c1c3bd3d61    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 21:26:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 19 Jun 2019 21:26:42 +0200    

Click here for diff

The SVG output produced by external tools needs some postprocessing.  
This is implemented by this new XSL stylesheet.  
  
Issues are:  
  
- SVG produced by Ditaa does not add a viewBox attribute to the svg  
  element, needed to make the image scalable.  
  
- SVG produced by Graphviz uses a stroke="transparent" attribute,  
  which is not valid SVG.  It appears to mostly work, but FOP  
  complains.  
  
Other tweaks can be added over time.  
  
This reverts 7dc78d8ef3e62f7e06d7767c63dcede048377b9a and  
29046c44f36099f4c979b1491fcf27db2f9184f9, which applied these fixes  
manually.  

M .gitattributes
M doc/src/sgml/images/Makefile
M doc/src/sgml/images/README
A doc/src/sgml/images/fixup-svg.xsl
M doc/src/sgml/images/gin.svg
M doc/src/sgml/images/pagelayout.svg

Fix typo

commit   : 66013fe73095f851c151a17ccc7553abe6246891    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 19 Jun 2019 14:59:26 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 19 Jun 2019 14:59:26 +0200    

Click here for diff

Author: Daniel Gustafsson  

M src/backend/access/table/tableamapi.c

Replace an occurrence of slave with standby

commit   : 992fe54e77f66ed67b6480fcf7dd208b2cd28aac    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 19 Jun 2019 14:38:23 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 19 Jun 2019 14:38:23 +0200    

Click here for diff

Commit a1ef920e27ba6ab3602aaf6d6751d8628fac1af8 replaced the use of  
slave with standby, but overlooked this comment.  
  
Author: Daniel Gustafsson  

M contrib/pg_stat_statements/pg_stat_statements.c

Remove last references to WAL segment size in MSVC scripts

commit   : 414cca40d506dd3f17b49ae3139853139192c2ba    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Jun 2019 11:18:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Jun 2019 11:18:50 +0900    

Click here for diff

fc49e24 has removed the last use of this compile-time variable as WAL  
segment size is something that can now be set at initdb time, still this  
commit has forgotten some references to it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Solution.pm

Fix description of WAL record XLOG_BTREE_META_CLEANUP

commit   : 3c28fd2281223580b88473e5145b752cc7cbadf9    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Jun 2019 11:02:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Jun 2019 11:02:19 +0900    

Click here for diff

This record uses one metadata buffer and registers some data associated  
to the buffer, but when parsing the record for its description a direct  
access to the record data was done, but there is none.  This leads  
usually to an incorrect description, but can also cause crashes like in  
pg_waldump.  Instead, fix things so as the parsing uses the data  
associated to the metadata block.  
  
This is an oversight from 3d92796, so backpatch down to 11.  
  
Author: Michael Paquier  
Description: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

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

Fix memory corruption/crash in ANALYZE.

commit   : 23224563d97913aa824d04c498d59ad4d85fda38    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 18 Jun 2019 15:51:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 18 Jun 2019 15:51:04 -0700    

Click here for diff

This fixes an embarrassing oversight I (Andres) made in 737a292b,  
namely missing two place where liverows/deadrows were used when  
converting those variables to pointers, leading to incrementing the  
pointer, rather than the value.  
  
It's not that actually that easy to trigger a crash: One needs tuples  
deleted by the current transaction, followed by a tuple deleted in  
another session, all in one page. Which is presumably why this hasn't  
been noticed before.  
  
Reported-By: Steve Singer  
Author: Steve Singer  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Avoid spurious deadlocks when upgrading a tuple lock

commit   : 8b21b416ed621501db3be38817c298c57470524f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 18 Jun 2019 18:23:16 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 18 Jun 2019 18:23:16 -0400    

Click here for diff

This puts back reverted commit de87a084c0a5, with some bug fixes.  
  
When two (or more) transactions are waiting for transaction T1 to release a  
tuple-level lock, and transaction T1 upgrades its lock to a higher level, a  
spurious deadlock can be reported among the waiting transactions when T1  
finishes.  The simplest example case seems to be:  
  
T1: select id from job where name = 'a' for key share;  
Y: select id from job where name = 'a' for update; -- starts waiting for T1  
Z: select id from job where name = 'a' for key share;  
T1: update job set name = 'b' where id = 1;  
Z: update job set name = 'c' where id = 1; -- starts waiting for T1  
T1: rollback;  
  
At this point, transaction Y is rolled back on account of a deadlock: Y  
holds the heavyweight tuple lock and is waiting for the Xmax to be released,  
while Z holds part of the multixact and tries to acquire the heavyweight  
lock (per protocol) and goes to sleep; once T1 releases its part of the  
multixact, Z is awakened only to be put back to sleep on the heavyweight  
lock that Y is holding while sleeping.  Kaboom.  
  
This can be avoided by having Z skip the heavyweight lock acquisition.  As  
far as I can see, the biggest downside is that if there are multiple Z  
transactions, the order in which they resume after T1 finishes is not  
guaranteed.  
  
Backpatch to 9.6.  The patch applies cleanly on 9.5, but the new tests don't  
work there (because isolationtester is not smart enough), so I'm not going  
to risk it.  
  
Author: Oleksii Kliukin  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/README.tuplock
M src/backend/access/heap/heapam.c
A src/test/isolation/expected/tuplelock-upgrade-no-deadlock.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/tuplelock-upgrade-no-deadlock.spec

Prevent Parallel Hash Join for JOIN_UNIQUE_INNER.

commit   : aca127c105aae551620d607e88d76930e6b9a2cf    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 18 Jun 2019 22:38:30 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 18 Jun 2019 22:38:30 +1200    

Click here for diff

WHERE EXISTS (...) queries cannot be executed by Parallel Hash Join  
with jointype JOIN_UNIQUE_INNER, because there is no way to make a  
partial plan totally unique.  The consequence of allowing such plans  
was duplicate results from some EXISTS queries.  
  
Back-patch to 11.  Bug #15857.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane  
Reported-by: Vladimir Kriukov  
Discussion: https://postgr.es/m/15857-d1ba2a64bce0795e%40postgresql.org  

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

Stamp 12beta2.

commit   : 0ab7110bcbcce5ff58afb32e7871c54e87502139    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jun 2019 17:12:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jun 2019 17:12:29 -0400    

Click here for diff

M configure
M configure.in
M src/include/pg_config.h.win32

Translation updates

commit   : 91acff7a538e6e6a8175450a38c7fa1d9a290011    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jun 2019 15:07:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jun 2019 15:07:14 +0200    

Click here for diff

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

M src/backend/po/es.po
M src/backend/po/sv.po
M src/backend/po/zh_CN.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/tr.po
M src/bin/pg_archivecleanup/po/es.po
M src/bin/pg_archivecleanup/po/tr.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/tr.po
M src/bin/pg_checksums/nls.mk
A src/bin/pg_checksums/po/de.po
M src/bin/pg_checksums/po/es.po
M src/bin/pg_checksums/po/sv.po
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/zh_CN.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/zh_CN.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/zh_CN.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/tr.po
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/tr.po
M src/bin/pg_rewind/po/de.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/tr.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/de.po
M src/bin/pg_waldump/po/es.po
M src/bin/pg_waldump/po/sv.po
M src/bin/pg_waldump/po/tr.po
M src/bin/psql/po/es.po
M src/bin/psql/po/zh_CN.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/tr.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/tr.po
M src/interfaces/ecpg/ecpglib/po/zh_CN.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/tr.po
M src/interfaces/ecpg/preproc/po/zh_CN.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/tr.po
M src/interfaces/libpq/po/zh_CN.po
M src/pl/plperl/po/es.po
M src/pl/plperl/po/tr.po
M src/pl/plperl/po/zh_CN.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/tr.po
M src/pl/plpgsql/src/po/zh_CN.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/tr.po
M src/pl/plpython/po/zh_CN.po
M src/pl/tcl/po/es.po
M src/pl/tcl/po/tr.po
M src/pl/tcl/po/zh_CN.po

Fix buffer overflow when processing SCRAM final message in libpq

commit   : b67421178880f9df337dc19b8601b54b99efbc78    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2019 22:13:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2019 22:13:57 +0900    

Click here for diff

When a client connects to a rogue server sending specifically-crafted  
messages, this can suffice to execute arbitrary code as the operating  
system account used by the client.  
  
While on it, fix one error handling when decoding an incorrect salt  
included in the first message received from server.  
  
Author: Michael Paquier  
Reviewed-by: Jonathan Katz, Heikki Linnakangas  
Security: CVE-2019-10164  
Backpatch-through: 10  

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

Fix buffer overflow when parsing SCRAM verifiers in backend

commit   : 09ec55b933091cb5b0af99978718cb3d289c71b6    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2019 21:48:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2019 21:48:17 +0900    

Click here for diff

Any authenticated user can overflow a stack-based buffer by changing the  
user's own password to a purpose-crafted value.  This often suffices to  
execute arbitrary code as the PostgreSQL operating system account.  
  
This fix is contributed by multiple folks, based on an initial analysis  
from Tom Lane.  This issue has been introduced by 68e61ee, so it was  
possible to make use of it at authentication time.  It became more  
easily to trigger after ccae190 which has made the SCRAM parsing more  
strict when changing a password, in the case where the client passes  
down a verifier already hashed using SCRAM.  Back-patch to v10 where  
SCRAM has been introduced.  
  
Reported-by: Alexander Lakhin  
Author: Jonathan Katz, Heikki Linnakangas, Michael Paquier  
Security: CVE-2019-10164  
Backpatch-through: 10  

M src/backend/libpq/auth-scram.c
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

Fix more typos and inconsistencies in the tree

commit   : 3412030205211079f9b0510e2244083e4ee7b15a    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2019 16:13:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2019 16:13:16 +0900    

Click here for diff

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

M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/common/session.c
M src/backend/access/hash/hash.c
M src/backend/access/transam/xact.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/commands/copy.c
M src/backend/commands/functioncmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeProjectSet.c
M src/backend/jit/llvm/Makefile
M src/backend/lib/integerset.c
M src/backend/libpq/pqformat.c
M src/backend/replication/walsender.c
M src/backend/statistics/mcv.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/sort/sharedtuplestore.c
M src/bin/pg_dump/common.c
M src/include/access/xlogdefs.h
M src/include/catalog/partition.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/executor/tuptable.h
M src/include/optimizer/placeholder.h
M src/include/partitioning/partprune.h
M src/include/port/pg_bitutils.h
M src/include/utils/jsonapi.h
M src/include/utils/sharedtuplestore.h
M src/pl/plperl/plperl.h
M src/port/pwrite.c
M src/test/isolation/specs/partition-key-update-4.spec
M src/test/modules/test_integerset/README
M src/tools/msvc/config_default.pl

Revert "Avoid spurious deadlocks when upgrading a tuple lock"

commit   : 9d20b0ec8f2af43041b1a65e5fcd91acc47e9ace    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 16 Jun 2019 22:24:21 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 16 Jun 2019 22:24:21 -0400    

Click here for diff

This reverts commits 3da73d6839dc and de87a084c0a5.  
  
This code has some tricky corner cases that I'm not sure are correct and  
not properly tested anyway, so I'm reverting the whole thing for next  
week's releases (reintroducing the deadlock bug that we set to fix).  
I'll try again afterwards.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/README.tuplock
M src/backend/access/heap/heapam.c
D src/test/isolation/expected/tuplelock-upgrade-no-deadlock.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/tuplelock-upgrade-no-deadlock.spec

Doc: remove description of commit 23bd3cec6 from v12 release notes.

commit   : 16c4e76f1b0a0145572551b7e919b967e406a0b1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Jun 2019 14:02:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Jun 2019 14:02:22 -0400    

Click here for diff

Now that we've back-patched that, it shouldn't be mentioned in v12  
anymore.  

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

Further fix privileges on pg_statistic_ext[_data].

commit   : 6973b058bc8d32e104bed99c134a4fab4b5dfe13    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Jun 2019 11:00:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Jun 2019 11:00:23 -0400    

Click here for diff

We don't need to restrict column privileges on pg_statistic_ext;  
all of that data is OK to read publicly.  What we *do* need to do,  
which was overlooked by 6cbfb784c, is revoke public read access on  
pg_statistic_ext_data; otherwise we still have the same security  
hole we started with.  
  
Catversion bump to ensure that installations calling themselves  
beta2 will have this fix.  
  
Diagnosis/correction by Dean Rasheed and Tomas Vondra, but I'm  
going to go ahead and push this fix ASAP so we get more buildfarm  
cycles on it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h

Fix privileges on pg_statistic_ext.tableoid

commit   : fc8cf3df478e054b892f6698b6d336e72f3a7328    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 16 Jun 2019 12:04:40 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 16 Jun 2019 12:04:40 +0200    

Click here for diff

The GRANT in system_views allowed SELECT privileges on various columns in  
the pg_statistic_ext catalog, but tableoid was not included in the list.  
That made pg_dump fail because it's accessing this column when building  
the list of extended statistics to dump.  
  
Discussion: https://postgr.es/m/8833.1560647898%40sss.pgh.pa.us  

M src/backend/catalog/system_views.sql

Fix incorrect CREATE STATISTICS example in docs

commit   : 7f44efa10b6ea3e5fd125e2800f357f38ab1068c    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 15 Jun 2019 21:38:53 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 15 Jun 2019 21:38:53 +0200    

Click here for diff

The example was incorrectly using parantheses around the list of columns, so  
just drop them.  
  
Reported-By: Robert Haas  
Discussion: https://postgr.es/m/CA%2BTgmoZZEMAqWMAfvLHZnK57SoxOutgvE-ALO94WsRA7zZ7wyQ%40mail.gmail.com  

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

Add pg_stats_ext view for extended statistics

commit   : aa087ec64f703a52f3c48c70117bb02e578f1802    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 13 Jun 2019 17:25:04 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 13 Jun 2019 17:25:04 +0200    

Click here for diff

Regular per-column statistics are stored in pg_statistics catalog, which  
is however rather difficult to read, so we also have pg_stats view with  
a human-reablable version of the data.  
  
For extended statistic the catalog was fairly easy to read, so we did  
not have such human-readable view so far.  Commit 9b6babfa2d however did  
split the catalog into two, which makes querying harder.  Furthermore,  
we want to show the multi-column MCV list in a way similar to per-column  
stats (and not as a bytea value).  
  
This commit introduces pg_stats_ext view, joining the two catalogs and  
massaging the data to produce human-readable output similar to pg_stats.  
It also considers RLS and access privileges - the data is shown only when  
the user has access to all columns the extended statistic is defined on.  
  
Bumped CATVERSION due to adding new system view.  
  
Author: Dean Rasheed, with improvements by me  
Reviewed-by: Dean Rasheed, John Naylor  
Discussion: https://postgr.es/m/CAEZATCUhT9rt7Ui%3DVdx4N%3D%3DVV5XOK5dsXfnGgVOz_JhAicB%3DZA%40mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

Rework the pg_statistic_ext catalog

commit   : 6cbfb784c3c91146148a76d50cda6f69ae6a79fb    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 13 Jun 2019 17:19:21 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 13 Jun 2019 17:19:21 +0200    

Click here for diff

Since extended statistic got introduced in PostgreSQL 10, there was a  
single catalog pg_statistic_ext storing both the definitions and built  
statistic.  That's however problematic when a user is supposed to have  
access only to the definitions, but not to user data.  
  
Consider for example pg_dump on a database with RLS enabled - if the  
pg_statistic_ext catalog respects RLS (which it should, if it contains  
user data), pg_dump would not see any records and the result would not  
define any extended statistics.  That would be a surprising behavior.  
  
Until now this was not a pressing issue, because the existing types of  
extended statistic (functional dependencies and ndistinct coefficients)  
do not include any user data directly.  This changed with introduction  
of MCV lists, which do include most common combinations of values.  
  
The easiest way to fix this is to split the pg_statistic_ext catalog  
into two - one for definitions, one for the built statistic values.  
The new catalog is called pg_statistic_ext_data, and we're maintaining  
a 1:1 relationship with the old catalog - either there are matching  
records in both catalogs, or neither of them.  
  
Bumped CATVERSION due to changing system catalog definitions.  
  
Author: Dean Rasheed, with improvements by me  
Reviewed-by: Dean Rasheed, John Naylor  
Discussion: https://postgr.es/m/CAEZATCUhT9rt7Ui%3DVdx4N%3D%3DVV5XOK5dsXfnGgVOz_JhAicB%3DZA%40mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/planstats.sgml
M src/backend/catalog/Makefile
M src/backend/commands/statscmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/statistics/README.mcv
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/utils/cache/syscache.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_statistic_ext.h
A src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/toasting.h
M src/include/utils/syscache.h
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/oidjoins.sql
M src/test/regress/sql/stats_ext.sql
M src/tools/pgindent/typedefs.list

Prefer timezone name "UTC" over alternative spellings.

commit   : e3846a00c2f87402dcedf7f07950ab2d89cf5827    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 15 Jun 2019 18:15:23 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 15 Jun 2019 18:15:23 +0100    

Click here for diff

tzdb 2019a made "UCT" a link to the "UTC" zone rather than a separate  
zone with its own abbreviation. Unfortunately, our code for choosing a  
timezone in initdb has an arbitrary preference for names earlier in  
the alphabet, and so it would choose the spelling "UCT" over "UTC"  
when the system is running on a UTC zone.  
  
Commit 23bd3cec6 was backpatched in order to address this issue, but  
that code helps only when /etc/localtime exists as a symlink, and does  
nothing to help on systems where /etc/localtime is a copy of a zone  
file (as is the standard setup on FreeBSD and probably some other  
platforms too) or when /etc/localtime is simply absent (giving UTC as  
the default).  
  
Accordingly, add a preference for the spelling "UTC", such that if  
multiple zone names have equally good content matches, we prefer that  
name before applying the existing arbitrary rules. Also add a slightly  
lower preference for "Etc/UTC"; lower because that preserves the  
previous behaviour of choosing the shorter name, but letting us still  
choose "Etc/UTC" over "Etc/UCT" when both exist but "UTC" does  
not (not common, but I've seen it happen).  
  
Backpatch all the way, because the tzdb change that sparked this issue  
is in those branches too.  

M src/bin/initdb/findtimezone.c

Add pg_dumpall --rows-per-insert

commit   : a193cbec1199e4e529c46645b7aecbf38956048b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Jun 2019 18:21:52 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Jun 2019 18:21:52 -0400    

Click here for diff

Commit 7e413a0f82c8 added that option to pg_dump, but neglected to teach  
pg_dumpall how to pass it along.  Repair.  
  
Author: Fabien Coelho  
Reported-by: Peter Eisentraut  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dumpall.sgml
M src/bin/pg_dump/pg_dumpall.c

Tweak libpq's PQhost, PQhostaddr, and psql's \connect

commit   : 313f56ce2d1b9dfd3483e4f39611baa27852835a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Jun 2019 18:02:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Jun 2019 18:02:26 -0400    

Click here for diff

Fixes some problems introduced by 6e5f8d489acc:  
  
* When reusing conninfo data from the previous connection in \connect,  
  the host address should only be reused if it was specified as  
  hostaddr; if it wasn't, then 'host' is resolved afresh.  We were  
  reusing the same IP address, which ignores a possible DNS change  
  as well as any other addresses that the name resolves to than the  
  one that was used in the original connection.  
  
* PQhost, PQhostaddr: Don't present user-specified hostaddr when we have  
  an inet_net_ntop-produced equivalent address.  The latter has been  
  put in canonical format, which is cleaner (so it produces "127.0.0.1"  
  when given "host=2130706433", for example).  
  
* Document the hostaddr-reusing aspect of \connect.  
  
* Fix some code comments  
  
Author: Fabien Coelho  
Reported-by: Noah Misch  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/interfaces/libpq/fe-connect.c

Silence compiler warning

commit   : 3da73d6839dc47f1f47ca57974bf28e5abd9b572    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Jun 2019 11:33:40 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Jun 2019 11:33:40 -0400    

Click here for diff

Introduced in de87a084c0a5.  

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

doc: PG 12 relnotes, add mention of single-child optimization

commit   : b9a0724cf7a3ecf19aaaa098ffd26e52bb800c5c    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 14 Jun 2019 09:30:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 14 Jun 2019 09:30:31 -0400    

Click here for diff

Add mention of single-child optimization for partitions and UNION ALL.  
  
Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f8R8riwBXw==7ijV=UZNuhP+3qXgDBKSiM+=_cTf4mXXw@mail.gmail.com  

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

postgres_fdw: Fix costing of pre-sorted foreign paths with local stats.

commit   : 08d2d58a2a1c8ef8d39e8132d39ee14a1d029500    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 14 Jun 2019 20:49:59 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 14 Jun 2019 20:49:59 +0900    

Click here for diff

Commit aa09cd242 modified estimate_path_cost_size() so that it reuses  
cached costs of a basic foreign path for a given foreign-base/join  
relation when costing pre-sorted foreign paths for that relation, but it  
incorrectly re-computed retrieved_rows, an estimated number of rows  
fetched from the remote side, which is needed for costing both the basic  
and pre-sorted foreign paths.  To fix, handle retrieved_rows the same way  
as the cached costs: store in that relation's fpinfo the retrieved_rows  
estimate computed for costing the basic foreign path, and reuse it when  
costing the pre-sorted foreign paths.  Also, reuse the rows/width  
estimates stored in that relation's fpinfo when costing the pre-sorted  
foreign paths, to make the code consistent.  
  
In commit ffab494a4, to extend the costing mentioned above to the  
foreign-grouping case, I made a change to add_foreign_grouping_paths() to  
store in a given foreign-grouped relation's RelOptInfo the rows estimate  
for that relation for reuse, but this patch makes that change unnecessary  
since we already store the row estimate in that relation's fpinfo, which  
this patch reuses when costing a foreign path for that relation with the  
sortClause ordering; remove that change.  
  
In passing, fix thinko in commit 7012b132d: in estimate_path_cost_size(),  
the width estimate for a given foreign-grouped relation to be stored in  
that relation's fpinfo was reset incorrectly when costing a basic foreign  
path for that relation with local stats.  
  
Apply the patch to HEAD only to avoid destabilizing existing plan choices.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/CAPmGK17jaJLPDEkgnP2VmkOg=5wT8YQ1CqssU8JRpZ_NSE+dqQ@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h

docs: PG 12 relnotes, update self-join item to mention ctid

commit   : be2e024bd6527b050da4ad02c921869fed84bb5d    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 13 Jun 2019 22:53:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 13 Jun 2019 22:53:20 -0400    

Click here for diff

Reported-by: Robert Haas  
  
Discussion: https://postgr.es/m/CA+TgmoY==TZwk-4cM3Usebq1f=j7Hpm1brFbk1v48h45wsWzzg@mail.gmail.com  

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

docs: PG 12 relnotes, move vacuumdb to the client app section

commit   : 18ef7a34fe616dc63f7de672a5ab7dd88137dc5c    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 13 Jun 2019 22:07:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 13 Jun 2019 22:07:25 -0400    

Click here for diff

It was previously incorrectly placed in the server application section.  
  
Reported-by: Tatsuo Ishii  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typos and inconsistencies in code comments

commit   : f43608bda2111a1fda514d1bed4df313ee2bbec3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Jun 2019 09:34:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Jun 2019 09:34:34 +0900    

Click here for diff

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

M src/backend/access/nbtree/nbtsearch.c
M src/backend/catalog/catalog.c
M src/backend/commands/copy.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/parser/parse_target.c
M src/backend/postmaster/checkpointer.c
M src/backend/utils/cache/lsyscache.c
M src/port/pg_bitutils.c

Use OpenSSL-specific ifdefs in sha2.h

commit   : 96719e52b1abd3a8c712d06a809b7e6c97c2e3a0    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Jun 2019 09:00:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Jun 2019 09:00:36 +0900    

Click here for diff

In order to separate OpenSSL's SHA symbols, this header has been using  
USE_SSL, which is equivalent to USE_OPENSSL.  There is now only one SSL  
implementation included in the tree, so this works fine, but when  
adding a new SSL implementation this would run into failures.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/include/common/sha2.h

Avoid combinatorial explosion in add_child_rel_equivalences().

commit   : d25ea0127598dd0ad27a029215172f396fbd1009    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2019 18:10:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2019 18:10:08 -0400    

Click here for diff

If an EquivalenceClass member expression includes variables from  
multiple appendrels, then instead of producing one substituted  
expression per child relation as intended, we'd create additional  
child expressions for combinations of children of different appendrels.  
This happened because the child expressions generated while considering  
the first appendrel were taken as sources during substitution of the  
second appendrel, and so on.  The extra expressions are useless, and are  
harmless unless there are too many of them --- but if you have several  
appendrels with a thousand or so members each, it gets bad fast.  
  
To fix, consider only original (non-em_is_child) EC members as candidates  
to be expanded.  This requires the ability to substitute directly from a  
top parent relation's Vars to those of an indirect descendant relation,  
but we already have that in adjust_appendrel_attrs_multilevel().  
  
Per bug #15847 from Feike Steenbergen.  This is a longstanding misbehavior,  
but it's only worth worrying about when there are more appendrel children  
than we've historically considered wise to use.  So I'm not going to take  
the risk of back-patching this.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid spurious deadlocks when upgrading a tuple lock

commit   : de87a084c0a5ac927017cd0834b33a932651cfc9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 13 Jun 2019 17:28:24 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 13 Jun 2019 17:28:24 -0400    

Click here for diff

When two (or more) transactions are waiting for transaction T1 to release a  
tuple-level lock, and transaction T1 upgrades its lock to a higher level, a  
spurious deadlock can be reported among the waiting transactions when T1  
finishes.  The simplest example case seems to be:  
  
T1: select id from job where name = 'a' for key share;  
Y: select id from job where name = 'a' for update; -- starts waiting for X  
Z: select id from job where name = 'a' for key share;  
T1: update job set name = 'b' where id = 1;  
Z: update job set name = 'c' where id = 1; -- starts waiting for X  
T1: rollback;  
  
At this point, transaction Y is rolled back on account of a deadlock: Y  
holds the heavyweight tuple lock and is waiting for the Xmax to be released,  
while Z holds part of the multixact and tries to acquire the heavyweight  
lock (per protocol) and goes to sleep; once X releases its part of the  
multixact, Z is awakened only to be put back to sleep on the heavyweight  
lock that Y is holding while sleeping.  Kaboom.  
  
This can be avoided by having Z skip the heavyweight lock acquisition.  As  
far as I can see, the biggest downside is that if there are multiple Z  
transactions, the order in which they resume after X finishes is not  
guaranteed.  
  
Backpatch to 9.6.  The patch applies cleanly on 9.5, but the new tests don't  
work there (because isolationtester is not smart enough), so I'm not going  
to risk it.  
  
Author: Oleksii Kliukin  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/README.tuplock
M src/backend/access/heap/heapam.c
A src/test/isolation/expected/tuplelock-upgrade-no-deadlock.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/tuplelock-upgrade-no-deadlock.spec

Mark ReplicationSlotCtl as PGDLLIMPORT.

commit   : 3c8f8f6ebefb3c2debd1cad1ba445a729290dac7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2019 10:53:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2019 10:53:17 -0400    

Click here for diff

Also MyReplicationSlot, in branches where it wasn't already.  
  
This was discussed in the thread that resulted in c572599c6, but  
for some reason nobody pulled the trigger.  Now that we have another  
request for the same thing, we should just do it.  
  
Craig Ringer  
  
Discussion: https://postgr.es/m/CAMsr+YFTsq-86MnsNng=mPvjjh5EAbzfMK0ptJPvzyvpFARuRg@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/include/replication/slot.h

Fix double-word typos

commit   : b9768458154de6c001af23efc02514f120c6094f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Jun 2019 14:16:18 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Jun 2019 14:16:18 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Michaël Paquier  

M doc/src/sgml/backup.sgml
M src/bin/pg_dump/pg_dump.c
M src/include/executor/tuptable.h
M src/include/fmgr.h
M src/include/utils/snapshot.h
M src/interfaces/ecpg/preproc/type.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/recovery/t/013_crash_restart.pl
M src/test/regress/expected/polygon.out
M src/test/regress/sql/polygon.sql

doc: PG 12 relnotes: update wording on truncate/vacuum item

commit   : 4f41a7227511a3f96148b7f3d4ae6f0c350bc7b2    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 13 Jun 2019 09:15:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 13 Jun 2019 09:15:57 -0400    

Click here for diff

This item prevents unauthorized locking of relations, and the previous  
wording was unclear.  
  
Reported-by: Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

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

postgres_fdw: Account for triggers in non-direct remote UPDATE planning.

commit   : 8b6da83d162cb0ac9f6d21082727bbd45c972c53    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 13 Jun 2019 17:59:09 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 13 Jun 2019 17:59:09 +0900    

Click here for diff

Previously, in postgresPlanForeignModify, we planned an UPDATE operation  
on a foreign table so that we transmit only columns that were explicitly  
targets of the UPDATE, so as to avoid unnecessary data transmission, but  
if there were BEFORE ROW UPDATE triggers on the foreign table, those  
triggers might change values for non-target columns, in which case we  
would miss sending changed values for those columns.  Prevent optimizing  
away transmitting all columns if there are BEFORE ROW UPDATE triggers on  
the foreign table.  
  
This is an oversight in commit 7cbe57c34 which added triggers on foreign  
tables, so apply the patch all the way back to 9.4 where that came in.  
  
Author: Shohei Mochizuki  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: fix bogus example.

commit   : 7dc6ae37def50b5344c157eee5e029a09359f8ee    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Jun 2019 23:05:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Jun 2019 23:05:40 -0400    

Click here for diff

This wasn't incorrect SQL, but it was doing cm-to-inch conversion  
backward, so it might confuse readers.  
  
Per bug #15849 from TAKATSUKA Haruka.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Doc: improve description of allowed spellings for Boolean input.

commit   : 9729c9360886bee7feddc6a1124b0742de4b9f3d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Jun 2019 22:54:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Jun 2019 22:54:46 -0400    

Click here for diff

datatype.sgml failed to explain that boolin() accepts any unique  
prefix of the basic input strings.  Indeed it was actively misleading  
because it called out a few minimal prefixes without mentioning that  
there were more valid inputs.  
  
I also felt that it wasn't doing anybody any favors by conflating  
SQL key words, valid Boolean input, and string literals containing  
valid Boolean input.  Rewrite in hopes of reducing the confusion.  
  
Per bug #15836 from Yuming Wang, as diagnosed by David Johnston.  
Back-patch to supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

docs: PG 12 relnotes, update btree items

commit   : 4bfb79ff6b1fd400b3dbc761921472173675a968    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 12 Jun 2019 22:48:04 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 12 Jun 2019 22:48:04 -0400    

Click here for diff

Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-Wzn-aH4ToZEWR05ELSSp7bO_JMn=sMPfUhNruwVmCXKh-w@mail.gmail.com  

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

Fix incorrect printing of queries with duplicated join names.

commit   : 3d99a81397abb8bb7b95aee794d6644e174e174f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Jun 2019 19:42:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Jun 2019 19:42:38 -0400    

Click here for diff

Given a query in which multiple JOIN nodes used the same alias  
(which'd necessarily be in different sub-SELECTs), ruleutils.c  
would assign the JOIN nodes distinct aliases for clarity ...  
but then it forgot to print the modified aliases when dumping  
the JOIN nodes themselves.  This results in a dump/reload hazard  
for views, because the emitted query is flat-out incorrect:  
Vars will be printed with table names that have no referent.  
  
This has been wrong for a long time, so back-patch to all supported  
branches.  
  
Philip Dubé  
  
Discussion: https://postgr.es/m/CY4PR2101MB080246F2955FF58A6ED1FEAC98140@CY4PR2101MB0802.namprd21.prod.outlook.com  

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

doc: Fix grammatical error in partitioning docs

commit   : ddc053dc503a773267a4d035418e0c81ce3b4851    
  
author   : David Rowley <[email protected]>    
date     : Thu, 13 Jun 2019 10:35:11 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 13 Jun 2019 10:35:11 +1200    

Click here for diff

Reported-by: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqGZFkKi0TkBGYpr2_5qrRAbHZoP47AP1BRLUOUkfQdy_A@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ddl.sgml

doc: PG 12 relnotes, list added snowball/FTS languages

commit   : 968072837173a0c0fa426114b17177f997b85473    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 12 Jun 2019 17:46:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 12 Jun 2019 17:46:38 -0400    

Click here for diff

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

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

doc: PG 12 relnotes, merge new SQL partition function items

commit   : 6a631a454664c145b7da88c9ef3976f8ac3ab0b1    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 12 Jun 2019 17:36:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 12 Jun 2019 17:36:43 -0400    

Click here for diff

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

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

Fix ALTER COLUMN TYPE failure with a partial exclusion constraint.

commit   : e76de886157b7f974d4d247908b242607cfbf043    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Jun 2019 12:29:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Jun 2019 12:29:24 -0400    

Click here for diff

ATExecAlterColumnType failed to consider the possibility that an index  
that needs to be rebuilt might be a child of a constraint that needs to be  
rebuilt.  We missed this so far because usually a constraint index doesn't  
have a direct dependency on its table, just on the constraint object.  
But if there's a WHERE clause, then dependency analysis of the WHERE  
clause results in direct dependencies on the column(s) mentioned in WHERE.  
This led to trying to drop and rebuild both the constraint and its  
underlying index.  
  
In v11/HEAD, we successfully drop both the index and the constraint,  
and then try to rebuild both, and of course the second rebuild hits a  
duplicate-index-name problem.  Before v11, it fails with obscure messages  
about a missing relation OID, due to trying to drop the index twice.  
  
This is essentially the same kind of problem noted in commit  
20bef2c31: the possible dependency linkages are broader than what  
ATExecAlterColumnType was designed for.  It was probably OK when  
written, but it's certainly been broken since the introduction of  
partial exclusion constraints.  Fix by adding an explicit check  
for whether any of the indexes-to-be-rebuilt belong to any of the  
constraints-to-be-rebuilt, and ignoring any that do.  
  
In passing, fix a latent bug introduced by commit 8b08f7d48: in  
get_constraint_index() we must "continue" not "break" when rejecting  
a relation of a wrong relkind.  This is harmless today because we don't  
expect that code path to be taken anyway; but if there ever were any  
relations to be ignored, the existing coding would have an extremely  
undesirable dependency on the order of pg_depend entries.  
  
Also adjust a couple of obsolete comments.  
  
Per bug #15835 from Yaroslav Schekin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix handling of COMMENT for domain constraints

commit   : ceac4505d3428a8414b4f3d6708ea81506811a5f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Jun 2019 11:30:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Jun 2019 11:30:11 +0900    

Click here for diff

For a non-superuser, changing a comment on a domain constraint was  
leading to a cache lookup failure as the code tried to perform the  
ownership lookup on the constraint OID itself, thinking that it was a  
type, but this check needs to happen on the type the domain constraint  
relies on.  As the type a domain constraint relies on can be guessed  
directly based on the constraint OID, first fetch its type OID and  
perform the ownership on it.  
  
This is broken since 7eca575, which has split the handling of comments  
for table constraints and domain constraints, so back-patch down to  
9.5.  
  
Reported-by: Clemens Ladisch  
Author: Daniel Gustafsson, Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/backend/catalog/objectaddress.c
M src/test/regress/input/constraints.source
M src/test/regress/output/constraints.source

doc: Add best practises section to partitioning docs

commit   : e788e849addd56007a0e75f3b5514f294a0f3bca    
  
author   : David Rowley <[email protected]>    
date     : Wed, 12 Jun 2019 08:08:57 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 12 Jun 2019 08:08:57 +1200    

Click here for diff

A few questionable partitioning designs have been cropping up lately  
around the mailing lists.  Generally, these cases have been partitioning  
using too many partitions which have caused performance or OOM problems for  
the users.  
  
Since we have very little else to guide users into good design, here we  
add a new section to the partitioning documentation with some best  
practise guidelines for good design.  
  
Reviewed-by: Justin Pryzby, Amit Langote, Alvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f-2rx+E9mG3xrCVHupefMjAp1+tpczQa9SEOZWyU7fjEA@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ddl.sgml

Fix conversion of JSON strings to JSON output columns in json_to_record().

commit   : 6f34fcbbd5ad5a6546710e7b90e6331cacfd36dc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Jun 2019 13:33:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Jun 2019 13:33:08 -0400    

Click here for diff

json_to_record(), when an output column is declared as type json or jsonb,  
should emit the corresponding field of the input JSON object.  But it got  
this slightly wrong when the field is just a string literal: it failed to  
escape the contents of the string.  That typically resulted in syntax  
errors if the string contained any double quotes or backslashes.  
  
jsonb_to_record() handles such cases correctly, but I added corresponding  
test cases for it too, to prevent future backsliding.  
  
Improve the documentation, as it provided only a very hand-wavy  
description of the conversion rules used by these functions.  
  
Per bug report from Robert Vollmert.  Back-patch to v10 where the  
error was introduced (by commit cf35346e8).  
  
Note that PG 9.4 - 9.6 also get this case wrong, but differently so:  
they feed the de-escaped contents of the string literal to json[b]_in.  
That behavior is less obviously wrong, so possibly it's being depended on  
in the field, so I won't risk trying to make the older branches behave  
like the newer ones.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Fix order of steps in DISCARD ALL documentation

commit   : 9f05c44ba4a4a6a857b957734bb369a2bb4dd62b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 11 Jun 2019 12:22:11 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 11 Jun 2019 12:22:11 -0400    

Click here for diff

The docs have always been slightly inaccurate, but got particularly so  
in a874fe7b4c89, which made DISCARD ALL occur before everything else;  
reorder.  
  
Author: Jan Chochol  
Discussion: https://postgr.es/m/CAEASf_3TzBbnXm64HpnD5zCZEh8An9jN8ubMR=De-vOXHMHGeA@mail.gmail.com  

M doc/src/sgml/ref/discard.sgml

Don't access catalogs to validate GUCs when not connected to a DB.

commit   : fff2a7d7bd09db38e1bafc1303c29b10a9805dc0    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 10 Jun 2019 23:20:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 10 Jun 2019 23:20:48 -0700    

Click here for diff

Vignesh found this bug in the check function for  
default_table_access_method's check hook, but that was just copied  
from older GUCs. Investigation by Michael and me then found the bug in  
further places.  
  
When not connected to a database (e.g. in a walsender connection), we  
cannot perform (most) GUC checks that need database access. Even when  
only shared tables are needed, unless they're  
nailed (c.f. RelationCacheInitializePhase2()), they cannot be accessed  
without pg_class etc. being present.  
  
Fix by extending the existing IsTransactionState() checks to also  
check for MyDatabaseOid.  
  
Reported-By: Vignesh C, Michael Paquier, Andres Freund  
Author: Vignesh C, Andres Freund  
Discussion: https://postgr.es/m/CALDaNm1KXK9gbZfY-p_peRFm_XrBh1OwQO1Kk6Gig0c0fVZ2uw%40mail.gmail.com  
Backpatch: 9.4-  

M src/backend/access/table/tableamapi.c
M src/backend/commands/tablespace.c
M src/backend/utils/cache/ts_cache.c

postgres_fdw: Reorder C includes.

commit   : 92a88644d2b7208e98d9e913c3a574c5c2fe7b78    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 11 Jun 2019 13:39:31 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 11 Jun 2019 13:39:31 +0900    

Click here for diff

Reorder header files in postgres_fdw.c and connection.c in alphabetical  
order.  
  
Author: Etsuro Fujita  
Reviewed-by: Alvaro Herrera  
Discussion: https://postgr.es/m/CAPmGK17ZmNb-EELqu8LmMh2t2uFdbfWNVDEfDO5-bpejHPONMQ@mail.gmail.com  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c

Fix documentation of ALTER TABLE for stored values

commit   : 727e45c8a457ab7378494ff33bf3b50607d303a8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 11 Jun 2019 12:58:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 11 Jun 2019 12:58:51 +0900    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoAA_gvZ002U6kovOHu0FsM7ieoCzdSqWBd7_KaQL0UMKg@mail.gmail.com  

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

tableam: Fix index_build_range_scan parameter name.

commit   : 132a1c101a205ee52ec7d731abcb8593a6354097    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 10 Jun 2019 20:04:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 10 Jun 2019 20:04:44 -0400    

Click here for diff

All of the other code thinks that the 8th parameter is the number of  
blocks, but this declaration thinks that it's the ending block number.  
Repair this inconsistency.  
  
Patch by me, reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+TgmoY49ManQWnJtiwkuytXBkmyTuDFqb74Pr4Zn2Nq9TuNBQ@mail.gmail.com  

M src/include/access/tableam.h

Make pg_dump emit ATTACH PARTITION instead of PARTITION OF (reprise)

commit   : 33a53130a89447e171a8268ae0b221bb48af6468    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 10 Jun 2019 18:56:23 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 10 Jun 2019 18:56:23 -0400    

Click here for diff

Using PARTITION OF can result in column ordering being changed from the  
database being dumped, if the partition uses a column layout different  
from the parent's.  It's not pg_dump's job to editorialize on table  
definitions, so this is not acceptable; back-patch all the way back to  
pg10, where partitioned tables where introduced.  
  
This change also ensures that partitions end up in the correct  
tablespace, if different from the parent's; this is an oversight in  
ca4103025dfe (in pg12 only).  Partitioned indexes (in pg11) don't have  
this problem, because they're already created as independent indexes and  
attached to their parents afterwards.  
  
This change also has the advantage that the partition is restorable from  
the dump (as a standalone table) even if its parent table isn't  
restored.  
  
The original commits (3b23552ad8bb in branch master) failed to cover  
subsidiary column elements correctly, such as NOT NULL constraint and  
CHECK constraints, as reported by Rushabh Lathia (initially as a failure  
to restore serial columns).  They were reverted.  This recapitulation  
commit fixes those problems.  
  
Add some pg_dump tests to verify these things more exhaustively,  
including constraints with legacy-inheritance tables, which were not  
tested originally.  In branches 10 and 11, add a local constraint to the  
pg_dump test partition that was added by commit 2d7eeb1b1492 to master.  
  
Author: Álvaro Herrera, David Rowley  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f_1c260nOt_vBJ067AZ3JXptXVRohDVMLEBmudX1YEx-A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAGPqQf0iQV=PPOv2Btog9J9AwOQp6HmuVd6SbGTR_v3Zp2XT1w@mail.gmail.com  

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

Fix operator naming in pg_trgm GUC option descriptions

commit   : b6987a885ba9216e1f4319441303ee115556922c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 10 Jun 2019 20:14:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 10 Jun 2019 20:14:19 +0300    

Click here for diff

Descriptions of pg_trgm GUC options have % replaced with %% like it was  
a printf-like format.  But that's not needed since they are just plain strings.  
This commit fixed that.  Backpatch to last supported version since this error  
present from the beginning.  
  
Reported-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoAgPKODUsu9gqUFiNqEOAqedStxJ-a0sapsJXWWAVp%3Dxg%40mail.gmail.com  
Backpatch-through: 9.4  

M contrib/pg_trgm/trgm_op.c

Add docs of missing GUC to pgtrgm.sgml

commit   : ba3783e0244e3502d1b08896ffc72b3a88dbdb83    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 10 Jun 2019 19:38:13 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 10 Jun 2019 19:38:13 +0300    

Click here for diff

be8a7a68 introduced pg_trgm.strict_word_similarity_threshold GUC, but missed  
docs for that.  This commit fixes that.  
  
Discussion: https://postgr.es/m/fc907f70-448e-fda3-3aa4-209a59597af0%402ndquadrant.com  
Author: Ian Barwick  
Reviewed-by: Masahiko Sawada, Michael Paquier  
Backpatch-through: 9.6  

M doc/src/sgml/pgtrgm.sgml

Fix docs indentation in pgtrgm.sgml

commit   : 852ddfbbe2121c905f2ecd750b1ec4cbfbea9f76    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 10 Jun 2019 19:28:47 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 10 Jun 2019 19:28:47 +0300    

Click here for diff

5871b884 introduced pg_trgm.word_similarity_threshold GUC, but its documentation  
contains wrong indentation.  This commit fixes that.  Backpatch for easier  
backpatching of other documentation fixes.  
  
Discussion: https://postgr.es/m/4c735d30-ab59-fc0e-45d8-f90eb5ed3855%402ndquadrant.com  
Author: Ian Barwick  
Backpatch-through: 9.6  

M doc/src/sgml/pgtrgm.sgml

MSVC: Reconcile clean.bat with PostgreSQL 12 work.

commit   : ae78a9456c8986a8869ec470b40e177b5617a2f1    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 9 Jun 2019 15:50:54 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 9 Jun 2019 15:50:54 -0700    

Click here for diff

M src/tools/msvc/clean.bat

Reconcile nodes/*funcs.c with PostgreSQL 12 work.

commit   : 44982e7d09cf9b1a08fded7fb0ca9a60dae869a5    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 9 Jun 2019 14:00:36 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 9 Jun 2019 14:00:36 -0700    

Click here for diff

One would have needed out-of-tree code to observe the defects.  Remove  
unreferenced fields instead of completing their support functions.  
Since in-tree code can't reach _readIntoClause(), no catversion bump.  

M src/backend/nodes/outfuncs.c
M src/backend/parser/parse_node.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h

Switch position of some declarations in libpq.h

commit   : cf4263cc6c3a2310de4f1540745990e62fa2312c    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 9 Jun 2019 11:33:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 9 Jun 2019 11:33:52 +0900    

Click here for diff

This makes the header more consistent with the surroundings, with  
declarations associated to a given file grouped together.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/include/libpq/libpq.h

Fix some typos

commit   : b880e22de4b2543f1c1db758bca4b2135525e87a    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 9 Jun 2019 11:25:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 9 Jun 2019 11:25:56 +0900    

Click here for diff

Author: Guillaume Lelarge  
Discussion: https://postgr.es/m/CAECtzeWPz4JikzUqZdMjqPTe8dAP3nZxPD-58Y-Hhvirg0fF+A@mail.gmail.com  

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

Update documentation about SIGKILL of postmaster.

commit   : a806b14a1139d3443a7c2c263abb9ff8e4a65694    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    

Click here for diff

Removing shared memory and semaphores in response to server start  
failure often masks the real problem, a live process associated with the  
data directory; see commit 5a907404b52753c4d6c6a7c21765aeaa42fd6a3b.  
Since 9.6, it's rarely necessary to kill subprocesses manually.  (When  
it is necessary, that commit's HINT will say as much, in all supported  
versions.)  

M doc/src/sgml/runtime.sgml

Stop using spelling "nonexistant".

commit   : f2c71cb71fe186dcf8ebec967f98d1c7c4777943    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    

Click here for diff

The documentation used "nonexistent" exclusively, and the source tree  
used it three times as often as "nonexistant".  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M src/bin/pg_dump/t/002_pg_dump.pl
M src/interfaces/ecpg/test/connect/test1.pgc
M src/interfaces/ecpg/test/connect/test5.pgc
M src/interfaces/ecpg/test/expected/connect-test1-minGW32.stderr
M src/interfaces/ecpg/test/expected/connect-test1.c
M src/interfaces/ecpg/test/expected/connect-test1.stderr
M src/interfaces/ecpg/test/expected/connect-test5.c
M src/interfaces/ecpg/test/expected/connect-test5.stderr
M src/interfaces/ecpg/test/expected/preproc-whenever.c
M src/interfaces/ecpg/test/expected/preproc-whenever.stderr
M src/interfaces/ecpg/test/preproc/whenever.pgc
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_am.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_am.sql
M src/test/regress/sql/rowtypes.sql
M src/test/regress/sql/stats_ext.sql

Update stale comments, and fix comment typos.

commit   : 31d250e049b4e3d51a635edaa2221c11815e40e7    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 8 Jun 2019 10:12:26 -0700    

Click here for diff

M src/backend/access/brin/brin_inclusion.c
M src/backend/access/transam/multixact.c
M src/backend/port/sysv_shmem.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/adt/like.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_upgrade/TESTING
M src/bin/pg_upgrade/controldata.c
M src/fe_utils/string_utils.c
M src/include/storage/s_lock.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/test/recovery/t/013_crash_restart.pl

Fix assorted inconsistencies.

commit   : 92c4abc73693690ce9ff13ede160f0dcb0a2de7b    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 8 Jun 2019 08:16:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 8 Jun 2019 08:16:38 +0530    

Click here for diff

There were a number of issues in the recent commits which include typos,  
code and comments mismatch, leftover function declarations.  Fix them.  
  
Reported-by: Alexander Lakhin  
Author: Alexander Lakhin, Amit Kapila and Amit Langote  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/reloptions.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/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeModifyTable.c
M src/backend/lib/integerset.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/smgr/md.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/executor/executor.h
M src/include/storage/sync.h
M src/test/modules/test_integerset/test_integerset.c

Move be-gssapi-common.h into src/include/libpq/

commit   : 35b2d4bc0eb5d61a2a294ccb6b2e4abdad307604    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 8 Jun 2019 09:59:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 8 Jun 2019 09:59:02 +0900    

Click here for diff

The file has been introduced in src/backend/libpq/ as of b0b39f72, but  
all backend-side headers of libpq are located in src/include/libpq/.  
Note that the identification path on top of the file referred to  
src/include/libpq/ from the start.  
  
Author: Michael Paquier  
Reviewed-by: Stephen Frost  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-gssapi.c
R100 src/backend/libpq/be-gssapi-common.h src/include/libpq/be-gssapi-common.h

Improve some comments in pg_checksums about the needed clean shutdown

commit   : 84d4de97e8d14469974eb488730a13f942aa787a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Jun 2019 20:48:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Jun 2019 20:48:39 +0900    

Click here for diff

It was not clear from the code why it is necessary.  And we need a clean  
shutdown to avoid random checksum failures caused by torn pages.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDum5MbAb7F=pa9dOD1W2tukuDMPzWT7NjZceNoWB_6Qw@mail.gmail.com  

M src/bin/pg_checksums/pg_checksums.c

Fix copy-pasto in freeing memory on error in vacuumlo.

commit   : 77b68e3a4f854d95350a3366ecfc8b3b506ebaa7    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Jun 2019 12:42:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 7 Jun 2019 12:42:27 +0300    

Click here for diff

It's harmless to call PQfreemem() with a NULL argument, so the only  
consequence was that if allocating 'schema' failed, but allocating 'table'  
or 'field' succeeded, we would leak a bit of memory. That's highly  
unlikely to happen, so this is just academical, but let's get it right.  
  
Per bug #15838 from Timur Birsh. Backpatch back to 9.5, where the  
PQfreemem() calls were introduced.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/vacuumlo/vacuumlo.c

Fix default_tablespace usage for partitioned tables

commit   : a36c84c3e4a9bee6baa740848f67a5db3fa279b0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Jun 2019 00:44:17 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Jun 2019 00:44:17 -0400    

Click here for diff

In commit 87259588d0ab I (Álvaro) tried to rationalize the determination  
of tablespace to use for partitioned tables, but failed to handle the  
default_tablespace case.  Repair and add proper tests.  
  
Author: Amit Langote, Rushabh Lathia  
Reported-by: Rushabh Lathia  
Reviewed-by: Amit Langote, Álvaro Herrera  
Discussion: https://postgr.es/m/CAGPqQf0cYjm1=rjxk_6gU0SjUS70=yFUAdCJLwWzh9bhNJnyVg@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Fix inconsistency in comments atop ExecParallelEstimate.

commit   : d8261595bc6f5189896cdce6861915ac23830e7c    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 7 Jun 2019 05:23:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 7 Jun 2019 05:23:52 +0530    

Click here for diff

When this code was initially introduced in commit d1b7c1ff, the structure  
used was SharedPlanStateInstrumentation, but later when it got changed to  
Instrumentation structure in commit b287df70, we forgot to update the  
comment.  
  
Reported-by: Wu Fei  
Author: Wu Fei  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/52E6E0843B9D774C8C73D6CF64402F0562215EB2@G08CNEXMBPEKD02.g08.fujitsu.local  

M src/backend/executor/execParallel.c

Fix message style

commit   : e8bdea58f960eac669ebac01dc3865606dd7b453    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 6 Jun 2019 12:18:14 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 6 Jun 2019 12:18:14 -0400    

Click here for diff

Mark one message not for translation, and prefer "cannot" over "may  
not", per commentary from Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/table/tableamapi.c
M src/test/regress/expected/create_am.out

Add forgotten translatable string in pg_checksums.c

commit   : 438e51987dcc21ca7ce28c6d1a4e58b0249eb690    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Jun 2019 22:10:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Jun 2019 22:10:52 +0900    

Click here for diff

Oversight in commit 280e5f1.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_checksums/pg_checksums.c

pg_waldump: Fix invalid option handling

commit   : f65eced25118aab29804debc4e0b9a67f4d043ad    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jun 2019 22:55:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jun 2019 22:55:16 +0200    

Click here for diff

Previously, running pg_waldump with an invalid option (pg_waldump  
--foo) would print the help output and exit successfully.  This was  
because it tried to process the option letter '?' as a normal option,  
but that letter is used by getopt() to report an invalid option.  
  
To fix, process help and version options separately, like we do  
everywhere else.  Also add a basic test suite for pg_waldump and run  
the basic option handling tests, which would have caught this.  

M src/bin/pg_waldump/.gitignore
M src/bin/pg_waldump/Makefile
M src/bin/pg_waldump/pg_waldump.c
A src/bin/pg_waldump/t/001_basic.pl

Fix confusion on different kinds of slots in IndexOnlyScans.

commit   : cd96389d713787b025c84869ba417c6f2f008a86    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Jun 2019 09:46:52 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Jun 2019 09:46:52 +0300    

Click here for diff

We used the same slot to store a tuple from the index, and to store a  
tuple from the table. That's not OK. It worked with the heap, because  
heapam_getnextslot() stores a HeapTuple to the slot, and doesn't care how  
large the tts_values/nulls arrays are. But when I played with a toy table  
AM implementation that used a virtual tuple, it caused memory overruns.  
  
In the passing, tidy up comments on the ioss_PscanLen fields.  

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

Docs: concurrent builds of partitioned indexes are not supported

commit   : 6c0c28383749c0ade89ac70ba6dbce9af140c0a9    
  
author   : David Rowley <[email protected]>    
date     : Thu, 6 Jun 2019 12:36:37 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 6 Jun 2019 12:36:37 +1200    

Click here for diff

Document that CREATE INDEX CONCURRENTLY is not currently supported for  
indexes on partitioned tables.  
  
Discussion: https://postgr.es/m/CAKJS1f_CErd2z9L21Q8OGLD4TgH7yw1z9MAtHTSO13sXVG-yow@mail.gmail.com  
Backpatch-through: 11  

M doc/src/sgml/ref/create_index.sgml

commit   : b250898c76f3a04421656f1bd8c5c520de02046d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jun 2019 22:08:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jun 2019 22:08:50 +0200    

Click here for diff

Formal tables should generally have an xref in the text that points to  
them.  Add them here.  

M doc/src/sgml/func.sgml

Fix confusing NOTICE text in REINDEX CONCURRENTLY

commit   : e24a815c1c8550fcba5cc5aeb0d130db46570872    
  
author   : David Rowley <[email protected]>    
date     : Wed, 5 Jun 2019 21:05:41 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 5 Jun 2019 21:05:41 +1200    

Click here for diff

When performing REINDEX TABLE CONCURRENTLY, if all of the table's indexes  
could not be reindexed, a NOTICE message claimed that the table had no  
indexes.  This was confusing, so let's change the NOTICE text to something  
less confusing.  
  
In passing, also mention in the comment before ReindexRelationConcurrently  
that materialized views are supported too and also explain what the return  
value of the function means.  
  
Author: Ashwin Agrawal  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CALfoeithHvi13p_VyR8kt9o6Pa7Z=Smi6Nfc2anHnQx5Lj8bTQ@mail.gmail.com  

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

Fix incorrect index behavior in COPY FROM with partitioned tables

commit   : 56b3b3838284f53c83556592e60688522155f57f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 5 Jun 2019 18:28:38 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 5 Jun 2019 18:28:38 +1200    

Click here for diff

86b85044e rewrote how COPY FROM works to allow multiple tuple buffers to  
exist to once thus allowing multi-inserts to be used in more cases with  
partitioned tables.  That commit neglected to update the estate's  
es_result_relation_info when flushing the insert buffer to the partition  
making it possible for the index tuples to be added into an index on the  
wrong partition.  
  
Fix this and also add an Assert in ExecInsertIndexTuples to help ensure  
that we never make this mistake again.  
  
Reported-by: Haruka Takatsuka  
Author: Ashutosh Sharma  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/executor/execIndexing.c
M src/test/regress/input/copy.source
M src/test/regress/output/copy.source

Rework code using list_delete_cell() in MergeAttributes

commit   : f7e954ad1cf99a65b1785d999058898a6d56e014    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Jun 2019 15:01:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Jun 2019 15:01:14 +0900    

Click here for diff

When merging two attributes, we are sure that at least one remains.  
However, when deleting one element in the attribute list we may finish  
with an empty list returned as NIL by list_delete_cell(), but the code  
failed to track that, which is not project-like.  Adjust the call so as  
we check for an empty list, and make use of it in an assertion.  
  
This has been introduced by e7b3349, when adding support for CREATE  
TABLE OF.  
  
Author: Mark Dilger  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/CAE-h2TpPDqSWgOvfvSziOaMngMPwW+QZcmPpY8hQ_KOJ2+3hXQ@mail.gmail.com  

M src/backend/commands/tablecmds.c

Document piecemeal construction of partitioned indexes

commit   : 5efd604ec0a3bdde98fe19d8cada69ab4ef80db3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 4 Jun 2019 16:42:40 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 4 Jun 2019 16:42:40 -0400    

Click here for diff

Continuous operation cannot be achieved without applying this technique,  
so it needs to be properly described.  
  
Author: Álvaro Herrera  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

doc: Fix whitespace

commit   : ece9dc40d6d77a8607e72931510e30cfdfb78fd4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jun 2019 13:57:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jun 2019 13:57:38 +0200    

Click here for diff

Verbatim environment tags should not be indented.  

M doc/src/sgml/func.sgml

Add command column to pg_stat_progress_create_index

commit   : c880096dc1e14b62610aa34bc98db226fa134260    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jun 2019 09:16:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jun 2019 09:16:02 +0200    

Click here for diff

This allows determining which command is running, similar to  
pg_stat_progress_cluster.  
  
Discussion: https://www.postgresql.org/message-id/flat/f0e56b3b-74b7-6cbc-e207-a5ed6bee18dc%402ndquadrant.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/index.c
M src/backend/catalog/system_views.sql
M src/backend/commands/indexcmds.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out

Fix some typos and inconsistencies in tableam.h

commit   : 041a2642e51eb008351435709dcb054760a43bb9    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Jun 2019 09:48:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Jun 2019 09:48:25 +0900    

Click here for diff

The defined callback definitions have been using references to heap for  
a couple of variables and comments.  This makes the whole interface more  
consistent by using "table" which is more generic.  
  
A variable storing index information was misspelled as well.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/tableam.h

Fix contrib/auto_explain to not cause problems in parallel workers.

commit   : 2cd4e835701e15f5e32dd8bde488f8669ddf7ae8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Jun 2019 18:06:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Jun 2019 18:06:04 -0400    

Click here for diff

A parallel worker process should not be making any decisions of its  
own about whether to auto-explain.  If the parent session process  
passed down flags asking for instrumentation data, do that, otherwise  
not.  Trying to enable instrumentation anyway leads to bugs like the  
"could not find key N in shm TOC" failure reported in bug #15821  
from Christian Hofstaedtler.  
  
We can implement this cheaply by piggybacking on the existing logic  
for not doing anything when we've chosen not to sample a statement.  
  
While at it, clean up some tin-eared coding related to the sampling  
feature, including an off-by-one error that meant that asking for 1.0  
sampling rate didn't actually result in sampling every statement.  
  
Although the specific case reported here only manifested in >= v11,  
I believe that related misbehaviors can be demonstrated in any version  
that has parallel query; and the off-by-one error is certainly there  
back to 9.6 where that feature was added.  So back-patch to 9.6.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/auto_explain.c

Fix unsafe memory management in CloneRowTriggersToPartition().

commit   : eaf0292c3ba7acac2735f99a8988bd49a26112f5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Jun 2019 16:59:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Jun 2019 16:59:16 -0400    

Click here for diff

It's not really supported to call systable_getnext() in a different  
memory context than systable_beginscan() was called in, and it's  
*definitely* not safe to do so and then reset that context between  
calls.  I'm not very clear on how this code survived  
CLOBBER_CACHE_ALWAYS testing ... but Alexander Lakhin found a case  
that would crash it pretty reliably.  
  
Per bug #15828.  Fix, and backpatch to v11 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Update SQL conformance information about JSON path

commit   : 05d36b68ed011d112ee287b1fedd981c73a48f85    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jun 2019 21:33:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 3 Jun 2019 21:33:01 +0200    

Click here for diff

Reviewed-by: Oleg Bartunov <[email protected]>  

M src/backend/catalog/sql_features.txt
M src/include/catalog/catversion.h

Fix typos in various places

commit   : 1fb6f62a84041b668fd9e85a2f33bb3a0fd28fdc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Jun 2019 13:44:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Jun 2019 13:44:03 +0900    

Click here for diff

Author: Andrea Gelmini  
Reviewed-by: Michael Paquier, Justin Pryzby  
Discussion: https://postgr.es/m/20190528181718.GA39034@glet  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql
M src/backend/access/gist/gist.c
M src/backend/access/heap/heapam_handler.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/inet_net_pton.c
M src/backend/utils/adt/jsonpath.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/psql/command.c
M src/common/unicode/generate-norm_test_table.pl
M src/include/executor/tuptable.h
M src/include/fe_utils/conditional.h
M src/include/nodes/execnodes.h

Fix some issues and improve psql completion for access methods

commit   : 0240a00fbd4fd14f577edf8d36a032237fd0b9cb    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Jun 2019 11:02:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Jun 2019 11:02:32 +0900    

Click here for diff

The following issues have been spotted:  
- CREATE INDEX .. USING suggests both index and table AMs, but it should  
consider only index AMs.  
- CREATE TABLE .. USING has no completion support.  USING was not being  
included in the completion list where it should, and follow-up  
suggestions for table AMs have been missing as well.  
- CREATE ACCESS METHOD .. TYPE suggests only INDEX, with TABLE missing.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Make cpluspluscheck more portable.

commit   : f4755a2c01486519cfce5b21ab04529ad26f5ed1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Jun 2019 13:45:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Jun 2019 13:45:01 -0400    

Click here for diff

Teach it to scrape -I and -D switches from CPPFLAGS in Makefile.global.  
This is useful for testing on, eg, FreeBSD, where you won't get far  
without "-I/usr/local/include".  
  
Also, expand the set of blacklisted-for-unportability atomics headers,  
based on noting that arch-x86.h fails to compile on an ARM box.  The  
other ones I'd omitted seem to compile all right on architectures they  
don't belong to, but that's surely too shaky to rely on.  Let's do  
like we did for the src/include/port/ headers, and ignore all except  
the variant that's pulled in by the arch-independent header.  

M src/tools/pginclude/cpluspluscheck

Clean up PL/Perl's handling of the _() macro.

commit   : 032627ee7837f0baa539df7247e003dbaded2c90    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Jun 2019 12:23:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Jun 2019 12:23:39 -0400    

Click here for diff

Perl likes to redefine the _() macro:  
  
#ifdef CAN_PROTOTYPE  
#define	_(args) args  
#else ...  
  
There was lots not to like about the way we dealt with this before:  
  
1. Instead of taking care of the conflict centrally in plperl.h, we  
expected every one of its ever-growing number of includers to do so.  
This is duplicative and error-prone in itself, plus it means that  
plperl.h fails to meet the expectation of being compilable standalone,  
resulting in macro-redefinition warnings in cpluspluscheck.  
  
2. We left _() with its Perl definition, meaning that if someone tried  
to use it in any Perl-related extension, it would silently fail to  
provide run-time translation.  I don't see any live bugs of this ilk,  
but it's clearly a hard-to-notice bug waiting to happen.  
  
So fix that by centralizing the cleanup logic, making it match what  
we're already doing for other macro conflicts with Perl.  Since we only  
expect plperl.h to be included by extensions not core code, we should  
redefine _() as dgettext() not gettext().  

M contrib/hstore_plperl/hstore_plperl.c
M contrib/jsonb_plperl/jsonb_plperl.c
M src/pl/plperl/SPI.xs
M src/pl/plperl/Util.xs
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl.h

worker_spi needs a .gitignore file now.

commit   : 135063e6f6ee61c7243801e9f4d702921ed53e06    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Jun 2019 11:13:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Jun 2019 11:13:23 -0400    

Click here for diff

A src/test/modules/worker_spi/.gitignore

Un-break ecpg tests for Windows.

commit   : 10a53cae9993abae159abdc6a76e46f6aac120d1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 2 Jun 2019 11:07:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 2 Jun 2019 11:07:54 -0400    

Click here for diff

Declaring a function "inline" still doesn't work with Windows compilers  
(C99? what's that?), unless the macro provided by pg_config.h is  
in-scope, which it is not in our ECPG test programs.  So the workaround  
I tried to use in commit 7640f9312 doesn't work for Windows.  Revert  
the change in printf_hack.h, and instead just blacklist that file  
in cpluspluscheck --- since it's a not-installed test file, we don't  
really need to verify its C++ cleanliness anyway.  

M src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
M src/interfaces/ecpg/test/printf_hack.h
M src/tools/pginclude/cpluspluscheck

Increase test coverage for worker_spi by ∞%

commit   : 4b3f1dd71b74f82dedbf37c331d0a444368c4009    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 2 Jun 2019 00:29:49 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 2 Jun 2019 00:29:49 -0400    

Click here for diff

This test module was not getting invoked, other than at compile time,  
limiting its usefulness -- and keeping its coverage at 0%.  Add a  
minimal regression test to ensure it runs on make check-world; this  
makes it 92% covered (line-wise), which seems sufficient.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/worker_spi/Makefile
A src/test/modules/worker_spi/dynamic.conf
A src/test/modules/worker_spi/expected/worker_spi.out
A src/test/modules/worker_spi/sql/worker_spi.sql
M src/test/modules/worker_spi/worker_spi.c

Fix documentation of check_option in information_schema.views

commit   : 0b8e0532c65c3a2d4b0e9c254efa022767bacceb    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 1 Jun 2019 15:33:47 -0400    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 1 Jun 2019 15:33:47 -0400    

Click here for diff

Support of CHECK OPTION for updatable views has been added in 9.4, but  
the documentation of information_schema never got the call even if the  
information displayed is correct.  
  
Author: Gilles Darold  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/information_schema.sgml

Improve coverage of cpluspluscheck.

commit   : 6f54b80edd88abd5665aa12fbcf10f846dd80939    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 16:32:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 16:32:07 -0400    

Click here for diff

Formerly, cpluspluscheck was only meant to examine headers that  
we thought of as exported --- but its notion of what we export  
was well behind the times.  Let's just make it check *all* .h  
files, except for a well-defined blacklist, instead.  
  
While at it, improve its ability to use a C++ compiler other than g++,  
by scraping the CXX setting from Makefile.global and making it possible  
to override the warning options used (per suggestion from Andres Freund).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pginclude/cpluspluscheck

Integrate cpluspluscheck into build system.

commit   : b1cd7ce23f40e1e443b3f2ab127bbe8348add678    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 31 May 2019 12:36:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 31 May 2019 12:36:17 -0700    

Click here for diff

Previously cpluspluscheck wouldn't work in vpath builds, this commit  
fixes that. To make it easier to invoke, there's a top-level  
cpluspluscheck target.  
  
Discussion: https://postgr.es/[email protected]  

M GNUmakefile.in
M src/tools/pginclude/cpluspluscheck

Fix incorrect parameter name in comment

commit   : 72b6223f766d6ba9076d7b1ebdf05df75e83ba5c    
  
author   : David Rowley <[email protected]>    
date     : Fri, 31 May 2019 13:30:05 -0400    
  
committer: David Rowley <[email protected]>    
date     : Fri, 31 May 2019 13:30:05 -0400    

Click here for diff

Author: Antonin Houska  
Discussion: https://postgr.es/m/22370.1559293357@localhost  

M src/include/access/tableam.h

Adjust ecpg expected-results files for commit 7640f9312.

commit   : ec66ec8b21d3d779047313ac214fba7bcd29a97c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 12:47:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 12:47:19 -0400    

Click here for diff

Mea culpa for not rechecking check-world at the last step :-(  
Per buildfarm.  

M src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c

Fix C++ incompatibilities in ecpg/preproc/ header files.

commit   : 4f67858d3f210658d42f44fc674d2850581e572e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 12:38:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 12:38:53 -0400    

Click here for diff

There's probably no need to back-patch this, since it seems unlikely  
that anybody would be inserting C++ code into ecpg's preprocessor.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/type.h

Fix C++ incompatibilities in plpgsql's header files.

commit   : 3f61b3205f1a8bd27909be97341f002db8842093    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 12:34:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 12:34:54 -0400    

Click here for diff

Rename some exposed parameters so that they don't conflict with  
C++ reserved words.  
  
Back-patch to all supported versions.  
  
George Tarasov  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix assorted header files that failed to compile standalone.

commit   : 7640f9312321ceba2af61f7017da7e64f0f7b667    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 11:45:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 11:45:33 -0400    

Click here for diff

We have a longstanding project convention that all .h files should  
be includable with no prerequisites other than postgres.h.  This is  
tested/relied-on by cpluspluscheck.  However, cpluspluscheck has not  
historically been applied to most headers outside the src/include  
tree, with the predictable consequence that some of them don't work.  
Fix that, usually by adding missing #include dependencies.  
  
The change in printf_hack.h might require some explanation: without  
it, my C++ compiler whines that the function is unused.  There's  
not so many call sites that "inline" is going to cost much, and  
besides all the callers are in test code that we really don't care  
about the size of.  
  
There's no actual bugs being fixed here, so I see no need to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_waldump/rmgrdesc.h
M src/bin/psql/crosstabview.h
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/test/printf_hack.h
M src/interfaces/libpq/fe-gssapi-common.h
M src/pl/plperl/plperl_helpers.h
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_resultobject.h
M src/pl/plpython/plpy_spi.h
M src/pl/plpython/plpy_subxactobject.h
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/plpy_util.h
M src/pl/plpython/plpython.h

Make our perfect hash functions be valid C++.

commit   : 9e58705a7f9728f10b2e0f0c9adc6e6ecff7486e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 10:40:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 May 2019 10:40:00 -0400    

Click here for diff

While C is happy to cast "const void *" to "const unsigned char *"  
silently, C++ insists on an explicit cast.  Since we put these  
functions into header files, cpluspluscheck whines about that.  
Add the cast to pacify it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/PerfectHash.pm

Fix double-phrase typo in message

commit   : d22f885f895add7e0184b08a78ba92ff091e36c4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 31 May 2019 10:08:37 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 31 May 2019 10:08:37 -0400    

Click here for diff

New in 147e3722f7e5.  

M src/backend/access/table/tableam.c

Rework options of pg_checksums options for filenode handling

commit   : fc115d0f9fc656967260815c031e0f25741428ae    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 30 May 2019 16:58:17 -0400    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 30 May 2019 16:58:17 -0400    

Click here for diff

This makes the tool consistent with the option set of oid2name, which  
has been historically using -f for filenodes, and has more recently  
gained long options and --filenode via 1aaf532.  
  
Reported-by: Peter Eisentraut  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_checksums.sgml
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/002_actions.pl

Remove unnecessary (and wrong) forward declaration.

commit   : 13002bf0bcdf4900987684ca6ef7665a25aa692b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 May 2019 13:44:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 May 2019 13:44:38 -0700    

Click here for diff

Interestingly only C++ compilers have, so far, complained about this  
odd forward declaration. This originated when IndexBuildCallback was  
defined in another file, but now is completely unnecessary (but was  
wrong before too, cpluspluscheck just wouldn't have noticed).  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/tableam.h

Make error logging in extended statistics more consistent

commit   : fe415ff10408a1487d5773b47459306476ec58f0    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 30 May 2019 16:16:12 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 30 May 2019 16:16:12 +0200    

Click here for diff

Most errors reported in extended statistics are internal issues, and so  
should use elog(). The MCV list code was already following this rule, but  
the functional dependencies and ndistinct coefficients were using a mix  
of elog() and ereport(). Fix this by changing most places to elog(), with  
the exception of input functions.  
  
This is a mostly cosmetic change, it makes the life a little bit easier  
for translators, as elog() messages are not translated. So backpatch to  
PostgreSQL 10, where extended statistics were introduced.  
  
Author: Tomas Vondra  
Backpatch-through: 10 where extended statistics were added  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c

Fix some documentation about access methods

commit   : 56b78626c7288fad498c0fae7fe4fd1f240ed13f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 29 May 2019 11:37:37 -0400    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 29 May 2019 11:37:37 -0400    

Click here for diff

Author: Guillaume Lelarge  
Discussion: https://postgr.es/m/CAECtzeWPz4JikzUqZdMjqPTe8dAP3nZxPD-58Y-Hhvirg0fF+A@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/tablesample-method.sgml

Fix some documentation about FKs and partitioned tables

commit   : f73293aba4d43e48707e361b2b1ef1465fef46e0    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 29 May 2019 11:19:06 -0400    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 29 May 2019 11:19:06 -0400    

Click here for diff

This got forgotten in f56f8f which has added foreign key support for  
partitioned tables.  In passing, add a mention about caveats applying to  
tables partitioned using inheritance regarding indexes and foreign keys.  
  
Author: Paul A Jungwirth  
Reviewed-by: Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/CA+renyUuSmYgmZjKc_DfUNVZ0uttF91-FwhDVW3F7WEPj0jL5w@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Make one message just like all its siblings.

commit   : d890fa812dd4620db0d092da1cd7cba01494cd21    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 28 May 2019 23:44:22 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 28 May 2019 23:44:22 -0400    

Click here for diff

M src/backend/storage/page/bufpage.c

Fix typo in message

commit   : a100974751baec7e13a527bf0c378ce8ef2787b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 28 May 2019 17:34:38 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 28 May 2019 17:34:38 -0400    

Click here for diff

I introduced the typo in source code in the course of 75445c1515ff.  
Repair.  

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

In the pg_upgrade test suite, don't write to src/test/regress.

commit   : 40b132c1afbb4b1494aa8e48cc35ec98d2b90777    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 28 May 2019 12:59:00 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 28 May 2019 12:59:00 -0700    

Click here for diff

When this suite runs installcheck, redirect file creations from  
src/test/regress to src/bin/pg_upgrade/tmp_check/regress.  This closes a  
race condition in "make -j check-world".  If the pg_upgrade suite wrote  
to a given src/test/regress/results file in parallel with the regular  
src/test/regress invocation writing it, a test failed spuriously.  Even  
without parallelism, in "make -k check-world", the suite finishing  
second overwrote the other's regression.diffs.  This revealed test  
"largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too.  
  
Buildfarm client REL_10, released fifty-four days ago, supports saving  
regression.diffs from its new location.  When an older client reports a  
pg_upgradeCheck failure, it will no longer include regression.diffs.  
Back-patch to 9.5, where pg_upgrade moved to src/bin.  
  
Reviewed (in earlier versions) by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/tools/msvc/vcregress.pl

In the pg_upgrade test suite, remove and recreate "tmp_check".

commit   : 10b72deafea5972edcafb9eb3f97154f32ccd340    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 28 May 2019 12:58:30 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 28 May 2019 12:58:30 -0700    

Click here for diff

This allows "vcregress upgradecheck" to pass twice in immediate  
succession, and it's more like how $(prove_check) works.  Back-patch to  
9.5, where pg_upgrade moved to src/bin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh
M src/tools/msvc/vcregress.pl

v12 release notes: Correct contributor name.

commit   : d5ec46bf224d2ea1b010b2bc10a65e44d4456553    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 28 May 2019 09:06:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 28 May 2019 09:06:40 -0700    

Click here for diff

Mea culpa.  

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

Fix comment

commit   : a94fd139df975a006d1697d2a7180d3656222d4d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 May 2019 08:26:24 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 May 2019 08:26:24 -0400    

Click here for diff

This code block was copied/adapted from other similar places but  
somehow the comment placement was changed so that it makes less sense.  

M src/bin/pg_checksums/pg_checksums.c

docs: PG 12 relnote wording fix

commit   : 3ceaed106d95e76c7dbfd41f5d83a163fd0d25c8    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 May 2019 07:17:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 May 2019 07:17:34 -0400    

Click here for diff

Reported-by: Gaby Schilders  

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

Fix typos in SQL scripts of pgcrypto

commit   : af94ea7406f332567331a9b2525fae4b57c96061    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 May 2019 06:33:30 -0400    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 May 2019 06:33:30 -0400    

Click here for diff

Author: Gurjeet Singh  
Discussion: https://postgr.es/m/CABwTF4U_5kEnH93PXZEuEsZHuoSSuBEOqC6pian8vDfLZSQJNA@mail.gmail.com  

M contrib/pgcrypto/expected/hmac-sha1.out
M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/sql/hmac-sha1.sql
M contrib/pgcrypto/sql/pgp-decrypt.sql

doc: Fix generated column documentation

commit   : 00ef6e3b28a8220f2dba881dbf56e3ba62f851bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 May 2019 12:26:16 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 May 2019 12:26:16 -0400    

Click here for diff

The old text still had an implicit reference to the virtual behavior,  
which was not in the final patch.  
  
Author: Tobias Bussmann <[email protected]>  

M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_table.sgml

Fix more thinkos in new ECPG "PREPARE AS" code.

commit   : 39fe881d3cf315d8d2ea9ee4ea1e3e39a82d5cc7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 May 2019 10:39:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 May 2019 10:39:11 -0400    

Click here for diff

ecpg_build_params() failed to check for ecpg_alloc failure in one  
newly-added code path, and leaked a temporary string in another path.  
Errors in commit a1dc6ab46, spotted by Coverity.  

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

Fix thinko in new ECPG "PREPARE AS" code.

commit   : 331695a4d9ca40864240aca721dc588a206ff395    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 May 2019 10:06:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 May 2019 10:06:37 -0400    

Click here for diff

ecpg_register_prepared_stmt() is pretty obviously checking the wrong  
variable while trying to detect malloc failure.  Error in commit  
a1dc6ab46, spotted by Coverity.  

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

Fix typos.

commit   : 9679345f3c5ec071f63db358581e28f06c8744a7    
  
author   : Amit Kapila <[email protected]>    
date     : Sun, 26 May 2019 18:28:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sun, 26 May 2019 18:28:18 +0530    

Click here for diff

Reported-by: Alexander Lakhin  
Author: Alexander Lakhin  
Reviewed-by: Amit Kapila and Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/charset.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execTuples.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/libpq/hba.c
M src/backend/postmaster/syslogger.c
M src/backend/statistics/mcv.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/statistics/statistics.h
M src/include/utils/jsonpath.h
M src/interfaces/libpq/pqexpbuffer.c

Change Graphviz file extension

commit   : 41205719d34969018f708baa70d9d06dae0c0d08    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 26 May 2019 08:08:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 26 May 2019 08:08:05 +0200    

Click here for diff

Change extension for Graphviz files from .dot to .gv.  The latter  
appears to be the generally preferred one nowadays.  
  
Discussion: https://www.postgresql.org/message-id/flat/71fe76d2-c7d7-2acc-6762-bbf9e61c566e%402ndquadrant.com  

M contrib/pg_trgm/trgm_regexp.c
M doc/src/sgml/images/Makefile
R100 doc/src/sgml/images/gin.dot doc/src/sgml/images/gin.gv

Doc: fix incorrect references in PG 12 release notes.

commit   : 02aa15de1b3821b0288a13dec71ce99f2e31fda5    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 25 May 2019 15:40:53 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 25 May 2019 15:40:53 +0530    

Click here for diff

Reported-by: Euler Taveira  
Author: Euler Taveira  
Discussion: https://postgr.es/m/CAHE3wgjiA8DdnUzH9WqBLxdrUVvjDkKNdHx-MkEg9uV+HtpMfg@mail.gmail.com  

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

Doc: fix typo in pgbench random_zipfian() documentation.

commit   : 591fb289c3eef010ee1bb271a54fab7da385c4cd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 May 2019 11:16:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 May 2019 11:16:06 -0400    

Click here for diff

Per bug #15819 from Koizumi Satoru.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgbench.sgml

commit   : 4c9210f34c621639f896d57cf7bfb5e9be139c91    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 23 May 2019 13:23:59 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 23 May 2019 13:23:59 +1200    

Click here for diff

Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CA%2BhUKGJFWXmtYo6Frd77RR8YXCHz7hJ2mRy5aHV%3D7fJOqDnBHA%40mail.gmail.com  

M src/backend/lib/integerset.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-gssapi-common.h
M src/backend/libpq/be-secure-gssapi.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-secure-gssapi.c

Fix typos.

commit   : 7988cb446d20512ec9d091db66dba6adee3f3d4b    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 23 May 2019 13:17:41 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 23 May 2019 13:17:41 +1200    

Click here for diff

Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CA%2BhUKGJFWXmtYo6Frd77RR8YXCHz7hJ2mRy5aHV%3D7fJOqDnBHA%40mail.gmail.com  

M src/backend/executor/execTuples.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/file/sharedfileset.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c

tableam: Rename wrapper functions to match callback names.

commit   : 73b8c3bd2889fed986044e15aefd0911f96ccdd3    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 May 2019 16:25:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 May 2019 16:25:48 -0700    

Click here for diff

Some of the wrapper functions didn't match the callback names. Many of  
them due to staying "consistent" with historic naming of the wrapped  
functionality. We decided that for most cases it's more important to  
be for tableam to be consistent going forward, than with the past.  
  
The one exception is beginscan/endscan/...  because it'd have looked  
odd to have systable_beginscan/endscan/... with a different naming  
scheme, and changing the systable_* APIs would have caused way too  
much churn (including breaking a lot of external users).  
  
Author: Ashwin Agrawal, with some small additions by Andres Freund  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CALfoeiugyrXZfX7n0ORCa4L-m834dzmaE8eFdbNR6PMpetU4Ww@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/table/tableam.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeTidscan.c
M src/backend/utils/adt/tid.c
M src/include/access/tableam.h

Fix table dump in pg_dump[all] with backends older than 9.5

commit   : 54487d1560619a0027e0651d1b8d715ca8fc388c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 May 2019 08:19:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 May 2019 08:19:21 +0900    

Click here for diff

The access method name "amname" can be dumped as of 3b925e90, but  
queries for backends older than 9.5 forgot to map it to a dummy NULL  
value, causing the column to not be mapped to a number.  As a result,  
pg_dump was throwing some spurious errors in its stderr output coming  
from libpq:  
pg_dump: column number -1 is out of range 0..36  
  
Fix this issue by adding a mapping of "amname" to NULL to all the older  
queries.  
  
Discussion: https://postgr.es/m/[email protected]  
Author: Michael Paquier  
Reviewed-by: Dmitry Dolgov, Andres Freund, Tom Lane  

M src/bin/pg_dump/pg_dump.c

pg_upgrade: Make test.sh's installcheck use to-be-upgraded version's bindir.

commit   : f916221df5652b95c402847905bdf48950b5b281    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 May 2019 14:46:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 May 2019 14:46:52 -0700    

Click here for diff

On master (after 700538) the old version's installed psql was used -  
even when the old version might not actually be installed / might be  
installed into a temporary directory. As commonly the case when just  
executing make check for pg_upgrade, as $oldbindir is just the current  
version's $bindir.  
  
In the back branches, with --install specified, psql from the new  
version's temporary installation was used, without --install (e.g for  
NO_TEMP_INSTALL, cf 47b3c26642), the new version's installed psql was  
used (which might or might not exist).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Fix array size allocation for HashAggregate hash keys.

commit   : 44e95b5728a4569c494fa4ea4317f8a2f50a206b    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 23 May 2019 15:26:01 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 23 May 2019 15:26:01 +0100    

Click here for diff

When there were duplicate columns in the hash key list, the array  
sizes could be miscomputed, resulting in access off the end of the  
array. Adjust the computation to ensure the array is always large  
enough.  
  
(I considered whether the duplicates could be removed in planning, but  
I can't rule out the possibility that duplicate columns might have  
different hash functions assigned. Simpler to just make sure it works  
at execution time regardless.)  
  
Bug apparently introduced in fc4b3dea2 as part of narrowing down the  
tuples stored in the hashtable. Reported by Colm McHugh of Salesforce,  
though I didn't use their patch. Backpatch back to version 10 where  
the bug was introduced.  
  
Discussion: https://postgr.es/m/CAFeeJoKKu0u+A_A9R9316djW-YW3-+Gtgvy3ju655qRHR3jtdA@mail.gmail.com  

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

Fix ordering of GRANT commands in pg_dumpall for tablespaces

commit   : 156c0c2dff403fd115f3a5f6d73ab80959c84129    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 May 2019 10:48:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 May 2019 10:48:17 +0900    

Click here for diff

This uses a method similar to 68a7c24f and now b8c6014 (applied for  
database creation), which guarantees that GRANT commands using the WITH  
GRANT OPTION are dumped in a way so as cascading dependencies are  
respected.  Note that tablespaces do not have support for initial  
privileges via pg_init_privs, so the same method needs to be applied  
again.  It would be nice to merge all the logic generating ACL queries  
in dumps under the same banner, but this requires extending the support  
of pg_init_privs to objects that cannot use it yet, so this is left as  
future work.  
  
Discussion: https://postgr.es/m/[email protected]  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart  
Backpatch-through: 9.6  

M src/bin/pg_dump/pg_dumpall.c

Remove -o/--oids from pg_dumpall

commit   : 657c2384c6c79c6ed0d6f71f811b2fc7c41f104a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 May 2019 09:36:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 May 2019 09:36:28 +0900    

Click here for diff

This has been forgotten in 578b229, which has removed support for WITH  
OIDS.  
  
Discussion: https://postgr.es/m/CALAY4q99FcFCoG6ddke0V-AksGe82L_+bhDWgEfgZBakB840zA@mail.gmail.com  
Author: Surafel Temesgen  

M doc/src/sgml/ref/pg_dumpall.sgml
M src/bin/pg_dump/pg_dumpall.c

Initial pgperltidy run for v12.

commit   : db6e2b4c52ade524f3db419d75084728e96e1f9c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 13:36:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 13:36:19 -0400    

Click here for diff

Make all the perl code look nice, too (for some value of "nice").  

M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/include/catalog/unused_oids
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/test/modules/commit_ts/t/004_restart.pl
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/004_timeline_switch.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/100_bugs.pl
M src/tools/gen_keywordlist.pl
M src/tools/msvc/Install.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/build.pl
M src/tools/msvc/install.pl
M src/tools/msvc/mkvcbuild.pl
M src/tools/msvc/vcregress.pl

Phase 2 pgindent run for v12.

commit   : 8255c7a5eeba8f1a38b7a431c04909bde4f5e67d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 13:04:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 13:04:48 -0400    

Click here for diff

Switch to 2.1 version of pg_bsd_indent.  This formats  
multiline function declarations "correctly", that is with  
additional lines of parameter declarations indented to match  
where the first line's left parenthesis is.  
  
Discussion: https://postgr.es/m/CAEepm=0P3FeTXRcU5B2W3jv3PgRVZ-kGUXLGfd42FFhUROO3ug@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/auto_explain/auto_explain.c
M contrib/bloom/bloom.h
M contrib/btree_gist/btree_utils_num.h
M contrib/btree_gist/btree_utils_var.h
M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/intarray/_int_selfuncs.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgcrypto/imath.c
M contrib/pgcrypto/mbuf.h
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp.h
M contrib/pgcrypto/px-crypt.h
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/sepgsql/sepgsql.h
M contrib/tablefunc/tablefunc.c
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/xml2/xpath.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/toasting.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/dbcommands.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execSRF.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/integerset.c
M src/backend/lib/pairingheap.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.h
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/regex/regcomp.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/syncrep.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/inet_cidr_ntop.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_db.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.h
M src/bin/psql/copy.h
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/startup.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/variables.h
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.h
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/file_utils.c
M src/common/ip.c
M src/fe_utils/print.c
M src/include/access/amvalidate.h
M src/include/access/brin_internal.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/hash.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/rewriteheap.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/table.h
M src/include/access/tableam.h
M src/include/access/timeline.h
M src/include/access/transam.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tuptoaster.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/catalog.h
M src/include/catalog/dependency.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_type.h
M src/include/catalog/storage.h
M src/include/catalog/toasting.h
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/copy.h
M src/include/commands/createas.h
M src/include/commands/defrem.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/view.h
M src/include/common/config_info.h
M src/include/common/controldata_utils.h
M src/include/common/ip.h
M src/include/common/md5.h
M src/include/common/pg_lzcompress.h
M src/include/common/relpath.h
M src/include/common/scram-common.h
M src/include/common/sha2.h
M src/include/common/string.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/spi.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/lib/binaryheap.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/rbtree.h
M src/include/lib/simplehash.h
M src/include/lib/stringinfo.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/crypt.h
M src/include/libpq/hba.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq.h
M src/include/libpq/pqformat.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/extensible.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/print.h
M src/include/nodes/tidbitmap.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/paramassign.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/regex/regex.h
M src/include/regex/regexport.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalfuncs.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/walreceiver.h
M src/include/replication/worker_internal.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rowsecurity.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/itemptr.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/md.h
M src/include/storage/pg_shmem.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/smgr.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/array.h
M src/include/utils/builtins.h
M src/include/utils/catcache.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/elog.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/freepage.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hashutils.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inval.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memutils.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/pg_locale.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/ps_status.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/relcache.h
M src/include/utils/relmapper.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/snapmgr.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/varlena.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/pqexpbuffer.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/tcl/pltcl.c
M src/port/inet_net_ntop.c
M src/port/path.c
M src/port/qsort.c
M src/port/qsort_arg.c
M src/port/snprintf.c
M src/test/isolation/isolationtester.c
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/regress/pg_regress.h
M src/timezone/localtime.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/timezone/strftime.c
M src/timezone/zic.c
M src/tools/pgindent/pgindent
M src/tutorial/funcs.c

Initial pgindent run for v12.

commit   : be76af171cdb3e7465c4ef234af403f97ad79b7b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 12:55:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 12:55:34 -0400    

Click here for diff

This is still using the 2.0 version of pg_bsd_indent.  
I thought it would be good to commit this separately,  
so as to document the differences between 2.0 and 2.1 behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M contrib/cube/cube.c
M contrib/file_fdw/file_fdw.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_tool.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pgcrypto/imath.c
M contrib/pgcrypto/imath.h
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/common/heaptuple.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/storage.c
M src/backend/commands/amcmds.c
M src/backend/commands/cluster.c
M src/backend/commands/constraint.c
M src/backend/commands/dbcommands.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/indexcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/vacuum.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/nodes/bitmapset.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partdesc.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.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/file/fd.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/dest.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/dsa.c
M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/copy.c
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/bin/psql/variables.c
M src/common/d2s.c
M src/common/f2s.c
M src/common/file_utils.c
M src/common/logging.c
M src/common/pg_lzcompress.c
M src/common/rmtree.c
M src/include/access/amapi.h
M src/include/access/gistxlog.h
M src/include/access/hio.h
M src/include/access/relscan.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/tableam.h
M src/include/access/tupdesc.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/catalog/dependency.h
M src/include/catalog/index.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_policy.h
M src/include/catalog/storage.h
M src/include/commands/defrem.h
M src/include/commands/trigger.h
M src/include/commands/vacuum.h
M src/include/common/file_utils.h
M src/include/common/logging.h
M src/include/executor/execParallel.h
M src/include/executor/executor.h
M src/include/executor/tuptable.h
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/parser/parse_node.h
M src/include/pgstat.h
M src/include/port.h
M src/include/replication/logical.h
M src/include/replication/reorderbuffer.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/fd.h
M src/include/storage/md.h
M src/include/tcop/deparse_utility.h
M src/include/utils/datum.h
M src/interfaces/ecpg/ecpglib/cursor.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/pqexpbuffer.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/plpy_exec.c
M src/pl/tcl/pltcl.c
M src/port/dlopen.c
M src/port/pg_bitutils.c
M src/port/strtof.c
M src/test/regress/pg_regress.c
M src/test/regress/regress.c
M src/tools/pgindent/typedefs.list

Convert ExecComputeStoredGenerated to use tuple slots

commit   : 66a4bad83aaa6613a45a00a488c04427f9969fb4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2019 19:37:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2019 19:37:52 +0200    

Click here for diff

This code was still using the old style of forming a heap tuple rather  
than using tuple slots.  This would be less efficient if a non-heap  
access method was used.  And using tuple slots is actually quite a bit  
faster when using heap as well.  
  
Also add some test cases for generated columns with null values and  
with varlena values.  This lack of coverage was discovered while  
working on this patch.  
  
Discussion: https://www.postgresql.org/message-id/flat/20190331025744.ugbsyks7czfcoksd%40alap3.anarazel.de  

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

Mention ANALYZE boolean options in documentation.

commit   : 03de5187d50af67d154a47cf00899290dca13003    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 23 May 2019 01:18:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 23 May 2019 01:18:16 +0900    

Click here for diff

Commit 41b54ba78e allowed not only VACUUM but also ANALYZE options  
to take a boolean argument. But it forgot to update the documentation  
for ANALYZE. This commit adds the descriptions about those ANALYZE  
boolean options into the documentation.  
  
This patch also updates tab-completion for ANALYZE boolean options.  
  
Reported-by: Kyotaro Horiguchi  
Author: Fujii Masao  
Reviewed-by: Masahiko Sawada, Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwHTUt-kuwgiwe8f0AvTnB+ySqJWh95jvmh-qcoKW9YA9g@mail.gmail.com  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/release-12.sgml
M src/bin/psql/tab-complete.c

Fix O(N^2) performance issue in pg_publication_tables view.

commit   : 166f69f769c83ef8759d905bf7f1a9aa1d97a340    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 11:46:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 11:46:57 -0400    

Click here for diff

The original coding of this view relied on a correlated IN sub-query.  
Our planner is not very bright about correlated sub-queries, and even  
if it were, there's no way for it to know that the output of  
pg_get_publication_tables() is duplicate-free, making the de-duplicating  
semantics of IN unnecessary.  Hence, rewrite as a LATERAL sub-query.  
This provides circa 100X speedup for me with a few hundred published  
tables (the whole regression database), and things would degrade as  
roughly O(published_relations * all_relations) beyond that.  
  
Because the rules.out expected output changes, force a catversion bump.  
Ordinarily we might not want to do that post-beta1; but we already know  
we'll be doing a catversion bump before beta2 to fix pg_statistic_ext  
issues, so it's pretty much free to fix it now instead of waiting for v13.  
  
Per report and fix suggestion from PegoraroF10.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

docs: PG 12 release notes, support functions

commit   : 728840fe13acff7b03a4b1a813eeb8900ce5e469    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2019 11:22:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2019 11:22:13 -0400    

Click here for diff

Move support function mention to the proper section, and reword.  
  
Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: PG 12 relnotes, correct recovery_target* variable mention

commit   : ba95a6933632410d103d6f17cd3bc1adf92a08f9    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2019 10:54:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2019 10:54:40 -0400    

Click here for diff

Clarify new restriction on recovery_target* variables.  
  
Reported-by: Gaby Schilders  
  
Discussion: reported via chat  

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

Add .gitignore entries for new ecpg test case.

commit   : 4a657ab260499381c645673ca1c3255adc0b2ace    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 10:42:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 10:42:24 -0400    

Click here for diff

Oversight in commit a1dc6ab465986a62b308dd1bb8da316b5ed9685a.  

M src/interfaces/ecpg/test/sql/.gitignore

In transam.h, don't expose static inline functions to frontend code.

commit   : 4fbf809e13c3ba09c4f03d148cb58767e56f67f1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 10:38:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 May 2019 10:38:21 -0400    

Click here for diff

That leads to unsatisfied external references if the C compiler fails  
to elide unused static functions.  Apparently, we have no buildfarm  
members building HEAD that have that issue ... but such compilers still  
exist in the wild.  Need to do something about that.  
  
In passing, fix Berkeley-era typo in comment.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/transam.h

Fix ordering of GRANT commands in pg_dump for database creation

commit   : b8c6014a65ee0819e8fe4c7536f72da0df5d8e46    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 May 2019 14:48:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 May 2019 14:48:00 +0900    

Click here for diff

This uses a method similar to 68a7c24f, which guarantees that GRANT  
commands using the WITH GRANT OPTION are dumped in a way so as cascading  
dependencies are respected.  As databases do not have support for  
initial privileges via pg_init_privs, we need to repeat again the same  
ACL reordering method.  
  
ACL for databases have been moved from pg_dumpall to pg_dump in v11, so  
this impacts pg_dump for v11 and above, and pg_dumpall for v9.6 and  
v10.  
  
Discussion: https://postgr.es/m/[email protected]  
Author: Nathan Bossart  
Reviewed-by: Haribabu Kommi  
Backpatch-through: 9.6  

M src/bin/pg_dump/pg_dump.c

Un-break pg_upgrade regression test.

commit   : 5eb4a51cb15166392ca3ede6ec58f8f1f820ef53    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 May 2019 23:51:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 May 2019 23:51:19 -0400    

Click here for diff

Commit 5af2e976d removed a bit too much from the test.sh invocation.  
Per buildfarm.  

M src/bin/pg_upgrade/Makefile

Implement PREPARE AS statement for ECPG.

commit   : a1dc6ab465986a62b308dd1bb8da316b5ed9685a    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 22 May 2019 04:58:29 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 22 May 2019 04:58:29 +0200    

Click here for diff

Besides implementing the new statement this change fix some issues with the  
parsing of PREPARE and EXECUTE statements. The different forms of these  
statements are now all handled in a ujnified way.  
  
Author: Matsumura-san <[email protected]>  

M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/include/ecpgtype.h
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-prepareas.c
A src/interfaces/ecpg/test/expected/sql-prepareas.stderr
A src/interfaces/ecpg/test/expected/sql-prepareas.stdout
M src/interfaces/ecpg/test/sql/Makefile
A src/interfaces/ecpg/test/sql/prepareas.pgc

pg_upgrade: Avoid check target accidentally breaking make's --output-sync.

commit   : 5af2e976d72aa345337596cc986237c57e1146b2    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 21 May 2019 15:03:27 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 21 May 2019 15:03:27 -0700    

Click here for diff

When $(MAKE) is present in a rule, make assumes that target is a  
submake, and it doesn't need to buffer its output. But in this case  
it's a shell script that needs buffered output. Avoid that heuristic,  
by referring to $(MAKE) via an indirection.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/Makefile

pg_upgrade: Don't use separate installation for test.

commit   : 7005389b2ad17258bc3aa0a2427c4eb77fed1d09    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 21 May 2019 14:56:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 21 May 2019 14:56:29 -0700    

Click here for diff

For pg_upgrade's test we (unless prevented by the caller via via  
NO_TEMP_INSTALL) built a separate installation. That causes an  
unnecessary slowdown after the infrastructure introduced by  
dcae5faccab (and unnecessarily duplicates code).  
  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/test.sh

docs: PG 12 relnote adjustments based on feedback from Tom Lane

commit   : 8e719d33fd253fc378871ba4dbf2de41fd2ba462    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:45:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:45:48 -0400    

Click here for diff

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

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

docs: adjust RECORD PG 12 relnote item

commit   : 3468a04a3e498bab755909505e8f7b6023bea493    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:35:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:35:43 -0400    

Click here for diff

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

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

doc: adjust PG 12 relnotes item on float digit adjustment

commit   : b84a801d6a6737e6d84326b77d98b498402ecad0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:31:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:31:02 -0400    

Click here for diff

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

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

doc: fix markup for PG 12 rel notes

commit   : 0fca8285ea533fa669a372c91fdb42265dcf7435    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:19:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:19:43 -0400    

Click here for diff

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

doc: adjustments for PG 12 release notes

commit   : 32fe2e3194c7198ca4afdb6bea4ffa12466612b1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:14:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 21 May 2019 16:14:33 -0400    

Click here for diff

Mostly commit messages, attribution, and text, all suggested by Andres  
Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Make pg_upgrade's test.sh less chatty.

commit   : eb9812f272db8e93416831e5254569b76edf8264    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 May 2019 13:11:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 May 2019 13:11:57 -0400    

Click here for diff

The use of "set -x" to echo a subset of the test's commands might've  
been a good idea during development of this test, but it's been stable  
for long enough now that the extra output isn't very useful.  Also  
our project expectations have been trending towards less output in  
non-error cases; the fact that "set -x" produces output on stderr  
is particularly annoying from that standpoint.  So get rid of it.  
  
Also, pass "-A trust" to initdb explicitly so that it won't issue  
a warning about "trust" being an insecure default.  This matches  
what the TAP tests have done for a long time, and again gets rid  
of some noise on stderr.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Insert temporary debugging output in regression tests.

commit   : f03a9ca4366d064d89b7cf7ed75d4e43f2ed0667    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 May 2019 12:23:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 May 2019 12:23:16 -0400    

Click here for diff

We're seeing occasional instability in the plans generated for  
parallel queries on the "a_star" table hierarchy.  This suggests  
that something is changing the planner's stats for those tables,  
but that should not be happening within a regression test run.  
To try to gather some information about what's happening, insert  
additional queries to check the basic page/tuple counts for these  
tables, as well as whether any vacuums or analyzes have happened  
on them.  (We expect that only the database-wide VACUUM in  
sanity_check.sql will have touched them.)  
  
I added the probes not only in select_parallel.sql itself, but  
also in stats.sql, bearing in mind that the stats collector's  
lag may prevent the initial query from reporting current truth.  
If any extra vacuum/analyze has happened, the recheck in stats.sql  
definitely ought to see it.  
  
This commit can be reverted once we figure out what's going on.  
  
Per suggestion from David Rowley, though I changed the queries around.  
  
Discussion: https://postgr.es/m/CA+hUKG+0CxrKRWRMf5ymN3gm+BECHna2B-q1w8onKBep4HasUw@mail.gmail.com  

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

tableam: Move heap-specific logic from needs_toast_table below tableam.

commit   : 1171d7d58545f26a402f76a05936d572bf29d53b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 21 May 2019 11:57:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 21 May 2019 11:57:13 -0400    

Click here for diff

This allows table AMs to completely suppress TOAST table creation, or  
to modify the conditions under which they are created.  
  
Patch by me.  Reviewed by Andres Freund.  
  
Discussion: http://postgr.es/m/CA+Tgmoa4O2n=yphqD2pERUnYmUO84bH1SqMsA-nSxBGsZ7gWfA@mail.gmail.com  

M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/toasting.c
M src/include/access/tableam.h

Doc: improve description of regexp character classes.

commit   : cf92226e9f7f985a678287167b954a831a3b660c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 May 2019 18:39:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 May 2019 18:39:53 -0400    

Click here for diff

Define the meanings of the POSIX-spec character classes in line,  
rather than referring to the ctype(3) man page.  That man page  
doesn't even exist on many modern systems, and if it does exist  
it probably says the wrong things about non-ASCII characters.  
Also document our non-POSIX-spec "ascii" character class.  
  
Also, point out here that this behavior is controlled by collation or  
LC_CTYPE, since the existing text explaining that is pretty far away.  
  
Per gripe from Geert Lobbestael.  Given the lack of prior complaints,  
I'm not excited about back-patching this.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Stamp 12beta1.

commit   : a240570b1e3802d1e82da08a9d72abeade370249    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 May 2019 16:37:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 May 2019 16:37:22 -0400    

Click here for diff

M configure
M configure.in
M src/include/pg_config.h.win32

Fix regression tests broken in fc7c281f87467.

commit   : 47a14c99e4715dde7f570d050e1ddb6d21278bf8    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 May 2019 09:36:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 May 2019 09:36:06 -0700    

Click here for diff

This shouldn't have been committed without even running the tests (nor  
were the tests added that were suggested). I'm fixing up the results  
to get the buildfarm back to green, it's quite possible we'll want to  
revert this later.  

M src/test/regress/expected/vacuum.out

Fix comment for issue_xlog_fsync().

commit   : b8e2170e40a151eb94079ce9cd791a712ed95342    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 21 May 2019 00:44:00 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 21 May 2019 00:44:00 +0900    

Click here for diff

"segno" is the argument for the function, not "log" and "seg".  
  
Author: Antonin Houska  
Discussion: https://postgr.es/m/[email protected]  

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

Make VACUUM accept 1 and 0 as a boolean value.

commit   : fc7c281f87467c1ff24fd72e0cc313dd6a71873f    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 21 May 2019 00:22:06 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 21 May 2019 00:22:06 +0900    

Click here for diff

Commit 41b54ba78e allowed existing VACUUM options to take a boolean  
argument. It's documented that valid boolean values that VACUUM can  
accept are true, false, on, off, 1, and 0. But previously the parser  
failed to accept 1 and 0 as a boolean value in VACUUM syntax because  
of a lack of NumericOnly clause for vac_analyze_option_arg in gram.y.  
  
This commit adds such NumericOnly clause so that VACUUM options  
can take also 1 and 0 as a boolean value.  
  
Discussion: https://postgr.es/m/CAHGQGwGYg82A8UCQxZe7Zn9MnyUBGdyB=1CNpKF3jBny+RbyfA@mail.gmail.com  

M src/backend/parser/gram.y

Translation updates

commit   : 3c439a58df83ae51f650cfae9878df1f9b70c4b8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 May 2019 16:00:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 May 2019 16:00:53 +0200    

Click here for diff

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

M src/backend/nls.mk
M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
M src/backend/po/it.po
M src/backend/po/ja.po
M src/backend/po/ko.po
M src/backend/po/ru.po
M src/backend/po/sv.po
A src/backend/po/tr.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/sv.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/sv.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_checksums/nls.mk
A src/bin/pg_checksums/po/es.po
A src/bin/pg_checksums/po/sv.po
M src/bin/pg_config/po/cs.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/sv.po
M src/bin/pg_config/po/tr.po
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/it.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
M src/bin/pg_controldata/po/tr.po
M src/bin/pg_ctl/po/cs.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/he.po
M src/bin/pg_ctl/po/it.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
M src/bin/pg_ctl/po/tr.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/sv.po
M src/bin/pg_resetwal/po/de.po
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/sv.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_test_fsync/nls.mk
A src/bin/pg_test_fsync/po/cs.po
M src/bin/pg_test_fsync/po/es.po
M src/bin/pg_test_fsync/po/ru.po
M src/bin/pg_test_fsync/po/tr.po
M src/bin/pg_test_timing/nls.mk
A src/bin/pg_test_timing/po/cs.po
M src/bin/pg_test_timing/po/es.po
M src/bin/pg_upgrade/nls.mk
A src/bin/pg_upgrade/po/cs.po
M src/bin/pg_upgrade/po/de.po
A 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
M src/bin/pg_upgrade/po/tr.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/sv.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/it.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/ru.po
M src/bin/psql/po/sv.po
A src/bin/psql/po/tr.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/sv.po
M src/interfaces/ecpg/ecpglib/po/cs.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/fr.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/ecpglib/po/sv.po
M src/interfaces/ecpg/preproc/po/cs.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/ecpg/preproc/po/it.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
M src/interfaces/ecpg/preproc/po/tr.po
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/he.po
M src/interfaces/libpq/po/it.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
M src/interfaces/libpq/po/tr.po
M src/pl/plperl/po/cs.po
M src/pl/plperl/po/de.po
M src/pl/plperl/po/es.po
M src/pl/plperl/po/fr.po
M src/pl/plperl/po/it.po
M src/pl/plperl/po/ru.po
M src/pl/plperl/po/sv.po
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/it.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
M src/pl/plpgsql/src/po/tr.po
M src/pl/plpython/po/cs.po
M src/pl/plpython/po/de.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/it.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
M src/pl/plpython/po/tr.po
M src/pl/plpython/po/vi.po
M src/pl/tcl/po/cs.po
M src/pl/tcl/po/es.po
M src/pl/tcl/po/fr.po
M src/pl/tcl/po/ru.po
M src/pl/tcl/po/sv.po

Remove bug.template file

commit   : 8bbb8166b63eeebd0cb618ddcf7dcaf8c4ba66f4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 May 2019 08:33:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 May 2019 08:33:31 +0200    

Click here for diff

It's outdated and not really in use anymore.  
  
Discussion: https://www.postgresql.org/message-id/flat/cf7ed2b1-1ebe-83cf-e05e-d5943f67af2d%402ndquadrant.com  

M .gitattributes
D doc/bug.template
M src/tools/version_stamp.pl

Remove outdated comment in copy.c.

commit   : fb504c5e4b5ce71e703006375ee2f5e4b57d89c9    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 19 May 2019 20:47:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 19 May 2019 20:47:54 -0700    

Click here for diff

M src/backend/commands/copy.c

Minimally fix partial aggregation for aggregates that don't have one argument.

commit   : 2657283256f1cab53d09d2c7db1ce9b7065193a0    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 19 May 2019 18:01:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 19 May 2019 18:01:06 -0700    

Click here for diff

For partial aggregation combine steps,  
AggStatePerTrans->numTransInputs was set to the transition function's  
number of inputs, rather than the combine function's number of  
inputs (always 1).  
  
That lead to partial aggregates with strict combine functions to  
wrongly check for NOT NULL input as required by strictness. When the  
aggregate wasn't exactly passed one argument, the strictness check was  
either omitted (in the 0 args case) or too many arguments were  
checked. In the latter case we'd read beyond the end of  
FunctionCallInfoData->args (only in master).  
  
AggStatePerTrans->numTransInputs actually has been wrong since since  
9.6, where partial aggregates were added. But it turns out to not be  
an active problem in 9.6 and 10, because numTransInputs wasn't used at  
all for combine functions: Before c253b722f6 there simply was no NULL  
check for the input to strict trans functions, and after that the  
check was simply hardcoded for the right offset in fcinfo, as it's  
done by code specific to combine functions.  
  
In bf6c614a2f2 (11) the strictness check was generalized, with common  
code doing the strictness checks for both plain and combine transition  
functions, based on numTransInputs. For combine functions this lead to  
not emitting an expression step to check for strict input in the 0  
arguments case, and in the > 1 arguments case, we'd check too many  
arguments.Due to the fact that the relevant fcinfo->isnull[2..] was  
always zero-initialized (more or less by accident, by being part of  
the AggStatePerTrans struct, which is palloc0'ed), there was no  
observable damage in the latter case before a9c35cf85ca1f, we just  
checked too many array elements.  
  
Due to the changes in a9c35cf85ca1f, > 1 argument bug became visible,  
because these days fcinfo is a) dynamically allocated without being  
zeroed b) exactly the length required for the number of specified  
arguments (hardcoded to 2 in this case).  
  
This commit only contains a fairly minimal fix, setting numTransInputs  
to a hardcoded 1 when building a pertrans for a combine function. It  
seems likely that we'll want to clean this up further (e.g. the  
arguments build_pertrans_for_aggref() aren't particularly meaningful  
for combine functions). But the wrap date for 12 beta1 is coming up  
fast, so it seems good to have a minimal fix in place.  
  
Backpatch to 11. While AggStatePerTrans->numTransInputs was set  
wrongly before that, the value was not used for combine functions.  
  
Reported-By: Rajkumar Raghuwanshi  
Diagnosed-By: Kyotaro Horiguchi, Jeevan Chalke, Andres Freund, David Rowley  
Author: David Rowley, Kyotaro Horiguchi, Andres Freund  
Discussion: https://postgr.es/m/CAKcux6=uZEyWyLw0N7HtR9OBc-sWEFeByEZC7t-KDf15FKxVew@mail.gmail.com  

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

Fix some grammar in documentation of spgist and pgbench

commit   : 03310dbea9746439e9f0fdedce0fa298b8c4cc76    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 20 May 2019 09:47:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 20 May 2019 09:47:19 +0900    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Author: Liudmila Mantrova  
Reviewed-by: Jonathan Katz, Tom Lane, Michael Paquier  
Backpatch-through: 9.4  

M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/spgist.sgml

Fix and improve SnapshotType comments.

commit   : 78d6a9cbd3438969ac87b9f1aaf0f07226636ed7    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 19 May 2019 16:17:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 19 May 2019 16:17:18 -0700    

Click here for diff

The comment for SNAPSHOT_SELF was unfortunately explaining  
SNAPSHOT_DIRTY, as reported by Sergei. Also expand a few comments, and  
include a few more comments from heapam_visibility.c, so they're in an  
AM independent place.  
  
Reported-By: Sergei Kornilov  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/utils/snapshot.h

Revert "In the pg_upgrade test suite, don't write to src/test/regress."

commit   : ae35e1c9d74afc3b1e7572ad60781946fdf71e95    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 19 May 2019 15:24:42 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 19 May 2019 15:24:42 -0700    

Click here for diff

This reverts commit bd1592e8570282b1650af6b8eede0016496daecd.  It had  
multiple defects.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/tools/msvc/vcregress.pl

Don't to predicate lock for analyze scans, refactor scan option passing.

commit   : c3b23ae457ddc8b7bfacb3c0569278615a2df2cd    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 19 May 2019 15:10:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 19 May 2019 15:10:28 -0700    

Click here for diff

Before this commit, when ANALYZE was run on a table and serializable  
was used (either by virtue of an explicit BEGIN TRANSACTION ISOLATION  
LEVEL SERIALIZABLE, or default_transaction_isolation being set to  
serializable) a null pointer dereference lead to a crash.  
  
The analyze scan doesn't need a snapshot (nor predicate locking), but  
before this commit a scan only contained information about being a  
bitmap or sample scan.  
  
Refactor the option passing to the scan_begin callback to use a  
bitmask instead. Alternatively we could have added a new boolean  
parameter, but that seems harder to read. Even before this issue  
various people (Heikki, Tom, Robert) suggested doing so.  
  
These changes don't change the scan APIs outside of tableam. The flags  
argument could be exposed, it's not necessary to fix this  
problem. Also the wrapper table_beginscan* functions encapsulate most  
of that complexity.  
  
After these changes fixing the bug is trivial, just don't acquire  
predicate lock for analyze style scans. That was already done for  
bitmap heap scans.  Add an assert that a snapshot is passed when  
acquiring the predicate lock, so this kind of bug doesn't require  
running with serializable.  
  
Also add a comment about sample scans currently requiring predicate  
locking the entire relation, that previously wasn't remarked upon.  
  
Reported-By: Joe Wildish  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/include/access/heapam.h
M src/include/access/relscan.h
M src/include/access/tableam.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

In the pg_upgrade test suite, don't write to src/test/regress.

commit   : bd1592e8570282b1650af6b8eede0016496daecd    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 19 May 2019 14:36:44 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 19 May 2019 14:36:44 -0700    

Click here for diff

When this suite runs installcheck, redirect file creations from  
src/test/regress to src/bin/pg_upgrade/tmp_check/regress.  This closes a  
race condition in "make -j check-world".  If the pg_upgrade suite wrote  
to a given src/test/regress/results file in parallel with the regular  
src/test/regress invocation writing it, a test failed spuriously.  Even  
without parallelism, in "make -k check-world", the suite finishing  
second overwrote the other's regression.diffs.  This revealed test  
"largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too.  
  
Buildfarm client REL_10, released forty-five days ago, supports saving  
regression.diffs from its new location.  When an older client reports a  
pg_upgradeCheck failure, it will no longer include regression.diffs.  
Back-patch to 9.5, where pg_upgrade moved to src/bin.  
  
Reviewed by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/tools/msvc/vcregress.pl

Improve logrotate test so that it meaningfully exercises syslogger.

commit   : 9d5c22d28f8c161aa729d841aeec936c646044d4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 May 2019 13:55:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 May 2019 13:55:39 -0400    

Click here for diff

Discussion of bug #15804 reveals that this test didn't really prove  
that the syslogger child process ever launched successfully, much  
less did anything.  It was only checking that the expected log file  
gets created, and that's done in the postmaster.  Moreover, the  
test assumed it could rename the log file, which is likely to fail  
on Windows (cf. commit d611175e5).  
  
Instead, use the default log file name pattern, which should result  
in a new file name being chosen after 1 second, and verify that  
rotation has occurred by checking for a new file name.  Also add code  
to test that messages actually do propagate through the syslogger.  
  
In theory this version of the test should work on Windows, so  
revert d611175e5.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/t/004_logrotate.pl

Revert "postmaster: Start syslogger earlier".

commit   : 833451552925d0175e1e15128e411ddef9a36996    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 May 2019 11:14:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 May 2019 11:14:23 -0400    

Click here for diff

This commit reverts 57431a911d3a650451d198846ad3194900666152.  
  
While that's still a good idea in the abstract, we found out  
that there are multiple crasher bugs in it on Windows builds,  
making the logging_collector option unusable on Windows.  
There's no time left to fix these issues before 12beta1,  
so revert the patch to allow Windows beta testing to proceed.  
We'll try again at some future date.  
  
Per bug #15804 from Yulian Khodorkovskiy and additional  
investigation by Michael Paquier.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Fix declarations of couple jsonpath functions

commit   : da24961e9e1d887111d17cc2dcece2e3946ca5a6    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 19 May 2019 07:45:42 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 19 May 2019 07:45:42 +0300    

Click here for diff

Make jsonb_path_query_array() and jsonb_path_query_first() use  
PG_FUNCTION_ARGS macro instead of its expansion.  

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

Improve documentation for array subscription in jsonpath

commit   : 87bcc02f4f739d76703feee0ff8346b98fa9b907    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 17 May 2019 05:47:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 17 May 2019 05:47:53 +0300    

Click here for diff

Usage of expressions and multiple ranges in jsonpath array subscription was  
undocumented.  This commit adds lacking documentation.  

M doc/src/sgml/json.sgml

Document jsonpath .** accessor with nesting level filter

commit   : e0e3dad770d3eefc4ee6cd562d9c25b61c263a6e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 17 May 2019 05:16:31 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 17 May 2019 05:16:31 +0300    

Click here for diff

It appears that some variants of .** jsonpath accessor are undocumented.  In  
particular undocumented variants are:  
  
 .**{level}  
 .**{lower_level to upper_level}  
 .**{lower_level to last}  
  
This commit adds missing documentation for them.  

M doc/src/sgml/json.sgml

ANSI-ify a few straggler K&R-style function definitions.

commit   : da71f98efba9aed493a178aa29f25dbca7407eaf    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 May 2019 20:16:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 May 2019 20:16:50 -0400    

Click here for diff

We still had a couple of these left in ancient src/port/ files.  
Convert them to modern style in preparation for switching to  
a version of pg_bsd_indent that doesn't cope well with K&R style.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/crypt.c
M src/port/isinf.c

Make BufFileCreateTemp() ensure that temp tablespaces are set up.

commit   : 93f03dad824f14f40519597e5e4a8fe7b6df858e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 May 2019 13:51:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 May 2019 13:51:16 -0400    

Click here for diff

If PrepareTempTablespaces() has never been called in the current  
transaction, OpenTemporaryFile() will fall back to using the default  
tablespace, which is a bug if the user wanted temp files placed elsewhere.  
gistInitBuildBuffers() appears to have this disease already, and it  
seems like an easy trap for future coders to fall into.  
  
We discussed other ways to close this gap, but none of them are prettier  
or more reliable than just having BufFileCreateTemp do it.  In particular,  
having fd.c do this creates layering issues that we could do without.  
  
Per suggestion from Melanie Plageman.  Arguably this is a bug fix, but  
nobody seems very excited about back-patching, so change in HEAD only.  
  
Discussion: https://postgr.es/m/CAAKRu_YwzjuGAmmaw4-8XO=OVFGR1QhY_Pq-t3wjb9ribBJb_Q@mail.gmail.com  

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

docs: tighten up PG 12 release note item on 1k partitions

commit   : b12db9ff5f09dc60dc05d0e208a5b28728970e55    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2019 09:23:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2019 09:23:29 -0400    

Click here for diff

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

"A void function may not return a value".

commit   : d307954a7d88ed45655d9206bbe1aefc280c09c7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 May 2019 00:40:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 May 2019 00:40:39 -0400    

Click here for diff

Per buildfarm.  

M src/backend/access/table/tableam.c

tableam: Avoid relying on relation size to determine validity of tids.

commit   : 147e3722f7e531f15ba389a4d518efe8cd0bd736    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 May 2019 18:52:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 May 2019 18:52:01 -0700    

Click here for diff

Instead add a tableam callback to do so. To avoid adding per  
validation overhead, pass a scan to tuple_tid_valid. In heap's case  
we'd otherwise incurred a RelationGetNumberOfBlocks() call for each  
tid - which'd have added noticable overhead to nodeTidscan.c.  
  
Author: Andres Freund  
Reviewed-By: Ashwin Agrawal  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/executor/nodeTidscan.c
M src/backend/utils/adt/tid.c
M src/include/access/heapam.h
M src/include/access/tableam.h

tableam: Don't assume that every AM uses md.c style storage.

commit   : 7f44ede5941499c4cee13b812dd93335f4005095    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 May 2019 18:06:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 May 2019 18:06:18 -0700    

Click here for diff

Previously various parts of the code routed size requests through  
RelationGetNumberOfBlocks[InFork]. That works if md.c is used by the  
AM, but not otherwise.  
  
Add a tableam callback to return the size of the table. As not every  
AM will use postgres' BLCKSZ, have it return bytes, and have  
RelationGetNumberOfBlocksInFork() round the byte size up into blocks.  
  
To allow code outside of the AM to determine the actual relation size  
map InvalidForkNumber the total size of a relation, as not every AM  
might just need the postgres defined forks.  
  
A few users of RelationGetNumberOfBlocks() ought to be converted away  
from that. One case, the use of it to determine whether a tid is  
valid, will be fixed in a follow up commit. Others will have to wait  
for v13.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/storage/buffer/bufmgr.c
M src/include/access/tableam.h

Restructure creation of run-time pruning steps.

commit   : 6630ccad7a25cad32e2d1a6833fb971602cb67fe    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 May 2019 19:44:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 May 2019 19:44:19 -0400    

Click here for diff

Previously, gen_partprune_steps() always built executor pruning steps  
using all suitable clauses, including those containing PARAM_EXEC  
Params.  This meant that the pruning steps were only completely safe  
for executor run-time (scan start) pruning.  To prune at executor  
startup, we had to ignore the steps involving exec Params.  But this  
doesn't really work in general, since there may be logic changes  
needed as well --- for example, pruning according to the last operator's  
btree strategy is the wrong thing if we're not applying that operator.  
The rules embodied in gen_partprune_steps() and its minions are  
sufficiently complicated that tracking their incremental effects in  
other logic seems quite impractical.  
  
Short of a complete redesign, the only safe fix seems to be to run  
gen_partprune_steps() twice, once to create executor startup pruning  
steps and then again for run-time pruning steps.  We can save a few  
cycles however by noting during the first scan whether we rejected  
any clauses because they involved exec Params --- if not, we don't  
need to do the second scan.  
  
In support of this, refactor the internal APIs in partprune.c to make  
more use of passing information in the GeneratePruningStepsContext  
struct, rather than as separate arguments.  
  
This is, I hope, the last piece of our response to a bug report from  
Alan Jackson.  Back-patch to v11 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/nodes/plannodes.h
M src/include/partitioning/partprune.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

docs: split out sort-skip partition item in PG 12 release notes

commit   : 05685897f07e7ae5684f0247157faad1f782f889    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 17 May 2019 11:31:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 17 May 2019 11:31:49 -0400    

Click here for diff

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

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

Fix regression test outputs

commit   : 6ba500cae6f57acf8f392d9e1671640f7c9d43b3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 May 2019 09:40:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 May 2019 09:40:02 +0900    

Click here for diff

75445c1 has caused various failures in tests across the tree after  
updating some error messages, so fix the newly-expected output.  
  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/regex.out
M src/test/regress/expected/strings.out
M src/test/regress/expected/subscription.out
M src/test/regress/output/copy.source

Fix typos in documentatoin of GSSAPI encryption

commit   : 41998f90ce66425ca6071ac5e170a19bb1498414    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 May 2019 08:22:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 May 2019 08:22:28 +0900    

Click here for diff

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

M doc/src/sgml/protocol.sgml
M doc/src/sgml/runtime.sgml

More message style fixes

commit   : 75445c1515fffa581585f1b72e5b5314c1c395ce    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 May 2019 18:50:56 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 May 2019 18:50:56 -0400    

Click here for diff

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

M src/backend/commands/copy.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/analyze.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/walsender.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/regexp.c

Remove extra nbtree half-dead internal page check.

commit   : 3f58cc6dd8fc821992da7ed8099d283b014fc2dc    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 16 May 2019 15:11:58 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 16 May 2019 15:11:58 -0700    

Click here for diff

It's not safe for nbtree VACUUM to attempt to delete a target page whose  
right sibling is already half-dead, since that would fail the  
cross-check when VACUUM attempts to re-find a downlink to the right  
sibling in the parent page.  Logic to prevent this from happening was  
added by commit 8da31837803, which addressed a bug in the overhaul of  
page deletion that went into PostgreSQL 9.4 (commit efada2b8e92).  
VACUUM was made to check the right sibling page, and back off when it  
happened to be half-dead already.  
  
However, it is only truly necessary to do the right sibling check on the  
leaf level, since that transitively determines if the deletion target's  
parent's right sibling page is itself undergoing deletion.  Remove the  
internal page level check, and add a comment explaining why the leaf  
level check alone suffices.  
  
The extra check is also unnecessary due to the fact that internal pages  
that are marked half-dead are generally considered corrupt.  Commit  
efada2b8e92 established the principle that there should never be  
half-dead internal pages (internal pages pending deletion are possible,  
but that status is never directly represented in the internal page).  
VACUUM will complain about corruption when it encounters half-dead  
internal pages, so VACUUM is bound to raise an error one way or another  
when an nbtree index has a half-dead internal page (contrib/amcheck will  
also report that the page is corrupt).  
  
It's possible that a pg_upgrade'd 9.3 database will still have half-dead  
internal pages, so it may seem like there is an argument for leaving the  
check in place to reliably get a cleaner error message that advises the  
user to REINDEX.  However, leaf pages are also deleted in the first  
phase of deletion prior to PostgreSQL 9.4, so I believe we won't even  
attempt to re-find the parent page anyway (we won't have the fully  
deleted leaf page as the right sibling of our target page, so we won't  
even try to find a downlink for it).  
  
Discussion: https://postgr.es/m/CAH2-Wzm_ntmqJjWLRyKzimFmFvk+BnVAvUpaA4s1h9Ja58woaQ@mail.gmail.com  

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

Fix bogus logic for combining range-partitioned columns during pruning.

commit   : 3922f10646fc79264228ea3f6a7343cc3f8f528a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 May 2019 16:25:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 May 2019 16:25:43 -0400    

Click here for diff

gen_prune_steps_from_opexps's notion of how to do this was overly  
complicated and underly correct.  
  
Per discussion of a report from Alan Jackson (though this fixes only one  
aspect of that problem).  Back-patch to v11 where this code came in.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix partition pruning to treat stable comparison operators properly.

commit   : 4b1fcb43d070ba8b34ea01d5a657630d76e4b33f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 May 2019 11:58:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 May 2019 11:58:21 -0400    

Click here for diff

Cross-type comparison operators in a btree or hash opclass might be  
only stable not immutable (this is true of timestamp vs. timestamptz  
for example).  partprune.c ignored this possibility and would perform  
plan-time pruning with them anyway, possibly leading to wrong answers  
if the environment changed between planning and execution.  
  
To fix, teach gen_partprune_steps() to do things differently when  
creating plan-time pruning steps vs. run-time pruning steps.  
analyze_partkey_exprs() also needs an extra check, which is rather  
annoying but now is not the time to restructure things enough to  
avoid that.  
  
While at it, simplify the logic for the plan-time case a little  
by insisting that the comparison value be a Const and nothing else.  
This relies on the assumption that eval_const_expressions will have  
reduced any immutable expression to a Const; which is not quite  
100% true, but certainly any case that comes up often enough to be  
interesting should have simplification logic there.  
  
Also improve a bunch of inadequate/obsolete/wrong comments.  
  
Per discussion of a report from Alan Jackson (though this fixes only one  
aspect of that problem).  Back-patch to v11 where this code came in.  
  
David Rowley, with some further hacking by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove obsolete nbtree insertion comment.

commit   : 489e431ba56b10f5736fb54a045ca40880f11bbc    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 15 May 2019 16:53:11 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 15 May 2019 16:53:11 -0700    

Click here for diff

Remove a Berkeley-era comment above _bt_insertonpg() that admonishes the  
reader to grok Lehman and Yao's paper before making any changes.  This  
made a certain amount of sense back when _bt_insertonpg() was  
responsible for most of the things that are now spread across  
_bt_insertonpg(), _bt_findinsertloc(), _bt_insert_parent(), and  
_bt_split(), but it doesn't work like that anymore.  
  
I believe that this comment alludes to the need to "couple" or "crab"  
buffer locks as we ascend the tree as page splits cascade upwards.  The  
nbtree README already explains this in detail, which seems sufficient.  
Besides, the changes to page splits made by commit 40dae7ec537 altered  
the exact details of how buffer locks are retained during splits; Lehman  
and Yao's original algorithm seems to release the lock on the left child  
page/buffer slightly earlier than _bt_insertonpg()/_bt_insert_parent()  
can.  

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

Remove no-longer-used typedef.

commit   : 8a0f0ad54047c8dc1430e521e2dc90f2cd138a9d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 May 2019 17:26:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 May 2019 17:26:52 -0400    

Click here for diff

struct ClonedConstraint is no longer needed, so delete it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/pg_constraint.h

Reverse order of newitem nbtree candidate splits.

commit   : 7505da2f459776a397177f7d591991f5591c2812    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 15 May 2019 12:22:07 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 15 May 2019 12:22:07 -0700    

Click here for diff

Commit fab25024, which taught nbtree to choose candidate split points  
more carefully, had _bt_findsplitloc() record all possible split points  
in an initial pass over a page that is about to be split.  The order  
that candidate split points were processed and stored in was assumed to  
match the offset number order of split points on an imaginary version of  
the page that contains the same items as the original, but also fits  
newitem (the item that provoked the split precisely because it didn't  
fit).  
  
However, the order of split points in the final array was not quite what  
was expected: the split point that makes newitem the firstright item  
came after the split point that makes newitem the lastleft item -- not  
before.  As a result, _bt_findsplitloc() could get confused about the  
leftmost and rightmost tuples among all possible split points recorded  
for the page.  This seems to have no appreciable impact on the quality  
of the final split point chosen by _bt_findsplitloc(), but it's still  
wrong.  
  
To fix, switch the order in which newitem candidate splits are recorded  
in.  This also makes it possible to describe candidate split points in  
terms of which pair of adjoining tuples enclose the split point within  
_bt_findsplitloc(), making it clearer why it's generally safe for  
_bt_split() to expect lastleft and firstright tuples.  

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

docs: properly indent PG 12 release notes

commit   : a429164ef31fc6899cef4d5e4f3f2ce8fc33aa27    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 15 May 2019 12:44:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 15 May 2019 12:44:59 -0400    

Click here for diff

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

Handle table_complete_speculative's succeeded argument as documented.

commit   : aa4b8c61d2cd57b53be03defb04d59b232a0e150    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 14 May 2019 12:11:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 14 May 2019 12:11:26 -0700    

Click here for diff

For some reason both callsite and the implementation for heapam had  
the meaning inverted (i.e. succeeded == true was passed in case of  
conflict). That's confusing.  
  
I (Andres) briefly pondered whether it'd be better to rename  
table_complete_speculative's argument to 'bool specConflict' or such,  
but decided not to. The 'complete' in the function name for me makes  
`succeeded` sound a bit better.  
  
Reported-By: Ashwin Agrawal, Melanie Plageman, Heikki Linnakangas  
Discussion:  
   https://postgr.es/m/CALfoeitk7-TACwYv3hCw45FNPjkA86RfXg4iQ5kAOPhR+F1Y4w@mail.gmail.com  
   https://postgr.es/m/[email protected]  

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

Add isolation test for INSERT ON CONFLICT speculative insertion failure.

commit   : 08e2edc0767ab6e619970f165cb34d4673105f23    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 14 May 2019 11:45:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 14 May 2019 11:45:40 -0700    

Click here for diff

This path previously was not reliably covered. There was some  
heuristic coverage via insert-conflict-toast.spec, but that test is  
not deterministic, and only tested for a somewhat specific bug.  
  
Backpatch, as this is a complicated and otherwise untested code  
path. Unfortunately 9.5 cannot handle two waiting sessions, and thus  
cannot execute this test.  
  
Triggered by a conversion with Melanie Plageman.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/CAAKRu_a7hbyrk=wveHYhr4LbcRnRCG=yPUVoQYB9YO1CdUBE9Q@mail.gmail.com  
Backpatch: 9.5-  

A src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-specconflict.spec

Fix "make clean" to clean out junk files left behind after ssl tests.

commit   : 6d2fba3189608186d1a196a595f21760412ec5e8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 14:28:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 14:28:33 -0400    

Click here for diff

We .gitignore'd this junk, but we didn't actually remove it.  

M src/test/ssl/Makefile

Move logging.h and logging.c from src/fe_utils/ to src/common/.

commit   : fc9a62af3f87f4bec1e8c904ea99ae50f3c881ef    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 14:19:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 14:19:49 -0400    

Click here for diff

The original placement of this module in src/fe_utils/ is ill-considered,  
because several src/common/ modules have dependencies on it, meaning that  
libpgcommon and libpgfeutils now have mutual dependencies.  That makes it  
pointless to have distinct libraries at all.  The intended design is that  
libpgcommon is lower-level than libpgfeutils, so only dependencies from  
the latter to the former are acceptable.  
  
We already have the precedent that fe_memutils and a couple of other  
modules in src/common/ are frontend-only, so it's not stretching anything  
out of whack to treat logging.c as a frontend-only module in src/common/.  
To the extent that such modules help provide a common frontend/backend  
environment for the rest of common/ to use, it's a reasonable design.  
(logging.c does not yet provide an ereport() emulation, but one can  
dream.)  
  
Hence, move these files over, and revert basically all of the build-system  
changes made by commit cc8d41511.  There are no places that need to grow  
new dependencies on libpgcommon, further reinforcing the idea that this  
is the right solution.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/Makefile
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_test_fsync/Makefile
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_waldump/Makefile
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/copy.c
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/bin/psql/input.c
M src/bin/psql/large_obj.c
M src/bin/psql/mainloop.c
M src/bin/psql/psqlscanslash.l
M src/bin/psql/startup.c
M src/bin/psql/variables.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/Makefile
M src/common/controldata_utils.c
M src/common/file_utils.c
R092 src/fe_utils/logging.c src/common/logging.c
M src/common/pgfnames.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/fe_utils/Makefile
M src/fe_utils/psqlscan.l
R092 src/include/fe_utils/logging.h src/include/common/logging.h
M src/interfaces/ecpg/test/Makefile
M src/nls-global.mk
M src/test/isolation/Makefile
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/tools/msvc/Mkvcbuild.pm

docs: Indent listitem tags in PG 12 release notes

commit   : b71dad22ce8a645a47c01e544f640f35b91bfbd3    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2019 13:32:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2019 13:32:03 -0400    

Click here for diff

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

Remove pg_rewind's private logging.h/logging.c files.

commit   : 53ddefbaf8a0493d2c1fa0b18bfaba72da556985    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 13:11:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 13:11:23 -0400    

Click here for diff

The existence of these files became rather confusing with the  
introduction of a widely-known logging.h header in commit cc8d41511.  
(Indeed, there's already some duplicative #includes here, perhaps  
betraying such confusion.)  The only thing left in them, after that  
commit, is a progress-reporting function that's neither general-purpose  
nor tied in any way to other logging infrastructure.  Hence, let's just  
move that function to pg_rewind.c, and get rid of the separate files.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
D src/bin/pg_rewind/logging.c
D src/bin/pg_rewind/logging.h
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/timeline.c

Fix SQL-style substring() to have spec-compliant greediness behavior.

commit   : 7c850320d8cfa5503ecec61c2559661b924f7595    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 11:27:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 11:27:31 -0400    

Click here for diff

SQL's regular-expression substring() function is defined to have a  
pattern argument that's separated into three subpatterns by escape-  
double-quote markers; the function result is the part of the input  
matching the second subpattern.  The standard makes it clear that  
if there is ambiguity about how to match the input to the subpatterns,  
the first and third subpatterns should be taken to match the smallest  
possible amount of text (i.e., they're "non greedy", in the terms of  
our regex code).  We were not doing it that way: the first subpattern  
would eat the largest possible amount of text, causing the function  
result to be shorter than what the spec requires.  
  
Fix that by attaching explicit greediness quantifiers to the  
subpatterns.  (This depends on the regex fix in commit 8a29ed053;  
before that, this didn't reliably change the regex engine's behavior.)  
  
Also, by adding parentheses around each subpattern, we ensure that  
"|" (OR) in the subpatterns behave sanely.  Previously, "|" in the  
first or third subpatterns didn't work.  
  
This patch also makes the function throw error if you write more than  
two escape-double-quote markers, and do something sane if you write  
just one, and document that behavior.  Previously, an odd number of  
markers led to a confusing complaint about unbalanced parentheses,  
while extra pairs of markers were just ignored.  (Note that the spec  
requires exactly two markers, but we've historically allowed there  
to be none, and this patch preserves the old behavior for that case.)  
  
In passing, adjust some substring() test cases that didn't really  
prove what they said they were testing for: they used patterns  
that didn't match the data string, so that the output would be  
NULL whether or not the function was really strict.  
  
Although this is certainly a bug fix, changing the behavior in back  
branches seems undesirable: applications could perhaps be depending on  
the old behavior, since it's not obviously wrong unless you read the  
spec very closely.  Hence, no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/regexp.c
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

In bootstrap mode, use default signal handling for SIGINT etc.

commit   : fb489e4b3195fc33cccc0fd308e5a0ab502cf199    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 10:22:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2019 10:22:28 -0400    

Click here for diff

Previously, the code pointed the standard process-termination signals  
to postgres.c's die().  That would typically result in an attempt to  
execute a transaction abort, which is not possible in bootstrap mode,  
leading to PANIC.  This choice seems to be a leftover from an old code  
structure in which the same signal-assignment code was used for many  
sorts of auxiliary processes, including interactive standalone  
backends.  It's not very sensible for bootstrap mode, which has no  
interest in either interactivity or continuing after an error.  We can  
get better behavior with less effort by just letting normal process  
termination happen, after which the parent initdb process will clean up.  
  
This is basically cosmetic in any case, since initdb will react the  
same way whether bootstrap dies on a signal or abort().  Given the  
lack of previous complaints, I don't feel a need to back-patch,  
even though the behavior is old.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c

Update SQL features/conformance information to SQL:2016

commit   : 037165ca95d854e04c0c28cfa85f1515bd852892    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2019 14:56:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2019 14:56:58 +0200    

Click here for diff

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

Update information_schema for SQL:2016

commit   : eb3a1376c98a1d220354b468f4b09e4a1dca909a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2019 15:15:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2019 15:15:05 +0200    

Click here for diff

This is mainly a light renumbering to match the sections in the  
standard.  

M src/backend/catalog/information_schema.sql

Update SQL keywords list to SQL:2016

commit   : c29ba98189190288c2251c6073c13c6234479e5c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2019 09:56:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2019 09:56:40 +0200    

Click here for diff

Per previous convention (see  
ace397e9d24eddc56e7dffa921f506117b602d78), drop SQL:2008 and only keep  
the latest two standards and SQL-92.  
  
Note: SQL:2016-2 lists a large number of non-reserved keywords that  
are really just information_schema column names related to new  
features.  Those kinds of thing have not previously been listed as  
keywords, and this was apparently done here by mistake, since these  
keywords have been removed again in post-2016 working drafts.  So in  
order to avoid bloating the keywords table unnecessarily, I have  
omitted these erroneous keywords here.  

M doc/src/sgml/generate-keywords-table.pl
R090 doc/src/sgml/keywords/sql2008-02-nonreserved.txt doc/src/sgml/keywords/sql2016-02-nonreserved.txt
R082 doc/src/sgml/keywords/sql2008-02-reserved.txt doc/src/sgml/keywords/sql2016-02-reserved.txt
R100 doc/src/sgml/keywords/sql2008-09-nonreserved.txt doc/src/sgml/keywords/sql2016-09-nonreserved.txt
R100 doc/src/sgml/keywords/sql2008-09-reserved.txt doc/src/sgml/keywords/sql2016-09-reserved.txt
R093 doc/src/sgml/keywords/sql2008-14-nonreserved.txt doc/src/sgml/keywords/sql2016-14-nonreserved.txt
R100 doc/src/sgml/keywords/sql2008-14-reserved.txt doc/src/sgml/keywords/sql2016-14-reserved.txt

docs: update partition item in PG 12 release notes

commit   : 356c83795aaa39cfd9bca588bfe4f0196710962e    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2019 09:17:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2019 09:17:08 -0400    

Click here for diff

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

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

docs: fix duplicate wording in PG 12 release notes

commit   : 34d40becfa7a5c7343d0079f181597d7e06122e1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2019 09:06:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2019 09:06:03 -0400    

Click here for diff

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

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

Detect internal GiST page splits correctly during index build.

commit   : 22251686f07f70527aecda22ab5402986884f6f5    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 May 2019 13:18:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 May 2019 13:18:44 +0300    

Click here for diff

As we descend the GiST tree during insertion, we modify any downlinks on  
the way down to include the new tuple we're about to insert (if they don't  
cover it already). Modifying an existing downlink might cause an internal  
page to split, if the new downlink tuple is larger than the old one. If  
that happens, we need to back up to the parent and re-choose a page to  
insert to. We used to detect that situation, thanks to the NSN-LSN  
interlock normally used to detect concurrent page splits, but that got  
broken by commit 9155580fd5. With that commit, we now use a dummy constant  
LSN value for every page during index build, so the LSN-NSN interlock no  
longer works. I thought that was OK because there can't be any other  
backends modifying the index during index build, but missed that the  
insertion itself can modify the page we're inserting to. The consequence  
was that we would sometimes insert the new tuple to an incorrect page, one  
whose downlink doesn't cover the new tuple.  
  
To fix, add a flag to the stack that keeps track of the state while  
descending tree, to indicate that a page was split, and that we need to  
retry the descend from the parent.  
  
Thomas Munro first reported that the contrib/intarray regression test was  
failing occasionally on the buildfarm after commit 9155580fd5. The failure  
was intermittent, because the gistchoose() function is not deterministic,  
and would only occasionally create the right circumstances for this bug to  
cause the failure.  
  
Patch by Anastasia Lubennikova, with some changes by me to make it work  
correctly also when the internal page split also causes the "grandparent"  
to be split.  
  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGJRzLo7tZExWfSbwM3XuK7aAK7FhdBV0FLkbUG%2BW0v0zg%40mail.gmail.com  

M src/backend/access/gist/gist.c
M src/include/access/gist_private.h

Fix comment on when HOT update is possible.

commit   : e95d550bbbe21f51d329fbae84cbac3545a9e650    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 14 May 2019 13:06:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 14 May 2019 13:06:28 +0300    

Click here for diff

The conditions listed in this comment have changed several times, and at  
some point the thing that the "if so" referred to was negated.  
  
The text was OK up to 9.6. It was differently wrong in v10, v11 and  
master, so fix in all those versions.  

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

Fix typo.

commit   : 7d9eca59cf958eb8c8ff47c40003392681a9ce68    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 14 May 2019 16:05:37 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 14 May 2019 16:05:37 +0900    

Click here for diff

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

doc: Update OID item in PG 12 release notes

commit   : 0b62f0f2552d895301fdae56aa839c1eaae24a3a    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2019 22:55:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2019 22:55:38 -0400    

Click here for diff

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

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

doc: improve wording of PG 12 releaase note partition item

commit   : f4125278e3c92d8cdd83c77d0b54f468ee81c750    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2019 22:38:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2019 22:38:50 -0400    

Click here for diff

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

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

doc: properly attibute PG 12 pgbench release note item

commit   : 5d971565a7993ba8dcd06d34d1387af48fdbd034    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2019 22:21:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2019 22:21:32 -0400    

Click here for diff

Reported-by: Fabien COELHO  
  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1905130839140.13487@lancre  

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

Fix duplicated words in comments

commit   : 7e19929ea29668f3d01280262e407b93042c959a    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 14 May 2019 09:37:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 14 May 2019 09:37:35 +0900    

Click here for diff

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

M src/backend/executor/execExpr.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/c.h
M src/include/jit/llvmjit_emit.h
M src/include/nodes/execnodes.h
M src/include/replication/logical.h

Standardize ItemIdData terminology.

commit   : ae7291acbc5ae4c3751615177fc256f9f3399403    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 13 May 2019 15:53:39 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 13 May 2019 15:53:39 -0700    

Click here for diff

The term "item pointer" should not be used to refer to ItemIdData  
variables, since that is needlessly ambiguous.  Only  
ItemPointerData/ItemPointer variables should be called item pointers.  
  
To fix, establish the convention that ItemIdData variables should always  
be referred to either as "item identifiers" or "line pointers".  The  
term "item identifier" already predominates in docs and translatable  
messages, and so should be the preferred alternative there.  
  
Discussion: https://postgr.es/m/CAH2-Wz=c=MZQjUzde3o9+2PLAPuHTpVZPPdYxN=E4ndQ2--8ew@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/heap/README.HOT
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/storage/page/bufpage.c
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/storage/bufpage.h
M src/include/storage/itemid.h

Doc: Refer to line pointers as item identifiers.

commit   : 08ca9d7feca890e97f77ef1fde02d7542a54ac5e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 13 May 2019 15:39:06 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 13 May 2019 15:39:06 -0700    

Click here for diff

An upcoming HEAD-only patch will standardize the terminology around  
ItemIdData variables/line pointers, ending the practice of referring to  
them as "item pointers".  Make the "Database Page Layout" docs  
consistent with the new policy.  The term "item identifier" is already  
used in the same section, so stick with that.  
  
Discussion: https://postgr.es/m/CAH2-Wz=c=MZQjUzde3o9+2PLAPuHTpVZPPdYxN=E4ndQ2--8ew@mail.gmail.com  
Backpatch: All supported branches.  

M doc/src/sgml/storage.sgml

Fix logical replication's ideas about which type OIDs are built-in.

commit   : 32ebb35128c3d16b64039f6d6774afd96a3d91b9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 May 2019 17:23:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 May 2019 17:23:00 -0400    

Click here for diff

Only hand-assigned type OIDs should be presumed to match across different  
PG servers; those assigned during genbki.pl or during initdb are likely  
to change due to addition or removal of unrelated objects.  
  
This means that the cutoff should be FirstGenbkiObjectId (in HEAD)  
or FirstBootstrapObjectId (before that), not FirstNormalObjectId.  
Compare postgres_fdw's is_builtin() test.  
  
It's likely that this error has no observable consequence in a  
normally-functioning system, since ATM the only affected type OIDs are  
system catalog rowtypes and information_schema types, which would not  
typically be interesting for logical replication.  But you could  
probably break it if you tried hard, so back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve commentary about hack in is_publishable_class().

commit   : e34ee993fbc38c8538f9342c5961e5f61fd45180    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 May 2019 17:05:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 May 2019 17:05:48 -0400    

Click here for diff

The FirstNormalObjectId test here is a kluge that needs to go away,  
but the only substitute we can think of is to add a column to pg_class,  
which will take more work than can be handled right now.  Add some  
commentary in the meanwhile.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_publication.c

Don't leave behind junk nbtree pages during split.

commit   : 9b42e713761a43e9ade3965285f077e2ba25bbb7    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 13 May 2019 10:27:59 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 13 May 2019 10:27:59 -0700    

Click here for diff

Commit 8fa30f906be reduced the elevel of a number of "can't happen"  
_bt_split() errors from PANIC to ERROR.  At the same time, the new right  
page buffer for the split could continue to be acquired well before the  
critical section.  This was possible because it was relatively  
straightforward to make sure that _bt_split() could not throw an error,  
with a few specific exceptions.  The exceptional cases were safe because  
they involved specific, well understood errors, making it possible to  
consistently zero the right page before actually raising an error using  
elog().  There was no danger of leaving around a junk page, provided  
_bt_split() stuck to this coding rule.  
  
Commit 8224de4f, which introduced INCLUDE indexes, added code to make  
_bt_split() truncate away non-key attributes.  This happened at a point  
that broke the rule around zeroing the right page in _bt_split().  If  
truncation failed (perhaps due to palloc() failure), that would result  
in an errant right page buffer with junk contents.  This could confuse  
VACUUM when it attempted to delete the page, and should be avoided on  
general principle.  
  
To fix, reorganize _bt_split() so that truncation occurs before the new  
right page buffer is even acquired.  A junk page/buffer will not be left  
behind if _bt_nonkey_truncate()/_bt_truncate() raise an error.  
  
Discussion: https://postgr.es/m/CAH2-WzkcWT_-NH7EeL=Az4efg0KCV+wArygW8zKB=+HoP=VWMw@mail.gmail.com  
Backpatch: 11-, where INCLUDE indexes were introduced.  

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

Improve comment for att_isnull.

commit   : 221b377f09a30dd7c74c26c8c1db439afcc59141    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 13 May 2019 13:13:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 13 May 2019 13:13:24 -0400    

Click here for diff

The comment implies that a 1 in the null bitmap indicates a null value,  
but actually a 0 in the null bitmap indicates a null value. Try to  
be more clear.  
  
Patch by me; proposed wording reviewed by Alvaro Herrera and Tom Lane.  
  
Discussion: http://postgr.es/m/CA+TgmobHOP8r6cG+UnsDFMrS30-m=jRrCBhgw-nFkn0k9QnFsg@mail.gmail.com  

M src/include/access/tupmacs.h

Fix misuse of an integer as a bool.

commit   : ddf927fb13471bec0cc76794eaf552df8a1178fb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 May 2019 10:53:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 May 2019 10:53:19 -0400    

Click here for diff

pgtls_read_pending is declared to return bool, but what the underlying  
SSL_pending function returns is a count of available bytes.  
  
This is actually somewhat harmless if we're using C99 bools, but in  
the back branches it's a live bug: if the available-bytes count happened  
to be a multiple of 256, it would get converted to a zero char value.  
On machines where char is signed, counts of 128 and up could misbehave  
as well.  The net effect is that when using SSL, libpq might block  
waiting for data even though some has already been received.  
  
Broken by careless refactoring in commit 4e86f1b16, so back-patch  
to 9.5 where that came in.  
  
Per bug #15802 from David Binderman.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-secure-openssl.c

postgres_fdw: Fix typo in comment.

commit   : cc866941ad4583f07e5637c145f6f6ee8a573e11    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 13 May 2019 17:30:35 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 13 May 2019 17:30:35 +0900    

Click here for diff

M contrib/postgres_fdw/postgres_fdw.c

doc: PG 12 release notes: normalize attribution names

commit   : f86b0c3c465319b80d71db7d7a9de636950e104a    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 12 May 2019 23:54:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 12 May 2019 23:54:02 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f-ktEhmQ2zJQ1L1niuJ9KB8WPA-bE-AhGiFsSO6QASB_w@mail.gmail.com  

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

doc: adjust PG 12 release note sections

commit   : a6927996be59ac329d65d41cf058d0b1b0978eeb    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 12 May 2019 23:41:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 12 May 2019 23:41:53 -0400    

Click here for diff

Tighten section designations.  

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

docs: fix typo in mention of MSVC

commit   : fefb6a75386b72a40f697523953eafc7cb1c7a5b    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 12 May 2019 23:24:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 12 May 2019 23:24:43 -0400    

Click here for diff

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

Fix incorrect return value in JSON equality function for scalars

commit   : 1171dbde2daef8f0dcd1dc1e54531a0d8dd34d88    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 May 2019 09:11:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 May 2019 09:11:50 +0900    

Click here for diff

equalsJsonbScalarValue() uses a boolean as return type, however for one  
code path -1 gets returned, which is confusing.  The origin of the  
confusion is visibly that this code got copy-pasted from  
compareJsonbScalarValue() since it has been introduced in d1d50bf.  
  
No backpatch, as this is only cosmetic.  
  
Author: Rikard Falkeborn  
Discussion: https://postgr.es/m/CADRDgG7mJnek6HNW13f+LF6V=6gag9PM+P7H5dnyWZAv49aBGg@mail.gmail.com  

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

Fix misoptimization of "{1,1}" quantifiers in regular expressions.

commit   : 8a29ed05302ea18b4be177c2d1181b43706af45f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 May 2019 18:53:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 May 2019 18:53:12 -0400    

Click here for diff

A bounded quantifier with m = n = 1 might be thought a no-op.  But  
according to our documentation (which traces back to Henry Spencer's  
original man page) it still imposes greediness, or non-greediness in the  
case of the non-greedy variant "{1,1}?", on whatever it's attached to.  
  
This turns out not to work though, because parseqatom() optimizes away  
the m = n = 1 case without regard for whether it's supposed to change  
the greediness of the argument RE.  
  
We can fix this by just not applying the optimization when the greediness  
needs to change; the subsequent general cases handle it fine.  
  
The three cases in which we can still apply the optimization are  
(a) no quantifier, or quantifier does not impose a preference;  
(b) atom has no greediness property, implying it cannot match a  
variable amount of text anyway; or  
(c) quantifier's greediness is same as atom's.  
Note that in most cases where one of these applies, we'd have exited  
earlier in the "not a messy case" fast path.  I think it's now only  
possible to get to the optimization when the atom involves capturing  
parentheses or a non-top-level backref.  
  
Back-patch to all supported branches.  I'd ordinarily be hesitant to  
put a subtle behavioral change into back branches, but in this case  
it's very hard to see a reason why somebody would write "{1,1}?" unless  
they're trying to get the documented change-of-greediness behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fail pgwin32_message_to_UTF16() for SQL_ASCII messages.

commit   : d02768ddd1791bab742cf131de726d0a36b3f337    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 12 May 2019 10:33:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 12 May 2019 10:33:05 -0700    

Click here for diff

The function had been interpreting SQL_ASCII messages as UTF8, throwing  
an error when they were invalid UTF8.  The new behavior is consistent  
with pg_do_encoding_conversion().  This affects LOG_DESTINATION_STDERR  
and LOG_DESTINATION_EVENTLOG, which will send untranslated bytes to  
write() and ReportEventA().  On buildfarm member bowerbird, enabling  
log_connections caused an error whenever the role name was not valid  
UTF8.  Back-patch to 9.4 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mb/mbutils.c
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/scripts/t/200_connstr.pl

Rearrange pgstat_bestart() to avoid failures within its critical section.

commit   : 85ccb6899c6c8639bb3e5962ea3bcce5d886e613    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 May 2019 21:27:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 May 2019 21:27:13 -0400    

Click here for diff

We long ago decided to design the shared PgBackendStatus data structure to  
minimize the cost of writing status updates, which means that writers just  
have to increment the st_changecount field twice.  That isn't hooked into  
any sort of resource management mechanism, which means that if something  
were to throw error between the two increments, the st_changecount field  
would be left odd indefinitely.  That would cause readers to lock up.  
Now, since it's also a bad idea to leave the field odd for longer than  
absolutely necessary (because readers will spin while we have it set),  
the expectation was that we'd treat these segments like spinlock critical  
sections, with only short, more or less straight-line, code in them.  
  
That was fine as originally designed, but commit 9029f4b37 broke it  
by inserting a significant amount of non-straight-line code into  
pgstat_bestart(), code that is very capable of throwing errors, not to  
mention taking a significant amount of time during which readers will spin.  
We have a report from Neeraj Kumar of readers actually locking up, which  
I suspect was due to an encoding conversion error in X509_NAME_to_cstring,  
though conceivably it was just a garden-variety OOM failure.  
  
Subsequent commits have loaded even more dubious code into pgstat_bestart's  
critical section (and commit fc70a4b0d deserves some kind of booby prize  
for managing to miss the critical section entirely, although the negative  
consequences seem minimal given that the PgBackendStatus entry should be  
seen by readers as inactive at that point).  
  
The right way to fix this mess seems to be to compute all these values  
into a local copy of the process' PgBackendStatus struct, and then just  
copy the data back within the critical section proper.  This plan can't  
be implemented completely cleanly because of the struct's heavy reliance  
on out-of-line strings, which we must initialize separately within the  
critical section.  But still, the critical section is far smaller and  
safer than it was before.  
  
In hopes of forestalling future errors of the same ilk, rename the  
macros for st_changecount management to make it more apparent that  
the writer-side macros create a critical section.  And to prevent  
the worst consequences if we nonetheless manage to mess it up anyway,  
adjust those macros so that they really are a critical section, ie  
they now bump CritSectionCount.  That doesn't add much overhead, and  
it guarantees that if we do somehow throw an error while the counter  
is odd, it will lead to PANIC and a database restart to reset shared  
memory.  
  
Back-patch to 9.5 where the problem was introduced.  
  
In HEAD, also fix an oversight in commit b0b39f72b: it failed to teach  
pgstat_read_current_status to copy st_gssstatus data from shared memory to  
local memory.  Hence, subsequent use of that data within the transaction  
would potentially see changing data that it shouldn't see.  
  
Discussion: https://postgr.es/m/CAPR3Wj5Z17=+eeyrn_ZDG3NQGYgMEOY6JV6Y-WRRhGgwc16U3Q@mail.gmail.com  

M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

docs: remove second mention of btree max length reduction

commit   : 4217d15d91128355ea13e6fb9c031b826e2a1335    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 18:24:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 18:24:31 -0400    

Click here for diff

I already added that to the incompatibility section as a separate item.  
  
Reported-by: Peter Geoghegan  

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

doc: remove pg_config mention from PG 12 release notes

commit   : 31f11f964734dbe2af2915182bf79f69e337d4d7    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 17:59:58 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 17:59:58 -0400    

Click here for diff

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

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

docs: PG 12 release notes, mention that REINDEX could now fail

commit   : d56fd6357a5e0e76fecf20c3dc762c5301290331    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 16:42:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 16:42:05 -0400    

Click here for diff

This is because of the new tid in the index entry.  
  
Reported-by: Peter Geoghegan  

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

commit   : 1708974485e82e1cf4694c683faa70fc5bcf142c    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 16:17:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 16:17:18 -0400    

Click here for diff

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

docs: adjust PG 12 floating point item

commit   : 0edc8fc47bc4482ceac85b09575d6372dbbc0bbf    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 10:29:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 May 2019 10:29:30 -0400    

Click here for diff

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

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

Honor TEMP_CONFIG in TAP suites.

commit   : 54c2ecb56707ed00844b8678a79570dd34cb95a3    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 11 May 2019 00:22:38 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 11 May 2019 00:22:38 -0700    

Click here for diff

The buildfarm client uses TEMP_CONFIG to implement its extra_config  
setting.  Except for stats_temp_directory, extra_config now applies to  
TAP suites; extra_config values seen in the past month are compatible  
with this.  Back-patch to 9.6, where PostgresNode was introduced, so the  
buildfarm can rely on it sooner.  
  
Reviewed by Andrew Dunstan and Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/t/001_start_stop.pl
M src/test/perl/PostgresNode.pm

Fix error reporting in reindexdb

commit   : e51bad8fb4c3f0ad5cb173034afdc0b349c7e488    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 11 May 2019 13:00:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 11 May 2019 13:00:54 +0900    

Click here for diff

When failing to reindex a table or an index, reindexdb would generate an  
extra error message related to a database failure, which is misleading.  
  
Backpatch all the way down, as this has been introduced by 85e9a5a0.  
  
Discussion: https://postgr.es/m/CAOBaU_Yo61RwNO3cW6WVYWwH7EYMPuexhKqufb2nFGOdunbcHw@mail.gmail.com  
Author: Julien Rouhaud  
Reviewed-by: Daniel Gustafsson, Álvaro Herrera, Tom Lane, Michael  
Paquier  
Backpatch-through: 9.4  

M src/bin/scripts/reindexdb.c

Fix editing error in floating-point docs.

commit   : b721e201a0bcf0f9e1795c295e134e47d698e80c    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 11 May 2019 03:23:55 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 11 May 2019 03:23:55 +0100    

Click here for diff

My fault; the error was introduced in the Ryu patch.  

M doc/src/sgml/datatype.sgml

doc: add Heikki to PG 12 release note btree item

commit   : 064df0edfee91d3843d54d1f67c05a4634690a12    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 22:11:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 22:11:13 -0400    

Click here for diff

Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-WzkrX-aA7d3OYtQT+8Mspq+tU5vwuVz=FTzMH3CdrSyprA@mail.gmail.com  

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

doc: improve PG 12 item on partitioned tables

commit   : 13d258ec0e55ebc4378e848934f0f4c0ffac0a6f    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 21:22:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 21:22:53 -0400    

Click here for diff

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

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

doc: reorder attribution of PG 12 btree item

commit   : 05f9eba3498f4dbc8687f66eff53a2bfb88f2595    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 21:16:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 21:16:33 -0400    

Click here for diff

Reported-by: Alexander Korotkov  
  
Discussion: https://postgr.es/m/CAPpHfdvkM-PkyrK6LQitJUDmC_1kOCEtTuseoVhCT=ew0XJmGg@mail.gmail.com  

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

docs: properly attribute PG 12 rel item to James Coleman

commit   : 8aa1b0885e3d248dbf3e0b0c544125d13dbc36d0    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 21:06:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 21:06:38 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f-NDmeA_tb0oRFhrgf19xq3A9MeoyMcckY04Ct=_i0c2A@mail.gmail.com  

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

docs: PG 12 docs, clarify btree index changes

commit   : 809e248299894b02e8f4eb3ee17829b2ae14ce9d    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 21:03:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 21:03:31 -0400    

Click here for diff

Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-WzkSYOM1GJVGtAbRW-OqymoCD=QWYG6ro+GaoOW-jPRuDQ@mail.gmail.com  

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

doc: PG 12 release note adjustment

commit   : b299efaea433a7d2c04ce124e4f6588807bbe87a    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 20:25:52 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2019 20:25:52 -0400    

Click here for diff

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

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

Remove reindex_catalog test from test schedules.

commit   : 5997a8f4d7478ae6bac4dab12ca1f883e41a7aa1    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 5 May 2019 23:31:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 5 May 2019 23:31:58 -0700    

Click here for diff

As none of the approaches for avoiding the deadlock issues seem  
promising enough, and all the expected reindex related changes have  
been made, apply 60c2951e1bab7e to master as well.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/reindex_catalog.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/reindex_catalog.sql

Cope with EINVAL and EIDRM shmat() failures in PGSharedMemoryAttach.

commit   : 610747d86e46ae6e94b7288393d08823cc39b498    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 May 2019 14:56:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 May 2019 14:56:41 -0400    

Click here for diff

There's a very old race condition in our code to see whether a pre-existing  
shared memory segment is still in use by a conflicting postmaster: it's  
possible for the other postmaster to remove the segment in between our  
shmctl() and shmat() calls.  It's a narrow window, and there's no risk  
unless both postmasters are using the same port number, but that's possible  
during parallelized "make check" tests.  (Note that while the TAP tests  
take some pains to choose a randomized port number, pg_regress doesn't.)  
If it does happen, we treated that as an unexpected case and errored out.  
  
To fix, allow EINVAL to be treated as segment-not-present, and the same  
for EIDRM on Linux.  AFAICS, the considerations here are basically  
identical to the checks for acceptable shmctl() failures, so I documented  
and coded it that way.  
  
While at it, adjust PGSharedMemoryAttach's API to remove its undocumented  
dependency on UsedShmemSegAddr in favor of passing the attach address  
explicitly.  This makes it easier to be sure we're using a null shmaddr  
when probing for segment conflicts (thus avoiding questions about what  
EINVAL means).  I don't think there was a bug there, but it required  
fragile assumptions about the state of UsedShmemSegAddr during  
PGSharedMemoryIsInUse.  
  
Commit c09850992 may have made this failure more probable by applying  
the conflicting-segment tests more often.  Hence, back-patch to all  
supported branches, as that was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/sysv_shmem.c

doc: add markup for PG 12 release note text

commit   : c65bcfe9aeecae1c6204ad60612fae43669a88b0    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 23:26:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 23:26:48 -0400    

Click here for diff

I will add links to other parts of the docs later.  

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

doc: PG 12 wording improvments

commit   : d0bbf871ca243eafcac7a84138741521c1aea3d2    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 20:58:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 20:58:02 -0400    

Click here for diff

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

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

Fix and improve description of locktag types in lock.h

commit   : 752f06443fba7e906cd98987f247297663f19a16    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 May 2019 09:35:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 May 2019 09:35:27 +0900    

Click here for diff

The description of the lock type for speculative insertions was  
incorrect, being copy-pasted from another one.  
  
As discussed, also move the description for all the fields of lock tag  
types from the structure listing lock tag types to the set of macros  
setting each LOCKTAG.  
  
Author: John Naylor  
Discussion: https://postgr.es/m/CACPNZCtA0-ybaC4fFfaDq_8p_TUOLvGxZH9Dm-=TMHZJarBa7Q@mail.gmail.com  

M src/include/storage/lock.h

doc: more PG 12 wording adjustments

commit   : 97b1654da7dd38fa50c9b6139f4213a1c47f0c39    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 20:32:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 20:32:35 -0400    

Click here for diff

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

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

doc: fix capitalization in PG 12 release notes

commit   : 32fe7ee2dd2b2aa8620e69451f60b2b35989677c    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 20:10:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 20:10:17 -0400    

Click here for diff

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

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

doc: more PG 12 release note adjustments

commit   : 79697d039f567cd52d844077244fb85df10dce19    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 19:59:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 19:59:59 -0400    

Click here for diff

This adds two more items that should have been included in the  
beginning.  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

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

docs: update release notes with fixes

commit   : 81ddfa2e4d9350eb68f28cde8ae6a7e0b39ef2ac    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 19:27:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 19:27:03 -0400    

Click here for diff

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

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

Improve and fix some error handling for REINDEX INDEX/TABLE CONCURRENTLY

commit   : 508300e2e141a9fd87758ce01374c5b0597986fd    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 May 2019 08:18:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 May 2019 08:18:46 +0900    

Click here for diff

This improves the user experience when it comes to restrict several  
flavors of REINDEX CONCURRENTLY.  First, for INDEX, remove a restriction  
on shared relations as we already check after catalog relations.  Then,  
for TABLE, add a proper error message when attempting to run the command  
on system catalogs.  The code path of CREATE INDEX CONCURRENTLY already  
complains about that, but if a REINDEX is issued then then the error  
generated is confusing.  
  
While on it, add more tests to check restrictions on catalog indexes and  
on toast table/index for catalogs.  Some error messages are improved,  
with wording suggestion coming from Tom Lane.  
  
Reported-by: Tom Lane  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Repair issues with faulty generation of merge-append plans.

commit   : 24c19e9f66863d83009a370604e40b1eaa71bcdd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 May 2019 16:52:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 May 2019 16:52:48 -0400    

Click here for diff

create_merge_append_plan failed to honor the CP_EXACT_TLIST flag:  
it would generate the expected targetlist but then it felt free to  
add resjunk sort targets to it.  This demonstrably leads to assertion  
failures in v11 and HEAD, and it's probably just accidental that we  
don't see the same in older branches.  I've not looked into whether  
there would be any real-world consequences in non-assert builds.  
In HEAD, create_append_plan has sprouted the same problem, so fix  
that too (although we do not have any test cases that seem able to  
reach that bug).  This is an oversight in commit 3fc6e2d7f which  
invented the CP_EXACT_TLIST flag, so back-patch to 9.6 where that  
came in.  
  
convert_subquery_pathkeys would create pathkeys for subquery output  
values if they match any EquivalenceClass known in the outer query  
and are available in the subquery's syntactic targetlist.  However,  
the second part of that condition is wrong, because such values might  
not appear in the subquery relation's reltarget list, which would  
mean that they couldn't be accessed above the level of the subquery  
scan.  We must check that they appear in the reltarget list, instead.  
This can lead to dropping knowledge about the subquery's sort  
ordering, but I believe it's okay, because any sort key that the  
outer query actually has any interest in would appear in the  
reltarget list.  
  
This second issue is of very long standing, but right now there's no  
evidence that it causes observable problems before 9.6, so I refrained  
from back-patching further than that.  We can revisit that choice if  
somebody finds a way to make it cause problems in older branches.  
(Developing useful test cases for these issues is really problematic;  
fixing convert_subquery_pathkeys removes the only known way to exhibit  
the create_merge_append_plan bug, and neither of the test cases added  
by this patch causes a problem in all branches, even when considering  
the issues separately.)  
  
The second issue explains bug #15795 from Suresh Kumar R ("could not  
find pathkey item to sort" with nested DISTINCT queries).  I stumbled  
across the first issue while investigating that.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

doc: update PG 12 release notes, v2

commit   : 64084d6857b1d8ac05ae46f658b6c244aa6ab591    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 16:44:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2019 16:44:27 -0400    

Click here for diff

Adjustments requested by reviewers.  
  
Reported-by: Amit Kapila, Thomas Munro, Andrew Gierth, Amit Langote, Oleg Bartunov, Michael Paquier, Alvaro Herrera, Tatsuo Ishii  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: Update FDW documentation about GetForeignUpperPaths().

commit   : a0be05bab062eff16eafce3df73b3df453a694f4    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 9 May 2019 19:50:15 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 9 May 2019 19:50:15 +0900    

Click here for diff

In commit d50d172e51, which added support for LIMIT/OFFSET pushdown in  
postgres_fdw, a new struct was introduced as the extra parameter of  
GetForeignUpperPaths() set for UPPERREL_FINAL, but I forgot to update  
the documentation to mention that.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/CAPmGK17uSXQDe31oRb-z1nYyT6vVzkstZkA3_Wbq38U92b9BmQ%40mail.gmail.com  

M doc/src/sgml/fdwhandler.sgml

postgres_fdw: Fix cost estimation for aggregate pushdown.

commit   : edbcbe277d795ecc339b0e4fa29bae42ce1a7be9    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 9 May 2019 18:39:23 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 9 May 2019 18:39:23 +0900    

Click here for diff

In commit 7012b132d0, which added support for aggregate pushdown in  
postgres_fdw, the expense of evaluating the final scan/join target  
computed by make_group_input_target() was not accounted for at all in  
costing aggregate pushdown paths with local statistics.  The right fix  
for this would be to have a separate upper stage to adjust the final  
scan/join relation (see comments for apply_scanjoin_target_to_paths());  
but for now, fix by adding the tlist eval cost when costing aggregate  
pushdown paths with local statistics.  
  
Apply this to HEAD only to avoid destabilizing existing plan choices.  
  
Author: Etsuro Fujita  
Reviewed-By: Antonin Houska  
Discussion: https://postgr.es/m/5C66A056.60007%40lab.ntt.co.jp  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/optimizer/plan/planner.c

Fix SxactGlobalXmin tracking.

commit   : 47a338cfcd67139a1f91892b080934fcfc3aea03    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 9 May 2019 19:11:46 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 9 May 2019 19:11:46 +1200    

Click here for diff

Commit bb16aba50 broke the code that maintains SxactGlobalXmin.  It  
could get stuck when a well-timed READ ONLY transaction runs.  If  
SxactGlobalXmin stops advancing, transactions on the  
FinishedSerializableTransactions queue are never cleaned up, so  
resources are effectively leaked.  Revert that hunk of the commit.  
  
Also revert another similar hunk that was probably harmless, but  
unnecessary and unjustified, relating to the DOOMED flag in case of  
RO_SAFE early release.  
  
Author: Thomas Munro  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/16170.1557251214%40sss.pgh.pa.us  

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

pg_controldata: Add common gettext flags

commit   : cd805f46d857291b26ba6eb491ce11b6e0fc9ad3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 May 2019 09:15:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 May 2019 09:15:59 +0200    

Click here for diff

So it picks up strings in pg_log_* calls.  This was forgotten when it  
was added to all other relevant subdirectories.  

M src/bin/pg_controldata/nls.mk

Fix grammar in error message

commit   : 02daece4ab4cd85b80d04469056e5b631918c9d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 May 2019 09:14:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 May 2019 09:14:37 +0200    

Click here for diff

M doc/src/sgml/plpgsql.sgml
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/plpgsql.out

Clean up the behavior and API of catalog.c's is-catalog-relation tests.

commit   : 2d7d946cd323ce1c1d3f3ef0e5f2f41591afc1b9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 May 2019 23:27:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 May 2019 23:27:29 -0400    

Click here for diff

The right way for IsCatalogRelation/Class to behave is to return true  
for OIDs less than FirstBootstrapObjectId (not FirstNormalObjectId),  
without any of the ad-hoc fooling around with schema membership.  
  
The previous code was wrong because (1) it claimed that  
information_schema tables were not catalog relations but their toast  
tables were, which is silly; and (2) if you dropped and recreated  
information_schema, which is a supported operation, the behavior  
changed.  That's even sillier.  With this definition, "catalog  
relations" are exactly the ones traceable to the postgres.bki data,  
which seems like what we want.  
  
With this simplification, we don't actually need access to the pg_class  
tuple to identify a catalog relation; we only need its OID.  Hence,  
replace IsCatalogClass with "IsCatalogRelationOid(oid)".  But keep  
IsCatalogRelation as a convenience function.  
  
This allows fixing some arguably-wrong semantics in contrib/sepgsql and  
ReindexRelationConcurrently, which were using an IsSystemNamespace test  
where what they really should be using is IsCatalogRelationOid.  The  
previous coding failed to protect toast tables of system catalogs, and  
also was not on board with the general principle that user-created tables  
do not become catalogs just by virtue of being renamed into pg_catalog.  
We can also get rid of a messy hack in ReindexMultipleTables.  
  
While we're at it, also rename IsSystemNamespace to IsCatalogNamespace,  
because the previous name invited confusion with the more expansive  
semantics used by IsSystemRelation/Class.  
  
Also improve the comments in catalog.c.  
  
There are a few remaining places in replication-related code that are  
special-casing OIDs below FirstNormalObjectId.  I'm inclined to think  
those are wrong too, and if there should be any special case it should  
just extend to FirstBootstrapObjectId.  But first we need to debate  
whether a FOR ALL TABLES publication should include information_schema.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/dml.c
M src/backend/access/transam/varsup.c
M src/backend/catalog/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/catalog.h

Fix error status of vacuumdb when multiple jobs are used

commit   : 3ae3c18b362817f9412c380539f1a16c7abb79c9    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 May 2019 10:29:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 May 2019 10:29:10 +0900    

Click here for diff

When running a batch of VACUUM or ANALYZE commands on a given database,  
there were cases where it is possible to have vacuumdb not report an  
error where it actually should, leading to incorrect status results.  
  
Author: Julien Rouhaud  
Reviewed-by: Amit Kapila, Michael Paquier  
Discussion: https://postgr.es/m/CAOBaU_ZuTwz7CtqLYJ1Ouuh272bTQPLN8b1bAPk0bCBm4PDMTQ@mail.gmail.com  
Backpatch-through: 9.5  

M src/bin/scripts/vacuumdb.c

Remove obsolete nbtree split REDO routine comment.

commit   : d95e36dc384e3068ae2db909c228b1800737b18d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 8 May 2019 12:47:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 8 May 2019 12:47:20 -0700    

Click here for diff

Commit dd299df8189, which added suffix truncation to nbtree, simplified  
the WAL record format used by page splits.  It became necessary to  
explicitly WAL-log the new high key for the left half of a split in all  
cases, which relieved the REDO routine from having to reconstruct a new  
high key for the left page by copying the first item from the right  
page.  Remove a comment that referred to the previous practice.  

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

Fix error messages

commit   : 61639816b870347677e6e6945604e0d9da1837ca    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 8 May 2019 13:16:54 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 8 May 2019 13:16:54 -0400    

Click here for diff

Some messages related to foreign servers were reporting the server name  
without quotes, or not at all; our style is to have all names be quoted,  
and the server name already appears quoted in a few other messages, so  
just add quotes and make them all consistent.  
  
Remove an extra "s" in other messages (typos introduced by myself in  
f56f8f8da6af).  

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

Fix documentation for the privileges required for replication functions.

commit   : df631ebc737e9d9cdf8d0691969d404f1bd584a4    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 May 2019 01:35:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 May 2019 01:35:13 +0900    

Click here for diff

Previously it's documented that use of replication functions is  
restricted to superusers. This is true for the functions which  
use replication origin, but not for pg_logicl_emit_message() and  
functions which use replication slot. For example, not only  
superusers but also users with REPLICATION privilege is allowed  
to use the functions for replication slot. This commit fixes  
the documentation for the privileges required for those replication  
functions.  
  
Back-patch to 9.4 (all supported versions).  
  
Author: Matsumura Ryo  
Discussion: https://postgr.es/m/03040DFF97E6E54E88D3BFEE5F5480F74ABA6E16@G01JPEXMBYT04  

M doc/src/sgml/func.sgml

Fix table lock levels for REINDEX INDEX CONCURRENTLY

commit   : add85ead4ab969c1e31d64f4476c2335856f4aa9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 May 2019 14:15:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 May 2019 14:15:01 +0200    

Click here for diff

REINDEX CONCURRENTLY locks tables with ShareUpdateExclusiveLock rather  
than the ShareLock used by a plain REINDEX.  However,  
RangeVarCallbackForReindexIndex() was not updated for that and still  
used the ShareLock only.  This would lead to lock upgrades later,  
leading to possible deadlocks.  
  
Reported-by: Andres Freund <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20190430151735.wi52sxjvxsjvaxxt%40alap3.anarazel.de  

M src/backend/commands/indexcmds.c

Probe only 127.0.0.1 when looking for ports on Unix.

commit   : 8efe710d9c84502b3e6a9487937bccf881f56d9c    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 6 May 2019 15:02:41 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 6 May 2019 15:02:41 +1200    

Click here for diff

Commit c0985099, later adjusted by commit 4ab02e81, probed 0.0.0.0  
in addition to 127.0.0.1, for the benefit of Windows build farm  
animals.  It isn't really useful on Unix systems, and turned out to  
be a bit inconvenient to users of some corporate firewall software.  
Switch back to probing just 127.0.0.1 on non-Windows systems.  
  
Back-patch to 9.6, like the earlier changes.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2B21EPwfgs4m%2BtqyRtbVqkOUvP8QQ8sWk9%2Bh55Aub1H3A%40mail.gmail.com  

M src/test/perl/PostgresNode.pm

Fix copy-and-paste mistakes in documentation.

commit   : 098344be663f5fc0ad166e7a9e1cd37721ee34d9    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 8 May 2019 21:14:14 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 8 May 2019 21:14:14 +1200    

Click here for diff

Reported-by: Vik Fearing  

M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_table_as.sgml

Add missing periods to comments.

commit   : b7434dc007252d7a5e5f7f85700bd7400b1db201    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 8 May 2019 16:49:09 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 8 May 2019 16:49:09 +0900    

Click here for diff

M src/include/nodes/pathnodes.h

Remove leftover reference to old "flat file" mechanism in a comment.

commit   : 256be1050cbbf90b1e44d11c8ed10f98255aa27d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 May 2019 09:32:34 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 May 2019 09:32:34 +0300    

Click here for diff

The flat file mechanism was removed in PostgreSQL 9.0.  

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

Correct obsolete nbtsort.c minimum key comment.

commit   : d65b5ccad626e1942c862e8a70f56ad7ee7a8003    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 7 May 2019 21:42:12 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 7 May 2019 21:42:12 -0700    

Click here for diff

It is no longer possible under any circumstances for nbtree code to  
reconstruct a strict lower bound key (parent page's pivot tuple key) for  
a right sibling page by retrieving the first item in the right sibling  
page.  

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

Add jsonpath_encoding_1.out changes missed in 29ceacc3f9

commit   : e5f978631722bb3cac42f0eb6e65e947e0f088ec    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 8 May 2019 01:55:31 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 8 May 2019 01:55:31 +0300    

Click here for diff

Reported-by: Tom Lane  
Discussion: https://postgr.es/m/14305.1557268259%40sss.pgh.pa.us  

M src/test/regress/expected/jsonpath_encoding_1.out

Remove word "singleton" out of jsonpath docs

commit   : 53ae0b16d6f60a15427e081091b2b81e36e674ee    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 30 Apr 2019 01:12:05 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 30 Apr 2019 01:12:05 +0300    

Click here for diff

Word "singleton" is hard for user understanding, especially taking into account  
there is only one place it's used in the docs and there is even no definition.  
Use more evident wording instead.  
  
Discussion: https://postgr.es/m/23737.1556550645%40sss.pgh.pa.us  

M doc/src/sgml/func.sgml

Improve error reporting in jsonpath

commit   : 29ceacc3f93720d3ebb7e7e999f8b7fe9622389c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 23 Apr 2019 17:43:09 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 23 Apr 2019 17:43:09 +0300    

Click here for diff

This commit contains multiple improvements to error reporting in jsonpath  
including but not limited to getting rid of following things:  
  
 * definition of error messages in macros,  
 * errdetail() when valueable information could fit to errmsg(),  
 * word "singleton" which is not properly explained anywhere,  
 * line breaks in error messages.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/14890.1555523005%40sss.pgh.pa.us  
Author: Alexander Korotkov  
Reviewed-by: Tom Lane  

M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/jsonpath_encoding.out
M src/test/regress/expected/jsonpath_encoding_1.out

Add TRUNCATE parameter to VACUUM.

commit   : b84dbc8eb80b43e554891c459a19969d9fbdefe5    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 May 2019 02:10:33 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 May 2019 02:10:33 +0900    

Click here for diff

This commit adds new parameter to VACUUM command, TRUNCATE,  
which specifies that VACUUM should attempt to truncate off  
any empty pages at the end of the table and allow the disk space  
for the truncated pages to be returned to the operating system.  
  
This parameter, if specified, overrides the vacuum_truncate  
reloption. If neither the reloption nor the VACUUM option is  
used, the default is true, as before.  
  
Author: Fujii Masao  
Reviewed-by: Julien Rouhaud, Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoD+qtrSDL=GSma4Wd3kLYLeRC0hPna-YAdkDeV4z156vg@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/include/commands/vacuum.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Fix typos and clarify a comment

commit   : 98719af6c2e30d538cd05cfe044f58ba4067b52b    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 7 May 2019 18:26:09 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 7 May 2019 18:26:09 +0200    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

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

Avoid "invalid memory alloc request size" while reading pg_stat_activity.

commit   : 8d0ddccec6366a2851da7d350b33659203aa644b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 May 2019 11:41:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 May 2019 11:41:37 -0400    

Click here for diff

On a 64-bit machine, if you set track_activity_query_size and  
max_connections such that their product exceeds 1GB, shared memory  
setup will still succeed (given enough RAM), but attempts to read  
pg_stat_activity fail with "invalid memory alloc request size".  
Work around that by using MemoryContextAllocHuge to allocate the  
local copy of the activity strings.  Using the "huge" API costs us  
nothing extra in normal cases, and it seems better than throwing  
an error and/or explaining to people why they can't do this.  
  
This situation seems insanely profligate today, but who knows what  
people will consider normal in ten or twenty years?  So let's fix it  
in HEAD but not worry about a back-patch.  
  
Per report from James Tomson.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

doc: Generate keywords table automatically

commit   : b753bc0c84e51c200ec7de6cefb6f689d13fef62    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 May 2019 15:29:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 May 2019 15:29:39 +0200    

Click here for diff

The SQL keywords table in the documentation had until now been  
generated by some ad hoc scripting outside the source tree once for  
each major release.  This changes it to an automated process.  
  
We have the PostgreSQL keywords available in a parseable format in  
parser/kwlist.h.  For the relevant SQL standard versions, keep the  
keyword lists in new text files.  A new script  
generate-keywords-table.pl pulls it all together and produces a  
DocBook table.  
  
The final output in the documentation should be identical after this  
change.  
  
Discussion: https://www.postgresql.org/message-id/flat/07daeadd-8c82-0d95-5e19-e350502cb749%402ndquadrant.com  

M doc/src/sgml/.gitignore
M doc/src/sgml/Makefile
M doc/src/sgml/filelist.sgml
A doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/keywords.sgml
A doc/src/sgml/keywords/sql1992-nonreserved.txt
A doc/src/sgml/keywords/sql1992-reserved.txt
A doc/src/sgml/keywords/sql2008-02-nonreserved.txt
A doc/src/sgml/keywords/sql2008-02-reserved.txt
A doc/src/sgml/keywords/sql2008-09-nonreserved.txt
A doc/src/sgml/keywords/sql2008-09-reserved.txt
A doc/src/sgml/keywords/sql2008-14-nonreserved.txt
A doc/src/sgml/keywords/sql2008-14-reserved.txt
A doc/src/sgml/keywords/sql2011-02-nonreserved.txt
A doc/src/sgml/keywords/sql2011-02-reserved.txt
A doc/src/sgml/keywords/sql2011-09-nonreserved.txt
A doc/src/sgml/keywords/sql2011-09-reserved.txt
A doc/src/sgml/keywords/sql2011-14-nonreserved.txt
A doc/src/sgml/keywords/sql2011-14-reserved.txt

Revert "Avoid the creation of the free space map for small heap relations".

commit   : 7db0cde6b58eef2ba0c70437324cbc7622230320    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 7 May 2019 09:30:24 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 7 May 2019 09:30:24 +0530    

Click here for diff

This feature was using a process local map to track the first few blocks  
in the relation.  The map was reset each time we get the block with enough  
freespace.  It was discussed that it would be better to track this map on  
a per-relation basis in relcache and then invalidate the same whenever  
vacuum frees up some space in the page or when FSM is created.  The new  
design would be better both in terms of API design and performance.  
  
List of commits reverted, in reverse chronological order:  
  
06c8a5090e  Improve code comments in b0eaa4c51b.  
13e8643bfc  During pg_upgrade, conditionally skip transfer of FSMs.  
6f918159a9  Add more tests for FSM.  
9c32e4c350  Clear the local map when not used.  
29d108cdec  Update the documentation for FSM behavior..  
08ecdfe7e5  Make FSM test portable.  
b0eaa4c51b  Avoid creation of the free space map for small heap relations.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql
M contrib/pgstattuple/pgstatapprox.c
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xact.c
M src/backend/storage/freespace/README
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/indexfsm.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/include/storage/freespace.h
D src/test/regress/expected/fsm.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
D src/test/regress/sql/fsm.sql

commit   : af82f95abb23a56d18fd009ef9eca68ef803a041    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 7 May 2019 09:39:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 7 May 2019 09:39:39 +0900    

Click here for diff

This code was broken as of 582edc3, and is most likely not used anymore.  
Note that pg_dump supports servers down to 8.0, and psql has code to  
support servers down to 7.4.  
  
Author: Julien Rouhaud  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAOBaU_Y5y=zo3+2gf+2NJC1pvMYPcbRXoQaPXx=U7+C8Qh4CzQ@mail.gmail.com  

M src/bin/scripts/common.c

docs: fist draft version of the PG 12 release notes

commit   : bdf595adbca195fa54a909c74a5233ebc30641a1    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 6 May 2019 19:02:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 6 May 2019 19:02:34 -0400    

Click here for diff

Still needs text markup, links, word wrap, and indenting.  

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

Revert "Make pg_dump emit ATTACH PARTITION instead of PARTITION OF"

commit   : a1ec7402e9a0392f95bc79542af0efcd5c6e7929    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 6 May 2019 12:23:49 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 6 May 2019 12:23:49 -0400    

Click here for diff

... and fallout (from branches 10, 11 and master).  The change was  
ill-considered, and it broke a few normal use cases; since we don't have  
time to fix it, we'll try again after this week's minor releases.  
  
Reported-by: Rushabh Lathia  
Discussion: https://postgr.es/m/CAGPqQf0iQV=PPOv2Btog9J9AwOQp6HmuVd6SbGTR_v3Zp2XT1w@mail.gmail.com  

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

Add tests for error message generation in partition tuple routing

commit   : 91248608a61d5504f8ac46534136de9b3717fed2    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 May 2019 21:44:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 May 2019 21:44:24 +0900    

Click here for diff

This adds extra tests for the error message generated for partition  
tuple routing in the executor, using more than three levels of  
partitioning including partitioned tables with no partitions.  These  
tests have been added to fix CVE-2019-10129 on REL_11_STABLE.  HEAD has  
no active bugs in this area, but it lacked coverage.  
  
Author: Michael Paquier  
Reviewed-by: Noah Misch  
Security: CVE-2019-10129  

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

Use checkAsUser for selectivity estimator checks, if it's set.

commit   : a0905056fd6b0927dd33f185adc9e7503515fc0d    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 6 May 2019 11:54:32 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 6 May 2019 11:54:32 +0100    

Click here for diff

In examine_variable() and examine_simple_variable(), when checking the  
user's table and column privileges to determine whether to grant  
access to the pg_statistic data, use checkAsUser for the privilege  
checks, if it's set. This will be the case if we're accessing the  
table via a view, to indicate that we should perform privilege checks  
as the view owner rather than the current user.  
  
This change makes this planner check consistent with the check in the  
executor, so the planner will be able to make use of statistics if the  
table is accessible via the view. This fixes a performance regression  
introduced by commit e2d4ef8de8, which affects queries against  
non-security barrier views in the case where the user doesn't have  
privileges on the underlying table, but the view owner does.  
  
Note that it continues to provide the same safeguards controlling  
access to pg_statistic for direct table access (in which case  
checkAsUser won't be set) and for security barrier views, because of  
the nearby checks on rte->security_barrier and rte->securityQuals.  
  
Back-patch to all supported branches because e2d4ef8de8 was.  
  
Dean Rasheed, reviewed by Jonathan Katz and Stephen Frost.  

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

Fix security checks for selectivity estimation functions with RLS.

commit   : 1aebfbea83c4a3e1a0aba4b0910135dc5a45666c    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 6 May 2019 11:38:43 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 6 May 2019 11:38:43 +0100    

Click here for diff

In commit e2d4ef8de8, security checks were added to prevent  
user-supplied operators from running over data from pg_statistic  
unless the user has table or column privileges on the table, or the  
operator is leakproof. For a table with RLS, however, checking for  
table or column privileges is insufficient, since that does not  
guarantee that the user has permission to view all of the column's  
data.  
  
Fix this by also checking for securityQuals on the RTE, and insisting  
that the operator be leakproof if there are any. Thus the  
leakproofness check will only be skipped if there are no securityQuals  
and the user has table or column privileges on the table -- i.e., only  
if we know that the user has access to all the data in the column.  
  
Back-patch to 9.5 where RLS was added.  
  
Dean Rasheed, reviewed by Jonathan Katz and Stephen Frost.  
  
Security: CVE-2019-10130  

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

Bring pg_nextoid()'s error messages into line with message style guide.

commit   : bd5e8b627bae9e394352a388d2ad30465eafea2c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 May 2019 17:06:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 May 2019 17:06:53 -0400    

Click here for diff

Noticed while reviewing nearby code.  Given all the disclaimers about  
this not being meant as user-facing code, I wonder whether we should  
make these non-translatable?  But in any case there's little excuse  
for them not to be good English.  

M src/backend/catalog/catalog.c

Fix style violations in syscache lookups.

commit   : 9691aa72e2a7fb146ac759e1f8a8b04962128cc0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 May 2019 13:10:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 May 2019 13:10:07 -0400    

Click here for diff

Project style is to check the success of SearchSysCacheN and friends  
by applying HeapTupleIsValid to the result.  A tiny minority of calls  
creatively did it differently.  Bring them into line with the rest.  
  
This is just cosmetic, since HeapTupleIsValid is indeed just a null  
check at the moment ... but that may not be true forever, and in any  
case it puts a mental burden on readers who may wonder why these  
call sites are not like the rest.  
  
Back-patch to v11 just to keep the branches in sync.  (The bulk of these  
errors seem to have originated in v11 or v12, though a few are old.)  
  
Per searching to see if anyplace else had made the same error  
repaired in 62148c352.  

M src/backend/catalog/partition.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/plancat.c

Add check for syscache lookup failure in update_relispartition().

commit   : 62148c3520b562e518f17134b22120bab0cb113b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 May 2019 12:44:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 May 2019 12:44:32 -0400    

Click here for diff

Omitted in commit 05b38c7e6 (though it looks like the original blame  
belongs to 9e9befac4).  A failure is admittedly unlikely, but if it  
did happen, SIGSEGV is not the approved method of reporting it.  
  
Per Coverity.  Back-patch to v11 where the broken code originated.  

M src/backend/commands/indexcmds.c

Fix set of issues with memory-allocation system calls in frontend code

commit   : 84e4570da9230d45022ef77f98b560f26eaf6916    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 4 May 2019 16:32:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 4 May 2019 16:32:19 +0900    

Click here for diff

Like the backend, the frontend has wrappers on top of malloc() and such  
whose use is recommended.  Particularly, it is possible to do memory  
allocation without issuing an error.  Some binaries missed the use of  
those wrappers, so let's fix the gap for consistency.  
  
This also fixes two latent bugs:  
- In pg_dump/pg_dumpall when parsing an ACL item, on an out-of-memory  
error for strdup(), the code considered the failure as a ACL parsing  
problem instead of an actual OOM.  
- In pg_waldump, an OOM when building the target directory string would  
cause a crash.  
  
Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/gY0y9xenfoBPc-Tufsr2Zg-MmkrJslm0Tw_CMg4p_j58-k_PXNC0klMdkKQkg61BkXC9_uWo-DcUzfxnHqpkpoR5jjVZrPHqKYikcHIiONhg=@yesql.se  

M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/psql/large_obj.c

MSVC: Build ~35% faster by calling dumpbin just once per directory.

commit   : 34ff542a71f8e8e768b24d40548dec4be0c707c3    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 3 May 2019 21:56:47 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 3 May 2019 21:56:47 -0700    

Click here for diff

Peifeng Qiu  
  
Discussion: https://postgr.es/m/CABmtVJiKXQjast0dQD-8KAtfm8XmyYxo-4Dc7+M+fBr8JRTqkw@mail.gmail.com  

M src/tools/msvc/gendef.pl

Suppress compiler warning in non-SSL, non-assert builds.

commit   : 726cc4242a2f766c8280a72ef7c8418965d139c8    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 3 May 2019 21:56:46 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 3 May 2019 21:56:46 -0700    

Click here for diff

Jeff Janes, reviewed by Michael Paquier.  
  
Discussion: https://postgr.es/m/CAMkU=1x8taZfsbPkv_MsWbTtzibW_yQHXoMhF_DTtm=z2hVHDg@mail.gmail.com  

M contrib/pgcrypto/imath.c

Correct more obsolete nbtree page split comments.

commit   : 7b37f4b02e11813b3cd9f7086149ba962a91e03c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 3 May 2019 13:34:45 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 3 May 2019 13:34:45 -0700    

Click here for diff

Commit 3f342839 corrected obsolete comments about buffer locks at the  
main _bt_insert_parent() call site, but missed similar obsolete comments  
above _bt_insert_parent() itself.  Both sets of comments were rendered  
obsolete by commit 40dae7ec537, which made the nbtree page split  
algorithm more robust.  Fix the comments that were missed the first time  
around now.  
  
In passing, refine a related _bt_insert_parent() comment about  
re-finding the parent page to insert new downlink.  

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

Doc: remove obsolete comment about per-branch documentation.

commit   : 8309eae499d6782bfc5e81f4d1cfcbf8e3fc8f5d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 May 2019 12:32:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 May 2019 12:32:06 -0400    

Click here for diff

I should have removed this in a0b762626, but forgot.  

M doc/src/sgml/release.sgml

Remove RelationSetIndexList().

commit   : f884dca4959f64bd47e78102d1dadd2c77d49201    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 May 2019 10:26:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 May 2019 10:26:14 -0400    

Click here for diff

In the wake of commit f912d7dec, RelationSetIndexList isn't used any  
more.  It was always a horrid wart, so getting rid of it is very nice.  
We can also convert rd_indexvalid back to a plain boolean.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix reindexing of pg_class indexes some more.

commit   : f912d7dec29341d55315fccef8dc3fdfd068c6e3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 May 2019 19:11:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 May 2019 19:11:28 -0400    

Click here for diff

Commits 3dbb317d3 et al failed under CLOBBER_CACHE_ALWAYS testing.  
Investigation showed that to reindex pg_class_oid_index, we must  
suppress accesses to the index (via SetReindexProcessing) before we call  
RelationSetNewRelfilenode, or at least before we do CommandCounterIncrement  
therein; otherwise, relcache reloads happening within the CCI may try to  
fetch pg_class rows using the index's new relfilenode value, which is as  
yet an empty file.  
  
Of course, the point of 3dbb317d3 was that that ordering didn't work  
either, because then RelationSetNewRelfilenode's own update of the index's  
pg_class row cannot access the index, should it need to.  
  
There are various ways we might have got around that, but Andres Freund  
came up with a brilliant solution: for a mapped index, we can really just  
skip the pg_class update altogether.  The only fields it was actually  
changing were relpages etc, but it was just setting them to zeroes which  
is useless make-work.  (Correct new values will be installed at the end  
of index build.)  All pg_class indexes are mapped and probably always will  
be, so this eliminates the problem by removing work rather than adding it,  
always a pleasant outcome.  Having taught RelationSetNewRelfilenode to do  
it that way, we can revert the code reordering in reindex_index.  (But  
I left the moved setup code where it was; there seems no reason why it  
has to run without use of the old index.  If you're trying to fix a  
busted pg_class index, you'll have had to disable system index use  
altogether to get this far.)  
  
Moreover, this means we don't need RelationSetIndexList at all, because  
reindex_relation's hacking to make "REINDEX TABLE pg_class" work is  
likewise now unnecessary.  We'll leave that code in place in the back  
branches, but a follow-on patch will remove it in HEAD.  
  
In passing, do some minor cleanup for commit 5c1560606 (in HEAD only),  
notably removing a duplicate newrnode assignment.  
  
Patch by me, using a core idea due to Andres Freund.  Back-patch to all  
supported branches, as 3dbb317d3 was.  
  
Discussion: https://postgr.es/m/[email protected]  

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

heap_prepare_freeze_tuple: Simplify coding

commit   : 2bf372a4ae26337ee61cf7a82081cf4bed05182d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 2 May 2019 16:13:48 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 2 May 2019 16:13:48 -0400    

Click here for diff

Commit d2599ecfcc74 introduced some contorted, confused code around:  
readers would think that it's possible for HeapTupleHeaderGetXmin return  
a non-frozen value for some frozen tuples, which would be disastrous.  
There's no actual bug, but it seems better to make it clearer.  
  
Per gripe from Tom Lane and Andres Freund.  
Discussion: https://postgr.es/m/[email protected]  

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

Fix nbtsort.c's page space accounting.

commit   : 6dd86c269d5b9a176f6c9f67ea61cc17fef9d860    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 2 May 2019 12:33:35 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 2 May 2019 12:33:35 -0700    

Click here for diff

Commit dd299df8189, which made heap TID a tiebreaker nbtree index  
column, introduced new rules on page space management to make suffix  
truncation safe.  In general, suffix truncation needs to have a small  
amount of extra space available on the new left page when splitting a  
leaf page.  This is needed in case it turns out that truncation cannot  
even "truncate away the heap TID column", resulting in a  
larger-than-firstright leaf high key with an explicit heap TID  
representation.  
  
Despite all this, CREATE INDEX/nbtsort.c did not account for the  
possible need for extra heap TID space on leaf pages when deciding  
whether or not a new item could fit on current page.  This could lead to  
"failed to add item to the index page" errors when CREATE  
INDEX/nbtsort.c tried to finish off a leaf page that lacked space for a  
larger-than-firstright leaf high key (it only had space for firstright  
tuple, which was just short of what was needed following "truncation").  
  
Several conditions needed to be met all at once for CREATE INDEX to  
fail.  The problem was in the hard limit on what will fit on a page,  
which tends to be masked by the soft fillfactor-wise limit.  The easiest  
way to recreate the problem seems to be a CREATE INDEX on a low  
cardinality text column, with tuples that are of non-uniform width,  
using a fillfactor of 100.  
  
To fix, bring nbtsort.c in line with nbtsplitloc.c, which already  
pessimistically assumes that all leaf page splits will have high keys  
that have a heap TID appended.  
  
Reported-By: Andreas Joseph Krogh  
Discussion: https://postgr.es/m/VisenaEmail.c5.3ee7fe277d514162.16a6d785bea@tc7-visena  

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

Fix some problems with VACUUM (INDEX_CLEANUP FALSE).

commit   : dd69597988859c51131e0cbff3e30432db4259e1    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 2 May 2019 10:07:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 2 May 2019 10:07:13 -0400    

Click here for diff

The new nleft_dead_tuples and nleft_dead_itemids fields are confusing  
and do not seem like the correct way forward.  One of them is tested  
via an assertion that can fail, as it has already done on buildfarm  
member topminnow.  Remove the assertion and the fields.  
  
Change the logic for the case where a tuple is not initially pruned  
by heap_page_prune but later diagnosed HEAPTUPLE_DEAD by  
HeapTupleSatisfiesVacuum.  Previously, tupgone = true was set in  
that case, which leads to treating the tuple as one that will be  
removed.  In a normal vacuum, that's OK, because we'll remove  
index entries for it and then the second heap pass will remove the  
tuple itself, but when index cleanup is disabled, those things  
don't happen, so we must instead treat it as a recently-dead  
tuple that we have voluntarily chosen to keep.  
  
Report and analysis by Tom Lane.  This patch loosely based on one  
from Masahiko Sawada, but I changed most of it.  

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

doc: clarify behavior of pg_upgrade's clone mode

commit   : 26950273dc27ec7775029cffe1140165f942325d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 1 May 2019 09:09:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 1 May 2019 09:09:28 -0400    

Click here for diff

Be more precise about the benefits of using clone mode.  

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

Fix union for pgstat message types

commit   : 659e53498c3c04e4f400323c02bef98fe8d13ec8    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 1 May 2019 12:30:44 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 1 May 2019 12:30:44 +0200    

Click here for diff

The message type for temp files and for checksum failures were missing  
from the union. Due to the coding style used there was no compiler error  
when this happend. So change the code to actively use the union thereby  
producing a compiler error if the same mistake happens again, suggested  
by Tom Lane.  
  
Author: Julien Rouhaud  
Reported-By: Tomas Vondra  
Discussion: https://postgr.es/m/20190430163328.zd4rrlnbvgaqlcdz@development  

M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Run catalog reindexing test from 3dbb317d32 serially, to avoid deadlocks.

commit   : 809c9b48f4bdd11dfc088f6d0b9a6c57936c32ca    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 17:45:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 17:45:32 -0700    

Click here for diff

The tests turn out to cause deadlocks in some circumstances. Fairly  
reproducibly so with -DRELCACHE_FORCE_RELEASE  
-DCATCACHE_FORCE_RELEASE.  Some of the deadlocks may be hard to fix  
without disproportionate measures, but others probably should be fixed  
- but not in 12.  
  
We discussed removing the new tests until we can fix the issues  
underlying the deadlocks, but results from buildfarm animal  
markhor (which runs with CLOBBER_CACHE_ALWAYS) indicates that there  
might be a more severe, as of yet undiagnosed, issue (including on  
stable branches) with reindexing catalogs. The failure is:  
ERROR: could not read block 0 in file "base/16384/28025": read only 0 of 8192 bytes  
Therefore it seems advisable to keep the tests.  
  
It's not certain that running the tests in isolation removes the risk  
of deadlocks. It's possible that additional locks are needed to  
protect against a concurrent auto-analyze or such.  
  
Per discussion with Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, like 3dbb317d3  

M src/test/regress/expected/create_index.out
A src/test/regress/expected/reindex_catalog.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/create_index.sql
A src/test/regress/sql/reindex_catalog.sql

Fix unused variable compiler warning in !debug builds.

commit   : 4b40d40b30ae04ba524cd410f14e64ae4425a180    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 17:45:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 17:45:32 -0700    

Click here for diff

Introduced in 3dbb317d3.  Fix by using the new local variable in more  
places.  
  
Reported-By: Bruce Momjian (off-list)  
Backpatch: 9.4-, like 3dbb317d3  

M src/backend/catalog/indexing.c

docs: Fix small copy & paste mistake.

commit   : b06a354e381d30e13cef28904bb923896aa4719b    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 16:18:35 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 16:18:35 -0700    

Click here for diff

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

M doc/src/sgml/ref/insert.sgml

Improve comment spelling and style in llvmjit_deform.c.

commit   : a0b5bb6e026a3acf739843b744f3b14d4093450a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 16:13:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 16:13:54 -0700    

Click here for diff

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

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

Improve code inferring length of bitmap for JITed tuple deforming.

commit   : 3a48005b0049d69b4376e6ae386479ae3d255a11    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 15:55:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 30 Apr 2019 15:55:07 -0700    

Click here for diff

While discussing comment improvements (see next commit) by Justin  
Pryzby, Tom complained about a few details of the logic to infer the  
length of the NULL bitmap when building the JITed tuple deforming  
function. That bitmap allows to avoid checking the tuple header's  
natts, a check which often causes a pipeline stall  
  
Improvements:  
a) As long as missing columns aren't taken into account, we can  
   continue to infer the length of the NULL bitmap from NOT NULL  
   columns following it. Previously we stopped at the first missing  
   column.  It's unlikely to matter much in practice, but the  
   alternative would have been to document why we stop.  
b) For robustness reasons it seems better to also check against  
   attisdropped - RemoveAttributeById() sets attnotnull to false, but  
   an additional check is trivial.  
c) Improve related comments  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: -  

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

Clean up handling of constraint_exclusion and enable_partition_pruning.

commit   : e03ff739695cb731956763355e8e0f38c6905008    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Apr 2019 15:03:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Apr 2019 15:03:35 -0400    

Click here for diff

The interaction of these parameters was a bit confused/confusing,  
and in fact v11 entirely misses the opportunity to apply partition  
constraints when a partition is accessed directly (rather than  
indirectly from its parent).  
  
In HEAD, establish the principle that enable_partition_pruning controls  
partition pruning and nothing else.  When accessing a partition via its  
parent, we do partition pruning (if enabled by enable_partition_pruning)  
and then there is no need to consider partition constraints in the  
constraint_exclusion logic.  When accessing a partition directly, its  
partition constraints are applied by the constraint_exclusion logic,  
only if constraint_exclusion = on.  
  
In v11, we can't have such a clean division of these GUCs' effects,  
partly because we don't want to break compatibility too much in a  
released branch, and partly because the clean coding requires  
inheritance_planner to have applied partition pruning to a partitioned  
target table, which it doesn't in v11.  However, we can tweak things  
enough to cover the missed case, which seems like a good idea since  
it's potentially a performance regression from v10.  This patch keeps  
v11's previous behavior in which enable_partition_pruning overrides  
constraint_exclusion for an inherited target table, though.  
  
In HEAD, also teach relation_excluded_by_constraints that it's okay to use  
inheritable constraints when trying to prune a traditional inheritance  
tree.  This might not be thought worthy of effort given that that feature  
is semi-deprecated now, but we have enough infrastructure that it only  
takes a couple more lines of code to do it correctly.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

doc: improve PG 12 to_timestamp()/to_date() wording

commit   : ad23adc5a169b114f9ff325932cbf2ce1c5e69c1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 30 Apr 2019 14:06:57 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 30 Apr 2019 14:06:57 -0400    

Click here for diff

M doc/src/sgml/func.sgml

doc: move "only" to a more appropriate place in the sentence

commit   : 345473862571d5b2c63849f6472828bdc5b49320    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 30 Apr 2019 13:44:31 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 30 Apr 2019 13:44:31 -0400    

Click here for diff

M doc/src/sgml/func.sgml

Message style fixes

commit   : 9f8b717a80c59e4a8e8091a8ff6c6f7666a69c33    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Apr 2019 10:00:38 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Apr 2019 10:00:38 -0400    

Click here for diff

M src/backend/access/table/tableamapi.c
M src/backend/access/transam/twophase.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/utils/misc/guc.c
M src/test/regress/output/tablespace.source

Widen tuple counter variables from long to int64

commit   : 9a83afecb7ec6e828b7dbef3133f3dd8b0b4dddb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Apr 2019 14:15:19 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Apr 2019 14:15:19 -0400    

Click here for diff

Mistake in ab0dfc961b6a; progress reporting would have wrapped around  
for indexes created with more than 2^31 tuples.  
  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wz=WbNxc5ob5NJ9yqo2RMJ0q4HXDS30GVCobeCvC9A1L9A@mail.gmail.com  

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

Fix potential assertion failure when reindexing a pg_class index.

commit   : 3dbb317d32f4f084ef7badaed8ef36f5c9b85fe6    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 29 Apr 2019 19:42:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 29 Apr 2019 19:42:04 -0700    

Click here for diff

When reindexing individual indexes on pg_class it was possible to  
either trigger an assertion failure:  
TRAP: FailedAssertion("!(!ReindexIsProcessingIndex(((index)->rd_id)))  
  
That's because reindex_index() called SetReindexProcessing() - which  
enables an asserts ensuring no index insertions happen into the index  
- before calling RelationSetNewRelfilenode(). That not correct for  
indexes on pg_class, because RelationSetNewRelfilenode() updates the  
relevant pg_class row, which needs to update the indexes.  
  
The are two reasons this wasn't noticed earlier. Firstly the bug  
doesn't trigger when reindexing all of pg_class, as reindex_relation  
has code "hiding" all yet-to-be-reindexed indexes. Secondly, the bug  
only triggers when the the update to pg_class doesn't turn out to be a  
HOT update - otherwise there's no index insertion to trigger the  
bug. Most of the time there's enough space, making this bug hard to  
trigger.  
  
To fix, move RelationSetNewRelfilenode() to before the  
SetReindexProcessing() (and, together with some other code, to outside  
of the PG_TRY()).  
  
To make sure the error checking intended by SetReindexProcessing() is  
more robust, modify CatalogIndexInsert() to check  
ReindexIsProcessingIndex() even when the update is a HOT update.  
  
Also add a few regression tests for REINDEXing of system catalogs.  
  
The last two improvements would have prevented some of the issues  
fixed in 5c1560606dc4c from being introduced in the first place.  
  
Reported-By: Michael Paquier  
Diagnosed-By: Tom Lane and Andres Freund  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, the bug is present in all branches  

M contrib/test_decoding/expected/rewrite.out
M contrib/test_decoding/sql/rewrite.sql
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix several recently introduced issues around handling new relation forks.

commit   : 5c1560606dc4c73993fb07f0176b5ec6c515a1b1    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 29 Apr 2019 19:28:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 29 Apr 2019 19:28:05 -0700    

Click here for diff

Most of these stem from d25f519107 "tableam: relation creation, VACUUM  
FULL/CLUSTER, SET TABLESPACE.".  
  
1) To pass data to the relation_set_new_filenode()  
   RelationSetNewRelfilenode() was made to update RelationData.rd_rel  
   directly. That's not OK however, as it makes the relcache entries  
   temporarily inconsistent. Which among other scenarios is a problem  
   if a REINDEX targets an index on pg_class - the  
   CatalogTupleUpdate() in RelationSetNewRelfilenode().  Presumably  
   that was introduced because other places in the code do so - while  
   those aren't "good practice" they don't appear to be actively  
   buggy (e.g. because system tables may not be targeted).  
  
   I (Andres) should have caught this while reviewing and signficantly  
   evolving the code in that commit, mea culpa.  
  
   Fix that by instead passing in the new RelFileNode as separate  
   argument to relation_set_new_filenode() and rely on the relcache to  
   update the catalog entry. Also revert that the  
   RelationMapUpdateMap() call was changed to immediate, and undo some  
   other more unnecessary changes.  
  
2) Document that the relation_set_new_filenode cannot rely on the  
   whole relcache entry to be valid. It might be worthwhile to  
   refactor the code to never have to rely on that, but given the way  
   heap_create() is currently coded, that'd be a large change.  
  
3) ATExecSetTableSpace() shouldn't do FlushRelationBuffers() itself. A  
   table AM might not use shared buffers at all. Move to  
   index_copy_data() and heapam_relation_copy_data().  
  
4) heapam_relation_set_new_filenode() previously sometimes accessed  
   rel->rd_rel->relpersistence rather than the `persistence`  
   argument. Code movement mistake.  
  
5) Previously heapam_relation_set_new_filenode() re-opened the smgr  
   relation to create the init for, if necesary. Instead have  
   RelationCreateStorage() return the SMgrRelation and use it to  
   create the init fork.  
  
6) Add a note about the danger of modifying the relcache directly to  
   ATExecSetTableSpace() - it's currently not a bug because there's a  
   check ERRORing for catalog tables.  
  
Regression tests and assertion improvements that together trigger the  
bug described in 1) will be added in a later commit, as there is a  
related bug on all branches.  
  
Reported-By: Michael Paquier  
Diagnosed-By: Tom Lane and Andres Freund  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/heap.c
M src/backend/catalog/storage.c
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/relcache.c
M src/include/access/tableam.h
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h

Remove obsolete _bt_insert_parent() comment.

commit   : 9ee7414ed0435d8946d040eb523824f2d71e2418    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 29 Apr 2019 14:14:38 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 29 Apr 2019 14:14:38 -0700    

Click here for diff

Remove a comment that refers to a coding practice that was fully removed  
by commit a8b8f4db, which introduced MarkBufferDirty().  It looks like  
the comment was even obsolete before then, since it concerns  
write-ordering dependencies with synchronous buffer writes.  

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

In walreceiver, don't try to do ereport() in a signal handler.

commit   : a1a789eb5ac894b4ca4b7742f2dc2d9602116e46    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Apr 2019 12:26:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Apr 2019 12:26:07 -0400    

Click here for diff

This is quite unsafe, even for the case of ereport(FATAL) where we won't  
return control to the interrupted code, and despite this code's use of  
a flag to restrict the areas where we'd try to do it.  It's possible  
for example that we interrupt malloc or free while that's holding a lock  
that's meant to protect against cross-thread interference.  Then, any  
attempt to do malloc or free within ereport() will result in a deadlock,  
preventing the walreceiver process from exiting in response to SIGTERM.  
We hypothesize that this explains some hard-to-reproduce failures seen  
in the buildfarm.  
  
Hence, get rid of the immediate-exit code in WalRcvShutdownHandler,  
as well as the logic associated with WalRcvImmediateInterruptOK.  
Instead, we need to take care that potentially-blocking operations  
in the walreceiver's data transmission logic (libpqwalreceiver.c)  
will respond reasonably promptly to the process's latch becoming  
set and then call ProcessWalRcvInterrupts.  Much of the needed code  
for that was already present in libpqwalreceiver.c.  I refactored  
things a bit so that all the uses of PQgetResult use latch-aware  
waiting, but didn't need to do much more.  
  
These changes should be enough to ensure that libpqwalreceiver.c  
will respond promptly to SIGTERM whenever it's waiting to receive  
data.  In principle, it could block for a long time while waiting  
to send data too, and this patch does nothing to guard against that.  
I think that that hazard is mostly theoretical though: such blocking  
should occur only if we fill the kernel's data transmission buffers,  
and we don't generally send enough data to make that happen without  
waiting for input.  If we find out that the hazard isn't just  
theoretical, we could fix it by using PQsetnonblocking, but that  
would require more ticklish changes than I care to make now.  
  
This is a bug fix, but it seems like too big a change to push into  
the back branches without much more testing than there's time for  
right now.  Perhaps we'll back-patch once we have more confidence  
in the change.  
  
Patch by me; thanks to Thomas Munro for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walreceiver.c
M src/include/replication/walreceiver.h

Fix some typos

commit   : 9c592896d9fc81d8def7b98c89a869588e76f0ea    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Apr 2019 23:52:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Apr 2019 23:52:42 +0900    

Click here for diff

Author: Daniel Gustafsson  
Discussion: https://postgr.es/m/42kEeWei6VxLGh12QbR08hiI5Pm-c3XgbK7qj393PSttEhVbnnQoFXHKzXjPRZLUpndWAfHIuZuUqGZBzyXadmEUCSqm9xphWur_I8vESMA=@yesql.se  

M src/bin/pg_dump/pg_dump.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Message fixes

commit   : ffbce803e646e254367a3f0670d8b64604badc50    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Apr 2019 10:05:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Apr 2019 10:05:07 -0400    

Click here for diff

M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/check.c
M src/bin/scripts/vacuumdb.c

Fix potential catalog corruption with temporary identity columns

commit   : cd3e27464cca40664c54fb8cd10454f979c1db4e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Apr 2019 08:44:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Apr 2019 08:44:51 +0200    

Click here for diff

If a temporary table with an identity column and ON COMMIT DROP is  
created in a single-statement transaction (not useful, but allowed),  
it would leave the catalog corrupted.  We need to add a  
CommandCounterIncrement() so that PreCommit_on_commit_actions() sees  
the created dependency between table and sequence and can clean it  
up.  
  
The analogous and more useful case of doing this in a transaction  
block already runs some CommandCounterIncrement() before it gets to  
the on-commit cleanup, so it wasn't a problem in practical use.  
  
Several locations for placing the new CommandCounterIncrement() call  
were discussed.  This patch places it at the end of  
standard_ProcessUtility().  That would also help if other commands  
were to create catalog entries that some on-commit action would like  
to see.  
  
Bug: #15631  
Reported-by: Serge Latyntsev <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/tcop/utility.c

Do pre-release housekeeping on catalog data, and fix jsonpath send/recv.

commit   : c3f67ed6e434333e1bc011afc94c25d9959a86bd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Apr 2019 17:16:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Apr 2019 17:16:50 -0400    

Click here for diff

Run renumber_oids.pl to move high-numbered OIDs down, as per pre-beta  
tasks specified by RELEASE_CHANGES.  (The only change is 8394 -> 3428.)  
  
Also run reformat_dat_file.pl while I'm here.  
  
While looking at the reformat diffs, I chanced to notice that type  
jsonpath had typsend and typreceive = '-', which surely is not the  
intention given that jsonpath_send and jsonpath_recv exist.  
Fix that.  It's safe to assume that these functions have never been  
tested :-(.  I didn't try, but somebody should.  

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

Use preprocessor conditions compatible with Emacs indent.

commit   : 90e7f317735159116fdc3f90e287dd688b18a353    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 28 Apr 2019 12:56:53 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 28 Apr 2019 12:56:53 -0700    

Click here for diff

Emacs wrongly indented hundreds of subsequent lines.  

M src/backend/postmaster/postmaster.c
M src/bin/pg_upgrade/controldata.c

Clean up minor warnings from buildfarm.

commit   : e481d26285b160058b093588e062cf3071fea192    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Apr 2019 12:45:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Apr 2019 12:45:55 -0400    

Click here for diff

Be more consistent about use of XXXGetDatum macros in new jsonpath  
code.  This is mostly to avoid having code that looks randomly  
different from everyplace else that's doing the exact same thing.  
  
In pg_regress.c, avoid an unreferenced-function warning from  
compilers that don't understand pg_attribute_unused().  Putting  
the function inside the same #ifdef as its only caller is more  
straightforward coding anyway.  
  
In be-secure-openssl.c, avoid use of pg_attribute_unused() on a label.  
That's pretty creative, but there's no good reason to suppose that  
it's portable, and there's absolutely no need to use goto's here in the  
first place.  (This wasn't actually causing any buildfarm complaints,  
but it's new code in v12 so it has no portability track record.)  

M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/test/regress/pg_regress.c

Fix more typos and inconsistencies in documentation

commit   : ac862376037727e744f25030bd8b6090c707247b    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 28 Apr 2019 22:53:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 28 Apr 2019 22:53:33 +0900    

Click here for diff

This fixes a couple of grammar mistakes, typos and inconsistencies in  
the documentation.  Particularly, the configuration parsing allows only  
"kB" to mean kilobyte but there were references in the docs to "KB".  
Some instances of the latter are still in the code comments.  Some  
parameter values were mentioned with "Minus-one", and using directly  
"-1" with proper markups is more helpful to the reader.  
  
Some of these have been pointed out by Justin, and some others are  
things I bumped into.  
  
Author: Justin Pryzby, Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/auto-explain.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/sources.sgml

Avoid postgres_fdw crash for a targetlist entry that's just a Param.

commit   : 8cad5adb9c0be82e9f40d51b02a542439f47de9e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 27 Apr 2019 13:15:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 27 Apr 2019 13:15:54 -0400    

Click here for diff

foreign_grouping_ok() is willing to put fairly arbitrary expressions into  
the targetlist of a remote SELECT that's doing grouping or aggregation on  
the remote side, including expressions that have no foreign component to  
them at all.  This is possibly a bit dubious from an efficiency standpoint;  
but it rises to the level of a crash-causing bug if the expression is just  
a Param or non-foreign Var.  In that case, the expression will necessarily  
also appear in the fdw_exprs list of values we need to send to the remote  
server, and then setrefs.c's set_foreignscan_references will mistakenly  
replace the fdw_exprs entry with a Var referencing the targetlist result.  
  
The root cause of this problem is bad design in commit e7cb7ee14: it put  
logic into set_foreignscan_references that IMV is postgres_fdw-specific,  
and yet this bug shows that it isn't postgres_fdw-specific enough.  The  
transformation being done on fdw_exprs assumes that fdw_exprs is to be  
evaluated with the fdw_scan_tlist as input, which is not how postgres_fdw  
uses it; yet it could be the right thing for some other FDW.  (In the  
bigger picture, setrefs.c has no business assuming this for the other  
expression fields of a ForeignScan either.)  
  
The right fix therefore would be to expand the FDW API so that the  
FDW could inform setrefs.c how it intends to evaluate these various  
expressions.  We can't change that in the back branches though, and we  
also can't just summarily change setrefs.c's behavior there, or we're  
likely to break external FDWs.  
  
As a stopgap, therefore, hack up postgres_fdw so that it won't attempt  
to send targetlist entries that look exactly like the fdw_exprs entries  
they'd produce.  In most cases this actually produces a superior plan,  
IMO, with less data needing to be transmitted and returned; so we probably  
ought to think harder about whether we should ship tlist expressions at  
all when they don't contain any foreign Vars or Aggs.  But that's an  
optimization not a bug fix so I left it for later.  One case where this  
produces an inferior plan is where the expression in question is actually  
a GROUP BY expression: then the restriction prevents us from using remote  
grouping.  It might be possible to work around that (since that would  
reduce to group-by-a-constant on the remote side); but it seems like a  
pretty unlikely corner case, so I'm not sure it's worth expending effort  
solely to improve that.  In any case the right long-term answer is to fix  
the API as sketched above, and then revert this hack.  
  
Per bug #15781 from Sean Johnston.  Back-patch to v10 where the problem  
was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql

Add viewBox attribute to storage page layout SVG image

commit   : 29046c44f36099f4c979b1491fcf27db2f9184f9    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 27 Apr 2019 11:36:51 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 27 Apr 2019 11:36:51 -0400    

Click here for diff

Recently added SVG image for storage page layout lacks  
a viewBox attribute which seems necessary to ensure propoer  
rendering. Add it.  
  
Author: Jonathan Katz  
Discussion: https://postgr.es/m/ba31e0e1-4c9b-b309-70e8-8e7ac14fc87e%40postgresql.org  

M doc/src/sgml/images/pagelayout.svg

Add guidance on making documentation SVG images responsive

commit   : 7dc78d8ef3e62f7e06d7767c63dcede048377b9a    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 27 Apr 2019 11:12:52 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 27 Apr 2019 11:12:52 -0400    

Click here for diff

Recently added guidance on adding SVG images to the documentation  
sources lacks advice on making the images responsive when rendered  
in a variety of media types and viewports. Add some.  
  
Patch by Jonathan Katz with some editorialization by me.  
  
Author: Jonathan Katz  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/images/README

Correct the URL pointing to PL/R

commit   : cf3ff97a15c184bf6a665b891f41349c8aba79fb    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 27 Apr 2019 09:27:56 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 27 Apr 2019 09:27:56 -0400    

Click here for diff

As pointed out by documentation comment, the URL for PL/R  
needs to be updated to the correct current repository. Back-patch  
to all supported branches.  

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

Update config.guess and config.sub

commit   : ddcaa596725a023c29fce34ff9914e123f225a5e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Apr 2019 14:25:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Apr 2019 14:25:00 +0200    

Click here for diff

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

Portability fix for zic.c.

commit   : 48f8fa9ce0f9799c8ae8bcd23c498fe002d5496d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Apr 2019 21:20:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Apr 2019 21:20:11 -0400    

Click here for diff

Missed an inttypes.h dependency in previous patch.  Per buildfarm.  

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

Mention REINDEX CONCURRENTLY in documentation about index maintenance

commit   : a967878414f906a7f88842424c667a5ac31b9625    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 27 Apr 2019 09:06:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 27 Apr 2019 09:06:39 +0900    

Click here for diff

The documentation includes a section about index maintenance and  
reindexing, mentioning a set of steps based on CREATE INDEX CONCURRENTLY  
and ALTER TABLE (for constraint dependencies) to emulate REINDEX  
CONCURRENTLY.  Now that REINDEX CONCURRENTLY is supported, let's just  
directly mention it instead.  
  
Reported-by: Peter Geoghegan  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut, Tom Lane  
Discussion: https://postgr.es/m/CAH2-WzmEL168t6w29aKrKXtpq9-apcmp0HC7K-fKt6ZgLXV6Dg@mail.gmail.com  

M doc/src/sgml/maintenance.sgml

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

commit   : acb897b806a5f4b23784b1c7e395e67b99a4362b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Apr 2019 19:46:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Apr 2019 19:46:26 -0400    

Click here for diff

This corrects a small bug in zic that caused it to output an incorrect  
year-2440 transition in the Africa/Casablanca zone.  
  
More interestingly, zic has grown a "-r" option that limits the range of  
zone transitions that it will put into the output files.  That might be  
useful to people who don't like the weird GMT offsets that tzdb likes  
to use for very old dates.  It appears that for dates before the cutoff  
time specified with -r, zic will use the zone's standard-time offset  
as of the cutoff time.  So for example one might do  
  
	make install ZIC_OPTIONS='-r @-1893456000'  
  
to cause all dates before 1910-01-01 to be treated as though 1910  
standard time prevailed indefinitely far back.  (Don't blame me for  
the unfriendly way of specifying the cutoff time --- it's seconds  
since or before the Unix epoch.  You can use extract(epoch ...)  
to calculate it.)  
  
As usual, back-patch to all supported branches.  

M src/timezone/Makefile
M src/timezone/README
M src/timezone/private.h
M src/timezone/tzfile.h
M src/timezone/zic.c

Update time zone data files to tzdata release 2019a.

commit   : d312de3fc092c784e743e58be4d1617cfb704b71    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Apr 2019 17:56:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Apr 2019 17:56:26 -0400    

Click here for diff

DST law changes in Palestine and Metlakatla.  
Historical corrections for Israel.  
  
Etc/UCT is now a backward-compatibility link to Etc/UTC, instead  
of being a separate zone that generates the abbreviation "UCT",  
which nowadays is typically a typo.  Postgres will still accept  
"UCT" as an input zone name, but it won't output it.  

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

Update key words table for version 12

commit   : 686fef22fdba732aeca28b471a362d4fb5675675    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Apr 2019 23:23:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Apr 2019 23:23:56 +0200    

Click here for diff

M doc/src/sgml/keywords.sgml

Apply stopgap fix for bug #15672.

commit   : c01eb619a83aed460b9ead50831265f2acde3c57    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Apr 2019 17:18:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Apr 2019 17:18:07 -0400    

Click here for diff

Fix DefineIndex so that it doesn't attempt to pass down a to-be-reused  
index relfilenode to a child index creation, and fix TryReuseIndex  
to not think that reuse is sensible for a partitioned index.  
  
In v11, this fixes a problem where ALTER TABLE on a partitioned table  
could assign the same relfilenode to several different child indexes,  
causing very nasty catalog corruption --- in fact, attempting to DROP  
the partitioned table then leads not only to a database crash, but to  
inability to restart because the same crash will recur during WAL replay.  
  
Either of these two changes would be enough to prevent the failure, but  
since neither action could possibly be sane, let's put in both changes  
for future-proofing.  
  
In HEAD, no such bug manifests, but that's just an accidental consequence  
of having changed the pg_class representation of partitioned indexes to  
have relfilenode = 0.  Both of these changes still seem like smart  
future-proofing.  
  
This is only a stop-gap because the code for ALTER TABLE on a partitioned  
table with a no-op type change still leaves a great deal to be desired.  
As the added regression tests show, it gets things wrong for comments on  
child indexes/constraints, and it is regenerating child indexes it doesn't  
have to.  However, fixing those problems will take more work which may not  
get back-patched into v11.  We need a fix for the corruption problem now.  
  
Per bug #15672 from Jianing Yang.  
  
Patch by me, regression test cases based on work by Amit Langote,  
who also did a lot of the investigative work.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_dump: store unused attribs as NULL instead of '\0'

commit   : 7fcdb5e002145ec95b2bebb4c125751be66c4d1a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Apr 2019 12:03:59 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Apr 2019 12:03:59 -0400    

Click here for diff

Commit f831d4accda0 changed pg_dump to emit (and pg_restore to  
understand) NULLs for unused members in ArchiveEntry structs, as a side  
effect of some code beautification.  That broke pg_restore of dumps  
generated with older pg_dump, however, so it was reverted in  
19455c9f5606.  Since the archiver version number has been bumped in  
3b925e905de3, we can put it back.  
  
Author: Dmitry Dolgov  
Discussion: https://postgr.es/m/CA+q6zcXx0XHqLsFJLaUU2j5BDiBAHig=YRoBC_YVq7VJGvzBEA@mail.gmail.com  

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

doc: Update section on NFS

commit   : 60bbf0753e337114d4c7d60dbc5a496b1f464cb5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Apr 2019 11:50:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Apr 2019 11:50:16 +0200    

Click here for diff

The old section was ancient and didn't seem very helpful.  Here, we  
add some concrete advice on particular mount options.  
  
Reviewed-by: Joe Conway <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/e90f24bb-5423-6abb-58ec-501176eb4afc%402ndquadrant.com  

M doc/src/sgml/runtime.sgml

Add FDW documentation notes about insert and update tuple routing and COPY.

commit   : 90fca7a35aa7ac421f814bdfdf1fee7c30fa82f0    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 26 Apr 2019 18:10:05 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 26 Apr 2019 18:10:05 +0900    

Click here for diff

Author: Laurenz Albe and Etsuro Fujita  
Reviewed-by: Laurenz Albe and Amit Langote  
Backpatch-through: 11 where support for that by FDWs was added  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/fdwhandler.sgml

Sanitize line pointers within contrib/amcheck.

commit   : a9ce839a31375a6c04189222706ae6b2abe96919    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 25 Apr 2019 12:50:37 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 25 Apr 2019 12:50:37 -0700    

Click here for diff

Adopt a more defensive approach to accessing index tuples in  
contrib/amcheck: verify that each line pointer looks sane before  
accessing associated tuple using pointer arithmetic based on line  
pointer's offset.  This avoids undefined behavior and assertion failures  
in cases where line pointers are corrupt.  
  
Issue spotted following a complaint about an assertion failure by  
Grigory Smolkin, which involved a test harness that deliberately  
corrupts indexes.  
  
This is arguably a bugfix, but no backpatch given the lack of field  
reports beyond Grigory's.  
  
Discussion: https://postgr.es/m/CAH2-WzmkurhCqnyLHxk0VkOZqd49+ZZsp1xAJOg7j2x7dmp_XQ@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c

Fix partitioned index attachment

commit   : 05b38c7e63d1c8bca8c07ab4c8b194eed3c50ec7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Apr 2019 10:50:14 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Apr 2019 10:50:14 -0400    

Click here for diff

When an existing index in a partition is attached to a new index on  
its parent, we forgot to set the "relispartition" flag correctly, which  
meant that it was not possible to find the index in various operations,  
such as adding a foreign key constraint that references that partitioned  
table.  One of four places that was assigning the parent index was  
forgetting to do that, so fix by shifting responsibility of updating the  
flag to the routine that changes the parent.  
  
Author: Amit Langote, Álvaro Herrera  
Reported-by: Hubert "depesz" Lubaczewski  
Discussion: https://postgr.es/m/CA+HiwqHMsRtRYRWYTWavKJ8x14AFsv7bmAV46mYwnfD3vy8goQ@mail.gmail.com  

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

Fix file path in comment.

commit   : c247ae09226eeb1c3a77bb54a0736ed7da5622b5    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 25 Apr 2019 23:49:37 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 25 Apr 2019 23:49:37 +0900    

Click here for diff

M src/bin/pg_checksums/pg_checksums.c

Fix function names in comments.

commit   : 978b032d1f39fcfe9b7e895ab313913d97db2268    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 25 Apr 2019 23:43:48 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 25 Apr 2019 23:43:48 +0900    

Click here for diff

Commit 3eb77eba5a renamed some functions, but forgot to  
update some comments referencing to those functions.  
This commit fixes those function names in the comments.  
  
Kyotaro Horiguchi  

M src/backend/postmaster/checkpointer.c
M src/backend/storage/smgr/md.c
M src/backend/storage/sync/sync.c
M src/common/rmtree.c

Fix tablespace inheritance for partitioned rels

commit   : 87259588d0ab0b8e742e30596afa7ae25caadb18    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Apr 2019 10:20:23 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Apr 2019 10:20:23 -0400    

Click here for diff

Commit ca4103025dfe left a few loose ends.  The most important one  
(broken pg_dump output) is already fixed by virtue of commit  
3b23552ad8bb, but some things remained:  
  
* When ALTER TABLE rewrites tables, the indexes must remain in the  
  tablespace they were originally in.  This didn't work because  
  index recreation during ALTER TABLE runs manufactured SQL (yuck),  
  which runs afoul of default_tablespace in competition with the parent  
  relation tablespace.  To fix, reset default_tablespace to the empty  
  string temporarily, and add the TABLESPACE clause as appropriate.  
  
* Setting a partitioned rel's tablespace to the database default is  
  confusing; if it worked, it would direct the partitions to that  
  tablespace regardless of default_tablespace.  But in reality it does  
  not work, and making it work is a larger project.  Therefore, throw  
  an error when this condition is detected, to alert the unwary.  
  
Add some docs and tests, too.  
  
Author: Álvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f_1c260nOt_vBJ067AZ3JXptXVRohDVMLEBmudX1YEx-A@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/bootstrap/bootparse.y
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/commands/tablespace.h
M src/include/nodes/parsenodes.h
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Make pg_dump emit ATTACH PARTITION instead of PARTITION OF

commit   : 3b23552ad8bbb1384381b67f860019d14d5b680e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 24 Apr 2019 15:30:37 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 24 Apr 2019 15:30:37 -0400    

Click here for diff

Using PARTITION OF can result in column ordering being changed from the  
database being dumped, if the partition uses a column layout different  
from the parent's.  It's not pg_dump's job to editorialize on table  
definitions, so this is not acceptable; back-patch all the way back to  
pg10, where partitioned tables where introduced.  
  
This change also ensures that partitions end up in the correct  
tablespace, if different from the parent's; this is an oversight in  
ca4103025dfe (in pg12 only).  Partitioned indexes (in pg11) don't have  
this problem, because they're already created as independent indexes and  
attached to their parents afterwards.  
  
This change also has the advantage that the partition is restorable from  
the dump (as a standalone table) even if its parent table isn't  
restored.  
  
Author: David Rowley  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CAKJS1f_1c260nOt_vBJ067AZ3JXptXVRohDVMLEBmudX1YEx-A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

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

Fix some minor postmaster-state-machine issues.

commit   : 0fae846232148754468f6d57b3f98d5b83d90af7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Apr 2019 14:15:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Apr 2019 14:15:44 -0400    

Click here for diff

In sigusr1_handler, don't ignore PMSIGNAL_ADVANCE_STATE_MACHINE based  
on pmState.  The restriction is unnecessary (PostmasterStateMachine  
should work in any state), not future-proof (since it makes too many  
assumptions about why the signal might be sent), and broken even today  
because a race condition can make it necessary to respond to the signal  
in PM_WAIT_READONLY state.  The race condition seems unlikely, but  
if it did happen, a hot-standby postmaster could fail to shut down  
after receiving a smart-shutdown request.  
  
In MaybeStartWalReceiver, don't clear the WalReceiverRequested flag  
if the fork attempt fails.  Leaving it set allows us to try  
again in future iterations of the postmaster idle loop.  (The startup  
process would eventually send a fresh request signal, but this change  
may allow us to retry the fork sooner.)  
  
Remove an obsolete comment and unnecessary test in  
PostmasterStateMachine's handling of PM_SHUTDOWN_2 state.  It's not  
possible to have a live walreceiver in that state, and AFAICT has not  
been possible since commit 5e85315ea.  This isn't a live bug, but the  
false comment is quite confusing to readers.  
  
In passing, rearrange sigusr1_handler's CheckPromoteSignal tests so that  
we don't uselessly perform stat() calls that we're going to ignore the  
results of.  
  
Add some comments clarifying the behavior of MaybeStartWalReceiver;  
I very nearly rearranged it in a way that'd reintroduce the race  
condition fixed in e5d494d78.  Mea culpa for not commenting that  
properly at the time.  
  
Back-patch to all supported branches.  The PMSIGNAL_ADVANCE_STATE_MACHINE  
change is the only one of even minor significance, but we might as well  
keep this code in sync across branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Unify error messages

commit   : 0a999e1290fc9d8708da61017e732380bc9239a3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 24 Apr 2019 09:26:13 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 24 Apr 2019 09:26:13 -0400    

Click here for diff

... for translatability purposes.  

M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c

postgres_fdw: Fix incorrect handling of row movement for remote partitions.

commit   : 5c47049180b8977154f99fdc7988d5846764afa2    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 24 Apr 2019 18:31:50 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 24 Apr 2019 18:31:50 +0900    

Click here for diff

Commit 3d956d9562 added support for update row movement in postgres_fdw.  
This patch fixes the following issues introduced by that commit:  
  
* When a remote partition chosen to insert routed rows into was also an  
  UPDATE subplan target rel that would be updated later, the UPDATE that  
  used a direct modification plan modified those routed rows incorrectly  
  because those routed rows were visible to the later UPDATE command.  
  The right fix for this would be to have some way in postgres_fdw in  
  which the later UPDATE command ignores those routed rows, but it seems  
  hard to do so with the current infrastructure.  For now throw an error  
  in that case.  
  
* When a remote partition chosen to insert routed rows into was also an  
  UPDATE subplan target rel, fmstate created for the UPDATE that used a  
  non-direct modification plan was mistakenly overridden by another  
  fmstate created for inserting those routed rows into the partition.  
  This caused 1) server crash when the partition would be updated later,  
  and 2) resource leak when the partition had been already updated.  To  
  avoid that, adjust the treatment of the fmstate for the inserting.  As  
  for #1, since we would also have the incorrectness issue as mentioned  
  above, error out in that case as well.  
  
Update the docs to mention that postgres_fdw currently does not handle  
the case where a remote partition chosen to insert a routed row into is  
also an UPDATE subplan target rel that will be updated later.  
  
Author: Amit Langote and Etsuro Fujita  
Reviewed-by: Amit Langote  
Backpatch-through: 11 where row movement in postgres_fdw was added  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Allow pg_class xid & multixid horizons to not be set.

commit   : fdc7efcc30b1da950ade72fd35852c21bf8de839    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 23 Apr 2019 21:42:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 23 Apr 2019 21:42:12 -0700    

Click here for diff

This allows table AMs that don't need these horizons. This was already  
documented in the tableam relation_set_new_filenode callback, but an  
assert prevented if from actually working (the test AM code contained  
the change itself). Defang the asserts in the general code, and move  
the stronger ones into heap AM.  
  
Relatedly, after CLUSTER/VACUUM, we'd always assign a relfrozenxid /  
relminmxid. Change the table_relation_copy_for_cluster() interface to  
allow the AM to overwrite the horizons that get set on the pg_class  
entry.  This'd also in the future allow AMs like heap to compute a  
relfrozenxid during rewrite that's the table's actual minimum rather  
than a pre-determined value.  Arguably it'd have been better to move  
the whole computation / setting of those values into the callback, but  
it seems likely that for other reasons it'd be better to be able to  
use one value to vacuum/cluster multiple tables (e.g. a toast's  
horizon shouldn't be different than the table's).  
  
Reported-By: Heikki Linnakangas  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/include/access/tableam.h

Repair assorted issues in locale data extraction.

commit   : 7ad1cd31bfcbaed122993deb778e6587a226e338    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2019 18:51:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2019 18:51:30 -0400    

Click here for diff

cache_locale_time (extraction of LC_TIME-related info) had never been  
taught the lessons we previously learned about extraction of info related  
to LC_MONETARY and LC_NUMERIC.  Specifically, commit 95a777c61 taught  
PGLC_localeconv() that data coming out of localeconv() was in an encoding  
determined by the relevant locale, but we didn't realize that there's a  
similar issue with strftime().  And commit a4930e7ca hardened  
PGLC_localeconv() against errors occurring partway through, but failed  
to do likewise for cache_locale_time().  So, rearrange the latter  
function to perform encoding conversion and not risk failure while  
it's got the locales set to temporary values.  
  
This time around I also changed PGLC_localeconv() to treat it as FATAL  
if it can't restore the previous settings of the locale values.  There  
is no reason (except possibly OOM) for that to fail, and proceeding with  
the wrong locale values seems like a seriously bad idea --- especially  
on Windows where we have to also temporarily change LC_CTYPE.  Also,  
protect against the possibility that we can't identify the codeset  
reported for LC_MONETARY or LC_NUMERIC; rather than just failing,  
try to validate the data without conversion.  
  
The user-visible symptom this fixes is that if LC_TIME is set to a locale  
name that implies an encoding different from the database encoding,  
non-ASCII localized day and month names would be retrieved in the wrong  
encoding, leading to either unexpected encoding-conversion error reports  
or wrong output from to_char().  The other possible failure modes are  
unlikely enough that we've not seen reports of them, AFAIK.  
  
The encoding conversion problems do not manifest on Windows, since  
we'd already created special-case code to handle that issue there.  
  
Per report from Juan José Santamaría Flecha.  Back-patch to all  
supported versions.  
  
Juan José Santamaría Flecha and Tom Lane  
  
Discussion: https://postgr.es/m/CAC+AXB22So5aZm2vZe+MChYXec7gWfr-n-SK-iO091R0P_1Tew@mail.gmail.com  

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

Remove useless comment.

commit   : e0fb4c9d013f8c3f6eb31c5fb991e24b4af6dbb1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2019 17:17:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2019 17:17:26 -0400    

Click here for diff

Commit e439c6f0c removed IndexStmt.relationId, but not the comment  
that had been added to explain it.  Said comment was therefore  
very confusing.  

M src/include/nodes/parsenodes.h

Prevent O(N^2) unique index insertion edge case.

commit   : 9b10926263d831fac5758f1493c929a49b55669b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 23 Apr 2019 10:33:57 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 23 Apr 2019 10:33:57 -0700    

Click here for diff

Commit dd299df8 made nbtree treat heap TID as a tiebreaker column,  
establishing the principle that there is only one correct location (page  
and page offset number) for every index tuple, no matter what.  
Insertions of tuples into non-unique indexes proceed as if heap TID  
(scan key's scantid) is just another user-attribute value, but  
insertions into unique indexes are more delicate.  The TID value in  
scantid must initially be omitted to ensure that the unique index  
insertion visits every leaf page that duplicates could be on.  The  
scantid is set once again after unique checking finishes successfully,  
which can force _bt_findinsertloc() to step right one or more times, to  
locate the leaf page that the new tuple must be inserted on.  
  
Stepping right within _bt_findinsertloc() was assumed to occur no more  
frequently than stepping right within _bt_check_unique(), but there was  
one important case where that assumption was incorrect: inserting a  
"duplicate" with NULL values.  Since _bt_check_unique() didn't do any  
real work in this case, it wasn't appropriate for _bt_findinsertloc() to  
behave as if it was finishing off a conventional unique insertion, where  
any existing physical duplicate must be dead or recently dead.  
_bt_findinsertloc() might have to grovel through a substantial portion  
of all of the leaf pages in the index to insert a single tuple, even  
when there were no dead tuples.  
  
To fix, treat insertions of tuples with NULLs into a unique index as if  
they were insertions into a non-unique index: never unset scantid before  
calling _bt_search() to descend the tree, and bypass _bt_check_unique()  
entirely.  _bt_check_unique() is no longer responsible for incoming  
tuples with NULL values.  
  
Discussion: https://postgr.es/m/CAH2-Wzm08nr+JPx4jMOa9CGqxWYDQ-_D4wtPBiKghXAUiUy-nQ@mail.gmail.com  

M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Avoid order-of-execution problems with ALTER TABLE ADD PRIMARY KEY.

commit   : f4a3fdfbdcd3763c42111318d004c2e90d072021    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2019 12:25:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2019 12:25:27 -0400    

Click here for diff

Up to now, DefineIndex() was responsible for adding attnotnull constraints  
to the columns of a primary key, in any case where it hadn't been  
convenient for transformIndexConstraint() to mark those columns as  
is_not_null.  It (or rather its minion index_check_primary_key) did this  
by executing an ALTER TABLE SET NOT NULL command for the target table.  
  
The trouble with this solution is that if we're creating the index due  
to ALTER TABLE ADD PRIMARY KEY, and the outer ALTER TABLE has additional  
sub-commands, the inner ALTER TABLE's operations executed at the wrong  
time with respect to the outer ALTER TABLE's operations.  In particular,  
the inner ALTER would perform a validation scan at a point where the  
table's storage might be inconsistent with its catalog entries.  (This is  
on the hairy edge of being a security problem, but AFAICS it isn't one  
because the inner scan would only be interested in the tuples' null  
bitmaps.)  This can result in unexpected failures, such as the one seen  
in bug #15580 from Allison Kaptur.  
  
To fix, let's remove the attempt to do SET NOT NULL from DefineIndex(),  
reducing index_check_primary_key's role to verifying that the columns are  
already not null.  (It shouldn't ever see such a case, but it seems wise  
to keep the check for safety.)  Instead, make transformIndexConstraint()  
generate ALTER TABLE SET NOT NULL subcommands to be executed ahead of  
the ADD PRIMARY KEY operation in every case where it can't force the  
column to be created already-not-null.  This requires only minor surgery  
in parse_utilcmd.c, and it makes for a much more satisfying spec for  
transformIndexConstraint(): it's no longer having to take it on faith  
that someone else will handle addition of NOT NULL constraints.  
  
To make that work, we have to move the execution of AT_SetNotNull into  
an ALTER pass that executes ahead of AT_PASS_ADD_INDEX.  I moved it to  
AT_PASS_COL_ATTRS, and put that after AT_PASS_ADD_COL to avoid failure  
when the column is being added in the same command.  This incidentally  
fixes a bug in the only previous usage of AT_PASS_COL_ATTRS, for  
AT_SetIdentity: it didn't work either for a newly-added column.  
  
Playing around with this exposed a separate bug in ALTER TABLE ONLY ...  
ADD PRIMARY KEY for partitioned tables.  The intent of the ONLY modifier  
in that context is to prevent doing anything that would require holding  
lock for a long time --- but the implied SET NOT NULL would recurse to  
the child partitions, and do an expensive validation scan for any child  
where the column(s) were not already NOT NULL.  To fix that, invent a  
new ALTER subcommand AT_CheckNotNull that just insists that a child  
column be already NOT NULL, and apply that, not AT_SetNotNull, when  
recursing to children in this scenario.  This results in a slightly laxer  
definition of ALTER TABLE ONLY ... SET NOT NULL for partitioned tables,  
too: that command will now work as long as all children are already NOT  
NULL, whereas before it just threw up its hands if there were any  
partitions.  
  
In passing, clean up the API of generateClonedIndexStmt(): remove a  
useless argument, ensure that the output argument is not left undefined,  
update the header comment.  
  
A small side effect of this change is that no-such-column errors in ALTER  
TABLE ADD PRIMARY KEY now produce a different message that includes the  
table name, because they are now detected by the SET NOT NULL step which  
has historically worded its error that way.  That seems fine to me, so  
I didn't make any effort to avoid the wording change.  
  
The basic bug #15580 is of very long standing, and these other bugs  
aren't new in v12 either.  However, this is a pretty significant change  
in the way ALTER TABLE ADD PRIMARY KEY works.  On balance it seems best  
not to back-patch, at least not till we get some more confidence that  
this patch has no new bugs.  
  
Patch by me, but thanks to Jie Zhang for a preliminary version.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/1396E95157071C4EBBA51892C5368521017F2E6E63@G08CNEXMBPEKD02.g08.fujitsu.local  

M src/backend/catalog/index.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/include/nodes/parsenodes.h
M src/include/parser/parse_utilcmd.h
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/identity.out
M src/test/regress/expected/indexing.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/identity.sql
M src/test/regress/sql/indexing.sql

Don't request pretty-printed output from xmlNodeDump().

commit   : c06e3550dc4163c3ff29a87283b605f0beb50bed    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2019 10:51:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Apr 2019 10:51:07 -0400    

Click here for diff

xml.c passed format = 1 to xmlNodeDump(), resulting in sometimes getting  
extra whitespace (newlines + spaces) in the output.  We don't really want  
that, first because whitespace might be semantically significant in some  
XML uses, and second because it happens only very inconsistently.  Only  
one case in our regression tests is affected.  
  
This potentially affects the results of xpath() and the XMLTABLE construct,  
when emitting nodeset values.  
  
Note that the older code in contrib/xml2 doesn't do this; it seems  
to have been an aboriginal bad decision in commit ea3b212fe.  
  
While this definitely seems like a bug to me, the small number of  
complaints to date argues against back-patching a behavioral change.  
Hence, fix in HEAD only, at least for now.  
  
Per report from Jean-Marc Voillequin.  
  
Discussion: https://postgr.es/m/1EC8157EB499BF459A516ADCF135ADCE3A23A9CA@LON-WGMSX712.ad.moodys.net  

M src/backend/utils/adt/xml.c
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_2.out

Fix detection of passwords hashed with MD5 or SCRAM-SHA-256

commit   : ccae190b916f27fbe4079ee4664d34cd1be47b79    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Apr 2019 15:43:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Apr 2019 15:43:21 +0900    

Click here for diff

This commit fixes a couple of issues related to the way password  
verifiers hashed with MD5 or SCRAM-SHA-256 are detected, leading to  
being able to store in catalogs passwords which do not follow the  
supported hash formats:  
- A MD5-hashed entry was checked based on if its header uses "md5" and  
if the string length matches what is expected.  Unfortunately the code  
never checked if the hash only used hexadecimal characters, as reported  
by Tom Lane.  
- A SCRAM-hashed entry was checked based on only its header, which  
should be "SCRAM-SHA-256$", but it never checked for any fields  
afterwards, as reported by Jonathan Katz.  
  
Backpatch down to v10, which is where SCRAM has been introduced, and  
where password verifiers in plain format have been removed.  
  
Author: Jonathan Katz  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/crypt.c
M src/include/common/md5.h
M src/include/libpq/scram.h
M src/test/regress/expected/password.out
M src/test/regress/sql/password.sql

Convert gist to compute page level xid horizon on primary.

commit   : b5f58cf213bdab7e726f7b09c1137b4ea397fc0b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Apr 2019 14:28:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Apr 2019 14:28:30 -0700    

Click here for diff

Due to parallel development, gist added the missing conflict  
information in c952eae52a3, while 558a9165e08 moved that computation  
to the primary for the index types that already had it.  Thus adapt  
gist to also compute on the primary, using  
index_compute_xid_horizon_for_tuples() instead of its own copy of the  
logic.  
  
This also adds pg_waldump support for XLOG_GIST_DELETE records, which  
previously was not properly present.  
  
Bumps WAL version.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/access/xlog_internal.h

Fix documentation of pg_start_backup and pg_stop_backup functions.

commit   : b804c1837b55722369d30be707738c098a75cd7a    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 23 Apr 2019 02:41:58 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 23 Apr 2019 02:41:58 +0900    

Click here for diff

This commit adds the description that "non-exclusive" pg_start_backup  
and pg_stop_backup can be executed even during recovery. Previously  
it was wrongly documented that those functions are not allowed to be  
executed during recovery.  
  
Back-patch to 9.6 where non-exclusive backup API was added.  
  
Discussion: https://postgr.es/m/CAHGQGwEuAYrEX7Yhmf2MCrTK81HDkkg-JqsOUh8zw6+zYC5zzw@mail.gmail.com  

M doc/src/sgml/func.sgml

Fix mvdistinct and dependencies size calculations

commit   : d08c44f7a4ec574110bf1587fe8bd682b8557e0f    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 21 Apr 2019 19:54:15 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 21 Apr 2019 19:54:15 +0200    

Click here for diff

The formulas used to calculate size while (de)serializing mvndistinct  
and functional dependencies were based on offset() of the structs. But  
that is incorrect, because the structures are not copied directly, we  
we copy the individual fields directly.  
  
At the moment this works fine, because there is no alignment padding  
on any platform we support. But it might break if we ever added some  
fields into any of the structs, for example. It's also confusing.  
  
Fixed by reworking the macros to directly sum sizes of serialized  
fields. The macros are now useful only for serialiation, so there is  
no point in keeping them in the public header file. So make them  
private by moving them to the .c files.  
  
Also adds a couple more asserts to check the serialization, and fixes  
an incorrect allocation of MVDependency instead of (MVDependency *).  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c
M src/include/statistics/statistics.h

docs: reorder collation regression test order in paragraph

commit   : bfbc150e39515c08a5691c7da4291d1b9f2b2b9c    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 20 Apr 2019 11:18:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 20 Apr 2019 11:18:43 -0400    

Click here for diff

Backpatch-through: 10  

M doc/src/sgml/regress.sgml

GSSAPI: Improve documentation and tests

commit   : eb882a1b717589777e068dc6671830226f3aa7f0    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 19 Apr 2019 21:22:22 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 19 Apr 2019 21:22:22 -0400    

Click here for diff

The GSSAPI encryption patch neglected to update the protocol  
documentation to describe how to set up a GSSAPI encrypted connection  
from a client to the server, so fix that by adding the appropriate  
documentation to protocol.sgml.  
  
The tests added for encryption support were overly long and couldn't be  
run in parallel due to race conditions; this was largely because each  
test was setting up its own KDC to perform the tests.  Instead, merge  
the authentication tests and the encryption tests into the original  
test, where we only create one KDC to run the tests with.  Also, have  
the tests check what the server's opinion is of the connection and if it  
was GSS authenticated or encrypted using the pg_stat_gssapi view.  
  
In passing, fix the libpq label for GSSENC-Mode to be consistent with  
the "PGGSSENCMODE" environment variable.  
  
Missing protocol documentation pointed out by Michael Paquier.  
Issues with the tests pointed out by Tom Lane and Peter Eisentraut.  
  
Refactored tests and added documentation by me.  
  
Reviewed by Robbie Harwood (protocol documentation) and Michael Paquier  
(rework of the tests).  

M doc/src/sgml/protocol.sgml
M src/interfaces/libpq/fe-connect.c
M src/test/kerberos/t/001_auth.pl
D src/test/kerberos/t/002_enc.pl

Fix slot type issue for fuzzy distance index scan over out-of-core table AM.

commit   : b8b94ea129ffc988c2d30eb2b5aa65a93329b8fa    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Apr 2019 11:25:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Apr 2019 11:25:48 -0700    

Click here for diff

For amcanreorderby scans the nodeIndexscan.c's reorder queue holds  
heap tuples, but the underlying table likely does not. Before this fix  
we'd return different types of slots, depending on whether the tuple  
came from the reorder queue, or from the index + table.  
  
While that could be fixed by signalling that the node doesn't return a  
fixed type of slot, it seems better to instead remove the separate  
slot for the reorder queue, and use ExecForceStoreHeapTuple() to store  
tuples from the queue. It's not particularly common to need  
reordering, after all.  
  
This reverts most of the iss_ReorderQueueSlot related changes to  
nodeIndexscan.c made in 1a0586de3657cd3, except that now  
ExecForceStoreHeapTuple() is used instead of ExecStoreHeapTuple().  
  
Noticed when testing zheap against the in-core version of tableam.  
  
Author: Andres Freund  

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

Fix two memory leaks around force-storing tuples in slots.

commit   : 88e6ad3054ddd5aa0dee12e5def2c335fe92a414    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Apr 2019 11:33:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Apr 2019 11:33:37 -0700    

Click here for diff

As reported by Tom, when ExecStoreMinimalTuple() had to perform a  
conversion to store the minimal tuple in the slot, it forgot to  
respect the shouldFree flag, and leaked the tuple into the current  
memory context if true.  Fix that by freeing the tuple in that case.  
  
Looking at the relevant code made me (Andres) realize that not having  
the shouldFree parameter to ExecForceStoreHeapTuple() was a bad  
idea. Some callers had to locally implement the necessary logic, and  
in one case it was missing, creating a potential per-group leak in  
non-hashed aggregation.  
  
The choice to not free the tuple in ExecComputeStoredGenerated() is  
not pretty, but not introduced by this commit - I'll start a separate  
discussion about it.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/trigger.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/tuptable.h

Fix problems with auto-held portals.

commit   : 4d5840cea96d7f893389664dd423716b38fded7a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Apr 2019 11:20:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Apr 2019 11:20:37 -0400    

Click here for diff

HoldPinnedPortals() did things in the wrong order: it must not mark  
a portal autoHeld until it's been successfully held.  Otherwise,  
a failure while persisting the portal results in a server crash  
because we think the portal is in a good state when it's not.  
  
Also add a check that portal->status is READY before attempting to  
hold a pinned portal.  We have such a check before the only other  
use of HoldPortal(), so it seems unwise not to check it here.  
  
Lastly, rethink the responsibility for where to call HoldPinnedPortals.  
The comment for it imagined that it was optional for any individual PL  
to call it or not, but that cannot be the case: if some outer level of  
procedure has a pinned portal, failing to persist it when an inner  
procedure commits is going to be trouble.  Let's have SPI do it instead  
of the individual PLs.  That's not a complete solution, since in theory  
a PL might not be using SPI to perform commit/rollback, but such a PL  
is going to have to be aware of lots of related requirements anyway.  
(This change doesn't cause an API break for any external PLs that might  
be calling HoldPinnedPortals per the old regime, because calling it  
twice during a commit or rollback sequence won't hurt.)  
  
Per bug #15703 from Julian Schauder.  Back-patch to v11 where this code  
came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/spi.c
M src/backend/utils/mmgr/portalmem.c
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql
M src/pl/plpython/plpy_plpymodule.c

Fix collection of typos and grammar mistakes in docs and comments

commit   : 148266fa354a47543f6c0325cd1ea900ead4aac6    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Apr 2019 16:57:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Apr 2019 16:57:40 +0900    

Click here for diff

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

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/ref/create_index.sgml
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/optimizer/plan/planner.c
M src/backend/utils/hash/dynahash.c
M src/interfaces/libpq/fe-auth.c

Clean up some documentation for log_statement_sample_rate

commit   : bc540f98599b875e7ee67086291cdb96997db3fc    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Apr 2019 16:26:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Apr 2019 16:26:41 +0900    

Click here for diff

This was missing from 88bdbd3.  
  
Author: Christoph Berg, Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Remove dependency to pageinspect in recovery tests

commit   : 5a9323eab6e2c47e4caee9ab4b5117ba01368253    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Apr 2019 15:51:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Apr 2019 15:51:23 +0900    

Click here for diff

If contrib/pageinspect is not installed, this causes the test checking  
the minimum recovery point to fail.  The point is that the dependency  
with pageinspect is not really necessary as the test does also all  
checks with an offline cluster by scanning directly the on-disk pages,  
which is enough for the purpose of the test.  
  
Per complaint from Tom Lane.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/Makefile
M src/test/recovery/t/016_min_consistency.pl

Fix potential use-after-free for BEFORE UPDATE row triggers on non-core AMs.

commit   : 75e03eabeaac8fd229b14f74de55d0e1470903c4    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 18 Apr 2019 17:53:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 18 Apr 2019 17:53:54 -0700    

Click here for diff

When such a trigger returns the old row version, it naturally get  
stored in the slot for the trigger result. When a table AMs doesn't  
store HeapTuples internally, ExecBRUpdateTriggers() frees the old row  
version passed to triggers - but before this fix it might still be  
referenced by the slot holding the new tuple.  
  
Noticed when running the out-of-core zheap AM against the in-core  
version of tableam.  
  
Author: Andres Freund  

M src/backend/commands/trigger.c

Fix handling of temp and unlogged tables in FOR ALL TABLES publications

commit   : bb385c4fb0f4eb33d2bc7e484061565ba51cc790    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Apr 2019 10:37:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Apr 2019 10:37:44 +0200    

Click here for diff

If a FOR ALL TABLES publication exists, temporary and unlogged tables  
are ignored for publishing changes.  But CheckCmdReplicaIdentity()  
would still check in that case that such a table has a replica  
identity set before accepting updates.  To fix, have  
GetRelationPublicationActions() return that such a table publishes no  
actions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/utils/cache/relcache.c
M src/test/subscription/t/100_bugs.pl

docs: correct typo-ed path to heapam_handler.c.

commit   : 1cebfdee0087624af2fc99a000642c2db4dfbfc9    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 17 Apr 2019 17:31:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 17 Apr 2019 17:31:54 -0700    

Click here for diff

Reported-By: Michael Paquier, Michel Pelletier  
Discussion:  
   https://postgr.es/m/[email protected]  
   https://postgr.es/m/CACxu=v+u_QTeFqdajCHv3i4QmzV_63arVb57R19dSKtThdSLkQ@mail.gmail.com  

M doc/src/sgml/tableam.sgml

pg_dump: Remove stray option parsing support for -o.

commit   : 4d0183592764629d38182e30642b1aef8baeb987    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 17 Apr 2019 17:28:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 17 Apr 2019 17:28:02 -0700    

Click here for diff

I (Andres) missed this in 578b229718e8f, the removal of WITH OIDS  
support.  
  
Author: Daniel Verite  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

docs: cleanup/remove/update references to OID column.

commit   : f6b39171f3d65155b9390c2c69bc5b3469f923a8    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 17 Apr 2019 17:22:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 17 Apr 2019 17:22:56 -0700    

Click here for diff

I (Andres) missed these in 578b229718e8f.  
  
Author: Justin Pryzby, editorialized a bit by Andres Freund  
Reviewed-By: Daniel Verite, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/spi.sgml

Tie loose ends in psql's new \dP command

commit   : 421a2c48328c88eb31f6b29979218f0a350bb739    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 17 Apr 2019 18:35:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 17 Apr 2019 18:35:41 -0400    

Click here for diff

* Remove one unnecessary pg_class join in SQL command.  Not needed,  
  because we use a regclass cast instead.  
  
* Doc: refer to "partitioned relations" rather than specifically tables,  
  since indexes are also displayed.  
  
* Rename "On table" column to "Table", for consistency with \di.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/describe.c
M src/test/regress/expected/psql.out

psql: display tablespace for partitioned indexes

commit   : b036982db786f7ef6c118419e7e832167ad4a6a7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 17 Apr 2019 18:17:43 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 17 Apr 2019 18:17:43 -0400    

Click here for diff

Nothing was shown previously.  

M src/bin/psql/describe.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

postgresql.conf.sample: add proper defaults for include actions

commit   : fb9c475597c245562a28d1e916b575ac4ec5c19f    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 17 Apr 2019 18:12:10 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 17 Apr 2019 18:12:10 -0400    

Click here for diff

Previously, include actions include_dir, include_if_exists, and include  
listed commented-out values which were not the defaults, which is  
inconsistent with other entries.  Instead, replace them with '', which  
is the default value.  
  
Reported-by: Emanuel Araújo  
  
Discussion: https://postgr.es/m/CAMuTAkYMx6Q27wpELDR3_v9aG443y7ZjeXu15_+1nGUjhMWOJA@mail.gmail.com  
  
Backpatch-through: 9.4  

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

docs: clarify pg_upgrade's recovery behavior

commit   : 64bbe1039962a75cb292fb557e2e79a58c77ec33    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 17 Apr 2019 18:01:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 17 Apr 2019 18:01:02 -0400    

Click here for diff

The previous paragraph trying to explain --check, --link, and no --link  
modes and the various points of failure was too complex.  Instead, use  
bullet lists and sublists.  
  
Reported-by: Daniel Gustafsson  
  
Discussion: https://postgr.es/m/qtqiv7hI87s_Xvz5ZXHCaH-1-_AZGpIDJowzlRjF3-AbCr3RhSNydM_JCuJ8DE4WZozrtxhIWmyYTbv0syKyfGB6cYMQitp9yN-NZMm-oAo=@yesql.se  
  
Backpatch-through: 9.4  

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

Fix unportable code in pgbench.

commit   : 1a75c1d0c5d967ea2adcd7129092687cded4e7bf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Apr 2019 17:30:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Apr 2019 17:30:29 -0400    

Click here for diff

The buildfarm points out that UINT64_FORMAT might not work with sscanf;  
it's calibrated for our printf implementation, which might not agree  
with the platform-supplied sscanf.  Fall back to just accepting an  
unsigned long, which is already more than the documentation promises.  
  
Oversight in e6c3ba7fb; back-patch to v11, as that was.  

M src/bin/pgbench/pgbench.c

Fix assorted minor bogosity in GSSAPI transport error messages.

commit   : 8cde7f49483d7e21569f61108fc80a8fe9e83e56    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Apr 2019 17:06:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Apr 2019 17:06:50 -0400    

Click here for diff

I noted that some buildfarm members were complaining about %ld being  
used to format values that are (probably) declared size_t.  Use %zu  
instead, and insert a cast just in case some versions of the GSSAPI  
API declare the length field differently.  While at it, clean up  
gratuitous differences in wording of equivalent messages, show  
the complained-of length in all relevant messages not just some,  
include trailing newline where needed, adjust random deviations  
from project-standard code layout and message style, etc.  

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

Minor jsonpath fixes.

commit   : b4f96d69ad197731c1f5b959e1234c9ba3517ecb    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Apr 2019 13:37:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Apr 2019 13:37:00 -0400    

Click here for diff

Restore missed "make clean" rule, fix misspelling.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CACPNZCt5B8jDCCGQiFoSuqmg-za_NCy4QDioBTLaNRih9+-bXg@mail.gmail.com  

M src/backend/utils/adt/Makefile
M src/backend/utils/adt/jsonpath_scan.l

Return NULL for checksum failures if checksums are not enabled

commit   : 252b707bc41cc9bf6c55c18d8cb302a6176b7e48    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 17 Apr 2019 13:51:48 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 17 Apr 2019 13:51:48 +0200    

Click here for diff

Returning 0 could falsely indicate that there is no problem. NULL  
correctly indicates that there is no information about potential  
problems.  
  
Also return 0 as numbackends instead of NULL for shared objects (as no  
connection can be made to a shared object only).  
  
Author: Julien Rouhaud <[email protected]>  
Reviewed-by: Robert Treat <[email protected]>  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/pgstatfuncs.c
M src/test/regress/expected/rules.out

Fix thinko introduced by 82a5649 in slot.c

commit   : 9010156445c420361c2cef9557751c0b8b52644b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Apr 2019 10:01:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Apr 2019 10:01:22 +0900    

Click here for diff

When saving a replication slot, failing to close the temporary path used  
to save the slot information is considered as a failure and reported as  
such.  However the code forgot to leave immediately as other failure  
paths do.  
  
Noticed while looking up at this area of the code for another patch.  

M src/backend/replication/slot.c

Simplify some ERROR paths clearing wait events and transient files

commit   : 47ac2033d460cefbbda2e39732e18de521dc6a36    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Apr 2019 09:51:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Apr 2019 09:51:45 +0900    

Click here for diff

Transient files and wait events get normally cleaned up when seeing an  
exception (be it in the context of a transaction for a backend or  
another process like the checkpointer), hence there is little point in  
complicating error code paths to do this work.  This shaves a bit of  
code, and removes some extra handling with errno which needed to be  
preserved during the cleanup steps done.  
  
Reported-by: Masahiko Sawada  
Author: Michael Paquier  
Reviewed-by: Tom Lane, Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDhHYVq5KkXfkaHhmjA-zJYj-e4teiRAJefvXuKJz1tKQ@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slot.c
M src/backend/storage/file/copydir.c

Rework handling of invalid indexes with REINDEX CONCURRENTLY

commit   : a6dcf9df4d91ff0db23579f9114079abe6f3e2bf    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Apr 2019 09:33:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Apr 2019 09:33:51 +0900    

Click here for diff

Per discussion with others, allowing REINDEX INDEX CONCURRENTLY to work  
for invalid indexes when working directly on them can have a lot of  
value to unlock situations with invalid indexes without having to use a  
dance involving DROP INDEX followed by an extra CREATE INDEX  
CONCURRENTLY (which would not work for indexes with constraint  
dependency anyway).  This also does not create extra bloat on the  
relation involved as this works on individual indexes, so let's enable  
it.  
  
Note that REINDEX TABLE CONCURRENTLY still bypasses invalid indexes as  
we don't want to bloat the number of indexes defined on a relation in  
the event of multiple and successive failures of REINDEX CONCURRENTLY.  
  
More regression tests are added to cover those behaviors, using an  
invalid index created with CREATE INDEX CONCURRENTLY.  
  
Reported-by: Dagfinn Ilmari Mannsåker, Álvaro Herrera  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut, Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/reindex.sgml
M src/backend/commands/indexcmds.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Add index terms for reloptions in documentation.

commit   : c8e0f6bbdb5ff0f235246af5b567b21dcfc1d22a    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 16 Apr 2019 23:16:20 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 16 Apr 2019 23:16:20 +0900    

Click here for diff

Author: Fujii Masao  
Reviewed-By: Alvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/CAHGQGwHyKt9-xkibVguPzYqKgb_2tdw14Ub1XDTu08kyHMiTQA@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml

Better scaling of images in HTML output

commit   : e446cde16d676b528f3aa91dcbe5bb9c5a3776d8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Apr 2019 14:27:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Apr 2019 14:27:56 +0200    

Click here for diff

Turn on the previously disabled automatic scaling of images in HTML  
output.  To avoid images looking too large on nowadays-normal screens,  
restrict the width to 75% on such screens.  
  
Some work is still necessary because SVG images without a viewBox  
still won't scale, but that will a separate patch.  
  
Discussion: https://www.postgresql.org/message-id/flat/6d2442d1-84a2-36ef-e014-b6d1ece8a139%40postgresql.org  

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

Remove duplicate assignment when initializing logical decoder context

commit   : 5ed4b123b6a678bc6243047846870f7f46e9c67b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 16 Apr 2019 15:08:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 16 Apr 2019 15:08:38 +0900    

Click here for diff

The private data in the WAL reader is already getting set when  
allocating it.  
  
Author: Antonin Houska  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/30563.1555329094@localhost  

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

Don't write to stdin of a test process that could have already exited.

commit   : e12a4726127b90b8fc5e75690fe4527f1866412d    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 15 Apr 2019 18:13:44 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 15 Apr 2019 18:13:44 -0700    

Click here for diff

Instead, close that stdin.  Per buildfarm member conchuela.  Back-patch  
to 9.6, where the test was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/017_shm.pl

Use [FLEXIBLE_ARRAY_MEMBER] not [1] in MultiSortSupportData.

commit   : dde7fb7836c7428f79cb3cd88ca5febb802e767e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Apr 2019 19:32:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Apr 2019 19:32:36 -0400    

Click here for diff

This struct seems to have not gotten the word about preferred  
coding style for variable-length arrays.  

M src/include/statistics/extended_stats_internal.h

Convert pre-existing stats_ext tests to new style

commit   : dbb984128ebf6b4bd6f12b4579ee9103ef1ca749    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 16 Apr 2019 00:02:22 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 16 Apr 2019 00:02:22 +0200    

Click here for diff

The regression tests added in commit 7300a69950 test cardinality  
estimates using a function that extracts the interesting pieces  
from the EXPLAIN output, instead of testing the whole plan. That  
seems both easier to understand and less fragile, so this applies  
the same approach to pre-existing tests of ndistinct coefficients  
and functional dependencies.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix pg_mcv_list deserialization

commit   : 3824ca30d162611fdaade403d3aec449fecd0924    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 16 Apr 2019 00:01:39 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 16 Apr 2019 00:01:39 +0200    

Click here for diff

The memcpy() was copying type OIDs in the wrong direction, so the  
deserialized MCV list always had them as 0. This is mostly harmless  
except when printing the data in pg_mcv_list_items(), in which case  
it reported  
  
    ERROR:  cache lookup failed for type 0  
  
Also added a simple regression test for pg_mcv_list_items() function,  
printing a single-item MCV list.  
  
Reported-By: Dean Rasheed  
Discussion: https://postgr.es/m/CAEZATCX6T0iDTTZrqyec4Cd6b4yuL7euu4=rQRXaVBAVrUi1Cg@mail.gmail.com  

M src/backend/statistics/mcv.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix failure with textual partition hash keys.

commit   : 4b40e44f07c727c7a82b291d3b60098dd99f3f64    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Apr 2019 16:47:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Apr 2019 16:47:09 -0400    

Click here for diff

Commit 5e1963fb7 overlooked two places in partbounds.c that now  
need to pass a collation identifier to the hash functions for  
a partition key column.  
  
Amit Langote, per report from Jesper Pedersen  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/hash_part.out
M src/test/regress/sql/hash_part.sql

Avoid possible regression test instability in timestamp.sql.

commit   : 47169c25500a70a7d04076860717f2f4f0ea83a7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Apr 2019 16:19:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Apr 2019 16:19:51 -0400    

Click here for diff

Concurrent autovacuum could result in a change in the order of the  
live rows in timestamp_tbl.  While this would not happen with the  
default autovacuum parameters, it's fairly easy to hit if  
autovacuum_vacuum_threshold is made small enough to allow autovac  
to decide to process this table.  That's a stumbling block for trying  
to exercise autovacuum aggressively using the core regression tests.  
  
To fix, replace an unqualified DELETE with a TRUNCATE.  There's a  
similar DELETE just above (and no order-sensitive queries between),  
so this doesn't lose any test coverage and might indeed be argued  
to improve it.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix division by zero in _bt_vacuum_needs_cleanup()

commit   : 1e871981823a68ec9e0174b652e8d27e05ce08bb    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 15 Apr 2019 20:20:43 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 15 Apr 2019 20:20:43 +0300    

Click here for diff

Checks inside _bt_vacuum_needs_cleanup() allow division by zero to happen when  
metad->btm_last_cleanup_num_heap_tuples == 0.  This commit adjusts the  
expression so that no division by zero might happen.  
  
Reported-by: Piotr Stefaniak  
Discussion: https://postgr.es/m/DB8PR03MB5931C41F7787A95313F08322F22A0%40DB8PR03MB5931.eurprd03.prod.outlook.com  
Reviewed-by: Masahiko Sawada  
Backpatch-through: 11  

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

Fix thinko in ExecCleanupTupleRouting().

commit   : 3a45321a491711b556d2cf8f6904ab989b9d0b08    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 15 Apr 2019 19:01:09 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 15 Apr 2019 19:01:09 +0900    

Click here for diff

Commit 3f2393edef changed ExecCleanupTupleRouting() so that it skipped  
cleaning up subplan resultrels before calling EndForeignInsert(), but  
that would cause an issue: when those resultrels were foreign tables,  
the FDWs would fail to shut down.  Repair by skipping it after calling  
EndForeignInsert() as before.  
  
Author: Etsuro Fujita  
Reviewed-by: David Rowley and Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c

Unbreak index optimization for LIKE on bytea

commit   : abb9c63b2c00109183cdb9f588d2f23fc383ed38    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Apr 2019 09:26:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Apr 2019 09:26:23 +0200    

Click here for diff

The same code is used to handle both text and bytea, but bytea is not  
collation-aware, so we shouldn't call get_collation_isdeterministic()  
in that case, since that will error out with an invalid collation.  
  
Reported-by: Jeevan Chalke <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAM2%2B6%3DWaf3qJ1%3DyVTUH8_yG-SC0xcBMY%2BSFLhvKKNnWNXSUDBw%40mail.gmail.com  

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

Fix SHOW ALL command for non-superusers with replication connection

commit   : c34677fdaa73f089d557554a9cd479b9bd5b5143    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 15 Apr 2019 12:34:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 15 Apr 2019 12:34:32 +0900    

Click here for diff

Since Postgres 10, SHOW commands can be triggered with replication  
connections in a WAL sender context, however it missed that a  
transaction context is needed for syscache lookups.  This commit makes  
sure that the syscache lookups can happen correctly by setting a  
transaction context when running SHOW commands in a WAL sender.  
  
Superuser-only parameters can be displayed using SHOW commands not only  
to superusers, but also to members of system role pg_read_all_settings,  
which requires a syscache lookup to check if the connected role is a  
member of this system role or not, or the instance crashes.  Superusers  
do not need to check the syscache so it worked correctly in this case.  
  
New tests are added to cover this issue.  
  
Reported-by: Alexander Kukushkin  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

Test both 0.0.0.0 and 127.0.0.x addresses to find a usable port.

commit   : 4ab02e8156270592c1eae03d5b9ee36bb8c761c2    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 14 Apr 2019 20:02:19 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 14 Apr 2019 20:02:19 -0700    

Click here for diff

Commit c098509927f9a49ebceb301a2cb6a477ecd4ac3c changed  
PostgresNode::get_new_node() to probe 0.0.0.0 instead of 127.0.0.1, but  
the new test was less effective for Windows native Perl.  This increased  
the failure rate of buildfarm members bowerbird and jacana.  Instead,  
test 0.0.0.0 and concrete addresses.  This restores the old level of  
defense, but the algorithm is still subject to its longstanding time of  
check to time of use race condition.  Back-patch to 9.6, like the  
previous change.  
  
Discussion: https://postgr.es/m/GrdLgAdUK9FdyZg8VIcTDKVOkys122ZINEb3CjjoySfGj2KyPiMKTh1zqtRp0TAD7FJ27G-OBB3eplxIB5GhcQH5o8zzGZfp0MuJaXJxVxk=@yesql.se  

M src/test/perl/PostgresNode.pm

Switch TAP tests of pg_rewind to use non-superuser role, take two

commit   : d9f543e9e9be15f92abdeaf870e57ef289020191    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 14 Apr 2019 18:47:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 14 Apr 2019 18:47:51 +0900    

Click here for diff

Up to now the tests of pg_rewind have been using a superuser for all its  
tests (which is the default of many tests actually, and something that  
ought to be reviewed) when involving an online source server, still it  
is possible to use a non-superuser role to do that as long as this role  
is granted permissions to execute all the source-side functions used for  
the rewind.  This is possible since v11, and was already documented as  
of bfc8068.  
  
PostgresNode::init is extended so as callers of this routine can add  
extra options to configure the authentication of a new node, which gets  
used by this commit, and allows the tests to work properly on Windows  
where SSPI is used.  
  
This will allow to catch up easily any change in pg_rewind if the tool  
begins to use more backend-side functions, so as the properties  
introduced by v11 are kept.  
  
Per suggestion from Peter Eisentraut.  
  
Author: Michael Paquier  
Reviewed-by: Magnus Hagander  
Discussion: https://postgr.es/m/[email protected]  

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

MSYS: Translate REGRESS_SHLIB to a Windows file name.

commit   : 9daefff1226087602d25837b6b30154b3a916ea8    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 14 Apr 2019 00:42:34 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 14 Apr 2019 00:42:34 -0700    

Click here for diff

Per buildfarm member jacana.  Back-patch to v11; earlier branches skip  
the affected test under msys.  
  
Discussion: https://postgr.es/m/GrdLgAdUK9FdyZg8VIcTDKVOkys122ZINEb3CjjoySfGj2KyPiMKTh1zqtRp0TAD7FJ27G-OBB3eplxIB5GhcQH5o8zzGZfp0MuJaXJxVxk=@yesql.se  

M src/test/recovery/t/017_shm.pl

When Perl "kill(9, ...)" fails, try "pg_ctl kill".

commit   : 947a35014fdc2ec74cbf06c7dbac6eea6fae90c6    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 13 Apr 2019 11:09:27 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 13 Apr 2019 11:09:27 -0700    

Click here for diff

Per buildfarm member jacana, the former fails under msys Perl 5.8.8.  
Back-patch to 9.6, like the code in question.  
  
Discussion: https://postgr.es/m/GrdLgAdUK9FdyZg8VIcTDKVOkys122ZINEb3CjjoySfGj2KyPiMKTh1zqtRp0TAD7FJ27G-OBB3eplxIB5GhcQH5o8zzGZfp0MuJaXJxVxk=@yesql.se  

M src/test/perl/PostgresNode.pm

Prevent memory leaks associated with relcache rd_partcheck structures.

commit   : 5f1433ac5e7f943b29ef01266b6b8fc915e6b917    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Apr 2019 13:22:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Apr 2019 13:22:26 -0400    

Click here for diff

The original coding of generate_partition_qual() just copied the list  
of predicate expressions into the global CacheMemoryContext, making it  
effectively impossible to clean up when the owning relcache entry is  
destroyed --- the relevant code in RelationDestroyRelation() only managed  
to free the topmost List header :-(.  This resulted in a session-lifespan  
memory leak whenever a table partition's relcache entry is rebuilt.  
Fortunately, that's not normally a large data structure, and rebuilds  
shouldn't occur all that often in production situations; but this is  
still a bug worth fixing back to v10 where the code was introduced.  
  
To fix, put the cached expression tree into its own small memory context,  
as we do with other complicated substructures of relcache entries.  
Also, deal more honestly with the case that a partition has an empty  
partcheck list; while that probably isn't a case that's very interesting  
for production use, it's legal.  
  
In passing, clarify comments about how partitioning-related relcache  
data structures are managed, and add some Asserts that we're not leaking  
old copies when we overwrite these data fields.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partdesc.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/include/utils/rel.h

Consistently test for in-use shared memory.

commit   : c098509927f9a49ebceb301a2cb6a477ecd4ac3c    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 12 Apr 2019 22:36:38 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 12 Apr 2019 22:36:38 -0700    

Click here for diff

postmaster startup scrutinizes any shared memory segment recorded in  
postmaster.pid, exiting if that segment matches the current data  
directory and has an attached process.  When the postmaster.pid file was  
missing, a starting postmaster used weaker checks.  Change to use the  
same checks in both scenarios.  This increases the chance of a startup  
failure, in lieu of data corruption, if the DBA does "kill -9 `head -n1  
postmaster.pid` && rm postmaster.pid && pg_ctl -w start".  A postmaster  
will no longer stop if shmat() of an old segment fails with EACCES.  A  
postmaster will no longer recycle segments pertaining to other data  
directories.  That's good for production, but it's bad for integration  
tests that crash a postmaster and immediately delete its data directory.  
Such a test now leaks a segment indefinitely.  No "make check-world"  
test does that.  win32_shmem.c already avoided all these problems.  In  
9.6 and later, enhance PostgresNode to facilitate testing.  Back-patch  
to 9.4 (all supported versions).  
  
Reviewed (in earlier versions) by Daniel Gustafsson and Kyotaro HORIGUCHI.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/init/postinit.c
M src/include/storage/ipc.h
M src/include/storage/pg_shmem.h
M src/test/perl/PostgresNode.pm
A src/test/recovery/t/017_shm.pl
M src/tools/msvc/vcregress.pl

Revert "Switch TAP tests of pg_rewind to use a role with minimal permissions"

commit   : db8db624e826efbe16aab1ae921bae071f98f099    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 13 Apr 2019 13:20:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 13 Apr 2019 13:20:21 +0900    

Click here for diff

This reverts commit d4e2a84, which added a new user with limited  
permissions to run the TAP tests of pg_rewind.  Buildfarm machine  
members on Windows jacana and bowerbird have been complaining about  
that, the new role not being able to run the rewind because SSPI is not  
configured to allow it.  
  
Fixing the test requires passing down directly the new user to  
pg_regress with --create-role so as SSPI can work properly.  
  
Reported-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/t/RewindTest.pm

Show shared object statistics in pg_stat_database

commit   : 77bd49adba4711b4497e7e39a5ec3a9812cbd52a    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 12 Apr 2019 14:04:50 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 12 Apr 2019 14:04:50 +0200    

Click here for diff

This adds a row to the pg_stat_database view with datoid 0 and datname  
NULL for those objects that are not in a database. This was added  
particularly for checksums, but we were already tracking more satistics  
for these objects, just not returning it.  
  
Also add a checksum_last_failure column that holds the timestamptz of  
the last checksum failure that occurred in a database (or in a  
non-dataabase file), if any.  
  
Author: Julien Rouhaud <[email protected]>  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/catalog/system_views.sql
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Fix REINDEX CONCURRENTLY of partitions

commit   : ef6f30fe77af69a8c775cca82bf993b10c9889ee    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 Apr 2019 08:36:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 Apr 2019 08:36:05 +0200    

Click here for diff

In case of a partition index, when swapping the old and new index, we  
also need to attach the new index as a partition and detach the old  
one.  Also, to handle partition indexes, we not only need to change  
dependencies referencing the index, but also dependencies of the index  
referencing something else.  The previous code did this only  
specifically for a constraint, but we also need to do this for  
partitioned indexes.  So instead write a generic function that does it  
for all dependencies.  
  
Author: Michael Paquier <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/DF4PR8401MB11964EDB77C860078C343BEBEE5A0%40DF4PR8401MB1196.NAMPRD84.PROD.OUTLOOK.COM#154df1fedb735190a773481765f7b874  

M src/backend/catalog/index.c
M src/backend/catalog/pg_depend.c
M src/include/catalog/dependency.h
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Fix GetNewTransactionId()'s interaction with xidVacLimit.

commit   : f7feb020c3d8d5aff24204af28359b99ee65bf8f    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 12 Apr 2019 14:53:38 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 12 Apr 2019 14:53:38 +1200    

Click here for diff

Commit ad308058 switched to returning a FullTransactionId, but  
failed to load the potentially updated value in the case where  
xidVacLimit is reached and we release and reacquire the lock.  
Repair, closing bug #15727.  
  
While reviewing that commit, also fix the size computation used  
by EstimateTransactionStateSize() and switch to the mul_size()  
macro traditionally used in such expressions.  
  
Author: Thomas Munro  
Reported-by: Roman Zharkov  
Discussion: https://postgr.es/m/15727-0be246e7d852d229%40postgresql.org  

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

Fix typos in reloptions.c

commit   : d87ab88686fb60ad5a34373de05bb20e632cf003    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Apr 2019 12:56:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Apr 2019 12:56:38 +0900    

Click here for diff

Author: Kirk Jamison  
Discussion: https://postgr.es/m/D09B13F772D2274BB348A310EE3027C6493463@g01jpexmbkw24  

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

Switch TAP tests of pg_rewind to use a role with minimal permissions

commit   : d4e2a843e6d6f325c070ee80a0c117ec11675e74    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Apr 2019 10:46:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Apr 2019 10:46:43 +0900    

Click here for diff

Up to now the tests of pg_rewind have been using a superuser for all the  
tests (which is the default of many tests actually, and something that  
ought to be reviewed) when involving an online source server, still it  
is possible to use a non-superuser role to do that as long as this role  
is granted permissions to execute all the source-side functions used for  
the rewind.  This is possible since v11, and was already documented as  
of bfc8068.  
  
This will allow to catch up easily any change in pg_rewind if the tool  
begins to use more backend-side functions, so as the properties  
introduced by v11 are kept.  
  
Per suggestion from Peter Eisentraut.  
  
Author: Michael Paquier  
Reviewed-by: Magnus Hagander  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/t/RewindTest.pm

Fix more strcmp() calls using boolean-like comparisons for result checks

commit   : d527fda6216780281b90f48820ae978c61c7905c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Apr 2019 10:16:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Apr 2019 10:16:49 +0900    

Click here for diff

Such calls can confuse the reader as strcmp() uses an integer as result.  
The places patched here have been spotted by Thomas Munro, David Rowley  
and myself.  
  
Author: Michael Paquier  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M contrib/spi/refint.c
M src/backend/commands/lockcmds.c
M src/backend/tsearch/spell.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c

Re-order some regression test scripts for more parallelism.

commit   : 798070ec058fe75757587c9e9916cc35c623f427    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 18:16:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 18:16:50 -0400    

Click here for diff

Move the strings, numerology, insert, insert_conflict, select and  
errors tests to be parts of nearby parallel groups, instead of  
executing by themselves.  (Moving "select" required adjusting the  
constraints test, which uses a table named "tmp" as select also  
does.  There don't seem to be any other conflicts.)  
  
Move psql and stats_ext to the next parallel group, where the rules  
test also has a long runtime.  To make it safe to run stats_ext in  
parallel with rules, I adjusted the latter to only dump views/rules  
from the pg_catalog and public schemas, which was what it was doing  
anyway.  stats_ext makes some views in a transient schema, which now  
will not affect rules.  
  
Reorder serial_schedule to match parallel_schedule.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/input/constraints.source
M src/test/regress/output/constraints.source
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/rules.sql

Speed up sort-order-comparison tests in create_index_spgist.

commit   : 5874c7055702e1cf5e58543f11dfcff6de2cc260    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 17:01:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 17:01:35 -0400    

Click here for diff

This test script verifies that KNN searches of an SP-GiST index  
produce the same sort order as a seqscan-and-sort.  The FULL JOINs  
used for that are exceedingly slow, however.  Investigation shows  
that the problem is that the initial join is on the rank() values,  
and we have a lot of duplicates due to the data set containing 1000  
duplicate points.  We're therefore going to produce 1000000 join  
rows that have to be thrown away again by the join filter.  
  
We can improve matters by using row_number() instead of rank(),  
so that the initial join keys are unique.  The catch is that  
that makes the results sensitive to the sorting of rows with  
equal distances from the reference point.  That doesn't matter  
for the actually-equal points, but as luck would have it, the  
data set also contains two distinct points that have identical  
distances to the origin.  So those two rows could legitimately  
appear in either order, causing unwanted output from the check  
queries.  
  
However, it doesn't seem like it's the job of this test to  
check whether the <-> operator correctly computes distances;  
its charter is just to verify that SP-GiST emits the values  
in distance order.  So we can dodge the indeterminacy problem  
by having the check only compare row numbers and distances  
not the actual point values.  
  
This change reduces the run time of create_index_spgist by a good  
three-quarters, on my machine, with ensuing beneficial effects on  
the runtime of create_index (thanks to interactions with CREATE  
INDEX CONCURRENTLY tests in the latter).  I see a net improvement  
of more than 2X in the runtime of their parallel test group.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Split up a couple of long-running regression test scripts.

commit   : 385d396b807bdd7034ad3d0cea3c921d7cb04faa    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 16:15:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 16:15:54 -0400    

Click here for diff

The point of this change is to increase the potential for parallelism  
while running the core regression tests.  Most people these days are  
using parallel testing modes on multi-core machines, so we might as  
well try a bit harder to keep multiple cores busy.  Hence, a test that  
runs much longer than others in its parallel group is a candidate to  
be sub-divided.  
  
In this patch, create_index.sql and join.sql are split up.  
I haven't changed the content of the tests in any way, just  
moved them.  
  
I moved create_index.sql's SP-GiST-related tests into a new script  
create_index_spgist, and moved its btree multilevel page deletion test  
over to the existing script btree_index.  (btree_index is a more natural  
home for that test, and it's shorter than others in its parallel group,  
so this doesn't hurt total runtime of that group.)  There might be  
room for more aggressive splitting of create_index, but this is enough  
to improve matters considerably.  
  
Likewise, I moved join.sql's "exercises for the hash join code" into  
a new file join_hash.  Those exercises contributed three-quarters of  
the script's runtime.  Which might well be excessive ... but for the  
moment, I'm satisfied with shoving them into a different parallel  
group, where they can share runtime with the roughly-equally-lengthy  
gist test.  
  
(Note for anybody following along at home: there are interesting  
interactions between the runtimes of create_index and anything running  
in parallel with it, because the tests of CREATE INDEX CONCURRENTLY  
in that file will repeatedly block waiting for concurrent transactions  
to commit.  As committed in this patch, create_index and  
create_index_spgist have roughly equal runtimes, but that's mostly an  
artifact of forced synchronization of the CONCURRENTLY tests; when run  
serially, create_index is much faster.  A followup patch will reduce  
the runtime of create_index_spgist and thereby also create_index.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/btree_index.out
M src/test/regress/expected/create_index.out
A src/test/regress/expected/create_index_spgist.out
M src/test/regress/expected/join.out
A src/test/regress/expected/join_hash.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/btree_index.sql
M src/test/regress/sql/create_index.sql
A src/test/regress/sql/create_index_spgist.sql
M src/test/regress/sql/join.sql
A src/test/regress/sql/join_hash.sql

Move plpgsql error-trapping tests to a new module-specific test file.

commit   : 6726d8d476b424633ebdc7068da3f5a6e6da10af    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 15:09:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 15:09:18 -0400    

Click here for diff

The test for statement timeout has a 2-second timeout, which was only  
moderately annoying when it was written, but nowadays it contributes  
a pretty significant chunk of the elapsed time needed to run the core  
regression tests on a fast machine.  We can improve this situation by  
pushing the test into a plpgsql-specific test file instead of having  
it in a core regression test.  That's a clean win when considering  
just the core tests.  Even when considering check-world or a buildfarm  
test run, we should come out ahead because the core tests get run  
more times in those sequences.  
  
Furthermore, since the plpgsql tests aren't currently parallelized,  
it seems likely that the timing problems reflected in commit f1e671a0b  
(which increased that timeout from 1 sec to 2) will be much less severe  
in this context.  Hence, let's try cutting the timeout back to 1 second  
in hopes of a further win for check-world.  We can undo that if  
buildfarm experience proves it to be a bad idea.  
  
To give the new test file some modicum of intellectual coherency,  
I moved the surrounding tests related to error-trapping along with  
the statement timeout test proper.  Those other tests don't run long  
enough to have any particular bearing on test-runtime considerations.  
The tests are the same as before, except with minor adjustments to  
not depend on an externally-created table.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_trap.out
A src/pl/plpgsql/src/sql/plpgsql_trap.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Fix off-by-one check that can lead to a memory overflow in ecpg.

commit   : ed16ba3248d486ec8b2fdfc75e442620d675b617    
  
author   : Michael Meskes <[email protected]>    
date     : Thu, 11 Apr 2019 20:56:17 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Thu, 11 Apr 2019 20:56:17 +0200    

Click here for diff

Patch by Liu Huailing <[email protected]>  

M src/interfaces/ecpg/preproc/pgc.l

Remove duplicative polygon SP-GiST sequencing test.

commit   : 4aaa3b5cf1c33d713b8eefa3612a9112cbcf1074    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 14:35:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 14:35:47 -0400    

Click here for diff

Code coverage comparisons confirm that the tests using  
quad_poly_tbl_ord_seq1/quad_poly_tbl_ord_idx1 hit no code  
paths not also covered by the similar tests using  
quad_poly_tbl_ord_seq2/quad_poly_tbl_ord_idx2.  Since these  
test cases are pretty expensive, they need to contribute more  
than zero benefit.  
  
In passing, make quad_poly_tbl_ord_seq2 a temp table, since  
there seems little reason to keep it around after the test.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/polygon.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/polygon.sql

doc: adjust libpq wording to be neither/nor

commit   : d4888a3f766a7c02a9330c658c76c60e1ab8cc3e    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 11 Apr 2019 13:25:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 11 Apr 2019 13:25:34 -0400    

Click here for diff

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

M doc/src/sgml/libpq.sgml

Remove redundant and ineffective test for btree insertion fast path.

commit   : f72d9a5e7dda5f89336a60e8b720ef9964a67177    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 13:15:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Apr 2019 13:15:59 -0400    

Click here for diff

indexing.sql's test for this feature was added along with the  
feature in commit 2b2727343.  However, shortly later that test was  
rendered ineffective by commit 074251db6, which limited when the  
optimization would be applied, so that the test didn't test it.  
Since then, commit dd299df81 added new tests (in btree_index.sql)  
that actually do test the feature.  Code coverage comparisons  
confirm that this test sequence adds no meaningful coverage, and  
it's rather expensive, accounting for nearly half of the runtime  
of indexing.sql according to my measurements.  So let's remove it.  
  
Per advice from Peter Geoghegan.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix declaration after statement

commit   : 65d857d92c418d732e3531a3761a32f2e352cb35    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 10 Apr 2019 22:28:50 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 10 Apr 2019 22:28:50 -0400    

Click here for diff

This style is frowned upon.  I inadvertently introduced one in commit  
fe0e0b4fc7f0.  (My compiler does not complain about it, even though  
-Wdeclaration-after-statement is specified.  Weird.)  
  
Author: Masahiko Sawada  

M src/bin/pgbench/pgbench.c

Fix backwards test in operator_precedence_warning logic.

commit   : 4cae471d1b6bec7493dcb2ca156382bef738f293    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Apr 2019 19:02:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Apr 2019 19:02:21 -0400    

Click here for diff

Warnings about unary minus might have been wrong.  It's a bit  
surprising that nobody noticed yet ... probably the precedence-warning  
feature hasn't really been used much in the field.  
  
Rikard Falkeborn  
  
Discussion: https://postgr.es/m/CADRDgG6fzA8A2oeygUw4=o7ywo4kvz26NxCSgpq22nMD73Bx4Q@mail.gmail.com  

M src/backend/parser/parse_expr.c

pg_restore: Make not verbose by default

commit   : 765525c8c2c6e55abe8c0cd43bf5c728926d76d4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Apr 2019 11:45:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Apr 2019 11:45:00 +0200    

Click here for diff

This was accidentally changed in  
cc8d41511721d25d557fc02a46c053c0a602fed0.  
  
Reported-by: Christoph Berg <[email protected]>  

M src/bin/pg_dump/pg_restore.c

Avoid counting transaction stats for parallel worker cooperating transaction.

commit   : bdf35744bdf70208fc4d0f4b76f7d4bce3cf326b    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 10 Apr 2019 08:24:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 10 Apr 2019 08:24:15 +0530    

Click here for diff

The transaction that is initiated by the parallel worker to cooperate  
with the actual transaction started by the main backend to complete the  
query execution should not be counted as a separate transaction.  The  
other internal transactions started and committed by the parallel worker  
are still counted as separate transactions as we that is what we do in  
other places like autovacuum.  
  
This will partially fix the bloat in transaction stats due to additional  
transactions performed by parallel workers.  For a complete fix, we need to  
decide how we want to show all the transactions that are started internally  
for various operations and that is a matter of separate patch.  
  
Reported-by: Haribabu Kommi  
Author: Haribabu Kommi  
Reviewed-by: Amit Kapila, Jamison Kirk and Rahila Syed  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/CAJrrPGc9=jKXuScvNyQ+VNhO0FZk7LLAShAJRyZjnedd2D61EQ@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Improve comment in sync.h.

commit   : d614aae02e8f878438716b7fd2642b8240b3f2b3    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 10 Apr 2019 12:49:49 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 10 Apr 2019 12:49:49 +1200    

Click here for diff

Per off-list complaint from Andres Freund.  

M src/include/storage/sync.h

Fix typos.

commit   : 255044889d419354b46a2bf8907b83507d695af5    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 10 Apr 2019 09:21:06 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 10 Apr 2019 09:21:06 +1200    

Click here for diff

M src/backend/executor/execTuples.c

Prevent inlining of multiply-referenced CTEs with outer recursive refs.

commit   : 9476131278c7bfc435ad9a21fc8e981272ac0dd2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Apr 2019 15:47:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Apr 2019 15:47:26 -0400    

Click here for diff

This has to be prevented because inlining would result in multiple  
self-references, which we don't support (and in fact that's disallowed  
by the SQL spec, see statements about linearly vs. nonlinearly  
recursive queries).  Bug fix for commit 608b167f9.  
  
Per report from Yaroslav Schekin (via Andrew Gierth)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo

commit   : 4dba0f6dc407f965924d6c1007ac1bb5cc209dde    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 9 Apr 2019 12:59:53 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 9 Apr 2019 12:59:53 -0400    

Click here for diff

M src/backend/replication/slotfuncs.c

Fix memory leak in pgbench

commit   : fe0e0b4fc7f0cdc2333bda08b199422a1e77a551    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 9 Apr 2019 12:46:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 9 Apr 2019 12:46:34 -0400    

Click here for diff

Commit 25ee70511ec2 introduced a memory leak in pgbench: some PGresult  
structs were not being freed during error bailout, because we're now  
doing more PQgetResult() calls than previously.  Since there's more  
cleanup code outside the discard_response() routine than in it, refactor  
the cleanup code, removing the routine.  
  
This has little effect currently, since we abandon processing after  
hitting errors, but if we ever get further pgbench features (such as  
testing for serializable transactions), it'll matter.  
  
Per Coverity.  
  
Reviewed-by: Michaël Paquier  

M src/bin/pgbench/pgbench.c

Test some more cases with partitioned tables in EvalPlanQual.

commit   : a2418f9e238794fcaaf00bbd5b8f953ca2856aa0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Apr 2019 11:42:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Apr 2019 11:42:53 -0400    

Click here for diff

We weren't testing anything involving EPQ on UPDATEs that move tuples  
into different partitions.  Depending on the implementation,  
it might be that these cases aren't actually very interesting ...  
but given our thin coverage of EPQ in general, I think it's a good  
idea to have a test case.  
  
Amit Langote, minor tweak by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Define WIN32_STACK_RLIMIT throughout win32 and cygwin builds.

commit   : ba3fb5d4fb9227719759740b6d7771e719c3318b    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 9 Apr 2019 08:25:39 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 9 Apr 2019 08:25:39 -0700    

Click here for diff

The MSVC build system already did this, and commit  
617dc6d299c957e2784320382b3277ede01d9c63 used it in a second file.  
Back-patch to 9.4, like that commit.  
  
Discussion: https://postgr.es/m/CAA8=A7_1SWc3+3Z=-utQrQFOtrj_DeohRVt7diA2tZozxsyUOQ@mail.gmail.com  

M src/backend/tcop/Makefile
M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.win32

Replace tabs with spaces in one .sql file

commit   : 9efe068e48f09d915660576f5672bfa9f1c0eb53    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Apr 2019 14:37:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Apr 2019 14:37:37 +0200    

Click here for diff

Let's at least keep this consistent within the same file.  

M src/backend/catalog/system_views.sql

Fix example in comment.

commit   : 16954e22e2a881a4a5ead82f364635bfa63cc9df    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 9 Apr 2019 08:32:02 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 9 Apr 2019 08:32:02 +0300    

Click here for diff

Author: Adrien Nayrat  

M src/backend/lib/integerset.c

Avoid "could not reattach" by providing space for concurrent allocation.

commit   : 617dc6d299c957e2784320382b3277ede01d9c63    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 8 Apr 2019 21:39:00 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 8 Apr 2019 21:39:00 -0700    

Click here for diff

We've long had reports of intermittent "could not reattach to shared  
memory" errors on Windows.  Buildfarm member dory fails that way when  
PGSharedMemoryReAttach() execution overlaps with creation of a thread  
for the process's "default thread pool".  Fix that by providing a second  
region to receive asynchronous allocations that would otherwise intrude  
into UsedShmemSegAddr.  In pgwin32_ReserveSharedMemoryRegion(), stop  
trying to free reservations landing at incorrect addresses; the caller's  
next step has been to terminate the affected process.  Back-patch to 9.4  
(all supported versions).  
  
Reviewed by Tom Lane.  He also did much of the prerequisite research;  
see commit bcbf2346d69f6006f126044864dd9383d50d87b4.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/include/storage/pg_shmem.h

tableam: comment and formatting fixes.

commit   : 6421011ea24db3a59dc7a0058a03e91981d53635    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 8 Apr 2019 10:25:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 8 Apr 2019 10:25:16 -0700    

Click here for diff

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

M src/include/access/tableam.h

doc: Fix whitespace

commit   : 122fa9f942478f8fdcfba961e01d172574369293    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Apr 2019 22:27:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Apr 2019 22:27:35 +0200    

Click here for diff

Author: Julien Rouhaud <[email protected]>  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/spgist.sgml

Fix improper interaction of FULL JOINs with lateral references.

commit   : 45f8eaa8e3031c9cb12deb1b5e294bc052b378f2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Apr 2019 16:09:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Apr 2019 16:09:06 -0400    

Click here for diff

join_is_legal() needs to reject forming certain outer joins in cases  
where that would lead the planner down a blind alley.  However, it  
mistakenly supposed that the way to handle full joins was to treat them  
as applying the same constraints as for left joins, only to both sides.  
That doesn't work, as shown in bug #15741 from Anthony Skorski: given  
a lateral reference out of a join that's fully enclosed by a full join,  
the code would fail to believe that any join ordering is legal, resulting  
in errors like "failed to build any N-way joins".  
  
However, we don't really need to consider full joins at all for this  
purpose, because we effectively force them to be evaluated in syntactic  
order, and that order is always legal for lateral references.  Hence,  
get rid of this broken logic for full joins and just ignore them instead.  
  
This seems to have been an oversight in commit 7e19db0c0.  
Back-patch to all supported branches, as that was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/joinrels.c
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/rangefuncs.sql

doc: Update serial explanation

commit   : c66000385fe1dc94a6d5525dcd192f17b551fb9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Apr 2019 22:03:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Apr 2019 22:03:48 +0200    

Click here for diff

The CREATE SEQUENCE command should include a data type specification,  
since PostgreSQL 10.  
  
Reported-by: [email protected]  

M doc/src/sgml/datatype.sgml

Fix EvalPlanQualStart to handle partitioned result rels correctly.

commit   : a8cb8f124679e0c373fdd07108b136e1cf1ee14a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Apr 2019 12:20:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Apr 2019 12:20:22 -0400    

Click here for diff

The es_root_result_relations array needs to be shallow-copied in the  
same way as the main es_result_relations array, else EPQ rechecks on  
partitioned result relations fail, as seen in bug #15677 from  
Norbert Benkocs.  
  
Amit Langote, isolation test case added by me  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

doc: Add note about generated columns in foreign tables

commit   : 348f57ce5be96190491e2153abb47060884f8ebf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 8 Apr 2019 13:47:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 8 Apr 2019 13:47:46 +0200    

Click here for diff

Explain that it is not enforced that querying a generated column  
returns data that is consistent with the data that was stored.  This  
is similar to the note about constraints nearby.  
  
Reported-by: Amit Langote <[email protected]>  

M doc/src/sgml/ref/create_foreign_table.sgml

Add vacuum_truncate reloption.

commit   : 119dcfad988d5b5d9f52b256087869997670aa36    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 8 Apr 2019 16:43:57 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 8 Apr 2019 16:43:57 +0900    

Click here for diff

vacuum_truncate controls whether vacuum tries to truncate off  
any empty pages at the end of the table. Previously vacuum always  
tried to do the truncation. However, the truncation could cause  
some problems; for example, ACCESS EXCLUSIVE lock needs to  
be taken on the table during the truncation and can cause  
the query cancellation on the standby even if hot_standby_feedback  
is true. Setting this reloption to false can be helpful to avoid  
such problems.  
  
Author: Tsunakawa Takayuki  
Reviewed-By: Julien Rouhaud, Masahiko Sawada, Michael Paquier, Kirk Jamison and Fujii Masao  
Discussion: https://postgr.es/m/CAHGQGwE5UqFqSq1=kV3QtTUtXphTdyHA-8rAj4A=Y+e4kyp3BQ@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/vacuumlazy.c
M src/bin/psql/tab-complete.c
M src/include/utils/rel.h
M src/test/regress/expected/reloptions.out
M src/test/regress/sql/reloptions.sql

Tweak wording of documentation for pg_checksums

commit   : e3865c37544d77bd4205dd5361592797b97d1e93    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Apr 2019 15:30:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Apr 2019 15:30:45 +0900    

Click here for diff

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

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

Reset memory context once per tuple in validateForeignKeyConstraint.

commit   : 4c9e1bd0a37e7b79dfc797dd91627336e871c1b0    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Apr 2019 22:42:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Apr 2019 22:42:42 -0700    

Click here for diff

When using tableam ExecFetchSlotHeapTuple() might return a separately  
allocated tuple. We could use the shouldFree argument to explicitly  
free it, but it seems more robust to to protect  
  
Also add a CHECK_FOR_INTERRUPTS() after each tuple. It's likely that  
each AM has (heap does) a CFI somewhere in the relevant path, but it  
seems more robust to have one in validateForeignKeyConstraint()  
itself.  
  
Note that this only affects the cases that couldn't be optimized to be  
verified with a query.  
  
Author: Andres Freund  
Reviewed-By: Tom Lane (in an earlier version)  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/CAKJS1f_SHKcPYMsi39An5aUjhAcEMZb6Cx1Sj1QWEWSiKJkBVQ@mail.gmail.com  
    https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Fix a number of issues around modifying a previously updated row.

commit   : 41f5e04aec6cf63ba8392adf70e9289e9c3706d6    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 7 Apr 2019 22:14:47 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 7 Apr 2019 22:14:47 -0700    

Click here for diff

This commit fixes three, unfortunately related, issues:  
  
1) Since 5db6df0c01, the introduction of DML via tableam, it was  
   possible to trigger "ERROR: unexpected table_lock_tuple status: 1"  
   when updating a row that was previously updated in the same  
   transaction - but only when the previously updated row was before  
   updated in a concurrent transaction (and READ COMMITTED was  
   used). The reason for that was that that case simply wasn't  
   expected. Fixing that lead to:  
  
2) Even before the above commit, there were error checks (introduced  
   in 6868ed7491b7) preventing a row being updated by different  
   commands within the same statement (say in a function called by an  
   UPDATE) - but that check wasn't performed when the row was first  
   updated in a concurrent transaction - instead the second update was  
   silently skipped in that case. After this change we throw the same  
   error as we'd without the concurrent transaction.  
  
3) The error messages (introduced in 6868ed7491b7) preventing such  
   updates emitted the same error message for both DELETE and  
   UPDATE ("tuple to be updated was already modified by an operation  
   triggered by the current command"). While that could be changed  
   separately, it made it hard to write tests that verify the correct  
   correct behavior of the code.  
  
This commit changes heap's implementation of table_lock_tuple() to  
return TM_SelfModified instead of TM_Invisible (previously loosely  
modeled after EvalPlanQualFetch), and teaches nodeModifyTable.c to  
handle that in response to table_lock_tuple() and not just in response  
to table_(delete|update).  
  
Additionally it fixes the wrong error message (see 3 above). The  
comment for table_lock_tuple() is also adjusted to state that  
TM_Deleted won't return information in TM_FailureData - it'll not  
always be available.  
  
This also adds tests to ensure that DELETE/UPDATE correctly error out  
when affecting a row that concurrently was modified by another  
transaction.  
  
Author: Andres Freund  
Reported-By: Tom Lane, when investigating a bug bug fix to another bug  
    by Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/tableam.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec
M src/test/regress/expected/triggers.out

Add more tests for partition tuple routing with dropped attributes

commit   : 964bae4d8456e5406753027fa5a70181ddb4c835    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Apr 2019 13:44:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Apr 2019 13:44:55 +0900    

Click here for diff

As bug #15733 has proved, we are lacking coverage for partition tuple  
routing with dropped attributes when involving three levels of  
partitioning or more.  There was only an active bug in this area for  
v11, and HEAD is proving to handle those scenarios fine, still it lacked  
some coverage for the previous problem.  
  
Author: Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid fetching past the end of the indoption array.

commit   : 80a96e066eecb6bd1788964b5911a405d932a784    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2019 18:18:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2019 18:18:58 -0400    

Click here for diff

pg_get_indexdef_worker carelessly fetched indoption entries even for  
non-key index columns that don't have one.  99.999% of the time this  
would be harmless, since the code wouldn't examine the value ... but  
some fine day this will be a fetch off the end of memory, resulting  
in SIGSEGV.  
  
Detected through valgrind testing.  Odd that the buildfarm's valgrind  
critters haven't noticed.  

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

psql \dP: list partitioned tables and indexes

commit   : 1c5d9270e339662cdd78d51d0b859d4f0a11aa91    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 7 Apr 2019 07:59:12 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 7 Apr 2019 07:59:12 -0400    

Click here for diff

The new command lists partitioned relations (tables and/or indexes),  
possibly with their sizes, possibly including partitioned partitions;  
their parents (if not top-level); if indexes show the tables they belong  
to; and their descriptions.  
  
While there are various possible improvements to this, having it in this  
form is already a great improvement over not having any way to obtain  
this report.  
  
Author: Pavel Stěhule, with help from Mathias Brossard, Amit Langote and  
	Justin Pryzby.  
Reviewed-by: Amit Langote, Mathias Brossard, Melanie Plageman,  
	Michaël Paquier, Álvaro Herrera  

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

Clean up side-effects of commits ab5fcf2b0 et al.

commit   : 159970bcadbbdefd312d75ce7ad90f19add19b40    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2019 12:54:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Apr 2019 12:54:22 -0400    

Click here for diff

Before those commits, partitioning-related code in the executor could  
assume that ModifyTableState.resultRelInfo[] contains only leaf partitions.  
However, now a fully-pruned update results in a dummy ModifyTable that  
references the root partitioned table, and that breaks some stuff.  
  
In v11, this led to an assertion or core dump in the tuple routing code.  
Fix by disabling tuple routing, since we don't need that anyway.  
(I chose to do that in HEAD as well for safety, even though the problem  
doesn't manifest in HEAD as it stands.)  
  
In v10, this confused ExecInitModifyTable's decision about whether it  
needed to close the root table.  But we can get rid of that altogether  
by being smarter about where to find the root table.  
  
Note that since the referenced commits haven't shipped yet, this  
isn't fixing any bug the field has seen.  
  
Amit Langote, per a report from me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Report progress of REINDEX operations

commit   : 03f9e5cba0ee1633af4abe734504df50af46fbd8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Apr 2019 11:30:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Apr 2019 11:30:14 +0200    

Click here for diff

This uses the same infrastructure that the CREATE INDEX progress  
reporting uses.  Add a column to pg_stat_progress_create_index to  
report the OID of the index being worked on.  This was not necessary  
for CREATE INDEX, but it's useful for REINDEX.  
  
Also edit the phase descriptions a bit to be more consistent with the  
source code comments.  
  
Discussion: https://www.postgresql.org/message-id/ef6a6757-c36a-9e81-123f-13b19e36b7d7%402ndquadrant.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/index.c
M src/backend/catalog/system_views.sql
M src/backend/commands/indexcmds.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out

Cast pg_stat_progress_cluster.cluster_index_relid to oid

commit   : 106f2eb664bbd38c83090becff9fcde1e9622c9c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 7 Apr 2019 10:31:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 7 Apr 2019 10:31:32 +0200    

Click here for diff

It's tracked internally as bigint, but when presented to the user it  
should be oid.  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

Avoid Python memory leaks in hstore_plpython and jsonb_plpython.

commit   : 9e360f0e8327bcf4b7c5ce957024fdff8f95f7de    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2019 17:54:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2019 17:54:29 -0400    

Click here for diff

Fix some places where we might fail to do Py_DECREF() on a Python  
object (thereby leaking it for the rest of the session).  Almost  
all of the risks were in error-recovery paths, which we don't really  
expect to hit anyway.  Hence, while this is definitely a bug fix,  
it doesn't quite seem worth back-patching.  
  
Nikita Glukhov, Michael Paquier, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c

Fix failures in validateForeignKeyConstraint's slow path.

commit   : 46e3442c9ec858071d60a1c0fae2e9868aeaa0c8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2019 15:09:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Apr 2019 15:09:09 -0400    

Click here for diff

The foreign-key-checking loop in ATRewriteTables failed to ignore  
relations without storage (e.g., partitioned tables), unlike the  
initial loop.  This accidentally worked as long as RI_Initial_Check  
succeeded, which it does in most practical cases (including all the  
ones exercised in the existing regression tests :-().  However, if  
that failed, as for instance when there are permissions issues,  
then we entered the slow fire-the-trigger-on-each-tuple path.  
And that would try to read from the referencing relation, and fail  
if it lacks storage.  
  
A second problem, recently introduced in HEAD, was that this loop  
had been broken by sloppy refactoring for the tableam API changes.  
  
Repair both issues, and add a regression test case so we have some  
coverage on this code path.  Back-patch as needed to v11.  
  
(It looks like this code could do with additional bulletproofing,  
but let's get a working test case in place first.)  
  
Hadi Moshayedi, Tom Lane, Andres Freund  
  
Discussion: https://postgr.es/m/CAK=1=WrnNmBbe5D9sm3t0a6dnAq3cdbF1vXY816j1wsMqzC8bw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/20190325180405.jytoehuzkeozggxx%40alap3.anarazel.de  

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

Add support TCP user timeout in libpq and the backend server

commit   : 249d64999615802752940e017ee5166e726bc7cd    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 6 Apr 2019 15:23:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 6 Apr 2019 15:23:37 +0900    

Click here for diff

Similarly to the set of parameters for keepalive, a connection parameter  
for libpq is added as well as a backend GUC, called tcp_user_timeout.  
  
Increasing the TCP user timeout is useful to allow a connection to  
survive extended periods without end-to-end connection, and decreasing  
it allows application to fail faster.  By default, the parameter is 0,  
which makes the connection use the system default, and follows a logic  
close to the keepalive parameters in its handling.  When connecting  
through a Unix-socket domain, the parameters have no effect.  
  
Author: Ryohei Nagaura  
Reviewed-by: Fabien Coelho, Robert Haas, Kyotaro Horiguchi, Kirk  
Jamison, Mikalai Keida, Takayuki Tsunakawa, Andrei Yahorau  
Discussion: https://postgr.es/m/EDA4195584F5064680D8130B1CA91C45367328@G01JPEXMBYT04  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml
M src/backend/libpq/pqcomm.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/libpq-be.h
M src/include/utils/guc.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

Use Append rather than MergeAppend for scanning ordered partitions.

commit   : 959d00e9dbe4cfcf4a63bb655ac2c29a5e579246    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Apr 2019 19:20:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Apr 2019 19:20:30 -0400    

Click here for diff

If we need ordered output from a scan of a partitioned table, but  
the ordering matches the partition ordering, then we don't need to  
use a MergeAppend to combine the pre-ordered per-partition scan  
results: a plain Append will produce the same results.  This  
both saves useless comparison work inside the MergeAppend proper,  
and allows us to start returning tuples after istarting up just  
the first child node not all of them.  
  
However, all is not peaches and cream, because if some of the  
child nodes have high startup costs then there will be big  
discontinuities in the tuples-returned-versus-elapsed-time curve.  
The planner's cost model cannot handle that (yet, anyway).  
If we model the Append's startup cost as being just the first  
child's startup cost, we may drastically underestimate the cost  
of fetching slightly more tuples than are available from the first  
child.  Since we've had bad experiences with over-optimistic choices  
of "fast start" plans for ORDER BY LIMIT queries, that seems scary.  
As a klugy workaround, set the startup cost estimate for an ordered  
Append to be the sum of its children's startup costs (as MergeAppend  
would).  This doesn't really describe reality, but it's less likely  
to cause a bad plan choice than an underestimated startup cost would.  
In practice, the cases where we really care about this optimization  
will have child plans that are IndexScans with zero startup cost,  
so that the overly conservative estimate is still just zero.  
  
David Rowley, reviewed by Julien Rouhaud and Antonin Houska  
  
Discussion: https://postgr.es/m/CAKJS1f-hAqhPLRk_RaSFTgYxd=Tz5hA7kQ2h4-DhJufQk8TGuw@mail.gmail.com  

M src/backend/executor/execProcnode.c
M src/backend/nodes/outfuncs.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/createplan.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/partitioning/partbounds.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/partitioning/partbounds.h
M src/test/regress/expected/inherit.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/partition_prune.sql

Add facility to copy replication slots

commit   : 9f06d79ef831ffa333f908f6d3debdb654292414    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Apr 2019 14:52:45 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Apr 2019 14:52:45 -0300    

Click here for diff

This allows the user to create duplicates of existing replication slots,  
either logical or physical, and even changing properties such as whether  
they are temporary or the output plugin used.  
  
There are multiple uses for this, such as initializing multiple replicas  
using the slot for one base backup; when doing investigation of logical  
replication issues; and to select a different output plugins.  
  
Author: Masahiko Sawada  
Reviewed-by: Michael Paquier, Andres Freund, Petr Jelinek  
Discussion: https://postgr.es/m/CAD21AoAm7XX8y_tOPP6j4Nzzch12FvA1wPqiO690RCk+uYVstg@mail.gmail.com  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/func.sgml
M src/backend/replication/logical/logical.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/logical.h

Wake up interested backends when a checkpoint fails.

commit   : de2b38419c4018fc8c2c917cc2cc752063096cfb    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Apr 2019 09:31:48 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Apr 2019 09:31:48 +1300    

Click here for diff

Commit c6c9474a switched to condition variables instead of sleep  
loops to notify backends of checkpoint start and stop, but forgot  
to broadcast in case of checkpoint failure.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CA%2BhUKGJKbCd%2B_K%2BSEBsbHxVT60SG0ivWHHAdvL0bLTUt2xpA2w%40mail.gmail.com  

M src/backend/postmaster/checkpointer.c

Fix missing word.

commit   : 6665305e17edff3e2c43d71396ea5b6a69e7b6f3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Apr 2019 15:25:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Apr 2019 15:25:09 -0400    

Click here for diff

Nathan Bossart  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ref/vacuum.sgml

Ensure consistent name matching behavior in processSQLNamePattern().

commit   : 478cacb50e4851760db9b8e75b2256085b571965    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Apr 2019 12:59:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Apr 2019 12:59:46 -0400    

Click here for diff

Prior to v12, if you used a collation-sensitive regex feature in a  
pattern handled by processSQLNamePattern() (for instance, \d '\\w+'  
in psql), the behavior you got matched the database's default collation.  
Since commit 586b98fdf you'd usually get C-collation behavior, because  
the catalog "name"-type columns are now marked as COLLATE "C".  Add  
explicit COLLATE specifications to restore the prior behavior.  
  
(Note for whoever writes the v12 release notes: the need for this shows  
that while 586b98fdf preserved pre-v12 behavior of "name" columns for  
simple comparison operators, it changed the behavior of regex operators  
on those columns.  Although this patch fixes it for pattern matches  
generated by our own tools, user-written queries will still be affected.  
So we'd better mention this issue as a compatibility item.)  
  
Daniel Vérité  
  
Discussion: https://postgr.es/m/[email protected]  

M src/fe_utils/string_utils.c

table: docs: fix typos and grammar.

commit   : 86cc06d1cf9c30be3b79207242e6746f0f0b681c    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 5 Apr 2019 09:45:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 5 Apr 2019 09:45:59 -0700    

Click here for diff

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

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/select_into.sgml
M doc/src/sgml/storage.sgml
M doc/src/sgml/tableam.sgml

Doc: Update documentation on partitioning vs. foreign tables.

commit   : 3e6b0c472942e9a73e0fc10659dce2cba56959a7    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 5 Apr 2019 20:55:06 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 5 Apr 2019 20:55:06 +0900    

Click here for diff

The limitations that it is not allowed to create/attach a foreign table  
as a partition of an indexed partitioned table were not documented.  
  
Reported-By: Stepan Yankevych  
Author: Etsuro Fujita  
Reviewed-By: Amit Langote  
Backpatch-through: 11 where partitioned index was introduced  
Discussion: https://postgr.es/m/[email protected]  

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

Fix compiler warning

commit   : edda32ee250fe480701083d4e072e06929991bf9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Apr 2019 09:23:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Apr 2019 09:23:07 +0200    

Click here for diff

Rewrite get_attgenerated() to avoid compiler warning if the compiler  
does not recognize that elog(ERROR) does not return.  
  
Reported-by: David Rowley <[email protected]>  

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

Revert "Consistently test for in-use shared memory."

commit   : 82150a05be0dc8a8ec708d1f6e6e1ef26c0e58d4    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 5 Apr 2019 00:00:52 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 5 Apr 2019 00:00:52 -0700    

Click here for diff

This reverts commits 2f932f71d9f2963bbd201129d7b971c8f5f077fd,  
16ee6eaf80a40007a138b60bb5661660058d0422 and  
6f0e190056fe441f7cf788ff19b62b13c94f68f3.  The buildfarm has revealed  
several bugs.  Back-patch like the original commits.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/init/postinit.c
M src/include/storage/ipc.h
M src/include/storage/pg_shmem.h
M src/test/perl/PostgresNode.pm
D src/test/recovery/t/017_shm.pl
M src/tools/msvc/vcregress.pl

Fix bugs in mdsyncfiletag().

commit   : 794c543b1736f71ff5bc5231eee41cdf460ad8ce    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Apr 2019 16:39:47 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Apr 2019 16:39:47 +1300    

Click here for diff

Commit 3eb77eba moved a _mdfd_getseg() call from mdsync() into a new  
callback function mdsyncfiletag(), but didn't get the arguments quite  
right.  Without the EXTENSION_DONT_CHECK_SIZE flag we fail to open a  
segment if lower-numbered segments have been truncated, and it wants  
a block number rather than a segment number.  
  
While comparing with the older coding, also remove an unnecessary  
clobbering of errno, and adjust the code in mdunlinkfiletag() to  
ressemble the original code from mdpostckpt() more closely instead  
of using an unnecessary call to smgropen().  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CA%2BhUKGL%2BYLUOA0eYiBXBfwW%2BbH5kFgh94%3DgQH0jHEJ-t5Y91wQ%40mail.gmail.com  

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

Handle errors during GSSAPI startup better

commit   : c46c85d4594d52fb34d36d4761bb9cfc5626f20b    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 4 Apr 2019 22:52:42 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 4 Apr 2019 22:52:42 -0400    

Click here for diff

There was some confusion over the format of the error message returned  
from the server during GSSAPI startup; specifically, it was expected  
that a length would be returned when, in reality, at this early stage in  
the startup sequence, no length is returned from the server as part of  
an error message.  
  
Correct the client-side code for dealing with error messages sent by the  
server during startup by simply reading what's available into our  
buffer, after we've discovered it's an error message, and then reporting  
back what was returned.  
  
In passing, also add in documentation of the environment variable  
PGGSSENCMODE which was missed previously, and adjust the code to look  
for the PGGSSENCMODE variable (the environment variable change was  
missed in the prior GSSMODE -> GSSENCMODE commit).  
  
Error-handling issue discovered by Peter Eisentraut, the rest were items  
discovered during testing of the error handling.  

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

Fix some documentation in pg_rewind

commit   : bfc80683ce51590545350b2c8ccfaa9e7a2a1870    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Apr 2019 10:37:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Apr 2019 10:37:59 +0900    

Click here for diff

Since 11, it is possible to use a non-superuser role when using an  
online source cluster with pg_rewind as long as the role has proper  
permissions to execute on the source all the functions used by  
pg_rewind, and the documentation stated that a superuser is necessary.  
Let's add at the same time all the details needed to create such a  
role.  
  
A second confusion which comes a lot from users is that it is necessary  
to issue a checkpoint on a freshly-promoted standby so as its control  
file has up-to-date timeline information which is used by pg_rewind to  
validate the operation.  Let's document that properly.  This is  
back-patched down to 9.5 where pg_rewind has been introduced.  
  
Author: Michael Paquier  
Reviewed-by: Magnus Hagander  
Discussion: https://postgr.es/m/CABUevEz5bpvbwVsYCaSMV80CBZ5-82nkMzbb+Bu=h1m=rLdn=g@mail.gmail.com  
Backpatch-through: 9.5  

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

Remove unused struct member, enforce multi_insert callback presence.

commit   : 57a7a3adfe4eadb471bb45a7effb1a99ebb00a7b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 4 Apr 2019 17:36:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 4 Apr 2019 17:36:45 -0700    

Click here for diff

Author: David Rowley, Andres Freund  
Discussion: https://postgr.es/m/CAKJS1f9=9phmm66diAji4gvHnWSrK7BGFoNct+mEUT_c8pPOjw@mail.gmail.com  

M src/backend/access/table/tableamapi.c
M src/backend/commands/copy.c

Harden tableam against nonexistant / wrong kind of AMs.

commit   : ea97e440b8570ffd1a6cd6604f2ef882c0a72291    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 4 Apr 2019 17:17:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 4 Apr 2019 17:17:50 -0700    

Click here for diff

Previously it was allowed to set default_table_access_method to an  
empty string. That makes sense for default_tablespace, where that was  
copied from, as it signals falling back to the database's default  
tablespace. As there is no equivalent for table AMs, forbid that.  
  
Also make sure to throw a usable error when creating a table using an  
index AM, by using get_am_type_oid() to implement get_table_am_oid()  
instead of a separate copy. Previously we'd error out only later, in  
GetTableAmRoutine().  
  
Thirdly remove GetTableAmRoutineByAmId() - it was only used in an  
earlier version of 8586bf7ed8.  
  
Add tests for the above (some for index AMs as well).  

M src/backend/access/table/tableamapi.c
M src/backend/commands/amcmds.c
M src/backend/commands/tablecmds.c
M src/include/access/tableam.h
M src/include/commands/defrem.h
M src/test/regress/expected/create_am.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/create_am.sql
M src/test/regress/sql/type_sanity.sql

Add test coverage for rootdescend verification.

commit   : 344b7e11bbaf5e11f2497b11405e63d190043cfe    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 4 Apr 2019 17:25:35 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 4 Apr 2019 17:25:35 -0700    

Click here for diff

Commit c1afd175, which added support for rootdescend verification to  
amcheck, added only minimal regression test coverage.  Address this by  
making sure that rootdescend verification is run on a multi-level index.  
In passing, simplify some of the regression tests that exercise  
multi-level nbtree page deletion.  
  
Both issues spotted while rereviewing coverage of the nbtree patch  
series using gcov.  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

tableam: Add table_multi_insert() and revamp/speed-up COPY FROM buffering.

commit   : 86b85044e823a304d2a265abc030254d39efe7df    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 4 Apr 2019 15:47:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 4 Apr 2019 15:47:19 -0700    

Click here for diff

This adds table_multi_insert(), and converts COPY FROM, the only user  
of heap_multi_insert, to it.  
  
A simple conversion of COPY FROM use slots would have yielded a  
slowdown when inserting into a partitioned table for some  
workloads. Different partitions might need different slots (both slot  
types and their descriptors), and dropping / creating slots when  
there's constant partition changes is measurable.  
  
Thus instead revamp the COPY FROM buffering for partitioned tables to  
allow to buffer inserts into multiple tables, flushing only when  
limits are reached across all partition buffers. By only dropping  
slots when there've been inserts into too many different partitions,  
the aforementioned overhead is gone. By allowing larger batches, even  
when there are frequent partition changes, we actuall speed such cases  
up significantly.  
  
By using slots COPY of very narrow rows into unlogged / temporary  
might slow down very slightly (due to the indirect function calls).  
  
Author: David Rowley, Andres Freund, Haribabu Kommi  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

Add a "SQLSTATE-only" error verbosity option to libpq and psql.

commit   : 7bac3acab4d5c3f2c35aa3a7bea08411d83fd5bc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2019 17:22:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2019 17:22:02 -0400    

Click here for diff

This is intended for use mostly in test scripts for external tools,  
which could do without cross-PG-version variations in error message  
wording.  Of course, the SQLSTATE isn't guaranteed stable either, but  
it should be more so than the error message text.  
  
Note: there's a bit of an ABI change for libpq here, but it seems  
OK because if somebody compiles against a newer version of libpq-fe.h,  
and then tries to pass PQERRORS_SQLSTATE to PQsetErrorVerbosity()  
of an older libpq library, it will be accepted and then act like  
PQERRORS_DEFAULT, thanks to the way the tests in pqBuildErrorMessage3  
have historically been phrased.  That seems acceptable.  
  
Didier Gautheron, reviewed by Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/CAJRYxuKyj4zA+JGVrtx8OWAuBfE-_wN4sUMK4H49EuPed=mOBw@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/help.c
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-fe.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

pg_restore: Require "-f -" to mean stdout

commit   : 413ccaa74d9a126b042727c826e65e2844adadac    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 4 Apr 2019 16:34:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 4 Apr 2019 16:34:58 -0300    

Click here for diff

The previous convention that stdout was selected by default when nothing  
is specified was just too error-prone.  
  
After a suggestion from Andrew Gierth.  
Author: Euler Taveira  
Reviewed-by: Yoshikazu Imai, José Arthur Benetasso Villanova  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl

Make queries' locking of indexes more consistent.

commit   : 9c703c169a872d144f2f79d2fb211c82587adfa7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2019 15:12:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Apr 2019 15:12:51 -0400    

Click here for diff

The assertions added by commit b04aeb0a0 exposed that there are some  
code paths wherein the executor will try to open an index without  
holding any lock on it.  We do have some lock on the index's table,  
so it seems likely that there's no fatal problem with this (for  
instance, the index couldn't get dropped from under us).  Still,  
it's bad practice and we should fix it.  
  
To do so, remove the optimizations in ExecInitIndexScan and friends  
that tried to avoid taking a lock on an index belonging to a target  
relation, and just take the lock always.  In non-bug cases, this  
will result in no additional shared-memory access, since we'll find  
in the local lock table that we already have a lock of the desired  
type; hence, no significant performance degradation should occur.  
  
Also, adjust the planner and executor so that the type of lock taken  
on an index is always identical to the type of lock taken for its table,  
by relying on the recently added RangeTblEntry.rellockmode field.  
This avoids some corner cases where that might not have been true  
before (possibly resulting in extra locking overhead), and prevents  
future maintenance issues from having multiple bits of logic that  
all needed to be in sync.  In addition, this change removes all core  
calls to ExecRelationIsTargetRelation, which avoids a possible O(N^2)  
startup penalty for queries with large numbers of target relations.  
(We'd probably remove that function altogether, were it not that we  
advertise it as something that FDWs might want to use.)  
  
Also adjust some places in selfuncs.c to not take any lock on indexes  
they are transiently opening, since we can assume that plancat.c  
did that already.  
  
In passing, change gin_clean_pending_list() to take RowExclusiveLock  
not AccessShareLock on its target index.  Although it's not clear that  
that's actually a bug, it seemed very strange for a function that's  
explicitly going to modify the index to use only AccessShareLock.  
  
David Rowley, reviewed by Julien Rouhaud and Amit Langote,  
a bit of further tweaking by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gin/ginfast.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/selfuncs.c

Allow VACUUM to be run with index cleanup disabled.

commit   : a96c41feec6b6616eb9d5baee9a9e08c20533c38    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Apr 2019 14:58:53 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Apr 2019 14:58:53 -0400    

Click here for diff

This commit adds a new reloption, vacuum_index_cleanup, which  
controls whether index cleanup is performed for a particular  
relation by default.  It also adds a new option to the VACUUM  
command, INDEX_CLEANUP, which can be used to override the  
reloption.  If neither the reloption nor the VACUUM option is  
used, the default is true, as before.  
  
Masahiko Sawada, reviewed and tested by Nathan Bossart, Alvaro  
Herrera, Kyotaro Horiguchi, Darafei Praliaskouski, and me.  
The wording of the documentation is mostly due to me.  
  
Discussion: http://postgr.es/m/CAD21AoAt5R3DNUZSjOoXDUY=naYPUOuffVsRzuTYMz29yLzQCA@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/psql/tab-complete.c
M src/include/commands/vacuum.h
M src/include/utils/rel.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Invalidate binary search bounds consistently.

commit   : 74eb2176bf3ac7a2fae1282b4f4f1d000f3e6d78    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 4 Apr 2019 09:38:08 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 4 Apr 2019 09:38:08 -0700    

Click here for diff

_bt_check_unique() failed to invalidate binary search bounds in the  
event of a live conflict following commit e5adcb78.  This resulted in  
problems after waiting for the conflicting xact to commit or abort.  The  
subsequent call to _bt_check_unique() would restore the initial binary  
search bounds, rather than starting a new search.  Fix by explicitly  
invalidating bounds when it becomes clear that there is a live conflict  
that insertion will have to wait to resolve.  
  
Ashutosh Sharma, with a few additional tweaks by me.  
  
Author: Ashutosh Sharma  
Reported-By: Ashutosh Sharma  
Diagnosed-By: Ashutosh Sharma  
Discussion: https://postgr.es/m/CAE9k0PnQp-qr-UYKMSCzdC2FBzdE4wKP41hZrZvvP26dKLonLg@mail.gmail.com  

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

Move the be_gssapi_get_* prototypes

commit   : 87e16db5ebe7256712999ec690899237029b9ae7    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 4 Apr 2019 11:11:46 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 4 Apr 2019 11:11:46 -0400    

Click here for diff

The be_gssapi_get_* prototypes were put close to similar ones for SSL-  
but a bit too close since that meant they ended up only being included  
for SSL-enabled builds.  Move those to be under ENABLE_GSS instead.  
  
Pointed out by Tom.  

M src/include/libpq/libpq-be.h

Refactor the fsync queue for wider use.

commit   : 3eb77eba5a51780d5cf52cd66a9844cd4d26feb0    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 4 Apr 2019 21:56:03 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 4 Apr 2019 21:56:03 +1300    

Click here for diff

Previously, md.c and checkpointer.c were tightly integrated so that  
fsync calls could be handed off and processed in the background.  
Introduce a system of callbacks and file tags, so that other modules  
can hand off fsync work in the same way.  
  
For now only md.c uses the new interface, but other users are being  
proposed.  Since there may be use cases that are not strictly SMGR  
implementations, use a new function table for sync handlers rather  
than extending the traditional SMGR one.  
  
Instead of using a bitmapset of segment numbers for each RelFileNode  
in the checkpointer's hash table, make the segment number part of the  
key.  This requires sending explicit "forget" requests for every  
segment individually when relations are dropped, but suits the file  
layout schemes of proposed future users better (ie sparse or high  
segment numbers).  
  
Author: Shawn Debnath and Thomas Munro  
Reviewed-by: Thomas Munro, Andres Freund  
Discussion: https://postgr.es/m/CAEepm=2gTANm=e3ARnJT=n0h8hf88wqmaZxk0JYkxw+b21fNrw@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/dbcommands.c
M src/backend/postmaster/checkpointer.c
M src/backend/storage/Makefile
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
A src/backend/storage/sync/Makefile
A src/backend/storage/sync/sync.c
M src/backend/utils/init/postinit.c
M src/include/postmaster/bgwriter.h
M src/include/storage/fd.h
A src/include/storage/md.h
M src/include/storage/smgr.h
A src/include/storage/sync.h
M src/tools/pgindent/typedefs.list

file_fdw: Fix for generated columns

commit   : 33215d113d61980a4b2f2aec36cdcd21fa58c1c4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 4 Apr 2019 09:24:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 4 Apr 2019 09:24:48 +0200    

Click here for diff

Since file_fdw uses COPY internally, but COPY doesn't allow listing  
generated columns in its column list, we need to make sure that we  
don't add generated columns to the column lists internally generated  
by file_fdw.  
  
Reported-by: Erik Rijkers <[email protected]>  

M contrib/file_fdw/file_fdw.c
M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source

Silence -Wimplicit-fallthrough in sysv_shmem.c.

commit   : 6f0e190056fe441f7cf788ff19b62b13c94f68f3    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 23:23:35 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 23:23:35 -0700    

Click here for diff

Commit 2f932f71d9f2963bbd201129d7b971c8f5f077fd added code that elicits  
a warning on buildfarm member flaviventris.  Back-patch to 9.4, like  
that commit.  
  
Reported by Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/sysv_shmem.c

Make src/test/recovery/t/017_shm.pl safe for concurrent execution.

commit   : 16ee6eaf80a40007a138b60bb5661660058d0422    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 23:16:37 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 23:16:37 -0700    

Click here for diff

Buildfarm members idiacanthus and komodoensis, which share a host, both  
executed this test in the same second.  That failed.  Back-patch to 9.6,  
where the test first appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/017_shm.pl

Improve readability of some tests in strings.sql

commit   : 92c76021aed47daa61afd5c7d6f8201382dee203    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Apr 2019 10:24:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Apr 2019 10:24:56 +0900    

Click here for diff

c251336 has added some tests to check if a toast relation should be  
empty or not, hardcoding the toast relation name when calling  
pg_relation_size().  pg_class.reltoastrelid offers the same information,  
so simplify the tests to use that.  
  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

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

tableam: basic documentation.

commit   : b73c3a11963c8bb783993cfffabb09f558f86e37    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 3 Apr 2019 17:37:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 3 Apr 2019 17:37:00 -0700    

Click here for diff

This adds documentation about the user oriented parts of table access  
methods (i.e. the default_table_access_method GUC and the USING clause  
for CREATE TABLE etc), adds a basic chapter about the table access  
method interface, and adds a note to storage.sgml that it's contents  
don't necessarily apply for non-builtin AMs.  
  
Author: Haribabu Kommi and Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/create_access_method.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/select_into.sgml
M doc/src/sgml/storage.sgml
A doc/src/sgml/tableam.sgml
M src/include/access/tableam.h

Assert that pgwin32_signal_initialize() has been called early enough.

commit   : ab9ed9be2378f02edf613e0543a29287e7484338    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 17:11:16 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 17:11:16 -0700    

Click here for diff

Before the pgwin32_signal_initialize() call, the backend version of  
pg_usleep() has no effect.  No in-tree code falls afoul of that today,  
but temporary commit 23078689a9921968ac0873b017be6e7f772f10bc did so.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32/signal.c
M src/port/open.c

Handle USE_MODULE_DB for all tests able to use an installed postmaster.

commit   : f433394e48afbb733b1436276a5a08cd78443164    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 17:06:01 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 17:06:01 -0700    

Click here for diff

When $(MODULES) and $(MODULE_big) are empty, derive the database name  
from the first element of $(REGRESS) instead of using a constant string.  
When deriving the database name from $(MODULES), use its first element  
instead of the entire list; the earlier approach would fail if any  
multi-module directory had $(REGRESS) tests.  Treat isolation suites and  
src/pl correspondingly.  Under USE_MODULE_DB=1, installcheck-world and  
check-world no longer reuse any database name in a given postmaster.  
Buildfarm members axolotl, mandrill and frogfish saw spurious "is being  
accessed by other users" failures that would not have happened without  
database name reuse.  (The CountOtherDBBackends() 5s deadline expired  
during DROP DATABASE; a backend for an earlier test suite had used the  
same database name and had not yet exited.)  Back-patch to 9.4 (all  
supported versions), except bits pertaining to isolation suites.  
  
Concept reviewed by Andrew Dunstan, Andres Freund and Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/makefiles/pgxs.mk

Consistently test for in-use shared memory.

commit   : 2f932f71d9f2963bbd201129d7b971c8f5f077fd    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 17:03:46 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 3 Apr 2019 17:03:46 -0700    

Click here for diff

postmaster startup scrutinizes any shared memory segment recorded in  
postmaster.pid, exiting if that segment matches the current data  
directory and has an attached process.  When the postmaster.pid file was  
missing, a starting postmaster used weaker checks.  Change to use the  
same checks in both scenarios.  This increases the chance of a startup  
failure, in lieu of data corruption, if the DBA does "kill -9 `head -n1  
postmaster.pid` && rm postmaster.pid && pg_ctl -w start".  A postmaster  
will no longer recycle segments pertaining to other data directories.  
That's good for production, but it's bad for integration tests that  
crash a postmaster and immediately delete its data directory.  Such a  
test now leaks a segment indefinitely.  No "make check-world" test does  
that.  win32_shmem.c already avoided all these problems.  In 9.6 and  
later, enhance PostgresNode to facilitate testing.  Back-patch to 9.4  
(all supported versions).  
  
Reviewed by Daniel Gustafsson and Kyotaro HORIGUCHI.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/init/postinit.c
M src/include/storage/ipc.h
M src/include/storage/pg_shmem.h
M src/test/perl/PostgresNode.pm
A src/test/recovery/t/017_shm.pl
M src/tools/msvc/vcregress.pl

Doc: clarify partial-index example.

commit   : af052daec5aa282eab2d22fa3b24d6109a30c2f3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Apr 2019 18:28:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Apr 2019 18:28:18 -0400    

Click here for diff

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

M doc/src/sgml/indices.sgml

Add SETTINGS option to EXPLAIN, to print modified settings.

commit   : ea569d64ac7174d3fe657e3e682d11053ecf1866    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 4 Apr 2019 00:04:31 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 4 Apr 2019 00:04:31 +0200    

Click here for diff

Query planning is affected by a number of configuration options, and it  
may be crucial to know which of those options were set to non-default  
values.  With this patch you can say EXPLAIN (SETTINGS ON) to include  
that information in the query plan.  Only options affecting planning,  
with values different from the built-in default are printed.  
  
This patch also adds auto_explain.log_settings option, providing the  
same capability in auto_explain module.  
  
Author: Tomas Vondra  
Reviewed-by: Rafia Sabih, John Naylor  
Discussion: https://postgr.es/m/[email protected]  

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/backend/utils/misc/guc.c
M src/include/commands/explain.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h

Tweak docs for log_statement_sample_rate

commit   : d1f04b96b99d595e80791cdb0faa9cfdde2a5afa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 18:54:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 18:54:02 -0300    

Click here for diff

Author: Justin Pryzby, partly after a suggestion from Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAD21AoB9+y8N4+Fan-ne-_7J5yTybPttxeVKfwUocKp4zT1vNQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Log all statements from a sample of transactions

commit   : 799e220346f1387e823a4dbdc3b1c8c3cdc5c3e0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 18:43:59 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 18:43:59 -0300    

Click here for diff

This is useful to obtain a view of the different transaction types in an  
application, regardless of the durations of the statements each runs.  
  
Author: Adrien Nayrat  
Reviewed-by: Masahiko Sawada, Hayato Kuroda, Andres Freund  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xact.c
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xact.h
M src/include/utils/guc.h

Remove now-unnecessary thread pointer arguments in pgbench.

commit   : d8c0bd9fefa9c70a3f5613fba672fa92f08ea940    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Apr 2019 17:16:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Apr 2019 17:16:00 -0400    

Click here for diff

Not required after nuking the zipfian thread-local cache.  
  
Also add a comment about hazardous pointer punning in threadRun(),  
and avoid using "thread" to refer to the threads array as a whole.  
  
Fabien Coelho and Tom Lane, per suggestion from Alvaro Herrera  
  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904032126060.7997@lancre  

M src/bin/pgbench/pgbench.c

Reduce overhead of pg_mcv_list (de)serialization

commit   : c50b3158bfd7fc8c2a0b2d2ede4415fd9859acd1    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 3 Apr 2019 21:08:36 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 3 Apr 2019 21:08:36 +0200    

Click here for diff

Commit ea4e1c0e8f resolved issues with memory alignment in serialized  
pg_mcv_list values, but it required copying data to/from the varlena  
buffer during serialization and deserialization.  As the MCV lits may  
be fairly large, the overhead (memory consumption, CPU usage) can get  
rather significant too.  
  
This change tweaks the serialization format so that the alignment is  
correct with respect to the varlena value, and so the parts may be  
accessed directly without copying the data.  
  
Catversion bump, as it affects existing pg_statistic_ext data.  

M src/backend/statistics/mcv.c
M src/include/catalog/catversion.h

GSSAPI encryption support

commit   : b0b39f72b9904bcb80f97b35837ccff1578aa4b8    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 3 Apr 2019 15:02:33 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 3 Apr 2019 15:02:33 -0400    

Click here for diff

On both the frontend and backend, prepare for GSSAPI encryption  
support by moving common code for error handling into a separate file.  
Fix a TODO for handling multiple status messages in the process.  
Eliminate the OIDs, which have not been needed for some time.  
  
Add frontend and backend encryption support functions.  Keep the  
context initiation for authentication-only separate on both the  
frontend and backend in order to avoid concerns about changing the  
requested flags to include encryption support.  
  
In postmaster, pull GSSAPI authorization checking into a shared  
function.  Also share the initiator name between the encryption and  
non-encryption codepaths.  
  
For HBA, add "hostgssenc" and "hostnogssenc" entries that behave  
similarly to their SSL counterparts.  "hostgssenc" requires either  
"gss", "trust", or "reject" for its authentication.  
  
Similarly, add a "gssencmode" parameter to libpq.  Supported values are  
"disable", "require", and "prefer".  Notably, negotiation will only be  
attempted if credentials can be acquired.  Move credential acquisition  
into its own function to support this behavior.  
  
Add a simple pg_stat_gssapi view similar to pg_stat_ssl, for monitoring  
if GSSAPI authentication was used, what principal was used, and if  
encryption is being used on the connection.  
  
Finally, add documentation for everything new, and update existing  
documentation on connection security.  
  
Thanks to Michael Paquier for the Windows fixes.  
  
Author: Robbie Harwood, with changes to the read/write functions by me.  
Reviewed in various forms and at different times by: Michael Paquier,  
   Andres Freund, David Steele.  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/runtime.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/Makefile
M src/backend/libpq/auth.c
A src/backend/libpq/be-gssapi-common.c
A src/backend/libpq/be-gssapi-common.h
A src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/hba.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/adt/pgstatfuncs.c
M src/bin/psql/command.c
M src/include/catalog/pg_proc.dat
M src/include/libpq/hba.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/pgstat.h
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
A src/interfaces/libpq/fe-gssapi-common.c
A src/interfaces/libpq/fe-gssapi-common.h
A src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
A src/test/kerberos/t/002_enc.pl
M src/test/regress/expected/rules.out
M src/tools/msvc/Mkvcbuild.pm

Copy name when cloning FKs recurses to partitions

commit   : 5f6fc34af5712995026267b9ace79d06b258a0ae    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 15:32:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 15:32:53 -0300    

Click here for diff

We were passing a string owned by a syscache entry, which was released  
before recursing.  Fix by pstrdup'ing the string.  
  
Per buildfarm member prion.  

M src/backend/commands/tablecmds.c

Support foreign keys that reference partitioned tables

commit   : f56f8f8da6afd8523b4d5284e02a20ed2b33ef8d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 14:38:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 14:38:20 -0300    

Click here for diff

Previously, while primary keys could be made on partitioned tables, it  
was not possible to define foreign keys that reference those primary  
keys.  Now it is possible to do that.  
  
Author: Álvaro Herrera  
Reviewed-by: Amit Langote, Jesper Pedersen  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/describe.c
M src/include/commands/tablecmds.h
M src/include/commands/trigger.h
M src/include/utils/ruleutils.h
A src/test/isolation/expected/fk-partitioned-1.out
A src/test/isolation/expected/fk-partitioned-2.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/fk-partitioned-1.spec
A src/test/isolation/specs/fk-partitioned-2.spec
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Generate less WAL during GiST, GIN and SP-GiST index build.

commit   : 9155580fd5fc2a0cbb23376dfca7cd21f59c2c7b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Apr 2019 17:03:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Apr 2019 17:03:15 +0300    

Click here for diff

Instead of WAL-logging every modification during the build separately,  
first build the index without any WAL-logging, and make a separate pass  
through the index at the end, to write all pages to the WAL. This  
significantly reduces the amount of WAL generated, and is usually also  
faster, despite the extra I/O needed for the extra scan through the index.  
WAL generated this way is also faster to replay.  
  
For GiST, the LSN-NSN interlock makes this a little tricky. All pages must  
be marked with a valid (i.e. non-zero) LSN, so that the parent-child  
LSN-NSN interlock works correctly. We now use magic value 1 for that during  
index build. Change the fake LSN counter to begin from 1000, so that 1 is  
safely smaller than any real or fake LSN. 2 would've been enough for our  
purposes, but let's reserve a bigger range, in case we need more special  
values in the future.  
  
Author: Anastasia Lubennikova, Andrey V. Lepikhov  
Reviewed-by: Heikki Linnakangas, Dmitry Dolgov  

M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/include/access/gin.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/access/spgxlog.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h

Correctly initialize newly added struct member

commit   : 5f768045a1a25847a3eea59d309e28c8141aed44    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 09:56:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 3 Apr 2019 09:56:20 -0300    

Click here for diff

Valgrind was rightly complaining that IndexVacuumInfo->report_progress  
(added by commit ab0dfc961b6a) was not being initialized in some code  
paths.  Repair.  
  
Per buildfarm member lousyjack.  

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

Prevent use of uninitialized variable

commit   : e8abf97af770401934a2fc4887940b76403520f0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Apr 2019 16:03:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Apr 2019 16:03:26 -0300    

Click here for diff

Per buildfarm member longfin.  

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

Update expected output for modified catalog definition

commit   : 11074f26bc072334ab91e5646d113f95f884bd07    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Apr 2019 15:43:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Apr 2019 15:43:32 -0300    

Click here for diff

Pilot error in previous commit  

M src/test/regress/expected/rules.out

Report progress of CREATE INDEX operations

commit   : ab0dfc961b6a821f23d9c40c723d11380ce195a6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 2 Apr 2019 15:18:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 2 Apr 2019 15:18:08 -0300    

Click here for diff

This uses the progress reporting infrastructure added by c16dc1aca5e0,  
adding support for CREATE INDEX and CREATE INDEX CONCURRENTLY.  
  
There are two pieces to this: one is index-AM-agnostic, and the other is  
AM-specific.  The latter is fairly elaborate for btrees, including  
reportage for parallel index builds and the separate phases that btree  
index creation uses; other index AMs, which are much simpler in their  
building procedures, have simplistic reporting only, but that seems  
sufficient, at least for non-concurrent builds.  
  
The index-AM-agnostic part is fairly complete, providing insight into  
the CONCURRENTLY wait phases as well as block-based progress during the  
index validation table scan.  (The index validation index scan requires  
patching each AM, which has not been included here.)  
  
Reviewers: Rahila Syed, Pavan Deolasee, Tatsuro Yamada  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M contrib/bloom/blinsert.c
M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashsort.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgutils.c
M src/backend/catalog/index.c
M src/backend/catalog/system_views.sql
M src/backend/commands/indexcmds.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/access/amapi.h
M src/include/access/genam.h
M src/include/access/nbtree.h
M src/include/access/tableam.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/commands/progress.h
M src/include/pgstat.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/test/regress/expected/rules.out

Add support for partial TOAST decompression

commit   : 4d0e994eed83c845a05da6e9a417b4efec67efaf    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 2 Apr 2019 12:35:32 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 2 Apr 2019 12:35:32 -0400    

Click here for diff

When asked for a slice of a TOAST entry, decompress enough to return the  
slice instead of decompressing the entire object.  
  
For use cases where the slice is at, or near, the beginning of the entry,  
this avoids a lot of unnecessary decompression work.  
  
This changes the signature of pglz_decompress() by adding a boolean to  
indicate if it's ok for the call to finish before consuming all of the  
source or destination buffers.  
  
Author: Paul Ramsey  
Reviewed-By: Rafia Sabih, Darafei Praliaskouski, Regina Obe  
Discussion: https://postgr.es/m/CACowWR07EDm7Y4m2kbhN_jnys%3DBBf9A6768RyQdKm_%3DNpkcaWg%40mail.gmail.com  

M src/backend/access/heap/tuptoaster.c
M src/backend/access/transam/xlogreader.c
M src/backend/utils/adt/varlena.c
M src/common/pg_lzcompress.c
M src/include/common/pg_lzcompress.h

postgres_fdw: Perform the (FINAL, NULL) upperrel operations remotely.

commit   : d50d172e517c1d2aabff3ceb3ad3113b909c5017    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 2 Apr 2019 20:30:45 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 2 Apr 2019 20:30:45 +0900    

Click here for diff

The upper-planner pathification allows FDWs to arrange to push down  
different types of upper-stage operations to the remote side.  This  
commit teaches postgres_fdw to do it for the (FINAL, NULL) upperrel,  
which is responsible for doing LockRows, LIMIT, and/or ModifyTable.  
This provides the ability for postgres_fdw to handle SELECT commands  
so that it 1) skips the LockRows step (if any) (note that this is  
safe since it performs early locking) and 2) pushes down the LIMIT  
and/or OFFSET restrictions (if any) to the remote side.  This doesn't  
handle the INSERT/UPDATE/DELETE cases.  
  
Author: Etsuro Fujita  
Reviewed-By: Antonin Houska and Jeff Janes  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/planner.c
M src/include/nodes/pathnodes.h

Refactor create_limit_path() to share cost adjustment code with FDWs.

commit   : aef65db6769e3f2c855dd89edcf95a536a9ab74f    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 2 Apr 2019 19:55:12 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 2 Apr 2019 19:55:12 +0900    

Click here for diff

This is in preparation for an upcoming commit.  
  
Author: Etsuro Fujita  
Reviewed-By: Antonin Houska and Jeff Janes  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/pathnode.h

commit   : 0269edefacb78700c95572c41a5a4c8633b631b6    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 2 Apr 2019 19:38:56 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 2 Apr 2019 19:38:56 +0900    

Click here for diff

This prevents the tests added by commit 4bbf6edfbd and adjusted by  
commit 99f6a17dd6 from being useless by plan changes created by an  
upcoming commit.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/[email protected]  

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

postgres_fdw: Perform the (ORDERED, NULL) upperrel operations remotely.

commit   : ffab494a4d4676a71e830b2d7285eeeb5f2b53d7    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 2 Apr 2019 19:20:30 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 2 Apr 2019 19:20:30 +0900    

Click here for diff

The upper-planner pathification allows FDWs to arrange to push down  
different types of upper-stage operations to the remote side.  This  
commit teaches postgres_fdw to do it for the (ORDERED, NULL) upperrel,  
which is responsible for evaluating the query's ORDER BY ordering.  
Since postgres_fdw is already able to evaluate that ordering remotely  
for foreign baserels and foreign joinrels (see commit aa09cd242f et al.),  
this adds support for that for foreign grouping relations.  
  
Author: Etsuro Fujita  
Reviewed-By: Antonin Houska and Jeff Janes  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h

Perform RLS subquery checks as the right user when going via a view.

commit   : e2d28c0f404713f564dc2250646551c75172f17b    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 2 Apr 2019 08:13:59 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 2 Apr 2019 08:13:59 +0100    

Click here for diff

When accessing a table with RLS via a view, the RLS checks are  
performed as the view owner. However, the code neglected to propagate  
that to any subqueries in the RLS checks. Fix that by calling  
setRuleCheckAsUser() for all RLS policy quals and withCheckOption  
checks for RTEs with RLS.  
  
Back-patch to 9.5 where RLS was added.  
  
Per bug #15708 from daurnimator.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add progress reporting to pg_checksums

commit   : 280e5f14056bf34a0f52320f659fb93acfda0876    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Apr 2019 10:58:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Apr 2019 10:58:07 +0900    

Click here for diff

This adds a new option to pg_checksums called -P/--progress, showing  
every second some information about the computation state of an  
operation for --check and --enable (--disable only updates the control  
file and is quick).  This requires a pre-scan of the data folder so as  
the total size of checksummable items can be calculated, and then it  
gets compared to the amount processed.  
  
Similarly to what is done for pg_rewind and pg_basebackup, the  
information printed in the progress report consists of the current  
amount of data computed and the total amount of data to compute.  This  
could be extended later on.  
  
Author: Michael Banck, Bernd Helmle  
Reviewed-by: Fabien Coelho, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Add wal_recycle and wal_init_zero GUCs.

commit   : 475861b2615dd63ae8431d811749a6f9a15bbfd6    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 2 Apr 2019 14:37:14 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 2 Apr 2019 14:37:14 +1300    

Click here for diff

On at least ZFS, it can be beneficial to create new WAL files every  
time and not to bother zero-filling them.  Since it's not clear which  
other filesystems might benefit from one or both of those things,  
add individual GUCs to control those two behaviors independently and  
make only very general statements in the docs.  
  
Author: Jerry Jelinek, with some adjustments by Thomas Munro  
Reviewed-by: Alvaro Herrera, Andres Freund, Tomas Vondra, Robert Haas and others  
Discussion: https://postgr.es/m/CACPQ5Fo00QR7LNAcd1ZjgoBi4y97%2BK760YABs0vQHH5dLdkkMA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h

Only allow heap in a number of contrib modules.

commit   : 4b82664156c230b59607704506f5b0a32ef490a2    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 1 Apr 2019 14:57:21 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 1 Apr 2019 14:57:21 -0700    

Click here for diff

Contrib modules pgrowlocks, pgstattuple and some functionality in  
pageinspect currently only supports the heap table AM. As they are all  
concerned with low-level details that aren't reasonably exposed via  
tableam, error out if invoked on a non heap relation.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/heapfuncs.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstattuple.c

tableam: Add table_finish_bulk_insert().

commit   : d45e40158623baacd3f36f92a670d435cc1e845f    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 1 Apr 2019 14:41:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 1 Apr 2019 14:41:42 -0700    

Click here for diff

This replaces the previous calls of heap_sync() in places using  
bulk-insert. By passing in the flags used for bulk-insert the AM can  
decide (first at insert time and then during the finish call) which of  
the optimizations apply to it, and what operations are necessary to  
finish a bulk insert operation.  
  
Also change HEAP_INSERT_* flags to TABLE_INSERT, and rename hi_options  
to ti_options.  
  
These changes are made even in copy.c, which hasn't yet been converted  
to tableam. There's no harm in doing so.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/include/access/tableam.h

Restrict pgbench's zipfian parameter to ensure good performance.

commit   : 26a76cb64072df6fa5585c2c15df39970ccdce01    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2019 17:37:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2019 17:37:26 -0400    

Click here for diff

Remove the code that supported zipfian distribution parameters less  
than 1.0, as it had undocumented performance hazards, and it's not  
clear that the case is useful enough to justify either fixing or  
documenting those hazards.  
  
Also, since the code path for parameter > 1.0 could perform badly  
for values very close to 1.0, establish a minimum allowed value  
of 1.001.  This solution seems superior to the previous vague  
documentation warning about small values not performing well.  
  
Fabien Coelho, per a gripe from Tomas Vondra  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix deadlock in heap_compute_xid_horizon_for_tuples().

commit   : 4fd05bb55b40a3c9dde2b19942f275fc31b5225a    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 2 Apr 2019 09:08:15 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 2 Apr 2019 09:08:15 +1300    

Click here for diff

We can't call code that uses syscache while we hold buffer locks  
on a catalog relation.  If passed such a relation, just fall back  
to the general effective_io_concurrency GUC rather than trying to  
look up the containing tablespace's IO concurrency setting.  
  
We might find a better way to control prefetching in follow-up  
work, but for now this is enough to avoid the deadlock introduced  
by commit 558a9165e0.  
  
Reviewed-by: Andres Freund  
Diagnosed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CA%2BhUKGLCwPF0S4Mk7S8qw%2BDK0Bq65LueN9rofAA3HHSYikW-Zw%40mail.gmail.com  
Discussion: https://postgr.es/m/962831d8-c18d-180d-75fb-8b842e3a2742%40chrullrich.net  

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

Improve documentation about our XML functionality.

commit   : 12d46ac392d00fa0d103f445aa4997f97029e007    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2019 16:20:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2019 16:20:22 -0400    

Click here for diff

Add a section explaining how our XML features depart from current  
versions of the SQL standard.  Update and clarify the descriptions  
of some XML functions.  
  
Chapman Flack, reviewed by Ryan Lambert  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAN-V+g-6JqUQEQZ55Q3toXEN6d5Ez5uvzL4VR+8KtvJKj31taw@mail.gmail.com  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt

Add volatile qualifier missed in commit 2e616dee9.

commit   : b2b819019f4449f2fd889ce0c39ffa81ebfaee16    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2019 14:37:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Apr 2019 14:37:25 -0400    

Click here for diff

Noted by Pavel Stehule  
  
Discussion: https://postgr.es/m/CAFj8pRAaGO5FX7bnP3E=mRssoK8y5T78x7jKy-vDiyS68L888Q@mail.gmail.com  

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

Unified logging system for command-line programs

commit   : cc8d41511721d25d557fc02a46c053c0a602fed0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Apr 2019 14:24:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Apr 2019 14:24:37 +0200    

Click here for diff

This unifies the various ad hoc logging (message printing, error  
printing) systems used throughout the command-line programs.  
  
Features:  
  
- Program name is automatically prefixed.  
  
- Message string does not end with newline.  This removes a common  
  source of inconsistencies and omissions.  
  
- Additionally, a final newline is automatically stripped, simplifying  
  use of PQerrorMessage() etc., another common source of mistakes.  
  
- I converted error message strings to use %m where possible.  
  
- As a result of the above several points, more translatable message  
  strings can be shared between different components and between  
  frontends and backend, without gratuitous punctuation or whitespace  
  differences.  
  
- There is support for setting a "log level".  This is not meant to be  
  user-facing, but can be used internally to implement debug or  
  verbose modes.  
  
- Lazy argument evaluation, so no significant overhead if logging at  
  some level is disabled.  
  
- Some color in the messages, similar to gcc and clang.  Set  
  PG_COLOR=auto to try it out.  Some colors are predefined, but can be  
  customized by setting PG_COLORS.  
  
- Common files (common/, fe_utils/, etc.) can handle logging much more  
  simply by just using one API without worrying too much about the  
  context of the calling program, requiring callbacks, or having to  
  pass "progname" around everywhere.  
  
- Some programs called setvbuf() to make sure that stderr is  
  unbuffered, even on Windows.  But not all programs did that.  This  
  is now done centrally.  
  
Soft goals:  
  
- Reduces vertical space use and visual complexity of error reporting  
  in the source code.  
  
- Encourages more deliberate classification of messages.  For example,  
  in some cases it wasn't clear without analyzing the surrounding code  
  whether a message was meant as an error or just an info.  
  
- Concepts and terms are vaguely aligned with popular logging  
  frameworks such as log4j and Python logging.  
  
This is all just about printing stuff out.  Nothing affects program  
flow (e.g., fatal exits).  The uses are just too varied to do that.  
Some existing code had wrappers that do some kind of print-and-exit,  
and I adapted those.  
  
I tried to keep the output mostly the same, but there is a lot of  
historical baggage to unwind and special cases to consider, and I  
might not always have succeeded.  One significant change is that  
pg_rewind used to write all error messages to stdout.  That is now  
changed to stderr.  
  
Reviewed-by: Donald Dong <[email protected]>  
Reviewed-by: Arthur Zakirov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/clusterdb.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/dropdb.sgml
M doc/src/sgml/ref/dropuser.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_controldata.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_isready.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/initdb/initdb.c
M src/bin/initdb/nls.mk
M src/bin/pg_archivecleanup/Makefile
M src/bin/pg_archivecleanup/nls.mk
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/nls.mk
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/nls.mk
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/logging.c
M src/bin/pg_rewind/logging.h
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/Makefile
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_waldump/Makefile
M src/bin/pg_waldump/nls.mk
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/bin/psql/input.c
M src/bin/psql/large_obj.c
M src/bin/psql/mainloop.c
M src/bin/psql/nls.mk
M src/bin/psql/psqlscanslash.l
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/nls.mk
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/controldata_utils.c
M src/common/file_utils.c
M src/common/pgfnames.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/fe_utils/Makefile
A src/fe_utils/logging.c
M src/fe_utils/psqlscan.l
M src/include/common/controldata_utils.h
M src/include/common/file_utils.h
M src/include/common/restricted_token.h
A src/include/fe_utils/logging.h
M src/include/fe_utils/psqlscan.h
M src/interfaces/ecpg/test/Makefile
M src/nls-global.mk
M src/test/isolation/Makefile
M src/test/perl/TestLib.pm
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/tools/msvc/Mkvcbuild.pm

Throw error in jsonb_path_match() when result is not single boolean

commit   : b4cc19ab01ffe6a72a915b21aa41536de80923f5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 1 Apr 2019 18:09:20 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 1 Apr 2019 18:09:20 +0300    

Click here for diff

jsonb_path_match() checks if jsonb document matches jsonpath query.  Therefore,  
jsonpath query should return single boolean.  Currently, if result of jsonpath  
is not a single boolean, NULL is returned independently whether silent mode  
is on or off.  But that appears to be wrong when silent mode is off.  This  
commit makes jsonb_path_match() throw an error in this case.  
  
Author: Nikita Glukhov  

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

Restrict some cases in parsing numerics in jsonpath

commit   : 2e643501e5281ad5e0fa626dab1d51c1d38f639a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 1 Apr 2019 18:09:09 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 1 Apr 2019 18:09:09 +0300    

Click here for diff

Jsonpath now accepts integers with leading zeroes and floats starting with  
a dot.  However, SQL standard requires to follow JSON specification, which  
doesn't allow none of these cases.  Our json[b] datatypes also restrict that.  
So, restrict it in jsonpath altogether.  
  
Author: Nikita Glukhov  

M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonpath.out

GIN support for @@ and @? jsonpath operators

commit   : 0a02e2ae0236103e641f6570b8135b7ee8a83686    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 1 Apr 2019 18:08:15 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 1 Apr 2019 18:08:15 +0300    

Click here for diff

This commit makes existing GIN operator classes jsonb_ops and json_path_ops  
support "jsonb @@ jsonpath" and "jsonb @? jsonpath" operators.  Basic idea is  
to extract statements of following form out of jsonpath.  
  
 key1.key2. ... .keyN = const  
  
The rest of jsonpath is rechecked from heap.  
  
Catversion is bumped.  
  
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com  
Author: Nikita Glukhov, Alexander Korotkov  
Reviewed-by: Jonathan Katz, Pavel Stehule  

M doc/src/sgml/gin.sgml
M doc/src/sgml/json.sgml
M src/backend/utils/adt/jsonb_gin.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.dat
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/jsonb.sql
M src/tools/pgindent/typedefs.list

Catch syntax error in generated column definition

commit   : 7241911782a7420e38b6e50b57d304ea48bc5362    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Apr 2019 10:46:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Apr 2019 10:46:37 +0200    

Click here for diff

The syntax  
  
    GENERATED BY DEFAULT AS (expr)  
  
is not allowed but we have to accept it in the grammar to avoid  
shift/reduce conflicts because of the similar syntax for identity  
columns.  The existing code just ignored this, incorrectly.  Add an  
explicit error check and a bespoke error message.  
  
Reported-by: Justin Pryzby <[email protected]>  

M src/backend/parser/gram.y
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Fix thinko in allocation call during MVC list deserialization

commit   : 4ae7f02b0364ccba49a82efbfff46125fb357d6c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Apr 2019 14:16:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Apr 2019 14:16:27 +0900    

Click here for diff

Spotted by Coverity.  

M src/backend/statistics/mcv.c

Update HINT for pre-existing shared memory block.

commit   : 5a907404b52753c4d6c6a7c21765aeaa42fd6a3b    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 31 Mar 2019 19:32:48 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 31 Mar 2019 19:32:48 -0700    

Click here for diff

One should almost always terminate an old process, not use a manual  
removal tool like ipcrm.  Removal of the ipcclean script eleven years  
ago (39627b1ae680cba44f6e56ca5facec4fdbfe9495) and its non-replacement  
corroborate that manual shm removal is now a niche goal.  Back-patch to  
9.4 (all supported versions).  
  
Reviewed by Daniel Gustafsson and Kyotaro HORIGUCHI.  
  
Discussion: https://postgr.es/m/[email protected]  

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

tableam: bitmap table scan.

commit   : bfbcad478f05794e5e7ea1339e62a1d258c99b6c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 31 Mar 2019 17:51:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 31 Mar 2019 17:51:49 -0700    

Click here for diff

This moves bitmap heap scan support to below an optional tableam  
callback. It's optional as the whole concept of bitmap heapscans is  
fairly block specific.  
  
This basically moves the work previously done in bitgetpage() into the  
new scan_bitmap_next_block callback, and the direct poking into the  
buffer done in BitmapHeapNext() into the new scan_bitmap_next_tuple()  
callback.  
  
The abstraction is currently somewhat leaky because  
nodeBitmapHeapscan.c's prefetching and visibilitymap based logic  
remains - it's likely that we'll later have to move more into the  
AM. But it's not trivial to do so without introducing a significant  
amount of code duplication between the AMs, so that's a project for  
later.  
  
Note that now nodeBitmapHeapscan.c and the associated node types are a  
bit misnamed. But it's not clear whether renaming wouldn't be a cure  
worse than the disease. Either way, that'd be best done in a separate  
commit.  
  
Author: Andres Freund  
Reviewed-By: Robert Haas (in an older version)  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/optimizer/util/plancat.c
M src/include/access/tableam.h
M src/include/nodes/execnodes.h
M src/include/nodes/tidbitmap.h

tableam: sample scan.

commit   : 73c954d24896aeb05de0f81d75e891a858e439e9    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 30 Mar 2019 20:18:53 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 30 Mar 2019 20:18:53 -0700    

Click here for diff

This moves sample scan support to below tableam. It's not optional as  
there is, in contrast to e.g. bitmap heap scans, no alternative way to  
perform tablesample queries. If an AM can't deal with the block based  
API, it will have to throw an ERROR.  
  
The tableam callbacks for this are block based, but given the current  
TsmRoutine interface, that seems to be required.  
  
The new interface doesn't require TsmRoutines to perform visibility  
checks anymore - that requires the TsmRoutine to know details about  
the AM, which we want to avoid.  To continue to allow taking the  
returned number of tuples account SampleScanState now has a donetuples  
field (which previously e.g. existed in SystemRowsSamplerData), which  
is only incremented after the visibility check succeeds.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M doc/src/sgml/tablesample-method.sgml
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/access/tablesample/system.c
M src/backend/executor/nodeSamplescan.c
M src/include/access/tableam.h
M src/include/access/tsmapi.h
M src/include/nodes/execnodes.h

tableam: Formatting and other minor cleanups.

commit   : 4bb50236eb561f4639e75a393a5a1c9b8681acfb    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 30 Mar 2019 20:13:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 30 Mar 2019 20:13:56 -0700    

Click here for diff

The superflous heapam_xlog.h includes were reported by Peter  
Geoghegan.  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/optimizer/util/plancat.c
M src/include/access/tableam.h

Fix nbtree high key "continuescan" row compare bug.

commit   : 76a39f2295ecb040f2ea052320941e1eb9b526c0    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 31 Mar 2019 17:24:04 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 31 Mar 2019 17:24:04 -0700    

Click here for diff

Commit 29b64d1d mishandled skipping over truncated high key attributes  
during row comparisons.  The row comparison key matching loop would loop  
forever when a truncated attribute was encountered for a row compare  
subkey.  Fix by following the example of other code in the loop: advance  
the current subkey, or break out of the loop when the last subkey is  
reached.  
  
Add test coverage for the relevant _bt_check_rowcompare() code path.  
The new test case is somewhat tied to nbtree implementation details,  
which isn't ideal, but seems unavoidable.  

M src/backend/access/nbtree/nbtutils.c
M src/test/regress/expected/index_including.out
M src/test/regress/sql/index_including.sql

Add test case exercising formerly-unreached code in inheritance_planner.

commit   : 8fba397f0ca7b9a1fd59ab2b676c057dde4f8219    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Mar 2019 15:49:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Mar 2019 15:49:06 -0400    

Click here for diff

There was some debate about whether the code I'd added to remap  
AppendRelInfos obtained from the initial SELECT planning run is  
actually necessary.  Add a test case demonstrating that it is.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Compute root->qual_security_level in a less random place.

commit   : 9fd4de119c609b4110eea74f00f7b9002e14aa38    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Mar 2019 13:47:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Mar 2019 13:47:41 -0400    

Click here for diff

We can set this up once and for all in subquery_planner's initial survey  
of the flattened rangetable, rather than incrementally adjusting it in  
build_simple_rel.  The previous approach made it rather hard to reason  
about exactly when the value would be available, and we were definitely  
using it in some places before the final value was computed.  
  
Noted while fooling around with Amit Langote's patch to delay creation  
of inheritance child rels.  That didn't break this code, but it made it  
even more fragile, IMO.  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/relnode.c

Skip redundant anti-wraparound vacuums

commit   : 2aa6e331ead7f3ad080561495ad4bd3bc7cd8913    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 31 Mar 2019 22:59:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 31 Mar 2019 22:59:12 +0900    

Click here for diff

An anti-wraparound vacuum has to be by definition aggressive as it needs  
to work on all the pages of a relation.  However it can happen that due  
to some concurrent activity an anti-wraparound vacuum is marked as  
non-aggressive, which makes it redundant with a previous run, and  
it is actually useless as an anti-wraparound vacuum should process all  
the pages of a relation.  This commit makes such vacuums to be skipped.  
  
An anti-wraparound vacuum not aggressive can be found easily by mixing  
low values of autovacuum_freeze_max_age (to control anti-wraparound) and  
autovacuum_freeze_table_age (to control the aggressiveness).  
  
28a8fa9 has added some extra logging printing all the possible  
combinations of anti-wraparound and aggressive vacuums, which now gets  
simplified as an anti-wraparound vacuum also non-aggressive gets  
skipped.  
  
Per discussion mainly between Andrew Dunstan, Robert Haas, Álvaro  
Herrera, Kyotaro Horiguchi, Masahiko Sawada, and myself.  
  
Author: Kyotaro Horiguchi, Michael Paquier  
Reviewed-by: Andrew Dunstan, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Have pg_upgrade's Makefile honor NO_TEMP_INSTALL

commit   : 47b3c26642e6850e8dfa7afe01db78320b11549e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 31 Mar 2019 08:08:14 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 31 Mar 2019 08:08:14 -0400    

Click here for diff

Backpatch to 9.5, when pg_upgrade's location changed.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/Makefile

tableam: Move heap specific logic from estimate_rel_size below tableam.

commit   : 696d78469f3714a8159f7a145af1fe9179fe3291    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 30 Mar 2019 16:40:33 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 30 Mar 2019 16:40:33 -0700    

Click here for diff

This just moves the table/matview[/toast] determination of relation  
size to a callback, and uses a copy of the existing logic to implement  
that callback for heap.  
  
It probably would make sense to also move the index specific logic  
into a callback, so the metapage handling (and probably more) can be  
index specific. But that's a separate task.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/optimizer/util/plancat.c
M src/include/access/tableam.h
M src/include/optimizer/plancat.h

tableam: VACUUM and ANALYZE support.

commit   : 737a292b5de296615a715ddce2b2d83d1ee245c5    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 30 Mar 2019 16:21:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 30 Mar 2019 16:21:09 -0700    

Click here for diff

This is a relatively straightforward move of the current  
implementation to sit below tableam. As the current analyze sampling  
implementation is pretty inherently block based, the tableam analyze  
interface is as well. It might make sense to generalize that at some  
point, but that seems like a larger project that shouldn't be  
undertaken at the same time as the introduction of tableam.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/include/access/tableam.h

Fix typo

commit   : 0f5493fdf19306314e7a729750a83b26a3264412    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 31 Mar 2019 03:29:58 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 31 Mar 2019 03:29:58 +0200    

Click here for diff

Author: John Naylor  

M src/backend/statistics/mcv.c

Speed up planning when partitions can be pruned at plan time.

commit   : 428b260f87e8861ba8e58807b69d433db491c4f4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Mar 2019 18:58:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Mar 2019 18:58:55 -0400    

Click here for diff

Previously, the planner created RangeTblEntry and RelOptInfo structs  
for every partition of a partitioned table, even though many of them  
might later be deemed uninteresting thanks to partition pruning logic.  
This incurred significant overhead when there are many partitions.  
Arrange to postpone creation of these data structures until after  
we've processed the query enough to identify restriction quals for  
the partitioned table, and then apply partition pruning before not  
after creation of each partition's data structures.  In this way  
we need not open the partition relations at all for partitions that  
the planner has no real interest in.  
  
For queries that can be proven at plan time to access only a small  
number of partitions, this patch improves the practical maximum  
number of partitions from under 100 to perhaps a few thousand.  
  
Amit Langote, reviewed at various times by Dilip Kumar, Jesper Pedersen,  
Yoshikazu Imai, and David Rowley  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/executor/execPartition.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/partitioning/partprune.c
M src/include/nodes/plannodes.h
M src/include/optimizer/inherit.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Fix compiler warnings in multivariate MCV code

commit   : ad3107b97324e0c8cf65932294115b6af9db8ded    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 30 Mar 2019 18:43:16 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 30 Mar 2019 18:43:16 +0100    

Click here for diff

Compiler warnings were observed on gcc 3.4.6 (on gaur).  
  
The assert is unnecessary, as the indexes are uint16 and so always >= 0.  
  
Reported-by: Tom Lane  

M src/backend/statistics/mcv.c

Additional fixes of memory alignment in pg_mcv_list code

commit   : ea4e1c0e8f583f99c8caab5bcdfbbbaaed0685c0    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 30 Mar 2019 18:34:59 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 30 Mar 2019 18:34:59 +0100    

Click here for diff

Commit d85e0f366a tried to fix memory alignment issues in serialization  
and deserialization of pg_mcv_list values, but it was a few bricks shy.  
The arrays of uint16 indexes in serialized items was not aligned, and  
the both the values and isnull flags were using the same pointer.  
  
Per investigation by Tom Lane on gaur.  

M src/backend/statistics/mcv.c

Avoid crash in partitionwise join planning under GEQO.

commit   : 7ad6498fd5a654de6e743814c36cf619a3b5ddb6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Mar 2019 12:48:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Mar 2019 12:48:19 -0400    

Click here for diff

While trying to plan a partitionwise join, we may be faced with cases  
where one or both input partitions for a particular segment of the join  
have been pruned away.  In HEAD and v11, this is problematic because  
earlier processing didn't bother to make a pruned RelOptInfo fully  
valid.  With an upcoming patch to make partition pruning more efficient,  
this'll be even more problematic because said RelOptInfo won't exist at  
all.  
  
The existing code attempts to deal with this by retroactively making the  
RelOptInfo fully valid, but that causes crashes under GEQO because join  
planning is done in a short-lived memory context.  In v11 we could  
probably have fixed this by switching to the planner's main context  
while fixing up the RelOptInfo, but that idea doesn't scale well to the  
upcoming patch.  It would be better not to mess with the base-relation  
data structures during join planning, anyway --- that's just a recipe  
for order-of-operations bugs.  
  
In many cases, though, we don't actually need the child RelOptInfo,  
because if the input is certainly empty then the join segment's result  
is certainly empty, so we can skip making a join plan altogether.  (The  
existing code ultimately arrives at the same conclusion, but only after  
doing a lot more work.)  This approach works except when the pruned-away  
partition is on the nullable side of a LEFT, ANTI, or FULL join, and the  
other side isn't pruned.  But in those cases the existing code leaves a  
lot to be desired anyway --- the correct output is just the result of  
the unpruned side of the join, but we were emitting a useless outer join  
against a dummy Result.  Pending somebody writing code to handle that  
more nicely, let's just abandon the partitionwise-join optimization in  
such cases.  
  
When the modified code skips making a join plan, it doesn't make a  
join RelOptInfo either; this requires some upper-level code to  
cope with nulls in part_rels[] arrays.  We would have had to have  
that anyway after the upcoming patch.  
  
Back-patch to v11 since the crash is demonstrable there.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_aggregate.sql
M src/test/regress/sql/partition_join.sql

doc: Fix typo

commit   : ef6576f5379edfa29bb4f99880b0f76dd315dd14    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Mar 2019 17:25:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Mar 2019 17:25:13 +0100    

Click here for diff

Author: Justin Pryzby <[email protected]>  

M doc/src/sgml/ref/create_table.sgml

Generated columns

commit   : fc22b6623b6b3bab3cb057ccd282c2bfad1a0b30    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Mar 2019 08:13:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Mar 2019 08:13:09 +0100    

Click here for diff

This is an SQL-standard feature that allows creating columns that are  
computed from expressions rather than assigned, similar to a view or  
materialized view but on a column basis.  
  
This implements one kind of generated column: stored (computed on  
write).  Another kind, virtual (computed on read), is planned for the  
future, and some room is left for it.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/copy.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/trigger.sgml
M src/backend/access/common/tupdesc.c
M src/backend/catalog/heap.c
M src/backend/catalog/information_schema.sql
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.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/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.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/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/access/tupdesc.h
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_class.dat
M src/include/executor/nodeModifyTable.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/optimizer/plancat.h
M src/include/parser/kwlist.h
M src/include/parser/parse_node.h
M src/include/utils/lsyscache.h
M src/pl/plperl/expected/plperl_trigger.out
M src/pl/plperl/plperl.c
M src/pl/plperl/sql/plperl_trigger.sql
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/expected/plpython_trigger.out
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
M src/pl/plpython/sql/plpython_trigger.sql
M src/pl/tcl/expected/pltcl_trigger.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_trigger.sql
M src/test/regress/expected/create_table_like.out
A src/test/regress/expected/generated.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/create_table_like.sql
A src/test/regress/sql/generated.sql
A src/test/subscription/t/011_generated.pl

Small code simplification for REINDEX CONCURRENTLY

commit   : 6b8b5364ddd0e4d882562615c6b6c28638ade9f2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Mar 2019 07:16:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Mar 2019 07:16:24 +0100    

Click here for diff

This was left over from an earlier code structure.  

M src/backend/commands/indexcmds.c

doc: Small documentation review for REINDEX CONCURRENTLY

commit   : 173268f4d011fcae1f909c811e264baf6c838e7a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 22:47:33 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 22:47:33 +0100    

Click here for diff

Author: Justin Pryzby <[email protected]>  

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

doc: Fix typo

commit   : 0267629e1889b3e1e2e6b2f1b41e8993eff86a9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 22:41:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 22:41:19 +0100    

Click here for diff

Author: Bossart, Nathan <[email protected]>  

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

commit   : 9c7fb7e6d8d0fdcabbdc32daad2159812e538bd5    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 29 Mar 2019 12:29:05 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 29 Mar 2019 12:29:05 -0700    

Click here for diff

M contrib/amcheck/verify_nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/include/access/nbtree.h

Fix memory alignment in pg_mcv_list serialization

commit   : d85e0f366a347633f255b8d1031ab34733c5e147    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 29 Mar 2019 18:50:51 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 29 Mar 2019 18:50:51 +0100    

Click here for diff

Blind attempt at fixing ia64, hppa an sparc builds.  
  
The serialized representation of MCV lists did not enforce proper memory  
alignment for internal fields, resulting in deserialization issues on  
platforms that are more sensitive to this (ia64, sparc and hppa).  
  
This forces a catalog version bump, because the layout of serialized  
pg_mcv_list changes.  
  
Broken since 7300a699.  

M src/backend/statistics/mcv.c
M src/include/catalog/catversion.h

Show table access methods as such in psql's \dA.

commit   : d3a5fc17ebdbeaec81bec1f41e304485b3292da3    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 29 Mar 2019 08:59:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 29 Mar 2019 08:59:40 -0700    

Click here for diff

Previously we didn't display a type for table access methods.  
  
Author: Haribabu Kommi  
Discussion: CAJrrPGeeYOqP3hkZyohDx_8dot4zvPuPMDBmhJ=iC85cTBNeYw@mail.gmail.com  

M src/bin/psql/describe.c

tableam: Comment fixes.

commit   : ffa8444ce4828108e49d961cfa64e31078d978f0    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 29 Mar 2019 08:16:35 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 29 Mar 2019 08:16:35 -0700    

Click here for diff

Author: Haribabu Kommi  
Discussion: CAJrrPGeeYOqP3hkZyohDx_8dot4zvPuPMDBmhJ=iC85cTBNeYw@mail.gmail.com  

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

Reorganize Notes section in documentation of pg_checksums

commit   : a7cc52370b2b8a0f9883e299cb07f56d702b58c2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 29 Mar 2019 23:00:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 29 Mar 2019 23:00:51 +0900    

Click here for diff

This commit reorders the paragraphs of the Notes section in order of  
importance, and clarifies better the safe uses of pg_checksums for  
replication setups.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1903231404280.18811@lancre  

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

commit   : c0a2ff474a47216031d1835f5878fa4f445f44fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 13:36:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 13:36:24 +0100    

Click here for diff

suggested by Chapman Flack <[email protected]>  

M doc/src/sgml/README.links

Allow existing VACUUM options to take a Boolean argument.

commit   : 41b54ba78e8c4d64679ba4daf82e4e2efefe1922    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Mar 2019 08:22:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Mar 2019 08:22:49 -0400    

Click here for diff

This makes VACUUM work more like EXPLAIN already does without changing  
the meaning of any commands that already work.  It is intended to  
facilitate the addition of future VACUUM options that may take  
non-Boolean parameters or that default to false.  
  
Masahiko Sawada, reviewed by me.  
  
Discussion: http://postgr.es/m/CA+TgmobpYrXr5sUaEe_T0boabV0DSm=utSOZzwCUNqfLEEm8Mw@mail.gmail.com  
Discussion: http://postgr.es/m/CAD21AoBaFcKBAeL5_++j+Vzir2vBBcF4juW7qH8b3HsQY=Q6+w@mail.gmail.com  

M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuum.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c

Warn more strongly about the dangers of exclusive backup mode.

commit   : c900c15269f0f900d666bd1b0c6df3eff5098678    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Mar 2019 08:09:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Mar 2019 08:09:39 -0400    

Click here for diff

Especially, warn about the hazards of mishandling the backup_label  
file.  Adjust a couple of server messages to be more clear about  
the hazards associated with removing backup_label files, too.  
  
David Steele and Robert Haas, reviewed by Laurenz Albe, Martín  
Marqués, Peter Eisentraut, and Magnus Hagander.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/backup.sgml
M src/backend/access/transam/xlog.c

Fix incorrect code in new REINDEX CONCURRENTLY code

commit   : bb76134b08aa46cdeb0ff1e6d7b392d315529a8c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 10:53:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 10:53:40 +0100    

Click here for diff

The previous code was adding pointers to transient variables to a  
list, but by the time the list was read, the variable might be gone,  
depending on the compiler.  Fix it by making copies in the proper  
memory context.  

M src/backend/commands/indexcmds.c

REINDEX CONCURRENTLY

commit   : 5dc92b844e680c54a7ecd68de0ba53c949c3d605    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 08:25:20 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Mar 2019 08:25:20 +0100    

Click here for diff

This adds the CONCURRENTLY option to the REINDEX command.  A REINDEX  
CONCURRENTLY on a specific index creates a new index (like CREATE  
INDEX CONCURRENTLY), then renames the old index away and the new index  
in place and adjusts the dependencies, and then drops the old  
index (like DROP INDEX CONCURRENTLY).  The REINDEX command also has  
the capability to run its other variants (TABLE, DATABASE) with the  
CONCURRENTLY option (but not SYSTEM).  
  
The reindexdb command gets the --concurrently option.  
  
Author: Michael Paquier, Andreas Karlsson, Peter Eisentraut  
Reviewed-by: Andres Freund, Fujii Masao, Jim Nasby, Sergei Kornilov  
Discussion: https://www.postgresql.org/message-id/flat/60052986-956b-4478-45ed-8bd119e9b9cf%402ndquadrant.com#74948a1044c56c5e817a5050f554ddee  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/reindexdb.sgml
M src/backend/catalog/dependency.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_depend.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/bin/psql/common.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/090_reindexdb.pl
M src/include/catalog/dependency.h
M src/include/catalog/index.h
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
A src/test/isolation/expected/reindex-concurrently.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/reindex-concurrently.spec
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

tableam: relation creation, VACUUM FULL/CLUSTER, SET TABLESPACE.

commit   : d25f519107bff602e1ebc81853fe592d020c118d    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 Mar 2019 20:01:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 Mar 2019 20:01:14 -0700    

Click here for diff

This moves the responsibility for:  
- creating the storage necessary for a relation, including creating a  
  new relfilenode for a relation with existing storage  
- non-transactional truncation of a relation  
- VACUUM FULL / CLUSTER's rewrite of a table  
below tableam.  
  
This is fairly straight forward, with a bit of complexity smattered in  
to move the computation of xid / multixid horizons below the AM, as  
they don't make sense for every table AM.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/storage.c
M src/backend/commands/cluster.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/utils/cache/relcache.c
M src/include/access/tableam.h
M src/include/catalog/heap.h
M src/include/catalog/storage.h
M src/include/utils/relcache.h

Fix typo.

commit   : 7e69323bf72a924fd1b04a7a91da343a0cda91cf    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 29 Mar 2019 10:03:58 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 29 Mar 2019 10:03:58 +1300    

Click here for diff

Author: Masahiko Sawada  

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

Fix a few comment copy & pastos.

commit   : 46bcd2af18b0406207c9dd31ff5e0dab64a76f0a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 Mar 2019 13:42:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 Mar 2019 13:42:37 -0700    

Click here for diff

M src/include/access/tableam.h

Fix deserialization of pg_mcv_list values

commit   : 62bf0fb35cb370e9650981ff0333d198e955bd54    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 28 Mar 2019 20:03:14 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 28 Mar 2019 20:03:14 +0100    

Click here for diff

There were multiple issues in deserialization of pg_mcv_list values.  
  
Firstly, the data is loaded from syscache, but the deserialization was  
performed after ReleaseSysCache(), at which point the data might have  
already disappeared.  Fixed by moving the calls in statext_mcv_load,  
and using the same NULL-handling code as existing stats.  
  
Secondly, the deserialized representation used pointers into the  
serialized representation.  But that is also unsafe, because the data  
may disappear at any time.  Fixed by reworking and simplifying the  
deserialization code to always copy all the data.  
  
And thirdly, when deserializing values for types passed by value, the  
code simply did memcpy(d,s,typlen) which however does not work on  
bigendian machines.  Fixed by using fetch_att/store_att_byval.  

M src/backend/statistics/mcv.c
M src/include/statistics/statistics.h

doc: Fix typo

commit   : f3afbbdae9b6ca04a6d2b224a8dfd5959d8a17ea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Mar 2019 09:29:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Mar 2019 09:29:49 +0100    

Click here for diff

M doc/src/sgml/storage.sgml

Use FullTransactionId for the transaction stack.

commit   : ad308058cc8666c50b43179e64d6bb7aeb3ba169    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 28 Mar 2019 10:59:19 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 28 Mar 2019 10:59:19 +1300    

Click here for diff

Provide GetTopFullTransactionId() and GetCurrentFullTransactionId().  
The intended users of these interfaces are access methods that use  
xids for visibility checks but don't want to have to go back and  
"freeze" existing references some time later before the 32 bit xid  
counter wraps around.  
  
Use a new struct to serialize the transaction state for parallel  
query, because FullTransactionId doesn't fit into the previous  
serialization scheme very well.  
  
Author: Thomas Munro  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/CAA4eK1%2BMv%2Bmb0HFfWM9Srtc6MVe160WFurXV68iAFMcagRZ0dQ%40mail.gmail.com  

M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/include/access/transam.h
M src/include/access/xact.h
M src/tools/pgindent/typedefs.list

Add basic infrastructure for 64 bit transaction IDs.

commit   : 2fc7af5e966043a412e8e69c135fae55a2db6d4f    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 28 Mar 2019 10:34:43 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 28 Mar 2019 10:34:43 +1300    

Click here for diff

Instead of inferring epoch progress from xids and checkpoints,  
introduce a 64 bit FullTransactionId type and use it to track xid  
generation.  This fixes an unlikely bug where the epoch is reported  
incorrectly if the range of active xids wraps around more than once  
between checkpoints.  
  
The only user-visible effect of this commit is to correct the epoch  
used by txid_current() and txid_status(), also visible with  
pg_controldata, in those rare circumstances.  It also creates some  
basic infrastructure so that later patches can use 64 bit  
transaction IDs in more places.  
  
The new type is a struct that we pass by value, as a form of strong  
typedef.  This prevents the sort of accidental confusion between  
TransactionId and FullTransactionId that would be possible if we  
were to use a plain old uint64.  
  
Author: Thomas Munro  
Reported-by: Amit Kapila  
Reviewed-by: Andres Freund, Tom Lane, Heikki Linnakangas  
Discussion: https://postgr.es/m/CAA4eK1%2BMv%2Bmb0HFfWM9Srtc6MVe160WFurXV68iAFMcagRZ0dQ%40mail.gmail.com  

M src/backend/access/rmgrdesc/xlogdesc.c
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/subtrans.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/txid.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/access/transam.h
M src/include/access/xlog.h
M src/include/catalog/pg_control.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/tools/pgindent/typedefs.list

tableam: Support for an index build's initial table scan(s).

commit   : 2a96909a4a8c38705163b83a81b228d5aec197f9    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 27 Mar 2019 19:59:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 27 Mar 2019 19:59:06 -0700    

Click here for diff

To support building indexes over tables of different AMs, the scans to  
do so need to be routed through the table AM.  While moving a fair  
amount of code, nearly all the changes are just moving code to below a  
callback.  
  
Currently the range based interface wouldn't make much sense for non  
block based table AMs. But that seems aceptable for now.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M contrib/bloom/blinsert.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/backend/catalog/index.c
M src/include/access/tableam.h
M src/include/catalog/index.h
M src/tools/pgindent/typedefs.list

Fix vpath build

commit   : 12bb35fc9b000d462b9bd6b8856e1884ef1bb3d7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Mar 2019 23:36:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Mar 2019 23:36:00 +0100    

Click here for diff

Skip doc/src/sgml/images/Makefile since the directory is not created.  

M config/prep_buildtree

doc: Add some images

commit   : ea55aec0a97d6cade0186df1913da2c8cb5c6f2c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Mar 2019 22:57:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Mar 2019 22:57:43 +0100    

Click here for diff

Add infrastructure for having images in the documentation, in SVG  
format.  Add two images to start with.  See the included README file  
for instructions.  
  
Author: Jürgen Purtz <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M .gitattributes
M doc/src/sgml/Makefile
M doc/src/sgml/gin.sgml
A doc/src/sgml/images/Makefile
A doc/src/sgml/images/README
A doc/src/sgml/images/gin.dot
A doc/src/sgml/images/gin.svg
A doc/src/sgml/images/pagelayout.svg
A doc/src/sgml/images/pagelayout.txt
M doc/src/sgml/storage.sgml
M doc/src/sgml/stylesheet-hh.xsl
M doc/src/sgml/stylesheet-html-common.xsl
M doc/src/sgml/stylesheet-html-nochunk.xsl
M doc/src/sgml/stylesheet.xsl

doc: Move htmlhelp output to subdirectory

commit   : 477422c9d176784e90e630de3c92b4fae8590bd2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Mar 2019 22:03:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Mar 2019 22:03:10 +0100    

Click here for diff

This makes it behave more like the html output.  That will make some  
subsequent changes across all output formats easier.  

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

Use Pandoc also for plain-text documentation output

commit   : 2488ea7a9056ab4c0f1bbf56548e829fa40f9c4c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Mar 2019 21:12:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Mar 2019 21:12:10 +0100    

Click here for diff

The makefile rule for the (rarely used) plain-text output postgres.txt  
was still written to use lynx, but in  
96b8b8b6f9d8de4af01a77797273ad88c7a8e32e, where the INSTALL file was  
switched to pandoc, the rest of the makefile support for lynx was  
removed, so this was broken.  Rewrite the rule to also use pandoc for  
postgres.txt.  

M doc/src/sgml/Makefile

Minor improvements for the multivariate MCV lists

commit   : a63b29a1dea0ce4e95f682f9d0b36994f2fcf43e    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 27 Mar 2019 20:07:41 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 27 Mar 2019 20:07:41 +0100    

Click here for diff

The MCV build should always call get_mincount_for_mcv_list(), as the  
there is no other logic to decide whether the MCV list represents all  
the data. So just remove the (ngroups > nitems) condition.  
  
Also, when building MCV lists, the number of items was limited by the  
statistics target (i.e. up to 10000). But when deserializing the MCV  
list, a different value (8192) was used to check the input, causing  
an error.  Simply ensure that the same value is used in both places.  
  
This should have been included in 7300a69950, but I forgot to include it  
in that commit.  

M src/backend/statistics/mcv.c
M src/include/statistics/statistics.h

Add support for multivariate MCV lists

commit   : 7300a699502fe5432b05fbc75baca534b080bebb    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 27 Mar 2019 18:32:18 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 27 Mar 2019 18:32:18 +0100    

Click here for diff

Introduce a third extended statistic type, supported by the CREATE  
STATISTICS command - MCV lists, a generalization of the statistic  
already built and used for individual columns.  
  
Compared to the already supported types (n-distinct coefficients and  
functional dependencies), MCV lists are more complex, include column  
values and allow estimation of much wider range of common clauses  
(equality and inequality conditions, IS NULL, IS NOT NULL etc.).  
Similarly to the other types, a new pseudo-type (pg_mcv_list) is used.  
  
Author: Tomas Vondra  
Reviewed-by: Dean Rasheed, David Rowley, Mark Dilger, Alvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/ref/create_statistics.sgml
M src/backend/commands/statscmds.c
M src/backend/nodes/bitmapset.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_utilcmd.c
M src/backend/statistics/Makefile
M src/backend/statistics/README
A src/backend/statistics/README.mcv
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
A src/backend/statistics/mcv.c
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_type.dat
M src/include/nodes/bitmapset.h
M src/include/optimizer/optimizer.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/stats_ext.sql

Avoid passing query tlist around separately from root->processed_tlist.

commit   : 333ed246c6f351c4e8fe22c764b97793c4101b00    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Mar 2019 12:57:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Mar 2019 12:57:41 -0400    

Click here for diff

In the dim past, the planner kept the fully-processed version of the query  
targetlist (the result of preprocess_targetlist) in grouping_planner's  
local variable "tlist", and only grudgingly passed it to individual other  
routines as needed.  Later we discovered a need to still have it available  
after grouping_planner finishes, and invented the root->processed_tlist  
field for that purpose, but it wasn't used internally to grouping_planner;  
the tlist was still being passed around separately in the same places as  
before.  
  
Now comes a proposed patch to allow appendrel expansion to add entries  
to the processed tlist, well after preprocess_targetlist has finished  
its work.  To avoid having to pass around the tlist explicitly, it's  
proposed to allow appendrel expansion to modify root->processed_tlist.  
That makes aliasing the tlist with assorted parameters and local  
variables really scary.  It would accidentally work as long as the  
tlist is initially nonempty, because then the List header won't move  
around, but it's not exactly hard to think of ways for that to break.  
Aliased values are poor programming practice anyway.  
  
Hence, get rid of local variables and parameters that can be identified  
with root->processed_tlist, in favor of just using that field directly.  
And adjust comments to match.  (Some of the new comments speak as though  
it's already possible for appendrel expansion to modify the tlist; that's  
not true yet, but will happen in a later patch.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/planmain.h

pgbench: doExecuteCommand -> executeMetaCommand

commit   : 9938d116331045171f37eef359992ec64c213384    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 27 Mar 2019 12:17:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 27 Mar 2019 12:17:19 -0300    

Click here for diff

The new function is only in charge of meta commands, not SQL commands.  
This change makes the code a little clearer: now all the state changes  
are effected by advanceConnectionState.  It also removes one indent  
level, which makes the diff look bulkier than it really is.  
  
Author: Fabien Coelho  
Reviewed-by: Kirk Jamison  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1811240904500.12627@lancre  

M src/bin/pgbench/pgbench.c

Suppress uninitialized-variable warning.

commit   : a51cc7e9e60701d31032669011adcda8b4621d93    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Mar 2019 11:10:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Mar 2019 11:10:42 -0400    

Click here for diff

Apparently Andres' compiler is smart enough to see that hpage  
must be initialized before use ... but mine isn't.  

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

Improve error handling of column references in expression transformation

commit   : ecfed4a12247cf4659eee6b6ea27405e35fe57f8    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 27 Mar 2019 21:04:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 27 Mar 2019 21:04:25 +0900    

Click here for diff

Column references are not allowed in default expressions and partition  
bound expressions, and are restricted as such once the transformation of  
their expressions is done.  However, trying to use more complex column  
references can lead to confusing error messages.  For example, trying to  
use a two-field column reference name for default expressions and  
partition bounds leads to "missing FROM-clause entry for table", which  
makes no sense in their respective context.  
  
In order to make the errors generated more useful, this commit adds more  
verbose messages when transforming column references depending on the  
context.  This has a little consequence though: for example an  
expression using an aggregate with a column reference as argument would  
cause an error to be generated for the column reference, while the  
aggregate was the problem reported before this commit because column  
references get transformed first.  
  
The confusion exists for default expressions for a long time, and the  
problem is new as of v12 for partition bounds.  Still per the lack of  
complaints on the matter no backpatch is done.  
  
The patch has been written by Amit Langote and me, and Tom Lane has  
provided the improvement of the documentation for default expressions on  
the CREATE TABLE page.  
  
Author: Amit Langote, Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Fix off-by-one error in txid_status().

commit   : d2fd7f74ee61f41a3bd5daf2942b72cebd88f346    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 27 Mar 2019 21:16:50 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 27 Mar 2019 21:16:50 +1300    

Click here for diff

The transaction ID returned by GetNextXidAndEpoch() is in the future,  
so we can't attempt to access its status or we might try to read a  
CLOG page that doesn't exist.  The > vs >= confusion probably stemmed  
from the choice of a variable name containing the word "last" instead  
of "next", so fix that too.  
  
Back-patch to 10 where the function arrived.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CA%2BhUKG%2Buua_BV5cyfsioKVN2d61Lukg28ECsWTXKvh%3DBtN2DPA%40mail.gmail.com  

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

Switch some palloc/memset calls to palloc0

commit   : 1983af8e899389187026cb34c1ca9d89ea986120    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 27 Mar 2019 12:02:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 27 Mar 2019 12:02:50 +0900    

Click here for diff

Some code paths have been doing some allocations followed by an  
immediate memset() to initialize the allocated area with zeros, this is  
a bit overkill as there are already interfaces to do both things in one  
call.  
  
Author: Daniel Gustafsson  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/vN0OodBPkKs7g2Z1uyk3CUEmhdtspHgYCImhlmSxv1Xn6nY1ZnaaGHL8EWUIQ-NEv36tyc4G5-uA3UXUF2l4sFXtK_EQgLN1hcgunlFVKhA=@yesql.se  

M contrib/tablefunc/tablefunc.c
M src/backend/access/gist/gist.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pgbench/pgbench.c

Switch function current_schema[s]() to be parallel-unsafe

commit   : 5bde1651bbba9984dc32bbeb68b329cfd3f92767    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 27 Mar 2019 11:35:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 27 Mar 2019 11:35:12 +0900    

Click here for diff

When invoked for the first time in a session, current_schema() and  
current_schemas() can finish by creating a temporary schema.  Currently  
those functions are parallel-safe, however if for a reason or another  
they get launched across multiple parallel workers, they would fail when  
attempting to create a temporary schema as temporary contexts are not  
supported in this case.  
  
The original issue has been spotted by buildfarm members crake and  
lapwing, after commit c5660e0 has introduced the first regression tests  
based on current_schema() in the tree.  After that, 396676b has  
introduced a workaround to avoid parallel plans but that was not  
completely right either.  
  
Catversion is bumped.  
  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/temp.out
M src/test/regress/sql/temp.sql

Track unowned relations in doubly-linked list

commit   : 6ca015f9f073eef40f933f587e0b166b87261406    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 27 Mar 2019 02:39:39 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 27 Mar 2019 02:39:39 +0100    

Click here for diff

Relations dropped in a single transaction are tracked in a list of  
unowned relations.  With large number of dropped relations this resulted  
in poor performance at the end of a transaction, when the relations are  
removed from the singly linked list one by one.  
  
Commit b4166911 attempted to address this issue (particularly when it  
happens during recovery) by removing the relations in a reverse order,  
resulting in O(1) lookups in the list of unowned relations.  This did  
not work reliably, though, and it was possible to trigger the O(N^2)  
behavior in various ways.  
  
Instead of trying to remove the relations in a specific order with  
respect to the linked list, which seems rather fragile, switch to a  
regular doubly linked.  That allows us to remove relations cheaply no  
matter where in the list they are.  
  
As b4166911 was a bugfix, backpatched to all supported versions, do the  
same thing here.  
  
Reviewed-by: Alvaro Herrera  
Discussion: https://www.postgresql.org/message-id/flat/80c27103-99e4-1d0c-642c-d9f3b94aaa0a%402ndquadrant.com  
Backpatch-through: 9.4  

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

Compute XID horizon for page level index vacuum on primary.

commit   : 558a9165e081d1936573e5a7d576f5febd7fb55a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Mar 2019 14:41:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Mar 2019 14:41:46 -0700    

Click here for diff

Previously the xid horizon was only computed during WAL replay. That  
had two major problems:  
1) It relied on knowing what the table pointed to looks like. That was  
   easy enough before the introducing of tableam (we knew it had to be  
   heap, although some trickery around logging the heap relfilenodes  
   was required). But to properly handle table AMs we need  
   per-database catalog access to look up the AM handler, which  
   recovery doesn't allow.  
2) Not knowing the xid horizon also makes it hard to support logical  
   decoding on standbys. When on a catalog table, we need to be able  
   to conflict with slots that have an xid horizon that's too old. But  
   computing the horizon by visiting the heap only works once  
   consistency is reached, but we always need to be able to detect  
   conflicts.  
  
There's also a secondary problem, in that the current method performs  
redundant work on every standby. But that's counterbalanced by  
potentially computing the value when not necessary (either because  
there's no standby, or because there's no connected backends).  
  
Solve 1) and 2) by moving computation of the xid horizon to the  
primary and by involving tableam in the computation of the horizon.  
  
To address the potentially increased overhead, increase the efficiency  
of the xid horizon computation for heap by sorting the tids, and  
eliminating redundant buffer accesses. When prefetching is available,  
additionally perform prefetching of buffers.  As this is more of a  
maintenance task, rather than something routinely done in every read  
only query, we add an arbitrary 10 to the effective concurrency -  
thereby using IO concurrency, when not globally enabled.  That's  
possibly not the perfect formula, but seems good enough for now.  
  
Bumps WAL format, as latestRemovedXid is now part of the records, and  
the heap's relfilenode isn't anymore.  
  
Author: Andres Freund, Amit Khandekar, Robert Haas  
Reviewed-By: Robert Haas  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/include/access/genam.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/nbtxlog.h
M src/include/access/tableam.h
M src/include/access/xlog_internal.h
M src/tools/pgindent/typedefs.list

Fix partitioned index creation bug with dropped columns

commit   : 126d631222328d3def7910934bfa9cbdc99d79cc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 26 Mar 2019 20:19:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 26 Mar 2019 20:19:28 -0300    

Click here for diff

ALTER INDEX .. ATTACH PARTITION fails if the partitioned table where the  
index is defined contains more dropped columns than its partition, with  
this message:  
  ERROR:  incorrect attribute map  
The cause was that one caller of CompareIndexInfo was passing the number  
of attributes of the partition rather than the parent, which confused  
the length check.  Repair.  
  
This can cause pg_upgrade to fail when used on such a database.  Leave  
some more objects around after regression tests, so that the case is  
detected by pg_upgrade test suite.  
  
Remove some spurious empty lines noticed while looking for other cases  
of the same problem.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Build "other rels" of appendrel baserels in a separate step.

commit   : 53bcf5e3dbeaed5baf9d09b124cf196d247c54ea    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2019 18:21:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2019 18:21:10 -0400    

Click here for diff

Up to now, otherrel RelOptInfos were built at the same time as baserel  
RelOptInfos, thanks to recursion in build_simple_rel().  However,  
nothing in query_planner's preprocessing cares at all about otherrels,  
only baserels, so we don't really need to build them until just before  
we enter make_one_rel.  This has two benefits:  
  
* create_lateral_join_info did a lot of extra work to propagate  
lateral-reference information from parents to the correct children.  
But if we delay creation of the children till after that, it's  
trivial (and much harder to break, too).  
  
* Since we have all the restriction quals correctly assigned to  
parent appendrels by this point, it'll be possible to do plan-time  
pruning and never make child RelOptInfos at all for partitions that  
can be pruned away.  That's not done here, but will be later on.  
  
Amit Langote, reviewed at various times by Dilip Kumar, Jesper Pedersen,  
Yoshikazu Imai, and David Rowley  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/pathnode.h
M src/include/optimizer/planmain.h

Add ORDER BY to more ICU regression test cases.

commit   : 8994cc6ffc8828569a39139996a0b0b8348ca036    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2019 17:46:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2019 17:46:04 -0400    

Click here for diff

Commit c77e12208 didn't fully fix the problem.  Per buildfarm  
and local testing.  

M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Fix oversight in data-type change for autovacuum_vacuum_cost_delay.

commit   : 7c366ac969ce060c4080fbdfe74a0131ae4bf6bb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2019 13:32:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2019 13:32:30 -0400    

Click here for diff

Commit caf626b2c missed that the relevant reloptions entry needs  
to be moved from the intRelOpts[] array to realRelOpts[].  
Somewhat surprisingly, it seems to work anyway, perhaps because  
the desired default and limit values are all integers.  We ought  
to have either a simpler data structure or better cross-checking  
here, but that's for another patch.  
  
Nikolay Shaplov  
  
Discussion: https://postgr.es/m/4861742.12LTaSB3sv@x200m  

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

psql: Schema-qualify typecast in one \d query

commit   : 1d21ba8a9b8cb784f927a2c9c5818f8ff6779c0b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 26 Mar 2019 13:04:06 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 26 Mar 2019 13:04:06 -0300    

Click here for diff

Bug introduced in my commit bc87f22ef6ef  

M src/bin/psql/describe.c

Get rid of duplicate child RTE for a partitioned table.

commit   : e8d5dd6be79ed532710922105c31a2d25b14430f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2019 12:03:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Mar 2019 12:03:27 -0400    

Click here for diff

We've been creating duplicate RTEs for partitioned tables just  
because we do so for regular inheritance parent tables.  But unlike  
regular-inheritance parents which are themselves regular tables  
and thus need to be scanned, partitioned tables don't need the  
extra RTE.  
  
This makes the conditions for building a child RTE the same as those  
for building an AppendRelInfo, allowing minor simplification in  
expand_single_inheritance_child.  Since the planner's actual processing  
is driven off the AppendRelInfo list, nothing much changes beyond that,  
we just have one fewer useless RTE entry.  
  
Amit Langote, reviewed and hacked a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/util/inherit.c

Improve psql's \d display of foreign key constraints

commit   : 1af25ca0c2d9d110bd7bd5be2a14fb20cd93ee78    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 26 Mar 2019 11:14:34 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 26 Mar 2019 11:14:34 -0300    

Click here for diff

When used on a partition containing foreign keys coming from one of its  
ancestors, \d would (rather unhelpfully) print the details about the  
pg_constraint row in the partition.  This becomes a bit frustrating when  
the user tries things like dropping the FK in the partition; instead,  
show the details for the foreign key on the table where it is defined.  
  
Also, when a table is referenced by a foreign key on a partitioned  
table, we would show multiple "Referenced by" lines, one for each  
partition, which gets unwieldy pretty fast.  Modify that so that it  
shows only one line for the ancestor partitioned table where the FK is  
defined.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Tom Lane, Amit Langote, Peter Eisentraut  

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

Fix typo

commit   : 05295e36ca9b40c53b7c36f5c7f75f822cd49baf    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 26 Mar 2019 13:30:46 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 26 Mar 2019 13:30:46 +0100    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/ecpg.sgml

Fix misplaced const

commit   : c8c885b7a5c8c1175288de1d8aaec3b4ae9050e1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Mar 2019 09:23:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Mar 2019 09:23:08 +0100    

Click here for diff

These instances were apparently trying to carry the const qualifier  
from the arguments through the complex casts, but for that the const  
qualifier was misplaced.  

M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/tsquery_op.c

Remove heap_hot_search().

commit   : 2ac1b2b175ea5456516e59fe2b53a1e0578a5dbd    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2019 19:02:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2019 19:02:36 -0700    

Click here for diff

After 71bdc99d0d7, "tableam: Add helper for indexes to check if a  
corresponding table tuples exist." there's no in-core user left. As  
there's unlikely to be an external user, and such an external user  
could easily be adjusted to use table_index_fetch_tuple_check(),  
remove heap_hot_search().  
  
Per complaint from Peter Geoghegan  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/CAH2-Wzn0Oq4ftJrTqRAsWy2WGjv0QrJcwoZ+yqWsF_Z5vjUBFw@mail.gmail.com  

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

Fix crash when using partition bound expressions

commit   : cdde886d36b5a4d7ad9e1d02596f7fa1c8c129e3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Mar 2019 10:09:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Mar 2019 10:09:14 +0900    

Click here for diff

Since 7c079d7, partition bounds are able to use generalized expression  
syntax when processed, treating "minvalue" and "maxvalue" as specific  
cases as they get passed down for transformation as a column references.  
  
The checks for infinite bounds in range expressions have been lax  
though, causing crashes when trying to use column reference names with  
more than one field.  Here is an example causing a crash:  
CREATE TABLE list_parted (a int) PARTITION BY LIST (a);  
CREATE TABLE part_list_crash PARTITION OF list_parted  
  FOR VALUES IN (somename.somename);  
  
Note that the creation of the second relation should fail as partition  
bounds cannot have column references in their expressions, so when  
finding an expression which does not match the expected infinite bounds,  
then this commit lets the generic transformation machinery check after  
it.  The error message generated in this case references as well a  
missing RTE, which is confusing.  This problem will be treated  
separately as it impacts as well default expressions for some time, and  
for now only the cases where a crash can happen are fixed.  
  
While on it, extend the set of regression tests in place for list  
partition bounds and add an extra set for range partition bounds.  
  
Reported-by: Alexander Lakhin  
Author: Michael Paquier  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

tableam: Add table_get_latest_tid, to wrap heap_get_latest_tid.

commit   : 2e3da03e9ee4d6ee5cf0d1ffe0227fe6275397e1    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2019 17:14:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2019 17:14:48 -0700    

Click here for diff

This primarily is to allow WHERE CURRENT OF to continue to work as it  
currently does. It's not clear to me that these semantics make sense  
for every AM, but it works for the in-core heap, and the out of core  
zheap. We can refine it further at a later point if necessary.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c
M src/backend/executor/nodeTidscan.c
M src/backend/utils/adt/tid.c
M src/include/access/tableam.h

tableam: Add helper for indexes to check if a corresponding table tuples exist.

commit   : 71bdc99d0d7c3b2d73fa04fb2ff80870ce1305f7    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2019 16:52:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2019 16:52:55 -0700    

Click here for diff

This is, likely exclusively, useful to verify that conflicts detected  
in a unique index are with live tuples, rather than dead ones.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Add MacPorts support to src/test/ldap tests.

commit   : aa1419e63f85b23503076bb4b6413aca30b535fe    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 26 Mar 2019 10:39:03 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 26 Mar 2019 10:39:03 +1300    

Click here for diff

Previously the test knew how to find an OpenLDAP installation at the  
paths used by Homebrew.  Add the MacPorts paths too.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CA%2BhUKGKrjGS7sO4jc53gp3qipCtEvThtdP_%3DzoixgX5ZBq4Nbw%40mail.gmail.com  

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

Improve planner's selectivity estimates for inequalities on CTID.

commit   : f7111f72d2fd31979c6d473cdde56ba8e7aba26a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2019 18:42:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2019 18:42:52 -0400    

Click here for diff

We were getting just DEFAULT_INEQ_SEL for comparisons such as  
"ctid >= constant", but it's possible to do a lot better if we don't  
mind some assumptions about the table's tuple density being reasonably  
uniform.  There are already assumptions much like that elsewhere in  
the planner, so that hardly seems like much of an objection.  
  
Extracted from a patch set that also proposes to introduce a special  
executor node type for such queries.  Not sure if that's going to make  
it into v12, but improving the selectivity estimate is useful  
independently of that.  
  
Edmund Horner, reviewed by David Rowley  
  
Discussion: https://postgr.es/m/CAMyN-kB-nFTkF=VA_JPwFNo08S0d-Yk0F741S2B7LDmYAi8eyA@mail.gmail.com  

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

Doc: clarify that REASSIGN OWNED doesn't handle default privileges.

commit   : b3bd819632701d53580d9433f3f80c529865f86d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2019 17:18:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2019 17:18:05 -0400    

Click here for diff

It doesn't touch regular privileges either, but only the latter was  
explicitly stated.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/reassign_owned.sgml

Suppress Append and MergeAppend plan nodes that have a single child.

commit   : 8edd0e79460b414b1d971895312e549e95e12e4f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2019 15:42:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2019 15:42:35 -0400    

Click here for diff

If there's only one child relation, the Append or MergeAppend isn't  
doing anything useful, and can be elided.  It does have a purpose  
during planning though, which is to serve as a buffer between parent  
and child Var numbering.  Therefore we keep it all the way through  
to setrefs.c, and get rid of it only after fixing references in the  
plan level(s) above it.  This works largely the same as setrefs.c's  
ancient hack to get rid of no-op SubqueryScan nodes, and can even  
share some code with that.  
  
Note the change to make setrefs.c use apply_tlist_labeling rather than  
ad-hoc code.  This has the effect of propagating the child's resjunk  
and ressortgroupref labels, which formerly weren't propagated when  
removing a SubqueryScan.  Doing that is demonstrably necessary for  
the [Merge]Append cases, and seems harmless for SubqueryScan, if only  
because trivial_subqueryscan is afraid to collapse cases where the  
resjunk marking differs.  (I suspect that restriction could now be  
removed, though it's unclear that it'd make any new matches possible,  
since the outer query can't have references to a child resjunk column.)  
  
David Rowley, reviewed by Alvaro Herrera and Tomas Vondra  
  
Discussion: https://postgr.es/m/CAKJS1f_7u8ATyJ1JGTMHFoKDvZdeF-iEBhs+sM_SXowOr9cArg@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/execAmi.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/inherit.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/union.out

Add "split after new tuple" nbtree optimization.

commit   : f21668f328c864c6b9290f39d41774cb2422f98e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 25 Mar 2019 09:44:25 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 25 Mar 2019 09:44:25 -0700    

Click here for diff

Add additional heuristics to the algorithm for locating an optimal split  
location.  New logic identifies localized monotonically increasing  
values in indexes with multiple columns.  When this insertion pattern is  
detected, page splits split just after the new item that provoked a page  
split (or apply leaf fillfactor in the style of a rightmost page split).  
This optimization is a variation of the long established leaf fillfactor  
optimization used during rightmost page splits.  
  
50/50 page splits are only appropriate with a pattern of truly random  
insertions, where the average space utilization ends up at 65% - 70%.  
Without this patch, affected cases have leaf pages that are no more than  
about 50% full on average.  Future insertions can never make use of the  
free space left behind.  With this patch, affected cases have leaf pages  
that are about 90% full on average (assuming a fillfactor of 90).  
  
Localized monotonically increasing insertion patterns are presumed to be  
fairly common in real-world applications.  There is a fair amount of  
anecdotal evidence for this.  Both pg_depend system catalog indexes  
(pg_depend_depender_index and pg_depend_reference_index) are at least  
20% smaller after the regression tests are run when the optimization is  
available.  Furthermore, many of the indexes created by a fair use  
implementation of TPC-C for Postgres are consistently about 40% smaller  
when the optimization is available.  
  
Note that even pg_upgrade'd v3 indexes make use of this optimization.  
  
Author: Peter Geoghegan  
Reviewed-By: Heikki Linnakangas  
Discussion: https://postgr.es/m/CAH2-WzkpKeZJrXvR_p7VSY1b-s85E3gHyTbZQzR0BkJ5LrWF_A@mail.gmail.com  

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

Further code review for new integerset code.

commit   : f7ff0ae8428f9001eab244cb2535f40d29f218e9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2019 12:23:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Mar 2019 12:23:40 -0400    

Click here for diff

Mostly cosmetic adjustments, but I added a more reliable method of  
detecting whether an iteration is in progress.  

M src/backend/lib/integerset.c
M src/test/modules/test_integerset/README
M src/test/modules/test_integerset/test_integerset.c

Refactor code to print pgbench progress reports.

commit   : 9f75e3772350fb66f20a3d7f33bc94f30300d7eb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Mar 2019 18:07:29 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Mar 2019 18:07:29 +0200    

Click here for diff

threadRun() function is very long and deeply-nested. Extract the code to  
print progress reports to a separate function, to make it slightly easier  
to read.  
  
Author: Fabien Coelho  
Discussion: https://www.postgresql.org/message-id/alpine.DEB.2.21.1903101225270.17271%40lancre  

M src/bin/pgbench/pgbench.c

Fix use of wrong datatype with sizeof().

commit   : 5857be907d5178673ce077ba71562f3c4297ee32    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 25 Mar 2019 11:23:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 25 Mar 2019 11:23:52 -0400    

Click here for diff

OID and int are the same size, but they are not the same thing.  
  
David Rowley  
  
Discussion: http://postgr.es/m/CAKJS1f_MhS++XngkTvWL9X1v8M5t-0N0B-R465yHQY=TmNV0Ew@mail.gmail.com  

M src/backend/nodes/copyfuncs.c
M src/backend/partitioning/partprune.c

pgbench: Remove \cset

commit   : 25ee70511ec2ccbef0ad3fe64875a4d552cdcd50    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Mar 2019 12:16:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Mar 2019 12:16:07 -0300    

Click here for diff

Partial revert of commit 6260cc550b0e, "pgbench: add \cset and \gset  
commands".  
  
While \gset is widely considered a useful and necessary tool for user-  
defined benchmarks, \cset does not have as much value, and its  
implementation was considered "not to be up to project standards"  
(though I, Álvaro, can't quite understand exactly how).  Therefore,  
remove \cset.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1903230716030.18811@lancre  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/fe_utils/psqlscan.l
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h

Add progress reporting for CLUSTER and VACUUM FULL.

commit   : 6f97457e0ddd8b421ca5e483439ef0318e6fc89a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 25 Mar 2019 10:59:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 25 Mar 2019 10:59:04 -0400    

Click here for diff

This uses the same progress reporting infrastructure added in commit  
c16dc1aca5e01e6acaadfcf38f5fc964a381dc62 and extends it to these  
additional cases.  We lack the ability to track the internal progress  
of sorts and index builds so the information reported is  
coarse-grained for some parts of the operation, but it still seems  
like a significant improvement over having nothing at all.  
  
Tatsuro Yamada, reviewed by Thomas Munro, Masahiko Sawada, Michael  
Paquier, Jeff Janes, Alvaro Herrera, Rafia Sabih, and by me.  A fair  
amount of polishing also by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/index.c
M src/backend/catalog/system_views.sql
M src/backend/commands/cluster.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Get rid of backtracking in jsonpath_scan.l

commit   : 1d88a75c424664cc85f307a876cde85191d27272    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 25 Mar 2019 15:43:56 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 25 Mar 2019 15:43:56 +0300    

Click here for diff

Non-backtracking flex parsers work faster than backtracking ones.  So, this  
commit gets rid of backtracking in jsonpath_scan.l.  That required explicit  
handling of some cases as well as manual backtracking for some cases.  More  
regression tests for numerics are added.  
  
Discussion: https://mail.google.com/mail/u/0?ik=a20b091faa&view=om&permmsgid=msg-f%3A1628425344167939063  
Author: John Naylor, Nikita Gluknov, Alexander Korotkov  

M src/backend/utils/adt/Makefile
M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
A src/test/regress/expected/jsonpath_encoding.out
A src/test/regress/expected/jsonpath_encoding_1.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/jsonb_jsonpath.sql
M src/test/regress/sql/jsonpath.sql
A src/test/regress/sql/jsonpath_encoding.sql

Cosmetic changes for jsonpath_gram.y and jsonpath_scan.l

commit   : 8b17298f0b6bb2a64b55fab0339c8fd6ec2d74fb    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 25 Mar 2019 15:42:51 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 25 Mar 2019 15:42:51 +0300    

Click here for diff

This commit include formatting improvements, renamings and comments.  Also,  
it makes jsonpath_scan.l be more uniform with other our lexers.  Firstly,  
states names are renamed to more short alternatives.  Secondly, <INITIAL>  
prefix removed from the rules.  Corresponding rules are moved to the tail, so  
they would anyway work only in initial state.  
  
Author: Alexander Korotkov  
Reviewed-by: John Naylor  

M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l

Clean up the Simple-8b encoder code.

commit   : d303122eab616ccbcfb0bab0fc674bf625d17a7b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Mar 2019 11:39:51 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Mar 2019 11:39:51 +0200    

Click here for diff

Coverity complained that simple8b_encode() might read beyond the end of  
the 'diffs' array, in the loop to encode the integers. That was a false  
positive, because we never get into the loop in modes 0 or 1, and the  
array is large enough for all the other modes. But I admit it's very  
subtle, so it's not surprising that Coverity didn't see it, and it's not  
very obvious to humans either. Refactor it, so that the second loop  
re-computes the differences, instead of carrying them over from the first  
loop in the 'diffs' array. This way, the 'diffs' array is not needed  
anymore. It makes no measurable difference in performance, and seems more  
straightforward this way.  
  
Also, improve the comments in simple8b_encode(): fix the comment about its  
return value that was flat-out wrong, and explain the condition when it  
returns EMPTY_CODEWORD better.  
  
In the passing, move the 'selector' from the codeword's low bits to the  
high bits. It doesn't matter much, but looking at the original paper, and  
googling around for other Simple-8b implementations, that's how it's  
usually done.  
  
Per Coverity, and Tom Lane's report off-list.  

M src/backend/lib/integerset.c
M src/test/modules/test_integerset/test_integerset.c

Align timestamps in pg_regress output

commit   : 148cf5f462e53f374a2085b2fa8dcde944539b03    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2019 10:00:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2019 10:00:11 +0100    

Click here for diff

This way the timestamps line up in a mix of "ok" and "FAILED" output.  
  
Author: Christoph Berg <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20190321115059.GF2687%40msg.df7cb.de  

M src/test/regress/pg_regress.c

Add macro to cast away volatile without allowing changes to underlying type

commit   : 481018f2804065cb5ed1cde75b7c0596aeef959a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2019 09:35:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2019 09:35:29 +0100    

Click here for diff

This adds unvolatize(), which works just like unconstify() but for volatile.  
  
Discussion: https://www.postgresql.org/message-id/flat/7a5cbea7-b8df-e910-0f10-04014bcad701%402ndquadrant.com  

M src/backend/postmaster/pgstat.c
M src/backend/storage/ipc/pmsignal.c
M src/include/c.h

Initialize structure at declaration

commit   : 572e3e6634e55accf95e2bcfb1340019c86a21dc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2019 09:35:22 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2019 09:35:22 +0100    

Click here for diff

Avoids extra memset call and cast.  
  
Discussion: https://www.postgresql.org/message-id/flat/7a5cbea7-b8df-e910-0f10-04014bcad701%402ndquadrant.com  

M contrib/dblink/dblink.c

tableam: Add and use table_fetch_row_version().

commit   : 9a8ee1dc650be623c32b1df103254847be974d01    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2019 00:13:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 25 Mar 2019 00:13:42 -0700    

Click here for diff

This is essentially the tableam version of heapam_fetch(),  
i.e. fetching a tuple identified by a tid, performing visibility  
checks.  
  
Note that this different from table_index_fetch_tuple(), which is for  
index lookups. It therefore has to handle a tid pointing to an earlier  
version of a tuple if the AM uses an optimization like heap's HOT. Add  
comments to that end.  
  
This commit removes the stats_relation argument from heap_fetch, as  
it's been unused for a long time.  
  
Author: Andres Freund  
Reviewed-By: Haribabu Kommi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableamapi.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeTidscan.c
M src/include/access/heapam.h
M src/include/access/tableam.h

Add ORDER BY to regression test case

commit   : c77e12208cd8540a209cc698373a3cfba8802639    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2019 08:15:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Mar 2019 08:15:38 +0100    

Click here for diff

Apparently, the output order is different on different endianness, per  
build farm member snapper.  

M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

tableam: Use in CREATE TABLE AS and CREATE MATERIALIZED VIEW.

commit   : 919e48b943014b1d4ab5d83e48dbc9f8e87e7be4    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 24 Mar 2019 18:55:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 24 Mar 2019 18:55:34 -0700    

Click here for diff

Previously those directly performed a heap_insert(). Use  
table_insert() instead.  The input slot of those routines is not of  
the target relation - we could fix that by copying if necessary, but  
that'd not be beneficial for performance. As those codepaths don't  
access any AM specific tuple fields (say xmin/xmax), there's no need  
to use an AM specific slot.  
  
Author: Andres Freund  
Reviewed-By: Haribabu Kommi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/createas.c
M src/backend/commands/matview.c

Un-hide most cascaded-drop details in regression test results.

commit   : 940311e4bb32a5fe99155052e41179c88b5d48af    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2019 19:15:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2019 19:15:37 -0400    

Click here for diff

Now that the ordering of DROP messages ought to be stable everywhere,  
we should not need these kluges of hiding DETAIL output just to avoid  
unstable ordering.  Hiding it's not great for test coverage, so  
let's undo that where possible.  
  
In a small number of places, it's necessary to leave it in, for  
example because the output might include a variable pg_temp_nnn  
schema name.  I also left things alone in places where the details  
would depend on other regression test scripts, e.g. plpython_drop.sql.  
  
Perhaps buildfarm experience will show this to be a bad idea,  
but if so I'd like to know why.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/create_function_3.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/dependency.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/float4-misrounded-input.out
M src/test/regress/expected/float4.out
M src/test/regress/expected/float8.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rolenames.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/truncate.out
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/collate.sql
M src/test/regress/sql/create_function_3.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/dependency.sql
M src/test/regress/sql/event_trigger.sql
M src/test/regress/sql/float4.sql
M src/test/regress/sql/float8.sql
M src/test/regress/sql/foreign_data.sql
M src/test/regress/sql/foreign_key.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/partition_prune.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rolenames.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/stats_ext.sql
M src/test/regress/sql/truncate.sql

Sort dependent objects before reporting them in DROP ROLE.

commit   : af6550d34466b3093edda54a0cc5a6f220d321b7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2019 18:17:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2019 18:17:41 -0400    

Click here for diff

Commit 8aa9dd74b didn't quite finish the job in this area after all,  
because DROP ROLE has a code path distinct from DROP OWNED BY, and  
it was still reporting dependent objects in whatever order the index  
scan returned them in.  
  
Buildfarm experience shows that index ordering of equal-keyed objects is  
significantly less stable than before in the wake of using heap TIDs as  
tie-breakers.  So if we try to hide the unstable ordering by suppressing  
DETAIL reports, we're just going to end up having to do that for every  
DROP that reports multiple objects.  That's not great from a coverage  
or problem-detection standpoint, and it's something we'll inevitably  
forget in future patches, leading to more iterations of fixing-an-  
unstable-result.  So let's just bite the bullet and sort here too.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_shdepend.c
M src/test/regress/expected/dependency.out

Remove dead code from nbtsplitloc.c.

commit   : 59ab3be9e4d3e3cdf03bada2f6fb3d71a1e42908    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 24 Mar 2019 12:28:58 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 24 Mar 2019 12:28:58 -0700    

Click here for diff

It doesn't make sense to consider the possibility that there will only  
be one candidate split point when choosing among split points to find  
the split with the lowest penalty.  This is a vestige of an earlier  
version of the patch that became commit fab25024.  
  
Issue spotted while rereviewing coverage of the nbtree patch series  
using gcov.  

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

Avoid double-free in vacuumlo error path.

commit   : bd9396a0b2d42497f1196af74b327e00cb6af435    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2019 15:13:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Mar 2019 15:13:20 -0400    

Click here for diff

The code would do "PQclear(res)" twice if lo_unlink failed, evidently  
due to careless thinking about how far out a "break" would break.  
Remove the extra PQclear and adjust the loop logic so that we'll fall  
out of both levels of loop after an error, as was clearly the intent.  
  
Spotted by Coverity.  I have no idea why it took this long to notice,  
since the bug has been there since commit 67ccbb080.  Accordingly,  
back-patch to all supported branches.  

M contrib/vacuumlo/vacuumlo.c

Make current_logfiles use permissions assigned to files in data directory

commit   : 276d2e6c2d8141f194a26da03b5b79375eb7041b    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 24 Mar 2019 21:00:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 24 Mar 2019 21:00:35 +0900    

Click here for diff

Since its introduction in 19dc233c, current_logfiles has been assigned  
the same permissions as a log file, which can be enforced with  
log_file_mode.  This setup can lead to incompatibility problems with  
group access permissions as current_logfiles is not located in the log  
directory, but at the root of the data folder.  Hence, if group  
permissions are used but log_file_mode is more restrictive, a backup  
with a user in the group having read access could fail even if the log  
directory is located outside of the data folder.  
  
Per discussion with the folks mentioned below, we have concluded that  
current_logfiles should not be treated as a log file as it only stores  
metadata related to log files, and that it should use the same  
permissions as all other files in the data directory.  This solution has  
the merit to be simple and fixes all the interaction problems between  
group access and log_file_mode.  
  
Author: Haribabu Kommi  
Reviewed-by: Stephen Frost, Robert Haas, Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CAJrrPGcEotF1P7AWoeQyD3Pqr-0xkQg_Herv98DjbaMj+naozw@mail.gmail.com  
Backpatch-through: 11, where group access has been added.  

M src/backend/postmaster/syslogger.c

Transaction chaining

commit   : 280a408b48d5ee42969f981bceb9e9426c3a344c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 24 Mar 2019 10:33:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 24 Mar 2019 10:33:14 +0100    

Click here for diff

Add command variants COMMIT AND CHAIN and ROLLBACK AND CHAIN, which  
start new transactions with the same transaction characteristics as the  
just finished one, per SQL standard.  
  
Support for transaction chaining in PL/pgSQL is also added.  This  
functionality is especially useful when running COMMIT in a loop in  
PL/pgSQL.  
  
Reviewed-by: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/abort.sgml
M doc/src/sgml/ref/commit.sgml
M doc/src/sgml/ref/end.sgml
M doc/src/sgml/ref/rollback.sgml
M doc/src/sgml/spi.sgml
M src/backend/access/transam/xact.c
M src/backend/catalog/sql_features.txt
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/bin/psql/tab-complete.c
M src/include/access/xact.h
M src/include/executor/spi.h
M src/include/nodes/parsenodes.h
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql
M src/test/regress/expected/transactions.out
M src/test/regress/sql/transactions.sql

Remove spurious return.

commit   : b2db277057a375ccbcc98cc3bbce8ce5b4d788ea    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 23 Mar 2019 21:09:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 23 Mar 2019 21:09:39 -0700    

Click here for diff

Per buildfarm member anole.  
  
Author: Andres Freund  

M src/include/access/tableam.h

tableam: Add tuple_{insert, delete, update, lock} and use.

commit   : 5db6df0c0117ff2a4e0cd87594d2db408cd5022f    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 23 Mar 2019 19:55:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 23 Mar 2019 19:55:57 -0700    

Click here for diff

This adds new, required, table AM callbacks for insert/delete/update  
and lock_tuple. To be able to reasonably use those, the EvalPlanQual  
mechanism had to be adapted, moving more logic into the AM.  
  
Previously both delete/update/lock call-sites and the EPQ mechanism had  
to have awareness of the specific tuple format to be able to fetch the  
latest version of a tuple. Obviously that needs to be abstracted  
away. To do so, move the logic that find the latest row version into  
the AM. lock_tuple has a new flag argument,  
TUPLE_LOCK_FLAG_FIND_LAST_VERSION, that forces it to lock the last  
version, rather than the current one.  It'd have been possible to do  
so via a separate callback as well, but finding the last version  
usually also necessitates locking the newest version, making it  
sensible to combine the two. This replaces the previous use of  
EvalPlanQualFetch().  Additionally HeapTupleUpdated, which previously  
signaled either a concurrent update or delete, is now split into two,  
to avoid callers needing AM specific knowledge to differentiate.  
  
The move of finding the latest row version into tuple_lock means that  
encountering a row concurrently moved into another partition will now  
raise an error about "tuple to be locked" rather than "tuple to be  
updated/deleted" - which is accurate, as that always happens when  
locking rows. While possible slightly less helpful for users, it seems  
like an acceptable trade-off.  
  
As part of this commit HTSU_Result has been renamed to TM_Result, and  
its members been expanded to differentiated between updating and  
deleting. HeapUpdateFailureData has been renamed to TM_FailureData.  
  
The interface to speculative insertion is changed so nodeModifyTable.c  
does not have to set the speculative token itself anymore. Instead  
there's a version of tuple_insert, tuple_insert_speculative, that  
performs the speculative insertion (without requiring a flag to signal  
that fact), and the speculative insertion is either made permanent  
with table_complete_speculative(succeeded = true) or aborted with  
succeeded = false).  
  
Note that multi_insert is not yet routed through tableam, nor is  
COPY. Changing multi_insert requires changes to copy.c that are large  
enough to better be done separately.  
  
Similarly, although simpler, CREATE TABLE AS and CREATE MATERIALIZED  
VIEW are also only going to be adjusted in a later commit.  
  
Author: Andres Freund and Haribabu Kommi  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M contrib/pgrowlocks/pgrowlocks.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeTidscan.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/executor/executor.h
M src/include/utils/snapshot.h
M src/test/isolation/expected/partition-key-update-1.out
M src/tools/pgindent/typedefs.list

Remove inadequate check for duplicate "xml" PI.

commit   : f778e537a0d02d5e05016da3e6f4068914101dee    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Mar 2019 17:40:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Mar 2019 17:40:19 -0400    

Click here for diff

I failed to think about PIs starting with "xml".  We don't really  
need this check at all, so just take it out.  Oversight in  
commit 8d1dadb25 et al.  

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

Ensure xmloption = content while restoring pg_dump output.

commit   : 4870dce37fab7ed308cee9856bec4d4c8c7590b3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Mar 2019 16:51:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Mar 2019 16:51:25 -0400    

Click here for diff

In combination with the previous commit, this ensures that valid XML  
data can always be dumped and reloaded, whether it is "document"  
or "content".  
  
Discussion: https://postgr.es/m/CAN-V+g-6JqUQEQZ55Q3toXEN6d5Ez5uvzL4VR+8KtvJKj31taw@mail.gmail.com  

M src/bin/pg_dump/pg_backup_archiver.c

Accept XML documents when xmloption = content, as required by SQL:2006+.

commit   : 8d1dadb25bb522e09af7f141e9d78db5805d868c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Mar 2019 16:24:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Mar 2019 16:24:30 -0400    

Click here for diff

Previously we were using the SQL:2003 definition, which doesn't allow  
this, but that creates a serious dump/restore gotcha: there is no  
setting of xmloption that will allow all valid XML data.  Hence,  
switch to the 2006 definition.  
  
Since libxml doesn't accept <!DOCTYPE> directives in the mode we  
use for CONTENT parsing, the implementation is to detect <!DOCTYPE>  
in the input and switch to DOCUMENT parsing mode.  This should not  
cost much, because <!DOCTYPE> should be close to the front of the  
input if it's there at all.  It's possible that this causes the  
error messages for malformed input to be slightly different than  
they were before, if said input includes <!DOCTYPE>; but that does  
not seem like a big problem.  
  
In passing, buy back a few cycles in parsing of large XML documents  
by not doing strlen() of the whole input in parse_xml_decl().  
  
Back-patch because dump/restore failures are not nice.  This change  
shouldn't break any cases that worked before, so it seems safe to  
back-patch.  
  
Chapman Flack (revised a bit by me)  
  
Discussion: https://postgr.es/m/CAN-V+g-6JqUQEQZ55Q3toXEN6d5Ez5uvzL4VR+8KtvJKj31taw@mail.gmail.com  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/xml.c
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Suppress DETAIL output from an event_trigger test.

commit   : 05f110cc0b83d9dc174f72cf96798299eb3e7f67    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 23 Mar 2019 13:49:53 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 23 Mar 2019 13:49:53 -0700    

Click here for diff

Suppress 3 lines of unstable DETAIL output from a DROP ROLE statement in  
event_trigger.sql.  This is further cleanup for commit dd299df8.  
  
Note that the event_trigger test instability issue is very similar to  
the recently suppressed foreign_data test instability issue.  Both  
issues involve DETAIL output for a DROP ROLE statement that needed to be  
changed as part of dd299df8.  
  
Per buildfarm member macaque.  

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

Add nbtree high key "continuescan" optimization.

commit   : 29b64d1de7c77ffb5cb10696693e6ed8a6fc481c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 23 Mar 2019 11:01:53 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 23 Mar 2019 11:01:53 -0700    

Click here for diff

Teach nbtree forward index scans to check the high key before moving to  
the right sibling page in the hope of finding that it isn't actually  
necessary to do so.  The new check may indicate that the scan definitely  
cannot find matching tuples to the right, ending the scan immediately.  
We already opportunistically force a similar "continuescan orientated"  
key check of the final non-pivot tuple when it's clear that it cannot be  
returned to the scan due to being dead-to-all.  The new high key check  
is complementary.  
  
The new approach for forward scans is more effective than checking the  
final non-pivot tuple, especially with composite indexes and non-unique  
indexes.  The improvements to the logic for picking a split point added  
by commit fab25024 make it likely that relatively dissimilar high keys  
will appear on a page.  A distinguishing key value that can only appear  
on non-pivot tuples on the right sibling page will often be present in  
leaf page high keys.  
  
Since forcing the final item to be key checked no longer makes any  
difference in the case of forward scans, the existing extra key check is  
now only used for backwards scans.  Backward scans continue to  
opportunistically check the final non-pivot tuple, which is actually the  
first non-pivot tuple on the page (not the last).  
  
Note that even pg_upgrade'd v3 indexes make use of this optimization.  
  
Author: Peter Geoghegan, Heikki Linnakangas  
Reviewed-By: Heikki Linnakangas  
Discussion: https://postgr.es/m/CAH2-WzkOmUduME31QnuTFpimejuQoiZ-HOf0pOWeFZNhTMctvA@mail.gmail.com  

M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Improve format of code and some error messages in pg_checksums

commit   : 4ba96d1b82d694fead0ac709f9429cbb7ea89cb0    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 23 Mar 2019 21:56:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 23 Mar 2019 21:56:43 +0900    

Click here for diff

This makes the code more consistent with the surroundings.  
  
Author: Fabrízio de Royes Mello  
Discussion: https://postgr.es/m/CAFcNs+pXb_35r5feMU3-dWsWxXU=Yjq+spUsthFyGFbT0QcaKg@mail.gmail.com  

M src/bin/pg_checksums/pg_checksums.c

Add unreachable "break" to satisfy -Wimplicit-fallthrough.

commit   : fb50d3f03fe6876b878d636a312c2ccc1f4f99af    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Mar 2019 01:32:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Mar 2019 01:32:58 -0400    

Click here for diff

gcc is a bit pickier about this than perhaps it should be.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_func.c

Expand EPQ tests for UPDATEs and DELETEs

commit   : cdcffe2263215eef9078ce97e6c9adece8ed1910    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 22 Mar 2019 19:55:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 22 Mar 2019 19:55:23 -0700    

Click here for diff

Previously there was basically no coverage for UPDATEs encountering  
deleted rows, and no coverage for DELETE having to perform EPQ. That's  
problematic for an upcoming commit in which EPQ is tought to integrate  
with tableams.  Also, there was no test for UPDATE to encounter a row  
UPDATEd into another partition.  
  
Author: Andres Freund  

M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/expected/partition-key-update-1.out
M src/test/isolation/specs/eval-plan-qual.spec
M src/test/isolation/specs/partition-key-update-1.spec

Add option -N/--no-sync to pg_checksums

commit   : e0090c86900877bf0911c53dcf4a30bc81d03047    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 23 Mar 2019 08:37:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 23 Mar 2019 08:37:36 +0900    

Click here for diff

This is an option consistent with what pg_dump, pg_rewind and  
pg_basebackup provide which is useful for leveraging the I/O effort when  
testing things, not to be used in a production environment.  
  
Author: Michael Paquier  
Reviewed-by: Michael Banck, Fabien Coelho, Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_checksums.sgml
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/002_actions.pl

Revert "Add gitignore entries for jsonpath_gram.h"

commit   : 7b084b38310cfe9c8b58cc615a81df625c771f5d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 23 Mar 2019 00:19:34 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 23 Mar 2019 00:19:34 +0100    

Click here for diff

This reverts commit 4e274a043fc8310ce1148190ef674beca06e990c.  
  
These files aren't actually built anymore since 550b9d26f.  

M src/backend/utils/adt/.gitignore
M src/include/utils/.gitignore

Add options to enable and disable checksums in pg_checksums

commit   : ed308d78379008b2cebca30a986f97f992ee6122    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 23 Mar 2019 08:12:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 23 Mar 2019 08:12:55 +0900    

Click here for diff

An offline cluster can now work with more modes in pg_checksums:  
- --enable enables checksums in a cluster, updating all blocks with a  
correct checksum, and updating the control file at the end.  
- --disable disables checksums in a cluster, updating only the control  
file.  
- --check is an extra option able to verify checksums for a cluster, and  
the default used if no mode is specified.  
  
When running --enable or --disable, the data folder gets fsync'd for  
durability, and then it is followed by a control file update and flush  
to keep the operation consistent should the tool be interrupted, killed  
or the host unplugged.  If no mode is specified in the options, then  
--check is used for compatibility with older versions of pg_checksums  
(named pg_verify_checksums in v11 where it was introduced).  
  
Author: Michael Banck, Michael Paquier  
Reviewed-by: Fabien Coelho, Magnus Hagander, Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_checksums.sgml
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/002_actions.pl
M src/tools/pgindent/typedefs.list

Make subscription collation test work independent of locale

commit   : 87914e708aabb7e2cd9045fa95b4fed99ca458ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2019 23:33:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2019 23:33:31 +0100    

Click here for diff

We need to set the database to UTF8 encoding so that the test can use  
Unicode escapes.  

M src/test/subscription/t/012_collation.pl

Add gitignore entries for jsonpath_gram.h

commit   : 4e274a043fc8310ce1148190ef674beca06e990c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2019 23:19:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2019 23:19:30 +0100    

Click here for diff

M src/backend/utils/adt/.gitignore
M src/include/utils/.gitignore

Rearrange make_partitionedrel_pruneinfo to avoid work when we can't prune.

commit   : 734308a220729e4ececa3758bdcae39a335d55ea    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Mar 2019 14:56:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Mar 2019 14:56:05 -0400    

Click here for diff

Postpone most of the effort of constructing PartitionedRelPruneInfos  
until after we have found out whether run-time pruning is needed at all.  
This costs very little duplicated effort (basically just an extra  
find_base_rel() call per partition) and saves quite a bit when we  
can't do run-time pruning.  
  
Also, merge the first loop (for building relid_subpart_map) into  
the second loop, since we don't need the map to be valid during  
that loop.  
  
Amit Langote  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partprune.c

Go back to suppressing foreign_data DETAIL test output.

commit   : 09963cedced7ffb98a06298cc16305767fd2b4dd    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 22 Mar 2019 11:34:28 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 22 Mar 2019 11:34:28 -0700    

Click here for diff

This is almost a straight revert of commit fff518d, which itself was a  
revert of 7d3bf73ac.  
  
It turns out that commit 8aa9dd74, which sorted dependent objects before  
deletion in DROP OWNED BY, was not sufficient to make all remaining  
unstable DETAIL output stable.  Unstable DETAIL output from DROP ROLE  
was not affected, because that happens to use a different code path.  It  
doesn't seem worthwhile to fix the other code path at this time.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Don't copy PartitionBoundInfo in set_relation_partition_info.

commit   : c8151e642368599dc77c4448e6bdc34cc8810475    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Mar 2019 14:16:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Mar 2019 14:16:50 -0400    

Click here for diff

I (tgl) remain dubious that it's a good idea for PartitionDirectory  
to hold a pin on a relcache entry throughout planning, rather than  
copying the data or using some kind of refcount scheme.  However, it's  
certainly the responsibility of the PartitionDirectory code to ensure  
that what it's handing back is a stable data structure, not that of  
its caller.  So this is a pretty clear oversight in commit 898e5e329,  
and one that can cost a lot of performance when there are many  
partitions.  
  
Amit Langote (extracted from a much larger patch set)  
  
Discussion: https://postgr.es/m/CA+TgmoY3bRmGB6-DUnoVy5fJoreiBJ43rwMrQRCdPXuKt4Ykaw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/plancat.c

Fix yet more portability bugs in integerset and its tests.

commit   : b5fd4972a3bc758c0b8e8c9cd4aa32bacdeb6605    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 17:59:19 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 17:59:19 +0200    

Click here for diff

There were more large constants that needed UINT64CONST. And one variable  
was declared as "int", when it needed to be uint64. These bugs were only  
visible on 32-bit systems; clearly I should've tested on one, given that  
this code does a lot of work with 64-bit integers.  
  
Also, in the test "huge distances" test, the code created some values with  
random distances between them, but the test logic didn't take into account  
the possibility that the random distance was exactly 1. That never actually  
happens with the seed we're using, but let's be tidy.  

M src/backend/lib/integerset.c
M src/test/modules/test_integerset/test_integerset.c

Fix ICU tests for older ICU versions

commit   : 638db07814f389e739b2cfde01b592aa9150b1be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2019 14:40:56 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2019 14:40:56 +0100    

Click here for diff

Change the tests to use old-style ICU locale specifications so that  
they can run on older ICU versions.  

M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

More portability fixes for integerset tests.

commit   : c477c68c8f660550219c69fac2ab41beb86d7f45    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 14:57:35 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 14:57:35 +0200    

Click here for diff

Use UINT64CONST for large constants.  

M src/test/modules/test_integerset/test_integerset.c

Make printf format strings in test_integerset portable.

commit   : 32f8ddf7e1c8b24382f98c14f6b588cd7e17418c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 14:42:33 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 14:42:33 +0200    

Click here for diff

Use UINT64_FORMAT for printing uint64s.  

M src/test/modules/test_integerset/test_integerset.c

Make the integerset test more verbose.

commit   : 608c5f4347acefdbb2663b9fb6deab079b4b3c8b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 14:32:53 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 14:32:53 +0200    

Click here for diff

Buildfarm member 'woodlouse' failed one of the tests, and I'm not sure  
which test failed. Better to print the names of the tests, so that it  
will appear in the regression.diffs on failure.  

M src/test/modules/test_integerset/expected/test_integerset.out
M src/test/modules/test_integerset/sql/test_integerset.sql

Fix bug in the GiST vacuum's 2nd stage.

commit   : d1b9ee4e44062cc540d8e406f49b160326d58a84    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 14:11:46 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 14:11:46 +0200    

Click here for diff

We mustn't assume that the IndexVacuumInfo pointer passed to bulkdelete()  
stage is still valid in the vacuumcleanup() stage.  
  
Per very pink buildfarm.  

M src/backend/access/gist/gistvacuum.c

Delete empty pages during GiST VACUUM.

commit   : 7df159a620b760e289f1795b13542ed1b3e13b87    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 13:21:20 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 13:21:20 +0200    

Click here for diff

To do this, we scan GiST two times. In the first pass we make note of  
empty leaf pages and internal pages. At second pass we scan through  
internal pages, looking for downlinks to the empty pages.  
  
Deleting internal pages is still not supported, like in nbtree, the last  
child of an internal page is never deleted. That means that if you have a  
workload where new keys are always inserted to different area than where  
old keys are removed, the index will still grow without bound. But the rate  
of growth will be an order of magnitude slower than before.  
  
Author: Andrey Borodin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/gist/README
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/test/regress/expected/gist.out
M src/test/regress/sql/gist.sql

Add IntegerSet, to hold large sets of 64-bit ints efficiently.

commit   : df816f6ad532ad685a3897869a2e64d3a53fe312    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 13:21:19 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 22 Mar 2019 13:21:19 +0200    

Click here for diff

The set is implemented as a B-tree, with a compact representation at leaf  
items, using Simple-8b algorithm, so that clusters of nearby values use  
less memory.  
  
The IntegerSet isn't used for anything yet, aside from the test code, but  
we have two patches in the works that would benefit from this: A patch to  
allow GiST vacuum to delete empty pages, and a patch to reduce heap  
VACUUM's memory usage, by storing the list of dead TIDs more efficiently  
and lifting the 1 GB limit on its size.  
  
This includes a unit test module, in src/test/modules/test_integerset.  
It can be used to verify correctness, as a regression test, but if you run  
it manully, it can also print memory usage and execution time of some of  
the tests.  
  
Author: Heikki Linnakangas, Andrey Borodin  
Reviewed-by: Julien Rouhaud  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/lib/Makefile
M src/backend/lib/README
A src/backend/lib/integerset.c
A src/include/lib/integerset.h
M src/test/modules/Makefile
A src/test/modules/test_integerset/.gitignore
A src/test/modules/test_integerset/Makefile
A src/test/modules/test_integerset/README
A src/test/modules/test_integerset/expected/test_integerset.out
A src/test/modules/test_integerset/sql/test_integerset.sql
A src/test/modules/test_integerset/test_integerset–1.0.sql
A src/test/modules/test_integerset/test_integerset.c
A src/test/modules/test_integerset/test_integerset.control

Collations with nondeterministic comparison

commit   : 5e1963fb764e9cc092e0f7b58b28985c311431d9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2019 12:09:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Mar 2019 12:09:32 +0100    

Click here for diff

This adds a flag "deterministic" to collations.  If that is false,  
such a collation disables various optimizations that assume that  
strings are equal only if they are byte-wise equal.  That then allows  
use cases such as case-insensitive or accent-insensitive comparisons  
or handling of strings with different Unicode normal forms.  
  
This functionality is only supported with the ICU provider.  At least  
glibc doesn't appear to have any locales that work in a  
nondeterministic way, so it's not worth supporting this for the libc  
provider.  
  
The term "deterministic comparison" in this context is from Unicode  
Technical Standard #10  
(https://unicode.org/reports/tr10/#Deterministic_Comparison).  
  
This patch makes changes in three areas:  
  
- CREATE COLLATION DDL changes and system catalog changes to support  
  this new flag.  
  
- Many executor nodes and auxiliary code are extended to track  
  collations.  Previously, this code would just throw away collation  
  information, because the eventually-called user-defined functions  
  didn't use it since they only cared about equality, which didn't  
  need collation information.  
  
- String data type functions that do equality comparisons and hashing  
  are changed to take the (non-)deterministic flag into account.  For  
  comparison, this just means skipping various shortcuts and tie  
  breakers that use byte-wise comparison.  For hashing, we first need  
  to convert the input string to a canonical "sort key" using the ICU  
  analogue of strxfrm().  
  
Reviewed-by: Daniel Verite <[email protected]>  
Reviewed-by: Peter Geoghegan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/citext.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/create_collation.sgml
M src/backend/access/hash/hashfunc.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/backend/commands/extension.c
M src/backend/executor/execExpr.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/tlist.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/lsyscache.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.h
M src/include/executor/executor.h
M src/include/executor/hashjoin.h
M src/include/executor/nodeHash.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/planmain.h
M src/include/optimizer/tlist.h
M src/include/partitioning/partbounds.h
M src/include/utils/lsyscache.h
M src/include/utils/pg_locale.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/collate.linux.utf8.sql
M src/test/regress/sql/collate.sql
M src/test/regress/sql/subselect.sql
M src/test/subscription/Makefile
A src/test/subscription/t/012_collation.pl

Fix crash with pg_partition_root

commit   : 2ab6d28d233af17987ea323e3235b2bda89b4f2e    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 22 Mar 2019 17:27:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 22 Mar 2019 17:27:38 +0900    

Click here for diff

Trying to call the function with the top-most parent of a partition tree  
was leading to a crash.  In this case the correct result is to return  
the top-most parent itself.  
  
Reported-by: Álvaro Herrera  
Author: Michael Paquier  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Revert "Suppress DETAIL output from a foreign_data test."

commit   : fff518d051285bc47e2694a349d410e01972730b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 21 Mar 2019 15:33:13 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 21 Mar 2019 15:33:13 -0700    

Click here for diff

This should be superseded by commit 8aa9dd74.  

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

Catversion bump announced in previous commit but forgotten

commit   : 03ae9d59bd5f5ef9a1cb387568e5cbf12b9c7b10    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Mar 2019 18:43:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Mar 2019 18:43:24 -0300    

Click here for diff

M src/include/catalog/catversion.h

Fix dependency recording bug for partitioned PKs

commit   : 7e7c57bbb2ebed7e8acbd2e62fadca5a5fe5df5f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Mar 2019 18:34:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Mar 2019 18:34:29 -0300    

Click here for diff

When DefineIndex recurses to create constraints on partitions, it needs  
to use the value returned by index_constraint_create to set up partition  
dependencies.  However, in the course of fixing the DEPENDENCY_INTERNAL_AUTO  
mess, commit 1d92a0c9f7dd introduced some code to that function that  
clobbered the return value, causing the recorded OID to be of the wrong  
object.  Close examination of pg_depend after creating the tables leads  
to indescribable objects :-( My sin (in commit bdc3d7fa2376, while  
preparing for DDL deparsing in event triggers) was to use a variable  
name for the return value that's typically used for throwaway objects in  
dependency-setting calls ("referenced").  Fix by changing the variable  
names to match extended practice (the return value is "myself" rather  
than "referenced".)  
  
The pg_upgrade test notices the problem (in an indirect way: the pg_dump  
outputs are in different order), but only if you create the objects in a  
specific way that wasn't being used in the existing tests.  Add a stanza  
to leave some objects around that shows the bug.  
  
Catversion bump because preexisting databases might have bogus pg_depend  
entries.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Improve error reporting for DROP FUNCTION/PROCEDURE/AGGREGATE/ROUTINE.

commit   : bfb456c1b9656d5b717b84d833f62cf712b21726    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Mar 2019 11:51:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Mar 2019 11:51:55 -0400    

Click here for diff

These commands allow the argument type list to be omitted if there is  
just one object that matches by name.  However, if that syntax was  
used with DROP IF EXISTS and there was more than one match, you got  
a "function ... does not exist, skipping" notice message rather than a  
truthful complaint about the ambiguity.  This was basically due to  
poor factorization and a rats-nest of logic, so refactor the relevant  
lookup code to make it cleaner.  
  
Note that this amounts to narrowing the scope of which sorts of  
error conditions IF EXISTS will bypass.  Per discussion, we only  
intend it to skip no-such-object cases, not multiple-possible-matches  
cases.  
  
Per bug #15572 from Ash Marath.  Although this definitely seems like  
a bug, it's not clear that people would thank us for changing the  
behavior in minor releases, so no back-patch.  
  
David Rowley, reviewed by Julien Rouhaud and Pavel Stehule  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_func.c
M src/include/parser/parse_func.h
M src/test/regress/expected/drop_if_exists.out
M src/test/regress/sql/drop_if_exists.sql

Add DNS SRV support for LDAP server discovery.

commit   : 0f086f84ad9041888b789af5871c7432f0e19c5b    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 21 Mar 2019 15:19:03 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 21 Mar 2019 15:19:03 +1300    

Click here for diff

LDAP servers can be advertised on a network with RFC 2782 DNS SRV  
records.  The OpenLDAP command-line tools automatically try to find  
servers that way, if no server name is provided by the user.  Teach  
PostgreSQL to do the same using OpenLDAP's support functions, when  
building with OpenLDAP.  
  
For now, we assume that HAVE_LDAP_INITIALIZE (an OpenLDAP extension  
available since OpenLDAP 2.0 and also present in Apple LDAP) implies  
that you also have ldap_domain2hostlist() (which arrived in the same  
OpenLDAP version and is also present in Apple LDAP).  
  
Author: Thomas Munro  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAEepm=2hAnSfhdsd6vXsM6VZVN0br-FbAZ-O+Swk18S5HkCP=A@mail.gmail.com  

M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c

Sort the dependent objects before deletion in DROP OWNED BY.

commit   : 8aa9dd74b36757342b6208fbfebb5b35c2d67c53    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Mar 2019 18:06:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Mar 2019 18:06:29 -0400    

Click here for diff

This finishes a task we left undone in commit f1ad067fc, by extending  
the delete-in-descending-OID-order rule to deletions triggered by  
DROP OWNED BY.  We've coped with machine-dependent deletion orders  
one time too many, and the new issues caused by Peter G's recent  
nbtree hacking seem like the last straw.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/catalog/pg_shdepend.c
M src/include/catalog/dependency.h

Add index_get_partition convenience function

commit   : a6da0047158b8a227f883aeed19eb7fcfbef11fb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Mar 2019 18:18:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Mar 2019 18:18:50 -0300    

Click here for diff

This new function simplifies some existing coding, as well as supports  
future patches.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Amit Langote, Jesper Pedersen  

M src/backend/catalog/partition.c
M src/backend/commands/tablecmds.c
M src/include/catalog/partition.h

Fix spurious compiler warning in nbtxlog.c.

commit   : 3d0dcc5c7fb9cfc349d1b2d476a1c0c5d64522bd    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 14:04:35 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 14:04:35 -0700    

Click here for diff

Cleanup from commit dd299df8.  
  
Per complaint from Tom Lane.  

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

Suppress DETAIL output from a foreign_data test.

commit   : 7d3bf73ac416fdd74d6c7d473e0c00a19be90c82    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 13:38:38 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 13:38:38 -0700    

Click here for diff

Unstable sort order related to changes to nbtree from commit dd299df8  
can cause two lines of DETAIL output to be in opposite-of-expected  
order.  Suppress the output using the same VERBOSITY hack that is used  
elsewhere in the foreign_data tests.  
  
Note that the same foreign_data.out DETAIL output was mechanically  
updated by commit dd299df8.  Only a few such changes were required,  
though.  
  
Per buildfarm member batfish.  
  
Discussion: https://postgr.es/m/CAH2-WzkCQ_MtKeOpzozj7QhhgP1unXsK8o9DMAFvDqQFEPpkYQ@mail.gmail.com  

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

Restore RI trigger sanity check

commit   : 815b20ae0c6ed61a431fba124c736152f0df5022    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Mar 2019 17:28:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Mar 2019 17:28:43 -0300    

Click here for diff

I unnecessarily removed this check in 3de241dba86f because I  
misunderstood what the final representation of constraints across a  
partitioning hierarchy was to be.  Put it back (in both branches).  
  
Discussion: https://postgr.es/m/[email protected]  

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

Allow amcheck to re-find tuples using new search.

commit   : c1afd175b5b2e5c44f6da34988342e00ecdfb518    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 10:41:36 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 10:41:36 -0700    

Click here for diff

Teach contrib/amcheck's bt_index_parent_check() function to take  
advantage of the uniqueness property of heapkeyspace indexes in support  
of a new verification option: non-pivot tuples (non-highkey tuples on  
the leaf level) can optionally be re-found using a new search for each,  
that starts from the root page.  If a tuple cannot be re-found, report  
that the index is corrupt.  
  
The new "rootdescend" verification option is exhaustive, and can  
therefore make a call to bt_index_parent_check() take a lot longer.  
Re-finding tuples during verification is mostly intended as an option  
for backend developers, since the corruption scenarios that it alone is  
uniquely capable of detecting seem fairly far-fetched.  
  
For example, "rootdescend" verification is much more likely to detect  
corruption of the least significant byte of a key from a pivot tuple in  
the root page of a B-Tree that already has at least three levels.  
Typically, only a few tuples on a cousin leaf page are at risk of  
"getting overlooked" by index scans in this scenario.  The corrupt key  
in the root page is only slightly corrupt: corrupt enough to give wrong  
answers to some queries, and yet not corrupt enough to allow the problem  
to be detected without verifying agreement between the leaf page and the  
root page, skipping at least one internal page level.  The existing  
bt_index_parent_check() checks never cross more than a single level.  
  
Author: Peter Geoghegan  
Reviewed-By: Heikki Linnakangas  
Discussion: https://postgr.es/m/CAH2-Wz=yTWnVu+HeHGKb2AGiADL9eprn-cKYAto4MkKOuiGtRQ@mail.gmail.com  

M contrib/amcheck/Makefile
A contrib/amcheck/amcheck–1.1–1.2.sql
M contrib/amcheck/amcheck.control
M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml

Consider secondary factors during nbtree splits.

commit   : fab2502433870d98271ba8751f3794e2ed44140a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 10:12:19 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 10:12:19 -0700    

Click here for diff

Teach nbtree to give some consideration to how "distinguishing"  
candidate leaf page split points are.  This should not noticeably affect  
the balance of free space within each half of the split, while still  
making suffix truncation truncate away significantly more attributes on  
average.  
  
The logic for choosing a leaf split point now uses a fallback mode in  
the case where the page is full of duplicates and it isn't possible to  
find even a minimally distinguishing split point.  When the page is full  
of duplicates, the split should pack the left half very tightly, while  
leaving the right half mostly empty.  Our assumption is that logical  
duplicates will almost always be inserted in ascending heap TID order  
with v4 indexes.  This strategy leaves most of the free space on the  
half of the split that will likely be where future logical duplicates of  
the same value need to be placed.  
  
The number of cycles added is not very noticeable.  This is important  
because deciding on a split point takes place while at least one  
exclusive buffer lock is held.  We avoid using authoritative insertion  
scankey comparisons to save cycles, unlike suffix truncation proper.  We  
use a faster binary comparison instead.  
  
Note that even pg_upgrade'd v3 indexes make use of these optimizations.  
Benchmarking has shown that even v3 indexes benefit, despite the fact  
that suffix truncation will only truncate non-key attributes in INCLUDE  
indexes.  Grouping relatively similar tuples together is beneficial in  
and of itself, since it reduces the number of leaf pages that must be  
accessed by subsequent index scans.  
  
Author: Peter Geoghegan  
Reviewed-By: Heikki Linnakangas  
Discussion: https://postgr.es/m/CAH2-WzmmoLNQOj9mAD78iQHfWLJDszHEDrAzGTUMG3mVh5xWPw@mail.gmail.com  

M src/backend/access/nbtree/Makefile
M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtinsert.c
A src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Make heap TID a tiebreaker nbtree index column.

commit   : dd299df8189bd00fbe54b72c64f43b6af2ffeccd    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 10:04:01 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 10:04:01 -0700    

Click here for diff

Make nbtree treat all index tuples as having a heap TID attribute.  
Index searches can distinguish duplicates by heap TID, since heap TID is  
always guaranteed to be unique.  This general approach has numerous  
benefits for performance, and is prerequisite to teaching VACUUM to  
perform "retail index tuple deletion".  
  
Naively adding a new attribute to every pivot tuple has unacceptable  
overhead (it bloats internal pages), so suffix truncation of pivot  
tuples is added.  This will usually truncate away the "extra" heap TID  
attribute from pivot tuples during a leaf page split, and may also  
truncate away additional user attributes.  This can increase fan-out,  
especially in a multi-column index.  Truncation can only occur at the  
attribute granularity, which isn't particularly effective, but works  
well enough for now.  A future patch may add support for truncating  
"within" text attributes by generating truncated key values using new  
opclass infrastructure.  
  
Only new indexes (BTREE_VERSION 4 indexes) will have insertions that  
treat heap TID as a tiebreaker attribute, or will have pivot tuples  
undergo suffix truncation during a leaf page split (on-disk  
compatibility with versions 2 and 3 is preserved).  Upgrades to version  
4 cannot be performed on-the-fly, unlike upgrades from version 2 to  
version 3.  contrib/amcheck continues to work with version 2 and 3  
indexes, while also enforcing stricter invariants when verifying version  
4 indexes.  These stricter invariants are the same invariants described  
by "3.1.12 Sequencing" from the Lehman and Yao paper.  
  
A later patch will enhance the logic used by nbtree to pick a split  
point.  This patch is likely to negatively impact performance without  
smarter choices around the precise point to split leaf pages at.  Making  
these two mostly-distinct sets of enhancements into distinct commits  
seems like it might clarify their design, even though neither commit is  
particularly useful on its own.  
  
The maximum allowed size of new tuples is reduced by an amount equal to  
the space required to store an extra MAXALIGN()'d TID in a new high key  
during leaf page splits.  The user-facing definition of the "1/3 of a  
page" restriction is already imprecise, and so does not need to be  
revised.  However, there should be a compatibility note in the v12  
release notes.  
  
Author: Peter Geoghegan  
Reviewed-By: Heikki Linnakangas, Alexander Korotkov  
Discussion: https://postgr.es/m/CAH2-WzkVb0Kom=R+88fDFb=JSxZMFvbHVC6Mn9LJ2n=X=kS-Uw@mail.gmail.com  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/btree.out
M contrib/pgstattuple/expected/pgstattuple.out
M doc/src/sgml/indices.sgml
M src/backend/access/common/indextuple.c
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/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/test/regress/expected/btree_index.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/dependency.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/btree_index.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/foreign_data.sql

Refactor nbtree insertion scankeys.

commit   : e5adcb789d80ba565ccacb1ed4341a7c29085238    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 09:30:57 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Mar 2019 09:30:57 -0700    

Click here for diff

Use dedicated struct to represent nbtree insertion scan keys.  Having a  
dedicated struct makes the difference between search type scankeys and  
insertion scankeys a lot clearer, and simplifies the signature of  
several related functions.  This is based on a suggestion by Andrey  
Lepikhov.  
  
Streamline how unique index insertions cache binary search progress.  
Cache the state of in-progress binary searches within _bt_check_unique()  
for later instead of having callers avoid repeating the binary search in  
an ad-hoc manner.  This makes it easy to add a new optimization:  
_bt_check_unique() now falls out of its loop immediately in the common  
case where it's already clear that there couldn't possibly be a  
duplicate.  
  
The new _bt_check_unique() scheme makes it a lot easier to manage cached  
binary search effort afterwards, from within _bt_findinsertloc().  This  
is needed for the upcoming patch to make nbtree tuples unique by  
treating heap TID as a final tiebreaker column.  Unique key binary  
searches need to restore lower and upper bounds.  They cannot simply  
continue to use the >= lower bound as the offset to insert at, because  
the heap TID tiebreaker column must be used in comparisons for the  
restored binary search (unlike the original _bt_check_unique() binary  
search, where scankey's heap TID column must be omitted).  
  
Author: Peter Geoghegan, Heikki Linnakangas  
Reviewed-By: Heikki Linnakangas, Andrey Lepikhov  
Discussion: https://postgr.es/m/CAH2-WzmE6AhUdk9NdWBf4K3HjWXZBX3+umC7mH7+WDrKcRtsOw@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/nbtree.h

Get rid of jsonpath_gram.h and jsonpath_scanner.h

commit   : 550b9d26f80fa3048f2d5883f0779ed29465960a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 20 Mar 2019 11:09:07 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 20 Mar 2019 11:09:07 +0300    

Click here for diff

Jsonpath grammar and scanner are both quite small.  It doesn't worth complexity  
to compile them separately.  This commit makes grammar and scanner be compiled  
at once.  Therefore, jsonpath_gram.h and jsonpath_gram.h are no longer needed.  
This commit also does some reorganization of code in jsonpath_gram.y.  
  
Discussion: https://postgr.es/m/d47b2023-3ecb-5f04-d253-d557547cf74f%402ndQuadrant.com  

M src/backend/Makefile
M src/backend/utils/adt/.gitignore
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/include/Makefile
M src/include/utils/.gitignore
D src/include/utils/jsonpath_scanner.h
M src/tools/msvc/Solution.pm

Remove ambiguity for jsonb_path_match() and jsonb_path_exists()

commit   : 641fde25233ef3ecc3b8101fe287eea9fceba6fd    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 20 Mar 2019 10:27:56 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 20 Mar 2019 10:27:56 +0300    

Click here for diff

There are 2-arguments and 4-arguments versions of jsonb_path_match() and  
jsonb_path_exists().  But 4-arguments versions have optional 3rd and 4th  
arguments, that leads to ambiguity.  In the same time 2-arguments versions are  
needed only for @@ and @? operators.  So, rename 2-arguments versions to  
remove the ambiguity.  
  
Catversion is bumped.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql

Restructure libpq's handling of send failures.

commit   : 1f39a1c0641531e0462a4822f2dba904c5d4d699    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Mar 2019 16:20:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Mar 2019 16:20:20 -0400    

Click here for diff

Originally, if libpq got a failure (e.g., ECONNRESET) while trying to  
send data to the server, it would just report that and wash its hands  
of the matter.  It was soon found that that wasn't a very pleasant way  
of coping with server-initiated disconnections, so we introduced a hack  
(pqHandleSendFailure) in the code that sends queries to make it peek  
ahead for server error reports before reporting the send failure.  
  
It now emerges that related cases can occur during connection setup;  
in particular, as of TLS 1.3 it's unsafe to assume that SSL connection  
failures will be reported by SSL_connect rather than during our first  
send attempt.  We could have fixed that in a hacky way by applying  
pqHandleSendFailure after a startup packet send failure, but  
(a) pqHandleSendFailure explicitly disclaims suitability for use in any  
state except query startup, and (b) the problem still potentially exists  
for other send attempts in libpq.  
  
Instead, let's fix this in a more general fashion by eliminating  
pqHandleSendFailure altogether, and instead arranging to postpone  
all reports of send failures in libpq until after we've made an  
attempt to read and process server messages.  The send failure won't  
be reported at all if we find a server message or detect input EOF.  
  
(Note: this removes one of the reasons why libpq typically overwrites,  
rather than appending to, conn->errorMessage: pqHandleSendFailure needed  
that behavior so that the send failure report would be replaced if we  
got a server message or read failure report.  Eventually I'd like to get  
rid of that overwrite behavior altogether, but today is not that day.  
For the moment, pqSendSome is assuming that its callees will overwrite  
not append to conn->errorMessage.)  
  
Possibly this change should get back-patched someday; but it needs  
testing first, so let's not consider that till after v12 beta.  
  
Discussion: https://postgr.es/m/CAEepm=2n6Nv+5tFfe8YnkUm1fXgvxR0Mm1FoD+QKG-vLNGLyKg@mail.gmail.com  

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

Rename typedef in jsonpath_gram.y from "string" to "JsonPathString"

commit   : 5e28b778bf9a5835e702277119c5f92b4dbab45e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 19 Mar 2019 20:56:13 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 19 Mar 2019 20:56:13 +0300    

Click here for diff

Reason is the same as in 75c57058b0.  

M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/include/utils/jsonpath_scanner.h

Tweak nbtsearch.c function prototype order.

commit   : 1009920aaa39e19ecb36409447ece2f8102f4225    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 19 Mar 2019 09:59:05 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 19 Mar 2019 09:59:05 -0700    

Click here for diff

nbtsearch.c's static function prototypes were slightly out of order.  
Make the order consistent with static function definition order.  

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

Make checkpoint requests more robust.

commit   : 0dfe3d0ef5799e5197adb127a0ec354b61429982    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Mar 2019 12:49:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Mar 2019 12:49:27 -0400    

Click here for diff

Commit 6f6a6d8b1 introduced a delay of up to 2 seconds if we're trying  
to request a checkpoint but the checkpointer hasn't started yet (or,  
much less likely, our kill() call fails).  However buildfarm experience  
shows that that's not quite enough for slow or heavily-loaded machines.  
There's no good reason to assume that the checkpointer won't start  
eventually, so we may as well make the timeout much longer, say 60 sec.  
  
However, if the caller didn't say CHECKPOINT_WAIT, it seems like a bad  
idea to be waiting at all, much less for as long as 60 sec.  We can  
remove the need for that, and make this whole thing more robust, by  
adjusting the code so that the existence of a pending checkpoint  
request is clear from the contents of shared memory, and making sure  
that the checkpointer process will notice it at startup even if it did  
not get a signal.  In this way there's no need for a non-CHECKPOINT_WAIT  
call to wait at all; if it can't send the signal, it can nonetheless  
assume that the checkpointer will eventually service the request.  
  
A potential downside of this change is that "kill -INT" on the checkpointer  
process is no longer enough to trigger a checkpoint, should anyone be  
relying on something so hacky.  But there's no obvious reason to do it  
like that rather than issuing a plain old CHECKPOINT command, so we'll  
assume that nobody is.  There doesn't seem to be a way to preserve this  
undocumented quasi-feature without introducing race conditions.  
  
Since a principal reason for messing with this is to prevent intermittent  
buildfarm failures, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/checkpointer.c
M src/include/access/xlog.h

Reorder LOCALLOCK structure members to compact the size

commit   : 28988a84cf19c01dba3c3fb40e95d9cd6e4888da    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2019 14:07:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2019 14:07:08 +0100    

Click here for diff

Save 8 bytes (on x86-64) by filling up padding holes.  
  
Author: Takayuki Tsunakawa <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/storage/lock.h

Rename typedef in jsonpath_scan.l from "keyword" to "JsonPathKeyword"

commit   : 75c57058b0f5d511a9d80ddfab68a761229d68ea    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 19 Mar 2019 13:34:16 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 19 Mar 2019 13:34:16 +0300    

Click here for diff

Typedef name should be both unique and non-intersect with variable names  
across all the sources.  That makes both pg_indent and debuggers happy.  
  
Discussion: https://postgr.es/m/23865.1552936099%40sss.pgh.pa.us  

M src/backend/utils/adt/jsonpath_scan.l

Ignore attempts to add TOAST table to shared or catalog tables

commit   : 590a87025b0aa9ebca53c7b71ddf036e5acd8f08    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2019 10:48:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2019 10:48:03 +0100    

Click here for diff

Running ALTER TABLE on any table will check if a TOAST table needs to be  
added.  On shared tables, this would previously fail, thus effectively  
disabling ALTER TABLE for those tables.  On (non-shared) system  
catalogs, on the other hand, it would add a TOAST table, even though we  
don't really want TOAST tables on some system catalogs.  In some cases,  
it would also fail with an error "AccessExclusiveLock required to add  
toast table.", depending on what locks the ALTER TABLE actions had  
already taken.  
  
So instead, just ignore attempts to add TOAST tables to such tables,  
outside of bootstrap mode, pretending they don't need one.  
  
This allows running ALTER TABLE on such tables without messing up the  
TOAST situation.  Legitimate uses for ALTER TABLE on system catalogs  
include setting reloptions (say, fillfactor or autovacuum settings).  
  
(All this still requires allow_system_table_mods, which is independent  
of this.)  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/toasting.c

Fix whitespace

commit   : e537ac5182f8cfa7244a8c8ae772b787b2288605    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2019 10:28:34 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2019 10:28:34 +0100    

Click here for diff

M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l

Fix bug in support for collation attributes on older ICU versions

commit   : 1f050c08f91d866c560344d4510404ecd2763cbf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2019 09:37:46 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Mar 2019 09:37:46 +0100    

Click here for diff

Unrecognized attribute names are supposed to be ignored.  But the code  
would error out on an unrecognized attribute value even if it did not  
recognize the attribute name.  So unrecognized attributes wouldn't  
really be ignored unless the value happened to be one that matched a  
recognized value.  This would break some important cases where the  
attribute would be processed by ucol_open() directly.  Fix that and  
add a test case.  
  
The restructured code should also avoid compiler warnings about  
initializing a UColAttribute value to -1, because the type might be an  
unsigned enum.  (reported by Andres Freund)  

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

Fix copyfuncs/equalfuncs support for VacuumStmt.

commit   : 53680c116ce8c501e4081332d32ba0e93aa1aaa2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 18 Mar 2019 23:20:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 18 Mar 2019 23:20:35 -0400    

Click here for diff

Commit 6776142a07afb4c28961f27059d800196902f5f1 failed to do this,  
and the buildfarm broke.  
  
Patch by me, per advice from Tom Lane and Michael Paquier.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c

Implement OR REPLACE option for CREATE AGGREGATE.

commit   : 01bde4fa4c24f4eea0a634d8fcad0b376efda6b1    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 19 Mar 2019 01:16:50 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 19 Mar 2019 01:16:50 +0000    

Click here for diff

Aggregates have acquired a dozen or so optional attributes in recent  
years for things like parallel query and moving-aggregate mode; the  
lack of an OR REPLACE option to add or change these for an existing  
agg makes extension upgrades gratuitously hard. Rectify.  

M doc/src/sgml/ref/create_aggregate.sgml
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/aggregatecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/include/catalog/pg_aggregate.h
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_aggregate.out
M src/test/regress/sql/create_aggregate.sql

Fix memory leak in printtup.c.

commit   : f2004f19ed9c9228d3ea2b12379ccb4b9212641f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Mar 2019 17:54:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Mar 2019 17:54:24 -0400    

Click here for diff

Commit f2dec34e1 changed things so that printtup's output stringinfo  
buffer was allocated outside the per-row temporary context, not inside  
it.  This creates a need to free that buffer explicitly when the temp  
context is freed, but that was overlooked.  In most cases, this is all  
happening inside a portal or executor context that will go away shortly  
anyhow, but that's not always true.  Notably, the stringinfo ends up  
getting leaked when JDBC uses row-at-a-time fetches.  For a query  
that returns wide rows, that adds up after awhile.  
  
Per bug #15700 from Matthias Otterbach.  Back-patch to v11 where the  
faulty code was added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typos in sgml docs about RefetchForeignRow().

commit   : 11180a5015e9c6299ee732fa587b3a8bc6dca6b2    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Mar 2019 13:32:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Mar 2019 13:32:41 -0700    

Click here for diff

I screwed this up in ad0bda5d24e.  
  
Reported-By: Jie Zhang, Michael Paquier, Etsuro Fujita  
Discussion: https://postgr.es/m/1396E95157071C4EBBA51892C5368521017F2DA203@G08CNEXMBPEKD02.g08.fujitsu.local  

M doc/src/sgml/fdwhandler.sgml

Remove leftover reference to oid column.

commit   : 7571ce6f11f24594274fd4956bd4d1114eebd485    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Mar 2019 13:10:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Mar 2019 13:10:29 -0700    

Click here for diff

I (Andres) missed this in 578b229718e8.  
  
Author: John Naylor  
Discussion: https://postgr.es/m/CACPNZCtd+ckUgibRFs9KewK4Yr5rj3Oipefquupw+XJZebFhrA@mail.gmail.com  

M contrib/vacuumlo/vacuumlo.c

Don't auto-restart per-database autoprewarm workers.

commit   : 1459e84cb2e57649627753ad1279428d35590df6    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 18 Mar 2019 15:21:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 18 Mar 2019 15:21:09 -0400    

Click here for diff

We should try to prewarm each database only once.  Otherwise, if  
prewarming fails for some reason, it will just keep retrying in an  
infnite loop.  This can happen if, for example, the database has been  
dropped.  The existing code was intended to implement the try-once  
behavior, but failed to do so because it neglected to set  
worker.bgw_restart_time to BGW_NEVER_RESTART.  
  
Mithun Cy, per a report from Hans Buschmann  
  
Discussion: http://postgr.es/m/CA+hUKGKpQJCWcgyy3QTC9vdn6uKAR_8r__A-MMm2GYfj45caag@mail.gmail.com  

M contrib/pg_prewarm/autoprewarm.c

Revise parse tree representation for VACUUM and ANALYZE.

commit   : 6776142a07afb4c28961f27059d800196902f5f1    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 18 Mar 2019 15:14:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 18 Mar 2019 15:14:52 -0400    

Click here for diff

Like commit f41551f61f9cf4eedd5b7173f985a3bdb4d9858c, this aims  
to make it easier to add non-Boolean options to VACUUM (or, in  
this case, to ANALYZE).  Instead of building up a bitmap of  
options directly in the parser, build up a list of DefElem  
objects and let ExecVacuum() sort it out; right now, we make  
no use of the fact that a DefElem can carry an associated value,  
but it will be easy to make that change in the future.  
  
Masahiko Sawada  
  
Discussion: http://postgr.es/m/CAD21AoATE4sn0jFFH3NcfUZXkU2BMbjBWB_kDj-XWYA-LXDcQA@mail.gmail.com  

M src/backend/commands/vacuum.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/include/commands/vacuum.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Fold vacuum's 'int options' parameter into VacuumParams.

commit   : f41551f61f9cf4eedd5b7173f985a3bdb4d9858c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 18 Mar 2019 13:57:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 18 Mar 2019 13:57:33 -0400    

Click here for diff

Many places need both, so this allows a few functions to take one  
fewer parameter.  More importantly, as soon as we add a VACUUM  
option that takes a non-Boolean parameter, we need to replace  
'int options' with a struct, and it seems better to think  
of adding more fields to VacuumParams rather than passing around  
both VacuumParams and a separate struct as well.  
  
Patch by me, reviewed by Masahiko Sawada  
  
Discussion: http://postgr.es/m/CA+Tgmob6g6-s50fyv8E8he7APfwCYYJ4z0wbZC2yZeSz=26CYQ@mail.gmail.com  

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

Fix optimization of foreign-key on update actions

commit   : 1ffa59a85cb40a61f4523fb03c8960db97eea124    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Mar 2019 17:01:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Mar 2019 17:01:40 +0100    

Click here for diff

In RI_FKey_pk_upd_check_required(), we check among other things  
whether the old and new key are equal, so that we don't need to run  
cascade actions when nothing has actually changed.  This was using the  
equality operator.  But the effect of this is that if a value in the  
primary key is changed to one that "looks" different but compares as  
equal, the update is not propagated.  (Examples are float -0 and 0 and  
case-insensitive text.)  This appears to violate the SQL standard, and  
it also behaves inconsistently if in a multicolumn key another key is  
also updated that would cause the row to compare as not equal.  
  
To fix, if we are looking at the PK table in ri_KeysEqual(), then do a  
bytewise comparison similar to record_image_eq() instead of using the  
equality operators.  This only makes a difference for ON UPDATE  
CASCADE, but for consistency we treat all changes to the PK the same.  For  
the FK table, we continue to use the equality operators.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/datum.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/include/utils/datum.h
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Remove unused macro

commit   : fb5806533f9fe0433290d84c9b019399cd69e9c2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Mar 2019 09:13:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Mar 2019 09:13:08 +0100    

Click here for diff

It has never been used.  

M src/bin/pg_dump/parallel.c

Revert 4178d8b91c

commit   : a0478b69985056965a5737184279a99bde421f69    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 18 Mar 2019 09:54:29 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 18 Mar 2019 09:54:29 +0300    

Click here for diff

As it was agreed to worsen the code readability.  
  
Discussion: https://postgr.es/m/ecfcfb5f-3233-eaa9-0c83-07056fb49a83%402ndquadrant.com  

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

Refactor more code logic to update the control file

commit   : 8b938d36f7446e76436ca4a8ddcebbebaeaab480    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Mar 2019 12:59:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Mar 2019 12:59:35 +0900    

Click here for diff

ce6afc6 has begun the refactoring work by plugging pg_rewind into a  
central routine to update the control file, and left around two extra  
copies, with one in xlog.c for the backend and one in pg_resetwal.c.  By  
adding an extra option to the central routine in controldata_utils.c to  
control if a flush of the control file needs to be done, it is proving  
to be straight-forward to make xlog.c and pg_resetwal.c use the central  
code path at the condition of moving the wait event tracking there.  
Hence, this allows to have only one central code path to update the  
control file, shaving the code from the duplicates.  
  
This refactoring actually fixes a problem in pg_resetwal.  Previously,  
the control file was first removed before being recreated.  So if a  
crash happened between the moment the file was removed and the moment  
the file was created, then it would have been possible to not have a  
control file anymore in the database folder.  
  
Author: Fabien Coelho  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1903170935210.2506@lancre  

M src/backend/access/transam/xlog.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
M src/common/controldata_utils.c
M src/include/common/controldata_utils.h

Fix pg_rewind when rewinding new database with tables included

commit   : a7eadaaaaf089994279488f795bdedd9ded1682a    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Mar 2019 10:34:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Mar 2019 10:34:45 +0900    

Click here for diff

This fixes an issue introduced by 266b6ac, which has added filters to  
exclude file patterns on the target and source data directories to  
reduce the number of files transferred.  Filters get applied to both  
the target and source data files, and include pg_internal.init which is  
present for each database once relations are created on it.  However, if  
the target differed from the source with at least one new database with  
relations, the rewind would fail due to the exclusion filters applied on  
the target files, causing pg_internal.init to still be present on the  
target database folder, while its contents should have been completely  
removed so as there is nothing remaining inside at the time of the  
folder deletion.  
  
Applying exclusion filters on the source files is fine, because this way  
the amount of data copied from the source to the target is reduced.  And  
actually, not applying the filters on the target is what pg_rewind  
should do, because this causes such files to be automatically removed  
during the rewind on the target.  Exclusion filters apply to paths which  
are removed or recreated automatically at startup, so removing all those  
files on the target during the rewind is a win.  
  
The existing set of TAP tests already stresses the rewind of databases,  
but it did not include any tables on those newly-created databases.  
Creating extra tables in this case is enough to reproduce the failure,  
so the existing tests are extended to close the gap.  
  
Reported-by: Mithun Cy  
Author: Michael Paquier  
Discussion: https://postgr.es/m/CADq3xVYt6_pO7ZzmjOqPgY9HWsL=kLd-_tNyMtdfjKqEALDyTA@mail.gmail.com  
Backpatch-through: 11  

M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/RewindTest.pm

Error out in pg_checksums on incompatible block size

commit   : fa3395659561b564051a2bbd3997de8e2923c8e3    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Mar 2019 09:11:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Mar 2019 09:11:52 +0900    

Click here for diff

pg_checksums is compiled with a given block size and has a hard  
dependency to it per the way checksums are calculated via  
checksum_impl.h, and trying to use the tool on a data folder which has  
not the same block size would result in incorrect checksum calculations  
and/or block read errors, meaning that the data folder is corrupted.  
This is harmless as checksums are only checked now, but very confusing  
for the user so issue an error properly if the block size used at  
compilation and the block size used in the data folder do not match.  
  
Reported-by: Sergei Kornilov  
Author: Michael Banck, Michael Paquier  
Reviewed-by: Fabien Coelho, Magnus Hagander  
Discussion: https://postgr.es/m/[email protected]  
ackpatch-through: 11  

M src/bin/pg_checksums/pg_checksums.c

Beautify initialization of JsonValueList and JsonLikeRegexContext

commit   : 4178d8b91cb943b422d1837b4b7798576d88995a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 12:58:26 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 12:58:26 +0300    

Click here for diff

Instead of tricky assignment to {0} introduce special macros, which  
explicitly initialize every field.  

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

Apply const qualifier to keywords of jsonpath_scan.l

commit   : aa1b7f386687dec17ffa62d13026580050734632    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 12:50:38 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 12:50:38 +0300    

Click here for diff

Discussion: https://postgr.es/m/CAEeOP_a-Pfy%3DU9-f%3DgQ0AsB8FrxrC8xCTVq%2BeO71-2VoWP5cag%40mail.gmail.com  
Author: Mark G  

M src/backend/utils/adt/jsonpath_scan.l

Remove some make rules added in 142c400d72

commit   : c183a07f279d1fba8ccea1baf7210e8fafbaa097    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 11:14:49 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 11:14:49 +0300    

Click here for diff

Because they fail build of jsonpath_scan.c.  

M src/backend/utils/adt/Makefile

Fix make rules for jsonpath grammar making them similar to SQL grammar

commit   : 142c400d72f77e7249306b80e0149f4fd35c6304    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 10:51:28 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 10:51:28 +0300    

Click here for diff

Reported-by: Jeff Janes, Tom Lane  
Discussion: https://postgr.es/m/CAMkU%3D1w1qBvoW82ZTFpAKae027R-2OHw-m6ALe0VQRNAFueBVA%40mail.gmail.com  

M src/backend/Makefile
M src/backend/utils/adt/Makefile
M src/include/Makefile

Add support for collation attributes on older ICU versions

commit   : b8f9a2a69a279d118e366a0d3d45caa84a7620b1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2019 08:16:33 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 17 Mar 2019 08:16:33 +0100    

Click here for diff

Starting in ICU 54, collation customization attributes can be  
specified in the locale string, for example  
"@colStrength=primary;colCaseLevel=yes".  Add support for this for  
older ICU versions as well, by adding some minimal parsing of the  
attributes in the locale string and calling ucol_setAttribute() on  
them.  This is essentially what never ICU versions do internally in  
ucol_open().  This was we can offer this functionality in a consistent  
way in all ICU versions supported by PostgreSQL.  
  
Also add some tests for ICU collation customization.  
  
Reported-by: Daniel Verite <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Fix compiler warning in jsonpath_exec.c

commit   : 042162d6281a7daf1291931ee7b0a5641d3a73d7    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 10:10:21 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 17 Mar 2019 10:10:21 +0300    

Click here for diff

Warning was observed in gcc 4.4.6, gcc 4.4.7 and probably others.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/25151.1552751426%40sss.pgh.pa.us  

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

Remove another unnecessary application_name specification in test

commit   : 0176eb210e445e8a911c7df79997c7ab62e86dcc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Mar 2019 22:38:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Mar 2019 22:38:59 +0100    

Click here for diff

see 8e93a516e68bac3c329fd2e7f423ee9aceca943a  

M src/test/subscription/t/100_bugs.pl

Further adjust the tests for the hyperbolic functions.

commit   : c43ecdee0fff529ca47a90aea0a6954690af045c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Mar 2019 15:50:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Mar 2019 15:50:13 -0400    

Click here for diff

It looks like we can leave in most of the test cases for Infinity/NaN  
inputs, but buildfarm member jacana gets the wrong answer for acosh(Inf).  
It's not worth carrying a variant expected file for that, so just disable  
that one test.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Suppress -Wimplicit-fallthrough warnings in new jsonpath code.

commit   : 20f7c3d5606254d8870697f15fd7a7b4e602e1e1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Mar 2019 12:34:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Mar 2019 12:34:46 -0400    

Click here for diff

Per buildfarm.  See commit 41c912cad for precedent.  

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

commit   : f27314ff9a0eb60b75bb576c3629c8849f7698c1    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 16 Mar 2019 16:00:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 16 Mar 2019 16:00:38 +0530    

Click here for diff

M src/backend/partitioning/partdesc.c
M src/include/partitioning/partdesc.h

Numeric error suppression in jsonpath

commit   : 16d489b0fe058e527619f5e9d92fd7ca3c6c2994    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 16 Mar 2019 12:21:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 16 Mar 2019 12:21:19 +0300    

Click here for diff

Add support of numeric error suppression to jsonpath as it's required by  
standard.  This commit doesn't use PG_TRY()/PG_CATCH() in order to implement  
that.  Instead, it provides internal versions of numeric functions used, which  
support error suppression.  
  
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com  
Author: Alexander Korotkov, Nikita Glukhov  
Reviewed-by: Tomas Vondra  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/float.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/numeric.c
M src/include/utils/float.h
M src/include/utils/numeric.h
M src/test/regress/expected/jsonb_jsonpath.out

Partial implementation of SQL/JSON path language

commit   : 72b6460336e86ad5cafd3426af6013c7d8457367    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 16 Mar 2019 12:15:37 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 16 Mar 2019 12:15:37 +0300    

Click here for diff

SQL 2016 standards among other things contains set of SQL/JSON features for  
JSON processing inside of relational database.  The core of SQL/JSON is JSON  
path language, allowing access parts of JSON documents and make computations  
over them.  This commit implements partial support JSON path language as  
separate datatype called "jsonpath".  The implementation is partial because  
it's lacking datetime support and suppression of numeric errors.  Missing  
features will be added later by separate commits.  
  
Support of SQL/JSON features requires implementation of separate nodes, and it  
will be considered in subsequent patches.  This commit includes following  
set of plain functions, allowing to execute jsonpath over jsonb values:  
  
 * jsonb_path_exists(jsonb, jsonpath[, jsonb, bool]),  
 * jsonb_path_match(jsonb, jsonpath[, jsonb, bool]),  
 * jsonb_path_query(jsonb, jsonpath[, jsonb, bool]),  
 * jsonb_path_query_array(jsonb, jsonpath[, jsonb, bool]).  
 * jsonb_path_query_first(jsonb, jsonpath[, jsonb, bool]).  
  
This commit also implements "jsonb @? jsonpath" and "jsonb @@ jsonpath", which  
are wrappers over jsonpath_exists(jsonb, jsonpath) and jsonpath_predicate(jsonb,  
jsonpath) correspondingly.  These operators will have an index support  
(implemented in subsequent patches).  
  
Catversion bumped, to add new functions and operators.  
  
Code was written by Nikita Glukhov and Teodor Sigaev, revised by me.  
Documentation was written by Oleg Bartunov and Liudmila Mantrova.  The work  
was inspired by Oleg Bartunov.  
  
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com  
Author: Nikita Glukhov, Teodor Sigaev, Alexander Korotkov, Oleg Bartunov, Liudmila Mantrova  
Reviewed-by: Tomas Vondra, Andrew Dunstan, Pavel Stehule, Alexander Korotkov  

M doc/src/sgml/biblio.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml
M src/backend/Makefile
M src/backend/catalog/system_views.sql
A src/backend/utils/adt/.gitignore
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
A src/backend/utils/adt/jsonpath.c
A src/backend/utils/adt/jsonpath_exec.c
A src/backend/utils/adt/jsonpath_gram.y
A src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/regexp.c
M src/backend/utils/errcodes.txt
M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/regex/regex.h
M src/include/utils/.gitignore
M src/include/utils/jsonb.h
A src/include/utils/jsonpath.h
A src/include/utils/jsonpath_scanner.h
A src/test/regress/expected/jsonb_jsonpath.out
A src/test/regress/expected/jsonpath.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/jsonb_jsonpath.sql
A src/test/regress/sql/jsonpath.sql
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/pgindent/typedefs.list

Avoid casting away a const

commit   : 893d6f8a1f9b43da805124e93cbf0f7aea890ad4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Mar 2019 10:13:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Mar 2019 10:13:03 +0100    

Click here for diff

M src/backend/access/transam/xlog.c
M src/backend/utils/misc/guc.c
M src/include/access/xlog.h

Don't propagate PGAPPNAME through pg_ctl in tests

commit   : 8e93a516e68bac3c329fd2e7f423ee9aceca943a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Mar 2019 21:24:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Mar 2019 21:24:05 +0100    

Click here for diff

When libpq is loaded in the server (for instance, by  
libpqwalreceiver), it may use libpq environment variables set in the  
postmaster environment for connection parameter defaults.  This has  
some confusing effects in our test suites.  For example, the TAP test  
infrastructure sets PGAPPNAME to allow identifying clients in the  
server log.  But this environment variable is also inherited by  
temporary servers started with pg_ctl and is then in turn used by  
libpqwalreceiver as the application_name for connecting to remote  
servers where it then shows up in pg_stat_replication and is relevant  
for things like synchronous_standby_names.  Replication already has a  
suitable default for application_name, and overriding that  
accidentally then requires the individual test cases to re-override  
that, which is all very confusing and unnecessary.  
  
To fix, unset PGAPPNAME temporarily before running pg_ctl start or  
restart in the tests.  
  
More comprehensive approaches like unsetting all environment variables  
in pg_ctl were considered but might be too complicated to achieve  
portably.  
  
The now unnecessary re-overriding of application_name by test cases is  
also removed.  
  
Reviewed-by: Noah Misch <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_rewind/t/RewindTest.pm
M src/test/perl/PostgresNode.pm
M src/test/recovery/t/004_timeline_switch.pl
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl

Use correct connection name variable in ecpglib.

commit   : c21d6033f77353623f8642c5541e0d002d986f59    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 15 Mar 2019 22:35:24 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 15 Mar 2019 22:35:24 +0100    

Click here for diff

Fixed-by: Kuroda-san <[email protected]>  

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

Improve code comments in b0eaa4c51b.

commit   : 06c8a5090ed9ec188557a86d4de11384f5128ec0    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 16 Mar 2019 06:55:56 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 16 Mar 2019 06:55:56 +0530    

Click here for diff

Author: John Naylor  
Discussion: https://postgr.es/m/CACPNZCswjyGJxTT=mxHgK=Z=mJ9uJ4WEx_UO=bNwpR_i0EaHHg@mail.gmail.com  

M src/backend/storage/freespace/freespace.c

Further reduce memory footprint of CLOBBER_CACHE_ALWAYS testing.

commit   : d3f48dfae42f9655425d1f58f396e495c7fb7812    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Mar 2019 13:46:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Mar 2019 13:46:26 -0400    

Click here for diff

Some buildfarm members using CLOBBER_CACHE_ALWAYS have been having OOM  
problems of late.  Commit 2455ab488 addressed this problem by recovering  
space transiently used within RelationBuildPartitionDesc, but it turns  
out that leaves quite a lot on the table, because other subroutines of  
RelationBuildDesc also leak memory like mad.  Let's move the temp-context  
management into RelationBuildDesc so that leakage from the other  
subroutines is also recovered.  
  
I examined this issue by arranging for postgres.c to dump the size of  
MessageContext just before resetting it in each command cycle, and  
then running the update.sql regression test (which is one of the two  
that are seeing buildfarm OOMs) with and without CLOBBER_CACHE_ALWAYS.  
Before 2455ab488, the peak space usage with CCA was as much as 250MB.  
That patch got it down to ~80MB, but with this patch it's about 0.5MB,  
and indeed the space usage now seems nearly indistinguishable from a  
non-CCA build.  
  
RelationBuildDesc's traditional behavior of not worrying about leaking  
transient data is of many years' standing, so I'm pretty hesitant to  
change that without more evidence that it'd be useful in a normal build.  
(So far as I can see, non-CCA memory consumption is about the same with  
or without this change, whuch if anything suggests that it isn't useful.)  
Hence, configure the patch so that we recover space only when  
CLOBBER_CACHE_ALWAYS or CLOBBER_CACHE_RECURSIVELY is defined.  However,  
that choice can be overridden at compile time, in case somebody would  
like to do some performance testing and try to develop evidence for  
changing that decision.  
  
It's possible that we ought to back-patch this change, but in the  
absence of back-branch OOM problems in the buildfarm, I'm not in  
a hurry to do that.  
  
Discussion: https://postgr.es/m/CA+TgmoY3bRmGB6-DUnoVy5fJoreiBJ43rwMrQRCdPXuKt4Ykaw@mail.gmail.com  

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

PL/Tcl: Improve trigger tests organization

commit   : aefcc2bba211b738b3dd3cb393d9cdfcbcdc83cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Mar 2019 11:21:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Mar 2019 11:21:01 +0100    

Click here for diff

The trigger tests for PL/Tcl were spread aroud pltcl_setup.sql and  
pltcl_queries.sql, mixed with other tests, which makes them hard to  
follow and edit.  Move all the trigger-related pieces to a new file  
pltcl_trigger.sql.  This also makes the test setup more similar to  
plperl and plpython.  

M src/pl/tcl/Makefile
M src/pl/tcl/expected/pltcl_queries.out
M src/pl/tcl/expected/pltcl_setup.out
A src/pl/tcl/expected/pltcl_trigger.out
M src/pl/tcl/sql/pltcl_queries.sql
M src/pl/tcl/sql/pltcl_setup.sql
A src/pl/tcl/sql/pltcl_trigger.sql

Add walreceiver API to get remote server version

commit   : 69039fda837d7a9c78e42b9dd5291d454e71f460    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Mar 2019 10:16:26 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Mar 2019 10:16:26 +0100    

Click here for diff

Add a separate walreceiver API function walrcv_server_version() to get  
the version of the remote server, instead of doing it as part of  
walrcv_identify_system().  This allows the server version to be  
available even for uses that don't call IDENTIFY_SYSTEM, and it seems  
cleaner anyway.  
  
This is for an upcoming patch, not currently used.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/include/replication/walreceiver.h

commit   : 4e197bf19556a1699b0e11e1ff111d77d09f6f80    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 15 Mar 2019 16:20:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 15 Mar 2019 16:20:11 +0900    

Click here for diff

Author: Sho Kato  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/25C1C6B2E7BE044889E4FE8643A58BA963E1D03D@G01JPEXMBKW03  

M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Enable parallel query with SERIALIZABLE isolation.

commit   : bb16aba50c9492490a0b57e600a932798f45cd4f    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 15 Mar 2019 16:23:46 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 15 Mar 2019 16:23:46 +1300    

Click here for diff

Previously, the SERIALIZABLE isolation level prevented parallel query  
from being used.  Allow the two features to be used together by  
sharing the leader's SERIALIZABLEXACT with parallel workers.  
  
An extra per-SERIALIZABLEXACT LWLock is introduced to make it safe to  
share, and new logic is introduced to coordinate the early release  
of the SERIALIZABLEXACT required for the SXACT_FLAG_RO_SAFE  
optimization, as follows:  
  
The first backend to observe the SXACT_FLAG_RO_SAFE flag (set by  
some other transaction) will 'partially release' the SERIALIZABLEXACT,  
meaning that the conflicts and locks it holds are released, but the  
SERIALIZABLEXACT itself will remain active because other backends  
might still have a pointer to it.  
  
Whenever any backend notices the SXACT_FLAG_RO_SAFE flag, it clears  
its own MySerializableXact variable and frees local resources so that  
it can skip SSI checks for the rest of the transaction.  In the  
special case of the leader process, it transfers the SERIALIZABLEXACT  
to a new variable SavedSerializableXact, so that it can be completely  
released at the end of the transaction after all workers have exited.  
  
Remove the serializable_okay flag added to CreateParallelContext() by  
commit 9da0cc35, because it's now redundant.  
  
Author: Thomas Munro  
Reviewed-by: Haribabu Kommi, Robert Haas, Masahiko Sawada, Kevin Grittner  
Discussion: https://postgr.es/m/CAEepm=0gXGYhtrVDWOTHS8SQQy_=S9xo+8oCxGLWZAOoeJ=yzQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/parallel.sgml
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/backend/executor/execParallel.c
M src/backend/optimizer/plan/planner.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/resowner/resowner.c
M src/include/access/parallel.h
M src/include/storage/lwlock.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
A src/test/isolation/expected/serializable-parallel-2.out
A src/test/isolation/expected/serializable-parallel.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/serializable-parallel-2.spec
A src/test/isolation/specs/serializable-parallel.spec

During pg_upgrade, conditionally skip transfer of FSMs.

commit   : 13e8643bfc29d3c1455c0946281cdfc24758ffb6    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 15 Mar 2019 08:25:57 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 15 Mar 2019 08:25:57 +0530    

Click here for diff

If a heap on the old cluster has 4 pages or fewer, and the old cluster  
was PG v11 or earlier, don't copy or link the FSM. This will shrink  
space usage for installations with large numbers of small tables.  
  
This will allow pg_upgrade to take advantage of commit b0eaa4c51b where  
we have avoided creation of the free space map for small heap relations.  
  
Author: John Naylor  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CACPNZCu4cOdm3uGnNEGXivy7Gz8UWyQjynDpdkPGabQ18_zK6g%40mail.gmail.com  

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c

Reorder identity regression test

commit   : 2fadf24e249bd72fc517663a91a233437460671c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Mar 2019 00:16:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Mar 2019 00:16:45 +0100    

Click here for diff

The previous test order had the effect that if something was wrong  
with the identity functionality, the create_table_like test would  
likely fail or crash first, which is confusing.  Reorder so that the  
identity test comes before create_table_like.  

M src/test/regress/expected/identity.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/identity.sql

Fix some oversights in commit 2455ab488.

commit   : de570047993bd5fd65ad2bdf6b0acf5b8939bcb3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Mar 2019 18:36:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Mar 2019 18:36:26 -0400    

Click here for diff

The idea was to generate all the junk in a destroyable subcontext rather  
than leaking it in the caller's context, but partition_bounds_create was  
still being called in the caller's context, allowing plenty of scope for  
leakage.  Also, get_rel_relkind() was still being called in the rel's  
rd_pdcxt, creating a risk of session-lifespan memory wastage.  
  
Simplify the logic a bit while at it.  Also, reduce rd_pdcxt to  
ALLOCSET_SMALL_SIZES, since it seems likely to not usually be big.  
  
Probably something like this needs to be back-patched into v11,  
but for now let's get some buildfarm testing on this.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partdesc.c

Improve code comment

commit   : 61dc407893600f551dbcbc235d1dccd134f43da0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 22:44:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 22:44:21 +0100    

Click here for diff

M src/backend/commands/copy.c

Remove unused #include

commit   : 8bee36708f6ee4bf93be68f9a368379b0e9c6474    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 22:03:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 22:03:14 +0100    

Click here for diff

M src/backend/executor/execMain.c

Add BKI_DEFAULT to pg_class.relrewrite

commit   : b13a913607b9b304d16029361b1b17e10783cf7c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 21:25:39 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 21:25:39 +0100    

Click here for diff

This column is always 0 on disk, so it doesn't have to be tracked  
separately for each entry.  

M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h

Ensure dummy paths have correct required_outer if rel is parameterized.

commit   : 0a9d7e1f6d814799e6cd5046513702dd1fe38929    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Mar 2019 12:16:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Mar 2019 12:16:09 -0400    

Click here for diff

The assertions added by commits 34ea1ab7f et al found another problem:  
set_dummy_rel_pathlist and mark_dummy_rel were failing to label  
the dummy paths they create with the correct outer_relids, in case  
the relation is necessarily parameterized due to having lateral  
references in its tlist.  It's likely that this has no user-visible  
consequences in production builds, at the moment; but still an assertion  
failure is a bad thing, so back-patch the fix.  
  
Per bug #15694 from Roman Zharkov (via Alexander Lakhin)  
and an independent report by Tushar Ahuja.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Defend against leaks into RelationBuildPartitionDesc.

commit   : 2455ab48844c90419714e27eafd235a85de23232    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Mar 2019 12:03:31 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Mar 2019 12:03:31 -0400    

Click here for diff

In normal builds, this isn't very important, because the leaks go  
into fairly short-lived contexts, but under CLOBBER_CACHE_ALWAYS,  
this can result in leaking hundreds of megabytes into MessageContext,  
which probably explains recent failures on hyrax.  
  
This may or may not be the best long-term strategy for dealing  
with this leak, but we can change it later if we come up with  
something better.  For now, do this to make the buildfarm green  
again (hopefully).  Commit 898e5e3290a72d288923260143930fb32036c00c  
seems to have exacerbated this problem for reasons that are not  
quite clear, but I don't believe it's actually the cause.  
  
Discussion: http://postgr.es/m/CA+TgmoY3bRmGB6-DUnoVy5fJoreiBJ43rwMrQRCdPXuKt4Ykaw@mail.gmail.com  

M src/backend/partitioning/partdesc.c

Refactor ParamListInfo initialization

commit   : c6ff0b892c30122b75d32c524109d16ee3c973f0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 13:30:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 13:30:09 +0100    

Click here for diff

There were six copies of identical nontrivial code.  Put it into a  
function.  

M src/backend/commands/prepare.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/nodes/params.c
M src/backend/tcop/postgres.c
M src/include/nodes/params.h
M src/pl/plpgsql/src/pl_exec.c

Fix volatile vs. pointer confusion

commit   : 1226d932b4dadc39ba2f9a488e4d784443ea6a78    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 08:25:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Mar 2019 08:25:25 +0100    

Click here for diff

Variables used after a longjmp() need to be declared volatile.  In  
case of a pointer, it's the pointer itself that needs to be declared  
volatile, not the pointed-to value.  So we need  
  
    PyObject *volatile items;  
  
instead of  
  
    volatile PyObject *items;  /* wrong */  
  
Discussion: https://www.postgresql.org/message-id/flat/f747368d-9e1a-c46a-ac76-3c27da32e8e4%402ndquadrant.com  

M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c

Fix thinko when bumping on temporary directories in pg_checksums

commit   : 6eebfdc38b173edcd179f422cf7083383edb24bc    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Mar 2019 14:14:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Mar 2019 14:14:49 +0900    

Click here for diff

This fixes an oversight from 5c99513.  This has no actual consequence as  
PG_TEMP_FILE_PREFIX and PG_TEMP_FILES_DIR have the same value so when  
bumping on a temporary path the directory scan was still moving on to  
the next entry instead of skipping the rest of the scan, but let's keep  
the logic correct.  
  
Author: Michael Banck  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/bin/pg_checksums/pg_checksums.c

Sync commentary in transam.h and bki.sgml.

commit   : 401b87a24fbab7bfb48eb48050a51e033452ac6e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Mar 2019 00:23:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Mar 2019 00:23:33 -0400    

Click here for diff

Commit a6417078c missed updating some comments in transam.h about  
reservation of high OIDs for development purposes.  Also tamp down  
an over-optimistic comment there about how easy it'd be to change  
FirstNormalObjectId.  
  
Earlier, commit 09568ec3d failed to update bki.sgml for the split  
between genbki.pl-assigned OIDs and those assigned during initdb.  
  
Also fix genbki.pl so that it will complain if it overruns  
that split.  It's possible that doing so would have no very bad  
consequences, but that's no excuse for not detecting it.  

M doc/src/sgml/bki.sgml
M src/backend/catalog/genbki.pl
M src/include/access/transam.h

Fix race condition in recently-added TAP test for recovery consistency

commit   : 364298be22090769da14aa749fe730cf16ed3c2c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Mar 2019 12:41:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Mar 2019 12:41:45 +0900    

Click here for diff

A couple of queries are run on the primary to create and fill in a test  
table, which gets checked on the standby afterwards.  However the test  
was not waiting for the confirmation that the necessary records have  
been replayed on the standby, leading to spurious failures.  
  
Per buildfarm member loach.  Thanks to Thomas Munro for the report and  
Tom Lane for the failure analysis.  
  
Discussion: https://postgr.es/m/CA+hUKGLUpqG52xtriUz5RpmeKPoEfNxNc-CginG+Cx+X2-Ycew@mail.gmail.com  

M src/test/recovery/t/016_min_consistency.pl

Adjust the tests for the hyperbolic functions.

commit   : c015f853bf5958dd7562a17952df33a9d115e65f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Mar 2019 21:05:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Mar 2019 21:05:33 -0400    

Click here for diff

Preliminary results from the buildfarm suggest that no platform gets  
commit c6f153dcf's test cases wrong by more than one or two units in  
the last place, so setting extra_float_digits = 0 should be plenty  
to hide the cross-platform variations.  
  
Also, add tests for Infinity/NaN inputs.  I think it highly likely  
that we'll end up removing these again, rather than adding code to  
make ancient platforms conform.  But it seems useful to find out  
just how many platforms have such issues before we make a decision.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rethink how to test the hyperbolic functions.

commit   : c6f153dcfebccf7a0d92290037793c656f1caef5    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Mar 2019 18:13:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Mar 2019 18:13:38 -0400    

Click here for diff

The initial commit tried to test them on trivial cases such as 0,  
reasoning that we shouldn't hit any portability issues that way.  
The buildfarm immediately proved that hope ill-founded, and anyway  
it's not a great testing scheme because it doesn't prove that we're  
even calling the right library function for each SQL function.  
  
Instead, let's test them at inputs such as 1 (or something within  
the valid range, as needed), so that each function should produce  
a different output.  
  
As committed, this is just about certain to show portability  
failures, because it's very unlikely that every platform computes  
these functions the same as mine down to the last bit.  However,  
I want to put it through a buildfarm cycle this way, so that  
we can see how big the variations are.  The plan is to add  
"set extra_float_digits = -1", or whatever we need in order to  
hide the variations; but first we need data.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Use condition variables to wait for checkpoints.

commit   : c6c9474aafa4de357ae424cd18b69e8bf7a4babe    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 14 Mar 2019 10:25:27 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 14 Mar 2019 10:25:27 +1300    

Click here for diff

Previously we used a polling/sleeping loop to wait for checkpoints  
to begin and end, which leads to up to a couple hundred milliseconds  
of needless thumb-twiddling.  Use condition variables instead.  
  
Author: Thomas Munro  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/CA%2BhUKGLY7sDe%2Bbg1K%3DbnEzOofGoo4bJHYh9%2BcDCXJepb6DQmLw%40mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Revert setting client_min_messages to 'debug1' in new tests.

commit   : 5655565c077c53b6e9b4b9bfcdf96439cf3af065    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 Mar 2019 13:14:42 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 Mar 2019 13:14:42 -0400    

Click here for diff

The buildfarm doesn't like this, because some buildfarm members have  
log_statement = 'all'.  We could change the log level of the messages  
instead, but Tom doesn't like that.  So let's do this instead, at  
least for now.  
  
Patch by Sergei Kornilov, applied here in reverse.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Include all columns in default names for foreign key constraints

commit   : f177660ab01e53dd5597b195dcc8526baa5cfcbd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Mar 2019 14:15:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Mar 2019 14:15:37 +0100    

Click here for diff

When creating a name for a foreign key constraint when none is  
specified, use all column names instead of only the first one, similar  
to how it is already done for index names.  
  
Author: Paul Martinez <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAF+2_SFjky6XRfLNRXpkG97W6PRbOO_mjAxqXzAAimU=c7w7_A@mail.gmail.com  

M src/backend/commands/indexcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/foreign_key.sql

Allow ALTER TABLE .. SET NOT NULL to skip provably unnecessary scans.

commit   : bbb96c3704c041d139181c6601e5bc770e045d26    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 Mar 2019 08:55:00 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 Mar 2019 08:55:00 -0400    

Click here for diff

If existing CHECK or NOT NULL constraints preclude the presence  
of nulls, we need not look to see whether any are present.  
  
Sergei Kornilov, reviewed by Stephen Frost, Ildar Musin, David Rowley,  
and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

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

Remove extra comma

commit   : 95fa9f1a137fcb55ed418d8c91a315c7bb169979    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 13 Mar 2019 13:41:14 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 13 Mar 2019 13:41:14 +0100    

Click here for diff

Author: Christoph Berg <[email protected]>  

M doc/src/sgml/pageinspect.sgml

Add TAP test to check consistency of minimum recovery LSN

commit   : b0825d28ea83e44139bd319e6d1db2c499cd4c6a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2019 14:58:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2019 14:58:24 +0900    

Click here for diff

c186ba13 has fixed an issue related to the updates of the minimum  
recovery LSN across multiple processes on standbys, but we never really  
had a test case able to reliably check its logic.  
  
This commit introduces a new test case to close the gap, and is designed  
to check the consistency of data based on the minimum recovery point set  
by either the startup process or the checkpointer for both an offline  
cluster (by looking at the on-disk page headers) and an online cluster  
(using pageinspect).  
  
Note that with c186ba13 reverted, this test fails badly for both the  
online and offline cases, as designed.  
  
Author: Michael Paquier, Andrew Gierth  
Reviewed-by: Andrew Gierth, Georgios Kokolatos, Arthur Zakirov  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/TestLib.pm
M src/test/recovery/Makefile
A src/test/recovery/t/016_min_consistency.pl

Rename pg_verify_checksums to pg_checksums

commit   : 6dd263cfaa8447470af4fae3f61c47438f91d71f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2019 10:43:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2019 10:43:20 +0900    

Click here for diff

The current tool name is too restrictive and focuses only on verifying  
checksums.  As more options to control checksums for an offline cluster  
are planned to be added, switch to a more generic name.  Documentation  
as well as all past references to the tool are updated.  
  
Author: Michael Paquier  
Reviewed-by: Michael Banck, Fabien Coelho, Seigei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/allfiles.sgml
R079 doc/src/sgml/ref/pg_verify_checksums.sgml doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/reference.sgml
M src/backend/replication/basebackup.c
M src/bin/Makefile
M src/bin/initdb/t/001_initdb.pl
A src/bin/pg_checksums/.gitignore
R053 src/bin/pg_verify_checksums/Makefile src/bin/pg_checksums/Makefile
A src/bin/pg_checksums/nls.mk
R094 src/bin/pg_verify_checksums/pg_verify_checksums.c src/bin/pg_checksums/pg_checksums.c
A src/bin/pg_checksums/t/001_basic.pl
R089 src/bin/pg_verify_checksums/t/002_actions.pl src/bin/pg_checksums/t/002_actions.pl
D src/bin/pg_verify_checksums/.gitignore
D src/bin/pg_verify_checksums/nls.mk
D src/bin/pg_verify_checksums/t/001_basic.pl

Fix cross-version compatibility checks of pg_verify_checksums

commit   : c9ae7f704c6772a99a456ed50d226c1fdf23f6d7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2019 09:51:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Mar 2019 09:51:02 +0900    

Click here for diff

pg_verify_checksums performs a read of the control file, and the data it  
fetches should be from a data folder compatible with the major version  
of Postgres the binary has been compiled with, but we never actually  
checked that compatibility.  
  
Reported-by: Sergei Kornilov  
Author: Michael Paquier  
Reviewed-by: Sergei Kornilov  
Discussion: https://postgr.es/m/155231347133.16480.11453587097036807558.pgcf@coridan.postgresql.org  
Backpatch-through: 11  

M src/bin/pg_verify_checksums/pg_verify_checksums.c

Correct obsolete nbtree page split comment.

commit   : 3f34283973a342aa1cb709d6e8f5cea430efcf29    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 12 Mar 2019 16:40:05 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 12 Mar 2019 16:40:05 -0700    

Click here for diff

Commit 40dae7ec537, which made the nbtree page split algorithm more  
robust, made _bt_insert_parent() only unlock the right child of the  
parent page before inserting a new downlink into the parent.  Update a  
comment from the Berkeley days claiming that both left and right child  
pages are unlocked before the new downlink actually gets inserted.  
  
The claim that it is okay to release both locks early based on Lehman  
and Yao's say-so never made much sense.  Lehman and Yao must sometimes  
"couple" buffer locks across a pair of internal pages when relocating a  
downlink, unlike the corresponding code within _bt_getstack().  

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

Add support for hyperbolic functions, as well as log10().

commit   : f1d85aa98ee71d9662309f6f0384b2f7f8f16f02    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Mar 2019 15:55:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Mar 2019 15:55:09 -0400    

Click here for diff

The SQL:2016 standard adds support for the hyperbolic functions  
sinh(), cosh(), and tanh().  POSIX has long required libm to  
provide those functions as well as their inverses asinh(),  
acosh(), atanh().  Hence, let's just expose the libm functions  
to the SQL level.  As with the trig functions, we only implement  
versions for float8, not numeric.  
  
For the moment, we'll assume that all platforms actually do have  
these functions; if experience teaches otherwise, some autoconf  
effort may be needed.  
  
SQL:2016 also adds support for base-10 logarithm, but with the  
function name log10(), whereas the name we've long used is log().  
Add aliases named log10() for the float8 and numeric versions.  
  
Lætitia Avrot  
  
Discussion: https://postgr.es/m/CAB_COdguG22LO=rnxDQ2DW1uzv8aQoUzyDQNJjrR4k00XSgm5w@mail.gmail.com  

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

Remove remaining hard-wired OID references in the initial catalog data.

commit   : 3aa0395d4ed36f040f20da304c122b956529dd14    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Mar 2019 12:30:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Mar 2019 12:30:35 -0400    

Click here for diff

In the v11-era commits that taught genbki.pl to resolve symbolic  
OID references in the initial catalog data, we didn't bother to  
make every last reference symbolic; some of the catalogs have so  
few initial rows that it didn't seem worthwhile.  
  
However, the new project policy that OIDs assigned by new patches  
should be automatically renumberable changes this calculus.  
A patch that wants to add a row in one of these catalogs would have  
a problem when the OID it assigns gets renumbered.  Hence, do the  
mop-up work needed to make all OID references in initial data be  
symbolic, and establish an associated project policy that we'll  
never again write a hard-wired OID reference there.  
  
No catversion bump since the contents of postgres.bki aren't  
actually changed by this commit.  
  
Discussion: https://postgr.es/m/CAH2-WzmMTGMcPuph4OvsO7Ykut0AOCF_i-=eaochT0dd2BN9CQ@mail.gmail.com  

M doc/src/sgml/bki.sgml
M src/backend/catalog/genbki.pl
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h

Create a script that can renumber manually-assigned OIDs.

commit   : a6417078c4140e51cfd717448430f274b449d687    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Mar 2019 10:50:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Mar 2019 10:50:48 -0400    

Click here for diff

This commit adds a Perl script renumber_oids.pl, which can reassign a  
range of manually-assigned OIDs to someplace else by modifying OID  
fields of the catalog *.dat files and OID-assigning macros in the  
catalog *.h files.  
  
Up to now, we've encouraged new patches that need manually-assigned  
OIDs to use OIDs just above the range of existing OIDs.  Predictably,  
this leads to patches stepping on each others' toes, as whichever  
one gets committed first creates an OID conflict that other patch  
author(s) have to resolve manually.  With the availability of  
renumber_oids.pl, we can eliminate a lot of this hassle.  
The new project policy, therefore, is:  
  
* Encourage new patches to use high OIDs (the documentation suggests  
choosing a block of OIDs at random in 8000..9999).  
  
* After feature freeze in each development cycle, run renumber_oids.pl  
to move all such OIDs down to lower numbers, thus freeing the high OID  
range for the next development cycle.  
  
This plan should greatly reduce the risk of OID collisions between  
concurrently-developed patches.  Also, if such a collision happens  
anyway, we have the option to resolve it without much effort by doing  
an off-schedule OID renumbering to get the first-committed patch out  
of the way.  Or a patch author could use renumber_oids.pl to change  
their patch's assignments without much pain.  
  
This approach does put a premium on not hard-wiring any OID values  
in places where renumber_oids.pl and genbki.pl can't fix them.  
Project practice in that respect seems to be pretty good already,  
but a follow-on patch will sand down some rough edges.  
  
John Naylor and Tom Lane, per an idea of Peter Geoghegan's  
  
Discussion: https://postgr.es/m/CAH2-WzmMTGMcPuph4OvsO7Ykut0AOCF_i-=eaochT0dd2BN9CQ@mail.gmail.com  

M doc/src/sgml/bki.sgml
M src/backend/catalog/Catalog.pm
M src/include/catalog/indexing.h
A src/include/catalog/renumber_oids.pl
M src/include/catalog/toasting.h
M src/tools/RELEASE_CHANGES

Fix testing of parallel-safety of scan/join target.

commit   : b5afdde6a7bb777d399b20da6fb8a664a1cd2784    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 12 Mar 2019 16:21:57 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 12 Mar 2019 16:21:57 +0900    

Click here for diff

In commit 960df2a971 ("Correctly assess parallel-safety of tlists when  
SRFs are used."), the testing of scan/join target was done incorrectly,  
which caused a plan-quality problem.  Backpatch through to v11 where  
the aforementioned commit went in, since this is a regression from v10.  
  
Author: Etsuro Fujita  
Reviewed-by: Robert Haas and Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Add more tests for FSM.

commit   : 6f918159a97acf76ee2512e44f5ed5dcaaa0d923    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 12 Mar 2019 08:14:28 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 12 Mar 2019 08:14:28 +0530    

Click here for diff

In commit b0eaa4c51bb, we left out a test that used a vacuum to remove dead  
rows as the behavior of test was not predictable.  This test has been  
rewritten to use fillfactor instead to control free space.  Since we no  
longer need to remove dead rows as part of the test, put the fsm regression  
test in a parallel group.  
  
Author: John Naylor  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1L=qWp_bJ5aTc9+fy4Ewx2LPaLWY-RbR4a60g_rupCKnQ@mail.gmail.com  

M src/test/regress/expected/fsm.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/fsm.sql

Add routine able to update the control file to src/common/

commit   : ce6afc6823fbe2d83a5a77061b05864612b6bab2    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Mar 2019 10:03:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Mar 2019 10:03:33 +0900    

Click here for diff

This adds a new routine to src/common/ which is compatible with both the  
frontend and backend code, able to update the control file's contents.  
This is now getting used only by pg_rewind, but some upcoming patches  
which add more control on checksums for offline instances will make use  
of it.  This could also get used more by the backend as xlog.c has its  
own flavor of the same logic with some wait events and an additional  
flush phase before closing the opened file descriptor, but this is let  
as separate work.  
  
Author: Michael Banck, Michael Paquier  
Reviewed-by: Fabien Coelho, Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/pg_rewind.c
M src/common/controldata_utils.c
M src/include/common/controldata_utils.h

Allow fractional input values for integer GUCs, and improve rounding logic.

commit   : 1a83a80a2fe5b559f85ed4830acb92d5124b7a9a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Mar 2019 19:13:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Mar 2019 19:13:46 -0400    

Click here for diff

Historically guc.c has just refused examples like set work_mem = '30.1GB',  
but it seems more useful for it to take that and round off the value to  
some reasonable approximation of what the user said.  Just rounding to  
the parameter's native unit would work, but it would lead to rather  
silly-looking settings, such as 31562138kB for this example.  Instead  
let's round to the nearest multiple of the next smaller unit (if any),  
producing 30822MB.  
  
Also, do the units conversion math in floating point and round to integer  
(if needed) only at the end.  This produces saner results for inputs that  
aren't exact multiples of the parameter's native unit, and removes another  
difference in the behavior for integer vs. float parameters.  
  
In passing, document the ability to use hex or octal input where it  
ought to be documented.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/test/regress/expected/reloptions.out
M src/test/regress/sql/reloptions.sql

Tweak wording on VARIADIC array doc patch.

commit   : fe0b2c12c992fa44ca0448bde9099957306c843f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 11 Mar 2019 18:23:01 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 11 Mar 2019 18:23:01 -0400    

Click here for diff

Per suggestion from Tom Lane.  

M doc/src/sgml/func.sgml

Document incompatibility of comparison expressions with VARIADIC array arguments

commit   : 5e74a427854fa17babfbb0e22c4ca95e4f48f2fe    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 11 Mar 2019 18:14:05 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 11 Mar 2019 18:14:05 -0400    

Click here for diff

COALESCE, GREATEST and LEAST all look like functions taking variable  
numbers of arguments, but in fact they are not functions, and so  
VARIADIC array arguments don't work with them. Add a note to the docs  
explaining this fact.  
  
The consensus is not to try to make this work, but just to document the  
limitation.  
  
Discussion: https://postgr.es/m/CAFj8pRCaAtuXuRtvXf5GmPbAVriUQrNMo7-=TXUFN025S31R_w@mail.gmail.com  

M doc/src/sgml/func.sgml

Remove spurious return.

commit   : 32b8f0b0332ef96c67f06ded4d458a3ce12fe2ef    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 11 Mar 2019 15:03:27 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 11 Mar 2019 15:03:27 -0700    

Click here for diff

Per buildfarm member anole.  
  
Author: Andres Freund  

M src/include/access/tableam.h

Give up on testing guc.c's behavior for "infinity" inputs.

commit   : d9c5e9629bf511a51328fd083ee452de88d91d9d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Mar 2019 17:53:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Mar 2019 17:53:09 -0400    

Click here for diff

Further buildfarm testing shows that on the machines that are failing  
ac75959cd's test case, what we're actually getting from strtod("-infinity")  
is a syntax error (endptr == value) not ERANGE at all.  This test case  
is not worth carrying two sets of expected output for, so just remove it,  
and revert commit b212245f9's misguided attempt to work around the platform  
dependency.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Ensure sufficient alignment for ParallelTableScanDescData in BTShared.

commit   : 8cacea7a725103f1a037a5ee06112ebe31051c66    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 11 Mar 2019 14:26:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 11 Mar 2019 14:26:43 -0700    

Click here for diff

Previously ParallelTableScanDescData was just a member in BTShared,  
but after c2fe139c2 that doesn't guarantee sufficient alignment as  
specific AMs might (are likely to) need atomic variables in the  
struct.  
  
One might think that MAXALIGNing would be sufficient, but as a  
comment in shm_toc_allocate() explains, that's not enough. For now,  
copy the hack described there.  
  
For parallel sequential scans no such change is needed, as its  
allocations go through shm_toc_allocate().  
  
An alternative approach would have been to allocate the parallel scan  
descriptor in a separate TOC entry, but there seems little benefit in  
doing so.  
  
Per buildfarm member dromedary.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

tableam: Add and use scan APIs.

commit   : c2fe139c201c48f1133e9fbea2dd99b8efe2fadd    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 11 Mar 2019 12:46:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 11 Mar 2019 12:46:41 -0700    

Click here for diff

Too allow table accesses to be not directly dependent on heap, several  
new abstractions are needed. Specifically:  
  
1) Heap scans need to be generalized into table scans. Do this by  
   introducing TableScanDesc, which will be the "base class" for  
   individual AMs. This contains the AM independent fields from  
   HeapScanDesc.  
  
   The previous heap_{beginscan,rescan,endscan} et al. have been  
   replaced with a table_ version.  
  
   There's no direct replacement for heap_getnext(), as that returned  
   a HeapTuple, which is undesirable for a other AMs. Instead there's  
   table_scan_getnextslot().  But note that heap_getnext() lives on,  
   it's still used widely to access catalog tables.  
  
   This is achieved by new scan_begin, scan_end, scan_rescan,  
   scan_getnextslot callbacks.  
  
2) The portion of parallel scans that's shared between backends need  
   to be able to do so without the user doing per-AM work. To achieve  
   that new parallelscan_{estimate, initialize, reinitialize}  
   callbacks are introduced, which operate on a new  
   ParallelTableScanDesc, which again can be subclassed by AMs.  
  
   As it is likely that several AMs are going to be block oriented,  
   block oriented callbacks that can be shared between such AMs are  
   provided and used by heap. table_block_parallelscan_{estimate,  
   intiialize, reinitialize} as callbacks, and  
   table_block_parallelscan_{nextpage, init} for use in AMs. These  
   operate on a ParallelBlockTableScanDesc.  
  
3) Index scans need to be able to access tables to return a tuple, and  
   there needs to be state across individual accesses to the heap to  
   store state like buffers. That's now handled by introducing a  
   sort-of-scan IndexFetchTable, which again is intended to be  
   subclassed by individual AMs (for heap IndexFetchHeap).  
  
   The relevant callbacks for an AM are index_fetch_{end, begin,  
   reset} to create the necessary state, and index_fetch_tuple to  
   retrieve an indexed tuple.  Note that index_fetch_tuple  
   implementations need to be smarter than just blindly fetching the  
   tuples for AMs that have optimizations similar to heap's HOT - the  
   currently alive tuple in the update chain needs to be fetched if  
   appropriate.  
  
   Similar to table_scan_getnextslot(), it's undesirable to continue  
   to return HeapTuples. Thus index_fetch_heap (might want to rename  
   that later) now accepts a slot as an argument. Core code doesn't  
   have a lot of call sites performing index scans without going  
   through the systable_* API (in contrast to loads of heap_getnext  
   calls and working directly with HeapTuples).  
  
   Index scans now store the result of a search in  
   IndexScanDesc->xs_heaptid, rather than xs_ctup->t_self. As the  
   target is not generally a HeapTuple anymore that seems cleaner.  
  
To be able to sensible adapt code to use the above, two further  
callbacks have been introduced:  
  
a) slot_callbacks returns a TupleTableSlotOps* suitable for creating  
   slots capable of holding a tuple of the AMs  
   type. table_slot_callbacks() and table_slot_create() are based  
   upon that, but have additional logic to deal with views, foreign  
   tables, etc.  
  
   While this change could have been done separately, nearly all the  
   call sites that needed to be adapted for the rest of this commit  
   also would have been needed to be adapted for  
   table_slot_callbacks(), making separation not worthwhile.  
  
b) tuple_satisfies_snapshot checks whether the tuple in a slot is  
   currently visible according to a snapshot. That's required as a few  
   places now don't have a buffer + HeapTuple around, but a  
   slot (which in heap's case internally has that information).  
  
Additionally a few infrastructure changes were needed:  
  
I) SysScanDesc, as used by systable_{beginscan, getnext} et al. now  
   internally uses a slot to keep track of tuples. While  
   systable_getnext() still returns HeapTuples, and will so for the  
   foreseeable future, the index API (see 1) above) now only deals with  
   slots.  
  
The remainder, and largest part, of this commit is then adjusting all  
scans in postgres to use the new APIs.  
  
Author: Andres Freund, Haribabu Kommi, Alvaro Herrera  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstattuple.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M src/backend/access/gist/gistget.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/access/tablesample/system.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/cluster.c
M src/backend/commands/constraint.c
M src/backend/commands/copy.c
M src/backend/commands/dbcommands.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/typecmds.c
M src/backend/commands/vacuum.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/partitioning/partbounds.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/init/postinit.c
M src/include/access/genam.h
M src/include/access/heapam.h
M src/include/access/relscan.h
M src/include/access/tableam.h
M src/include/catalog/index.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

pgbench: increase the maximum number of variables/arguments

commit   : a47841528107921f02c280e0c5f91c5a1d86adb0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 11 Mar 2019 11:47:35 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 11 Mar 2019 11:47:35 -0400    

Click here for diff

pgbench's arbitrary limit of 10 arguments for SQL statements or  
metacommands is far too low. Increase it to 256.  
  
This results in a very modest increase in memory usage, not enough to  
worry about.  
  
The maximum includes the SQL statement or metacommand. This is reflected  
in the comments and revised TAP tests.  
  
Simon Riggs and Dagfinn Ilmari Mannsåker with some light editing by me.  
Reviewed by: David Rowley and Fabien Coelho  
  
Discussion: https://postgr.es/m/CANP8+jJiMJOAf-dLoHuR-8GENiK+eHTY=Omw38Qx7j2g0NDTXA@mail.gmail.com  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix typos in commit 8586bf7ed8.

commit   : a6e48da08844eeb5a72c8b59dad3aaab6e891fac    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 11 Mar 2019 08:16:14 +0530    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 11 Mar 2019 08:16:14 +0530    

Click here for diff

Author: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1KNv1Mg2krf4E9ssWFnE=8A9mZ1VbVywXBZTFSzb+wP2g@mail.gmail.com  

M src/backend/access/table/tableamapi.c
M src/backend/utils/cache/relcache.c
M src/include/access/tableam.h

Move hash_any prototype from access/hash.h to utils/hashutils.h

commit   : af38498d4c9b840e0e454574519459edda3871db    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 Mar 2019 13:17:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 Mar 2019 13:17:50 -0300    

Click here for diff

... as well as its implementation from backend/access/hash/hashfunc.c to  
backend/utils/hash/hashfn.c.  
  
access/hash is the place for the hash index AM, not really appropriate  
for generic facilities, which is what hash_any is; having things the old  
way meant that anything using hash_any had to include the AM's include  
file, pointlessly polluting its namespace with unrelated, unnecessary  
cruft.  
  
Also move the HTEqual strategy number to access/stratnum.h from  
access/hash.h.  
  
To avoid breaking third-party extension code, add an #include  
"utils/hashutils.h" to access/hash.h.  (An easily removed line by  
committers who enjoy their asbestos suits to protect them from angry  
extension authors.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/citext/citext.c
M contrib/hstore/hstore_op.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/sepgsql/uavc.c
M src/backend/access/common/tupdesc.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/executor/execGrouping.c
M src/backend/executor/nodeSamplescan.c
M src/backend/lib/bloomfilter.c
M src/backend/nodes/bitmapset.c
M src/backend/storage/file/sharedfileset.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/hash.h
M src/include/access/stratnum.h
M src/include/utils/hashutils.h

In guc.c, ignore ERANGE errors from strtod().

commit   : b212245f96437b574b59993c772e4d9276965e49    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Mar 2019 11:25:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Mar 2019 11:25:23 -0400    

Click here for diff

Instead, just proceed with the infinity or zero result that it should  
return for overflow/underflow.  This avoids a platform dependency,  
in that various versions of strtod are inconsistent about whether they  
signal ERANGE for a value that's specified as infinity.  
  
It's possible this won't be enough to remove the buildfarm failures  
we're seeing from ac75959cd, in which case I'll take out the infinity  
test case that commit added.  But first let's see if we can fix it.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix potential memory access violation in ecpg if filename of include file is shorter than 2 characters.

commit   : 08cecfaf60c484f219ba7e6ee23e9699aea4e9af    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 11 Mar 2019 16:11:16 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 11 Mar 2019 16:11:16 +0100    

Click here for diff

Patch by: "Wu, Fei" <[email protected]>  

M src/interfaces/ecpg/preproc/pgc.l

Fix ecpglib regression that made it impossible to close a cursor that was opened in a prepared statement.

commit   : 98bdaab0d918169a36d64a06667a809c673ec065    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 11 Mar 2019 16:00:13 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 11 Mar 2019 16:00:13 +0100    

Click here for diff

Patch by: "Kuroda, Hayato" <[email protected]>  

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

Remove unused macro

commit   : 3c067154471100ae691d1a7b2659ee439ab7b96d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Mar 2019 09:29:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Mar 2019 09:29:50 +0100    

Click here for diff

Use was removed in 25ca5a9a54923a5d6746f771c4c23e85a195bde5.  

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

psql: Add documentation URL to \help output

commit   : 27f3dea64833d68c1fa08c1e5d26176a579f69c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Mar 2019 08:50:02 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Mar 2019 08:50:02 +0100    

Click here for diff

Add a link to the specific command's reference web page to the bottom  
of its \help output.  
  
Discussion: https://www.postgresql.org/message-id/flat/40179bd0-fa7d-4108-1991-a20ae9ad5667%402ndquadrant.com  

M src/bin/psql/create_help.pl
M src/bin/psql/help.c

Adjust error message for partial writes in WAL segments

commit   : f2d84a4a6b4ec891a0a52f583ed5aa081c71acc6    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Mar 2019 09:31:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Mar 2019 09:31:25 +0900    

Click here for diff

93473c6 has removed openLogOff, changing on the way the error message  
which is used to report partial writes to WAL segments.  The  
newly-introduced error message used the offset up to which the write has  
happened, keeping always the same total length to write.  This changes  
the error message so as the number of bytes left to write are reported.  
  
Reported-by: Michael Paquier  
Author: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

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

Fix documentation on partitioning vs. foreign tables

commit   : fc84c05acd151cb1141c47d4af0c5ca803a4c3b4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 10 Mar 2019 19:45:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 10 Mar 2019 19:45:29 -0300    

Click here for diff

1. The PARTITION OF clause of CREATE FOREIGN TABLE was not explained in  
   the CREATE FOREIGN TABLE reference page.  Add it.  
   (Postgres 10 onwards)  
  
2. The limitation that tuple routing cannot target partitions that are  
   foreign tables was not documented clearly enough.  Improve wording.  
   (Postgres 10 onwards)  
  
3. The UPDATE tuple re-routing concurrency behavior was explained in  
   the DDL chapter, which doesn't seem the right place.  Move it to the  
   UPDATE reference page instead.  (Postgres 11 onwards).  
  
Authors: Amit Langote, David Rowley.  
Reviewed-by: Etsuro Fujita.  
Reported-by: Derek Hans  
Discussion: https://postgr.es/m/CAGrP7a3Xc1Qy_B2WJcgAD8uQTS_NDcJn06O5mtS_Ne1nYhBsyw@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/update.sgml

Reduce the default value of autovacuum_vacuum_cost_delay to 2ms.

commit   : cbccac371c79d96c44fcd8c9cbb5ff4dedaaa522    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 15:16:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 15:16:21 -0400    

Click here for diff

This is a better way to implement the desired change of increasing  
autovacuum's default resource consumption.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Revert "Increase the default vacuum_cost_limit from 200 to 2000"

commit   : 52985e4fea75f1ec742742f27e246a8775c99e08    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 15:05:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 15:05:25 -0400    

Click here for diff

This reverts commit bd09503e633b8077822bb4daf91625b71ac16253.  
  
Per discussion, it seems like what we should do instead is to  
reduce the default value of autovacuum_vacuum_cost_delay by the  
same factor.  That's functionally equivalent as long as the  
platform can accurately service the smaller delay request, which  
should be true on anything released in the last 10 years or more.  
And smaller, more-closely-spaced delays are better in terms of  
providing a steady I/O load.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Convert [autovacuum_]vacuum_cost_delay into floating-point GUCs.

commit   : caf626b2cd471615914986f18282c03c8282a1f4    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 15:01:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 15:01:39 -0400    

Click here for diff

This change makes it possible to specify sub-millisecond delays,  
which work well on most modern platforms, though that was not true  
when the cost-delay feature was designed.  
  
To support this without breaking existing configuration entries,  
improve guc.c to allow floating-point GUCs to have units.  Also,  
allow "us" (microseconds) as an input/output unit for time-unit GUCs.  
(It's not allowed as a base unit, at least not yet.)  
  
Likewise change the autovacuum_vacuum_cost_delay reloption to be  
floating-point; this forces a catversion bump because the layout of  
StdRdOptions changes.  
  
This patch doesn't in itself change the default values or allowed  
ranges for these parameters, and it should not affect the behavior  
for any already-allowed setting for them.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/catalog/catversion.h
M src/include/miscadmin.h
M src/include/postmaster/autovacuum.h
M src/include/utils/guc.h
M src/include/utils/rel.h
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Include GUC's unit, if it has one, in out-of-range error messages.

commit   : 28a65fc3607a0f45c39a9418f747459bb4f1592a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 13:18:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 13:18:17 -0400    

Click here for diff

This should reduce confusion in cases where we've applied a units  
conversion, so that the number being reported (and the quoted range  
limits) are in some other units than what the user gave in the  
setting we're rejecting.  
  
Some of the changes here assume that float GUCs can have units,  
which isn't true just yet, but will be shortly.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/test/regress/expected/guc.out

Disallow NaN as a value for floating-point GUCs.

commit   : ac75959cdc073a09a0d3d649fb922d90e1df4c61    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 12:58:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Mar 2019 12:58:51 -0400    

Click here for diff

None of the code that uses GUC values is really prepared for them to  
hold NaN, but parse_real() didn't have any defense against accepting  
such a value.  Treat it the same as a syntax error.  
  
I haven't attempted to analyze the exact consequences of setting any  
of the float GUCs to NaN, but since they're quite unlikely to be good,  
this seems like a back-patchable bug fix.  
  
Note: we don't need an explicit test for +-Infinity because those will  
be rejected by existing range checks.  I added a regression test for  
that in HEAD, but not older branches because the spelling of the value  
in the error message will be platform-dependent in branches where we  
don't always use port/snprintf.c.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

pg_upgrade: Ignore TOAST for partitioned tables

commit   : 203749a8a66096171f808dd8e870d08d8ad57e5e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 10 Mar 2019 13:20:58 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 10 Mar 2019 13:20:58 -0300    

Click here for diff

Since partitioned tables in pg12 do not have toast tables, trying to set  
the toast OID confuses pg_upgrade.  Have pg_dump omit those values to  
avoid the problem.  
  
Per Andres Freund and buildfarm members crake and snapper  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Support for INCLUDE attributes in GiST indexes

commit   : f2e403803fe6deb8cff59ea09dff42c6163b2110    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 10 Mar 2019 11:36:47 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 10 Mar 2019 11:36:47 +0300    

Click here for diff

Similarly to B-tree, GiST index access method gets support of INCLUDE  
attributes.  These attributes aren't used for tree navigation and aren't  
present in non-leaf pages.  But they are present in leaf pages and can be  
fetched during index-only scan.  
  
The point of having INCLUDE attributes in GiST indexes is slightly different  
from the point of having them in B-tree.  The main point of INCLUDE attributes  
in B-tree is to define UNIQUE constraint over part of attributes enabled for  
index-only scan.  In GiST the main point of INCLUDE attributes is to use  
index-only scan for attributes, whose data types don't have GiST opclasses.  
  
Discussion: https://postgr.es/m/73A1A452-AD5F-40D4-BD61-978622FF75C1%40yandex-team.ru  
Author: Andrey Borodin, with small changes by me  
Reviewed-by: Andreas Karlsson  

M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/textsearch.sgml
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/include/access/gist_private.h
M src/test/regress/expected/amutils.out
M src/test/regress/expected/index_including.out
A src/test/regress/expected/index_including_gist.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/index_including.sql
A src/test/regress/sql/index_including_gist.sql

commit   : a0b762626884b3b949c2703abb1c4b42fbbdfdc6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Mar 2019 18:42:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Mar 2019 18:42:19 -0500    

Click here for diff

Now that https://www.postgresql.org/docs/release/ is populated,  
replace the stopgap text we had under "Prior Releases" with  
a pointer to that archive.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release.sgml
M src/tools/RELEASE_CHANGES

Add new clientcert hba option verify-full

commit   : 0516c61b756e39ed6eb7a6bb54311a841002211a    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 9 Mar 2019 12:09:10 -0800    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 9 Mar 2019 12:09:10 -0800    

Click here for diff

This allows a login to require both that the cn of the certificate  
matches (like authentication type cert) *and* that another  
authentication method (such as password or kerberos) succeeds as well.  
  
The old value of clientcert=1 maps to the new clientcert=verify-ca,  
clientcert=0 maps to the new clientcert=no-verify, and the new option  
erify-full will add the validation of the CN.  
  
Author: Julian Markwort, Marius Timmer  
Reviewed by: Magnus Hagander, Thomas Munro  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/runtime.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/SSLServer.pm

Track block level checksum failures in pg_stat_database

commit   : 6b9e875f7286d8535bff7955e5aa3602e188e436    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 9 Mar 2019 10:45:17 -0800    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 9 Mar 2019 10:45:17 -0800    

Click here for diff

This adds a column that counts how many checksum failures have occurred  
on files belonging to a specific database. Both checksum failures  
during normal backend processing and those created when a base backup  
detects a checksum failure are counted.  
  
Author: Magnus Hagander  
Reviewed by: Julien Rouhaud  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/storage/page/bufpage.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

Avoid some table rewrites for ALTER TABLE .. SET DATA TYPE timestamp.

commit   : 3c5926301aea476025f118159688a6a88b2738bc    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 8 Mar 2019 20:16:27 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 8 Mar 2019 20:16:27 -0800    

Click here for diff

When the timezone is UTC, timestamptz and timestamp are binary coercible  
in both directions.  See b8a18ad4850ea5ad7884aa6ab731fd392e73b4ad and  
c22ecc6562aac895f0f0529707d7bdb460fd2a49 for the previous attempt in  
this problem space.  Skip the table rewrite; for now, continue to  
needlessly rewrite any index on an affected column.  
  
Reviewed by Simon Riggs and Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/timestamp.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Tighten use of OpenTransientFile and CloseTransientFile

commit   : 82a5649fb9dbef12d04cd24799be6bf298d889a6    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 9 Mar 2019 08:50:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 9 Mar 2019 08:50:55 +0900    

Click here for diff

This fixes two sets of issues related to the use of transient files in  
the backend:  
1) OpenTransientFile() has been used in some code paths with read-write  
flags while read-only is sufficient, so switch those calls to be  
read-only where necessary.  These have been reported by Joe Conway.  
2) When opening transient files, it is up to the caller to close the  
file descriptors opened.  In error code paths, CloseTransientFile() gets  
called to clean up things before issuing an error.  However in normal  
exit paths, a lot of callers of CloseTransientFile() never actually  
reported errors, which could leave a file descriptor open without  
knowing about it.  This is an issue I complained about a couple of  
times, but never had the courage to write and submit a patch, so here we  
go.  
  
Note that one frontend code path is impacted by this commit so as an  
error is issued when fetching control file data, making backend and  
frontend to be treated consistently.  
  
Reported-by: Joe Conway, Michael Paquier  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Georgios Kokolatos, Joe Conway  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/libpq/be-fsstubs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/utils/cache/relmapper.c
M src/common/controldata_utils.c

Fix crash with old libxml2

commit   : 2e616dee9e601d36462dc4cc48eb0b6a1ff20051    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 8 Mar 2019 19:13:25 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 8 Mar 2019 19:13:25 -0300    

Click here for diff

Certain libxml2 versions (such as the 2.7.6 commonly seen in older  
distributions, but apparently only on x86_64) contain a bug that causes  
xmlCopyNode, when called on a XML_DOCUMENT_NODE, to return a node that  
xmlFreeNode crashes on.  Arrange to call xmlFreeDoc instead of  
xmlFreeNode for those nodes.  
  
Per buildfarm members lapwing and grison.  
  
Author: Pavel Stehule, light editing by Álvaro.  
Discussion: https://postgr.es/m/[email protected]  

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

Reformat catalog .dat files.

commit   : 1b76168da7787505fbe506ef3ab74e9a14b4b7fb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Mar 2019 12:01:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Mar 2019 12:01:27 -0500    

Click here for diff

Test run for my previous commit; cleans up formatting issues in some  
other recent commits.  

M src/include/catalog/pg_class.dat
M src/include/catalog/pg_proc.dat

Minor improvements for reformat_dat_file.pl.

commit   : 27aaf6eff49a6348408476652911fe4acceffc71    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Mar 2019 11:48:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Mar 2019 11:48:49 -0500    

Click here for diff

Use Getopt::Long in preference to hand-rolled option parsing code.  
  
Also, remove "-I .../backend/catalog" switch from the Makefile  
invocations.  That's been unnecessary for some time, and leaving it  
there gives the false impression it's needed in manual invocations.  
  
John Naylor (extracted from a larger but more controversial patch)  
  
Discussion: https://postgr.es/m/CACPNZCsHdcQN2jQ1=ptbi1Co2Nj3aHgRCUMk62=ThgWNabPY+Q@mail.gmail.com  

M src/include/catalog/Makefile
M src/include/catalog/reformat_dat_file.pl

Fix function signatures of pageinspect in documentation

commit   : e1e0e8d58c5c70da92e36cb9d59c2f7ecf839e00    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Mar 2019 15:10:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Mar 2019 15:10:14 +0900    

Click here for diff

tuple_data_split() lacked the type of the first argument, and  
heap_page_item_attrs() has reversed the first and second argument,  
with the bytea argument using an incorrect name.  
  
Author: Laurenz Albe  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/pageinspect.sgml

Fix compatibility of pg_basebackup -R with 11 and older versions

commit   : beeb8e2e0717065296dc7b32daba2d66f0f931dd    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Mar 2019 10:14:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Mar 2019 10:14:03 +0900    

Click here for diff

When 2dedf4d9 has integrated recovery.conf into postgresql.conf, it also  
changed pg_basebackup -R in the way recovery configuration is  
generated.  However this implementation forgot the fact that  
pg_basebackup needs to keep compatibility with older server versions as  
well.  
  
Reported-by: Devrim Gündüz  
Author: Sergei Kornilov, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c

Fix minor deficiencies in XMLTABLE, xpath(), xmlexists()

commit   : 251cf2e27bec98274e8bb002608680bdc211319e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 15:21:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 15:21:56 -0300    

Click here for diff

Correctly process nodes of more types than previously.  In some cases,  
nodes were being ignored (nothing was output); in other cases, trying to  
return them resulted in errors about unrecognized nodes.  In yet other  
cases, necessary escaping (of XML special characters) was not being  
done.  Fix all those (as far as the authors could find) and add  
regression tests cases verifying the new behavior.  
  
I (Álvaro) was of two minds about backpatching these changes.  They do  
seem bugfixes that would benefit most users of the affected functions;  
but on the other hand it would change established behavior in minor  
releases, so it seems prudent not to.  
  
Authors: Pavel Stehule, Markus Winand, Chapman Flack  
Discussion:  
   https://postgr.es/m/CAFj8pRA6J25CtAZ2TuRvxK3gat7-bBUYh0rfE2yM7Hj9GD14Dg@mail.gmail.com  
   https://postgr.es/m/[email protected]  
  
The elephant in the room as pointed out by Chapman Flack, not fixed in  
this commit, is that we still have XMLTABLE operating on XPath 1.0  
instead of the standard-mandated XQuery (or even its subset XPath 2.0).  
Fixing that is a major undertaking, however.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/xml.c
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Fix handling of targetlist SRFs when scan/join relation is known empty.

commit   : 1d338584062b3e53b738f987ecb0d2b67745232a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Mar 2019 14:21:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Mar 2019 14:21:52 -0500    

Click here for diff

When we introduced separate ProjectSetPath nodes for application of  
set-returning functions in v10, we inadvertently broke some cases where  
we're supposed to recognize that the result of a subquery is known to be  
empty (contain zero rows).  That's because IS_DUMMY_REL was just looking  
for a childless AppendPath without allowing for a ProjectSetPath being  
possibly stuck on top.  In itself, this didn't do anything much worse  
than produce slightly worse plans for some corner cases.  
  
Then in v11, commit 11cf92f6e rearranged things to allow the scan/join  
targetlist to be applied directly to partial paths before they get  
gathered.  But it inserted a short-circuit path for dummy relations  
that was a little too short: it failed to insert a ProjectSetPath node  
at all for a targetlist containing set-returning functions, resulting in  
bogus "set-valued function called in context that cannot accept a set"  
errors, as reported in bug #15669 from Madelaine Thibaut.  
  
The best way to fix this mess seems to be to reimplement IS_DUMMY_REL  
so that it drills down through any ProjectSetPath nodes that might be  
there (and it seems like we'd better allow for ProjectionPath as well).  
  
While we're at it, make it look at rel->pathlist not cheapest_total_path,  
so that it gives the right answer independently of whether set_cheapest  
has been done lately.  That dependency looks pretty shaky in the context  
of code like apply_scanjoin_target_to_paths, and even if it's not broken  
today it'd certainly bite us at some point.  (Nastily, unsafe use of the  
old coding would almost always work; the hazard comes down to possibly  
looking through a dangling pointer, and only once in a blue moon would  
you find something there that resulted in the wrong answer.)  
  
It now looks like it was a mistake for IS_DUMMY_REL to be a macro: if  
there are any extensions using it, they'll continue to use the old  
inadequate logic until they're recompiled, after which they'll fail  
to load into server versions predating this fix.  Hopefully there are  
few such extensions.  
  
Having fixed IS_DUMMY_REL, the special path for dummy rels in  
apply_scanjoin_target_to_paths is unnecessary as well as being wrong,  
so we can just drop it.  
  
Also change a few places that were testing for partitioned-ness of a  
planner relation but not using IS_PARTITIONED_REL for the purpose; that  
seems unsafe as well as inconsistent, plus it required an ugly hack in  
apply_scanjoin_target_to_paths.  
  
In passing, save a few cycles in apply_scanjoin_target_to_paths by  
skipping processing of pre-existing paths for partitioned rels,  
and do some cosmetic cleanup and comment adjustment in that function.  
  
I renamed IS_DUMMY_PATH to IS_DUMMY_APPEND with the intention of breaking  
any code that might be using it, since in almost every case that would  
be wrong; IS_DUMMY_REL is what to be using instead.  
  
In HEAD, also make set_dummy_rel_pathlist static (since it's no longer  
used from outside allpaths.c), and delete is_dummy_plan, since it's no  
longer used anywhere.  
  
Back-patch as appropriate into v11 and v10.  
  
Tom Lane and Julien Rouhaud  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/paths.h
M src/include/optimizer/planner.h
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/tsrf.sql

Allow ATTACH PARTITION with only ShareUpdateExclusiveLock.

commit   : 898e5e3290a72d288923260143930fb32036c00c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 7 Mar 2019 11:13:12 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 7 Mar 2019 11:13:12 -0500    

Click here for diff

We still require AccessExclusiveLock on the partition itself, because  
otherwise an insert that violates the newly-imposed partition  
constraint could be in progress at the same time that we're changing  
that constraint; only the lock level on the parent relation is  
weakened.  
  
To make this safe, we have to cope with (at least) three separate  
problems. First, relevant DDL might commit while we're in the process  
of building a PartitionDesc.  If so, find_inheritance_children() might  
see a new partition while the RELOID system cache still has the old  
partition bound cached, and even before invalidation messages have  
been queued.  To fix that, if we see that the pg_class tuple seems to  
be missing or to have a null relpartbound, refetch the value directly  
from the table. We can't get the wrong value, because DETACH PARTITION  
still requires AccessExclusiveLock throughout; if we ever want to  
change that, this will need more thought. In testing, I found it quite  
difficult to hit even the null-relpartbound case; the race condition  
is extremely tight, but the theoretical risk is there.  
  
Second, successive calls to RelationGetPartitionDesc might not return  
the same answer.  The query planner will get confused if lookup up the  
PartitionDesc for a particular relation does not return a consistent  
answer for the entire duration of query planning.  Likewise, query  
execution will get confused if the same relation seems to have a  
different PartitionDesc at different times.  Invent a new  
PartitionDirectory concept and use it to ensure consistency.  This  
ensures that a single invocation of either the planner or the executor  
sees the same view of the PartitionDesc from beginning to end, but it  
does not guarantee that the planner and the executor see the same  
view.  Since this allows pointers to old PartitionDesc entries to  
survive even after a relcache rebuild, also postpone removing the old  
PartitionDesc entry until we're certain no one is using it.  
  
For the most part, it seems to be OK for the planner and executor to  
have different views of the PartitionDesc, because the executor will  
just ignore any concurrently added partitions which were unknown at  
plan time; those partitions won't be part of the inheritance  
expansion, but invalidation messages will trigger replanning at some  
point.  Normally, this happens by the time the very next command is  
executed, but if the next command acquires no locks and executes a  
prepared query, it can manage not to notice until a new transaction is  
started.  We might want to tighten that up, but it's material for a  
separate patch.  There would still be a small window where a query  
that started just after an ATTACH PARTITION command committed might  
fail to notice its results -- but only if the command starts before  
the commit has been acknowledged to the user. All in all, the warts  
here around serializability seem small enough to be worth accepting  
for the considerable advantage of being able to add partitions without  
a full table lock.  
  
Although in general the consequences of new partitions showing up  
between planning and execution are limited to the query not noticing  
the new partitions, run-time partition pruning will get confused in  
that case, so that's the third problem that this patch fixes.  
Run-time partition pruning assumes that indexes into the PartitionDesc  
are stable between planning and execution.  So, add code so that if  
new partitions are added between plan time and execution time, the  
indexes stored in the subplan_map[] and subpart_map[] arrays within  
the plan's PartitionedRelPruneInfo get adjusted accordingly.  There  
does not seem to be a simple way to generalize this scheme to cope  
with partitions that are removed, mostly because they could then get  
added back again with different bounds, but it works OK for added  
partitions.  
  
This code does not try to ensure that every backend participating in  
a parallel query sees the same view of the PartitionDesc.  That  
currently doesn't matter, because we never pass PartitionDesc  
indexes between backends.  Each backend will ignore the concurrently  
added partitions which it notices, and it doesn't matter if different  
backends are ignoring different sets of concurrently added partitions.  
If in the future that matters, for example because we allow writes in  
parallel query and want all participants to do tuple routing to the same  
set of partitions, the PartitionDirectory concept could be improved to  
share PartitionDescs across backends.  There is a draft patch to  
serialize and restore PartitionDescs on the thread where this patch  
was discussed, which may be a useful place to start.  
  
Patch by me.  Thanks to Alvaro Herrera, David Rowley, Simon Riggs,  
Amit Langote, and Michael Paquier for discussion, and to Alvaro  
Herrera for some review.  
  
Discussion: http://postgr.es/m/CA+Tgmobt2upbSocvvDej3yzokd7AkiT+PvgFH+a9-5VV1oJNSQ@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoZE0r9-cyA-aY6f8WFEROaDLLL7Vf81kZ8MtFCkxpeQSw@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoY13KQZF-=HNTrt9UYWYx3_oYOQpu9ioNT49jGgiDpUEA@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/utils/cache/relcache.c
M src/include/executor/execPartition.h
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partdesc.h

Fix broken markup

commit   : ec51727f6eed38f302a10cdb0066f4484b0b5902    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 11:35:39 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 11:35:39 -0300    

Click here for diff

M doc/src/sgml/func.sgml

Fix the BY {REF,VALUE} clause of XMLEXISTS/XMLTABLE

commit   : eaaa5986ad03f7871fa95878460e1132cb7e8963    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 11:17:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 11:17:09 -0300    

Click here for diff

This clause is used to indicate the passing mode of a XML document, but  
we were doing it wrong: we accepted BY REF and ignored it, and rejected  
BY VALUE as a syntax error.  The reality, however, is that documents are  
always passed BY VALUE, so rejecting that clause was silly.  Change  
things so that we accept BY VALUE.  
  
BY REF continues to be accepted, and continues to be ignored.  
  
Author: Chapman Flack  
Reviewed-by: Pavel Stehule  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/parser/gram.y

Add missing <limits.h>

commit   : cb706ec4b60b3dede957ffdd70451b017eddffb0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 10:08:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 10:08:29 -0300    

Click here for diff

Per buildfarm  

M src/bin/pg_dump/pg_dump.c

pg_dump: allow multiple rows per insert

commit   : 7e413a0f82c8f8e9abb3981839191414de3aae08    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 09:26:14 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Mar 2019 09:26:14 -0300    

Click here for diff

This is useful to speed up loading data in a different database engine.  
  
Authors: Surafel Temesgen and David Rowley.  Lightly edited by Álvaro.  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/CALAY4q9kumSdnRBzvRJvSRf2+BH20YmSvzqOkvwpEmodD-xv6g@mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl

Remove useless header inclusion.

commit   : 42210524cca3a6d3161bcef9d9e687c7c1f5f6c4    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 7 Mar 2019 19:38:47 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 7 Mar 2019 19:38:47 +1300    

Click here for diff

M src/include/storage/smgr.h

Drop the vestigial "smgr" type.

commit   : 91595f9d49cf6fd6b6524f3269b2105b3ec18d96    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 7 Mar 2019 15:43:37 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 7 Mar 2019 15:43:37 +1300    

Click here for diff

Before commit 3fa2bb31 this type appeared in the catalogs to  
select which of several block storage mechanisms each relation  
used.  
  
New features under development propose to revive the concept of  
different block storage managers for new kinds of data accessed  
via bufmgr.c, but don't need to put references to them in the  
catalogs.  So, avoid useless maintenance work on this type by  
dropping it.  Update some regression tests that were referencing  
it where any type would do.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BDE0mmiBZMtZyvwWtgv1sZCniSVhXYsXkvJ_Wo%2B83vvw%40mail.gmail.com  

M src/backend/storage/smgr/Makefile
M src/backend/storage/smgr/README
D src/backend/storage/smgr/smgrtype.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/alter_table.sql

Don't reuse slots between root and partition in ON CONFLICT ... UPDATE.

commit   : 277cb789836b5ddf81aabb80c2058268c70e2f36    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 15:43:33 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 15:43:33 -0800    

Click here for diff

Until now the the slot to store the conflicting tuple, and the result  
of the ON CONFLICT SET, where reused between partitions. That  
necessitated changing slots descriptor when switching partitions.  
  
Besides the overhead of switching descriptors on a slot (which  
requires memory allocations and prevents JITing), that's importantly  
also problematic for tableam. There individual partitions might belong  
to different tableams, needing different kinds of slots.  
  
In passing also fix ExecOnConflictUpdate to clear the existing slot at  
exit. Otherwise that slot could continue to hold a pin till the query  
ends, which could be far too long if the input data set is large, and  
there's no further conflicts. While previously also problematic, it's  
now more important as there will be more such slots when partitioned.  
  
Author: Andres Freund  
Reviewed-By: Robert Haas, David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/nodes/execnodes.h

Fix equalfuncs for accessMethod addition in 8586bf7ed8.

commit   : d16a74c20ce3485d43902b0b1fb8ec1c11ec84a5    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 13:04:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 13:04:09 -0800    

Click here for diff

In a complete brown paper bag moment, I forgot to include equalfuncs  
in my previous fix of copy/out/readfuncs.  Thanks Tom for noticing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/equalfuncs.c

Don't log incomplete startup packet if it's empty

commit   : 342cb650e0ffc7a007a12a419be04d47da4bd8cc    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 6 Mar 2019 15:27:19 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 6 Mar 2019 15:27:19 -0500    

Click here for diff

This will stop logging cases where, for example, a monitor opens a  
connection and immediately closes it. If the packet contains any data an  
incomplete packet will still be logged.  
  
Author: Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

Fix copy/out/readfuncs for accessMethod addition in 8586bf7ed8.

commit   : b1723423216749be9b28f8430c3b7180dec3fa70    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 11:55:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 11:55:28 -0800    

Click here for diff

This includes a catversion bump, as IntoClause is theoretically  
speaking part of storable rules. In practice I don't think that can  
happen, but there's no reason to be stingy here.  
  
Per buildfarm member calliphoridae.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/catalog/catversion.h

Fix collation dependency in test introduced in 8586bf7ed8, take 2.

commit   : 863aa55624d891be57b54f8d12e61cb4fa9b70ef    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 11:06:01 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 11:06:01 -0800    

Click here for diff

Per buildfarm.  This time I hopefully actually made sure to get all  
the cases...  

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

Fix collation dependency in test introduced in 8586bf7ed8.

commit   : 836f634522d2f07efdec2f41d63b582aac95e546    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 11:06:01 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 11:06:01 -0800    

Click here for diff

Per buildfarm.  

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

tableam: Add pg_dump support.

commit   : 3b925e905de3204ffef64fa4d53dd7bbac1a143f    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 09:54:38 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 09:54:38 -0800    

Click here for diff

This adds pg_dump support for table AMs in a similar manner to how  
tablespaces are handled. That is, instead of specifying the AM for  
every CREATE TABLE etc, emit SET default_table_access_method  
statements. That makes it easier to change the AM for all/most tables  
in a dump, and allows restore to succeed even if some AM is not  
available.  
  
This increases the dump archive version, as a tables/matview's AM  
needs to be tracked therein.  
  
Author: Dimitri Dolgov, Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

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

tableam: introduce table AM infrastructure.

commit   : 8586bf7ed8889f39a59dd99b292014b73be85342    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 09:54:38 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 09:54:38 -0800    

Click here for diff

This introduces the concept of table access methods, i.e. CREATE  
  ACCESS METHOD ... TYPE TABLE and  
  CREATE TABLE ... USING (storage-engine).  
No table access functionality is delegated to table AMs as of this  
commit, that'll be done in following commits.  
  
Subsequent commits will incrementally abstract table access  
functionality to be routed through table access methods. That change  
is too large to be reviewed & committed at once, so it'll be done  
incrementally.  
  
Docs will be updated at the end, as adding them incrementally would  
likely make them less coherent, and definitely is a lot more work,  
without a lot of benefit.  
  
Table access methods are specified similar to index access methods,  
i.e. pg_am.amhandler returns, as INTERNAL, a pointer to a struct with  
callbacks. In contrast to index AMs that struct needs to live as long  
as a backend, typically that's achieved by just returning a pointer to  
a constant struct.  
  
Psql's \d+ now displays a table's access method. That can be disabled  
with HIDE_TABLEAM=true, which is mainly useful so regression tests can  
be run against different AMs.  It's quite possible that this behaviour  
still needs to be fine tuned.  
  
For now it's not allowed to set a table AM for a partitioned table, as  
we've not resolved how partitions would inherit that. Disallowing  
allows us to introduce, if we decide that's the way forward, such a  
behaviour without a compatibility break.  
  
Catversion bumped, to add the heap table AM and references to it.  
  
Author: Haribabu Kommi, Andres Freund, Alvaro Herrera, Dimitri Golgov and others  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/backend/access/heap/Makefile
A src/backend/access/heap/heapam_handler.c
M src/backend/access/table/Makefile
A src/backend/access/table/tableam.c
A src/backend/access/table/tableamapi.c
M src/backend/bootstrap/bootparse.y
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/toasting.c
M src/backend/commands/amcmds.c
M src/backend/commands/cluster.c
M src/backend/commands/createas.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/parser/gram.y
M src/backend/rewrite/rewriteDefine.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/guc.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c
A src/include/access/tableam.h
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/test/regress/expected/create_am.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/psql.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/pg_regress_main.c
M src/test/regress/sql/create_am.sql
M src/test/regress/sql/opr_sanity.sql
M src/test/regress/sql/psql.sql
M src/test/regress/sql/type_sanity.sql
M src/tools/pgindent/typedefs.list

Fix bug in clearing of virtual tuple slot.

commit   : f21776185648537a7bb82dfdf89991fb2e0b9ca5    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 09:54:38 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Mar 2019 09:54:38 -0800    

Click here for diff

I broke/typoed this in 4da597edf1bae0c. Astonishingly this mostly  
doesn't cause breakage, except when trying to change the tuple  
descriptor of a slot (because TTS_FLAG_FIXED is assumed to be set).  
  
Author: Andres Freund  

M src/backend/executor/execTuples.c

Removed unused variable, openLogOff.

commit   : 93473c6ac805994a74e74ed13828c6c9433c8faf    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 6 Mar 2019 09:30:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 6 Mar 2019 09:30:50 -0500    

Click here for diff

Antonin Houska  
  
Discussion: http://postgr.es/m/30413.1551870730@localhost  

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

Increase the default vacuum_cost_limit from 200 to 2000

commit   : bd09503e633b8077822bb4daf91625b71ac16253    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 6 Mar 2019 09:10:12 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 6 Mar 2019 09:10:12 -0500    

Click here for diff

The original 200 default value was set back in f425b605f4e when the cost  
delay settings were first added.  Hardware has improved quite a bit since  
then and we've also made improvements such as sorting buffers during  
checkpoints (9cd00c457e6) which should result in less random writes.  
  
This low default value was reportedly causing problems with badly  
configured servers and in the absence of a native method to remove  
excessive bloat from tables without incurring an AccessExclusiveLock, this  
often made cleaning up the damage caused by badly configured auto-vacuums  
difficult.  
  
It seems more likely that someone will notice that auto-vacuum is running  
too quickly than too slowly, so let's go all out and multiple the default  
value for the setting by 10.  With the default vacuum_cost_page_dirty and  
autovacuum_vacuum_cost_delay (assuming a page size of 8192 bytes), this  
allows autovacuum a theoretical maximum dirty write rate of around 39MB/s  
instead of just 3.9MB/s.  
  
Author: David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f_YbXC2qTMPyCbmsPiKvZYwpuQNQMohiRXLj1r=8_rYvw@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Teach SKIP_LOCKED to psql tab completion of VACUUM and ANALYZE

commit   : ff9bff0a85b6c23d622b4913ed38f459866f0d3a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Mar 2019 14:42:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Mar 2019 14:42:52 +0900    

Click here for diff

This was missing since 803b130, which has introduced the option for the  
user-facing VACUUM and ANALYZE.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoD2TMdTxRhZ7WSp940V82_OAyPmgHnbi25UbbArLgA92Q@mail.gmail.com  

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

Fix pgbench TAP test failure with funky file names (redux)

commit   : e988878f85436dcd74e503c94f5b8e2b76a08711    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 5 Mar 2019 10:46:21 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 5 Mar 2019 10:46:21 -0500    

Click here for diff

This test fails if the containing directory contains a funny character  
such as a space or some perl metacharacter. To avoid that, we check for  
files names using readdir and a regex, rather than using a glob pattern.  
  
Discussion: https://postgr.es/m/CAM6_UM6dGdU39PKAC24T+HD9ouy0jLN9vH6163K8QEEzr__iZw@mail.gmail.com  
  
Author: Fabien COELHO  
Reviewed-by: Raúl Marín Rodríguez  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Remove duplicate macro

commit   : 9b1384dd6a03c6ae1db1c2f5a8e87875f2f299ca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Mar 2019 15:02:56 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Mar 2019 15:02:56 +0100    

Click here for diff

The original commit appears to have accidentally introduced a  
duplicate definition.  Keep only one of them.  

M src/bin/pgbench/pgbench.c

Scan GiST indexes in physical order during VACUUM.

commit   : fe280694d0d49e3d5f2666042b5e9ff0c8305341    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 5 Mar 2019 15:19:48 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 5 Mar 2019 15:19:48 +0200    

Click here for diff

Scanning an index in physical order is faster than walking it in logical  
order, because sequential I/O is faster than random I/O. The idea and code  
structure is borrowed from B-tree vacuum code.  
  
Patch by Andrey Borodin, with changes by me. Based on early work by  
Konstantin Kuznetsov, although the patch has been rewritten multiple times  
since his original version.  
  
Discussion: https://www.postgresql.org/message-id/1B9FAC6F-FA19-4A24-8C1B-F4F574844892%40yandex-team.ru  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistvacuum.c

Note case where nbtree VACUUM finishes splits.

commit   : 35bc0ec7c800b303e0629913ac336924cf979dcc    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 4 Mar 2019 17:57:36 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 4 Mar 2019 17:57:36 -0800    

Click here for diff

The nbtree README claims that VACUUM can never finish interrupted page  
splits by design.  That isn't entirely accurate, though.  Note an  
exception to the general rule.  
  
Discussion: https://postgr.es/m/CAH2-Wz=_Xvv8byzK_LvY4ci76OgsHCQzoKF7We8yG9waO7j6rA@mail.gmail.com  

M src/backend/access/nbtree/README

Disable dump_connstr test on Msys2

commit   : 1638623f34b716cab8e260b11720466223fe2589    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 4 Mar 2019 17:11:18 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 4 Mar 2019 17:11:18 -0500    

Click here for diff

For some reason the dump test with names with high bits set fails on  
Msys2 (although not Msys1). Disable the tests for now, so that other  
tests can run.  

M src/bin/pg_dump/t/010_dump_connstr.pl

Allow recovery tests to run on Windows as an admin user

commit   : 4eff1e9f0bf7835bee61aaaa9d6de23422a724a0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 4 Mar 2019 15:50:23 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 4 Mar 2019 15:50:23 -0500    

Click here for diff

This is the only test that fails when run as an admin user. The reason  
is that when Postgres is started via pg_ctl its admin privileges are  
lowered. However, this test called 'postgres -D datadir' directly,  
resulting in a failure. Replace that by calling pg_ctl and then checking  
the result for the expected failure, and the logfile for the expected  
error message.  

M src/test/recovery/t/003_recovery_targets.pl

Correct obsolete nbtree page split WAL comment.

commit   : 72c7c4e38610297b200721a7d5201f79e7ceef7c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 4 Mar 2019 12:32:40 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 4 Mar 2019 12:32:40 -0800    

Click here for diff

Commit 2c03216d831, which revamped the WAL record format, failed to  
update a comment referencing the old API.  Update the comment.  

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

Reorder configure tests for accept() in Windows

commit   : 6ad94e4d73c098aea8636e27212b9284c6cd9708    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 4 Mar 2019 13:53:06 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 4 Mar 2019 13:53:06 -0500    

Click here for diff

Currently only frogmouth in the buildfarm uses the 32bit params, and  
it's not able to build past release 10, so put those last, saving  
substantial configure time on more modern systems. Even if we get a  
modern 32 bit Windows system at some stage we should probably prefer the  
64 bit interface here these days.  

M config/ac_func_accept_argtypes.m4
M configure

pg_partition_ancestors

commit   : b96f6b19487fb9802216311b242c01c27c1938de    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Mar 2019 16:14:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Mar 2019 16:14:29 -0300    

Click here for diff

Adds another introspection feature for partitioning, necessary for  
further psql patches.  
  
Reviewed-by: Michaël Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Test partition functions with legacy inheritance children, too

commit   : d12fbe2f8e5daf84b07a61884a8ea5f84d6c5832    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 4 Mar 2019 15:52:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 4 Mar 2019 15:52:41 -0300    

Click here for diff

It's worth immortalizing this behavior, per discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove volatile from latch API

commit   : 278584b526d71a3fe86f91be5870f99f38477e27    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Feb 2019 09:24:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Feb 2019 09:24:15 +0100    

Click here for diff

This was no longer useful since the latch functions use memory  
barriers already, which are also compiler barriers, and volatile does  
not help with cross-process access.  
  
Discussion: https://www.postgresql.org/message-id/flat/20190218202511.qsfpuj5sy4dbezcw%40alap3.anarazel.de#18783c27d73e9e40009c82f6e0df0974  

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

Fix error handling of readdir() port implementation on first file lookup

commit   : 754b90f657bd54b482524b73726dae4a9165031c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Mar 2019 09:49:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Mar 2019 09:49:06 +0900    

Click here for diff

The implementation of readdir() in src/port/ which gets used by MSVC has  
been added in 399a36a, and since the beginning it considers all errors  
on the first file lookup as ENOENT, setting errno accordingly and  
letting the routine caller think that the directory is empty.  While  
this is normally enough for the case of the backend, this can confuse  
callers of this routine on Windows as all errors would map to the same  
behavior.  So, for example, even permission errors would be thought as  
having an empty directory, while there could be contents in it.  
  
This commit changes the error handling so as readdir() gets a behavior  
similar to native implementations: force errno=0 when seeing  
ERROR_FILE_NOT_FOUND as error and consider other errors as plain  
failures.  
  
While looking at the patch, I noticed that MinGW does not enforce  
errno=0 when looking at the first file, but it gets enforced on the next  
file lookups.  A comment related to that was incorrect in the code.  
  
Reported-by: Yuri Kurenkov  
Diagnosed-by: Yuri Kurenkov, Grigory Smolkin  
Author:	Konstantin Knizhnik  
Reviewed-by: Andrew Dunstan, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M src/port/dirent.c

fix thinko in logrotate test

commit   : 5bd9160f27420ab1a2fb54458d84606b1527a15c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 3 Mar 2019 19:15:47 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 3 Mar 2019 19:15:47 -0500    

Click here for diff

M src/bin/pg_ctl/t/004_logrotate.pl

Don't do pg_ctl logrotate test on Windows

commit   : d611175e531b9e09f2f497d7338fff73dd8f2c49    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 3 Mar 2019 18:19:44 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 3 Mar 2019 18:19:44 -0500    

Click here for diff

The test crashes and burns quite badly, for some reason, but even if it  
didn't it wouldn't work, since Windows doesn't let you rename a file  
held by a running process.  

M src/bin/pg_ctl/t/004_logrotate.pl

Improve performance of index-only scans with many index columns.

commit   : 80b9e9c4664a020ebd14889046bd8d22a17d1ca6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Mar 2019 16:57:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Mar 2019 16:57:14 -0500    

Click here for diff

StoreIndexTuple was a loop over index_getattr, which is O(N^2)  
if the index columns are variable-width, and the performance  
impact is already quite visible at ten columns.  The obvious  
move is to replace that with a call to index_deform_tuple ...  
but that's *also* a loop over index_getattr.  Improve it to  
be essentially a clone of heap_deform_tuple.  
  
(There are a few other places that loop over all index columns  
with index_getattr, and perhaps should be changed likewise,  
but most of them don't seem performance-critical.  Anyway, the  
rest would mostly only be interested in the index key columns,  
which there aren't likely to be so many of.  Wide index tuples  
are a new thing with INCLUDE.)  
  
Konstantin Knizhnik  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/indextuple.c
M src/backend/executor/nodeIndexonlyscan.c

Avoid accidental wildcard expansion in msys shell

commit   : 78b408a20a5a19486f0ed833466d0de342c7e471    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 3 Mar 2019 11:48:12 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 3 Mar 2019 11:48:12 -0500    

Click here for diff

Commit f092de05 added a test for pg_dumpall --exclude-database including  
the wildcard pattern '*dump*' which matches some files in the source  
directory. The test library on msys uses the shell which expands this  
and thus the program gets incorrect arguments. This doesn't happen if  
the pattern doesn't match any files, so here the pattern is set to  
'*dump_test*' which is such a pattern.  
  
Per buildfarm animal jacana.  

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

Further fixing for multi-row VALUES lists for updatable views.

commit   : ed4653db8ca7a70ba7a4d329a44812893f8e59c2    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 3 Mar 2019 10:51:13 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 3 Mar 2019 10:51:13 +0000    

Click here for diff

Previously, rewriteTargetListIU() generated a list of attribute  
numbers from the targetlist, which were passed to rewriteValuesRTE(),  
which expected them to contain the same number of entries as there are  
columns in the VALUES RTE, and to be in the same order. That was fine  
when the target relation was a table, but for an updatable view it  
could be broken in at least three different ways ---  
rewriteTargetListIU() could insert additional targetlist entries for  
view columns with defaults, the view columns could be in a different  
order from the columns of the underlying base relation, and targetlist  
entries could be merged together when assigning to elements of an  
array or composite type. As a result, when recursing to the base  
relation, the list of attribute numbers generated from the rewritten  
targetlist could no longer be relied upon to match the columns of the  
VALUES RTE. We got away with that prior to 41531e42d3 because it used  
to always be the case that rewriteValuesRTE() did nothing for the  
underlying base relation, since all DEFAULTS had already been replaced  
when it was initially invoked for the view, but that was incorrect  
because it failed to apply defaults from the base relation.  
  
Fix this by examining the targetlist entries more carefully and  
picking out just those that are simple Vars referencing the VALUES  
RTE. That's sufficient for the purposes of rewriteValuesRTE(), which  
is only responsible for dealing with DEFAULT items in the VALUES  
RTE. Any DEFAULT item in the VALUES RTE that doesn't have a matching  
simple-Var-assignment in the targetlist is an error which we complain  
about, but in theory that ought to be impossible.  
  
Additionally, move this code into rewriteValuesRTE() to give a clearer  
separation of concerns between the 2 functions. There is no need for  
rewriteTargetListIU() to know about the details of the VALUES RTE.  
  
While at it, fix the comment for rewriteValuesRTE() which claimed that  
it doesn't support array element and field assignments --- that hasn't  
been true since a3c7a993d5 (9.6 and later).  
  
Back-patch to all supported versions, with minor differences for the  
pre-9.6 branches, which don't support array element and field  
assignments to the same column in multi-row VALUES lists.  
  
Reviewed by Amit Langote.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Consider only relations part of partition trees in partition functions

commit   : 3422955735d9b2623532c60c53cb885c9cb6e3b1    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 2 Mar 2019 18:18:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 2 Mar 2019 18:18:59 +0900    

Click here for diff

This changes the partition functions so as tables and indexes which are  
not part of partition trees are handled the same way as what is done for  
undefined objects and unsupported relkinds: pg_partition_tree() returns  
no rows and pg_partition_root() returns a NULL result.  Hence,  
partitioned tables, partitioned indexes and relations whose flag  
pg_class.relispartition is set are considered as valid objects to  
process.  
  
Previously, tables and indexes not included in a partition tree were  
processed the same way as a partition or a partitioned table, which  
caused the functions to return inconsistent results for inherited  
tables, especially when inheriting from multiple tables.  
  
Reported-by: Álvaro Herrera  
Author: Amit Langote, Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Use a virtual rather than a heap slot in two places where that suffices.

commit   : 70b9bda65f8174e24eef5d8967705485a314a82e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 1 Mar 2019 17:24:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 1 Mar 2019 17:24:57 -0800    

Click here for diff

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

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

Check we don't misoptimize a NOT IN where the subquery returns no rows.

commit   : 3396138a6de329fa7b5e0dda79219b4ae82622dc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Mar 2019 17:57:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Mar 2019 17:57:20 -0500    

Click here for diff

Future-proofing against a common mistake in attempts to optimize NOT IN.  
We don't have such an optimization right now, but attempts to do so  
are in the works, and some of 'em are buggy.  Add a regression test case  
covering the point.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f90E9agVZryVyUpbHQbjTt5ExqS2Fsodmt5_A7E_cEyVA@mail.gmail.com  

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

Teach optimizer's predtest.c more things about ScalarArrayOpExpr.

commit   : 65ce07e0202f2ef0953be9d085d3e5df7ad353a4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Mar 2019 17:14:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Mar 2019 17:14:07 -0500    

Click here for diff

In particular, make it possible to prove/refute "x IS NULL" and  
"x IS NOT NULL" predicates from a clause involving a ScalarArrayOpExpr  
even when we are unable or unwilling to deconstruct the expression  
into an AND/OR tree.  This avoids a former unexpected degradation of  
plan quality when the size of an ARRAY[] expression or array constant  
exceeded the arbitrary MAX_SAOP_ARRAY_SIZE limit.  For IS-NULL proofs,  
we don't really care about the values of the individual array elements;  
at most, we care whether there are any, and for some common cases we  
needn't even know that.  
  
The main user-visible effect of this is to let the optimizer recognize  
applicability of partial indexes with "x IS NOT NULL" predicates to  
queries with "x IN (array)" clauses in some cases where it previously  
failed to recognize that.  The structure of predtest.c is such that a  
bunch of related proofs will now also succeed, but they're probably  
much less useful in the wild.  
  
James Coleman, reviewed by David Rowley  
  
Discussion: https://postgr.es/m/CAAaqYe8yKSvzbyu8w-dThRs9aTFMwrFxn_BkTYeXgjqe3CbNjg@mail.gmail.com  

M src/backend/optimizer/util/predtest.c
M src/test/modules/test_predtest/expected/test_predtest.out
M src/test/modules/test_predtest/sql/test_predtest.sql

Fix whitespace

commit   : aad21d4c3cd84e7c2a28d239048d2e2f494be47e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Mar 2019 20:56:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Mar 2019 20:56:53 +0100    

Click here for diff

M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/test/expected/sql-bytea.c
M src/interfaces/ecpg/test/expected/sql-bytea.stderr
M src/interfaces/ecpg/test/sql/bytea.pgc

Remove tests for pg_dumpall --exclude-database missing argument

commit   : 97b6f2eb759ce898ad632fd7b5db29f542b93454    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 1 Mar 2019 14:11:37 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 1 Mar 2019 14:11:37 -0500    

Click here for diff

It turns out that different getopt implementations spell the error for  
missing arguments different ways. This test is of fairly marginal  
value, so instead of trying to keep up  with the different error  
messages just remove the test.  

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

Store tuples for EvalPlanQual in slots, rather than as HeapTuples.

commit   : ad0bda5d24ea2bcc72b5e50020e3c79bab10836b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 1 Mar 2019 10:37:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 1 Mar 2019 10:37:57 -0800    

Click here for diff

For the upcoming pluggable table access methods it's quite  
inconvenient to store tuples as HeapTuples, as that'd require  
converting tuples from a their native format into HeapTuples. Instead  
use slots to manage epq tuples.  
  
To fit into that scheme, change the foreign data wrapper callback  
RefetchForeignRow, to store the tuple in a slot. Insist on using the  
caller provided slot, so it conveniently can be stored in the  
corresponding EPQ slot.  As there is no in core user of  
RefetchForeignRow, that change was done blindly, but we plan to test  
that soon.  
  
To avoid duplicating that work for row locks, move row locks to just  
directly use the EPQ slots - it previously temporarily stored tuples  
in LockRowsState.lr_curtuples, but that doesn't seem beneficial, given  
we'd possibly end up with a significant number of additional slots.  
  
The behaviour of es_epqTupleSet[rti -1] is now checked by  
es_epqTupleSlot[rti -1] != NULL, as that is distinguishable from a  
slot containing an empty tuple.  
  
Author: Andres Freund, Haribabu Kommi, Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/fdwhandler.sgml
M src/backend/executor/execMain.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/include/executor/tuptable.h
M src/include/foreign/fdwapi.h
M src/include/nodes/execnodes.h

Add extra descriptive headings in pg_dumpall

commit   : 6cbdbd9e8d8f2986fde44f2431ed8d0c8fce7f5d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 1 Mar 2019 11:38:54 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 1 Mar 2019 11:38:54 -0500    

Click here for diff

Headings are added for the User Configurations and Databases sections,  
and for each user configuration and database in the output.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1812272222130.32444@lancre  

M src/bin/pg_dump/pg_dumpall.c

Add --exclude-database option to pg_dumpall

commit   : f092de0503cd77a8463e7089c249d5e0586a120b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 1 Mar 2019 10:47:44 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 1 Mar 2019 10:47:44 -0500    

Click here for diff

This option functions similarly to pg_dump's --exclude-table option, but  
for database names. The option can be given once, and the argument can  
be a pattern including wildcard characters.  
  
Author: Andrew Dunstan.  
Reviewd-by: Fabien Coelho and Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dumpall.sgml
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl

Clear the local map when not used.

commit   : 9c32e4c35026bd52aaf340bfe7594abc653e42f0    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 1 Mar 2019 07:38:47 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 1 Mar 2019 07:38:47 +0530    

Click here for diff

After commit b0eaa4c51b, we use a local map of pages to find the required  
space for small relations.  We do clear this map when we have found a block  
with enough free space, when we extend the relation, or on transaction  
abort so that it can be used next time.  However, we miss to clear it when  
we didn't find any pages to try from the map which leads to an assertion  
failure when we later tried to use it after relation extension.  
  
In the passing, I have improved some comments in this area.  
  
Reported-by: Tom Lane based on buildfarm results  
Author: Amit Kapila  
Reviewed-by: John Naylor  
Tested-by: Kuntal Ghosh  
Discussion: https://postgr.es/m/[email protected]  

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

Make pg_partition_tree return no rows on unsupported and undefined objects

commit   : 0f3cdf873e7d81fbf61965e13685595c8a23c322    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Mar 2019 09:07:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Mar 2019 09:07:07 +0900    

Click here for diff

The function was tweaked so as it returned one row full of NULLs when  
working on an unsupported relkind or an undefined object as of cc53123,  
and after discussion with Amit and Álvaro it looks more natural to make  
it return no rows.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/partitionfuncs.c
M src/test/regress/expected/partition_info.out

Don't superfluously materialize slot after DELETE from an FDW.

commit   : 253655116bb437d649203a5a87105e885e4b08f9    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 Feb 2019 13:57:49 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 Feb 2019 13:57:49 -0800    

Click here for diff

Previously that was needed to safely store the table oid, but after  
b8d71745eac0a127 that's not necessary anymore.  
  
Author: Andres Freund  

M src/backend/executor/nodeModifyTable.c

Don't force materializing when copying a buffer tuple table slot.

commit   : 8f0577386e68c3b1c83a07b95756e5ee3f4ae73f    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 Feb 2019 13:55:27 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 Feb 2019 13:55:27 -0800    

Click here for diff

After 5408e233f0667478 it's not necessary to force materializing the  
target slot when copying from one buffer slot to another. Previously  
that was required because the HeapTupleData portion of the source slot  
wasn't guaranteed to stay valid long enough, but now we can simply  
copy that part into the destination slot's tupdata.  
  
Author: Andres Freund  

M src/backend/executor/execTuples.c

Improve docs for ALTER TABLE .. SET TABLESPACE

commit   : 2c31825fb9a95914418f1e376917f60841a26c78    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Feb 2019 19:24:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Feb 2019 19:24:21 -0300    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Robert Haas  

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

Make get_controlfile not leak file descriptors

commit   : 4598a99cf22de0dbab975d9c87ce16fd53146aca    
  
author   : Joe Conway <[email protected]>    
date     : Thu, 28 Feb 2019 15:57:40 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Thu, 28 Feb 2019 15:57:40 -0500    

Click here for diff

When backend functions were added to expose controldata via SQL,  
reading of pg_control was consolidated under src/common so that  
both frontend and backend could share the same code. That move  
from frontend-only to shared frontend-backend failed to recognize  
the risk (and coding standards violation) of using a bare open().  
In particular, it risked leaking file descriptors if transient  
errors occurred while reading the file. Fix that by using  
OpenTransientFile() instead in the backend case, which is  
purpose-built for this type of usage.  
  
Since there have been no complaints from the field, and an intermittent  
failure low risk, no backpatch. Hard failure would of course be bad, but  
in that case these functions are probably the least of your worries.  
  
Author: Joe Conway  
Reviewed-By: Michael Paquier  
Reported by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/common/controldata_utils.c

Allow buffer tuple table slots to materialize after ExecStoreVirtualTuple().

commit   : f414abd62da7aa3cfd75e9047affd94c029c7c04    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 28 Feb 2019 12:27:58 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 28 Feb 2019 12:27:58 -0800    

Click here for diff

While not common, it can be useful to store a virtual tuple into a  
buffer tuple table slot, and then materialize that slot. So far we've  
asserted out, which surprisingly wasn't a problem for anything in  
core. But that seems fragile, and it also breaks redis_fdw after  
ff11e7f4b9.  
  
Thus, allow materializing a virtual tuple stored in a buffer tuple  
table slot.  
  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c

pg_dump: Fix ArchiveEntry handling of some empty values

commit   : 19455c9f5606072a191962271c35ad659fbab526    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Feb 2019 17:16:08 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Feb 2019 17:16:08 -0300    

Click here for diff

Commit f831d4acc changed what pg_dump emits for some empty fields: they  
were output as empty strings before, NULL pointer afterwards.  That  
makes old pg_restore unable to work (crash) with such files, which is  
unacceptable.  Return to the original representation by explicitly  
setting those struct members to "" where needed; remove some no longer  
needed checks for NULL input.  
  
We can declutter the code a little by returning to NULLs when we next  
update the archive version, so add a note to remind us later.  
  
Discussion: https://postgr.es/m/[email protected]  
Reported-by: hubert depesz lubaczewski  
Author: Dmitry Dolgov  

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

Merge near-duplicate code in RI triggers

commit   : 3f61999cc9da68890174dd8cf97f2cb96b223e81    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 19:08:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 19:08:55 +0100    

Click here for diff

Merge ri_setnull and ri_setdefault into one function ri_set.  These  
functions were to a large part identical.  
  
This is a continuation in spirit of  
4797f9b519995ceca5d6b8550b5caa2ff6d19347.  
  
Author: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/0ccdd3e1-10b0-dd05-d8a7-183507c11eb1%402ndquadrant.com  

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

Standardize some more loops that chase down parallel lists.

commit   : c94fb8e8acc05c4b5f9f5b2a595ce7930827c2be    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Feb 2019 14:25:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Feb 2019 14:25:01 -0500    

Click here for diff

We have forboth() and forthree() macros that simplify iterating  
through several parallel lists, but not everyplace that could  
reasonably use those was doing so.  Also invent forfour() and  
forfive() macros to do the same for four or five parallel lists,  
and use those where applicable.  
  
The immediate motivation for doing this is to reduce the number  
of ad-hoc lnext() calls, to reduce the footprint of a WIP patch.  
However, it seems like good cleanup and error-proofing anyway;  
the places that were combining forthree() with a manually iterated  
loop seem particularly illegible and bug-prone.  
  
There was some speculation about restructuring related parsetree  
representations to reduce the need for parallel list chasing of  
this sort.  Perhaps that's a win, or perhaps not, but in any case  
it would be considerably more invasive than this patch; and it's  
not particularly related to my immediate goal of improving the  
List infrastructure.  So I'll leave that question for another day.  
  
Patch by me; thanks to David Rowley for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/tupdesc.c
M src/backend/executor/execExpr.c
M src/backend/executor/nodeIndexscan.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_func.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/pg_list.h

Clean up some variable names in ri_triggers.c

commit   : 0a271df705c98c1cc617078ebd069cf080fa5a16    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 15:29:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 15:29:00 +0100    

Click here for diff

There was a mix of old_slot/oldslot, new_slot/newslot.  Since we've  
changed everything from row to slot, we might as well take this  
opportunity to clean this up.  
  
Also update some more comments for the slot change.  

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

Compact for loops

commit   : 554ebf687852d045f0418d3242b978b49f160f44    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 10:54:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 10:54:44 +0100    

Click here for diff

Declare loop variable in for loop, for readability and to save space.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/0ccdd3e1-10b0-dd05-d8a7-183507c11eb1%402ndquadrant.com  

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

Reduce comments

commit   : 05d604718f7fec7db33548374ecde3f11916ec15    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 10:54:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 10:54:44 +0100    

Click here for diff

Reduce the vertical space used by comments in ri_triggers.c, making  
the file longer and more tedious to read than it needs to be.  Update  
some comments to use a more common style.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/0ccdd3e1-10b0-dd05-d8a7-183507c11eb1%402ndquadrant.com  

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

Remove unnecessary unused MATCH PARTIAL code

commit   : 0afdecc1e5d70f86d87fdc125b83ed4b7e3e88dd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 10:54:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 10:54:44 +0100    

Click here for diff

ri_triggers.c spends a lot of space catering to a not-yet-implemented  
MATCH PARTIAL option.  An actual implementation would probably not use  
the existing code structure anyway, so let's just simplify this for  
now.  
  
First, have ri_FetchConstraintInfo() check that riinfo->confmatchtype  
is valid.  Then we don't have to repeat that everywhere.  
  
In the various referential action functions, we don't need to pay  
attention to the match type at all right now, so remove all that code.  
A future MATCH PARTIAL implementation would probably have some  
conditions added to the present code, but it won't need an entirely  
separate switch branch in each case.  
  
In RI_FKey_fk_upd_check_required(), reorganize the code to make it  
much simpler.  
  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/0ccdd3e1-10b0-dd05-d8a7-183507c11eb1%402ndquadrant.com  

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

Update comment

commit   : 22c0d52b8dc175fe46ebb6e0ab5b2be35e02be4e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 10:43:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 10:43:00 +0100    

Click here for diff

for ff11e7f4b9ae017585c3ba146db7ba39c31f209a  

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

Improve documentation of data_sync_retry

commit   : b3a156858ab03cb5f9c55dedcaf85a6249b3ec64    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Feb 2019 11:02:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Feb 2019 11:02:11 +0900    

Click here for diff

Reflecting an updated parameter value requires a server restart, which  
was not mentioned in the documentation and in postgresql.conf.sample.  
  
Reported-by: Thomas Poty  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/postgresql.conf.sample

Fix SCRAM authentication via SSL when mixing versions of OpenSSL

commit   : 87c346a35ee869e401e736163ec9d21632cc3b0d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Feb 2019 09:40:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Feb 2019 09:40:28 +0900    

Click here for diff

When using a libpq client linked with OpenSSL 1.0.1 or older to connect  
to a backend linked with OpenSSL 1.0.2 or newer, the server would send  
SCRAM-SHA-256-PLUS and SCRAM-SHA-256 as valid mechanisms for the SASL  
exchange, and the client would choose SCRAM-SHA-256-PLUS even if it does  
not support channel binding, leading to a confusing error.  In this  
case, what the client ought to do is switch to SCRAM-SHA-256 so as the  
authentication can move on and succeed.  
  
So for a SCRAM authentication over SSL, here are all the cases present  
and how we deal with them using libpq:  
1) Server supports channel binding, it sends SCRAM-SHA-256-PLUS and  
SCRAM-SHA-256 as allowed mechanisms.  
1-1) Client supports channel binding, chooses SCRAM-SHA-256-PLUS.  
1-2) Client does not support channel binding, chooses SCRAM-SHA-256.  
2) Server does not support channel binding, sends SCRAM-SHA-256 as  
allowed mechanism.  
2-1) Client supports channel binding, still it has no choice but to  
choose SCRAM-SHA-256.  
2-2) Client does not support channel binding, it chooses SCRAM-SHA-256.  
In all these scenarios the connection should succeed, and the one which  
was handled incorrectly prior this commit is 1-2), causing the  
connection attempt to fail because client chose SCRAM-SHA-256-PLUS over  
SCRAM-SHA-256.  
  
Reported-by: Hugh Ranalli  
Diagnosed-by: Peter Eisentraut  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/CAAhbUMO89SqUk-5mMY+OapgWf-twF2NA5sCucbHEzMfGbvcepA@mail.gmail.com  
Backpatch-through: 11  

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

Remove unused macro

commit   : da35d14806249c4619b2b5efda061211768a27ce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 00:28:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 28 Feb 2019 00:28:50 +0100    

Click here for diff

It has never been used as long as hstore has been in the tree.  

M contrib/hstore/hstore_gist.c

Initialize variable to silence compiler warning.

commit   : 5963b29e03d9b93011acb3954ccc3565d217acc3    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 27 Feb 2019 09:14:34 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 27 Feb 2019 09:14:34 -0800    

Click here for diff

After ff11e7f4b9ae Tom's compiler warns about accessing a potentially  
uninitialized rInfo. That's not actually possible, but it's  
understandable the compiler would get this wrong. NULL initialize too.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

Set cluster_name for PostgresNode.pm instances

commit   : 538ecc17c478e87cc3155c2b9cda7a1b1812d767    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Feb 2019 08:38:54 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Feb 2019 08:38:54 +0100    

Click here for diff

This can help identifying test instances more easily at run time, and  
it also provides some minimal test coverage for the cluster_name  
feature.  
  
Reviewed-by: Euler Taveira <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/test/perl/PostgresNode.pm

Set fallback_application_name for a walreceiver to cluster_name

commit   : 6ae578a91e653ce3f4cba8cab96ce41e0cc7103f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Feb 2019 08:17:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Feb 2019 08:17:21 +0100    

Click here for diff

By default, the fallback_application_name for a physical walreceiver  
is "walreceiver".  This means that multiple standbys cannot be  
distinguished easily on a primary, for example in pg_stat_activity or  
synchronous_standby_names.  
  
If cluster_name is set, use that for fallback_application_name in the  
walreceiver.  (If it's not set, it remains "walreceiver".)  If someone  
set cluster_name to identify their instance, we might as well use that  
by default to identify the node remotely as well.  It's still possible  
to specify another application_name in primary_conninfo explicitly.  
  
Reviewed-by: Euler Taveira <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/replication/walreceiver.c

Fix memory leak when inserting tuple at relation creation for CTAS

commit   : 414a9d3cf34c7aff1c63533df4c40ebb63bd0840    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 27 Feb 2019 14:14:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 27 Feb 2019 14:14:06 +0900    

Click here for diff

The leak has been introduced by 763f2ed which has addressed the problem  
for transient tables, and forgot CREATE TABLE AS which shares a similar  
logic when receiving a new tuple to store into the newly-created  
relation.  
  
Author: Jeff Janes  
Discussion: https://postgr.es/m/CAMkU=1xZXtz3mziPEPD2Fubbas4G2RWkZm5HHABtfKVcbu1=Sg@mail.gmail.com  

M src/backend/commands/createas.c

Use slots in trigger infrastructure, except for the actual invocation.

commit   : ff11e7f4b9ae017585c3ba146db7ba39c31f209a    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Feb 2019 20:30:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Feb 2019 20:30:28 -0800    

Click here for diff

In preparation for abstracting table storage, convert trigger.c to  
track tuples in slots. Which also happens to make code calling  
triggers simpler.  
  
As the calling interface for triggers themselves is not changed in  
this patch, HeapTuples still are extracted from the slot at that  
time. But that's handled solely inside trigger.c, not visible to  
callers. It's quite likely that we'll want to revise the external  
trigger interface, but that's a separate large project.  
  
As part of this work the slots used for old/new/return tuples are  
moved from EState into ResultRelInfo, as different updated tables  
might need different slots. The slots are now also now created  
on-demand, which is good both from an efficiency POV, but also makes  
the modifying code simpler.  
  
Author: Andres Freund, Amit Khandekar and Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/backend/replication/logical/worker.c
M src/backend/utils/adt/ri_triggers.c
M src/include/commands/trigger.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h

Store table oid and tuple's tid in tuple slots directly.

commit   : b8d71745eac0a12740a70dc78cbcdedadade37f8    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Feb 2019 18:21:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Feb 2019 18:21:44 -0800    

Click here for diff

After the introduction of tuple table slots all table AMs need to  
support returning the table oid of the tuple stored in a slot created  
by said AM. It does not make sense to re-implement that in every AM,  
therefore move handling of table OIDs into the TupleTableSlot  
structure itself.  It's possible that we, at a later date, might want  
to get rid of HeapTupleData.t_tableOid entirely, but doing so before  
the abstractions for table AMs are integrated turns out to be too  
hard, so delay that for now.  
  
Similarly, every AM needs to support the concept of a tuple  
identifier (tid / item pointer) for its tuples. It's quite possible  
that we'll generalize the exact form of a tid at a future point (to  
allow for things like index organized tables), but for now many parts  
of the code know about tids, so there's not much point in abstracting  
tids away. Therefore also move into slot (rather than providing API to  
set/get the tid associated with the tuple in a slot).  
  
Once table AM includes insert/updating/deleting tuples, the  
responsibility to set the correct tid after such an action will move  
into that. After that change, code doing such modifications, should  
not have to deal with HeapTuples directly anymore.  
  
Author: Andres Freund, Haribabu Kommi and Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execReplication.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/tuptable.h

Allow to use HeapTupleData embedded in [Buffer]HeapTupleTableSlot.

commit   : 5408e233f0667478e7f2a3e4b914e14217e20729    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Feb 2019 18:15:59 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Feb 2019 18:15:59 -0800    

Click here for diff

That avoids having to care about the lifetime of the  
HeapTupleHeaderData passed to ExecStore[Buffer]HeapTuple(). That  
doesn't make a huge difference for a plain HeapTupleTableSlot, but for  
BufferHeapTupleTableSlot it can be a significant advantage, avoiding  
the need to materialize slots where it's inconvenient to provide a  
HeapTupleData with appropriate lifetime to point to the on-disk tuple.  
  
It's quite possible that we'll want to add support functions for  
constructing HeapTuples using that embedded HeapTupleData, but for now  
callers do so themselves.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/executor/tuptable.h

Add ExecStorePinnedBufferHeapTuple.

commit   : 8aa02b52db11039925191912eca71e3584b68860    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 26 Feb 2019 17:59:01 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 26 Feb 2019 17:59:01 -0800    

Click here for diff

This allows to avoid an unnecessary pin/unpin cycle when storing a  
tuple in an already pinned buffer into a slot, when the pin isn't  
further needed at the call site.  
  
Only a single caller for now (to ensure coverage), but upcoming  
patches will increase use of the new function.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c
M src/backend/executor/nodeTidscan.c
M src/include/executor/tuptable.h

Change lock acquisition order in expand_inherited_rtentry.

commit   : f4b6341d5fcb627d51b3fc89527aa5eaa659fb2e    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 26 Feb 2019 12:22:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 26 Feb 2019 12:22:57 -0500    

Click here for diff

Previously, this function acquired locks in the order using  
find_all_inheritors(), which locks the children of each table that it  
processes in ascending OID order, and which processes the inheritance  
hierarchy as a whole in a breadth-first fashion.  Now, it processes  
the inheritance hierarchy in a depth-first fashion, and at each level  
it proceeds in the order in which tables appear in the PartitionDesc.  
If table inheritance rather than table partitioning is used, the old  
order is preserved.  
  
This change moves the locking of any given partition much closer to  
the code that actually expands that partition.  This seems essential  
if we ever want to allow concurrent DDL to add or remove partitions,  
because if the set of partitions can change, we must use the same data  
to decide which partitions to lock as we do to decide which partitions  
to expand; otherwise, we might expand a partition that we haven't  
locked.  It should hopefully also facilitate efforts to postpone  
inheritance expansion or locking for performance reasons, because  
there's really no way to postpone locking some partitions if  
we're blindly locking them all using find_all_inheritors().  
  
The only downside of this change which is known to me is that it  
further deviates from the principle that we should always lock the  
inheritance hierarchy in find_all_inheritors() order to avoid deadlock  
risk.  However, we've already crossed that bridge in commit  
9eefba181f7782d27d85d7e94e6028371e7ab2d7 and there are futher patches  
pending that make similar changes, so this isn't really giving up  
anything that we haven't surrendered already -- and it seems entirely  
worth it, given the performance benefits some of those changes seem  
likely to bring.  
  
Patch by me; thanks to David Rowley for discussion of these issues.  
  
Discussion: http://postgr.es/m/CAKJS1f_eEYVEq5tM8sm1k-HOwG0AyCPwX54XG9x4w0zy_N4Q_Q@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoZUwPf_uanjF==gTGBMJrn8uCq52XYvAEorNkLrUdoawg@mail.gmail.com  

M src/backend/optimizer/util/inherit.c

Free memory in ecpg bytea regression test.

commit   : 42ccbe4351e4c0b1ad1684323c2fea79c86ae573    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 26 Feb 2019 11:59:35 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 26 Feb 2019 11:59:35 +0100    

Click here for diff

While not really a problem it's easier to run tools like valgrind against it  
when fixed.  

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

Hopefully fixing memory handling issues in ecpglib that Coverity found.

commit   : 0cc0507940c1cf4153fc25c8f6f4f75adada86d0    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 26 Feb 2019 10:56:54 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 26 Feb 2019 10:56:54 +0100    

Click here for diff

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

Simplify some code in pg_rewind when syncing target directory

commit   : 6e52209eb1f830552a5ec220c2bfc3b517535837    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Feb 2019 16:08:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Feb 2019 16:08:24 +0900    

Click here for diff

9a4059d simplified the flush of target data folder when finishing  
processing, and could have done a bit more.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/pg_rewind.c

Remove unneeded argument from _bt_getstackbuf().

commit   : 2ab23445bc6af517bddb40d8429146d8ff8d7ff4    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 25 Feb 2019 17:47:43 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 25 Feb 2019 17:47:43 -0800    

Click here for diff

_bt_getstackbuf() is called at exactly two points following commit  
efada2b8e92 (one call site is concerned with page splits, while the  
other is concerned with page deletion).  The parent buffer returned by  
_bt_getstackbuf() is write-locked in both cases.  Remove the 'access'  
argument and make _bt_getstackbuf() assume that callers require a  
write-lock.  

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

Correct obsolete nbtree page deletion comment.

commit   : 067786cea0f150ccf9350abb9a5ac3e4ad328804    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 25 Feb 2019 16:54:18 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 25 Feb 2019 16:54:18 -0800    

Click here for diff

Commit efada2b8e92, which made the nbtree page deletion algorithm more  
robust, removed _bt_getstackbuf() calls from _bt_pagedel().  It failed  
to update a comment that referenced the earlier approach.  Update the  
comment to explain that the _bt_getstackbuf() page deletion call site  
mirrors the only other remaining _bt_getstackbuf() call site, which is  
reached during page splits.  

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

psql: Remove obsolete code

commit   : b6926dee0e1304368964e1161bfd60dd4b01b25d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Feb 2019 12:00:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Feb 2019 12:00:29 +0100    

Click here for diff

The check in create_help.pl for a null end tag (</>) has been obsolete  
since the conversion from SGML to XML, since XML does not allow that  
anymore.  

M src/bin/psql/create_help.pl

Remove unnecessary use of PROCEDURAL

commit   : bc09d5e4cc1813c9af60c4537fe7d70ed1baae11    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 25 Feb 2019 08:38:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 25 Feb 2019 08:38:59 +0100    

Click here for diff

Remove some unnecessary, legacy-looking use of the PROCEDURAL keyword  
before LANGUAGE.  We mostly don't use this anymore, so some of these  
look a bit old.  
  
There is still some use in pg_dump, which is harder to remove because  
it's baked into the archive format, so I'm not touching that.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/xplang.sgml
M src/backend/commands/proclang.c
M src/include/nodes/parsenodes.h
M src/pl/plperl/plperl–1.0.sql
M src/pl/plperl/plperl–unpackaged–1.0.sql
M src/pl/plperl/plperlu–1.0.sql
M src/pl/plperl/plperlu–unpackaged–1.0.sql
M src/pl/plpgsql/src/plpgsql–1.0.sql
M src/pl/plpgsql/src/plpgsql–unpackaged–1.0.sql
M src/pl/plpython/plpython2u–1.0.sql
M src/pl/plpython/plpython2u–unpackaged–1.0.sql
M src/pl/plpython/plpython3u–1.0.sql
M src/pl/plpython/plpython3u–unpackaged–1.0.sql
M src/pl/plpython/plpythonu–1.0.sql
M src/pl/plpython/plpythonu–unpackaged–1.0.sql
M src/pl/tcl/pltcl–1.0.sql
M src/pl/tcl/pltcl–unpackaged–1.0.sql
M src/pl/tcl/pltclu–1.0.sql
M src/pl/tcl/pltclu–unpackaged–1.0.sql

Make release of 2PC identifier and locks consistent in COMMIT PREPARED

commit   : effe7d9552dd41fd6119404e39eecd2653cd966c    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 25 Feb 2019 14:19:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 25 Feb 2019 14:19:34 +0900    

Click here for diff

When preparing a transaction in two-phase commit, a dummy PGPROC entry  
holding the GID used for the transaction is registered, which gets  
released once COMMIT PREPARED is run.  Prior releasing its shared memory  
state, all the locks taken in the prepared transaction are released  
using a dedicated set of callbacks (pgstat and multixact having similar  
callbacks), which may cause the locks to be released before the GID is  
set free.  
  
Hence, there is a small window where lock conflicts could happen, for  
example:  
- Transaction A releases its locks, still holding its GID in shared  
memory.  
- Transaction B held a lock which conflicted with locks of transaction  
A.  
- Transaction B continues its processing, reusing the same GID as  
transaction A.  
- Transaction B fails because of a conflicting GID, already in use by  
transaction A.  
  
This commit changes the shared memory state release so as post-commit  
callbacks and predicate lock cleanup happen consistently with the shared  
memory state cleanup for the dummy PGPROC entry.  The race window is  
small and 2PC had this issue from the start, so no backpatch is done.  
On top if that fixes discussed involved ABI breakages, which are not  
welcome in stable branches.  
  
Reported-by: Oleksii Kliukin, Ildar Musin  
Diagnosed-by: Oleksii Kliukin, Ildar Musin  
Author: Michael Paquier  
Reviewed-by: Masahiko Sawada, Oleksii Kliukin  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/storage/lmgr/lock.c
M src/include/access/twophase.h

Fix inconsistent out-of-memory error reporting in dsa.c.

commit   : 29ddb548f683e15429cd5464029c01d83c40bb40    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 25 Feb 2019 10:54:12 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 25 Feb 2019 10:54:12 +1300    

Click here for diff

Commit 16be2fd1 introduced the flag DSA_ALLOC_NO_OOM to control whether  
the DSA allocator would raise an error or return InvalidDsaPointer on  
failure to allocate.  One edge case was not handled correctly: if we  
fail to allocate an internal "span" object for a large allocation, we  
would always return InvalidDsaPointer regardless of the flag; a caller  
not expecting that could then dereference a null pointer.  
  
This is a plausible explanation for a one-off report of a segfault.  
  
Remove a redundant pair of braces so that all three stanzas that handle  
DSA_ALLOC_NO_OOM match in style, for visual consistency.  
  
While fixing inconsistencies, if FreePageManagerGet() can't supply the  
pages that our book-keeping says it should be able to supply, then we  
should always report a FATAL error.  Previously we treated that as a  
regular allocation failure in one code path, but as a FATAL condition  
in another.  
  
Back-patch to 10, where dsa.c landed.  
  
Author: Thomas Munro  
Reported-by: Jakub Glapa  
Discussion: https://postgr.es/m/CAEepm=2oPqXxyWQ-1o60tpOLrwkw=VpgNXqqF1VN2EyO9zKGQw@mail.gmail.com  

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

Fix ecpg bugs caused by missing semicolons in the backend grammar.

commit   : 9e138a401d19acc2129ebfd37e7609589210ff67    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Feb 2019 12:51:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Feb 2019 12:51:50 -0500    

Click here for diff

The Bison documentation clearly states that a semicolon is required  
after every grammar rule, and our scripts that generate ecpg's  
grammar from the backend's implicitly assumed this is true.  But it  
turns out that only ancient versions of Bison actually enforce that.  
There have been a couple of rules without trailing semicolons in  
gram.y for some time, and as a consequence, ecpg's grammar was faulty  
and produced wrong output for the affected statements.  
  
To fix, add the missing semis, and add some cross-checks to ecpg's  
scripts so that they'll bleat if we mess this up again.  
  
The cases that were broken were:  
* "SET variable = DEFAULT" (but not "SET variable TO DEFAULT"),  
  as well as allied syntaxes such as ALTER SYSTEM SET ... DEFAULT.  
  These produced syntactically invalid output that the server  
  would reject.  
* Multiple type names in DROP TYPE/DOMAIN commands.  Only the  
  first type name would be listed in the emitted command.  
  
Per report from Daisuke Higuchi.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905DB51CE@g01jpexmbkw24  

M src/backend/parser/gram.y
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl

Tolerate EINVAL when calling fsync() on a directory.

commit   : f16735d80d2fbe1c86f4ac044ee66fe2073b8877    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 24 Feb 2019 23:48:52 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 24 Feb 2019 23:48:52 +1300    

Click here for diff

Previously, we tolerated EBADF as a way for the operating system to  
indicate that it doesn't support fsync() on a directory.  Tolerate  
EINVAL too, for older versions of Linux CIFS.  
  
Bug #15636.  Back-patch all the way.  
  
Reported-by: John Klann  
Discussion: https://postgr.es/m/[email protected]  

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

Tolerate ENOSYS failure from sync_file_range().

commit   : 483520eca426fb1b428e8416d1d014ac5ad80ef4    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 24 Feb 2019 13:38:15 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 24 Feb 2019 13:38:15 +1300    

Click here for diff

One unintended consequence of commit 9ccdd7f6 was that Windows WSL  
users started getting a panic whenever we tried to initiate data  
flushing with sync_file_range(), because WSL does not implement that  
system call.  Previously, they got a stream of periodic warnings,  
which was also undesirable but at least ignorable.  
  
Prevent the panic by handling ENOSYS specially and skipping the panic  
promotion with data_sync_elevel().  Also suppress future attempts  
after the first such failure so that the pre-existing problem of  
noisy warnings is improved.  
  
Back-patch to 9.6 (older branches were not affected in this way by  
9ccdd7f6).  
  
Author: Thomas Munro and James Sewell  
Tested-by: James Sewell  
Reported-by: Bruce Klein  
Discussion: https://postgr.es/m/CA+mCpegfOUph2U4ZADtQT16dfbkjjYNJL1bSTWErsazaFjQW9A@mail.gmail.com  

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

Revert "pg_regress: Don't use absolute paths for the diff"

commit   : f27522553992132d34c67caeea193d57934111cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 23 Feb 2019 09:37:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 23 Feb 2019 09:37:25 +0100    

Click here for diff

This reverts commit 1995552deb5479a50ec9044f0179f906ff7772e0.  
  
Several developers didn't like the new behavior.  

M src/test/regress/pg_regress.c

Fix incorrect function reference in comment of twophase.c

commit   : 4c23216002ac816f67fb87301290fa992115215e    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 23 Feb 2019 08:40:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 23 Feb 2019 08:40:01 +0900    

Click here for diff

The header block of TwoPhaseGetDummyBackendId mentioned incorrectly  
TwoPhaseGetDummyProc.  
  
Reported-by: Oleksii Kliukin  
Discussion: https://postgr.es/m/[email protected]  

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

Add TAP tests for 2PC post-commit callbacks of multixacts at recovery

commit   : b1086767087efe437131b9059fc6f2d3b7c7ecc2    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 23 Feb 2019 08:19:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 23 Feb 2019 08:19:31 +0900    

Click here for diff

The current set of TAP tests for two-phase transactions include some  
coverage for post-commit callbacks of multixact, but it lacked tests for  
testing the recovery of those callbacks.  This commit adds some tests  
with soft and hard restarts in this case, using transactions which  
include DDLs.  
  
Author: Michael Paquier  
Reviewed-by: Oleksii Kliukin  
Discussion: https://postgr.es/m/[email protected]  

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

Fix plan created for inherited UPDATE/DELETE with all tables excluded.

commit   : ab5fcf2b04f9cc4ecccb1832faabadb047087d23    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Feb 2019 12:23:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Feb 2019 12:23:00 -0500    

Click here for diff

In the case where inheritance_planner() finds that every table has  
been excluded by constraints, it thought it could get away with  
making a plan consisting of just a dummy Result node.  While certainly  
there's no updating or deleting to be done, this had two user-visible  
problems: the plan did not report the correct set of output columns  
when a RETURNING clause was present, and if there were any  
statement-level triggers that should be fired, it didn't fire them.  
  
Hence, rather than only generating the dummy Result, we need to  
stick a valid ModifyTable node on top, which requires a tad more  
effort here.  
  
It's been broken this way for as long as inheritance_planner() has  
known about deleting excluded subplans at all (cf commit 635d42e9c),  
so back-patch to all supported branches.  
  
Amit Langote and Tom Lane, per a report from Petr Fedorov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/inherit.out
M src/test/regress/expected/triggers.out
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/triggers.sql

Report correct name in autovacuum "work items" activity

commit   : 98098faaff77a632c759c967f3b956524e492ee4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Feb 2019 13:00:16 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Feb 2019 13:00:16 -0300    

Click here for diff

We were reporting the database name instead of the relation name to  
pg_stat_activity.  Repair.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

Add const qualifier

commit   : 1373ba55c9b9c9a5e4705daa03643255b4de1519    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Feb 2019 09:01:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Feb 2019 09:01:19 +0100    

Click here for diff

New code introduced in 050710b36964dee7e1b2bf6b5ef00041fd5d2787.  The  
lack of const is not currently a compiler warning, but it's nice to  
have for consistency with surrounding code.  

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

Remove duplicate variable declaration in fe-connect.c

commit   : 554ca6954ecbfc54e7159a609b5ffc7921670185    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 22 Feb 2019 13:16:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 22 Feb 2019 13:16:47 +0900    

Click here for diff

The same variables are declared twice when checking if a connection is  
writable, which is useless.  
  
Author: Haribabu Kommi  
Discussion: https://postgr.es/m/CAJrrPGf=rcALB54w_Tg1_hx3y+cgSWaERY-uYSQzGc3Zt5XN4g@mail.gmail.com  

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

Fix mark-and-restore-skipping test case to not be a self-join.

commit   : 24d08f3c0a1f04ea8bac68eb3aa3b069680e43f5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Feb 2019 18:55:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Feb 2019 18:55:29 -0500    

Click here for diff

There isn't any good reason for this test to be a self-join rather  
than a join between separate tables, except that it saved a couple  
of SQL commands for setup.  A proposed patch to optimize away  
self-joins breaks the test, so adjust it to avoid that happening.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Move estimate_hashagg_tablesize to selfuncs.c, and widen result to double.

commit   : 0c7d53793079a1af3f070d93e3eb86a52720f6e7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Feb 2019 14:59:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Feb 2019 14:59:02 -0500    

Click here for diff

It seems to make more sense for this to be in selfuncs.c, since it's  
largely a statistical-estimation thing, and it's related to other  
functions like estimate_hash_bucket_stats that are there.  
  
While at it, change the result type from Size to double.  Perhaps at one  
point it was impossible for the result to overflow an integer, but  
I've got no confidence in that proposition anymore.  Nothing's actually  
done with the result except to compare it to a work_mem-based limit,  
so as long as we don't get an overflow on the way to that comparison,  
things should be fine even with very large dNumGroups.  
  
Code movement proposed by Antonin Houska, type change by me  
  
Discussion: https://postgr.es/m/25767.1549359615@localhost  

M src/backend/optimizer/plan/planner.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Hide other user's pg_stat_ssl rows

commit   : f9692a769b16f53be80f819fa5ee91e28dc7683a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 20 Feb 2019 11:38:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 20 Feb 2019 11:38:44 +0100    

Click here for diff

Change pg_stat_ssl so that an unprivileged user can only see their own  
rows; other rows will be all null.  This makes the behavior consistent  
with pg_stat_activity, where information about where the connection  
came from is also restricted.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/63117976-d02c-c8e2-3aef-caa31a5ab8d3%402ndquadrant.com  

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

doc: Add security information about pg_stat_activity

commit   : 213eae9b8a8a6b2ce3b0e5f5dc86d4b267096398    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Feb 2019 19:49:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Feb 2019 19:49:27 +0100    

Click here for diff

Add a basic note that some columns in pg_stat_activity and related  
views are not visible to all users.  
  
Discussion: https://www.postgresql.org/message-id/3018acd9-e5d8-1e85-5ed7-47276cd77569%402ndquadrant.com  

M doc/src/sgml/monitoring.sgml

pg_regress: Don't use absolute paths for the diff

commit   : 1995552deb5479a50ec9044f0179f906ff7772e0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Feb 2019 18:34:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Feb 2019 18:34:19 +0100    

Click here for diff

Don't expand inputfile and outputfile to absolute paths globally, just  
where needed.  In particular, pass them as is to the file name  
arguments of the diff command, so that we don't see the full absolute  
path in the diff header, which makes the diff unnecessarily verbose  
and harder to read.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/regress/pg_regress.c

Move code for managing PartitionDescs into a new file, partdesc.c

commit   : 1bb5e78218107db543086e71fc162d36a955b08e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Feb 2019 11:38:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Feb 2019 11:38:54 -0500    

Click here for diff

This is similar in spirit to the existing partbounds.c file in the  
same directory, except that there's a lot less code in the new file  
created by this commit.  Pending work in this area proposes to add a  
bunch more code related to PartitionDescs, though, and this will give  
us a good place to put it.  
  
Discussion: http://postgr.es/m/CA+TgmoZUwPf_uanjF==gTGBMJrn8uCq52XYvAEorNkLrUdoawg@mail.gmail.com  

M src/backend/catalog/heap.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execPartition.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/backend/partitioning/Makefile
M src/backend/partitioning/partbounds.c
A src/backend/partitioning/partdesc.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/partition.h
A src/include/partitioning/partdesc.h
M src/include/utils/partcache.h

Delay lock acquisition for partitions until we route a tuple to them.

commit   : 9eefba181f7782d27d85d7e94e6028371e7ab2d7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 21 Feb 2019 11:24:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 21 Feb 2019 11:24:40 -0500    

Click here for diff

Instead of locking all partitions to which we might route a tuple at  
executor startup, just lock them as we use them.  In some cases such a  
partition might get locked at executor startup anyway because it  
appears in the query's range table for some other reason, but in other  
cases this is a bit savings.  
  
This changes the order in which partitions are locked in some cases,  
which might conceivably create deadlock hazards that don't exist  
today, but per discussion, it seems like such cases should be rare  
enough that we can neglect them in favor of improving performance.  
  
David Rowley, reviewed and tested by Tomas Vondra, Sho Kato, John  
Naylor, Tom Lane, and me.  
  
Discussion: http://postgr.es/m/CAKJS1f-=FnMqmQP6qitkD+xEddxw22ySLP-0xFk3JAqUX2yfMw@mail.gmail.com  

M src/backend/executor/execPartition.c

Fix dbtoepub output file name

commit   : 7aa00d2464b4e14d553e8a64adacfe9741939e14    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 21 Feb 2019 15:39:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 21 Feb 2019 15:39:37 +0100    

Click here for diff

In previous releases, the input file of dbtoepub was postgres.xml, and  
dbtoepub knows to derive the output file name postgres.epub from that  
automatically.  But now the intput file is postgres.sgml (since  
postgres.sgml is itself an XML file and we no longer need the  
intermediate postgres.xml file), but dbtoepub doesn't know how to deal  
with the .sgml suffix, so the automatically derived output file name  
becomes postgres.sgml.epub.  Fix by adding an explicit -o option.  

M doc/src/sgml/Makefile

Speed up match_eclasses_to_foreign_key_col() when there are many ECs.

commit   : fa86238f1eac5b1bfb3887d2deb138f53da82c9b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Feb 2019 20:53:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Feb 2019 20:53:08 -0500    

Click here for diff

Check ec_relids before bothering to iterate through the EC members.  
On a perhaps extreme, but still real-world, query in which  
match_eclasses_to_foreign_key_col() accounts for the bulk of the  
planner's runtime, this saves nearly 40% of the runtime.  It's a bit  
of a stopgap fix, but it's simple enough to be back-patched to 9.6  
where this code came in; so let's do that.  
  
David Rowley  
  
Discussion: https://postgr.es/m/[email protected]  

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

Use an unsigned char for bool if we don't use the native bool.

commit   : d26a810ebf9e419556a60bdc0a4190883c38f4c4    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 20 Feb 2019 21:31:02 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 20 Feb 2019 21:31:02 +0000    

Click here for diff

On (rare) platforms where sizeof(bool) > 1, we need to use our own  
bool, but imported c99 code (such as Ryu) may want to use bool values  
as array subscripts, which elicits warnings if bool is defined as  
char. Using unsigned char instead should work just as well for our  
purposes, and avoid such warnings.  
  
Per buildfarm members prariedog and locust.  

M src/include/c.h

Improve planner's understanding of strictness of type coercions.

commit   : e04a3905e4f2e93bbd8fca08c3baeed7b15a48cf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Feb 2019 14:39:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Feb 2019 14:39:11 -0500    

Click here for diff

PG type coercions are generally strict, ie a NULL input must produce  
a NULL output (or, in domain cases, possibly an error).  The planner's  
understanding of that was a bit incomplete though, so improve it:  
  
* Teach contain_nonstrict_functions() that CoerceViaIO can always be  
considered strict.  Previously it believed that only if the underlying  
I/O functions were marked strict, which is often but not always true.  
  
* Teach clause_is_strict_for() that CoerceViaIO, ArrayCoerceExpr,  
ConvertRowtypeExpr, CoerceToDomain can all be considered strict.  
Previously it knew nothing about any of them.  
  
The main user-visible impact of this is that IS NOT NULL predicates  
can be proven to hold from expressions involving casts in more cases  
than before, allowing partial indexes with such predicates to be used  
without extra pushups.  This reduces the surprise factor for users,  
who may well be used to ordinary (function-call-based) casts being  
known to be strict.  
  
Per a gripe from Samuel Williams.  This doesn't rise to the level of  
a bug, IMO, so no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/predtest.c

Fix incorrect strictness test for ArrayCoerceExpr expressions.

commit   : 1571bc0f0613a82befe1a6eda39df161777231ad    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Feb 2019 13:36:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Feb 2019 13:36:55 -0500    

Click here for diff

The recursion in contain_nonstrict_functions_walker() was done wrong,  
causing the strictness check to be bypassed for a parse node that  
is the immediate input of an ArrayCoerceExpr node.  This could allow,  
for example, incorrect decisions about whether a strict SQL function  
can be inlined.  
  
I didn't add a regression test, because (a) the bug is so narrow  
and (b) I couldn't think of a test case that wasn't dependent on a  
large number of other behaviors, to the point where it would likely  
soon rot to the point of not testing what it was intended to.  
  
I broke this in commit c12d570fa, so back-patch to v11.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/clauses.c

Make object address handling more robust

commit   : 5721b9b3ceaa57219244954a6084d107b73082b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Feb 2019 09:12:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Feb 2019 09:12:02 -0300    

Click here for diff

pg_identify_object_as_address crashes when passed certain tuples from  
inconsistent system catalogs.  Make it more defensive.  
  
Author: Álvaro Herrera  
Reviewed-by: Michaël Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaddress.c

Doc: Update the documentation for FSM behavior for small tables.

commit   : 29d108cdecbe918452e70041d802cc515b2d56b8    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 20 Feb 2019 17:37:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 20 Feb 2019 17:37:39 +0530    

Click here for diff

In commit b0eaa4c51b, we have avoided the creation of FSM for small tables.  
So the functions that use FSM to compute the free space can return zero for  
such tables.  This was previously also possible for the cases where the  
vacuum has not been triggered to update FSM.  
  
This commit updates the comments in code and documentation to reflect this  
behavior.  
  
Author: John Naylor  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CACPNZCtba-3m1q3A8gxA_vxg=T7gQf7gMbpR4Ciy5LntY-j+0Q@mail.gmail.com  

M contrib/pgstattuple/pgstatapprox.c
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgstattuple.sgml

Fix DEFAULT-handling in multi-row VALUES lists for updatable views.

commit   : 41531e42d34f4aca117d343b5e40f3f757dec5fe    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 20 Feb 2019 08:30:21 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 20 Feb 2019 08:30:21 +0000    

Click here for diff

INSERT ... VALUES for a single VALUES row is implemented differently  
from a multi-row VALUES list, which causes inconsistent behaviour in  
the way that DEFAULT items are handled. In particular, when inserting  
into an auto-updatable view on top of a table with a column default, a  
DEFAULT item in a single VALUES row gets correctly replaced with the  
table column's default, but for a multi-row VALUES list it is replaced  
with NULL.  
  
Fix this by allowing rewriteValuesRTE() to leave DEFAULT items in the  
VALUES list untouched if the target relation is an auto-updatable view  
and has no column default, deferring DEFAULT-expansion until the query  
against the base relation is rewritten. For all other types of target  
relation, including tables and trigger- and rule-updatable views, we  
must continue to replace DEFAULT items with NULL in the absence of a  
column default.  
  
This is somewhat complicated by the fact that if an auto-updatable  
view has DO ALSO rules attached, the VALUES lists for the product  
queries need to be handled differently from the original query, since  
the product queries need to act like rule-updatable views whereas the  
original query has auto-updatable view semantics.  
  
Back-patch to all supported versions.  
  
Reported by Roger Curley (bug #15623). Patch by Amit Langote and me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Mark correctly initial slot snapshots with MVCC type when built

commit   : 56fadbedbd2f697400b89e7b767cfa4ec67932d6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Feb 2019 12:31:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Feb 2019 12:31:07 +0900    

Click here for diff

When building an initial slot snapshot, snapshots are marked with  
historic MVCC snapshots as type with the marker field being set in  
SnapBuildBuildSnapshot() but not overriden in SnapBuildInitialSnapshot().  
Existing callers of SnapBuildBuildSnapshot() do not care about the type  
of snapshot used, but extensions calling it actually may, as reported.  
  
While on it, mark correctly the snapshot type when importing one.  This  
is cosmetic as the field is enforced to 0.  
  
Author: Antonin Houska  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/23215.1527665193@localhost  
Backpatch-through: 9.4  

M src/backend/replication/logical/snapbuild.c
M src/backend/utils/time/snapmgr.c

Use varargs macro for CACHEDEBUG

commit   : 90cfa49003831dbea109a9f0a7924dc95c1bf1c5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Feb 2019 12:32:34 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Feb 2019 12:32:34 +0100    

Click here for diff

Reviewed-by: Andres Freund <[email protected]>  

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

Fix omissions in ecpg/test/sql/.gitignore.

commit   : 315dcffb949bba8d2a002664bb6c4718e28b803b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Feb 2019 21:24:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Feb 2019 21:24:38 -0500    

Click here for diff

Oversights in commits 050710b36 and e81f0e311.  

M src/interfaces/ecpg/test/sql/.gitignore

Remove line duplicated during conflict resolution.

commit   : 22bc403029c096639a74d7c91069bf9e8a35460f    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Feb 2019 11:07:30 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Feb 2019 11:07:30 -0800    

Click here for diff

I included the duplicated ExecTypeFromTL in 578b2297 "Remove WITH OIDS  
support".  
  
Reported-By: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c

De-clutter display of script runtimes in pg_regress.

commit   : 93b5cc039e2328b7ac256de57a25c810d50a7f29    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Feb 2019 11:16:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Feb 2019 11:16:39 -0500    

Click here for diff

Add more whitespace, per suggestion from Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Provide an extra-float-digits setting for pg_dump / pg_dumpall

commit   : af25bc03e17eb0aba195e42506b1a15f47178e44    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 18 Feb 2019 07:22:00 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 18 Feb 2019 07:22:00 -0500    

Click here for diff

Changes made by commit 02ddd49 mean that dumps made against pre version  
12 instances are no longer comparable with those made against version 12  
or later instances. This makes cross-version upgrade testing fail in the  
buildfarm. Experimentation has shown that the error is cured if the  
dumps are made when extra_float_digits is set to 0. Hence this patch  
allows for it to be explicitly set rather than relying on pg_dump's  
builtin default (3 in almost all cases). This feature might have other  
uses, but should not normally be used.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c

Properly end string to make sure ecpglib does not read beyond its boundaries.

commit   : 8e6ab9f8012ff54d2e3cf2804db811e5f8eada1b    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 18 Feb 2019 12:52:53 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 18 Feb 2019 12:52:53 +0100    

Click here for diff

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

Sync ECPG's CREATE TABLE AS statement with backend's.

commit   : e81f0e3113e6d9791285e6629d5301759839f3c9    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 18 Feb 2019 11:57:34 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 18 Feb 2019 11:57:34 +0100    

Click here for diff

Author: Higuchi-san ("Higuchi, Daisuke" <[email protected]>)  

M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-createtableas.c
A src/interfaces/ecpg/test/expected/sql-createtableas.stderr
A src/interfaces/ecpg/test/expected/sql-createtableas.stdout
M src/interfaces/ecpg/test/sql/Makefile
A src/interfaces/ecpg/test/sql/createtableas.pgc

Add bytea datatype to ECPG.

commit   : 050710b36964dee7e1b2bf6b5ef00041fd5d2787    
  
author   : Michael Meskes <[email protected]>    
date     : Mon, 18 Feb 2019 10:20:31 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Mon, 18 Feb 2019 10:20:31 +0100    

Click here for diff

So far ECPG programs had to treat binary data for bytea column as 'char' type.  
But this meant converting from/to escaped format with PQunescapeBytea/  
PQescapeBytea() and therefore forcing users to add unnecessary code and cost  
for the conversion in runtime. By adding a dedicated datatype for bytea most of  
this special handling is no longer needed.  
  
Author: Matsumura-san ("Matsumura, Ryo" <[email protected]>)  
  
Discussion: https://postgr.es/m/flat/03040DFF97E6E54E88D3BFEE5F5480F737A141F9@G01JPEXMBYT04  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/ecpglib/typename.c
M src/interfaces/ecpg/include/ecpgtype.h
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/variable.c
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-bytea.c
A src/interfaces/ecpg/test/expected/sql-bytea.stderr
A src/interfaces/ecpg/test/expected/sql-bytea.stdout
M src/interfaces/ecpg/test/sql/Makefile
A src/interfaces/ecpg/test/sql/bytea.pgc

Save PathTargets for distinct/ordered relations in root->upper_targets[].

commit   : 3fdc374b5d24b08119a91555ca2fae427af0b085    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 18 Feb 2019 16:13:46 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 18 Feb 2019 16:13:46 +0900    

Click here for diff

For the convenience of extensions, we previously only saved PathTargets  
for grouped, window, and final relations in root->upper_targets[] in  
grouping_planner().  To improve the convenience, save PathTargets for  
distinct and ordered relations as well.  
  
Author: Antonin Houska, with an additional change by me  
Discussion: https://postgr.es/m/10994.1549559088@localhost  

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

Fix some issues with TAP tests of pg_basebackup and pg_verify_checksums

commit   : a916bdc496a9d3fde48ca7c72478e7e4aecc5597    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Feb 2019 14:23:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Feb 2019 14:23:30 +0900    

Click here for diff

ee9e145 has fixed the tests of pg_basebackup for checksums a first time,  
still one seek() call missed the shot.  Also, the data written in files  
to emulate corruptions was not actually writing zeros as the quoting  
style was incorrect.  
  
Backpatch the portion for pg_basebackup to v11 where these tests have  
been introduced.  The tests of pg_verify_checksums are new as of v12.  
  
Author: Michael Banck  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_verify_checksums/t/002_actions.pl

Fix typo in transam.h for OIDs assigned by genbki.pl

commit   : f0cce9fcb5fd9f4158dbf5dfe11f263ad3b7b1dd    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Feb 2019 12:44:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Feb 2019 12:44:25 +0900    

Click here for diff

The actual range of reserved OIDs in this case is [11000,11999] and not  
[11000,12000].  
  
Author: John Naylor  
Discussion: https://postgr.es/m/CAJVSVGV5StmK-inxbmrf0nLbBGeaAKnjnqxXmk+4ufeav8JMSA@mail.gmail.com  

M src/include/access/transam.h

Avoid some unnecessary block reads in WAL reader

commit   : 0dd6ff0ac8482f753405c5bdb091d2a8adc58e75    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Feb 2019 09:52:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Feb 2019 09:52:02 +0900    

Click here for diff

When reading a new page internally and depending on the way the WAL  
reader facility gets used by plugins, the current implementation of the  
WAL reader may finish by reading a block multiple times while it is not  
actually necessary as the requested data length may be equal to what has  
been already read.  This can happen for any size, but is more likely to  
happen at the end of a page.  This can cause performance penalties in  
plugins which rely on the block reads to be purely sequential, zlib not  
liking backward reads for example.  The new behavior also shaves some  
cycles when doing recovery.  
  
Author: Arthur Zakirov  
Reviewed-by: Andrey Lepikhov, Michael Paquier, Grigory Smolkin  
Discussion: https://postgr.es/m/[email protected]  

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

Fix race in dsm_unpin_segment() when handles are reused.

commit   : 0b55aaacec313c309e21f63d9ff5733c3f8ab813    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 18 Feb 2019 09:53:26 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 18 Feb 2019 09:53:26 +1300    

Click here for diff

Teach dsm_unpin_segment() to skip segments that are in the process  
of being destroyed by another backend, when searching for a handle.  
Such a segment cannot possibly be the one we are looking for, even  
if its handle matches.  Another slot might hold a recently created  
segment that has the same handle value by coincidence, and we need  
to keep searching for that one.  
  
The bug caused rare "cannot unpin a segment that is not pinned"  
errors on 10 and 11.  Similar to commit 6c0fb941 for dsm_attach().  
  
Back-patch to 10, where dsm_unpin_segment() landed.  
  
Author: Thomas Munro  
Reported-by: Justin Pryzby  
Tested-by: Justin Pryzby (along with other recent DSA/DSM fixes)  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : bc6d7eb689a2d083df981dfd10c65d1a9d32ca64    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 17 Feb 2019 13:15:14 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 17 Feb 2019 13:15:14 -0500    

Click here for diff

The dblink documentation claims that an empty string is returned if there  
has been no error, however OK is actually returned in that case. Also,  
clarify that an async error may not be seen unless dblink_is_busy() or  
dblink_get_result() have been called first.  
  
Backpatch to all supported branches.  
  
Reported-by: realyota  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/dblink.sgml

Fix CREATE VIEW to allow zero-column views.

commit   : a32ca7883629f6b1fbbf0bd2e2aa11ec86edb6b3    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Feb 2019 12:37:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Feb 2019 12:37:31 -0500    

Click here for diff

We should logically have allowed this case when we allowed zero-column  
tables, but it was overlooked.  
  
Although this might be thought a feature addition, it's really a bug  
fix, because it was possible to create a zero-column view via  
the convert-table-to-view code path, and then you'd have a situation  
where dump/reload would fail.  Hence, back-patch to all supported  
branches.  
  
Arrange the added test cases to provide coverage of the related  
pg_dump code paths (since these views will be dumped and reloaded  
during the pg_upgrade regression test).  I also made them test  
the case where pg_dump has to postpone the view rule into post-data,  
which disturbingly had no regression coverage before.  
  
Report and patch by Ashutosh Sharma (test case by me)  
  
Discussion: https://postgr.es/m/CAE9k0PkmHdeSaeZt2ujnb_cKucmK3sDDceDzw7+d5UZoNJPYOg@mail.gmail.com  

M src/backend/commands/view.c
M src/test/regress/expected/create_view.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/create_view.sql

Mark pg_config() stable rather than immutable

commit   : 290e3b77fde9cd063e20d96b1241566a429943de    
  
author   : Joe Conway <[email protected]>    
date     : Sun, 17 Feb 2019 09:21:13 -0500    
  
committer: Joe Conway <[email protected]>    
date     : Sun, 17 Feb 2019 09:21:13 -0500    

Click here for diff

pg_config() has been marked immutable since its inception. As part of a  
larger discussion around the definition of immutable versus stable and  
related implications for marking functions parallel safe raised by  
Andres, the consensus was clearly that pg_config() is stable, since  
it could possibly change output even for the same minor version with  
a recompile or installation of a new binary. So mark it stable.  
  
Theoretically this could/should be backpatched, but it was deemed to be not  
worth the effort since in practice this is very unlikely to cause problems  
in the real world.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/pg_proc.dat

Doc: remove ancient comment.

commit   : 69e5247879291b0164b38d17526658a72884fbe8    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sun, 17 Feb 2019 20:23:10 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sun, 17 Feb 2019 20:23:10 +0900    

Click here for diff

There's a very old comment in rules.sgml added back to 2003.  It  
expected to a feature coming back but it never happened. So now we can  
safely remove the comment. Back-patched to all supported branches.  
  
Discussion: https://postgr.es/m/20190211.191004.219630835457494660.t-ishii%40sraoss.co.jp  

M doc/src/sgml/rules.sgml

Fix CLogTruncationLock documentation.

commit   : 301de4f7d92ffe5451d34da2edd36284f3887493    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 17 Feb 2019 00:51:11 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 17 Feb 2019 00:51:11 -0800    

Click here for diff

Back-patch to v10, which introduced the lock.  

M doc/src/sgml/monitoring.sgml

Suppress another case of MSVC warning 4146.

commit   : faee6fae6d09fb5d8c809946a113eb70c2968892    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 16 Feb 2019 15:28:27 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 16 Feb 2019 15:28:27 -0800    

Click here for diff

M contrib/pgcrypto/imath.c

In imath.h, replace stdint.h usage with c.h equivalents.

commit   : 04a87ae2626311e922cf964d1e7d42a5ef7d87bf    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 16 Feb 2019 15:28:27 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 16 Feb 2019 15:28:27 -0800    

Click here for diff

As things stood, buildfarm member dory failed.  MSVC versions lacking  
stdint.h are unusable for building PostgreSQL, but pg_config.h.win32  
doesn't know that.  Even so, we support other systems lacking stdint.h,  
including buildfarm member gaur.  Per a suggestion from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/imath.c
M contrib/pgcrypto/imath.h

Remove float8-small-is-zero regression test variant.

commit   : 6ee89952d4e944b5c9c26181d418395b2f5d5fd8    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 16 Feb 2019 22:11:04 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 16 Feb 2019 22:11:04 +0000    

Click here for diff

Since this was also the variant used as an example in the docs, update  
the docs to use float4-misrounded-input as an example instead, since  
that is now the only remaining variant file.  

M doc/src/sgml/regress.sgml
D src/test/regress/expected/float8-small-is-zero.out

Import changes from IMath versions (1.3, 1.29].

commit   : 48e24ba6b7fd3bfd156b51e8d768fd48df0d288b    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 16 Feb 2019 13:12:28 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 16 Feb 2019 13:12:28 -0800    

Click here for diff

Upstream fixed bugs over the years, but none are confirmed to have  
affected pgcrypto.  We're better off naively tracking upstream than  
reactively maintaining a twelve-year-old snapshot of upstream.  Add a  
header comment describing the synchronization procedure.  Discard use of  
INVERT_COMPARE_RESULT(); the domain of the comparisons in question is  
{-1,0,1}, controlled entirely by code in imath.c.  
  
Andrew Gierth reviewed the Makefile change.  Tom Lane reviewed the  
synchronization procedure description.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/Makefile
M contrib/pgcrypto/imath.c
M contrib/pgcrypto/imath.h

Fix PERMIT_DECLARATION_AFTER_STATEMENT initialization.

commit   : d1299aabbd0b4ae860078691b628dc6b90698039    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 16 Feb 2019 13:12:28 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 16 Feb 2019 13:12:28 -0800    

Click here for diff

The defect caused a mere warning and only for gcc versions before 3.4.0.  

M configure
M configure.in

Allow user control of CTE materialization, and change the default behavior.

commit   : 608b167f9f9c4553c35bb1ec0eab9ddae643989b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Feb 2019 16:11:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Feb 2019 16:11:12 -0500    

Click here for diff

Historically we've always materialized the full output of a CTE query,  
treating WITH as an optimization fence (so that, for example, restrictions  
from the outer query cannot be pushed into it).  This is appropriate when  
the CTE query is INSERT/UPDATE/DELETE, or is recursive; but when the CTE  
query is non-recursive and side-effect-free, there's no hazard of changing  
the query results by pushing restrictions down.  
  
Another argument for materialization is that it can avoid duplicate  
computation of an expensive WITH query --- but that only applies if  
the WITH query is called more than once in the outer query.  Even then  
it could still be a net loss, if each call has restrictions that  
would allow just a small part of the WITH query to be computed.  
  
Hence, let's change the behavior for WITH queries that are non-recursive  
and side-effect-free.  By default, we will inline them into the outer  
query (removing the optimization fence) if they are called just once.  
If they are called more than once, we will keep the old behavior by  
default, but the user can override this and force inlining by specifying  
NOT MATERIALIZED.  Lastly, the user can force the old behavior by  
specifying MATERIALIZED; this would mainly be useful when the query had  
deliberately been employing WITH as an optimization fence to prevent a  
poor choice of plan.  
  
Andreas Karlsson, Andrew Gierth, David Fetter  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/select.sgml
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/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/parser/gram.y
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rowtypes.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/subselect.sql

Fix previous MinGW fix.

commit   : 79730e2a9bb1ce7837feddd16208ff2d9e490118    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 16 Feb 2019 15:21:10 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 16 Feb 2019 15:21:10 +0000    

Click here for diff

Definitions required for MinGW need to be outside #if _MSC_VER. Oops.  

M src/include/port/win32_port.h

Add DECLARE STATEMENT support to ECPG.

commit   : bd7c95f0c1a38becffceb3ea7234d57167f6d4bf    
  
author   : Michael Meskes <[email protected]>    
date     : Sat, 16 Feb 2019 10:55:17 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Sat, 16 Feb 2019 10:55:17 +0100    

Click here for diff

DECLARE STATEMENT is a statement that lets users declare an identifier  
pointing at a connection.  This identifier will be used in other embedded  
dynamic SQL statement such as PREPARE, EXECUTE, DECLARE CURSOR and so on.  
When connecting to a non-default connection, the AT clause can be used in  
a DECLARE STATEMENT once and is no longer needed in every dynamic SQL  
statement.  This makes ECPG applications easier and more efficient.  Moreover,  
writing code without designating connection explicitly improves portability.  
  
Authors: Ideriha-san ("Ideriha, Takeshi" <[email protected]>)  
         Kuroda-san ("Kuroda, Hayato" <[email protected]>)  
  
Discussion: https://postgr.es/m4E72940DA2BF16479384A86D54D0988A565669DF@G01JPEXMBKW04  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/connect.c
A src/interfaces/ecpg/ecpglib/cursor.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/exports.txt
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/include/ecpgerrno.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/ecpgtype.h
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/ecpg_schedule
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/preproc-autoprep.c
M src/interfaces/ecpg/test/expected/preproc-cursor.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
M src/interfaces/ecpg/test/expected/sql-binary.c
A src/interfaces/ecpg/test/expected/sql-declare.c
A src/interfaces/ecpg/test/expected/sql-declare.stderr
A src/interfaces/ecpg/test/expected/sql-declare.stdout
M src/interfaces/ecpg/test/expected/sql-desc.c
M src/interfaces/ecpg/test/expected/sql-dyntest.c
M src/interfaces/ecpg/test/expected/sql-execute.c
M src/interfaces/ecpg/test/expected/sql-fetch.c
M src/interfaces/ecpg/test/expected/sql-oldexec.c
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/sql/.gitignore
M src/interfaces/ecpg/test/sql/Makefile
A src/interfaces/ecpg/test/sql/declare.pgc

Make use of compiler builtins and/or assembly for CLZ, CTZ, POPCNT.

commit   : 02a6a54ecd6632f974b1b4eebfb2373363431084    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Feb 2019 23:22:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Feb 2019 23:22:27 -0500    

Click here for diff

Test for the compiler builtins __builtin_clz, __builtin_ctz, and  
__builtin_popcount, and make use of these in preference to  
handwritten C code if they're available.  Create src/port  
infrastructure for "leftmost one", "rightmost one", and "popcount"  
so as to centralize these decisions.  
  
On x86_64, __builtin_popcount generally won't make use of the POPCNT  
opcode because that's not universally supported yet.  Provide code  
that checks CPUID and then calls POPCNT via asm() if available.  
This requires indirecting through a function pointer, which is  
an annoying amount of overhead for a one-instruction operation,  
but it's probably not worth working harder than this for our  
current use-cases.  
  
I'm not sure we've found all the existing places that could profit  
from this new infrastructure; but we at least touched all the  
ones that used copied-and-pasted versions of the bitmapset.c code,  
and got rid of multiple copies of the associated constant arrays.  
  
While at it, replace c-compiler.m4's one-per-builtin-function  
macros with a single one that can handle all the cases we need  
to worry about so far.  Also, because I'm paranoid, make those  
checks into AC_LINK checks rather than just AC_COMPILE; the  
former coding failed to verify that libgcc has support for the  
builtin, in cases where it's not inline code.  
  
David Rowley, Thomas Munro, Alvaro Herrera, Tom Lane  
  
Discussion: https://postgr.es/m/CAKJS1f9WTAGG1tPeJnD18hiQW5gAk59fQ6WK-vfdAKEHyRg2RA@mail.gmail.com  

M config/c-compiler.m4
M configure
M configure.in
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M contrib/pg_trgm/trgm_gist.c
M src/backend/access/heap/visibilitymap.c
M src/backend/lib/bloomfilter.c
M src/backend/nodes/bitmapset.c
M src/backend/utils/adt/tsgistidx.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
A src/include/port/pg_bitutils.h
M src/port/Makefile
A src/port/pg_bitutils.c
M src/tools/msvc/Mkvcbuild.pm

Cygwin and Mingw floating-point fixes.

commit   : 72880ac182c8f3769f0be868f77166994282cb2a    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 16 Feb 2019 01:50:16 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 16 Feb 2019 01:50:16 +0000    

Click here for diff

Deal with silent-underflow errors in float4 for cygwin and mingw by  
using our strtof() wrapper; deal with misrounding errors by adding  
them to the resultmap. Some slight reorganization of declarations was  
done to avoid duplicating material between cygwin.h and win32_port.h.  
  
While here, remove from the resultmap all references to  
float8-small-is-zero; inspection of cygwin output suggests it's no  
longer required there, and the freebsd/netbsd/openbsd entries should  
no longer be necessary (these date back to c. 2000). This commit  
doesn't remove the file itself nor the documentation references for  
it; that will happen in a subsequent commit if all goes well.  

M configure
M configure.in
M src/include/port.h
M src/include/port/cygwin.h
M src/include/port/win32_port.h
M src/port/strtof.c
M src/test/regress/resultmap

Revert attempts to use POPCNT etc instructions

commit   : 457aef0f1fd365c68fab3fa2ca3ae48c5bd230c6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 Feb 2019 16:32:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 Feb 2019 16:32:30 -0300    

Click here for diff

This reverts commits fc6c72747ae6, 109de05cbb03, d0b4663c23b7 and  
711bab1e4d19.  
  
Somebody will have to try harder before submitting this patch again.  
I've spent entirely too much time on it already, and the #ifdef maze yet  
to be written in order for it to build at all got on my nerves.  The  
amount of work needed to get a platform-specific performance improvement  
that's barely above the noise level is not worth it.  

M config/c-compiler.m4
M configure
M configure.in
M src/Makefile.global.in
M src/backend/access/heap/visibilitymap.c
M src/backend/lib/bloomfilter.c
M src/backend/nodes/bitmapset.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
D src/include/port/pg_bitutils.h
M src/port/Makefile
D src/port/pg_bitutils.c
D src/port/pg_bitutils_hwpopcnt.c
M src/tools/msvc/Mkvcbuild.pm

Refactor index cost estimation functions in view of IndexClause changes.

commit   : e89f14e2bb9f7c392c4c85a53ab5a13ea2aed83d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Feb 2019 13:05:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Feb 2019 13:05:19 -0500    

Click here for diff

Get rid of deconstruct_indexquals() in favor of just iterating over the  
IndexClause list directly.  The extra services that that function used to  
provide, such as hiding clause commutation and associating the right index  
column with each clause, are no longer useful given the new data structure.  
I'd originally thought that it'd provide a useful amount of abstraction  
by freeing callers from paying attention to the exact clause type of each  
indexqual, but that hope proves to have been vain, because few callers can  
ignore the semantic differences between different clause types.  Indeed,  
removing it results in a net code savings, and probably some cycles shaved  
by not having to build an extra list-of-structs data structure.  
  
Also, export a few formerly-static support functions, with the goal  
of allowing extension AMs to write functionality equivalent to  
genericcostestimate() without pointless code duplication.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blcost.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Fix compiler builtin usage in new pg_bitutils.c

commit   : fc6c72747ae6db6909fcd7d1adbc3d923ec1fffa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 15 Feb 2019 13:07:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 15 Feb 2019 13:07:02 -0300    

Click here for diff

Split out these new functions in three parts: one in a new file that  
uses the compiler builtin and gets compiled with the -mpopcnt compiler  
option if it exists; another one that uses the compiler builtin but not  
the compiler option; and finally the fallback with open-coded  
algorithms.  
  
Split out the configure logic: in the original commit, it was selecting  
to use the -mpopcnt compiler switch together with deciding whether to  
use the compiler builtin, but those two things are really separate.  
Split them out.  Also, expose whether the builtin exists to  
Makefile.global, so that src/port's Makefile can decide whether to  
compile the hw-optimized file.  
  
Remove CPUID test for CTZ/CLZ.  Make pg_{right,left}most_ones use either  
the compiler intrinsic or open-coded algo; trying to use the  
HW-optimized version is a waste of time.  Make them static inline  
functions.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.in
M src/Makefile.global.in
M src/include/port/pg_bitutils.h
M src/port/Makefile
M src/port/pg_bitutils.c
A src/port/pg_bitutils_hwpopcnt.c

doc: Update README.links

commit   : b060e6c1f5b4609718468a0b6562dd03db26ea46    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 15 Feb 2019 17:29:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 15 Feb 2019 17:29:41 +0100    

Click here for diff

The guideline to "not use text with <ulink> so the URL appears in  
printed output" is obsolete, since the URL appears as a footnote in  
printed output in that case.  
  
Reported-by: Chapman Flack <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/README.links

Use standard diff separator for regression.diffs

commit   : 8f27a14b1bd3d906144356ce19e33a2fd0095141    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jan 2019 21:24:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jan 2019 21:24:51 +0100    

Click here for diff

Instead of ======..., use the standard separator for a multi-file  
diff, which is, per POSIX,  
  
    "diff %s %s %s\n", <diff_options>, <filename1>, <filename2>  
  
This makes regression.diffs behave more like a proper diff file, for  
use with other tools.  And it shows the diff options used, for  
clarity.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/regress/pg_regress.c

Fix support for CREATE TABLE IF NOT EXISTS AS EXECUTE

commit   : 331a613e9d363febfee8508e8de545fd84624758    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 15 Feb 2019 17:12:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 15 Feb 2019 17:12:24 +0900    

Click here for diff

The grammar IF NOT EXISTS for CTAS is supported since 9.5 and documented  
as such, however the case of using EXECUTE as query has never been  
covered as EXECUTE CTAS statements and normal CTAS statements are parsed  
separately.  
  
Author: Andreas Karlsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/backend/parser/gram.y
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Fix race in dsm_attach() when handles are reused.

commit   : 6c0fb941892519ad6b8873e99c4001404fb9a128    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 15 Feb 2019 10:19:11 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 15 Feb 2019 10:19:11 +1300    

Click here for diff

DSM handle values can be reused as soon as the underlying shared memory  
object has been destroyed.  That means that for a brief moment we  
might have two DSM slots with the same handle.  While trying to attach,  
if we encounter a slot with refcnt == 1, meaning that it is currently  
being destroyed, we should continue our search in case the same handle  
exists in another slot.  
  
The race manifested as a rare "dsa_area could not attach to segment"  
error, and was more likely in 10 and 11 due to the lack of distinct  
seed for random() in parallel workers.  It was made very unlikely in  
in master by commit 197e4af9, and older releases don't usually create  
new DSM segments in background workers so it was also unlikely there.  
  
This fixes the root cause of bug report #15585, in which the error  
could also sometimes result in a self-deadlock in the error path.  
It's not yet clear if further changes are needed to avoid that failure  
mode.  
  
Back-patch to 9.4, where dsm.c arrived.  
  
Author: Thomas Munro  
Reported-by: Justin Pryzby, Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

Simplify the planner's new representation of indexable clauses a little.

commit   : 8fd3fdd85a3e22f04b2cb0949450f63cb48952cd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Feb 2019 19:37:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Feb 2019 19:37:30 -0500    

Click here for diff

In commit 1a8d5afb0, I thought it'd be a good idea to define  
IndexClause.indexquals as NIL in the most common case where the given  
clause (IndexClause.rinfo) is usable exactly as-is.  It'd be more  
consistent to define the indexquals in that case as being a one-element  
list containing IndexClause.rinfo, but I thought saving the palloc  
overhead for making such a list would be worthwhile.  
  
In hindsight, that was a great example of "premature optimization is the  
root of all evil": it's complicated everyplace that needs to deal with  
the indexquals, requiring duplicative code to handle both the simple  
case and the not-simple case.  I'd initially found that tolerable but  
it's getting less so as I mop up some areas that I'd not touched in  
1a8d5afb0.  In any case, two more pallocs during a planner run are  
surely at the noise level (a conclusion confirmed by a bit of  
microbenchmarking).  So let's change this decision before it becomes  
set in stone, and insist that IndexClause.indexquals always be a valid  
list of the actual index quals for the clause.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/pathnodes.h

Get rid of another unconstify through API changes

commit   : 86eea78694ce0d95e74cc82cc29c096d66a9accd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Feb 2019 20:44:47 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Feb 2019 20:44:47 +0100    

Click here for diff

This also makes the code in read_client_first_message() more similar  
to read_client_final_message().  
  
Reported-by: Mark Dilger <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/53a28052-f9f3-1808-fed9-460fd43035ab%402ndquadrant.com  

M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/include/libpq/scram.h

Resolve one unconstify use

commit   : 4b3b07fd5d60cffc95cabf34246d71d15b0c8302    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Feb 2019 17:00:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Feb 2019 17:00:25 +0100    

Click here for diff

A small API change makes it unnecessary.  
  
Reported-by: Mark Dilger <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/53a28052-f9f3-1808-fed9-460fd43035ab%402ndquadrant.com  

M contrib/pgcrypto/md5.c

Move pattern selectivity code from selfuncs.c to like_support.c.

commit   : 49fa99e54ec0ded180b52a4a14e543702d53e8c9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Feb 2019 10:51:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Feb 2019 10:51:59 -0500    

Click here for diff

While at it, refactor patternsel() a bit so that it can be used from  
the LIKE/regex planner support functions as well.  This makes the  
planner able to deal equally well with either operator or function  
syntax for these operations.  I'm not excited about that as a feature  
in itself, but it provides a nice model for extensions to follow if  
they want such behavior for their operations.  
  
This change localizes the use of pattern_fixed_prefix() and  
make_greater_string() so that they no longer need be exported.  
(We might get pushback from extensions about that, perhaps,  
in which case I'd be inclined to re-export them in a new header  
file like_support.h.)  
  
This reduces the bulk of selfuncs.c a fair amount, removing ~1370  
lines or about one-sixth of that file; it's still too big, but this  
is progress.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Fix portability issues in pg_bitutils

commit   : 109de05cbb034b032cd60f50708716c8ff0afdf2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Feb 2019 20:09:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Feb 2019 20:09:48 -0300    

Click here for diff

We were using uint64 function arguments as "long int" arguments to  
compiler builtins, which fails on machines where long ints are 32 bits:  
the upper half of the uint64 was being ignored.  Fix by using the "ll"  
builtin variants instead, which on those machines take 64 bit arguments.  
  
Also, remove configure tests for __builtin_popcountl() (as well as  
"long" variants for ctz and clz): the theory here is that any compiler  
version will provide all widths or none, so one test suffices.  Were  
this theory to be wrong, we'd have to add tests for  
__builtin_popcountll() and friends, which would be tedious.  
  
Per failures in buildfarm member lapwing and ensuing discussion.  

M config/c-compiler.m4
M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/port/pg_bitutils.c

Remove a stray subnormal value from float tests.

commit   : 80c468b4a454881b56e1c73c6fedcb2978c5b415    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 20:38:54 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 20:38:54 +0000    

Click here for diff

We don't care to assume that input of subnormal float values works,  
but a stray subnormal value from the upstream Ryu regression test had  
been left in the test data by mistake. Remove it.  
  
Per buildfarm member fulmar.  

M src/test/regress/expected/float4-misrounded-input.out
M src/test/regress/expected/float4.out
M src/test/regress/sql/float4.sql

Add -mpopcnt to all compiles of pg_bitutils.c

commit   : d0b4663c23b7a6ae6f489c4d7a2f58f879914959    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Feb 2019 17:38:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Feb 2019 17:38:21 -0300    

Click here for diff

The way this makefile works, we need to specify it three times.  

M src/port/Makefile

More float test and portability fixes.

commit   : da6520be7f946f5f0f8fe46c34e303d1d36ee080    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 19:35:50 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 19:35:50 +0000    

Click here for diff

Avoid assuming exact results in tstypes test; some platforms vary.  
(per buildfarm members eulachon, danio, lapwing)  
  
Avoid dubious usage (inherited from upstream) of bool parameters to  
copy_special_str, to see if this fixes the mac/ppc failures (per  
buildfarm members prariedog and locust). (Isolated test programs on a  
ppc mac don't seem to show any other cause that would explain them.)  

M src/common/d2s.c
M src/common/f2s.c
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tstypes.sql

Add basic support for using the POPCNT and SSE4.2s LZCNT opcodes

commit   : 711bab1e4d19b5c9967328315a542d93386b1ac5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Feb 2019 16:10:06 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Feb 2019 16:10:06 -0300    

Click here for diff

These opcodes have been around in the AMD world since 2007, and 2008 in  
the case of intel.  They're supported in GCC and Clang via some __builtin  
macros.  The opcodes may be unavailable during runtime, in which case we  
fall back on a C-based implementation of the code.  In order to get the  
POPCNT instruction we must pass the -mpopcnt option to the compiler.  We  
do this only for the pg_bitutils.c file.  
  
David Rowley (with fragments taken from a patch by Thomas Munro)  
  
Discussion: https://postgr.es/m/CAKJS1f9WTAGG1tPeJnD18hiQW5gAk59fQ6WK-vfdAKEHyRg2RA@mail.gmail.com  

M config/c-compiler.m4
M configure
M configure.in
M src/Makefile.global.in
M src/backend/access/heap/visibilitymap.c
M src/backend/lib/bloomfilter.c
M src/backend/nodes/bitmapset.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
A src/include/port/pg_bitutils.h
M src/port/Makefile
A src/port/pg_bitutils.c
M src/tools/msvc/Mkvcbuild.pm

Fix an overlooked UINT32_MAX.

commit   : 754ca99314e9e1debe855b0462869ef6e58b7e7a    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 15:57:54 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 15:57:54 +0000    

Click here for diff

Replace with PG_UINT32_MAX. Per buildfarm members dory and woodlouse.  

M src/common/f2s.c

Change floating-point output format for improved performance.

commit   : 02ddd499322ab6f2f0d58692955dc9633c2150fc    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 15:20:33 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 15:20:33 +0000    

Click here for diff

Previously, floating-point output was done by rounding to a specific  
decimal precision; by default, to 6 or 15 decimal digits (losing  
information) or as requested using extra_float_digits. Drivers that  
wanted exact float values, and applications like pg_dump that must  
preserve values exactly, set extra_float_digits=3 (or sometimes 2 for  
historical reasons, though this isn't enough for float4).  
  
Unfortunately, decimal rounded output is slow enough to become a  
noticable bottleneck when dealing with large result sets or COPY of  
large tables when many floating-point values are involved.  
  
Floating-point output can be done much faster when the output is not  
rounded to a specific decimal length, but rather is chosen as the  
shortest decimal representation that is closer to the original float  
value than to any other value representable in the same precision. The  
recently published Ryu algorithm by Ulf Adams is both relatively  
simple and remarkably fast.  
  
Accordingly, change float4out/float8out to output shortest decimal  
representations if extra_float_digits is greater than 0, and make that  
the new default. Applications that need rounded output can set  
extra_float_digits back to 0 or below, and take the resulting  
performance hit.  
  
We make one concession to portability for systems with buggy  
floating-point input: we do not output decimal values that fall  
exactly halfway between adjacent representable binary values (which  
would rely on the reader doing round-to-nearest-even correctly). This  
is known to be a problem at least for VS2013 on Windows.  
  
Our version of the Ryu code originates from  
https://github.com/ulfjack/ryu/ at commit c9c3fb1979, but with the  
following (significant) modifications:  
  
 - Output format is changed to use fixed-point notation for small  
   exponents, as printf would, and also to use lowercase 'e', a  
   minimum of 2 exponent digits, and a mandatory sign on the exponent,  
   to keep the formatting as close as possible to previous output.  
  
 - The output of exact midpoint values is disabled as noted above.  
  
 - The integer fast-path code is changed somewhat (since we have  
   fixed-point output and the upstream did not).  
  
 - Our project style has been largely applied to the code with the  
   exception of C99 declaration-after-statement, which has been  
   retained as an exception to our present policy.  
  
 - Most of upstream's debugging and conditionals are removed, and we  
   use our own configure tests to determine things like uint128  
   availability.  
  
Changing the float output format obviously affects a number of  
regression tests. This patch uses an explicit setting of  
extra_float_digits=0 for test output that is not expected to be  
exactly reproducible (e.g. due to numerical instability or differing  
algorithms for transcendental functions).  
  
Conversions from floats to numeric are unchanged by this patch. These  
may appear in index expressions and it is not yet clear whether any  
change should be made, so that can be left for another day.  
  
This patch assumes that the only supported floating point format is  
now IEEE format, and the documentation is updated to reflect that.  
  
Code by me, adapting the work of Ulf Adams and other contributors.  
  
References:  
https://dl.acm.org/citation.cfm?id=3192369  
  
Reviewed-by: Tom Lane, Andres Freund, Donald Dong  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M contrib/btree_gist/expected/float4.out
M contrib/btree_gist/expected/float8.out
M contrib/cube/expected/cube.out
M contrib/cube/expected/cube_sci.out
M contrib/cube/sql/cube.sql
M contrib/pg_trgm/expected/pg_strict_word_trgm.out
M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/expected/pg_word_trgm.out
M contrib/pg_trgm/sql/pg_strict_word_trgm.sql
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/pg_trgm/sql/pg_word_trgm.sql
M contrib/seg/expected/seg.out
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M src/Makefile.global.in
M src/backend/utils/adt/float.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/common/Makefile
A src/common/d2s.c
A src/common/d2s_full_table.h
A src/common/d2s_intrinsics.h
A src/common/digit_table.h
A src/common/f2s.c
A src/common/ryu_common.h
A src/include/common/shortest_dec.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/circle.out
M src/test/regress/expected/float4-misrounded-input.out
M src/test/regress/expected/float4.out
M src/test/regress/expected/float8-small-is-zero.out
M src/test/regress/expected/float8.out
M src/test/regress/expected/int8.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/line.out
M src/test/regress/expected/point.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/tsearch.out
M src/test/regress/expected/tstypes.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/window.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/circle.sql
M src/test/regress/sql/float4.sql
M src/test/regress/sql/float8.sql
M src/test/regress/sql/point.sql
M src/test/regress/sql/updatable_views.sql
M src/tools/msvc/Mkvcbuild.pm

Use strtof() and not strtod() for float4 input.

commit   : f397e08599a3c3c08b3af3b318c531db5882f57d    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 15:19:44 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 13 Feb 2019 15:19:44 +0000    

Click here for diff

Using strtod() creates a double-rounding problem; the input decimal  
value is first rounded to the nearest double; rounding that to the  
nearest float may then give an incorrect result.  
  
An example is that 7.038531e-26 when input via strtod and then rounded  
to float4 gives 0xAE43FEp-107 instead of the correct 0xAE43FDp-107.  
  
Values output by earlier PG versions with extra_float_digits=3 should  
all be read in with the same values as previously. However, values  
supplied by other software using shortest representations could be  
mis-read.  
  
On platforms that lack a strtof() entirely, we fall back to the old  
incorrect rounding behavior. (As strtof() is required by C99, such  
platforms are considered of primarily historical interest.) On VS2013,  
some workarounds are used to get correct error handling.  
  
The regression tests now test for the correct input values, so  
platforms that lack strtof() will need resultmap entries. An entry for  
HP-UX 10 is included (more may be needed).  
  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/utils/adt/float.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
M src/include/port/win32_port.h
A src/port/strtof.c
A src/test/regress/expected/float4-misrounded-input.out
M src/test/regress/expected/float4.out
M src/test/regress/resultmap
M src/test/regress/sql/float4.sql
M src/tools/msvc/Mkvcbuild.pm

More unconstify use

commit   : 37d9916020286caec810f4de61fbd0de3568454d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jan 2019 01:16:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jan 2019 01:16:24 +0100    

Click here for diff

Replace casts whose only purpose is to cast away const with the  
unconstify() macro.  
  
Discussion: https://www.postgresql.org/message-id/flat/53a28052-f9f3-1808-fed9-460fd43035ab%402ndquadrant.com  

M contrib/btree_gist/btree_utils_num.c
M contrib/pgcrypto/imath.c
M contrib/pgcrypto/md5.c
M contrib/pgcrypto/pgp-compress.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/transam/xact.c
M src/backend/executor/spi.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/parser/parse_type.c
M src/backend/replication/logical/message.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_dump/compress_io.c
M src/bin/psql/prompt.c
M src/fe_utils/print.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/pqexpbuffer.c
M src/pl/tcl/pltcl.c
M src/port/path.c
M src/timezone/localtime.c

Remove useless casts

commit   : cf40dc65b676c8df1ee12f060b40f0e37a183e04    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jan 2019 01:12:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jan 2019 01:12:18 +0100    

Click here for diff

Some of these were uselessly casting away "const", some were just  
nearby, but they where all unnecessary anyway.  
  
Discussion: https://www.postgresql.org/message-id/flat/53a28052-f9f3-1808-fed9-460fd43035ab%402ndquadrant.com  

M contrib/btree_gist/btree_utils_num.c
M src/backend/catalog/heap.c
M src/common/unicode_norm.c

commit   : 6ea95166a0f19ca0363b9c868e676b10365edec9    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Feb 2019 16:31:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Feb 2019 16:31:20 +0900    

Click here for diff

As of commit c6e4133, the calculation happens in make_one_rel() and not  
query_planner().  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Fix rare dsa_allocate() failures due to freepage.c corruption.

commit   : 7215efdc005e694ec93678a6203dbfc714d12809    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 13 Feb 2019 13:14:10 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 13 Feb 2019 13:14:10 +1300    

Click here for diff

In a corner case, a btree page was allocated during a clean-up operation  
that could cause the tracking of the largest contiguous span of free  
space to get out of whack.  That was supposed to be prevented by the use  
of the "soft" flag to avoid allocating internal pages during incidental  
clean-up work, but the flag was ignored in the case where the FPM was  
promoted from singleton format to btree format.  Repair.  
  
Remove an obsolete comment in passing.  
  
Back-patch to 10, where freepage.c arrived (as support for dsa.c).  
  
Author: Robert Haas  
Diagnosed-by: Thomas Munro and Robert Haas  
Reported-by: Justin Pryzby, Rick Otten, Sand Stone, Arne Roland and others  
Discussion: https://postgr.es/m/CAMAYy4%2Bw3NTBM5JLWFi8twhWK4%3Dk_5L4nV5%2BbYDSPu8r4b97Zg%40mail.gmail.com  

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

Clean up planner confusion between ncolumns and nkeycolumns.

commit   : 75c46149fc2215b046aa56caaf59f8125f0e6062    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Feb 2019 18:38:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Feb 2019 18:38:32 -0500    

Click here for diff

We're only going to consider key columns when creating indexquals,  
so there is no point in having the outer loops in indxpath.c iterate  
further than nkeycolumns.  
  
Doing so in match_pathkeys_to_index() is actually wrong, and would have  
caused crashes by now, except that we have no index AMs supporting both  
amcanorderbyop and amcaninclude.  
  
It's also wrong in relation_has_unique_index_for().  The effect there is  
to fail to prove uniqueness even when the index does prove it, if there  
are extra columns.  
  
Also future-proof examine_variable() for the day when extra columns can  
be expressions, and fix what's either a thinko or just an oversight in  
btcostestimate(): we should consider the number of key columns, not the  
total, when deciding whether to derate correlation.  
  
None of these things seemed important enough to risk changing in a  
just-before-wrap patch, but since we're past the release wrap window,  
time to fix 'em.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/indxpath.c
M src/backend/utils/adt/selfuncs.c

Relax overly strict assertion

commit   : 8c67d29fd51c0381d8bce41d35d7726725924616    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Feb 2019 18:42:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Feb 2019 18:42:37 -0300    

Click here for diff

Ever since its birth, ReorderBufferBuildTupleCidHash() has contained an  
assertion that a catalog tuple cannot change Cmax after acquiring one.  But  
that's wrong: if a subtransaction executes DDL that affects that catalog  
tuple, and later aborts and another DDL affects the same tuple, it will  
change Cmax.  Relax the assertion to merely verify that the Cmax remains  
valid and monotonically increasing, instead.  
  
Add a test that tickles the relevant code.  
  
Diagnosed by, and initial patch submitted by: Arseny Sher  
Co-authored-by: Arseny Sher  
Discussion: https://postgr.es/m/874l9p8hyw.fsf@ars-thinkpad  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M src/backend/replication/logical/reorderbuffer.c

Blind attempt at fixing Windows build

commit   : d357a16997a2e9dce0f56299c739b2b2584c4026    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Feb 2019 18:29:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Feb 2019 18:29:26 -0300    

Click here for diff

Broken since fe33a196de.  

M src/tools/msvc/Solution.pm

Use Getopt::Long for catalog scripts

commit   : fe33a196ded8565d0fd8367e816d695b840e40cb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Feb 2019 11:53:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Feb 2019 11:53:36 -0300    

Click here for diff

Replace hand-rolled option parsing with the Getopt module. This is  
shorter and easier to read. In passing, make some cosmetic adjustments  
for consistency.  
  
Author: John Naylor  
Reviewed-by: David Fetter  
Discussion: https://postgr.es/m/CACPNZCvRjepXh5b2N50njN+rO_2Nzcf=jhMkKX7=79XWUKJyKA@mail.gmail.com  

M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile

Fix erroneous error reports in snapbuild.c.

commit   : 232a8e233f21eb9a214c551d5a6af3d324915b4e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Feb 2019 01:12:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Feb 2019 01:12:52 -0500    

Click here for diff

It's pretty unhelpful to report the wrong file name in a complaint  
about syscall failure, but SnapBuildSerialize managed to do that twice  
in a span of 50 lines.  Also fix half a dozen missing or poorly-chosen  
errcode assignments; that's mostly cosmetic, but still wrong.  
  
Noted while studying recent failures on buildfarm member nightjar.  
I'm not sure whether those reports are actually giving the wrong  
filename, because there are two places here with identically  
spelled error messages.  The other one is specifically coded not  
to report ENOENT, but if it's this one, how could we be getting  
ENOENT from open() with O_CREAT?  Need to sit back and await results.  
  
However, these ereports are clearly broken from birth, so back-patch.  

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

Fix description of WAL record XLOG_PARAMETER_CHANGE

commit   : b7ec820559b68df446c01fe1497bd24e9091f559    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Feb 2019 13:10:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Feb 2019 13:10:59 +0900    

Click here for diff

max_wal_senders and max_worker_processes got reversed in the output  
generated because of ea92368.  
  
Reported-by: Kevin Hale Boyes  
Discussion: https://postgr.es/m/CADAecHVAD4=26KAx4nj5DBvxqqvJkuwsy+riiiNhQqwnZg2K8Q@mail.gmail.com  

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

Fix header inclusion issue.

commit   : b07c695d9c34cccfa0138ca7f4c76547a24c74e1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Feb 2019 22:37:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Feb 2019 22:37:16 -0500    

Click here for diff

partprune.h failed to compile by itself; needs to include partdefs.h.  
  
I think I must've broken this in fa2cf164a, though I'd swear I ran  
the appropriate tests when removing #includes.  Anyway, it's very  
sensible for this file to include partdefs.h, so let's just do that.  
  
Per cpluspluscheck.  

M src/include/partitioning/partprune.h

Clarify docs about limitations of constraint exclusion with partitions

commit   : ea05b221c2ff9d180f632ae90c806e984f15ed0d    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Feb 2019 12:01:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Feb 2019 12:01:56 +0900    

Click here for diff

The current wording can confuse the reader about constraint exclusion  
being available at query execution, but this only applies to partition  
pruning.  
  
Reported-by: Shouyu Luo  
Author: David Rowley  
Reviewed-by: Chapman Flack, Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Allow extensions to generate lossy index conditions.

commit   : 74dfe58a5927b22c744b29534e67bfdd203ac028    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Feb 2019 21:26:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Feb 2019 21:26:08 -0500    

Click here for diff

For a long time, indxpath.c has had the ability to extract derived (lossy)  
index conditions from certain operators such as LIKE.  For just as long,  
it's been obvious that we really ought to make that capability available  
to extensions.  This commit finally accomplishes that, by adding another  
API for planner support functions that lets them create derived index  
conditions for their functions.  As proof of concept, the hardwired  
"special index operator" code formerly present in indxpath.c is pushed  
out to planner support functions attached to LIKE and other relevant  
operators.  
  
A weak spot in this design is that an extension needs to know OIDs for  
the operators, datatypes, and opfamilies involved in the transformation  
it wants to make.  The core-code prototypes use hard-wired OID references  
but extensions don't have that option for their own operators etc.  It's  
usually possible to look up the required info, but that may be slow and  
inconvenient.  However, improving that situation is a separate task.  
  
I want to do some additional refactorization around selfuncs.c, but  
that also seems like a separate task.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/like_support.c
M src/backend/utils/adt/network.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/supportnodes.h
M src/include/optimizer/optimizer.h
M src/test/regress/expected/btree_index.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/inet.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/btree_index.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/inet.sql
M src/test/regress/sql/rowtypes.sql

Move max_wal_senders out of max_connections for connection slot handling

commit   : ea92368cd1da1e290f9ab8efb7f60cb7598fc310    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Feb 2019 10:07:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Feb 2019 10:07:56 +0900    

Click here for diff

Since its introduction, max_wal_senders is counted as part of  
max_connections when it comes to define how many connection slots can be  
used for replication connections with a WAL sender context.  This can  
lead to confusion for some users, as it could be possible to block a  
base backup or replication from happening because other backend sessions  
are already taken for other purposes by an application, and  
superuser-only connection slots are not a correct solution to handle  
that case.  
  
This commit makes max_wal_senders independent of max_connections for its  
handling of PGPROC entries in ProcGlobal, meaning that connection slots  
for WAL senders are handled using their own free queue, like autovacuum  
workers and bgworkers.  
  
One compatibility issue that this change creates is that a standby now  
requires to have a value of max_wal_senders at least equal to its  
primary.  So, if a standby created enforces the value of  
max_wal_senders to be lower than that, then this could break failovers.  
Normally this should not be an issue though, as any settings of a  
standby are inherited from its primary as postgresql.conf gets normally  
copied as part of a base backup, so parameters would be consistent.  
  
Author: Alexander Kukushkin  
Reviewed-by: Kyotaro Horiguchi, Petr Jelínek, Masahiko Sawada, Oleksii  
Kliukin  
Discussion: https://postgr.es/m/CAFh8B=nBzHQeYAu0b8fjK-AF1X4+_p6GRtwG+cCgs6Vci2uRuQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/runtime.sgml
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/walsender.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/access/xlog_internal.h
M src/include/catalog/pg_control.h
M src/include/storage/proc.h

Redesign the partition dependency mechanism.

commit   : 1d92a0c9f7dd547ad14cd8a3974289c5ec7f04ce    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Feb 2019 14:41:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Feb 2019 14:41:13 -0500    

Click here for diff

The original setup for dependencies of partitioned objects had  
serious problems:  
  
1. It did not verify that a drop cascading to a partition-child object  
also cascaded to at least one of the object's partition parents.  Now,  
normally a child object would share all its dependencies with one or  
another parent (e.g. a child index's opclass dependencies would be shared  
with the parent index), so that this oversight is usually harmless.  
But if some dependency failed to fit this pattern, the child could be  
dropped while all its parents remain, creating a logically broken  
situation.  (It's easy to construct artificial cases that break it,  
such as attaching an unrelated extension dependency to the child object  
and then dropping the extension.  I'm not sure if any less-artificial  
cases exist.)  
  
2. Management of partition dependencies during ATTACH/DETACH PARTITION  
was complicated and buggy; for example, after detaching a partition  
table it was possible to create cases where a formerly-child index  
should be dropped and was not, because the correct set of dependencies  
had not been reconstructed.  
  
Less seriously, because multiple partition relationships were  
represented identically in pg_depend, there was an order-of-traversal  
dependency on which partition parent was cited in error messages.  
We also had some pre-existing order-of-traversal hazards for error  
messages related to internal and extension dependencies.  This is  
cosmetic to users but causes testing problems.  
  
To fix #1, add a check at the end of the partition tree traversal  
to ensure that at least one partition parent got deleted.  To fix #2,  
establish a new policy that partition dependencies are in addition to,  
not instead of, a child object's usual dependencies; in this way  
ATTACH/DETACH PARTITION need not cope with adding or removing the  
usual dependencies.  
  
To fix the cosmetic problem, distinguish between primary and secondary  
partition dependency entries in pg_depend, by giving them different  
deptypes.  (They behave identically except for having different  
priorities for being cited in error messages.)  This means that the  
former 'I' dependency type is replaced with new 'P' and 'S' types.  
  
This also fixes a longstanding bug that after handling an internal  
dependency by recursing to the owning object, findDependentObjects  
did not verify that the current target was now scheduled for deletion,  
and did not apply the current recursion level's objflags to it.  
Perhaps that should be back-patched; but in the back branches it  
would only matter if some concurrent transaction had removed the  
internal-linkage pg_depend entry before the recursive call found it,  
or the recursive call somehow failed to find it, both of which seem  
unlikely.  
  
Catversion bump because the contents of pg_depend change for  
partitioning relationships.  
  
Patch HEAD only.  It's annoying that we're not fixing #2 in v11,  
but there seems no practical way to do so given that the problem  
is exactly a poor choice of what entries to put in pg_depend.  
We can't really fix that while staying compatible with what's  
in pg_depend in existing v11 installations.  
  
Discussion: https://postgr.es/m/CAH2-Wzkypv1R+teZrr71U23J578NnTBt2X8+Y=Odr4pOdW1rXg@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/dependency.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Fix misleading PG_RE_THROW commentary

commit   : c603b392c32513982439bc466312d3a6b697d53e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 11 Feb 2019 15:55:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 11 Feb 2019 15:55:09 -0300    

Click here for diff

The old verbiage indicated that PG_RE_THROW is optional, which is not  
really true.  This has confused many people, so it seems worth fixing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/utils/elog.h

Adjust gratuitously different error message wording

commit   : 256fc004afb1eedba10232349c5149c8f41d06a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Feb 2019 14:01:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Feb 2019 14:01:05 +0100    

Click here for diff

M src/backend/commands/lockcmds.c

Remove unused macro

commit   : 78b0cac74dabf879f769ff02a0df83ed90f2d36c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Feb 2019 10:07:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Feb 2019 10:07:25 +0100    

Click here for diff

Last use was removed in 2c66f9924c1162bfba27c77004ccf42fb6ea188d.  

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

Fix indexable-row-comparison logic to account for covering indexes.

commit   : 6bdc3005b54fc9c6ef27cd4e64edd548315f57ba    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Feb 2019 22:51:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Feb 2019 22:51:32 -0500    

Click here for diff

indxpath.c needs a good deal more attention for covering indexes than  
it's gotten.  But so far as I can tell, the only really awful breakage  
is in expand_indexqual_rowcompare (nee adjust_rowcompare_for_index),  
which was only half fixed in c266ed31a.  The other problems aren't  
bad enough to take the risk of a just-before-wrap fix.  
  
The problem here is that if the leading column of a row comparison  
matches an index (allowing this code to be reached), and some later  
column doesn't match the index, it'll nonetheless believe that that  
column matches the first included index column.  Typically that'll  
lead to an error like "operator M is not a member of opfamily N" as  
a result of fetching a garbage opfamily OID.  But with enough bad  
luck, maybe a broken plan would be generated.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/indxpath.c
M src/test/regress/expected/index_including.out
M src/test/regress/sql/index_including.sql

Add per-test-script runtime display to pg_regress.

commit   : 72d71e03563b6c295b257040e324793a30162042    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Feb 2019 16:54:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Feb 2019 16:54:31 -0500    

Click here for diff

It seems useful to have this information available, so that it's  
easier to tell when a test script is taking a disproportionate  
amount of time.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Fix trigger drop procedure

commit   : cb90de1aac18f8d9d89af8a3c2286aa0691c8214    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 10 Feb 2019 10:00:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 10 Feb 2019 10:00:11 -0300    

Click here for diff

After commit 123cc697a8eb, we remove redundant FK action triggers during  
partition ATTACH by merely deleting the catalog tuple, but that's wrong:  
it should use performDeletion() instead.  Repair, and make the comments  
more explicit.  
  
Per code review from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Solve cross-version-upgrade testing problem induced by 1fb57af92.

commit   : 068503c76511cdb0080bab689662a20e86b9c845    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 21:02:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 21:02:06 -0500    

Click here for diff

Renaming varchar_transform to varchar_support had a side effect  
I hadn't foreseen: the core regression tests leave around a  
transform object that relies on that function, so the name  
change breaks cross-version upgrade tests, because the name  
used in the older branches doesn't match.  
  
Since the dependency on varchar_transform was chosen with the  
aid of a dartboard anyway (it would surely not work as a  
language transform support function), fix by just choosing  
a different random builtin function with the right signature.  
Also add some comments explaining why this isn't horribly unsafe.  
  
I chose to make the same substitution in a couple of other  
copied-and-pasted test cases, for consistency, though those  
aren't directly contributing to the testing problem.  
  
Per buildfarm.  Back-patch, else it doesn't fix the problem.  

M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/modules/test_ddl_deparse/expected/create_transform.out
M src/test/modules/test_ddl_deparse/sql/create_transform.sql
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Repair unsafe/unportable snprintf usage in pg_restore.

commit   : 4dbe1969079672064777e71c3fc981abbf55e207    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 19:45:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 19:45:38 -0500    

Click here for diff

warn_or_exit_horribly() was blithely passing a potentially-NULL  
string pointer to a %s format specifier.  That works (at least  
to the extent of not crashing) on some platforms, but not all,  
and since we switched to our own snprintf.c it doesn't work  
for us anywhere.  
  
Of the three string fields being handled this way here, I think  
that only "owner" is supposed to be nullable ... but considering  
that this is error-reporting code, it has very little business  
assuming anything, so put in defenses for all three.  
  
Per a crash observed on buildfarm member crake and then  
reproduced here.  Because of the portability aspect,  
back-patch to all supported versions.  

M src/bin/pg_dump/pg_backup_archiver.c

Build out the planner support function infrastructure.

commit   : a391ff3c3d418e404a2c6e4ff0865a107752827b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 18:32:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 18:32:23 -0500    

Click here for diff

Add support function requests for estimating the selectivity, cost,  
and number of result rows (if a SRF) of the target function.  
  
The lack of a way to estimate selectivity of a boolean-returning  
function in WHERE has been a recognized deficiency of the planner  
since Berkeley days.  This commit finally fixes it.  
  
In addition, non-constant estimates of cost and number of output  
rows are now possible.  We still fall back to looking at procost  
and prorows if the support function doesn't service the request,  
of course.  
  
To make concrete use of the possibility of estimating output rowcount  
for SRFs, this commit adds support functions for array_unnest(anyarray)  
and the integer variants of generate_series; the lack of plausible  
rowcount estimates for those, even when it's obvious to a human,  
has been a repeated subject of complaints.  Obviously, much more  
could now be done in this line, but I'm mostly just trying to get  
the infrastructure in place.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/xfunc.sgml
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/lsyscache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/supportnodes.h
M src/include/optimizer/clauses.h
M src/include/optimizer/plancat.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/misc_functions.out
M src/test/regress/expected/subselect.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/misc_functions.sql
M src/test/regress/sql/subselect.sql

Create the infrastructure for planner support functions.

commit   : 1fb57af92069ee104c09e2016af9e0e620681be3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 18:08:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 18:08:48 -0500    

Click here for diff

Rename/repurpose pg_proc.protransform as "prosupport".  The idea is  
still that it names an internal function that provides knowledge to  
the planner about the behavior of the function it's attached to;  
but redesign the API specification so that it's not limited to doing  
just one thing, but can support an extensible set of requests.  
  
The original purpose of simplifying a function call is handled by  
the first request type to be invented, SupportRequestSimplify.  
Adjust all the existing transform functions to handle this API,  
and rename them fron "xxx_transform" to "xxx_support" to reflect  
the potential generalization of what they do.  (Since we never  
previously provided any way for extensions to add transform functions,  
this change doesn't create an API break for them.)  
  
Also add DDL and pg_dump support for attaching a support function to a  
user-defined function.  Unfortunately, DDL access has to be restricted  
to superusers, at least for now; but seeing that support functions  
will pretty much have to be written in C, that limitation is just  
theoretical.  (This support is untested in this patch, but a follow-on  
patch will add cases that exercise it.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/keywords.sgml
M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xoper.sgml
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/functioncmds.c
M src/backend/commands/proclang.c
M src/backend/commands/typecmds.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.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_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/nodes/nodes.h
A src/include/nodes/supportnodes.h
M src/include/parser/kwlist.h
M src/include/utils/datetime.h
M src/test/modules/test_ddl_deparse/expected/create_transform.out
M src/test/modules/test_ddl_deparse/sql/create_transform.sql
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/oidjoins.sql
M src/test/regress/sql/opr_sanity.sql
M src/tools/findoidjoins/README

Refactor the representation of indexable clauses in IndexPaths.

commit   : 1a8d5afb0dfc5d0dcc6eda0656a34cb1f0cf0bdf    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 17:30:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 17:30:43 -0500    

Click here for diff

In place of three separate but interrelated lists (indexclauses,  
indexquals, and indexqualcols), an IndexPath now has one list  
"indexclauses" of IndexClause nodes.  This holds basically the same  
information as before, but in a more useful format: in particular, there  
is now a clear connection between an indexclause (an original restriction  
clause from WHERE or JOIN/ON) and the indexquals (directly usable index  
conditions) derived from it.  
  
We also change the ground rules a bit by mandating that clause commutation,  
if needed, be done up-front so that what is stored in the indexquals list  
is always directly usable as an index condition.  This gets rid of repeated  
re-determination of which side of the clause is the indexkey during costing  
and plan generation, as well as repeated lookups of the commutator  
operator.  To minimize the added up-front cost, the typical case of  
commuting a plain OpExpr is handled by a new special-purpose function  
commute_restrictinfo().  For RowCompareExprs, generating the new clause  
properly commuted to begin with is not really any more complex than before,  
it's just different --- and we can save doing that work twice, as the  
pretty-klugy original implementation did.  
  
Tracking the connection between original and derived clauses lets us  
also track explicitly whether the derived clauses are an exact or lossy  
translation of the original.  This provides a cheap solution to getting  
rid of unnecessary rechecks of boolean index clauses, which previously  
seemed like it'd be more expensive than it was worth.  
  
Another pleasant (IMO) side-effect is that EXPLAIN now always shows  
index clauses with the indexkey on the left; this seems less confusing.  
  
This commit leaves expand_indexqual_conditions() and some related  
functions in a slightly messy state.  I didn't bother to change them  
any more than minimally necessary to work with the new data structure,  
because all that code is going to be refactored out of existence in  
a follow-on patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/utils/adt/selfuncs.c
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/optimizer/clauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/restrictinfo.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/create_index.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/partition_prune.out

Call set_rel_pathlist_hook before generate_gather_paths, not after.

commit   : 6401583863eaf83624994908911350b03f9978ae    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 11:41:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Feb 2019 11:41:09 -0500    

Click here for diff

The previous ordering of these steps satisfied the nominal requirement  
that set_rel_pathlist_hook could editorialize on the whole set of Paths  
constructed for a base relation.  In practice, though, trying to change  
the set of partial paths was impossible.  Adding one didn't work because  
(a) it was too late to be included in Gather paths made by the core code,  
and (b) calling add_partial_path after generate_gather_paths is unsafe,  
because it might try to delete a path it thinks is dominated, but that  
is already embedded in some Gather path(s).  Nor could the hook safely  
remove partial paths, for the same reason that they might already be  
embedded in Gathers.  
  
Better to call extensions first, let them add partial paths as desired,  
and then gather.  In v11 and up, we already doubled down on that ordering  
by postponing gathering even further for single-relation queries; so even  
if the hook wished to editorialize on Gather path construction, it could  
not.  
  
Report and patch by KaiGai Kohei.  Back-patch to 9.6 where Gather paths  
were added.  
  
Discussion: https://postgr.es/m/CAOP8fzahwpKJRTVVTqo2AE=mDTz_efVzV6Get_0=U3SO+-ha1A@mail.gmail.com  

M doc/src/sgml/custom-scan.sgml
M src/backend/optimizer/path/allpaths.c

Use better comment marker in Autoconf input

commit   : 4446565d36ac4482282146a9ab35068f18dff4fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Feb 2019 15:55:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Feb 2019 15:55:17 +0100    

Click here for diff

The comment marker "#" is copied to the output, so it's only  
appropriate for comments that make sense in the shell output.  For  
comments about the Autoconf language, "dnl" should be used.  

M config/llvm.m4
M config/programs.m4
M configure
M configure.in

Reset, not recreate, execGrouping.c style hashtables.

commit   : 356687bd825e5ca7230d43c1bffe7a59ad2e77bd    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 9 Feb 2019 00:35:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 9 Feb 2019 00:35:57 -0800    

Click here for diff

This uses the facility added in the preceding commit to fix  
performance issues caused by rebuilding the hashtable (with its  
comparator expression being the most expensive bit), after every  
reset. That's especially important when the comparator is JIT  
compiled.  
  
Bug: #15592 #15486  
Reported-By: Jakub Janeček, Dmitry Marakasov  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
Backpatch: 11, where I broke this in bf6c614a2f2c5  

M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c

Allow to reset execGrouping.c style tuple hashtables.

commit   : 317ffdfeaac12e434b2befa24993dc1b52a140fd    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 9 Feb 2019 00:35:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 9 Feb 2019 00:35:57 -0800    

Click here for diff

This has the advantage that the comparator expression, the table's  
slot, etc do not have to be rebuilt. Additionally the simplehash.h  
hashtable within the tuple hashtable now keeps its previous size and  
doesn't need to be reallocated. That both reduces allocator overhead,  
and improves performance in cases where the input estimation was off  
by a significant factor.  
  
To avoid an API/ABI break, the new parameter is exposed via the new  
BuildTupleHashTableExt(), and BuildTupleHashTable() now is a wrapper  
around the former, that continues to allocate the table itself in the  
tablecxt.  
  
Using this fixes performance issues discovered in the two bugs  
referenced. This commit however has not converted the callers, that's  
done in a separate commit.  
  
Bug: #15592 #15486  
Reported-By: Jakub Janeček, Dmitry Marakasov  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
Backpatch: 11, this is a prerequisite for other fixes  

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

simplehash: Add support for resetting a hashtable's contents.

commit   : 3b632a58e7985c6589dbd0e6c0f32ba007783cfa    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 9 Feb 2019 00:35:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 9 Feb 2019 00:35:57 -0800    

Click here for diff

A hashtable reset just reset the hashtable entries, but does not free  
memory.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Bug: #15592 #15486  
Backpatch: 11, this is a prerequisite for other fixes  

M src/include/lib/simplehash.h

Plug leak in BuildTupleHashTable by creating ExprContext in correct context.

commit   : 5567d12ce030781a4f749c9cd2034b95a3b64424    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 9 Feb 2019 00:35:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 9 Feb 2019 00:35:57 -0800    

Click here for diff

In bf6c614a2f2c5 I added a expr context to evaluate the grouping  
expression. Unfortunately the code I added initialized them while in  
the calling context, rather the table context.  Additionally, I used  
CreateExprContext() rather than CreateStandaloneExprContext(), which  
creates the econtext in the estate's query context.  
  
Fix that by using CreateStandaloneExprContext when in the table's  
tablecxt. As we rely on the memory being freed by a memory context  
reset that means that the econtext's shutdown callbacks aren't being  
called, but that seems ok as the expressions are tightly controlled  
due to ExecBuildGroupingEqual().  
  
Bug: #15592  
Reported-By: Dmitry Marakasov  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11, where I broke this in bf6c614a2f2c5  

M src/backend/executor/execGrouping.c

Defend against null error message reported by libxml2.

commit   : 0edef16d76beb8286cc832e4e1daf1f16b3d8f4a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Feb 2019 13:30:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Feb 2019 13:30:42 -0500    

Click here for diff

While this isn't really supposed to happen, it can occur in OOM  
situations and perhaps others.  Instead of crashing, substitute  
"(no message provided)".  
  
I didn't worry about localizing this text, since we aren't  
localizing anything else here; besides, if we're on the edge of  
OOM, it's unlikely gettext() would work.  
  
Report and fix by Sergio Conde Gómez in bug #15624.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: fix thinko in description of how to escape a backslash in bytea.

commit   : f10a20e14714d2b06b84a260a2bf6cef55f46801    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Feb 2019 12:49:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Feb 2019 12:49:36 -0500    

Click here for diff

Also clean up some discussion that had been left in a very confused  
state thanks to half-hearted adjustments for the change to  
standard_conforming_strings being the default.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Fix error handling around ssl_*_protocol_version settings

commit   : 3d462f0861cd7ef8bca0bd186123869a08c89bc8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Feb 2019 11:58:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Feb 2019 11:58:19 +0100    

Click here for diff

In case of a reload, we just want to LOG errors instead of FATAL when  
processing SSL configuration, but the more recent code for the  
ssl_*_protocol_version settings didn't behave like that.  
  
Author: Daniel Gustafsson <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

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

Add some const decorations

commit   : 08d25d7850858094ed6aa7ccc2314f724242336d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Feb 2019 10:13:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Feb 2019 10:13:24 +0100    

Click here for diff

These mainly help understanding the function signatures better.  

M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c

Add pg_partition_root to display top-most parent of a partition tree

commit   : 3677a0b26bb2f3f72d16dc7fa6f34c305badacce    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Feb 2019 08:56:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Feb 2019 08:56:14 +0900    

Click here for diff

This is useful when looking at partition trees with multiple layers, and  
combined with pg_partition_tree, it provides the possibility to show up  
an entire tree by just knowing one member at any level.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera, Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Split create_foreignscan_path() into three functions.

commit   : 34ea1ab7fd305afe1124a6e73ada0ebae04b6ebb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Feb 2019 12:59:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Feb 2019 12:59:47 -0500    

Click here for diff

Up to now postgres_fdw has been using create_foreignscan_path() to  
generate not only base-relation paths, but also paths for foreign joins  
and foreign upperrels.  This is wrong, because create_foreignscan_path()  
calls get_baserel_parampathinfo() which will only do the right thing for  
baserels.  It accidentally fails to fail for unparameterized paths, which  
are the only ones postgres_fdw (thought it) was handling, but we really  
need different APIs for the baserel and join cases.  
  
In HEAD, the best thing to do seems to be to split up the baserel,  
joinrel, and upperrel cases into three functions so that they can  
have different APIs.  I haven't actually given create_foreign_join_path  
a different API in this commit: we should spend a bit of time thinking  
about just what we want to do there, since perhaps FDWs would want to  
do something different from the build-up-a-join-pairwise approach that  
get_joinrel_parampathinfo expects.  In the meantime, since postgres_fdw  
isn't prepared to generate parameterized joins anyway, just give it a  
defense against trying to plan joins with lateral refs.  
  
In addition (and this is what triggered this whole mess) fix bug #15613  
from Srinivasan S A, by teaching file_fdw and postgres_fdw that plain  
baserel foreign paths still have outer refs if the relation has  
lateral_relids.  Add some assertions in relnode.c to catch future  
occurrences of the same error --- in particular, to catch other FDWs  
doing that, but also as backstop against core-code mistakes like the  
one fixed by commit bdd9a99aa.  
  
Bug #15613 also needs to be fixed in the back branches, but the  
appropriate fix will look quite a bit different there, since we don't  
want to assume that existing FDWs get the word right away.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/fdwhandler.sgml
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/pathnode.h

Fix perl searchpath for gen_keywordlist.pl

commit   : 51b025933d442823b076e36f4dbe756d25b1a159    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 7 Feb 2019 11:14:29 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 7 Feb 2019 11:14:29 -0500    

Click here for diff

as found by running src/tools/perlcheck/pgperlsyncheck  

M src/tools/gen_keywordlist.pl

Fix searchpath and module location for pg_rewind and ssl TAP tests

commit   : 8ce641f99709669133c6cbb12aa3d516af7897aa    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 7 Feb 2019 10:22:49 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 7 Feb 2019 10:22:49 -0500    

Click here for diff

The modules RewindTest.pm and ServerSetup.pm are really only useful for  
TAP tests, so they really belong in the TAP test directories. In  
addition, ServerSetup.pm is renamed to SSLServer.pm.  
  
The test scripts have their own directories added to the search path so  
that the relocated modules will be found, regardless of where the tests  
are run from, even on modern perl where "." is no longer in the  
searchpath.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch as appropriate to 9.5  

M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
R100 src/bin/pg_rewind/RewindTest.pm src/bin/pg_rewind/t/RewindTest.pm
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
R099 src/test/ssl/ServerSetup.pm src/test/ssl/t/SSLServer.pm

Use EXECUTE FUNCTION syntax for triggers more

commit   : 0c1f8f166cb6273ab9c06a5f3c2ebedbf36f93e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Feb 2019 09:01:54 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Feb 2019 09:01:54 +0100    

Click here for diff

Change pg_dump and ruleutils.c to use the FUNCTION keyword instead of  
PROCEDURE in trigger and event trigger definitions.  
  
This completes the pieces of the transition started in  
0a63f996e018ac508c858e87fa39cc254a5db49f that were kept out of  
PostgreSQL 11 because of the required catversion change.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/catalog/information_schema.sql
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/test/regress/expected/triggers.out

Allow some recovery parameters to be changed with reload

commit   : 13b89f96d07ad3da67b57f66c134c3609bd3e98f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Feb 2019 09:28:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Feb 2019 09:28:17 +0100    

Click here for diff

Change  
  
archive_cleanup_command  
promote_trigger_file  
recovery_end_command  
recovery_min_apply_delay  
  
from PGC_POSTMASTER to PGC_SIGHUP.  This did not require any further  
changes.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/ca28011a-cfaa-565c-d622-c1907c33ecf7%402ndquadrant.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Add collation assignment to CALL statement

commit   : cd5afd8175e256fa401cf440d06304df746abe62    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 5 Feb 2019 15:08:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 5 Feb 2019 15:08:53 +0100    

Click here for diff

Otherwise functions that require collation information will not have  
it if they are called in arguments to a CALL statement.  
  
Reported-by: Jean-Marc Voillequin <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/1EC8157EB499BF459A516ADCF135ADCE39FFAC54%40LON-WGMSX712.ad.moodys.net  

M src/backend/parser/analyze.c
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Doc: Update the documentation for row movement behavior across partitions.

commit   : 793c736d69091d385a967b2740cc93cfb7a7b076    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 7 Feb 2019 08:58:29 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 7 Feb 2019 08:58:29 +0530    

Click here for diff

In commit f16241bef7c, we have changed the behavior for concurrent updates  
that move row to a different partition, but forgot to update the docs.  
Previously when an UPDATE command causes a row to move from one partition  
to another, there is a chance that another concurrent UPDATE or DELETE  
misses this row.  However, now we raise a serialization failure error in  
such a case.  
  
Reported-by: David Rowley  
Author: David Rowley and Amit Kapila  
Backpatch-through: 11 where it was introduced  
Discussion: https://postgr.es/m/CAKJS1f-iVhGD4-givQWpSROaYvO3c730W8yoRMTF9Gc3craY3w@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Align better test output regex with grammar in pg_dump TAP tests

commit   : f339a998ffe6fb8aa8c114a33316e97b56cb1513    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Feb 2019 10:04:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Feb 2019 10:04:55 +0900    

Click here for diff

This enforces one-or-more character matches in the regular expressions  
for pg_dump testing on SQL syntax output where zero-or-more matches  
implies a syntax error.  
  
Author: Daniel Gustafsson  
Reviewed-by: David G. Johnston, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Add more tests for CREATE TABLE AS with WITH NO DATA

commit   : 537898bd81bd8bd3650846e0abde4298ff1373da    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Feb 2019 09:21:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Feb 2019 09:21:57 +0900    

Click here for diff

The relation creation is done at executor startup, however the main  
regression test suite is lacking scenarios where no data is inserted  
which is something that can happen when using EXECUTE or EXPLAIN with  
CREATE TABLE AS and WITH NO DATA.  
  
Some patches are worked on to reshape the way CTAS relations are  
created, so this makes sure that we do not miss some query patterns  
already supported.  
  
Reported-by: Andreas Karlsson  
Author: Michael Paquier  
Reviewed-by: Andreas Karlsson  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/prepare.out
M src/test/regress/expected/select_into.out
M src/test/regress/sql/prepare.sql
M src/test/regress/sql/select_into.sql

Avoid amcheck inline compression false positives.

commit   : eba775345d23d2c999bbb412ae658b6dab36e3e8    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 6 Feb 2019 15:54:19 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 6 Feb 2019 15:54:19 -0800    

Click here for diff

The previous tacit assumption that index_form_tuple() hides differences  
in the TOAST state of its input datums was wrong.  Normalize input  
varlena datums by decompressing compressed values, and forming a new  
index tuple for fingerprinting using uncompressed inputs.  The final  
normalized representation may actually be compressed once again within  
index_form_tuple(), though that shouldn't matter.  When the original  
tuple is found to have no datums that are compressed inline, fingerprint  
the original tuple directly.  
  
Normalization avoids false positive reports of corruption in certain  
cases.  For example, the executor can apply toasting with some inline  
compression to an entire heap tuple because its input has a single  
external TOAST pointer.  Varlena datums for other attributes that are  
not particularly good candidates for inline compression can be  
compressed in the heap tuple in passing, without the representation of  
the same values in index tuples ever receiving concomitant inline  
compression.  
  
Add a test case to recreate the issue in a simpler though less realistic  
way: by exploiting differences in pg_attribute.attstorage between heap  
and index relations.  
  
This bug was discovered by me during testing of an upcoming set of nbtree  
enhancements.  It was also independently reported by Andreas Kunert, as  
bug #15597.  His test case was rather more realistic than the one I  
ended up using.  
  
Bug: #15597  
Discussion: https://postgr.es/m/CAH2-WznrVd9ie+TTJ45nDT+v2nUt6YJwQrT9SebCdQKtAvfPZw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where heapallindexed verification was introduced.  

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

Hide cascade messages in collate tests

commit   : 727921f466a5234e41b27d34f8e859ca39a93f9e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Feb 2019 22:17:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Feb 2019 22:17:57 +0100    

Click here for diff

These are not relevant to the tests and would just uselessly bloat  
patches.  

M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/collate.linux.utf8.sql

Propagate lateral-reference information to indirect descendant relations.

commit   : bdd9a99aac3bb0eaa49b5db81b2bd9402617fa32    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Feb 2019 12:44:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Feb 2019 12:44:58 -0500    

Click here for diff

create_lateral_join_info() computes a bunch of information about lateral  
references between base relations, and then attempts to propagate those  
markings to appendrel children of the original base relations.  But the  
original coding neglected the possibility of indirect descendants  
(grandchildren etc).  During v11 development we noticed that this was  
wrong for partitioned-table cases, but failed to realize that it was just  
as wrong for any appendrel.  While the case can't arise for appendrels  
derived from traditional table inheritance (because we make a flat  
appendrel for that), nested appendrels can arise from nested UNION ALL  
subqueries.  Failure to mark the lower-level relations as having lateral  
references leads to confusion in add_paths_to_append_rel about whether  
unparameterized paths can be built.  It's not very clear whether that  
leads to any user-visible misbehavior; the lack of field reports suggests  
that it may cause nothing worse than minor cost misestimation.  Still,  
it's a bug, and it leads to failures of Asserts that I intend to add  
later.  
  
To fix, we need to propagate information from all appendrel parents,  
not just those that are RELOPT_BASERELs.  We can still do it in one  
pass, if we rely on the append_rel_list to be ordered with ancestor  
relationships before descendant ones; add assertions checking that.  
While fixing this, we can make a small performance improvement by  
traversing the append_rel_list just once instead of separately for  
each appendrel parent relation.  
  
Noted while investigating bug #15613, though this patch does not fix  
that (which is why I'm not committing the related Asserts yet).  
  
Discussion: https://postgr.es/m/[email protected]  

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

Unify searchpath and do file logic in MSVC build scripts.

commit   : 592123efbb60443d717ab8da9c6735aaec88ac44    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 6 Feb 2019 07:32:35 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 6 Feb 2019 07:32:35 -0500    

Click here for diff

Commit f83419b739 failed to notice that mkvcbuild.pl and build.pl use  
different searchpath and do-file logic, breaking the latter, so it is  
adjusted to use the same logic as mkvcbuild.pl.  

M src/tools/msvc/build.pl

Fix heap_getattr() handling of fast defaults.

commit   : 171e0418b03dc103d5d9bdc0bfaadbb193dd7fd6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Feb 2019 01:09:32 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Feb 2019 01:09:32 -0800    

Click here for diff

Previously heap_getattr() returned NULL for attributes with a fast  
default value (c.f. 16828d5c0273), as it had no handling whatsoever  
for that case.  
  
A previous fix, 7636e5c60f, attempted to fix issues caused by this  
oversight, but just expanding OLD tuples for triggers doesn't actually  
solve the underlying issue.  
  
One known consequence of this bug is that the check for HOT updates  
can return the wrong result, when a previously fast-default'ed column  
is set to NULL. Which in turn means that an index over a column with  
fast default'ed columns might be corrupt if the underlying column(s)  
allow NULLs.  
  
Fix by handling fast default columns in heap_getattr(), remove now  
superfluous expansion in GetTupleForTrigger().  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11, where fast defaults were introduced  

M src/backend/access/common/heaptuple.c
M src/backend/commands/trigger.c
M src/include/access/htup_details.h
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Tighten some regexes with proper character escaping in pg_dump TAP tests

commit   : d07fb6810e51a676c4c631f673b8da09f63205b3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Feb 2019 17:33:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Feb 2019 17:33:55 +0900    

Click here for diff

Some tests have been using regular expressions which have been lax in  
escaping dots, which may cause tests to pass when they should not.  This  
make the whole set of tests more robust where needed.  
  
Author: David Rowley  
Reviewed-by: Daniel Gustafsson, Michael Paquier  
Discussion: https://postgr.es/m/CAKJS1f9jD8aVo1BTH+Vgwd=f-ynbuRVrS90XbWMT6UigaOQJTA@mail.gmail.com  

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

Fix included file path for modern perl

commit   : f83419b7396fe5c64613838fd9eab8424591ad4a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 5 Feb 2019 18:57:12 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 5 Feb 2019 18:57:12 -0500    

Click here for diff

Contrary to the comment on 772d4b76, only paths starting with "./" or  
"../" are considered relative to the current working directory by perl's  
"do" function. So this patch converts all the relevant cases to use "./"  
paths. This only affects MSVC.  
  
Backpatch to all live branches.  

M src/tools/msvc/Install.pm
M src/tools/msvc/build.pl
M src/tools/msvc/install.pl
M src/tools/msvc/mkvcbuild.pl
M src/tools/msvc/pgbison.pl
M src/tools/msvc/pgflex.pl
M src/tools/msvc/vcregress.pl

Keep perl style checker happy

commit   : 8916b33e52485f0acea98fdfc919c2313178f865    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 5 Feb 2019 15:16:55 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 5 Feb 2019 15:16:55 -0500    

Click here for diff

It doesn't like code before "use strict;".  

M src/backend/catalog/genbki.pl

Update time zone data files to tzdata release 2018i.

commit   : d63dc0aa0ccf432f3bc9a735e77eb3845732cf28    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Feb 2019 10:58:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Feb 2019 10:58:53 -0500    

Click here for diff

DST law changes in Kazakhstan, Metlakatla, and São Tomé and Príncipe.  
Kazakhstan's Qyzylorda zone is split in two, creating a new zone  
Asia/Qostanay, as some areas did not change UTC offset.  
Historical corrections for Hong Kong and numerous Pacific islands.  

M src/timezone/data/tzdata.zi

Fix searchpath for modern Perl for genbki.pl

commit   : f884a96819ad375a3220fffadcd47d0dcabeece4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 5 Feb 2019 09:59:46 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 5 Feb 2019 09:59:46 -0500    

Click here for diff

This was fixed for MSVC tools by commit 1df92eeafefac4, but per  
buildfarm member bowerbird genbki.pl needs the same treatment.  
  
Backpatch to all live branches.  

M src/backend/catalog/genbki.pl

Remove unnecessary "inline" marker introduced in commit 4be058fe9.

commit   : 24114e8b4df4a4ff2db9e608742768d219b1067c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Feb 2019 21:45:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Feb 2019 21:45:39 -0500    

Click here for diff

Some of our older buildfarm members bleat about this coding,  
along the lines of  
  
prepjointree.c:112: warning: 'get_result_relid' declared inline after being called  
prepjointree.c:112: warning: previous declaration of 'get_result_relid' was here  
  
Modern compilers will probably inline this function without being  
prompted, so rather than move the function, let's just drop the  
marking.  

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

Doc: in each release branch, keep only that branch's own release notes.

commit   : 527b5ed1ad469e19af458a3cbcc060899d1eab71    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Feb 2019 19:18:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Feb 2019 19:18:49 -0500    

Click here for diff

Historically we've had each release branch include all prior branches'  
notes, including minor-release changes, back to the beginning of the  
project.  That's basically an O(N^2) proposition, and it was starting to  
catch up with us: as of HEAD the back-branch release notes alone accounted  
for nearly 30% of the documentation.  While there's certainly some value  
in easy access to back-branch notes, this is getting out of hand.  
  
Hence, switch over to the rule that each branch contains only its own  
release notes.  So as to not make older notes too hard to find, each  
branch will provide URLs for the immediately preceding branches'  
release notes on the project website.  
  
There might be value in providing aggregated notes across all branches  
somewhere on the website, but that's a task for another day.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/filelist.sgml
D doc/src/sgml/release-10.sgml
D doc/src/sgml/release-11.sgml
M doc/src/sgml/release-12.sgml
D doc/src/sgml/release-7.4.sgml
D doc/src/sgml/release-8.0.sgml
D doc/src/sgml/release-8.1.sgml
D doc/src/sgml/release-8.2.sgml
D doc/src/sgml/release-8.3.sgml
D doc/src/sgml/release-8.4.sgml
D doc/src/sgml/release-9.0.sgml
D doc/src/sgml/release-9.1.sgml
D doc/src/sgml/release-9.2.sgml
D doc/src/sgml/release-9.3.sgml
D doc/src/sgml/release-9.4.sgml
D doc/src/sgml/release-9.5.sgml
D doc/src/sgml/release-9.6.sgml
D doc/src/sgml/release-old.sgml
M doc/src/sgml/release.sgml
M src/tools/RELEASE_CHANGES

Fix dumping of matviews with indirect dependencies on primary keys.

commit   : 6e4d45b5f6babe48c066c547a7eedfc8152e5138    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Feb 2019 17:20:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Feb 2019 17:20:02 -0500    

Click here for diff

Commit 62215de29 turns out to have been not quite on-the-mark.  
When we are forced to postpone dumping of a materialized view into  
the dump's post-data section (because it depends on a unique index  
that isn't created till that section), we may also have to postpone  
dumping other matviews that depend on said matview.  The previous fix  
didn't reliably work for such cases: it'd break the dependency loops  
properly, producing a workable object ordering, but it didn't  
necessarily mark all the matviews as "postponed_def".  This led to  
harmless bleating about "archive items not in correct section order",  
as reported by Tom Cassidy in bug #15602.  Less harmlessly,  
selective-restore options such as --section might misbehave due to  
the matview dump objects not being properly labeled.  
  
The right way to fix it is to consider that each pre-data dependency  
we break amounts to moving the no-longer-dependent object into  
post-data, and hence we should mark that object if it's a matview.  
  
Back-patch to all supported versions, since the issue's been there  
since matviews were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump_sort.c

Remove unused macro

commit   : f602cf49c2f614ef7450df30bab9df29842bd359    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Feb 2019 21:29:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Feb 2019 21:29:31 +0100    

Click here for diff

Use was removed in 6d46f4783efe457f74816a75173eb23ed8930020 but  
definition was forgotten.  

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

Move port-specific parts of with_temp_install to port makefile.

commit   : 54f5f887fd7df0ba9e286ce7bc4d1b1197afcbf3    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 4 Feb 2019 18:47:33 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 4 Feb 2019 18:47:33 +0000    

Click here for diff

Rather than define ld_library_path_ver with a big nested $(if), just  
put the overriding values in the makefiles for the relevant ports.  
  
Also add a variable for port makefiles to append their own stuff to  
with_temp_install, and use it to set LD_LIBRARY_PATH_RPATH=1 on  
FreeBSD which is needed to make LD_LIBRARY_PATH override DT_RPATH  
if DT_RUNPATH is not set (which seems to depend in unpredictable ways  
on the choice of compiler, at least on my system).  
  
Backpatch for the benefit of anyone doing regression tests on FreeBSD.  
(For other platforms there should be no functional change.)  

M src/Makefile.global.in
M src/makefiles/Makefile.aix
M src/makefiles/Makefile.darwin
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.hpux

Make FSM test portable.

commit   : 08ecdfe7e5e0a31efbe1d58fefbe085b53bc79ca    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 4 Feb 2019 10:08:29 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 4 Feb 2019 10:08:29 +0530    

Click here for diff

In b0eaa4c51b, we allow FSM to be created only after 4 pages.  One of the  
tests check the FSM contents and to do that it populates many tuples in  
the relation.  The FSM contents depend on the availability of freespace in  
the page and it could vary because of the alignment of tuples.  
  
This commit removes the dependency on FSM contents.  
  
Author: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1KADF6K1bagr0--mGv3dMcZ%3DH_Z-Qtvdfbp5PjaC6PJJA%40mail.gmail.com  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql

Avoid creation of the free space map for small heap relations, take 2.

commit   : b0eaa4c51bbff3e3c600b11e5d104d6feb9ca77f    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 4 Feb 2019 07:49:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 4 Feb 2019 07:49:15 +0530    

Click here for diff

Previously, all heaps had FSMs. For very small tables, this means that the  
FSM took up more space than the heap did. This is wasteful, so now we  
refrain from creating the FSM for heaps with 4 pages or fewer. If the last  
known target block has insufficient space, we still try to insert into some  
other page before giving up and extending the relation, since doing  
otherwise leads to table bloat. Testing showed that trying every page  
penalized performance slightly, so we compromise and try every other page.  
This way, we visit at most two pages. Any pages with wasted free space  
become visible at next relation extension, so we still control table bloat.  
As a bonus, directly attempting one or two pages can even be faster than  
consulting the FSM would have been.  
  
Once the FSM is created for a heap we don't remove it even if somebody  
deletes all the rows from the corresponding relation.  We don't think it is  
a useful optimization as it is quite likely that relation will again grow  
to the same size.  
  
Author: John Naylor, Amit Kapila  
Reviewed-by: Amit Kapila  
Tested-by: Mithun C Y  
Discussion: https://www.postgresql.org/message-id/CAJVSVGWvB13PzpbLEecFuGFc5V2fsO736BsdTakPiPAcdMM5tQ@mail.gmail.com  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql
M doc/src/sgml/storage.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xact.c
M src/backend/storage/freespace/README
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/indexfsm.c
M src/include/storage/freespace.h
A src/test/regress/expected/fsm.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/fsm.sql

Clarify behavior of initdb's --allow-group-access on Windows in docs

commit   : be12aa47e60c45f331e91693efdbc94497d4e9b0    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Feb 2019 09:57:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Feb 2019 09:57:20 +0900    

Click here for diff

The option is ignored on Windows, and GUC data_directory_mode already  
mentioned that within its description in the documentation.  
  
Author: Michael Paquier  
Reported-by: Haribabu Kommi, David Steele  
Discussion: https://postgr.es/m/CAJrrPGefxTG43yk6BrOC7ZcMnCTccG9+inCSncvyys_t8Ev9cQ@mail.gmail.com  
Backpatch-through: 11  

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

Add shared_memory_type GUC.

commit   : f1bebef60ec8f557324cd3bfc1671da1318de968    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 3 Feb 2019 09:55:39 +0100    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 3 Feb 2019 09:55:39 +0100    

Click here for diff

Since 9.3 we have used anonymous shared mmap for our main shared memory  
region, except in EXEC_BACKEND builds.  Provide a GUC so that users  
can opt for System V shared memory once again, like in 9.2 and earlier.  
  
A later patch proposes to add huge/large page support for AIX, which  
requires System V shared memory and provided the motivation to revive  
this possibility.  It may also be useful on some BSDs.  
  
Author: Andres Freund (revived and documented by Thomas Munro)  
Discussion: https://postgr.es/m/HE1PR0202MB28126DB4E0B6621CC6A1A91286D90%40HE1PR0202MB2812.eurprd02.prod.outlook.com  
Discussion: https://postgr.es/m/2AE143D2-87D3-4AD1-AC78-CE2258230C05%40FreeBSD.org  

M doc/src/sgml/config.sgml
M doc/src/sgml/runtime.sgml
M src/backend/port/sysv_shmem.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/storage/pg_shmem.h

Move page initialization from RelationAddExtraBlocks() to use, take 2.

commit   : 0d1fe9f74e369a6066b18fcbc0a25d87cbdff7ce    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 3 Feb 2019 01:27:19 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 3 Feb 2019 01:27:19 -0800    

Click here for diff

Previously we initialized pages when bulk extending in  
RelationAddExtraBlocks(). That has a major disadvantage: It ties  
RelationAddExtraBlocks() to heap, as other types of storage are likely  
to need different amounts of special space, have different amount of  
free space (previously determined by PageGetHeapFreeSpace()).  
  
That we're relying on initializing pages, but not WAL logging the  
initialization, also means the risk for getting  
"WARNING:  relation \"%s\" page %u is uninitialized --- fixing"  
style warnings in vacuums after crashes/immediate shutdowns, is  
considerably higher. The warning sounds much more serious than what  
they are.  
  
Fix those two issues together by not initializing pages in  
RelationAddExtraPages() (but continue to do so in  
RelationGetBufferForTuple(), which is linked much more closely to  
heap), and accepting uninitialized pages as normal in  
vacuumlazy.c. When vacuumlazy encounters an empty page it now adds it  
to the FSM, but does nothing else.  We chose to not issue a debug  
message, much less a warning in that case - it seems rarely useful,  
and quite likely to scare people unnecessarily.  
  
For now empty pages aren't added to the VM, because standbys would not  
re-discover such pages after a promotion. In contrast to other sources  
for empty pages, there's no corresponding WAL records triggering FSM  
updates during replay.  
  
Previously when extending the relation, there was a moment between  
extending the relation, and acquiring an exclusive lock on the new  
page, in which another backend could lock the page. To avoid new  
content being put on that new page, vacuumlazy needed to acquire the  
extension lock for a brief moment when encountering a new page. A  
second corner case, only working somewhat by accident, was that  
RelationGetBufferForTuple() sometimes checks the last page in a  
relation for free space, without consulting the FSM; that only worked  
because PageGetHeapFreeSpace() interprets the zero page header in a  
new page as no free space.  The lack of handling this properly  
required reverting the previous attempt in 684200543b.  
  
This issue can be solved by using RBM_ZERO_AND_LOCK when extending the  
relation, thereby avoiding this window. There's some added complexity  
when RelationGetBufferForTuple() is called with another buffer (for  
updates), to avoid deadlocks, but that's rarely hit at runtime.  
  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Add PG_CFLAGS, PG_CXXFLAGS, and PG_LDFLAGS variables to PGXS

commit   : ac3a9afdbefd76de51fa8f864288f2d2372ca4e9    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 3 Feb 2019 17:48:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 3 Feb 2019 17:48:09 +0900    

Click here for diff

Add PG_CFLAGS, PG_CXXFLAGS, and PG_LDFLAGS variables to pgxs.mk which  
will be appended or prepended to the corresponding make variables.  
Notably, there was previously no way to pass custom CXXFLAGS to third  
party extension module builds, COPT and PROFILE supporting only CFLAGS  
and LDFLAGS.  
  
Backpatch all the way down to ease integration with existing  
extensions.  
  
Author: Christoph Berg  
Reviewed-by: Andres Freund, Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk

Avoid possible deadlock while locking multiple heap pages.

commit   : 0b8bdb3c3ec092f18813d5b6fc738d7ec450289b    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 2 Feb 2019 15:47:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 2 Feb 2019 15:47:00 +0530    

Click here for diff

To avoid deadlock, backend acquires a lock on heap pages in block  
number order.  In certain cases, lock on heap pages is dropped and  
reacquired.  In this case, the locks are dropped for reading in  
corresponding VM page/s. The issue is we re-acquire locks in bufferId  
order whereas the intention was to acquire in blockid order.  
  
This commit ensures that we will always acquire locks on heap pages in  
blockid order.  
  
Reported-by: Nishant Fnu  
Author: Nishant Fnu  
Reviewed-by: Amit Kapila and Robert Haas  
Backpatch-through: 9.4  
Discussion: https://postgr.es/m/[email protected]  

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

Improve installation instructions with pg_ctl in documentation

commit   : 3e938a83b2ee3b47d47cdbdf58df09946877d4fd    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 2 Feb 2019 13:23:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 2 Feb 2019 13:23:26 +0900    

Click here for diff

The documentation includes sections to be able to initialize and start  
Postgres via a couple of commands.  Some of its recommendations involve  
using directly "postgres", which is inconsistent with the recommendation  
given by initdb.  At the same time make some other command calls more  
consistent with the rest, by using an absolute path when creating a  
database.  
  
Author: Andreas Scherbaum  
Reviewed-by: Michael Banck, Ryan Lambert  

M doc/src/sgml/installation.sgml
M doc/src/sgml/standalone-install.xml

Renaming for new subscripting mechanism

commit   : 558d77f20e4e9ed18101d5d057b770ae22ece855    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Feb 2019 12:50:32 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Feb 2019 12:50:32 -0300    

Click here for diff

Over at patch https://commitfest.postgresql.org/21/1062/ Dmitry wants to  
introduce a more generic subscription mechanism, which allows  
subscripting not only arrays but also other object types such as JSONB.  
That functionality is introduced in a largish invasive patch, out of  
which this internal renaming patch was extracted.  
  
Author: Dmitry Dolgov  
Reviewed-by: Tom Lane, Arthur Zakirov  
Discussion: https://postgr.es/m/CA+q6zcUK4EqPAu7XRRO5CCjMwhz5zvg+rfWuLzVoxp_5sKS6=w@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/deparse.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/execExpr.h
M src/include/jit/llvmjit.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/parse_node.h
M src/pl/plpgsql/src/pl_exec.c

Add ArchiveOpts to pass options to ArchiveEntry

commit   : f831d4accda00b9144bc647ede2e2f848b59f39d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Feb 2019 11:29:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Feb 2019 11:29:42 -0300    

Click here for diff

The ArchiveEntry function has a number of arguments that can be  
considered optional.  Split them out into a separate struct, to make the  
API more flexible for changes.  
  
Author: Dmitry Dolgov  
Discussion: https://postgr.es/m/CA+q6zcXRxPE+qp6oerQWJ3zS061WPOhdxeMrdc-Yf-2V5vsrEw@mail.gmail.com  

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

Add combining characters to unaccent.rules.

commit   : 456e3718e7b72efe4d2639437fcbca2e4ad83099    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 1 Feb 2019 15:23:01 +0100    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 1 Feb 2019 15:23:01 +0100    

Click here for diff

Strip certain classes of combining characters, so that accents encoded  
this way are removed.  
  
Author: Hugh Ranalli  
Discussion: https://postgr.es/m/15548-cef1b3f8de190d4f%40postgresql.org  

M contrib/unaccent/expected/unaccent.out
M contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/sql/unaccent.sql
M contrib/unaccent/unaccent.rules

Move building of child base quals out into a new function

commit   : 80579f9bb171350fccdd5f1d793c538254d9de62    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Feb 2019 06:47:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Feb 2019 06:47:49 -0300    

Click here for diff

An upcoming patch which changes how inheritance planning works requires  
adding a new function that does a similar job to set_append_rel_size() but  
for child target relations.  To save it from having to duplicate the qual  
building code, move that to a separate function first.  
  
Here we also change things so that we never attempt to build security quals  
after detecting some const false child quals.  We needlessly used to do this  
just before we marked the child relation as a dummy rel.  
  
In passing, this also moves the partition pruned check to before the qual  
building code.  We don't need to build the child quals before we check if  
the partition has been pruned.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f_i+jrrD+if8qC7KPuTAAWsd=dtepgY_7u=P86GDEwm7A@mail.gmail.com  

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

Adjust comment about timeout when waiting for WAL at recovery

commit   : c93001b3f957994942ea18ed261ae06ac507ea95    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Feb 2019 10:46:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Feb 2019 10:46:45 +0900    

Click here for diff

A timeout of 5s is used when waiting for WAL to become available at  
recovery so as the startup process is able to react promptly if a  
trigger file shows up.  However this missed the fact that the startup  
process also relies on the timeout to check periodically the status of  
any active WAL receiver.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix use of dangling pointer in heap_delete() when logging replica identity

commit   : eb8c9f0bc394160efd6951c69e644551e835a486    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Feb 2019 10:35:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Feb 2019 10:35:16 +0900    

Click here for diff

When logging the replica identity of a deleted tuple, XLOG_HEAP_DELETE  
records include references of the old tuple.  Its data is stored in an  
intermediate variable used to register this information for the WAL  
record, but this variable gets away from the stack when the record gets  
actually inserted.  
  
Spotted by clang's AddressSanitizer.  
  
Author: Stas Kelvish  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

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

Add more columns to pg_stat_ssl

commit   : f60a0e96778854ed0b7fd4737488ba88022e47bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Feb 2019 00:17:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Feb 2019 00:17:45 +0100    

Click here for diff

Add columns client_serial and issuer_dn to pg_stat_ssl.  These allow  
uniquely identifying the client certificate.  
  
Rename the existing column clientdn to client_dn, to make the naming  
more consistent and easier to read.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/be-secure-openssl.c
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/libpq/libpq-be.h
M src/include/pgstat.h
M src/test/regress/expected/rules.out
M src/test/ssl/t/001_ssltests.pl

Add --min-xid-age and --min-mxid-age options to vacuumdb

commit   : 00d1e88d36687ceae1be2317fac90e967941c085    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 31 Jan 2019 13:06:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 31 Jan 2019 13:06:51 +0900    

Click here for diff

These two new options can be used to improve the selectivity of  
relations to vacuum or analyze even further depending on the age of  
respectively their transaction ID or multixact ID, so as it is possible  
to prioritize tables to prevent wraparound of one or the other.  
Combined with --table, it is possible to target a subset of tables to  
choose as potential processing targets.  
  
Author: Nathan Bossart  
Reviewed-by: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c

Allow RECORD and RECORD[] to be specified in function coldeflists.

commit   : 5f5c01459053c0975b89b5aa1a3d705e677348ae    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Jan 2019 19:25:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Jan 2019 19:25:33 -0500    

Click here for diff

We can't allow these pseudo-types to be used as table column types,  
because storing an anonymous record value in a table would result  
in data that couldn't be understood by other sessions.  However,  
it seems like there's no harm in allowing the case in a column  
definition list that's specifying what a function-returning-record  
returns.  The data involved is all local to the current session,  
so we should be just as able to resolve its actual tuple type as  
we are for the function-returning-record's top-level tuple output.  
  
Elvis Pranskevichus, with cosmetic changes by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_relation.c
M src/include/catalog/heap.h
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

Log PostgreSQL version number on startup

commit   : 689d15e95e3509554fbc1afd231b41f4a1fee669    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Jan 2019 23:26:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Jan 2019 23:26:10 +0100    

Click here for diff

Logging the PostgreSQL version on startup is useful for two reasons:  
There is a clear marker in the log file that a new postmaster is  
beginning, and it's useful for tracking the server version across  
startup while upgrading.  
  
Author: Christoph Berg <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M src/backend/postmaster/postmaster.c

postmaster: Start syslogger earlier

commit   : 57431a911d3a650451d198846ad3194900666152    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 17:32:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 17:32:01 +0100    

Click here for diff

When the syslogger was originally  
added (bdf8ef6925de6ea1a9330fa1ce32e1a315d07eb2), nothing was normally  
logged before the point where it was started.  But since  
f9dfa5c9776649f769d537dd0923003b35f128de, the creation of sockets  
causes messages of level LOG to be written routinely, so those don't  
go to the syslogger now.  
  
To improve that, arrange the sequence in PostmasterMain() slightly so  
that the syslogger is started early enough to capture those messages.  
  
Discussion: https://www.postgresql.org/message-id/d5d50936-20b9-85f1-06bc-94a01c5040c1%402ndquadrant.com  
Reviewed-by: Christoph Berg <[email protected]>  

M src/backend/postmaster/postmaster.c

Change error handling of out of scope variables in ecpg.

commit   : 7ea38f045dad6bbb7fbe807f2486df7370bc0b0f    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 30 Jan 2019 13:58:25 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 30 Jan 2019 13:58:25 +0100    

Click here for diff

The function called can result in an out of memory error that subsequently was  
disregarded. Instead it should set the appropriate SQL error variables and be  
checked by whatever whenever statement is defined.  

M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
M src/interfaces/ecpg/test/expected/preproc-cursor.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/sql-binary.c

Make some ecpg test cases more robust against unexpected errors that happen during development. Test cases themselves should not hang or segfault.

commit   : e2f731cdba9b7a79cddc64325990a8f51818877b    
  
author   : Michael Meskes <[email protected]>    
date     : Wed, 30 Jan 2019 10:36:53 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Wed, 30 Jan 2019 10:36:53 +0100    

Click here for diff

M src/interfaces/ecpg/test/compat_informix/test_informix.pgc
M src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
M src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr
M src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
M src/interfaces/ecpg/test/expected/compat_informix-test_informix2.stderr
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.stderr
M src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
M src/interfaces/ecpg/test/expected/sql-binary.c
M src/interfaces/ecpg/test/expected/sql-binary.stderr
M src/interfaces/ecpg/test/expected/sql-fetch.c
M src/interfaces/ecpg/test/expected/sql-fetch.stderr
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/preproc/outofscope.pgc
M src/interfaces/ecpg/test/preproc/whenever_do_continue.pgc
M src/interfaces/ecpg/test/sql/binary.pgc
M src/interfaces/ecpg/test/sql/fetch.pgc
M src/interfaces/ecpg/test/sql/quote.pgc

Make sure that ecpglib's statement variable has a defined value no matter what.

commit   : 5c04630ad05e6e33bc18a6846b4086f9794d99e8    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 29 Jan 2019 14:50:16 +0100    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 29 Jan 2019 14:50:16 +0100    

Click here for diff

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

Fix a crash in logical replication

commit   : dfa774ff9ac9de33d8cb98b91906ada55a2ab1df    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 22:09:33 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 22:09:33 +0100    

Click here for diff

The bug was that determining which columns are part of the replica  
identity index using RelationGetIndexAttrBitmap() would run  
eval_const_expressions() on index expressions and predicates across  
all indexes of the table, which in turn might require a snapshot, but  
there wasn't one set, so it crashes.  There were actually two separate  
bugs, one on the publisher and one on the subscriber.  
  
To trigger the bug, a table that is part of a publication or  
subscription needs to have an index with a predicate or expression  
that lends itself to constant expressions simplification.  
  
The fix is to avoid the constant expressions simplification in  
RelationGetIndexAttrBitmap(), so that it becomes safe to call in these  
contexts.  The constant expressions simplification comes from the  
calls to RelationGetIndexExpressions()/RelationGetIndexPredicate() via  
BuildIndexInfo().  But RelationGetIndexAttrBitmap() calling  
BuildIndexInfo() is overkill.  The latter just takes pg_index catalog  
information, packs it into the IndexInfo structure, which former then  
just unpacks again and throws away.  We can just do this directly with  
less overhead and skip the troublesome calls to  
eval_const_expressions().  This also removes the awkward  
cross-dependency between relcache.c and index.c.  
  
Bug: #15114  
Reported-by: Петър Славов <[email protected]>  
Reviewed-by: Noah Misch <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M src/backend/utils/cache/relcache.c
A src/test/subscription/t/100_bugs.pl

Do not filter by relkind in vacuumdb's catalog query if --table is used

commit   : b8f73df0f845d865823ef72669024dc150282392    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Jan 2019 09:44:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Jan 2019 09:44:08 +0900    

Click here for diff

If a user specifies a relation name which cannot be processed, then the  
backend can warn directly about what is wrong with it.  This fixes an  
oversight from e0c2933.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c

Rename nodes/relation.h to nodes/pathnodes.h.

commit   : fa2cf164aaf91e074be653c28e035f65d80eb666    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Jan 2019 16:49:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Jan 2019 16:49:25 -0500    

Click here for diff

The old name of this file was never a very good indication of what it  
was for.  Now that there's also access/relation.h, we have a potential  
confusion hazard as well, so let's rename it to something more apropos.  
Per discussion, "pathnodes.h" is reasonable, since a good fraction of  
the file is Path node definitions.  
  
While at it, tweak a couple of other headers that were gratuitously  
importing relation.h into modules that don't need it.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/bloom.h
M contrib/postgres_fdw/postgres_fdw.h
M src/backend/executor/execAmi.c
M src/backend/executor/nodeCustom.c
M src/backend/nodes/README
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/print.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/predtest.c
M src/backend/rewrite/rewriteManip.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/include/access/tsmapi.h
M src/include/executor/executor.h
M src/include/executor/nodeCustom.h
M src/include/foreign/fdwapi.h
M src/include/nodes/extensible.h
M src/include/nodes/nodes.h
R099 src/include/nodes/relation.h src/include/nodes/pathnodes.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/paramassign.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/partitioning/partprune.h
M src/include/statistics/statistics.h
M src/include/utils/selfuncs.h

Refactor planner's header files.

commit   : f09346a9c6218dd239fdf3a79a729716c0d305bd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Jan 2019 15:48:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Jan 2019 15:48:51 -0500    

Click here for diff

Create a new header optimizer/optimizer.h, which exposes just the  
planner functions that can be used "at arm's length", without need  
to access Paths or the other planner-internal data structures defined  
in nodes/relation.h.  This is intended to provide the whole planner  
API seen by most of the rest of the system; although FDWs still need  
to use additional stuff, and more thought is also needed about just  
what selfuncs.c should rely on.  
  
The main point of doing this now is to limit the amount of new  
#include baggage that will be needed by "planner support functions",  
which I expect to introduce later, and which will be in relevant  
datatype modules rather than anywhere near the planner.  
  
This commit just moves relevant declarations into optimizer.h from  
other header files (a couple of which go away because everything  
got moved), and adjusts #include lists to match.  There's further  
cleanup that could be done if we want to decide that some stuff  
being exposed by optimizer.h doesn't belong in the planner at all,  
but I'll leave that for another day.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blcost.c
M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/transam/parallel.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/partition.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/explain.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/executor/execExpr.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteManip.c
M src/backend/statistics/dependencies.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/misc/guc.c
M src/include/nodes/relation.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
A src/include/optimizer/optimizer.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
D src/include/optimizer/predtest.h
M src/include/optimizer/prep.h
M src/include/optimizer/tlist.h
D src/include/optimizer/var.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/modules/test_predtest/test_predtest.c

Make some small planner API cleanups.

commit   : a1b8c41e990ec0f083e9b684700a07640d5a356a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Jan 2019 15:26:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Jan 2019 15:26:44 -0500    

Click here for diff

Move a few very simple node-creation and node-type-testing functions  
from the planner's clauses.c to nodes/makefuncs and nodes/nodeFuncs.  
There's nothing planner-specific about them, as evidenced by the  
number of other places that were using them.  
  
While at it, rename and_clause() etc to is_andclause() etc, to clarify  
that they are node-type-testing functions not node-creation functions.  
And use "static inline" implementations for the shortest ones.  
  
Also, modify flatten_join_alias_vars() and some subsidiary functions  
to take a Query not a PlannerInfo to define the join structure that  
Vars should be translated according to.  They were only using the  
"parse" field of the PlannerInfo anyway, so this just requires removing  
one level of indirection.  The advantage is that now parse_agg.c can  
use flatten_join_alias_vars() without the horrid kluge of creating an  
incomplete PlannerInfo, which will allow that file to be decoupled from  
relation.h in a subsequent patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeTidscan.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/print.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/var.c
M src/backend/parser/parse_agg.c
M src/backend/partitioning/partprune.c
M src/backend/statistics/dependencies.c
M src/backend/utils/cache/relcache.c
M src/include/nodes/makefuncs.h
M src/include/nodes/nodeFuncs.h
M src/include/optimizer/clauses.h
M src/include/optimizer/prep.h
M src/include/optimizer/var.h
M src/test/modules/test_predtest/test_predtest.c

Fix pg_stat_ssl.clientdn

commit   : e77cfa54d700557ea700d47454c9e570f20f1841    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 14:36:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 14:36:48 +0100    

Click here for diff

Return null if there is no client certificate.  This is how it has  
always been documented, but in reality it returned an empty string.  
  
Reviewed-by: Kyotaro HORIGUCHI <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M src/backend/utils/adt/pgstatfuncs.c
M src/test/ssl/t/001_ssltests.pl

Add tests for pg_stat_ssl system view

commit   : 18059543e76aeb6b3cf3a5513e69daf222d3558e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 14:34:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 14:34:15 +0100    

Click here for diff

Reviewed-by: Kyotaro HORIGUCHI <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

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

Make SSL tests more robust

commit   : bdd6e9ba171765ae34d320e1be17717620cb491c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jan 2019 10:29:07 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jan 2019 10:29:07 +0100    

Click here for diff

Someone running these test could have key or certificate files in  
their ~/.postgresql/, which would interfere with the tests.  The way  
to override that is to specify sslcert=invalid and/or  
sslrootcert=invalid if no actual certificate is used for a particular  
test.  Document that and fix up one test that had a risk of failing in  
these circumstances.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

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

Improve wording about WAL files in tar mode of pg_basebackup

commit   : 9745b528f7cb03be3afad0f91a634072c13ea91f    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 29 Jan 2019 10:42:41 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 29 Jan 2019 10:42:41 +0100    

Click here for diff

Author: Alex Kliukin  
Reviewed-By: Michael Paquier, Magnus Hagander  

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

postgres_fdw: Fix test for cached costs in estimate_path_cost_size().

commit   : 449d0a85507b07be3040df78a93e2966ed0908c8    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 29 Jan 2019 12:27:13 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 29 Jan 2019 12:27:13 +0900    

Click here for diff

estimate_path_cost_size() failed to re-use cached costs when the cached  
startup/total cost was 0, so it calculated the costs redundantly.  
  
This is an oversight in commit aa09cd242f; but apply the patch to HEAD  
only because there are no reports of actual trouble from that.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/5C4AF3F3.4060409%40lab.ntt.co.jp  

M contrib/postgres_fdw/postgres_fdw.c

Use catalog query to discover tables to process in vacuumdb

commit   : e0c2933a767c652429ddef674622b4656fa43092    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Jan 2019 11:22:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Jan 2019 11:22:03 +0900    

Click here for diff

vacuumdb would use a catalog query only when the command caller does not  
define a list of tables.  Switching to a catalog table represents two  
advantages:  
- Relation existence check can happen before running any VACUUM or  
ANALYZE query.  Before this change, if multiple relations are defined  
using --table, the utility would fail only after processing the  
firstly-defined ones, which may be a long some depending on the size of  
the relation.  This adds checks for the relation names, and does  
nothing, at least yet, for the attribute names.  
- More filtering options can become available for the utility user.  
These options, which may be introduced later on, are based on the  
relation size or the relation age, and need to be made available even if  
the user does not list any specific table with --table.  
  
Author: Nathan Bossart  
Reviewed-by: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/vacuumdb.c

commit   : da05eb51debd5d4b0284bcafa728244183c303ae    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 18:05:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 18:05:52 -0800    

Click here for diff

Previously llvmjit.h #error'ed when USE_LLVM was not defined, to  
prevent it from being included from code not having #ifdef USE_LLVM  
guards - but that's not actually that useful after, during the  
development of JIT support, LLVM related code was moved into a  
separately compiled .so.  Having that #error means cpluspluscheck  
doesn't work when llvm support isn't enabled, which isn't great.  
  
Similarly add USE_LLVM guards to llvmjit_emit.h, and additionally make  
sure it compiles standalone.  
  
Per complaint from Tom Lane.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11, where JIT support was added  

M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h

Revert "Move page initialization from RelationAddExtraBlocks() to use."

commit   : 684200543b4cbfe1ac002c9962e90683d4ea4691    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 17:16:56 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 17:16:56 -0800    

Click here for diff

This reverts commit fc02e6724f3ce069b33284bce092052ab55bd751 and  
e6799d5a53011985d916fdb48fe014a4ae70422e.  
  
Parts of the buildfarm error out with  
ERROR: page %u of relation "%s" should be empty but is not  
errors, and so far I/we do not know why. fc02e672 didn't fix the  
issue.  As I cannot reproduce the issue locally, it seems best to get  
the buildfarm green again, and reproduce the issue without time  
pressure.  

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

Fix race condition between relation extension and vacuum.

commit   : fc02e6724f3ce069b33284bce092052ab55bd751    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 15:41:23 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 15:41:23 -0800    

Click here for diff

In e6799d5a5301 I removed vacuumlazy.c trickery around re-checking  
whether a page is actually empty after acquiring an extension lock on  
the relation, because the page is not PageInit()ed anymore, and  
entries in the FSM ought not to lead to user-visible errors.  
  
As reported by various buildfarm animals that is not correct, given  
the way to code currently stands: If vacuum processes a page that's  
just been newly added by either RelationGetBufferForTuple() or  
RelationAddExtraBlocks(), it could add that page to the FSM and it  
could be reused by other backends, before those two functions check  
whether the newly added page is actually new.  That's a relatively  
narrow race, but several buildfarm machines appear to be able to hit  
it.  
  
While it seems wrong that the FSM, given it's lack of durability and  
approximative nature, can trigger errors like this, that seems better  
fixed in a separate commit. Especially given that a good portion of  
the buildfarm is red, and this is just re-introducing logic that  
existed a few hours ago.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Separate per-batch and per-tuple memory contexts in COPY

commit   : 36a1281f86c0f805462e9f05cacbe64779009845    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 29 Jan 2019 00:00:47 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 29 Jan 2019 00:00:47 +0100    

Click here for diff

In batching mode, COPY was using the same (per-tuple) memory context for  
allocations with longer lifetime. This was confusing but harmless, until  
commit 31f3817402 added COPY FROM ... WHERE feature, introducing a risk  
of memory leak.  
  
The "per-tuple" memory context was reset only when starting new batch,  
but as the rows may be filtered out by the WHERE clauses, that may not  
happen at all.  The WHERE clause however has to be evaluated for all  
rows, before filtering them out.  
  
This commit separates the per-tuple and per-batch contexts, removing the  
ambiguity.  Expressions (both defaults and WHERE clause) are evaluated  
in the per-tuple context, while tuples are formed in the batch context.  
This allows resetting the contexts at appropriate times.  
  
The main complexity is related to partitioning, in which case we need to  
reset the batch context after forming the tuple (which happens before  
routing to leaf partition).  Instead of switching between two contexts  
as before, we simply copy the last tuple aside, reset the context and  
then copy the tuple back.  The performance impact is negligible, and  
juggling with two contexts is not free either.  
  
Discussion: https://www.postgresql.org/message-id/flat/CALAY4q_DdpWDuB5-Zyi-oTtO2uSk8pmy+dupiRe3AvAc++1imA@mail.gmail.com  

M src/backend/commands/copy.c

In the planner, replace an empty FROM clause with a dummy RTE.

commit   : 4be058fe9ec5e630239b656af21fc083371f30ed    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Jan 2019 17:54:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Jan 2019 17:54:10 -0500    

Click here for diff

The fact that "SELECT expression" has no base relations has long been a  
thorn in the side of the planner.  It makes it hard to flatten a sub-query  
that looks like that, or is a trivial VALUES() item, because the planner  
generally uses relid sets to identify sub-relations, and such a sub-query  
would have an empty relid set if we flattened it.  prepjointree.c contains  
some baroque logic that works around this in certain special cases --- but  
there is a much better answer.  We can replace an empty FROM clause with a  
dummy RTE that acts like a table of one row and no columns, and then there  
are no such corner cases to worry about.  Instead we need some logic to  
get rid of useless dummy RTEs, but that's simpler and covers more cases  
than what was there before.  
  
For really trivial cases, where the query is just "SELECT expression" and  
nothing else, there's a hazard that adding the extra RTE makes for a  
noticeable slowdown; even though it's not much processing, there's not  
that much for the planner to do overall.  However testing says that the  
penalty is very small, close to the noise level.  In more complex queries,  
this is able to find optimizations that we could not find before.  
  
The new RTE type is called RTE_RESULT, since the "scan" plan type it  
gives rise to is a Result node (the same plan we produced for a "SELECT  
expression" query before).  To avoid confusion, rename the old ResultPath  
path type to GroupResultPath, reflecting that it's only used in degenerate  
grouping cases where we know the query produces just one grouped row.  
(It wouldn't work to unify the two cases, because there are different  
rules about where the associated quals live during query_planner.)  
  
Note: although this touches readfuncs.c, I don't think a catversion  
bump is required, because the added case can't occur in stored rules,  
only plans.  
  
Patch by me, reviewed by David Rowley and Mark Dilger  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/executor/execAmi.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/print.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/relation.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/prep.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec
M src/test/regress/expected/join.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/join.sql

commit   : 5c1186751214416fdf88f33a89c3dc88391d2d60    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 13:51:12 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 13:51:12 -0800    

Click here for diff

There's no reason not to install these, and jit.h can be useful for  
users of e.g. planner hooks.  
  
Author: Donald Dong  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where JIT compilation was introduced  

M src/include/Makefile

Move page initialization from RelationAddExtraBlocks() to use.

commit   : e6799d5a53011985d916fdb48fe014a4ae70422e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 13:15:11 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 28 Jan 2019 13:15:11 -0800    

Click here for diff

Previously we initialized pages when bulk extending in  
RelationAddExtraBlocks(). That has a major disadvantage: It ties  
RelationAddExtraBlocks() to heap, as other types of storage are likely  
to need different amounts of special space, have different amount of  
free space (previously determined by PageGetHeapFreeSpace()).  
  
That we're relying on initializing pages, but not WAL logging the  
initialization, also means the risk for getting  
"WARNING:  relation \"%s\" page %u is uninitialized --- fixing"  
style warnings in vacuums after crashes/immediate shutdowns, is  
considerably higher. The warning sounds much more serious than what  
they are.  
  
Fix those two issues together by not initializing pages in  
RelationAddExtraPages() (but continue to do so in  
RelationGetBufferForTuple(), which is linked much more closely to  
heap), and accepting uninitialized pages as normal in  
vacuumlazy.c. When vacuumlazy encounters an empty page it now adds it  
to the FSM, but does nothing else.  We chose to not issue a debug  
message, much less a warning in that case - it seems rarely useful,  
and quite likely to scare people unnecessarily.  
  
For now empty pages aren't added to the VM, because standbys would not  
re-discover such pages after a promotion. In contrast to other sources  
for empty pages, there's no corresponding WAL records triggering FSM  
updates during replay.  
  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

psql: Remove unused tab completion query

commit   : d4316b87bb8ec7a0ea04fb5fbc18f34a6799fe3f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 22:02:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 22:02:45 +0100    

Click here for diff

This was used for the old CLUSTER syntax, has been unused since  
e55c8e36ae44677dca4420bed07ad09d191fdf6c.  

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

commit   : bcf3f00be515c1da76b1d88923d01a78862467d3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 14:28:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Jan 2019 14:28:36 +0100    

Click here for diff

Reviewed-by: Kyotaro HORIGUCHI <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M doc/src/sgml/sslinfo.sgml

Add tab completion for ALTER INDEX ALTER COLUMN in psql

commit   : 23349b18d92d0dd522da17917bb5231f37a87d88    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Jan 2019 15:30:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Jan 2019 15:30:14 +0900    

Click here for diff

The completion here consists of attribute numbers, which is specific to  
this grammar.  
  
Author: Tatsuro Yamada  
Reviewed-by: Peter Eisentraut  
Discussion: https://portgr.es/m/[email protected]  

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

Revert "Avoid creation of the free space map for small heap relations."

commit   : a23676503b746b7f1588cd2ab0c60411032d32da    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 28 Jan 2019 11:31:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 28 Jan 2019 11:31:44 +0530    

Click here for diff

This reverts commit ac88d2962a96a9c7e83d5acfc28fe49a72812086.  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql
M doc/src/sgml/storage.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xact.c
M src/backend/storage/freespace/README
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/indexfsm.c
M src/include/storage/freespace.h
D src/test/regress/expected/fsm.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
D src/test/regress/sql/fsm.sql

Avoid creation of the free space map for small heap relations.

commit   : ac88d2962a96a9c7e83d5acfc28fe49a72812086    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 28 Jan 2019 08:14:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 28 Jan 2019 08:14:06 +0530    

Click here for diff

Previously, all heaps had FSMs. For very small tables, this means that the  
FSM took up more space than the heap did. This is wasteful, so now we  
refrain from creating the FSM for heaps with 4 pages or fewer. If the last  
known target block has insufficient space, we still try to insert into some  
other page before giving up and extending the relation, since doing  
otherwise leads to table bloat. Testing showed that trying every page  
penalized performance slightly, so we compromise and try every other page.  
This way, we visit at most two pages. Any pages with wasted free space  
become visible at next relation extension, so we still control table bloat.  
As a bonus, directly attempting one or two pages can even be faster than  
consulting the FSM would have been.  
  
Once the FSM is created for a heap we don't remove it even if somebody  
deletes all the rows from the corresponding relation.  We don't think it is  
a useful optimization as it is quite likely that relation will again grow  
to the same size.  
  
Author: John Naylor with design inputs and some code contribution by Amit Kapila  
Reviewed-by: Amit Kapila  
Tested-by: Mithun C Y  
Discussion: https://www.postgresql.org/message-id/CAJVSVGWvB13PzpbLEecFuGFc5V2fsO736BsdTakPiPAcdMM5tQ@mail.gmail.com  

M contrib/pageinspect/expected/page.out
M contrib/pageinspect/sql/page.sql
M doc/src/sgml/storage.sgml
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xact.c
M src/backend/storage/freespace/README
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/indexfsm.c
M src/include/storage/freespace.h
A src/test/regress/expected/fsm.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/fsm.sql

In bootstrap mode, don't allow the creation of files if they don't already exist.

commit   : d66e3664b8baf41908865ad363c6ba943e6f9c4e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 28 Jan 2019 07:51:02 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 28 Jan 2019 07:51:02 +0530    

Click here for diff

In commit's b9d01fe288 and 3908473c80, we have added some code where we  
allowed the creation of files during mdopen even if they didn't exist  
during the bootstrap mode.  The later commit obviates the need for same.  
  
This was harmless code till now but with an upcoming feature where we don't  
allow to create FSM for small tables, this will needlessly create FSM  
files.  
  
Author: John Naylor  
Reviewed-by: Amit Kapila  
Discussion: https://www.postgresql.org/message-id/CAJVSVGWvB13PzpbLEecFuGFc5V2fsO736BsdTakPiPAcdMM5tQ@mail.gmail.com  
	    https://www.postgresql.org/message-id/CAA4eK1KsET6sotf+rzOTQfb83pzVEzVhbQi1nxGFYVstVWXUGw@mail.gmail.com  

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

Add TAP tests for vacuumdb with column lists

commit   : 0803b0ae1ed6e5825eee4d1ba227e96cd8a328d8    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 27 Jan 2019 22:25:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 27 Jan 2019 22:25:48 +0900    

Click here for diff

vacuumdb generates by itself SQL queries to run ANALYZE or VACUUM on the  
backend, but we never actually checked for query patterns with column  
lists defined.  
  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/t/100_vacuumdb.pl

Allow for yet another crash symptom in 013_crash_restart.pl.

commit   : d6f6f0fc2d84906985b21d959622e4cab6f8f9b1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Jan 2019 22:12:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Jan 2019 22:12:48 -0500    

Click here for diff

Given the right timing, psql could emit "connection to server was lost"  
rather than one of the other messages that this test script checked for.  
It looks like commit 4247db625 may have made this more likely, but  
I don't really believe it was impossible before then.  Rather than  
stress about it, just add that spelling as one of the crash-successfully-  
detected cases.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/013_crash_restart.pl

Change function call information to be variable length.

commit   : a9c35cf85ca1ff72f16f0f10d7ddee6e582b62b8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Jan 2019 14:17:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Jan 2019 14:17:52 -0800    

Click here for diff

Before this change FunctionCallInfoData, the struct arguments etc for  
V1 function calls are stored in, always had space for  
FUNC_MAX_ARGS/100 arguments, storing datums and their nullness in two  
arrays.  For nearly every function call 100 arguments is far more than  
needed, therefore wasting memory. Arg and argnull being two separate  
arrays also guarantees that to access a single argument, two  
cachelines have to be touched.  
  
Change the layout so there's a single variable-length array with pairs  
of value / isnull. That drastically reduces memory consumption for  
most function calls (on x86-64 a two argument function now uses  
64bytes, previously 936 bytes), and makes it very likely that argument  
value and its nullness are on the same cacheline.  
  
Arguments are stored in a new NullableDatum struct, which, due to  
padding, needs more memory per argument than before. But as usually  
far fewer arguments are stored, and individual arguments are cheaper  
to access, that's still a clear win.  It's likely that there's other  
places where conversion to NullableDatum arrays would make sense,  
e.g. TupleTableSlots, but that's for another commit.  
  
Because the function call information is now variable-length  
allocations have to take the number of arguments into account. For  
heap allocations that can be done with SizeForFunctionCallInfoData(),  
for on-stack allocations there's a new LOCAL_FCINFO(name, nargs) macro  
that helps to allocate an appropriately sized and aligned variable.  
  
Some places with stack allocation function call information don't know  
the number of arguments at compile time, and currently variably sized  
stack allocations aren't allowed in postgres. Therefore allow for  
FUNC_MAX_ARGS space in these cases. They're not that common, so for  
now that seems acceptable.  
  
Because of the need to allocate FunctionCallInfo of the appropriate  
size, older extensions may need to update their code. To avoid subtle  
breakages, the FunctionCallInfoData struct has been renamed to  
FunctionCallInfoBaseData. Most code only references FunctionCallInfo,  
so that shouldn't cause much collateral damage.  
  
This change is also a prerequisite for more efficient expression JIT  
compilation (by allocating the function call information on the stack,  
allowing LLVM to optimize it away); previously the size of the call  
information caused problems inside LLVM's optimizer.  
  
Author: Andres Freund  
Reviewed-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore/hstore_op.c
M doc/src/sgml/plhandler.sgml
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/README
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execSRF.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/postmaster/pgstat.c
M src/backend/tcop/fastpath.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/fmgr/README
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/sort/sortsupport.c
M src/include/executor/execExpr.h
M src/include/executor/nodeAgg.h
M src/include/fmgr.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/nodes/execnodes.h
M src/include/pgstat.h
M src/include/postgres.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/tcl/pltcl.c
M src/tools/pgindent/typedefs.list

Fix psql's "\g target" meta-command to work with COPY TO STDOUT.

commit   : 6d3ede5f1c654f923b2767b0b0c3b09569adaa18    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Jan 2019 14:15:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Jan 2019 14:15:42 -0500    

Click here for diff

Previously, \g would successfully execute the COPY command, but  
the target specification if any was ignored, so that the data was  
always dumped to the regular query output target.  This seems like  
a clear bug, so let's not just fix it but back-patch it.  
  
While at it, adjust the documentation for \copy to recommend  
"COPY ... TO STDOUT \g foo" as a plausible alternative.  
  
Back-patch to 9.5.  The problem exists much further back, but the  
code associated with \g was refactored enough in 9.5 that we'd  
need a significantly different patch for 9.4, and it doesn't  
seem worth the trouble.  
  
Daniel Vérité, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/common.c
M src/bin/psql/copy.c

Make regression test output locale-independent

commit   : 1e4730c639acb967b8e40e6f33e81ebe1721ea5f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 26 Jan 2019 09:22:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 26 Jan 2019 09:22:27 +0100    

Click here for diff

In some locales, letters sort before numbers, so change the object  
naming to not depend on that.  Introduced by commit  
7c079d7417a8f2d4bf5144732e2f85117db9214f.  

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

Allow UNLISTEN in hot-standby mode.

commit   : ebfe20dc706bd3238a9bdf3b44cd8f82337e86a8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Jan 2019 21:14:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Jan 2019 21:14:31 -0500    

Click here for diff

Since LISTEN is (still) disallowed, UNLISTEN must be a no-op in a  
hot-standby session, and so there's no harm in allowing it.  This  
change allows client code to not worry about whether it's connected  
to a primary or standby server when performing session-state-reset  
type activities.  (Note that DISCARD ALL, which includes UNLISTEN,  
was already allowed, making it inconsistent to reject UNLISTEN.)  
  
Per discussion, back-patch to all supported versions.  
  
Shay Rojansky, reviewed by Mi Tar  
  
Discussion: https://postgr.es/m/CADT4RqCf2gA_TJtPAjnGzkC3ZiexfBZiLmA-mV66e4UyuVv8bA@mail.gmail.com  

M doc/src/sgml/high-availability.sgml
M src/backend/tcop/utility.c
M src/test/regress/expected/hs_standby_allowed.out
M src/test/regress/expected/hs_standby_disallowed.out
M src/test/regress/sql/hs_standby_allowed.sql
M src/test/regress/sql/hs_standby_disallowed.sql

Simplify restriction handling of two-phase commit for temporary objects

commit   : c9b75c5838feeae73dbae00bce9d8f650b80ba38    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 26 Jan 2019 10:45:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 26 Jan 2019 10:45:23 +0900    

Click here for diff

There were two flags used to track the access to temporary tables and  
to the temporary namespace of a session which are used to restrict  
PREPARE TRANSACTION, however the first control flag is a concept  
included in the second.  This removes the flag for temporary table  
tracking, keeping around only the one at namespace level.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/relation.c
M src/backend/access/transam/xact.c
M src/backend/commands/lockcmds.c
M src/backend/commands/tablecmds.c
M src/include/access/xact.h
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/regress/expected/temp.out

SQL comment: remove extra word in heading comment

commit   : df4c9044406f1e907268930dd12ba6c3642d21dd    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 25 Jan 2019 18:57:21 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 25 Jan 2019 18:57:21 -0500    

Click here for diff

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

M src/tutorial/advanced.source

Split QTW_EXAMINE_RTES flag into QTW_EXAMINE_RTES_BEFORE/_AFTER.

commit   : 18c0da88a5d9da566c3bfac444366b73bd0b57da    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Jan 2019 17:09:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Jan 2019 17:09:45 -0500    

Click here for diff

This change allows callers of query_tree_walker() to choose whether  
to visit an RTE before or after visiting the contents of the RTE  
(i.e., prefix or postfix tree order).  All existing users of  
QTW_EXAMINE_RTES want the QTW_EXAMINE_RTES_BEFORE behavior, but  
an upcoming patch will want QTW_EXAMINE_RTES_AFTER, and it seems  
like a potentially useful change on its own.  
  
Andreas Karlsson (extracted from CTE inlining patch)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/rewrite/rewriteManip.c
M src/include/nodes/nodeFuncs.h

Teach nulltestsel() that system columns are never NULL.

commit   : ff750ce2d82979e9588c629955e161a9379b05f3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Jan 2019 11:44:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Jan 2019 11:44:26 -0500    

Click here for diff

While it's perhaps unlikely that users would write an explicit test  
like "ctid IS NULL", this function is also used in range estimation,  
and an incorrect answer can throw off the results for tight ranges.  
Anyway it's not much code so we might as well do it.  
  
Edmund Horner  
  
Discussion: https://postgr.es/m/CAMyN-kCa3BFUFrCTtQeprxTU1anCd3Pua7zXstGCKq4pXgjukw@mail.gmail.com  

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

Fix possibly-uninitialized-variable warning from commit 9556aa01c.

commit   : 6119060d01ab2dfb9e2c1c101595f2de7890965d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Jan 2019 11:27:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Jan 2019 11:27:44 -0500    

Click here for diff

Heikki's compiler doesn't complain about end_ptr, apparently,  
but mine does.  
  
In passing, I failed to resist the temptation to remove the  
no-longer-used fldnum variable, and relocate chunk_len's  
declaration to a narrower scope.  

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

Use single-byte Boyer-Moore-Horspool search even with multibyte encodings.

commit   : 9556aa01c69a26ca726d8dda8e395acc7c1e30fc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 25 Jan 2019 16:25:05 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 25 Jan 2019 16:25:05 +0200    

Click here for diff

The old implementation first converted the input strings to arrays of  
wchars, and performed the conversion on those. However, the conversion is  
expensive, and for a large input string, consumes a lot of memory.  
Allocating the large arrays also meant that these functions could not be  
used on strings larger 1 GB / pg_encoding_max_length() (256 MB for UTF-8).  
  
Avoid the conversion, and instead use the single-byte algorithm even with  
multibyte encodings. That can get fooled, if there is a matching byte  
sequence in the middle of a multi-byte character, so to eliminate false  
positives like that, we verify any matches by walking the string character  
by character with pg_mblen(). Also, if the caller needs the position of  
the match, as a character-offset, we also need to walk the string to count  
the characters.  
  
Performance testing shows that walking the whole string with pg_mblen() is  
somewhat slower than converting the whole string to wchars. It's still  
often a win, though, because we don't need to do it if there is no match,  
and even when there is, we only need to walk up to the point where the  
match is, not the whole string. Even in the worst case, there would be  
room for optimization: Much of the CPU time in the current loop with  
pg_mblen() is function call overhead, and could be improved by inlining  
pg_mblen() and/or the encoding-specific mblen() functions. But I didn't  
attempt to do that as part of this patch.  
  
Most of the callers of text_position_setup/next functions were actually  
not interested in the position of the match, counted in characters. To  
cater for them, refactor the text_position_next() interface into two  
parts: searching for the next match (text_position_next()), and returning  
the current match's position as a pointer (text_position_get_match_ptr())  
or as a character offset (text_position_get_match_pos()). Getting the  
pointer to the match is a more convenient API for many callers, and with  
UTF-8, it allows skipping the character-walking step altogether, because  
UTF-8 can't have false matches even when treated like raw byte strings.  
  
Reviewed-by: John Naylor  
Discussion: https://www.postgresql.org/message-id/3173d989-bc1c-fc8a-3b69-f24246f73876%40iki.fi  

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

Fix comments that claimed that mblen() only looks at first byte.

commit   : a5be6e9a1dfe820807f9ccb21dec5144982618e6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 25 Jan 2019 14:54:38 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 25 Jan 2019 14:54:38 +0200    

Click here for diff

GB18030's mblen() function looks at the first and the second byte of the  
multibyte character, to determine its length. copy.c had made the  
assumption that mblen() only looks at the first byte, but it turns out to  
work out fine, because of the way the GB18030 encoding works. COPY will  
see a 4-byte encoded character as two 2-byte encoded characters, which is  
enough for COPY's purposes. It cannot mix those up with delimiter or  
escaping characters, because only single-byte ASCII characters are  
supported as delimiters or escape characters.  
  
Discussion: https://www.postgresql.org/message-id/7704d099-9643-2a55-fb0e-becd64400dcb%40iki.fi  

M src/backend/commands/copy.c
M src/backend/utils/mb/wchar.c

Allow generalized expression syntax for partition bounds

commit   : 7c079d7417a8f2d4bf5144732e2f85117db9214f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jan 2019 11:27:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Jan 2019 11:27:59 +0100    

Click here for diff

Previously, only literals were allowed.  This change allows general  
expressions, including functions calls, which are evaluated at the  
time the DDL command is executed.  
  
Besides offering some more functionality, it simplifies the parser  
structures and removes some inconsistencies in how the literals were  
handled.  
  
Author: Kyotaro Horiguchi, Tom Lane, Amit Langote  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_utilcmd.c
M src/include/optimizer/clauses.h
M src/include/parser/parse_node.h
M src/include/utils/partcache.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Remove _configthreadlocale() calls in ecpg test suite.

commit   : e3565fd61cee16414a682d2be0d44c112a80a30c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Jan 2019 17:02:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Jan 2019 17:02:09 -0500    

Click here for diff

This essentially reverts commits a772624b1 and 04fbe0e45, which  
added "_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)" calls to the  
thread-related ecpg test programs.  That was nothing but a hack,  
because we shouldn't expect that ecpg-using applications have  
done that for us; and now that we've inserted such calls into  
ecpglib, the tests should still pass without it.  
  
(If they don't, it would be good to know that.)  
  
HEAD only; there seems no big need to change this in the  
back branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-descriptor.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/ecpg/test/expected/thread-thread.c
M src/interfaces/ecpg/test/expected/thread-thread_implicit.c
M src/interfaces/ecpg/test/thread/alloc.pgc
M src/interfaces/ecpg/test/thread/descriptor.pgc
M src/interfaces/ecpg/test/thread/prep.pgc
M src/interfaces/ecpg/test/thread/thread.pgc
M src/interfaces/ecpg/test/thread/thread_implicit.pgc

Remove infinite-loop hazards in ecpg test suite.

commit   : d5a1fde397269bd60b99e70a4eb2934b75fd31ec    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Jan 2019 16:46:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Jan 2019 16:46:55 -0500    

Click here for diff

A report from Andrew Dunstan showed that an ecpglib breakage that  
causes repeated query failures could lead to infinite loops in some  
ecpg test scripts, because they contain "while(1)" loops with no  
exit condition other than successful test completion.  That might  
be all right for manual testing, but it seems entirely unacceptable  
for automated test environments such as our buildfarm.  We don't  
want buildfarm owners to have to intervene manually when a test  
goes wrong.  
  
To fix, just change all those while(1) loops to exit after at most  
100 iterations (which is more than any of them expect to iterate).  
This seems sufficient since we'd see discrepancies in the test output  
if any loop executed the wrong number of times.  
  
I tested this by dint of intentionally breaking ecpg_do_prologue  
to always fail, and verifying that the tests still got to completion.  
  
Back-patch to all supported branches, since the whole point of this  
exercise is to protect the buildfarm against future mistakes.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/compat_informix/test_informix.pgc
M src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/pgtypeslib-nan_test.c
M src/interfaces/ecpg/test/expected/preproc-autoprep.c
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/preproc-whenever_do_continue.c
M src/interfaces/ecpg/test/expected/sql-fetch.c
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/pgtypeslib/nan_test.pgc
M src/interfaces/ecpg/test/preproc/autoprep.pgc
M src/interfaces/ecpg/test/preproc/outofscope.pgc
M src/interfaces/ecpg/test/preproc/variable.pgc
M src/interfaces/ecpg/test/preproc/whenever_do_continue.pgc
M src/interfaces/ecpg/test/sql/fetch.pgc
M src/interfaces/ecpg/test/sql/quote.pgc

PL/pgSQL: Add statement ID to statement structures

commit   : bbd5c207b960dd072445a3547f16abea0c27f726    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Jan 2019 22:23:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Jan 2019 22:23:12 +0100    

Click here for diff

This can be used by a profiler as the index for an array of  
per-statement metrics.  
  
Author: Pavel Stehule <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRDRCjN6rpM9ZccU7Ta_afsNX7mg9=n34F+r445Nt9v2tA@mail.gmail.com/  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h

Fix whitespace

commit   : bf2fb2e03ebd897575d7428c73ae6ba7b1f91fc7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Jan 2019 21:58:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Jan 2019 21:58:37 +0100    

Click here for diff

M src/bin/pg_upgrade/function.c

Fix droppability of constraints upon partition detach

commit   : efd9366dcedec8db9fc85e77d071b0c5a6badea2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 24 Jan 2019 14:09:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 24 Jan 2019 14:09:56 -0300    

Click here for diff

We were failing to set conislocal correctly for constraints in  
partitions after partition detach, leading to those constraints becoming  
undroppable.  Fix by setting the flag correctly.  Existing databases  
might contain constraints with the conislocal wrongly set to false, for  
partitions that were detached; this situation should be fixable by  
applying an UPDATE on pg_constraint to set conislocal true.  This  
problem should otherwise be innocuous and should disappear across a  
dump/restore or pg_upgrade.  
  
Secondarily, when constraint drop was attempted in a partitioned table,  
ATExecDropConstraint would try to recurse to partitions after doing  
performDeletion() of the constraint in the partitioned table itself; but  
since the constraint in the partitions are dropped by the initial call  
of performDeletion() (because of following dependencies), the recursion  
step would fail since it would not find the constraint, causing the  
whole operation to fail.  Fix by preventing recursion.  
  
Reported-by: Amit Langote  
Diagnosed-by: Amit Langote  
Author: Amit Langote, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Fix portability problem in pgbench.

commit   : e6c3ba7fbfd59ceabcf9bdaf52d71b44831b09d2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Jan 2019 11:31:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Jan 2019 11:31:54 -0500    

Click here for diff

The pgbench regression test supposed that srandom() with a specific value  
would result in deterministic output from random(), as required by POSIX.  
It emerges however that OpenBSD is too smart to be constrained by mere  
standards, so their random() emits nondeterministic output anyway.  
While a workaround does exist, what seems like a better fix is to stop  
relying on the platform's srandom()/random() altogether, so that what  
you get from --random-seed=N is not merely deterministic but platform  
independent.  Hence, use a separate pg_jrand48() random sequence in  
place of random().  
  
Also adjust the regression test case that's supposed to detect  
nondeterminism so that it's more likely to detect it; the original  
choice of random_zipfian parameter tended to produce the same output  
all the time even if the underlying behavior wasn't deterministic.  
  
In passing, improve pgbench's docs about random_zipfian().  
  
Back-patch to v11 where this code was introduced.  
  
Fabien Coelho and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Simplify coding to detach constraints when detaching partition

commit   : 19184fcc09739abf75ccdada965ed6135c6d07c3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 24 Jan 2019 11:18:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 24 Jan 2019 11:18:35 -0300    

Click here for diff

The original coding was too baroque and led to an use-after-release  
mistake, noticed by buildfarm member prion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

postgres_fdw: Account for tlist eval costs in estimate_path_cost_size().

commit   : fd1afdbafd4fbb0ce23a3f319adc177e4cf8fe99    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 24 Jan 2019 16:49:17 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 24 Jan 2019 16:49:17 +0900    

Click here for diff

Previously, estimate_path_cost_size() didn't account for tlist eval  
costs, except when costing a foreign-grouping path using local  
statistics, but such costs should be accounted for when costing that path  
using remote estimates, because some of the tlist expressions might be  
evaluated locally.  Also, such costs should be accounted for in the case  
of a foreign-scan or foreign-join path, because the tlist might contain  
PlaceHolderVars, which postgres_fdw currently evaluates locally.  
  
This also fixes an oversight in my commit f8f6e44676.  
  
Like that commit, apply this to HEAD only to avoid destabilizing existing  
plan choices.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/5BFD3EAD.2060301%40lab.ntt.co.jp  

M contrib/postgres_fdw/postgres_fdw.c

Blind attempt to fix _configthreadlocale() failures on MinGW.

commit   : 2cf91ccb73ce888c44e3751548fb7c77e87335f2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Jan 2019 22:46:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Jan 2019 22:46:45 -0500    

Click here for diff

Apparently, some builds of MinGW contain a version of  
_configthreadlocale() that always returns -1, indicating failure.  
Rather than treating that as a curl-up-and-die condition, soldier on  
as though the function didn't exist.  This leaves us without thread  
safety on such MinGW versions, but we didn't have it anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Detach constraints when partitions are detached

commit   : ae366aa57762ad0e6a1a0885a7644e79541afe39    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 23 Jan 2019 23:57:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 23 Jan 2019 23:57:46 -0300    

Click here for diff

I (Álvaro) forgot to do this in eb7ed3f30634, leading to undroppable  
constraints after partitions are detached.  Repair.  
  
Reported-by: Amit Langote  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Remove argument isprimary from index_build()

commit   : 289198c0d93a3d591f379c4134e90275bd426426    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Jan 2019 07:57:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Jan 2019 07:57:09 +0900    

Click here for diff

The flag was introduced in 3fdeb18, but f66e8bf actually forgot to  
finish the cleanup as index_update_stats() has simplified its  
interface.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/include/catalog/index.h

Fix misc typos in comments.

commit   : 95931133a959404cf7320b49058b2f1c2e4606b9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 23 Jan 2019 13:39:00 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 23 Jan 2019 13:39:00 +0200    

Click here for diff

Spotted mostly by Fabien Coelho.  
  
Discussion: https://www.postgresql.org/message-id/alpine.DEB.2.21.1901230947050.16643@lancre  

M contrib/pgcrypto/pgp-decrypt.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/gin/ginget.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execParallel.c
M src/backend/executor/execTuples.c
M src/backend/parser/gram.y
M src/backend/tcop/postgres.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/typcache.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/include/nodes/execnodes.h
M src/include/port.h
M src/pl/plpython/plpy_elog.c

Fix typo in pgbench.c

commit   : 1699e6dd1fa7fbc7c3d114b121828eb27eb523b1    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 23 Jan 2019 14:57:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 23 Jan 2019 14:57:29 +0900    

Click here for diff

Author: Moon, Insung  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Doc: fix typo in URL of OASIS group web site.

commit   : 78855e798325f64e36e2775031137ea83ad0c3ef    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 23 Jan 2019 13:06:45 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 23 Jan 2019 13:06:45 +0900    

Click here for diff

In other places that has been changed from http://www.oasis-open.org/  
https://www.oasis-open.org/ but there's a place where the change was  
missed.  
Discussion: https://postgr.es/m/20190121.222844.399814306477973879.t-ishii%40sraoss.co.jp  

M doc/src/sgml/docguide.sgml

Make vacuumdb test regex more modular for its query output

commit   : adaaacae658e37a3e3c836266681774395b437fe    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 23 Jan 2019 09:57:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 23 Jan 2019 09:57:19 +0900    

Click here for diff

This is in preparation for always using a catalog query to discover  
tables, where the ANALYZE and VACUUM queries get completed with relation  
names.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/t/100_vacuumdb.pl

Fix handling of volatile expressions in COPY FROM ... WHERE

commit   : 4a8283d0ec5a6781b9e0d4ba16b44da8a0856d02    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 22 Jan 2019 23:11:17 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 22 Jan 2019 23:11:17 +0100    

Click here for diff

The checking for calls to volatile functions in the COPY FROM ... WHERE  
expression was treating all WHERE clauses as if containing such calls.  
While that does not produce incorrect results, this disables batching  
which may result in significant performance regression.  
  
Discussion: https://www.postgresql.org/message-id/flat/CALAY4q_DdpWDuB5-Zyi-oTtO2uSk8pmy+dupiRe3AvAc++1imA@mail.gmail.com  

M src/backend/commands/copy.c

llvm: Fix file-ending in IDENTIFICATION comments.

commit   : 005881033d4e34c0b2e0a157464dc1929db52e17    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Jan 2019 11:46:59 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Jan 2019 11:46:59 -0800    

Click here for diff

Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where llvm was introduced.  

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

Adjust documentation for vacuumdb --disable-page-skipping

commit   : efab708997dcd7a78cce289bcd9d3643a3455465    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 22 Jan 2019 11:21:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 22 Jan 2019 11:21:07 +0900    

Click here for diff

This makes the description more consistent with the other options, and  
the mapping with VACUUM is intuitive.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

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

Rename RelationData.rd_amroutine to rd_indam.

commit   : 346ed70b0ad7efc574711a97812692dab4542712    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:36:55 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:36:55 -0800    

Click here for diff

The upcoming table AM support makes rd_amroutine to generic, as its  
only about index AMs. The new name makes that clear, and is shorter to  
boot.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/index/indexam.c
M src/backend/catalog/index.c
M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeIndexscan.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/cache/relcache.c
M src/include/utils/rel.h

Rephrase references to "time qualification".

commit   : ebcc7bf949bae614cccc6b86e3ef9b926a6e2f99    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:03:15 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:03:15 -0800    

Click here for diff

Now that the relevant code has, for other reasons, moved out of  
tqual.[ch], it seems time to refer to visiblity rather than time  
qualification.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/indexam.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/utils/cache/inval.c

Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c.

commit   : c91560defc57f89f7e88632ea14ae77b5cec78ee    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:03:15 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:03:15 -0800    

Click here for diff

Given these routines are heap specific, and that there will be more  
generic visibility support in via table AM, it makes sense to move the  
prototypes to heapam.h (routines like HeapTupleSatisfiesVacuum will  
not be exposed in a generic fashion, because they are too storage  
specific).  
  
Similarly, the code in tqual.c is specific to heap, so moving it into  
access/heap/ makes sense.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_visibility/pg_visibility.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/heap/Makefile
M src/backend/access/heap/heapam.c
R099 src/backend/utils/time/tqual.c src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/genam.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/xact.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSamplescan.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/inval.c
M src/backend/utils/time/Makefile
M src/include/access/heapam.h
M src/include/utils/snapshot.h
D src/include/utils/tqual.h

commit   : b7eda3e0e33402a7727253e6f307ca96b92eb23d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:03:15 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:03:15 -0800    

Click here for diff

The code in tqual.c is largely heap specific. Due to the upcoming  
pluggable storage work, it therefore makes sense to move it into  
access/heap/ (as the file's header notes, the tqual name isn't very  
good).  
  
But the various statically allocated snapshot and snapshot  
initialization functions are now (see previous commit) generic and do  
not depend on functions declared in tqual.h anymore. Therefore move.  
Also move XidInMVCCSnapshot as that's useful for future AMs, and  
already used outside of tqual.c.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M contrib/sepgsql/database.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/catalog/catalog.c
M src/backend/commands/async.c
M src/backend/commands/constraint.c
M src/backend/executor/execIndexing.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/time/snapmgr.c
M src/backend/utils/time/tqual.c
M src/include/utils/snapmgr.h
M src/include/utils/tqual.h

Change snapshot type to be determined by enum rather than callback.

commit   : 63746189b23815415cacc715fdc4f6b991f1a5e7    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:03:15 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 17:03:15 -0800    

Click here for diff

This is in preparation for allowing the same snapshot be used for  
different table AMs. With the current callback based approach we would  
need one callback for each supported AM, which clearly would not be  
extensible.  Thus add a new Snapshot->snapshot_type field, and move  
the dispatch into HeapTupleSatisfiesVisibility() (which is now a  
function). Later work will then dispatch calls to  
HeapTupleSatisfiesVisibility() and other AMs visibility functions  
depending on the type of the table.  The central SnapshotType enum  
also seems like a good location to centralize documentation about the  
intended behaviour of various types of snapshots.  
  
As tqual.h isn't included by bufmgr.h any more (as HeapTupleSatisfies*  
isn't referenced by TestForOldSnapshot() anymore) a few files now need  
to include it directly.  
  
Author: Andres Freund, loosely based on earlier work by Haribabu Kommi  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M contrib/pg_visibility/pg_visibility.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/replication/logical/snapbuild.c
M src/backend/utils/time/snapmgr.c
M src/backend/utils/time/tqual.c
M src/include/storage/bufmgr.h
M src/include/utils/snapshot.h
M src/include/utils/tqual.h
M src/tools/pgindent/typedefs.list

Remove useless bms_copy step in RelationGetIndexAttrBitmap.

commit   : 8f9e934ab746907abbeeed06a1a9b995e5b4d339    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 18:33:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 18:33:32 -0500    

Click here for diff

Seems to be from a bad case of copy-and-paste-itis in commit 665d1fad9.  
It wouldn't be quite so annoying if it didn't contradict the comment  
half a dozen lines above.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f95Dyf8Qkdz4W+PbCmT-HTb54tkqUCC8isa2RVgSJ_pXQ@mail.gmail.com  

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

Create action triggers when partitions are detached

commit   : 0464fdf07f69452dd67dd798c026d82c956bda33    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 21 Jan 2019 19:59:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 21 Jan 2019 19:59:07 -0300    

Click here for diff

Detaching a partition from a partitioned table that's constrained by  
foreign keys requires additional action triggers on the referenced side;  
otherwise, DELETE/UPDATE actions there fail to notice rows in the table  
that was partition, and so are incorrectly allowed through.  With this  
commit, those triggers are now created.  Conversely, when a table that  
has a foreign key is attached as a partition to a table that also has  
the same foreign key, those action triggers are no longer needed, so we  
remove them.  
  
Add a minimal test case verifying (part of) this.  
  
Authors: Amit Langote, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Flush relcache entries when their FKs are meddled with

commit   : 175544093524bef9c28c59c8d49c77b1fcf4fb92    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 21 Jan 2019 19:34:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 21 Jan 2019 19:34:11 -0300    

Click here for diff

Back in commit 100340e2dcd0, we made relcache entries keep lists of the  
foreign keys applying to the relation -- but we forgot to update  
CacheInvalidateHeapTuple to flush those entries when new FKs got created  
or existing ones updated/deleted.  No bugs appear to have been reported  
that would be explained by this ommission, but I noticed the problem  
while working on an unrelated bugfix which clearly showed it.  Fix by  
adding relcache flush on relevant foreign key changes.  
  
Backpatch to 9.6, like the aforementioned commit.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Tom Lane  

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

Second try at fixing ecpglib thread-safety problem.

commit   : ee27584c4a40620fb26d1729e9cc449d54d62b07    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 16:17:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 16:17:10 -0500    

Click here for diff

While Windows (allegedly) has _configthreadlocale() pretty far back,  
it seems MinGW didn't acquire support for that till more recently.  
Fortunately, we can use an autoconf probe on that toolchain,  
instead of guessing whether it's there.  (Hm, I wonder whether Cygwin  
will need this also.)  
  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c

Fix "Remove superfluous tqual.h includes" by adding back one include.

commit   : 527114e51e45dbd91d46171fa4a111355f0dfc3b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 12:59:31 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 12:59:31 -0800    

Click here for diff

I removed one include too many in e7cc78ad43eb, not sure why that  
escaped my test script.  
  
Author: Andres Freund  

M src/backend/catalog/catalog.c

Fix sepgsql regression test.

commit   : 071e11898dd42c89dc68ddc4e4fe6a35049729d6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 15:39:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 15:39:08 -0500    

Click here for diff

Message order in the expected output changes due to commit f1ad067fc.  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/expected/ddl.out

Remove superfluous tqual.h includes.

commit   : e7cc78ad43eb1a6ea43dbb46c83264d2d00e402c    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 12:15:02 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 12:15:02 -0800    

Click here for diff

Most of these had been obsoleted by 568d4138c / the SnapshotNow  
removal.  
  
This is is preparation for moving most of tqual.[ch] into either  
snapmgr.h or heapam.h, which in turn is in preparation for pluggable  
table AMs.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/sepgsql/label.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/alter.c
M src/backend/commands/comment.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/proclang.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeLockRows.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tid.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/init/postinit.c
M src/include/utils/tqual.h

Replace uses of heap_open et al with the corresponding table_* function.

commit   : e0c4ec07284db817e1f8d9adfb3fffc952252db0    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 10:32:19 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 10:32:19 -0800    

Click here for diff

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

M contrib/amcheck/verify_nbtree.c
M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M src/backend/access/brin/brin.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/toasting.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/tablesync.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/queryenvironment.c

Replace heapam.h includes with {table, relation}.h where applicable.

commit   : 111944c5ee567f1c45bf0f1ecfdec682af467aa6    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 10:18:20 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 10:18:20 -0800    

Click here for diff

A lot of files only included heapam.h for relation_open, heap_open etc  
- replace the heapam.h include in those files with the narrower  
header.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_freespacemap/pg_freespacemap.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstatindex.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M src/backend/access/brin/brin.c
M src/backend/access/hash/hashinsert.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_type.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/user.c
M src/backend/commands/view.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/misc/queryenvironment.c

Introduce access/{table.h, relation.h}, for generic functions from heapam.h.

commit   : 4b21acf522d751ba5b6679df391d5121b6c4a35f    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 10:14:09 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 10:14:09 -0800    

Click here for diff

access/heapam contains functions that are very storage specific (say  
heap_insert() and a lot of lower level functions), and fairly generic  
infrastructure like relation_open(), heap_open() etc.  In the upcoming  
pluggable storage work we're introducing a layer between table  
accesses in general and heapam, to allow for different storage  
methods. For a bit cleaner separation it thus seems advantageous to  
move generic functions like the aforementioned to their own headers.  
  
access/relation.h will contain relation_open() etc, and access/table.h  
will contain table_open() (formerly known as heap_open()). I've decided  
for table.h not to include relation.h, but we might change that at a  
later stage.  
  
relation.h already exists in another directory, but the other  
plausible name (rel.h) also conflicts. It'd be nice if there were a  
non-conflicting name, but nobody came up with a suggestion. It's  
possible that the appropriate way to address the naming conflict would  
be to rename nodes/relation.h, which isn't particularly well named.  
  
To avoid breaking a lot of extensions that just use heap_open() etc,  
table.h has macros mapping the old names to the new ones, and heapam.h  
includes relation, table.h.  That also allows to keep the  
bulk renaming of existing callers in a separate commit.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/Makefile
M src/backend/access/common/Makefile
A src/backend/access/common/relation.c
M src/backend/access/heap/heapam.c
A src/backend/access/table/Makefile
A src/backend/access/table/table.c
M src/include/access/heapam.h
A src/include/access/relation.h
A src/include/access/table.h

Sort the dependent objects before recursing in findDependentObjects().

commit   : f1ad067fc3ae3d34dc6b8826913d454cc3fe354f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 13:48:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 13:48:07 -0500    

Click here for diff

Historically, the notices output by DROP CASCADE tended to come out  
in uncertain order, and in some cases you might get different claims  
about which object depends on which other one.  This is because we  
just traversed the dependency tree in the order in which pg_depend  
entries are seen, and nbtree has never promised anything about the  
order of equal-keyed index entries.  We've put up with that for years,  
hacking regression tests when necessary to prevent them from emitting  
unstable output.  However, it's a problem for pending work that will  
change nbtree's behavior for equal keys, as that causes unexpected  
changes in the regression test results.  
  
Hence, adjust findDependentObjects to sort the results of each  
indexscan before processing them.  The sort is on descending OID of  
the dependent objects, hence more or less reverse creation order.  
While this rule could still result in bogus regression test failures  
if an OID wraparound occurred mid-test, that seems unlikely to happen  
in any plausible development or packaging-test scenario.  
  
This is enough to ensure output stability for ordinary DROP CASCADE  
commands, but not for DROP OWNED BY, because that has a different  
code path with the same problem.  We might later choose to sort in  
the DROP OWNED BY code as well, but this patch doesn't do so.  
  
I've also not done anything about reverting the existing hacks to  
suppress unstable DROP CASCADE output in specific regression tests.  
It might be worth undoing those, but it seems like a distinct question.  
  
The first indexscan loop in findDependentObjects is not touched,  
meaning there is a hazard of unstable error reports from that too.  
However, said hazard is not the fault of that code: it was designed  
on the assumption that there could be at most one "owning" object  
to complain about, and that assumption does not seem unreasonable.  
The recent patch that added the possibility of multiple  
DEPENDENCY_INTERNAL_AUTO links broke that assumption, but we should  
fix that situation not band-aid around it.  That's a matter for  
another patch, though.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_type.out
M src/test/regress/expected/domain.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/updatable_views.out

Add 'id' to Acknowledgments section

commit   : fcea1e10904856bbc77b701a0195d0524b9705d6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 21 Jan 2019 14:41:44 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 21 Jan 2019 14:41:44 -0300    

Click here for diff

Per note from Erik Rijkers  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-11.sgml

Fix ALTER TRIGGER ... RENAME, broken in WITH OIDS removal.

commit   : 8cc157b23413c21f229e376cb2982a2086655fc9    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 09:12:31 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 09:12:31 -0800    

Click here for diff

I (Andres) broke this in 578b229718e.  
  
Author: Rushabh Lathia  
Discussion: https://postgr.es/m/CAGPqQf04PywZX3sVQaF6H=oLiW9GJncRW+=e78vTy4MokEWcZw@mail.gmail.com  

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

Adjust some more comments for WITH OIDS removal.

commit   : 93507e67c9ca54026019ebec3026de35d30370f9    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 09:05:51 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Jan 2019 09:05:51 -0800    

Click here for diff

I missed these in 578b229718e8f.  
  
Author: Andres Freund  

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

Avoid thread-safety problem in ecpglib.

commit   : 8eb4a9312c95be56cdb31f5411eddc2cb2ba89be    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 12:07:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 12:07:02 -0500    

Click here for diff

ecpglib attempts to force the LC_NUMERIC locale to "C" while reading  
server output, to avoid problems with strtod() and related functions.  
Historically it's just issued setlocale() calls to do that, but that  
has major problems if we're in a threaded application.  setlocale()  
itself is not required by POSIX to be thread-safe (and indeed is not,  
on recent OpenBSD).  Moreover, its effects are process-wide, so that  
we could cause unexpected results in other threads, or another thread  
could change our setting.  
  
On platforms having uselocale(), which is required by POSIX:2008,  
we can avoid these problems by using uselocale() instead.  Windows  
goes its own way as usual, but we can make it safe by using  
_configthreadlocale().  Platforms having neither continue to use the  
old code, but that should be pretty much nobody among current systems.  
  
This should get back-patched, but let's see what the buildfarm  
thinks of it first.  
  
Michael Meskes and Tom Lane; thanks also to Takayuki Tsunakawa.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c

Revert "Fix under-quoted filename pattern in pgbench TAP test."

commit   : f4593bd2ff0376fbc56dd1b384c7d51e1a7062f0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 11:28:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Jan 2019 11:28:03 -0500    

Click here for diff

This reverts commit 458a1244f1fcf407874482a93b7631ecf5303d6e.  
It has portability problems on Windows, which will require  
a little bit of research to fix.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Postpone generating tlists and EC members for inheritance dummy children.

commit   : 8d8dcead1295a0d718b08e84d62913b587501425    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 21 Jan 2019 17:12:40 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 21 Jan 2019 17:12:40 +0900    

Click here for diff

Previously, in set_append_rel_size(), we generated tlists and EC members  
for dummy children for possible use by partition-wise join, even if  
partition-wise join was disabled or the top parent was not a partitioned  
table, but adding such EC members causes noticeable planning speed  
degradation for queries with certain kinds of join quals like  
"(foo.x + bar.y) = constant" where foo and bar are partitioned tables in  
cases where there are lots of dummy children, as the EC members lists  
grow huge, especially for the ECs derived from such join quals, which  
makes the search for the parent EC members in add_child_rel_equivalences()  
very time-consuming.  Postpone the work until such children are actually  
involved in a partition-wise join.  
  
Reported-by: Sanyo Capobiango  
Analyzed-by: Justin Pryzby and Alvaro Herrera  
Author: Amit Langote, with a few additional changes by me  
Reviewed-by: Ashutosh Bapat  
Backpatch-through: v11 where partition-wise join was added  
Discussion: https://postgr.es/m/CAO698qZnrxoZu7MEtfiJmpmUtz3AVYFVnwzR%2BpqjF%3DrmKBTgpw%40mail.gmail.com  

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

Allow COPY FROM to filter data using WHERE conditions

commit   : 31f3817402da736b29014ace470cf70aeb126ac5    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 19 Jan 2019 23:48:16 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 19 Jan 2019 23:48:16 +0100    

Click here for diff

Extends the COPY FROM command with a WHERE condition, which allows doing  
various types of filtering while importing the data (random sampling,  
condition on a data column, etc.).  Until now such filtering required  
either preprocessing of the input data, or importing all data and then  
filtering in the database. COPY FROM ... WHERE is an easy-to-use and  
low-overhead alternative for most simple cases.  
  
Author: Surafel Temesgen  
Reviewed-by: Tomas Vondra, Masahiko Sawada, Lim Myungkyu  
Discussion: https://www.postgresql.org/message-id/flat/CALAY4q_DdpWDuB5-Zyi-oTtO2uSk8pmy+dupiRe3AvAc++1imA@mail.gmail.com  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/include/nodes/parsenodes.h
M src/include/parser/parse_node.h
M src/interfaces/ecpg/preproc/ecpg.addons
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql

Revert "Add valgrind suppressions for wcsrtombs optimizations"

commit   : d6ef7fe75c1fb7ccc4ad8e3dd38d4e84d6fe9b9f    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 19 Jan 2019 20:49:51 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 19 Jan 2019 20:49:51 +0100    

Click here for diff

This reverts commit d3bbc4b96a5b4d055cf636596c6865913a099929.  
  
Per discussion, it's not desirable to add valgrind suppressions for  
outside our own code base (e.g. glibc in this case), especially when  
the suppressions may be platform-specific. There are better ways to  
deal with that, e.g. by providing local suppressions.  
  
Discussion: https://www.postgresql.org/message-id/flat/90ac0452-e907-e7a4-b3c8-15bd33780e62%402ndquadrant.com  

M src/tools/valgrind.supp

Replace @postgresql.org with @lists.postgresql.org for mailinglists

commit   : 0301db623de076f9fb17189daaeb9202a05865bf    
  
author   : Magnus Hagander <[email protected]>    
date     : Sat, 19 Jan 2019 19:06:35 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sat, 19 Jan 2019 19:06:35 +0100    

Click here for diff

Commit c0d0e54084 replaced the ones in the documentation, but missed out  
on the ones in the code. Replace those as well, but unlike c0d0e54084,  
don't backpatch the code changes to avoid breaking translations.  

M configure
M configure.in
M contrib/oid2name/oid2name.c
M contrib/pg_standby/pg_standby.c
M contrib/vacuumlo/vacuumlo.c
M doc/bug.template
M src/backend/catalog/genbki.pl
M src/backend/main/main.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/Gen_fmgrtab.pl
M src/bin/initdb/initdb.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/help.c
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/include/pg_config.h.win32
M src/include/storage/s_lock.h
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/type.c
M src/nls-global.mk
M src/test/regress/pg_regress.c
M src/timezone/tznames/README
M src/tools/fix-old-flex-code.pl

Fix outdated comment

commit   : 3bed67bed171701e86417ec5a201e2f2e82356fb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 19 Jan 2019 09:34:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 19 Jan 2019 09:34:24 +0100    

Click here for diff

The issue the comment is referring to was fixed by  
08859bb5c2cebc132629ca838113d27bb31b990c.  

M src/backend/executor/execReplication.c

Fix under-quoted filename pattern in pgbench TAP test.

commit   : 458a1244f1fcf407874482a93b7631ecf5303d6e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Jan 2019 15:23:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Jan 2019 15:23:44 -0500    

Click here for diff

Avoids issues if build directory's pathname contains regex  
metacharacters.  
  
Raúl Marín Rodríguez  
  
Discussion: https://postgr.es/m/CAM6_UM6dGdU39PKAC24T+HD9ouy0jLN9vH6163K8QEEzr__iZw@mail.gmail.com  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Use our own getopt() on OpenBSD.

commit   : 69bcd718dfd510750a83e4191b20d9ba3bfcd0fb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Jan 2019 15:06:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Jan 2019 15:06:26 -0500    

Click here for diff

Recent OpenBSD (at least 5.9 and up) has a version of getopt(3)  
that will not cope with the "-:" spec we use to accept double-dash  
options in postgres.c and postmaster.c.  Admittedly, that's a hack  
because POSIX only requires getopt() to allow alphanumeric option  
characters.  I have no desire to find another way, however, so  
let's just do what we were already doing on Solaris: force use  
of our own src/port/getopt.c implementation.  
  
In passing, improve some of the comments around said implementation.  
  
Per buildfarm and local testing.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_getopt.h
M src/port/getopt.c

Fix creation of duplicate foreign keys on partitions

commit   : 0325d7a5957ba39a0dce90835ab54a08ab8bf762    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 18 Jan 2019 14:49:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 18 Jan 2019 14:49:40 -0300    

Click here for diff

When creating a foreign key in a partitioned table, if some partitions  
already have equivalent constraints, we wastefully create duplicates of  
the constraints instead of attaching to the existing ones.  That's  
inconsistent with the de-duplication that is applied when a table is  
attached as a partition.  To fix, reuse the FK-cloning code instead of  
having a separate code path.  
  
Backpatch to Postgres 11.  This is a subtle behavior change, but surely  
a welcome one since there's no use in having duplicate foreign keys.  
  
Discovered by Álvaro Herrera while thinking about a different problem  
reported by Jesper Pedersen (bug #15587).  
  
Author: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Move CloneForeignKeyConstraints to tablecmds.c

commit   : 03afae201f0a0762bb66cf02e038ed0d982ad048    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 18 Jan 2019 14:49:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 18 Jan 2019 14:49:27 -0300    

Click here for diff

My commit 3de241dba86f introduced some code to create a clone of a  
foreign key to a partition, but I put it in pg_constraint.c because it  
was too close to the contents of the pg_constraint row.  With the  
previous commit that split out the constraint tuple deconstruction into  
its own routine, it makes more sense to have the FK-cloning function in  
tablecmds.c, mostly because its static subroutine can then be used by a  
future bugfix.  
  
My initial posting of this patch had this routine as static in  
tablecmds.c, but sadly this function is already part of the Postgres 11  
ABI as exported from pg_constraint.c, so keep it as exported also just  
to avoid breaking any possible users of it.  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/include/catalog/pg_constraint.h

Refactor duplicate code into DeconstructFkConstraintRow

commit   : 0080396dad4fe59a91f6d7e9c1f806affcfc68c3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 18 Jan 2019 14:40:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 18 Jan 2019 14:40:13 -0300    

Click here for diff

My commit 3de241dba86f introduced some code (in tablecmds.c) to obtain  
data from a pg_constraint row for a foreign key, that already existed in  
ri_triggers.c.  Split it out into its own routine in pg_constraint.c,  
where it naturally belongs.  
  
No functional code changes, only code movement.  
  
Backpatch to pg11, because a future bugfix is simpler after this.  

M src/backend/catalog/pg_constraint.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/pg_constraint.h

Avoid sometimes printing both tables and their columns in DROP CASCADE.

commit   : 9194c4270b28bb19b43a0156e5a296d1a0a3dd48    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Jan 2019 11:05:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Jan 2019 11:05:11 -0500    

Click here for diff

A cascaded drop might find independent reasons to drop both a table  
and some column of the table (for instance, a schema drop might include  
dropping a data type used in some table in the schema).  Depending on  
the order of visitation of pg_depend entries, we might report the  
table column and the whole table as separate objects-to-be-dropped,  
or we might only report the table.  This is confusing and leads to  
unstable regression test output, so fix it to report only the table  
regardless of visitation order.  
  
Per gripe from Peter Geoghegan.  This is just cosmetic from a user's  
standpoint, and we haven't actually seen regression test problems in  
practice (yet), so I'll refrain from back-patching.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c

Remove obsolete comment

commit   : f04ad77a300ad77cfe1b84e42eff90fd29cb4c4d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Jan 2019 09:48:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Jan 2019 09:48:51 +0100    

Click here for diff

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

configure: More use of AC_ARG_VAR

commit   : 29b3ac75462625b78eec0a92a49a22c5e2c7a01f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 Jan 2019 08:29:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 Jan 2019 08:29:42 +0100    

Click here for diff

AC_ARG_VAR is necessary if an environment variable influences a  
configure result that is then used by other tests that are cached.  
With AC_ARG_VAR, a change in the variable is detected on subsequent  
configure runs and the user is then advised to remove the cache.  
  
This adds AC_ARG_VAR calls for: MSGFMT, PERL, PYTHON, TCLSH, XML2_CONFIG  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M config/perl.m4
M config/programs.m4
M config/python.m4
M config/tcl.m4
M configure
M configure.in

Fix incorrect relation name in comment of vacuumlazy.c

commit   : 80971bc206b06deebe71e722f49949f6df4ce642    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Jan 2019 13:53:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Jan 2019 13:53:43 +0900    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoBiOiapB7YGbWRfNZji3cs1gkEwv=uGLTemaZ9yNKK1DA@mail.gmail.com  

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

Enforce non-parallel plan when calling current_schema() in newly-added test

commit   : 396676b0ec4bd45969b9089ffcabde3b4331c1c3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Jan 2019 10:51:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Jan 2019 10:51:39 +0900    

Click here for diff

current_schema() gets called in the recently-added regression test from  
c5660e0, and can be used in a parallel context, causing its call to fail  
when creating a temporary schema.  
  
Per buildfarm members crake and lapwing.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid assuming that we know the spelling of getopt_long's error messages.

commit   : 251f57460f123f28089ff23a7e43990618dd05a8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Jan 2019 19:31:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Jan 2019 19:31:03 -0500    

Click here for diff

I've had enough of "fixing" this test case.  Whatever value it has  
is limited to verifying that pgbench fails for an unrecognized switch,  
and we don't need to assume anything about what getopt_long prints in  
order to do that.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/002_pgbench_no_server.pl

Restrict the use of temporary namespace in two-phase transactions

commit   : c5660e0aa52d5df27accd8e5e97295cf0e64f7d4    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Jan 2019 09:21:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Jan 2019 09:21:44 +0900    

Click here for diff

Attempting to use a temporary table within a two-phase transaction is  
forbidden for ages.  However, there have been uncovered grounds for  
a couple of other object types and commands which work on temporary  
objects with two-phase commit.  In short, trying to create, lock or drop  
an object on a temporary schema should not be authorized within a  
two-phase transaction, as it would cause its state to create  
dependencies with other sessions, causing all sorts of side effects with  
the existing session or other sessions spawned later on trying to use  
the same temporary schema name.  
  
Regression tests are added to cover all the grounds found, the original  
report mentioned function creation, but monitoring closer there are many  
other patterns with LOCK, DROP or CREATE EXTENSION which are involved.  
One of the symptoms resulting in combining both is that the session  
which used the temporary schema is not able to shut down completely,  
waiting for being able to drop the temporary schema, something that it  
cannot complete because of the two-phase transaction involved with  
temporary objects.  In this case the client is able to disconnect but  
the session remains alive on the backend-side, potentially blocking  
connection backend slots from being used.  Other problems reported could  
also involve server crashes.  
  
This is back-patched down to v10, which is where 9b013dc has introduced  
MyXactFlags, something that this patch relies on.  
  
Reported-by: Alexey Bashtanov  
Author: Michael Paquier  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M doc/src/sgml/ref/prepare_transaction.sgml
M src/backend/access/transam/xact.c
M src/backend/catalog/namespace.c
M src/backend/commands/dropcmds.c
M src/backend/commands/extension.c
M src/backend/commands/lockcmds.c
M src/include/access/xact.h
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql
M src/test/regress/expected/temp.out
M src/test/regress/sql/temp.sql

Replace references to mailinglists with @lists.postgresql.org

commit   : c0d0e540847d24d9dfe374549fb4cfd5ca40d050    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 17 Jan 2019 13:42:40 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 17 Jan 2019 13:42:40 +0100    

Click here for diff

The namespace for all lists have changed a while ago, so all references  
should use the correct address.  

M doc/src/sgml/installation.sgml
M doc/src/sgml/problems.sgml
M doc/src/sgml/stylesheet-hh.xsl
M doc/src/sgml/stylesheet-html-common.xsl
M doc/src/sgml/xml2.sgml

Remove references to Majordomo

commit   : 0e10040e19db02a797a2597d2fecbaa094f04866    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 17 Jan 2019 13:35:34 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 17 Jan 2019 13:35:34 +0100    

Click here for diff

Lists are not handled by Majordomo anymore and haven't been for a while,  
so remove the reference and instead direct people to the list server.  

M doc/src/sgml/problems.sgml

Postpone aggregate checks until after collation is assigned.

commit   : d16d453870958f79d49876b35e04682792f4ea99    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 17 Jan 2019 05:33:01 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 17 Jan 2019 05:33:01 +0000    

Click here for diff

Previously, parseCheckAggregates was run before  
assign_query_collations, but this causes problems if any expression  
has already had a collation assigned by some transform function (e.g.  
transformCaseExpr) before parseCheckAggregates runs. The differing  
collations would cause expressions not to be recognized as equal to  
the ones in the GROUP BY clause, leading to spurious errors about  
unaggregated column references.  
  
The result was that CASE expr WHEN val ... would fail when "expr"  
contained a GROUPING() expression or matched one of the group by  
expressions, and where collatable types were involved; whereas the  
supposedly identical CASE WHEN expr = val ... would succeed.  
  
Backpatch all the way; this appears to have been wrong ever since  
collations were introduced.  
  
Per report from Guillaume Lelarge, analysis and patch by me.  
  
Discussion: https://postgr.es/m/CAECtzeVSO_US8C2Khgfv54ZMUOBR4sWq+6_bLrETnWExHT=rFg@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c
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

Doc: enhance pgbench manual.

commit   : 2472ea0a53f0e3fe7cb315fbbe6619fa71b181f9    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Thu, 17 Jan 2019 15:34:41 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Thu, 17 Jan 2019 15:34:41 +0900    

Click here for diff

Clarify the difference between "prepared mode" and other query modes.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed by: Fabien Coelh and Alvaro Herrera.  

M doc/src/sgml/ref/pgbench.sgml

postgres_fdw: Remove duplicate code in DML execution callback functions.

commit   : 6c61d7c5935793e218d2335ac540a2cea7eacdce    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 17 Jan 2019 14:37:33 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 17 Jan 2019 14:37:33 +0900    

Click here for diff

postgresExecForeignInsert(), postgresExecForeignUpdate(), and  
postgresExecForeignDelete() are coded almost identically, except that  
postgresExecForeignInsert() does not need CTID.  Extract that code into  
a separate function and use it in all the three function implementations.  
  
Author: Ashutosh Bapat  
Reviewed-By: Michael Paquier  
Discussion: https://postgr.es/m/CAFjFpRcz8yoY7cBTYofcrCLwjaDeCcGKyTUivUbRiA57y3v-bw%40mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c

Reorganize planner code moved in b60c39759908

commit   : d723f56872a9fd1b898b7ee29ca5d26a9e538058    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 16 Jan 2019 16:27:44 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 16 Jan 2019 16:27:44 -0300    

Click here for diff

It seems modules are better defined like this instead of the original  
split.  
  
Per complaints from David Rowley as well as Amit Langote's self review.  
Discussion: https://postgr.es/m/CAKJS1f988rsyhwvLgfT-y1UCYUfXDOv67ENQk=v24OxhsZOzZw@mail.gmail.com  

M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/inherit.c
M src/include/optimizer/appendinfo.h

Increase test coverage in RI_Initial_Check()

commit   : 304e9f031b6ae261525df6be0cd1b24fb443077e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 16:53:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 16:53:55 +0100    

Click here for diff

This covers the special error handling of FKCONSTR_MATCH_FULL.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Mi Tar <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

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

Increase test coverage in RI_FKey_fk_upd_check_required()

commit   : 45ed6e1ae01d219e4145e7541758651dfcf71b83    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 16:53:47 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 16:53:47 +0100    

Click here for diff

This checks the code path of FKCONSTR_MATCH_FULL and  
RI_KEYS_SOME_NULL.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Mi Tar <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

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

Increase test coverage in RI_FKey_pk_upd_check_required()

commit   : cdaf4a472776141899dfdb742c9b73581f19f59a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 16:53:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 16:53:38 +0100    

Click here for diff

This checks the case where the primary key has at least one null  
column.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Mi Tar <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

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

Add test case for ON DELETE NO ACTION/RESTRICT

commit   : 74bd06648b720bb48f50bd32848f2f3cf2deb1f6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 16:52:07 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Jan 2019 16:52:07 +0100    

Click here for diff

This was previously not covered at all; function  
RI_FKey_restrict_del() was not exercised in the tests.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Mi Tar <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

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

Don't duplicate parallel seqscan shmem sizing logic in nbtree.

commit   : 90525d7b4e0fe5ebd53960cd7ef59ee11ff06516    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 15 Jan 2019 12:19:21 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 15 Jan 2019 12:19:21 -0800    

Click here for diff

This is architecturally mildly problematic, which becomes more  
pronounced with the upcoming introduction of pluggable storage.  
  
To fix, teach heap_parallelscan_estimate() to deal with SnapshotAny  
snapshots, and then use it from _bt_parallel_estimate_shared().  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Move vacuumlazy.c into access/heap.

commit   : 285d8e12055f27bce5675e93fef365b6c337f2b3    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 15 Jan 2019 12:06:19 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 15 Jan 2019 12:06:19 -0800    

Click here for diff

It's heap table storage specific code that can't realistically be  
generalized into table AM agnostic code.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Fix parent of WCO qual.

commit   : 148e632c05412aa46b450d31cc598a0a33222792    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 15 Jan 2019 11:59:32 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 15 Jan 2019 11:59:32 -0800    

Click here for diff

The parent of some WCO expressions was, apparently by accident, set to  
the the source of DML queries, rather than the target table.  This  
causes problems for the upcoming pluggable storage work, because the  
target and source table might be of different storage types.  
  
It's possible that this is already problematic, but neither  
experimenting nor inquiries on -hackers have found them. So don't  
backpatch for now.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c
M src/test/regress/expected/updatable_views.out

Finish reverting "recheck_on_update" patch.

commit   : 1c53c4dec3985512f7f2f53c9d76a5295cd0a2dd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Jan 2019 12:07:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Jan 2019 12:07:10 -0500    

Click here for diff

This reverts commit c203d6cf8 and some follow-on fixes, completing the  
task begun in commit 5d28c9bd7.  If that feature is ever resurrected,  
the code will look quite a bit different from this, so it seems best  
to start from a clean slate.  
  
The v11 branch is not touched; in that branch, the recheck_on_update  
storage option remains present, but nonfunctional and undocumented.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam.c
M src/backend/catalog/index.c
M src/backend/utils/cache/relcache.c
M src/bin/psql/tab-complete.c
M src/include/access/reloptions.h
M src/include/utils/rel.h
M src/include/utils/relcache.h

Don't include genam.h from execnodes.h and relscan.h anymore.

commit   : 0944ec54de389b4b8a471ca1f40f1b9d81de1f30    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 17:02:12 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 17:02:12 -0800    

Click here for diff

This is the genam.h equivalent of 4c850ecec649c (which removed  
heapam.h from a lot of other headers).  There's still a few header  
includes of genam.h, but not from central headers anymore.  
  
As a few headers are not indirectly included anymore, execnodes.h and  
relscan.h need a few additional includes. Some of the depended on  
types were replacable by using the underlying structs, but e.g. for  
Snapshot in execnodes.h that'd have gotten more invasive than  
reasonable in this commit.  
  
Like the aforementioned commit 4c850ecec649c, this requires adding new  
genam.h includes to a number of backend files, which likely is also  
required in a few external projects.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/index/genam.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/indexing.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/analyze.c
M src/backend/commands/constraint.c
M src/backend/commands/extension.c
M src/backend/commands/matview.c
M src/backend/commands/typecmds.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/init/postinit.c
M src/include/access/relscan.h
M src/include/executor/nodeIndexscan.h
M src/include/nodes/execnodes.h

commit   : 774a975c9a5903d271a727a260efd8c31125b9d6    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 16:15:20 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 16:15:20 -0800    

Click here for diff

We usually don't change the name of structs between the struct name  
itself and the name of the typedef. Additionally, structs that are  
usually used via a typedef that hides being a pointer, are commonly  
suffixed Data.  Change tupdesc code to follow those convention.  
  
This is triggered by a future patch that intends to forward declare  
TupleDescData in another header - keeping with the naming scheme makes  
that easier to understand.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/tupdesc.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/jit/llvmjit.h

Remove too generically named MissingPtr typedef.

commit   : e451dd5521966516110eb1761342ae4a1380b19d    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 16:07:22 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 16:07:22 -0800    

Click here for diff

As there's only a single user of the typedef in the entire codebase,  
just use the underlying struct directly.  
  
Per complaint from Alvaro Herrera  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/tupdesc.h

Don't include heapam.h from others headers.

commit   : 4c850ecec649c1b1538c741b89cf65d8f7d61853    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 15:54:18 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 15:54:18 -0800    

Click here for diff

heapam.h previously was included in a number of widely used  
headers (e.g. execnodes.h, indirectly in executor.h, ...). That's  
problematic on its own, as heapam.h contains a lot of low-level  
details that don't need to be exposed that widely, but becomes more  
problematic with the upcoming introduction of pluggable table storage  
- it seems inappropriate for heapam.h to be included that widely  
afterwards.  
  
heapam.h was largely only included in other headers to get the  
HeapScanDesc typedef (which was defined in heapam.h, even though  
HeapScanDescData is defined in relscan.h). The better solution here  
seems to be to just use the underlying struct (forward declared where  
necessary). Similar for BulkInsertState.  
  
Another problem was that LockTupleMode was used in executor.h - parts  
of the file tried to cope without heapam.h, but due to the fact that  
it indirectly included it, several subsequent violations of that goal  
were not not noticed. We could just reuse the approach of declaring  
parameters as int, but it seems nicer to move LockTupleMode to  
lockoptions.h - that's not a perfect location, but also doesn't seem  
bad.  
  
As a number of files relied on implicitly included heapam.h, a  
significant number of files grew an explicit include. It's quite  
probably that a few external projects will need to do the same.  
  
Author: Andres Freund  
Reviewed-By: Alvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/verify_nbtree.c
M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pg_freespacemap/pg_freespacemap.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M src/backend/access/brin/brin.c
M src/backend/access/common/indextuple.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/tablesample/system.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/toasting.c
M src/backend/commands/alter.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/constraint.c
M src/backend/commands/createas.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/optimizer/plan/planner.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/fmgr/funcapi.c
M src/include/access/heapam.h
M src/include/access/hio.h
M src/include/access/relscan.h
M src/include/catalog/index.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/lockoptions.h

Fix typos in documentation and for one wait event

commit   : 42e2a580713201645d7caa4b27713ac777432d8d    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 15 Jan 2019 08:47:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 15 Jan 2019 08:47:01 +0900    

Click here for diff

These have been found while cross-checking for the use of unique words  
in the documentation, and a wait event was not getting generated in a way  
consistent to what the documentation provided.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/file-fdw.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/postmaster/pgstat.c

Re-add default_with_oids GUC to avoid breaking old dump files.

commit   : de66987adb8a3414724b99540d324407bfad697a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 15:30:24 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Jan 2019 15:30:24 -0800    

Click here for diff

After 578b229718 / the removal of WITH OIDS support, older dump files  
containing  
    SET default_with_oids = false;  
either report unnecessary errors (as the subsequent tables have no  
oids) or even fail to restore entirely (when using transaction mode).  
To avoid that, re-add the GUC, but don't allow setting it to true.  
  
Per complaint from Tom Lane.  
  
Author: Amit Khandekar, editorialized by me  
Discussion: https://postgr.es/m/CAJ3gD9dZyxrtL0rJfoNoOj6v7fJSDaXBngi9wy5XU8m-ioXhAA@mail.gmail.com  

M src/backend/utils/misc/guc.c
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Fix unique INCLUDE indexes on partitioned tables

commit   : 0ad41cf537ea5f076273fcffa4c83a184bd9910f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 14 Jan 2019 19:25:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 14 Jan 2019 19:25:19 -0300    

Click here for diff

We were considering the INCLUDE columns as part of the key, allowing  
unicity-violating rows to be inserted in different partitions.  
  
Concurrent development conflict in eb7ed3f30634 and 8224de4f42cc.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

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

Detach postmaster process from pg_ctl's session at server startup.

commit   : bb24439cefead34f195c78f400982f3834593df6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 14 Jan 2019 14:50:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 14 Jan 2019 14:50:58 +0200    

Click here for diff

pg_ctl is supposed to daemonize the postmaster process, so that it's not  
affected by signals to the launching process group.  Before this patch, if  
you had a shell script that used "pg_ctl start", and you interrupted the  
shell script after postmaster had been launched, postmaster was also  
killed.  To fix, call setsid() after forking the postmaster process.  
  
Long time ago, we had a 'silent_mode' option, which daemonized the  
postmaster process by calling setsid(), but that was removed back in 2011  
(commit f7ea6beaf4).  We discussed bringing that back in some form, but  
pg_ctl is the documented way of launching postmaster to the background, so  
putting the setsid() call in pg_ctl itself seems appropriate.  
  
Just putting postmaster in a separate session would change the behavior  
when you interrupt "pg_ctl -w start", e.g. with CTRL-C, while it's waiting  
for postmaster to start.  The historical behavior has been that  
interrupting pg_ctl aborts the server launch, which is handy if the server  
is stuck in recovery, for example, and won't fully start up.  To keep that  
behavior, install a signal handler in pg_ctl, to explicitly kill  
postmaster, if pg_ctl is interrupted while it's waiting for the server to  
start up.  This isn't 100% watertight, there is a small window after  
forking the postmaster process, where the signal handler doesn't know the  
postmaster's PID yet, but seems good enough.  
  
Arguably this is a long-standing bug, but I refrained from back-batching,  
out of fear of breaking someone's scripts that depended on the old  
behavior.  
  
Reviewed by Tom Lane.  Report and original patch by Paul Guo, with  
feedback from Michael Paquier.  
  
Discussion: https://www.postgresql.org/message-id/CAEET0ZH5Bf7dhZB3mYy8zZQttJrdZg_0Wwaj0o1PuuBny1JkEw%40mail.gmail.com  

M src/bin/pg_ctl/pg_ctl.c

fix typo

commit   : d9cdb1ba9e66039d0f4c037a7ae6e2839e9652d6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 13 Jan 2019 16:43:14 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 13 Jan 2019 16:43:14 -0500    

Click here for diff

M src/Makefile.global.in

Make DLSUFFIX easily discoverable by build scripts

commit   : b40cb99b855563ab8dc878b5bc1b22a6735a57b6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 13 Jan 2019 15:59:35 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 13 Jan 2019 15:59:35 -0500    

Click here for diff

This will enable things like the buildfarm client to discover more  
reliably if certain libraries have been installed.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to all live branches.  

M src/Makefile.global.in

Make Emacs perl-mode indent more like perltidy.

commit   : 472e1e4cf64b81b1ecae900db8115deb250ba8bc    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 13 Jan 2019 11:32:31 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 13 Jan 2019 11:32:31 -0800    

Click here for diff

This especially helps braces that surround code blocks.  Back-patch to  
v11, where commit 56fb890ace8ac0ca955ae0803c580c2074f876f6 first  
appeared; before that, settings were even more distant from perltidy.  
  
Reviewed by Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M .dir-locals.el
M src/tools/editors/emacs.samples

Improve missing-program error handling in make_ctags and make_etags.

commit   : 52a301e0d95aa25aa9bbc0eefd1167458e3e0cab    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Jan 2019 13:33:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Jan 2019 13:33:50 -0500    

Click here for diff

If ctags (resp. etags) isn't installed, these scripts naturally fail,  
but the error messages were less clear than one could wish.  
It seems worth installing an explicit test to improve that.  
  
Nikolay Shaplov, with suggestions from Michael Paquier and Andrew Dunstan  
  
Discussion: https://postgr.es/m/2394207.ccz7JgCJsh@x200m  

M src/tools/make_ctags
M src/tools/make_etags

Fix error message for logical replication targets

commit   : 9f527a6e9a70ea668616e20d05c31d7a086669a4    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 13 Jan 2019 22:36:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 13 Jan 2019 22:36:23 +0900    

Click here for diff

This fixes an oversight from 373bda6.  
  
Noted by Erik Rijkers.  

M src/backend/executor/execReplication.c

Make INSTALL makefile rule more robust

commit   : bb874e30fbf9e85bdb117bad34865a5fae29dbf6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Jan 2019 10:50:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Jan 2019 10:50:36 +0100    

Click here for diff

With the previous rule, if pandoc was missing, a zero-length output  
file would be created without an error from make.  To improve that,  
write the rule as two separate commands without a pipe.  
  
Reported-by: Tom Lane <[email protected]>  

M doc/src/sgml/Makefile

configure: Update python search order

commit   : 7291733ac93fbc7a30255a7543729678d29afc21    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 15:45:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 15:45:15 +0100    

Click here for diff

Some systems don't ship with "python" by default anymore, only  
"python3" or "python2" or some combination, so include those in the  
configure search.  
  
Discussion: https://www.postgresql.org/message-id/flat/1457.1543184081%40sss.pgh.pa.us#c9cc1199338fd6a257589c6dcea6cf8d  

M config/python.m4
M configure
M doc/src/sgml/installation.sgml

Change default of recovery_target_timeline to 'latest'

commit   : 0acb3bc33af11a57d560cbce5a74246eb3e642db    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 10:36:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 10:36:10 +0100    

Click here for diff

This is what one usually wants for recovery and almost always wants  
for a standby.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  
Reviewed-by: David Steele <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/access/transam/xlog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_rewind/RewindTest.pm
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/012_subtransactions.pl

Improve error messages for incorrect types of logical replication targets

commit   : 373bda61d2d620e704815553978726c9be9e1209    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 13 Jan 2019 16:39:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 13 Jan 2019 16:39:49 +0900    

Click here for diff

If trying to use something else than a plain table as logical  
replication target, a rather-generic error message gets used to report  
the problem.  This can be confusing when it comes to foreign tables and  
partitioned tables, so use more dedicated messages in these cases.  
  
Author: Amit Langote  
Reviewed-by: Peter Eisentraut, Magnus Hagander, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execReplication.c

Remove heapam.h include made superfluous by b60c3975990.

commit   : 1845ca2cfd1f7fd6b536900cf129f6734a4ddded    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Jan 2019 22:19:02 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Jan 2019 22:19:02 -0800    

Click here for diff

Noticed this while working on another patch.  
  
Author: Andres Freund  

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

Free pre-modification HeapTuple in ALTER TABLE ... TYPE ...

commit   : e33884d4122b56fc0dbff3d8cedd8177334db838    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 11 Jan 2019 17:12:54 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 11 Jan 2019 17:12:54 -0500    

Click here for diff

This was an oversight in commit 3b174b1a3.  
  
Per offline gripe from Alvaro Herrera  
  
Backpatch to release 11.  

M src/backend/commands/tablecmds.c

Avoid sharing PARAM_EXEC slots between different levels of NestLoop.

commit   : 1db5667bac63d0be825c375c4aeb8fb29b9a50bd    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Jan 2019 15:53:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Jan 2019 15:53:34 -0500    

Click here for diff

Up to now, createplan.c attempted to share PARAM_EXEC slots for  
NestLoopParams across different plan levels, if the same underlying Var  
was being fed down to different righthand-side subplan trees by different  
NestLoops.  This was, I think, more of an artifact of using subselect.c's  
PlannerParamItem infrastructure than an explicit design goal, but anyway  
that was the end result.  
  
This works well enough as long as the plan tree is executing synchronously,  
but the feature whereby Gather can execute the parallelized subplan locally  
breaks it.  An upper NestLoop node might execute for a row retrieved from  
a parallel worker, and assign a value for a PARAM_EXEC slot from that row,  
while the leader's copy of the parallelized subplan is suspended with a  
different active value of the row the Var comes from.  When control  
eventually returns to the leader's subplan, it gets the wrong answers if  
the same PARAM_EXEC slot is being used within the subplan, as reported  
in bug #15577 from Bartosz Polnik.  
  
This is pretty reminiscent of the problem fixed in commit 46c508fbc, and  
the proper fix seems to be the same: don't try to share PARAM_EXEC slots  
across different levels of controlling NestLoop nodes.  
  
This requires decoupling NestLoopParam handling from PlannerParamItem  
handling, although the logic remains somewhat similar.  To avoid bizarre  
division of labor between subselect.c and createplan.c, I decided to move  
all the param-slot-assignment logic for both cases out of those files  
and put it into a new file paramassign.c.  Hopefully it's a bit better  
documented now, too.  
  
A regression test case for this might be nice, but we don't know a  
test case that triggers the problem with a suitably small amount  
of data.  
  
Back-patch to 9.6 where we added Gather nodes.  It's conceivable that  
related problems exist in older branches; but without some evidence  
for that, I'll leave the older branches alone.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/Makefile
A src/backend/optimizer/util/paramassign.c
A src/include/optimizer/paramassign.h
M src/include/optimizer/subselect.h

doc: Correct documentation of install-time environment variables

commit   : 8b89a88618dff78dec25f08ee0ca83824b69b34b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 17:21:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 17:21:45 +0100    

Click here for diff

Since approximately PostgreSQL 10, it is no longer required that  
environment variables at installation time such as PERL, PYTHON, TCLSH  
be "full path names", so change that phrasing in the installation  
instructions.  (The exact time of change appears to differ for PERL  
and the others, but it works consistently in PostgreSQL 10.)  
  
Also while we're here document the defaults for PERL and PYTHON, but  
since the search list for TCLSH is so long, let's leave that out so we  
don't need to maintain a copy of that list in the installation  
instructions.  

M doc/src/sgml/installation.sgml

Create INSTALL file using Pandoc

commit   : 96b8b8b6f9d8de4af01a77797273ad88c7a8e32e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 12:02:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 12:02:48 +0100    

Click here for diff

Replace using lynx with using pandoc.  Pandoc creates better looking  
output and it avoids the delicate locale/encoding issues of lynx because  
it always uses UTF-8 for both input and output.  
  
Note: requires Pandoc >=1.13  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  
Reviewed-by: Mi Tar <[email protected]>  

M doc/src/sgml/Makefile
M doc/src/sgml/docguide.sgml

Add value 'current' for recovery_target_timeline

commit   : ff85306055ede1fbca86ca4dfc4d48172342462b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 10:25:06 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Jan 2019 10:25:06 +0100    

Click here for diff

This value represents the default behavior of using the current  
timeline.  Previously, this was represented by an empty string.  
  
(Before the removal of recovery.conf, this setting could not be chosen  
explicitly but was used when recovery_target_timeline was not  
mentioned at all.)  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  
Reviewed-by: David Steele <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Extend pg_stat_statements_reset to reset statistics specific to a particular user/db/query.

commit   : 43cbedab8ff1eef4088807ffc1a64a107de67af6    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 11 Jan 2019 08:50:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 11 Jan 2019 08:50:09 +0530    

Click here for diff

The function pg_stat_statements_reset() is extended to accept userid, dbid,  
and queryid as input parameters.  Now, it can discard the statistics  
gathered so far by pg_stat_statements corresponding to the specified  
userid, dbid, and queryid.  If no parameter is specified or all the  
specified parameters have default value aka 0, it will discard all  
statistics as per the old behavior.  
  
The new behavior is useful to get the fresh statistics for a specific  
user/database/query without resetting all the existing statistics.  
  
Author: Haribabu Kommi, with few additional changes by me  
Reviewed-by: Michael Paquier, Amit Kapila and Fujii Masao  
Discussion: https://postgr.es/m/CAJrrPGcyh-gkFswyc6C661K6cknL0XkNqVT0sQt2mFNMR4HRKA@mail.gmail.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.6–1.7.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

Fix missing values when doing ALTER TABLE ALTER COLUMN TYPE

commit   : 3b174b1a355f0de2d433c16eb350b3356bdd08b8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 10 Jan 2019 15:53:45 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 10 Jan 2019 15:53:45 -0500    

Click here for diff

This was an oversight in commit 16828d5c. If the table is going to be  
rewritten, we simply clear all the missing values from all the table's  
attributes, since there will no longer be any rows with the attributes  
missing. Otherwise, we repackage the missing value in an array  
constructed with the new type specifications.  
  
Backpatch to release 11.  
  
This fixes bug #15446, reported by Dmitry Molotkov  
  
Reviewed by Dean Rasheed  

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

Add .gitignore entry for a derived file created by "make distprep".

commit   : f6cddbd4d7c0ab222f884883ef297b81b35c816e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Jan 2019 14:20:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Jan 2019 14:20:28 -0500    

Click here for diff

I chanced to notice that "make distprep" leaves a state of the  
tree that git complains about.  It's been like this for awhile,  
but given the lack of complaints it probably doesn't need  
back-patching.  

M src/interfaces/libpq/.gitignore

Fix C++ compile failures in headers.

commit   : eaf0380eccd53df5ce7d1fed41f4ca16f4146408    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Jan 2019 14:07:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Jan 2019 14:07:01 -0500    

Click here for diff

Avoid using "typeid" as a parameter name in header files, since that  
is a C++ keyword.  These cases were introduced recently, in 04fe805a1  
and 586b98fdf.  
  
Since I'm an incurable neatnik, also rename these parameters in the  
underlying function definitions.  That's not really necessary per  
project rules, but I don't like function declarations that don't  
quite agree with the underlying definitions.  
  
Per src/tools/pginclude/cpluspluscheck.  

M src/backend/optimizer/plan/setrefs.c
M src/backend/utils/adt/varlena.c
M src/include/optimizer/planmain.h
M src/include/utils/varlena.h

Remove unnecessary #include.

commit   : a968d54c5df196e06305c1efa731657f9536ec7a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Jan 2019 13:38:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Jan 2019 13:38:02 -0500    

Click here for diff

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

M src/include/optimizer/appendinfo.h

Move inheritance expansion code into its own file

commit   : b60c39759908bb2a2dbcfc108ec19bdbdcc278e8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 10 Jan 2019 14:54:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 10 Jan 2019 14:54:31 -0300    

Click here for diff

This commit moves expand_inherited_tables and underlings from  
optimizer/prep/prepunionc.c to optimizer/utils/inherit.c.  
Also, all of the AppendRelInfo-based expression manipulation routines  
are moved to optimizer/utils/appendinfo.c.  
  
No functional code changes.  One exception is the introduction of  
make_append_rel_info, but that's still just moving around code.  
  
Also, stop including <limits.h> in prepunion.c, which no longer needs  
it since 3fc6e2d7f5b6.  I (Álvaro) noticed this because Amit was copying  
that to inherit.c, which likewise doesn't need it.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/Makefile
A src/backend/optimizer/util/appendinfo.c
A src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/backend/partitioning/partprune.c
A src/include/optimizer/appendinfo.h
A src/include/optimizer/inherit.h
M src/include/optimizer/prep.h

Don't use address of array as boolean

commit   : dacadcd1f32873d930b3953d3055dc7cb9548e48    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 10 Jan 2019 13:59:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 10 Jan 2019 13:59:40 -0300    

Click here for diff

Per buildfarm  

M src/bin/pgbench/pgbench.c

pgbench: add \cset and \gset commands

commit   : 6260cc550b0e60052168518a0338e440b67cf24e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 10 Jan 2019 13:42:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 10 Jan 2019 13:42:20 -0300    

Click here for diff

These commands allow assignment of values produced by queries to pgbench  
variables, where they can be used by further commands.  \gset terminates  
a command sequence (just like a bare semicolon); \cset separates  
multiple queries in a compound command, like an escaped semicolon (\;).  
A prefix can be provided to the \-command and is prepended to the name  
of each output column to produce the final variable name.  
  
This feature allows pgbench scripts to react meaningfully to the actual  
database contents, allowing more powerful benchmarks to be written.  
  
Authors: Fabien Coelho, Álvaro Herrera  
Reviewed-by: Amit Langote <[email protected]>  
Reviewed-by: Stephen Frost <[email protected]>  
Reviewed-by: Pavel Stehule <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Tatsuo Ishii <[email protected]>  
Reviewed-by: Rafia Sabih <[email protected]>  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1607091005330.3412@sto  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/fe_utils/psqlscan.l
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h

Update unaccent rules with release 34 of CLDR for Latin-ASCII.xml

commit   : e1c1d5444e430375be9bc17366d17f1acd87ec0b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 10 Jan 2019 14:10:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 10 Jan 2019 14:10:21 +0900    

Click here for diff

This has required an update of the python script generating the rules,  
as its format has changed in release 29.  This release has also added  
new punctuation and symbols, and a new set of rules has been generated  
to include them.  The way to find newest versions of Latin-ASCII gets  
also more clearly documented.  
  
Author: Hugh Ranalli, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/unaccent/expected/unaccent.out
M contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/sql/unaccent.sql
M contrib/unaccent/unaccent.rules

Use perfect hashing, instead of binary search, for keyword lookup.

commit   : c64d0cd5ce24a344798534f1bc5827a9199b7a6e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Jan 2019 19:47:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Jan 2019 19:47:38 -0500    

Click here for diff

We've been speculating for a long time that hash-based keyword lookup  
ought to be faster than binary search, but up to now we hadn't found  
a suitable tool for generating the hash function.  Joerg Sonnenberger  
provided the inspiration, and sample code, to show us that rolling our  
own generator wasn't a ridiculous idea.  Hence, do that.  
  
The method used here requires a lookup table of approximately 4 bytes  
per keyword, but that's less than what we saved in the predecessor commit  
afb0d0712, so it's not a big problem.  The time savings is indeed  
significant: preliminary testing suggests that the total time for raw  
parsing (flex + bison phases) drops by ~20%.  
  
Patch by me, but it owes its existence to Joerg Sonnenberger;  
thanks also to John Naylor for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/Makefile
M src/common/kwlookup.c
M src/include/common/kwlookup.h
M src/include/parser/kwlist.h
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_keywords.c
M src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/pl/plpgsql/src/Makefile
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
A src/tools/PerfectHash.pm
M src/tools/gen_keywordlist.pl
M src/tools/msvc/Solution.pm

Fix grammar mistakes in md.c

commit   : 5d59a6c5eaff4a58322683e450e76a11d943d322    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 10 Jan 2019 09:36:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 10 Jan 2019 09:36:25 +0900    

Click here for diff

Author: Kirk Jamison  
Discussion: https://postgr.es/m/D09B13F772D2274BB348A310EE3027C640AC54@g01jpexmbkw24  

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

Reduce the size of the fmgr_builtin_oid_index[] array.

commit   : 8ff5f824dca75174e3d3efc7c1182cf1d388bacc    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Jan 2019 15:22:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Jan 2019 15:22:43 -0500    

Click here for diff

This index array was originally defined to have 10000 entries (ranging  
up to FirstGenbkiObjectId), but we really only need entries up to the  
last existing builtin function OID, currently 6121.  That saves close  
to 8K of never-accessed space in the server executable, at the small  
price of one more fetch in fmgr_isbuiltin().  
  
We could reduce the array size still further by renumbering a few of  
the highest-numbered builtin functions; but there's a small risk of  
breaking clients that have chosen to hardwire those function OIDs,  
so it's not clear if it'd be worth the trouble.  (We should, however,  
discourage future patches from choosing function OIDs above 6K as long  
as there's still lots of space below that.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/fmgr/fmgr.c
M src/include/utils/fmgrtab.h

Update docs & tests to reflect that unassigned OLD/NEW are now NULL.

commit   : 59029b6fb71e187c150d12f4c37bb2bf982d3125    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Jan 2019 11:35:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Jan 2019 11:35:14 -0500    

Click here for diff

For a long time, plpgsql has allowed trigger functions to parse  
references to OLD and NEW even if the current trigger event type didn't  
assign a value to one or the other variable; but actually executing such  
a reference would fail.  The v11 changes to use "expanded records" for  
DTYPE_REC variables changed the behavior so that the unassigned variable  
now reads as a null composite value.  While this behavioral change was  
more or less unintentional, it seems that leaving it like this is better  
than adding code and complexity to be bug-compatible with the old way.  
The change doesn't break any code that worked before, and it eliminates  
a gotcha that often required extra code to work around.  
  
Hence, update the docs to say that these variables are "null" not  
"unassigned" when not relevant to the event type.  And add a regression  
test covering the behavior, so that we'll notice if we ever break it  
again.  
  
Per report from Kristjan Tammekivi.  
  
Discussion: https://postgr.es/m/CAABK7uL-uC9ZxKBXzo_68pKt7cECfNRv+c35CXZpjq6jCAzYYA@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/release-11.sgml
M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_trigger.out
M src/pl/plpgsql/src/pl_exec.c
A src/pl/plpgsql/src/sql/plpgsql_trigger.sql

Doc: update our docs about kernel IPC parameters on *BSD.

commit   : a2b22d8e804511ca7f0f712e8365a6a013b0254e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Jan 2019 12:03:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Jan 2019 12:03:53 -0500    

Click here for diff

runtime.sgml said that you couldn't change SysV IPC parameters on OpenBSD  
except by rebuilding the kernel.  That's definitely wrong in OpenBSD 6.x,  
and excavation in their man pages says it changed in OpenBSD 3.3.  
  
Update NetBSD and OpenBSD sections to recommend adjustment of the SEMMNI  
and SEMMNS settings, which are painfully small by default on those  
platforms.  (The discussion thread contemplated recommending that  
people select POSIX semaphores instead, but the performance consequences  
of that aren't really clear, so I'll refrain.)  
  
Remove pointless discussion of SEMMNU and SEMMAP from the FreeBSD  
section.  Minor other wordsmithing.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml

Add --disable-page-skipping and --skip-locked to vacuumdb

commit   : 354e95d1f2122d20c1c5895eb3973cfb0e8d0cc2    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Jan 2019 10:52:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Jan 2019 10:52:29 +0900    

Click here for diff

DISABLE_PAGE_SKIPPING is available since v9.6, and SKIP_LOCKED since  
v12.  They lacked equivalents for vacuumdb, so this closes the gap.  
  
Author: Nathan Bossart  
Reviewed-by: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c

Doc: fix meaning of acronym "btree".

commit   : a67212de198c9da70f04d2462474dc26965530c8    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 8 Jan 2019 09:51:17 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 8 Jan 2019 09:51:17 +0900    

Click here for diff

Acronym "btree" better means "multi-way balanced tree" rather than  
"multi-way binary tree".  
  
Discussion: https://postgr.es/m/20190105.183532.1686260542006440682.t-ishii%40sraoss.co.jp  

M doc/src/sgml/btree.sgml

doc: document that INFO messages always go to client.

commit   : 93fedda6f093ca0b47a27b91f3008afc43c49bcc    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 7 Jan 2019 18:19:46 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 7 Jan 2019 18:19:46 +0000    

Click here for diff

In passing add a couple of links to the message severity table.  
  
Backpatch because it's always been this way.  
  
Author: Karl O. Pinc <[email protected]>  

M doc/src/sgml/config.sgml

isolationtester: Use atexit()

commit   : be2e329f2e700032df087e08ac2103ba3d1fa811    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 5 Jan 2019 15:05:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 5 Jan 2019 15:05:49 +0100    

Click here for diff

Replace exit_nicely() calls with standard exit() and register the  
cleanup actions using atexit().  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M src/test/isolation/isolationtester.c

initdb: Use atexit()

commit   : 3913a40ff104fd26f795c3d4c402ec27a1f86385    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 29 Dec 2018 13:21:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 29 Dec 2018 13:21:57 +0100    

Click here for diff

Replace exit_nicely() calls with standard exit() and register the  
cleanup actions using atexit().  The coding pattern used here mirrors  
existing use in pg_basebackup.c.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M src/bin/initdb/initdb.c

pg_basebackup: Use atexit()

commit   : a4205fa00d526c3158c677a3d82042f88d429f84    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 29 Dec 2018 13:21:47 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 29 Dec 2018 13:21:47 +0100    

Click here for diff

Instead of using our custom disconnect_and_exit(), just register the  
desired cleanup using atexit() and use the standard exit() to leave  
the program.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c

Replace the data structure used for keyword lookup.

commit   : afb0d0712f1a62efe2addd95262cf38e8481e84a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 6 Jan 2019 17:02:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 6 Jan 2019 17:02:57 -0500    

Click here for diff

Previously, ScanKeywordLookup was passed an array of string pointers.  
This had some performance deficiencies: the strings themselves might  
be scattered all over the place depending on the compiler (and some  
quick checking shows that at least with gcc-on-Linux, they indeed  
weren't reliably close together).  That led to very cache-unfriendly  
behavior as the binary search touched strings in many different pages.  
Also, depending on the platform, the string pointers might need to  
be adjusted at program start, so that they couldn't be simple constant  
data.  And the ScanKeyword struct had been designed with an eye to  
32-bit machines originally; on 64-bit it requires 16 bytes per  
keyword, making it even more cache-unfriendly.  
  
Redesign so that the keyword strings themselves are allocated  
consecutively (as part of one big char-string constant), thereby  
eliminating the touch-lots-of-unrelated-pages syndrome.  And get  
rid of the ScanKeyword array in favor of three separate arrays:  
uint16 offsets into the keyword array, uint16 token codes, and  
uint8 keyword categories.  That reduces the overhead per keyword  
to 5 bytes instead of 16 (even less in programs that only need  
one of the token codes and categories); moreover, the binary search  
only touches the offsets array, further reducing its cache footprint.  
This also lets us put the token codes somewhere else than the  
keyword strings are, which avoids some unpleasant build dependencies.  
  
While we're at it, wrap the data used by ScanKeywordLookup into  
a struct that can be treated as an opaque type by most callers.  
That doesn't change things much right now, but it will make it  
less painful to switch to a hash-based lookup method, as is being  
discussed in the mailing list thread.  
  
Most of the change here is associated with adding a generator  
script that can build the new data structure from the same  
list-of-PG_KEYWORD header representation we used before.  
The PG_KEYWORD lists that plpgsql and ecpg used to embed in  
their scanner .c files have to be moved into headers, and the  
Makefiles have to be taught to invoke the generator script.  
This work is also necessary if we're to consider hash-based lookup,  
since the generator script is what would be responsible for  
constructing a hash table.  
  
Aside from saving a few kilobytes in each program that includes  
the keyword table, this seems to speed up raw parsing (flex+bison)  
by a few percent.  So it's worth doing even as it stands, though  
we think we can gain even more with a follow-on patch to switch  
to hash-based lookup.  
  
John Naylor, with further hacking by me  
  
Discussion: https://postgr.es/m/CAJVSVGXdFVU2sgym89XPL=Lv1zOS5=EHHQ8XWNzFL=mTXkKMLw@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/ruleutils.c
A src/common/.gitignore
M src/common/Makefile
M src/common/keywords.c
A src/common/kwlookup.c
M src/fe_utils/string_utils.c
M src/include/common/keywords.h
A src/include/common/kwlookup.h
M src/include/parser/kwlist.h
M src/include/parser/scanner.h
M src/interfaces/ecpg/preproc/.gitignore
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_keywords.c
A src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/ecpg_keywords.c
A src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/pl/plpgsql/src/.gitignore
M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
A src/pl/plpgsql/src/pl_unreserved_kwlist.h
A src/tools/gen_keywordlist.pl
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat

Fix program build rule in src/bin/scripts/Makefile.

commit   : c5c7fa261f57fadd93f166dc33ce2b1d188ad4e7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Jan 2019 19:12:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Jan 2019 19:12:22 -0500    

Click here for diff

Commit 69ae9dcb4 added a globally-visible "%: %.o" rule, but we failed  
to notice that src/bin/scripts/Makefile already had such a rule.  
Apparently, the later occurrence of the same rule wins in nearly all  
versions of gmake ... but not in the one used by buildfarm member jacana.  
jacana is evidently using the global rule, which says to link "$<",  
ie just the first dependency.  But the scripts makefile needs to  
link "$^", ie all the dependencies listed for the target.  
  
There is, fortunately, no good reason not to use "$^" in the global  
version of the rule, so we can just do that and get rid of the local  
version.  

M src/Makefile.global.in
M src/bin/scripts/Makefile

Don't create relfilenode for relations without storage

commit   : 807ae415c54628ade937cb209f0fc9913e6b0cf5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 4 Jan 2019 14:51:17 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 4 Jan 2019 14:51:17 -0300    

Click here for diff

Some relation kinds had relfilenode set to some non-zero value, but  
apparently the actual files did not really exist because creation was  
prevented elsewhere.  Get rid of the phony pg_class.relfilenode values.  
  
Catversion bumped, but only because the sanity_test check will fail if  
run in a system initdb'd with the previous version.  
  
Reviewed-by: Kyotaro HORIGUCHI, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/catversion.h
M src/include/utils/rel.h
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/sanity_check.sql

Rename macro to RELKIND_HAS_STORAGE

commit   : df5be63763f82c5cd1b7f8af702b2e20f7d282aa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 4 Jan 2019 14:34:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 4 Jan 2019 14:34:18 -0300    

Click here for diff

The original name was an unfortunate choice.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/commands/tablecmds.c
M src/include/catalog/pg_class.h

Support plpgsql variable names that conflict with unreserved SQL keywords.

commit   : 4879a5172af01dc05b6350dfa97ea1ac9a4c603c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Jan 2019 12:16:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Jan 2019 12:16:19 -0500    

Click here for diff

A variable name matching a statement-introducing keyword, such as  
"comment" or "update", caused parse failures if one tried to write  
a statement using that keyword.  Commit bb1b8f69 already addressed  
this scenario for the case of variable names matching unreserved  
plpgsql keywords, but we didn't think about unreserved core-grammar  
keywords.  The same heuristic (viz, it can't be a variable name  
unless the next token is assignment or '[') should work fine for  
that case too, and as a bonus the code gets shorter and less  
duplicative.  
  
Per bug #15555 from Feike Steenbergen.  Since this hasn't been  
complained of before, and is easily worked around anyway,  
I won't risk a back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Make sort-test.py Python 3 compatible

commit   : cb719fa02d828a4a5d1746f4282fdecec51b5656    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Jan 2019 11:23:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Jan 2019 11:23:24 +0100    

Click here for diff

Python 2 is still supported.  

M src/test/locale/sort-test.py

unaccent: Make generate_unaccent_rules.py Python 3 compatible

commit   : 3d59da9ccdb9d00dee906a40bc8471049b4c9e17    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Jan 2019 11:12:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Jan 2019 11:12:31 +0100    

Click here for diff

Python 2 is still supported.  
  
Author: Hugh Ranalli <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAAhbUMNyZ+PhNr_mQ=G161K0-hvbq13Tz2is9M3WK+yX9cQOCw@mail.gmail.com  

M contrib/unaccent/generate_unaccent_rules.py

Move the built-in conversions into the initial catalog data.

commit   : d33faa285b8f692549c5ec278c8e631786ae4502    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Jan 2019 19:47:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Jan 2019 19:47:53 -0500    

Click here for diff

Instead of running a SQL script to create the standard conversion  
functions and pg_conversion entries, put those entries into the  
initial data in postgres.bki.  
  
This shaves a few percent off the runtime of initdb, and also allows  
accurate comments to be attached to the conversion functions; the  
previous script labeled them with machine-generated comments that  
were not quite right for multi-purpose conversion functions.  
Also, we can get rid of the duplicative Makefile and MSVC perl  
implementations of the generation code for that SQL script.  
  
A functional change is that these pg_proc and pg_conversion entries  
are now "pinned" by initdb.  Leaving them unpinned was perhaps a  
good thing back while the conversions feature was under development,  
but there seems no valid reason for it now.  
  
Also, the conversion functions are now marked as immutable, where  
before they were volatile by virtue of lacking any explicit  
specification.  That seems like it was just an oversight.  
  
To avoid using magic constants in pg_conversion.dat, extend  
genbki.pl to allow encoding names to be converted, much as it  
does for language, access method, etc names.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CAJVSVGWtUqxpfAaxS88vEGvi+jKzWZb2EStu5io-UPc4p9rSJg@mail.gmail.com  

M doc/src/sgml/bki.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl
D src/backend/utils/mb/conversion_procs/.gitignore
M src/backend/utils/mb/conversion_procs/Makefile
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/catalog/genbki.h
A src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_sanity.out
M src/tools/msvc/Install.pm

Use symbolic references for pg_language OIDs in the bootstrap data.

commit   : 814c9019aa7b0ce3a4f19415023a256fdd717b20    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Jan 2019 18:38:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Jan 2019 18:38:49 -0500    

Click here for diff

This patch teaches genbki.pl to replace pg_language names by OIDs  
in much the same way as it already does for pg_am names etc, and  
converts pg_proc.dat to use such symbolic references in the prolang  
column.  
  
Aside from getting rid of a few more magic numbers in the initial  
catalog data, this means that Gen_fmgrtab.pl no longer needs to read  
pg_language.dat, since it doesn't have to know the OID of the "internal"  
language; now it's just looking for the string "internal".  
  
No need for a catversion bump, since the contents of postgres.bki  
don't actually change at all.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CAJVSVGWtUqxpfAaxS88vEGvi+jKzWZb2EStu5io-UPc4p9rSJg@mail.gmail.com  

M doc/src/sgml/bki.sgml
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/tools/msvc/Solution.pm

Improve ANALYZE's handling of concurrent-update scenarios.

commit   : 7170268efd511cb43bee49cd7963216a3f228648    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Jan 2019 17:00:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Jan 2019 17:00:08 -0500    

Click here for diff

This patch changes the rule for whether or not a tuple seen by ANALYZE  
should be included in its sample.  
  
When we last touched this logic, in commit 51e1445f1, we weren't  
thinking very hard about tuples being UPDATEd by a long-running  
concurrent transaction.  In such a case, we might see the pre-image as  
either LIVE or DELETE_IN_PROGRESS depending on timing; and we might see  
the post-image not at all, or as INSERT_IN_PROGRESS.  Since the existing  
code will not sample either DELETE_IN_PROGRESS or INSERT_IN_PROGRESS  
tuples, this leads to concurrently-updated rows being omitted from the  
sample entirely.  That's not very helpful, and it's especially the wrong  
thing if the concurrent transaction ends up rolling back.  
  
The right thing seems to be to sample DELETE_IN_PROGRESS rows just as if  
they were live.  This makes the "sample it" and "count it" decisions the  
same, which seems good for consistency.  It's clearly the right thing  
if the concurrent transaction ends up rolling back; in effect, we are  
sampling as though IN_PROGRESS transactions haven't happened yet.  
Also, this combination of choices ensures maximum robustness against  
the different combinations of whether and in which state we might see the  
pre- and post-images of an update.  
  
It's slightly annoying that we end up recording immediately-out-of-date  
stats in the case where the transaction does commit, but on the other  
hand the stats are fine for columns that didn't change in the update.  
And the alternative of sampling INSERT_IN_PROGRESS rows instead seems  
like a bad idea, because then the sampling would be inconsistent with  
the way rows are counted for the stats report.  
  
Per report from Mark Chambers; thanks to Jeff Janes for diagnosing  
what was happening.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/CAFh58O_Myr6G3tcH3gcGrF-=OExB08PJdWZcSBcEcovaiPsrHA@mail.gmail.com  

M src/backend/commands/analyze.c

Don't believe MinMaxExpr is leakproof without checking.

commit   : 68a13f28bebc9eb70cc6988bfa2daaf4500f519f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Jan 2019 16:33:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Jan 2019 16:33:48 -0500    

Click here for diff

MinMaxExpr invokes the btree comparison function for its input datatype,  
so it's only leakproof if that function is.  Many such functions are  
indeed leakproof, but others are not, and we should not just assume that  
they are.  Hence, adjust contain_leaked_vars to verify the leakproofness  
of the referenced function explicitly.  
  
I didn't add a regression test because it would need to depend on  
some particular comparison function being leaky, and that's a moving  
target, per discussion.  
  
This has been wrong all along, so back-patch to supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/clauses.c

Switch pg_regress to output unified diffs by default

commit   : acfe1392eff2f96ef7931068b11b2d58196f4d95    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jan 2019 21:20:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jan 2019 21:20:53 +0100    

Click here for diff

Author: Christoph Berg <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M doc/src/sgml/regress.sgml
M src/test/regress/pg_regress.c

commit   : 69ae9dcb444a667533344562f134444856fb3414    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Jan 2019 13:57:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Jan 2019 13:57:42 -0500    

Click here for diff

It's important for link commands to list *.o input files before -l  
switches for libraries, as library code may not get pulled into the link  
unless referenced by an earlier command-line entry.  This is certainly  
necessary for static libraries (.a style).  Apparently on some platforms  
it is also necessary for shared libraries, as reported by Donald Dong.  
  
We often put -l switches for within-tree libraries into LDFLAGS, meaning  
that link commands that list *.o files after LDFLAGS are hazardous.  
Most of our link commands got this right, but a few did not.  In  
particular, places that relied on gmake's default implicit link rule  
failed, because that puts LDFLAGS first.  Fix that by overriding the  
built-in rule with our own.  The implicit link rules in  
src/makefiles/Makefile.* for single-.o-file shared libraries mostly  
got this wrong too, so fix them.  I also changed the link rules for the  
backend and a couple of other places for consistency, even though they  
are not (currently) at risk because they aren't adding any -l switches  
to LDFLAGS.  
  
Arguably, the real problem here is that we're abusing LDFLAGS by  
putting -l switches in it and we should stop doing that.  But changing  
that would be quite invasive, so I'm not eager to do so.  
  
Perhaps this is a candidate for back-patching, but so far it seems  
that problems can only be exhibited in test code we don't normally  
build, and at least some of the problems are new in HEAD anyway.  
So I'll refrain for now.  
  
Donald Dong and Tom Lane  
  
Discussion: https://postgr.es/m/CAKABAquXn-BF-vBeRZxhzvPyfMqgGuc74p8BmQZyCFDpyROBJQ@mail.gmail.com  

M src/Makefile.global.in
M src/backend/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/test/Makefile
M src/interfaces/ecpg/test/Makefile.regress
M src/makefiles/Makefile.aix
M src/makefiles/Makefile.darwin
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.hpux
M src/makefiles/Makefile.linux
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd
M src/makefiles/Makefile.solaris
M src/test/thread/Makefile

commit   : 97c39498e5ca9208d3de5a443a2282923619bf91    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 2 Jan 2019 12:44:25 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 2 Jan 2019 12:44:25 -0500    

Click here for diff

Backpatch-through: certain files through 9.4  

M COPYRIGHT
M configure
M configure.in
M contrib/adminpack/adminpack.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/dblink/dblink.c
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/intarray/_int_selfuncs.c
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/vacuumlo.c
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/syncscan.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/lib/binaryheap.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/knapsack.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/lib/stringinfo.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/port/atomics.c
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/mingwcompat.c
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/smgr/smgrtype.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/dicts/hunspell_sample_long.dict
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashes.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/txid.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/hashfn.c
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/probes.d
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/backend/utils/time/tqual.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_config/Makefile
M src/bin/pg_config/pg_config.c
M src/bin/pg_controldata/Makefile
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/fetch.c
M src/bin/pg_rewind/fetch.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_fetch.c
M src/bin/pg_rewind/logging.c
M src/bin/pg_rewind/logging.h
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/timeline.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_verify_checksums/Makefile
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgevent/Makefile
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/base64.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/exec.c
M src/common/fe_memutils.c
M src/common/file_perm.c
M src/common/file_utils.c
M src/common/ip.c
M src/common/keywords.c
M src/common/link-canary.c
M src/common/md5.c
M src/common/pg_lzcompress.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha2.c
M src/common/sha2_openssl.c
M src/common/string.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/norm_test.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/fe_utils/Makefile
M src/fe_utils/conditional.c
M src/fe_utils/mbprint.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/sysattr.h
M src/include/access/timeline.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/access/tupmacs.h
M src/include/access/tuptoaster.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/Makefile
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/opfam_internal.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_pltemplate.dat
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/variable.h
M src/include/commands/view.h
M src/include/common/base64.h
M src/include/common/config_info.h
M src/include/common/controldata_utils.h
M src/include/common/fe_memutils.h
M src/include/common/file_perm.h
M src/include/common/file_utils.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/keywords.h
M src/include/common/link-canary.h
M src/include/common/md5.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha2.h
M src/include/common/string.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_table.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/connect.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/rbtree.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/relation.h
M src/include/nodes/replnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/predtest.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/optimizer/var.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partprune.h
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic-xlc.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/win32_port.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/basebackup.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalfuncs.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/backendid.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/hashutils.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonapi.h
M src/include/utils/jsonb.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/partcache.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenodemap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tqual.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol2.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/libpq.rc.in
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/test/uri-regress.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plperl.h
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/plpython.h
M src/pl/tcl/generate-pltclerrcodes.pl
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/dlopen.c
M src/port/erand48.c
M src/port/fls.c
M src/port/fseeko.c
M src/port/getaddrinfo.c
M src/port/getpeereid.c
M src/port/getrusage.c
M src/port/isinf.c
M src/port/kill.c
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_crc32c_sse42_choose.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pgstrsignal.c
M src/port/pqsignal.c
M src/port/pread.c
M src/port/pwrite.c
M src/port/quotes.c
M src/port/random.c
M src/port/snprintf.c
M src/port/sprompt.c
M src/port/srandom.c
M src/port/strerror.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/system.c
M src/port/thread.c
M src/port/unsetenv.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/kerberos/Makefile
M src/test/ldap/Makefile
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_predtest/test_predtest.c
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/perl/Makefile
M src/test/recovery/Makefile
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/subscription/Makefile
M src/test/thread/Makefile
M src/test/thread/thread_test.c
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/findoidjoins/Makefile
M src/tools/findoidjoins/findoidjoins.c
M src/tools/fix-old-flex-code.pl
M src/tools/ifaddrs/Makefile
M src/tools/testint128.c
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Convert unaccent tests to UTF-8

commit   : b6f3649bba9832cf4958dbb184dabef93dcea29c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jan 2019 18:36:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Jan 2019 18:36:05 +0100    

Click here for diff

This makes it easier to add new tests that are specific to Unicode  
features.  The files were previously in KOI8-R.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/unaccent/expected/unaccent.out
M contrib/unaccent/sql/unaccent.sql

Remove configure switch --disable-strong-random

commit   : 1707a0d2aa6b2bcfe78f63836c769943a1a6b9e0    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 1 Jan 2019 20:05:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 1 Jan 2019 20:05:51 +0900    

Click here for diff

This removes a portion of infrastructure introduced by fe0a0b5 to allow  
compilation of Postgres in environments where no strong random source is  
available, meaning that there is no linking to OpenSSL and no  
/dev/urandom (Windows having its own CryptoAPI).  No systems shipped  
this century lack /dev/urandom, and the buildfarm is actually not  
testing this switch at all, so just remove it.  This simplifies  
particularly some backend code which included a fallback implementation  
using shared memory, and removes a set of alternate regression output  
files from pgcrypto.  
  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
D contrib/pgcrypto/expected/pgp-compression_1.out
D contrib/pgcrypto/expected/pgp-decrypt_1.out
D contrib/pgcrypto/expected/pgp-encrypt_1.out
D contrib/pgcrypto/expected/pgp-pubkey-encrypt_1.out
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/pgp-encrypt.c
M contrib/pgcrypto/pgp-mpi-internal.c
M contrib/pgcrypto/pgp-pubenc.c
M contrib/pgcrypto/pgp-s2k.c
M contrib/pgcrypto/px-crypt.c
M contrib/pgcrypto/px.c
M doc/src/sgml/installation.sgml
M doc/src/sgml/monitoring.sgml
M src/Makefile.global.in
M src/backend/access/transam/xlog.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/adt/float.c
M src/backend/utils/misc/Makefile
D src/backend/utils/misc/backend_random.c
M src/bin/pgbench/pgbench.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
D src/include/utils/backend_random.h
M src/interfaces/libpq/fe-auth-scram.c
M src/port/Makefile

Fix generation of padding message before encrypting Elgamal in pgcrypto

commit   : d880b208e5fcf55e3ae396d5fc5fa6639f58205f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 1 Jan 2019 10:39:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 1 Jan 2019 10:39:19 +0900    

Click here for diff

fe0a0b5, which has added a stronger random source in Postgres, has  
introduced a thinko when creating a padding message which gets encrypted  
for Elgamal.  The padding message cannot have zeros, which are replaced  
by random bytes.  However if pg_strong_random() failed, the message  
would finish by being considered in correct shape for encryption with  
zeros.  
  
Author: Tom Lane  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M contrib/pgcrypto/pgp-pubenc.c

Improve comments and logs in do_pg_stop/start_backup

commit   : 8d3b389ec3405659d8e2968fc6179b28b286ccd8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 1 Jan 2019 08:53:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 1 Jan 2019 08:53:02 +0900    

Click here for diff

The function name pg_stop_backup() has been included for ages in some  
log messages when stopping the backup, which is confusing for base  
backups taken with the replication protocol because this function is  
never called.  Some other comments and messages in this area are  
improved while on it.  
  
The new wording is based on input and suggestions from several people,  
all listed below.  
  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut, Álvaro Herrera, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

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

Process EXTRA_INSTALL serially, during the first temp-install.

commit   : aa019da523912876ec20129f28b3b1657ba6f263    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 31 Dec 2018 13:54:38 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 31 Dec 2018 13:54:38 -0800    

Click here for diff

This closes a race condition in "make -j check-world"; the symptom was  
EEXIST errors.  Back-patch to v10, before which parallel check-world had  
worse problems.  
  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M src/Makefile.global.in
M src/makefiles/pgxs.mk

Send EXTRA_INSTALL errors to install.log, not stderr.

commit   : 76f7b0b08ac44733193bfb0b0d61dd2b32cdc21b    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 31 Dec 2018 13:53:05 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 31 Dec 2018 13:53:05 -0800    

Click here for diff

We already redirected other temp-install stderr and all temp-install  
stdout in this way.  Back-patch to v10, like the next commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in

pg_regress: Promptly detect failed postmaster startup.

commit   : 94600dd4f47d4eb659e0c35cab0aeb257f89cbf1    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 31 Dec 2018 13:50:32 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 31 Dec 2018 13:50:32 -0800    

Click here for diff

Detect it the way pg_ctl's wait_for_postmaster() does.  When pg_regress  
spawned a postmaster that failed startup, we were detecting that only  
with "pg_regress: postmaster did not respond within 60 seconds".  
Back-patch to 9.4 (all supported versions).  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Update leakproofness markings on some btree comparison functions.

commit   : d01e75d68eb2a478c57af92cc38f23f3ce5e1e0f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Dec 2018 16:38:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Dec 2018 16:38:11 -0500    

Click here for diff

Mark pg_lsn and oidvector comparison functions as leakproof.  Per  
discussion, these clearly are leakproof so we might as well mark them so.  
  
On the other hand, remove leakproof markings from name comparison  
functions other than equal/not-equal.  Now that these depend on  
varstr_cmp, they can't be considered leakproof if text comparison isn't.  
(This was my error in commit 586b98fdf.)  
  
While at it, add some opr_sanity queries to catch cases where related  
functions do not have the same volatility and leakproof markings.  
This would clearly be bogus for commutator or negator pairs.  In the  
domain of btree comparison functions, we do have some exceptions,  
because text equality is leakproof but inequality comparisons are not.  
That's odd on first glance but is reasonable (for now anyway) given  
the much greater complexity of the inequality code paths.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Remove some useless code

commit   : e439c6f0c3ddc6e4b71922ec326cb796c2885656    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 31 Dec 2018 14:40:33 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 31 Dec 2018 14:40:33 -0300    

Click here for diff

In commit 8b08f7d4820f I added member relationId to IndexStmt struct.  
I'm now not sure why; DefineIndex doesn't need it, since the relation  
OID is passed as a separate argument anyway.  Remove it.  
  
Also remove a redundant assignment to the relationId argument (it wasn't  
redundant when added by commit e093dcdd285, but should have been removed  
in commit 5f173040e3), and use relationId instead of stmt->relation when  
locking the relation in the second phase of CREATE INDEX CONCURRENTLY,  
which is not only confusing but it means we resolve the name twice for  
no reason.  

M src/backend/commands/indexcmds.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/include/nodes/parsenodes.h

Fix oversight in commit b5415e3c2187ab304390524f5ae66b4bd2c58279.

commit   : b2edbbd02d3070c234225da7b2ec10298652658a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Dec 2018 12:39:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Dec 2018 12:39:15 -0500    

Click here for diff

While rearranging code in tidpath.c, I overlooked the fact that we ought  
to check restriction_is_securely_promotable when trying to use a join  
clause as a TID qual.  Since tideq itself is leakproof, this wouldn't  
really allow any interesting leak AFAICT, but it still seems like we  
had better check it.  
  
For consistency with the corresponding logic in indxpath.c, also  
check rinfo->pseudoconstant.  I'm not sure right now that it's  
possible for that to be set in a join clause, but if it were,  
a match couldn't be made anyway.  

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

Change "checkpoint starting" message to use "wal"

commit   : 60d99797bfb07f8042a8b82c161500f6e4a500ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 30 Dec 2018 22:23:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 30 Dec 2018 22:23:01 +0100    

Click here for diff

This catches up with the recent renaming of all user-facing mentions  
of "xlog" to "wal".  
  
Discussion: https://www.postgresql.org/message-id/flat/20181129084708.GA9562%40msg.credativ.de  

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

Add a hash opclass for type "tid".

commit   : 0a6ea4001a9dff64e9ba66f68855a59a1bf69bc9    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Dec 2018 15:40:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Dec 2018 15:40:04 -0500    

Click here for diff

Up to now we've not worried much about joins where the join key is a  
relation's CTID column, reasoning that storing a table's CTIDs in some  
other table would be pretty useless.  However, there are use-cases for  
this sort of query involving self-joins, so that argument doesn't really  
hold water.  
  
With larger relations, a merge or hash join is desirable.  We had a btree  
opclass for type "tid", allowing merge joins on CTID, but no hash opclass  
so that hash joins weren't possible.  Add the missing infrastructure.  
  
This also potentially enables hash aggregation on "tid", though the  
use-cases for that aren't too clear.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/tid.c
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_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/test/regress/expected/tidscan.out
M src/test/regress/sql/tidscan.sql

Support parameterized TidPaths.

commit   : b5415e3c2187ab304390524f5ae66b4bd2c58279    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Dec 2018 15:24:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Dec 2018 15:24:28 -0500    

Click here for diff

Up to now we've not worried much about joins where the join key is a  
relation's CTID column, reasoning that storing a table's CTIDs in some  
other table would be pretty useless.  However, there are use-cases for  
this sort of query involving self-joins, so that argument doesn't really  
hold water.  
  
This patch allows generating plans for joins on CTID that use a nestloop  
with inner TidScan, similar to what we might do with an index on the join  
column.  This is the most efficient way to join when the outer side of  
the nestloop is expected to yield relatively few rows.  
  
This change requires upgrading tidpath.c and the generated TidPaths  
to work with RestrictInfos instead of bare qual clauses, but that's  
long-postponed technical debt anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/test/regress/expected/tidscan.out
M src/test/regress/sql/tidscan.sql

Teach eval_const_expressions to constant-fold LEAST/GREATEST expressions.

commit   : 6f19a8c41f976236310a272bb646d3411759e18d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Dec 2018 13:42:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Dec 2018 13:42:04 -0500    

Click here for diff

Doing this requires an assumption that the invoked btree comparison  
function is immutable.  We could check that explicitly, but in other  
places such as contain_mutable_functions we just assume that it's true,  
so we may as well do likewise here.  (If the comparison function's  
behavior isn't immutable, the sort order in indexes built with it would  
be unstable, so it seems certainly wrong for it not to be so.)  
  
Vik Fearing  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/clauses.c

Trigger stmt_beg and stmt_end for top-level statement blocks of PL/pgSQL

commit   : e0ef136d5235f39f5652c209c08a5d4322560e9c    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 30 Dec 2018 14:35:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 30 Dec 2018 14:35:15 +0900    

Click here for diff

PL/pgSQL provides a set of callbacks which can be used for extra  
instrumentation of functions written in this language called at function  
setup, begin and end, as well as statement begin and end.  When calling  
a routine, a trigger, or an event trigger, statement callbacks are not  
getting called for the top-level statement block leading to an  
inconsistent handling compared to the other statements.  This  
inconsistency can potentially complicate extensions doing  
instrumentation work on top of PL/pgSQL, so this commit makes sure that  
all statement blocks, including the top-level one, go through the  
correct corresponding callbacks.  
  
Author: Pavel Stehule  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAFj8pRArEANsaUjo5in9_iQt0vKf9ecwDAmsdN_EBwL13ps12A@mail.gmail.com  

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

Use pg_strong_random() to select each server process's random seed.

commit   : 4203842a1cd06a7c30fd3eaae1c111928909e539    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Dec 2018 17:56:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Dec 2018 17:56:06 -0500    

Click here for diff

Previously we just set the seed based on process ID and start timestamp.  
Both those values are directly available within the session, and can  
be found out or guessed by other users too, making the session's series  
of random(3) values fairly predictable.  Up to now, our backend-internal  
uses of random(3) haven't seemed security-critical, but commit 88bdbd3f7  
added one that potentially is: when using log_statement_sample_rate, a  
user might be able to predict which of his SQL statements will get logged.  
  
To improve this situation, upgrade the per-process seed initialization  
method to use pg_strong_random() if available, greatly reducing the  
predictability of the initial seed value.  This adds a few tens of  
microseconds to process start time, but since backend startup time is  
at least a couple of milliseconds, that seems an acceptable price.  
  
This means that pg_strong_random() needs to be able to run without  
reliance on any backend infrastructure, since it will be invoked  
before any of that is up.  It was safe for that already, but adjust  
comments and #include commands to make it clearer.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c
M src/port/pg_strong_random.c

Use a separate random seed for SQL random()/setseed() functions.

commit   : 6645ad6bdd81e7d5a764e0d94ef52fae053a9e13    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Dec 2018 17:33:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Dec 2018 17:33:27 -0500    

Click here for diff

Previously, the SQL random() function depended on libc's random(3),  
and setseed() invoked srandom(3).  This results in interference between  
these functions and backend-internal uses of random(3).  We'd never paid  
too much mind to that, but in the wake of commit 88bdbd3f7 which added  
log_statement_sample_rate, the interference arguably has a security  
consequence: if log_statement_sample_rate is active then an unprivileged  
user could probably control which if any of his SQL commands get logged,  
by issuing setseed() at the right times.  That seems bad.  
  
To fix this reliably, we need random() and setseed() to use their own  
private random state variable.  Standard random(3) isn't amenable to such  
usage, so let's switch to pg_erand48().  It's hard to say whether that's  
more or less "random" than any particular platform's version of random(3),  
but it does have a wider seed value and a longer period than are required  
by POSIX, so we can hope that this isn't a big downgrade.  Also, we should  
now have uniform behavior of random() across platforms, which is worth  
something.  
  
While at it, upgrade the per-process seed initialization method to use  
pg_strong_random() if available, greatly reducing the predictability  
of the initial seed value.  (I'll separately do something similar for  
the internal uses of random().)  
  
In addition to forestalling the possible security problem, this has a  
benefit in the other direction, which is that we can now document  
setseed() as guaranteeing a reproducible sequence of random() values.  
Previously, because of the possibility of internal calls of random(3),  
we could not promise any such thing.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/float.c

pg_rewind: Add missing newline to error message

commit   : 1a4eba4e246480466c04feb81f76866e7dcb2827    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 29 Dec 2018 13:02:51 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 29 Dec 2018 13:02:51 +0100    

Click here for diff

M src/bin/pg_rewind/pg_rewind.c

Remove redundant translation markers

commit   : e3299d36a938c7af386b240f318c7b9e55bdc92d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 29 Dec 2018 12:50:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 29 Dec 2018 12:50:59 +0100    

Click here for diff

psql_error() already handles that itself.  

M src/bin/psql/command.c
M src/bin/psql/common.c

Improve description of DEFAULT_XLOG_SEG_SIZE in pg_config.h

commit   : 0a5a493f042b30afe350763820dc79bb3e6df91a    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 29 Dec 2018 08:24:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 29 Dec 2018 08:24:11 +0900    

Click here for diff

This was incorrectly referring to --walsegsize, and its description is  
rewritten in a clearer way.  
  
Author: Ian Barwick, Tom Lane  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/include/pg_config_manual.h

Marginal performance hacking in erand48.c.

commit   : 6b9bba2df8d469a13bf8f0b9eb6933c7eaaff2c1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Dec 2018 15:06:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Dec 2018 15:06:48 -0500    

Click here for diff

Get rid of the multiplier and addend variables in favor of hard-wired  
constants.  Do the multiply-and-add using uint64 arithmetic, rather  
than manually combining several narrower multiplications and additions.  
Make _dorand48 return the full-width new random value, and have its  
callers use that directly (after suitable masking) rather than  
reconstructing what they need from the unsigned short[] representation.  
  
On my machine, this is good for a nearly factor-of-2 speedup of  
pg_erand48(), probably mostly from needing just one call of ldexp()  
rather than three.  The wins for the other functions are smaller  
but measurable.  While none of the existing call sites are really  
performance-critical, a cycle saved is a cycle earned; and besides  
the machine code is smaller this way (at least on x86_64).  
  
Patch by me, but the original idea to optimize this by switching  
to int64 arithmetic is from Fabien Coelho.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/erand48.c

Fix latent problem with pg_jrand48().

commit   : e09046641114dc5ab038530019bc35b04c2976e7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Dec 2018 14:08:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Dec 2018 14:08:24 -0500    

Click here for diff

POSIX specifies that jrand48() returns a signed 32-bit value (in the  
range [-2^31, 2^31)), but our code was returning an unsigned 32-bit  
value (in the range [0, 2^32)).  This doesn't actually matter to any  
existing call site, because they all cast the "long" result to int32  
or uint32; but it will doubtless bite somebody in the future.  
To fix, cast the arithmetic result to int32 explicitly before the  
compiler widens it to long (if widening is needed).  
  
While at it, upgrade this file's far-short-of-project-style comments.  
Had there been some peer pressure to document pg_jrand48() properly,  
maybe this thinko wouldn't have gotten committed to begin with.  
  
Backpatch to v10 where pg_jrand48() was added, just in case somebody  
back-patches a fix that uses it and depends on the standard behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/erand48.c

Fix thinko in previous commit

commit   : 4ed6c071b82a80fb7d8396477a5d698de3c93bf3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 28 Dec 2018 15:18:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 28 Dec 2018 15:18:00 -0300    

Click here for diff

M src/backend/executor/execMain.c

Rewrite ExecPartitionCheckEmitError for clarity

commit   : e8b0e6b82dbdb4459ec19f9871f691dfa7d1902c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 28 Dec 2018 14:47:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 28 Dec 2018 14:47:05 -0300    

Click here for diff

The original was hard to follow and failed to comply with DRY principle.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c

Clarify referential actions in docs of CREATE/ALTER TABLE

commit   : f7ea1a42337f45efed7c4d44f50f62a55e60d30c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 28 Dec 2018 10:19:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 28 Dec 2018 10:19:14 +0900    

Click here for diff

The documentation of ON DELETE and ON UPDATE uses the term "action",  
which is also used on the ALTER TABLE page for other purposes.  This  
commit renames the term to "referential_action", which is more  
consistent with the SQL specification.  The new term is now used on the  
documentation of both CREATE TABLE and ALTER TABLE for consistency.  
  
Reported-by: Brigitte Blanc-Lafay  
Author: Lætitia Avrot  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CAB_COdiHEVVs0uB+uYCjjYUwQ4YFFekppq+Xqv6qAM8+cd42gA@mail.gmail.com  

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

Reduce length of GIN predicate locking isolation test suite

commit   : 0c6f4f9212cf3155b258910acf80fec89f49b767    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 28 Dec 2018 03:33:10 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 28 Dec 2018 03:33:10 +0300    

Click here for diff

Isolation test suite of GIN predicate locking was criticized for being too slow,  
especially under Valgrind.  This commit is intended to accelerate it.  Tests are  
simplified in the following ways.  
  
  1) Amount of data is reduced.  We're now close to the minimal amount of data,  
     which produces at least one posting tree and at least two pages of entry  
     tree.  
  2) Three isolation tests are merged into one.  
  3) Only one tuple is queried from posting tree.  So, locking of index is the  
     same, but tuple locks are not propagated to relation lock.  Also, it is  
     faster.  
  4) Test cases itself are simplified.  Now each test case run just one INSERT  
     and one SELECT involving GIN, which either conflict or not.  
  
Discussion: https://postgr.es/m/20181204000740.ok2q53nvkftwu43a%40alap3.anarazel.de  
Reported-by: Andres Freund  
Tested-by: Andrew Dunstan  
Author: Alexander Korotkov  
Backpatch-through: 11  

D src/test/isolation/expected/predicate-gin-fastupdate.out
D src/test/isolation/expected/predicate-gin-nomatch.out
M src/test/isolation/expected/predicate-gin.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/predicate-gin-fastupdate.spec
D src/test/isolation/specs/predicate-gin-nomatch.spec
M src/test/isolation/specs/predicate-gin.spec

Remove obsolete IndexIs* macros

commit   : ae4472c619341ff0517254d395d74796277622e6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Dec 2018 10:07:46 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Dec 2018 10:07:46 +0100    

Click here for diff

Remove IndexIsValid(), IndexIsReady(), IndexIsLive() in favor of  
accessing the index structure directly.  These macros haven't been  
used consistently, and the original reason of maintaining source  
compatibility with PostgreSQL 9.2 is gone.  
  
Discussion: https://www.postgresql.org/message-id/flat/d419147c-09d4-6196-5d9d-0234b230880a%402ndquadrant.com  

M contrib/amcheck/verify_nbtree.c
M contrib/tcn/tcn.c
M src/backend/access/heap/tuptoaster.c
M src/backend/catalog/index.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/executor/execIndexing.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/pg_index.h

pg_dump: Add missing newline to error message

commit   : 5c828307973366f424438b848d4cca6ef98c032e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Dec 2018 10:03:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Dec 2018 10:03:05 +0100    

Click here for diff

M src/bin/pg_dump/pg_backup_archiver.c

Remove entry tree root conflict checking from GIN predicate locking

commit   : b450abd2551ee30b5bc289c662f5728d87e13a39    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 27 Dec 2018 04:10:51 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 27 Dec 2018 04:10:51 +0300    

Click here for diff

According to README we acquire predicate locks on entry tree leafs and posting  
tree roots.  However, when ginFindLeafPage() is going to lock leaf in exclusive  
mode, then it checks root for conflicts regardless whether it's a entry or  
posting tree.  Assuming that we never place predicate lock on entry tree root  
(excluding corner case when root is leaf), this check is redundant.  This  
commit removes this check.  Now, root conflict checking is controlled by  
separate argument of ginFindLeafPage().  
  
Discussion: https://postgr.es/m/CAPpHfdv7rrDyy%3DMgsaK-L9kk0AH7az0B-mdC3w3p0FSb9uoyEg%40mail.gmail.com  
Author: Alexander Korotkov  
Backpatch-through: 11  

M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/include/access/gin_private.h

Ignore inherited temp relations from other sessions when truncating

commit   : 1e504f01da11db0181d7b28bb30cb5eeb0767184    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Dec 2018 10:16:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Dec 2018 10:16:19 +0900    

Click here for diff

Inheritance trees can include temporary tables if the parent is  
permanent, which makes possible the presence of multiple temporary  
children from different sessions.  Trying to issue a TRUNCATE on the  
parent in this scenario causes a failure, so similarly to any other  
queries just ignore such cases, which makes TRUNCATE work  
transparently.  
  
This makes truncation behave similarly to any other DML query working on  
the parent table with queries which need to be work on the children.  A  
set of isolation tests is added to cover basic cases.  
  
Reported-by: Zhou Digoal  
Author: Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4  

M src/backend/commands/tablecmds.c
A src/test/isolation/expected/inherit-temp.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/inherit-temp.spec

Fix failure to check for open() or fsync() failures.

commit   : 8528e3d849a896f8711c56fb41eae56f8c986729    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Dec 2018 16:08:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Dec 2018 16:08:17 -0500    

Click here for diff

While it seems OK to not be concerned about fsync() failure for a  
pre-existing signal file, it's not OK to not even check for open()  
failure.  This at least causes complaints from static analyzers,  
and I think on some platforms passing -1 to fsync() or close() might  
trigger assertion-type failures.  Also add (void) casts to make clear  
that we're ignoring fsync's result intentionally.  
  
Oversights in commit 2dedf4d9a, noted by Coverity.  

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

Fix portability failure introduced in commits d2b0b60e7 et al.

commit   : e9fcfed3fb6b15e6b33bea9bb8504b14560857a8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Dec 2018 15:30:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Dec 2018 15:30:10 -0500    

Click here for diff

I made a frontend fprintf() format use %m, forgetting that that's only  
safe in HEAD not the back branches; prior to 96bf88d52 and d6c55de1f,  
it would work on glibc platforms but not elsewhere.  Revert to using  
%s ... strerror(errno) as the code did before.  
  
We could have left HEAD as-is, but for code consistency across branches,  
I chose to apply this patch there too.  
  
Per Coverity and a few buildfarm members.  

M src/common/psprintf.c

Improve tab completion of ALTER INDEX/TABLE with SET STATISTICS in psql

commit   : f89ae34ab8b4d9e9ce8af6bd889238b0ccff17cb    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Dec 2018 14:20:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Dec 2018 14:20:46 +0900    

Click here for diff

This fixes two issues with the completion of ALTER TABLE and ALTER INDEX  
after SET STATISTICS is typed, trying to suggest schema objects while  
the grammar only allows integers.  
  
The tab completion of ALTER INDEX is made smarter by handling properly  
more patterns.  COLUMN is an optional keyword, but as no column numbers  
can be suggested yet as possible input simply adjust the completion so  
as no incorrect queries are generated.  
  
Author: Michael Paquier  
Reviewed-by: Tatsuro Yamada  
Discussion: https://postgr.es/m/[email protected]  

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

Prioritize history files when archiving

commit   : b981df4cc09aca978c5ce55e437a74913d09cccc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 24 Dec 2018 20:24:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 24 Dec 2018 20:24:16 +0900    

Click here for diff

At the end of recovery for the post-promotion process, a new history  
file is created followed by the last partial segment of the previous  
timeline.  Based on the timing, the archiver would first try to archive  
the last partial segment and then the history file.  This can delay the  
detection of a new timeline taken, particularly depending on the time it  
takes to transfer the last partial segment as it delays the moment the  
history file of the new timeline gets archived.  This can cause promoted  
standbys to use the same timeline as one already taken depending on the  
circumstances if multiple instances look at archives at the same  
location.  
  
This commit changes the order of archiving so as history files are  
archived in priority over other file types, which reduces the likelihood  
of the same timeline being taken (still not reducing the window to  
zero), and it makes the archiver behave more consistently with the  
startup process doing its post-promotion business.  
  
Author: David Steele  
Reviewed-by: Michael Paquier, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5  

M src/backend/postmaster/pgarch.c

Disable WAL-skipping optimization for COPY on views and foreign tables

commit   : bf491a9073e12ce1fc3e6facd0ae1308534df570    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 23 Dec 2018 16:42:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 23 Dec 2018 16:42:22 +0900    

Click here for diff

COPY can skip writing WAL when loading data on a table which has been  
created in the same transaction as the one loading the data, however  
this cannot work on views or foreign table as this would result in  
trying to flush relation files which do not exist.  So disable the  
optimization so as commands are able to work the same way with any  
configuration of wal_level.  
  
Tests are added to cover the different cases, which need to have  
wal_level set to minimal to allow the problem to show up, and that is  
not the default configuration.  
  
Reported-by: Luis M. Carril, Etsuro Fujita  
Author: Amit Langote, Michael Paquier  
Reviewed-by: Etsuro Fujita  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10, where support for COPY on views has been added,  
while v11 has added support for COPY on foreign tables.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/commands/copy.c
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql

Add completion for storage parameters after CREATE TABLE WITH in psql

commit   : 11a60d496147a1e1bbf6932bda53941c5a62ee1a    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 23 Dec 2018 09:33:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 23 Dec 2018 09:33:49 +0900    

Click here for diff

In passing, move the list of parameters where it can be used for both  
CREATE TABLE and ALTER TABLE, and reorder it alphabetically.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

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

Add WRITE_*_ARRAY macros

commit   : 66ca44084d7ae40c45802d19f19eb4597bd12f40    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 22 Dec 2018 06:53:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 22 Dec 2018 06:53:37 +0100    

Click here for diff

Add WRITE_ATTRNUMBER_ARRAY, WRITE_OID_ARRAY, WRITE_INT_ARRAY,  
WRITE_BOOL_ARRAY macros to outfuncs.c, mirroring the existing  
READ_*_ARRAY macros in readfuncs.c.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8f2ebc67-e75f-9478-f5a5-bbbf090b1f8d%402ndquadrant.com  

M src/backend/nodes/outfuncs.c

Add some const decorations

commit   : 323eaf98250e2de9afb2d9f86fa841beaeb575b7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Dec 2018 21:17:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Dec 2018 21:17:53 +0100    

Click here for diff

These mainly help understanding the function signatures better.  

M src/backend/executor/execExpr.c
M src/backend/executor/execGrouping.c
M src/include/executor/executor.h

commit   : f4eabaf3e0f84d5eb3ebdeeff0a71cb8db4b1ff6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 22 Dec 2018 07:21:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 22 Dec 2018 07:21:40 +0100    

Click here for diff

This has never been correct since this code was introduced.  

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_basebackup.c

Check for conflicting queries during replay of gistvacuumpage()

commit   : c952eae52a33069e2e92d34f217b43d0eca3d7de    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 21 Dec 2018 02:37:37 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 21 Dec 2018 02:37:37 +0300    

Click here for diff

013ebc0a7b implements so-called GiST microvacuum.  That is gistgettuple() marks  
index tuples as dead when kill_prior_tuple is set.  Later, when new tuple  
insertion claims page space, those dead index tuples are physically deleted  
from page.  When this deletion is replayed on standby, it might conflict with  
read-only queries.  But 013ebc0a7b doesn't handle this.  That may lead to  
disappearance of some tuples from read-only snapshots on standby.  
  
This commit implements resolving of conflicts between replay of GiST microvacuum  
and standby queries.  On the master we implement new WAL record type  
XLOG_GIST_DELETE, which comprises necessary information.  On stable releases  
we've to be tricky to keep WAL compatibility.  Information required for conflict  
processing is just appended to data of XLOG_GIST_PAGE_UPDATE record.  So,  
PostgreSQL version, which doesn't know about conflict processing, will just  
ignore that.  
  
Reported-by: Andres Freund  
Diagnosed-by: Andres Freund  
Discussion: https://postgr.es/m/20181212224524.scafnlyjindmrbe6%40alap3.anarazel.de  
Author: Alexander Korotkov  
Backpatch-through: 9.6  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/include/access/gist_private.h
M src/include/access/gistxlog.h

Base information_schema.sql_identifier domain on name, not varchar.

commit   : 7c15cef86d37924505b3bb49b5e1ad1740b1d8f7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Dec 2018 16:21:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Dec 2018 16:21:51 -0500    

Click here for diff

The SQL spec says that sql_identifier is a domain over varchar,  
but it also says that that domain is supposed to represent the set  
of valid identifiers for the implementation, in particular applying  
a length limit matching the implementation's identifier length limit.  
We were declaring sql_identifier as just "character varying", thus  
duplicating what the spec says about base type, but entirely failing  
at the rest of it.  
  
Instead, let's declare sql_identifier as a domain over type "name".  
(We can drop the COLLATE "C" added by commit 6b0faf723, since that's  
now implicit in "name".)  With the recent improvements to name's  
comparison support, there's not a lot of functional difference between  
name and varchar.  So although in principle this is a spec deviation,  
it's a pretty minor one.  And correctly enforcing PG's name length limit  
is a good thing; on balance this seems closer to the intent of the spec  
than what we had.  
  
But that's all just language-lawyering.  The *real* reason to do this is  
that it makes sql_identifier columns exposed by information_schema views  
be just direct representations of the underlying "name" catalog columns,  
eliminating a semantic mismatch that was disastrous for performance of  
typical queries on the information_schema.  In combination with the  
recent change to allow dropping no-op CoerceToDomain nodes, this allows  
(for example) queries such as  
  
    select ... from information_schema.tables where table_name = 'foo';  
  
to produce an indexscan rather than a seqscan on pg_class.  
  
Discussion: https://postgr.es/m/CAFj8pRBUCX4LZ2rA2BbEkdD6NN59mgx+BLo1gO08Wod4RLtcTg@mail.gmail.com  

M src/backend/catalog/information_schema.sql
M src/include/catalog/catversion.h

Avoid producing over-length specific_name outputs in information_schema.

commit   : 5bbee34d9f2e6097247ace3ebe1dde1f6aa80287    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Dec 2018 15:58:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Dec 2018 15:58:58 -0500    

Click here for diff

information_schema output columns that are declared as being type  
sql_identifier are supposed to conform to the implementation's rules  
for valid identifiers, in particular the identifier length limit.  
Several places potentially violated this limit by concatenating a  
function's name and OID.  (The OID is added to ensure name uniqueness  
within a schema, since the spec doesn't expect function name overloading.)  
  
Simply truncating the concatenation result to fit in "name" won't do,  
since losing part of the OID might wind up giving non-unique results.  
Instead, let's truncate the function name as necessary.  
  
The most practical way to do that is to do it in a C function; the  
information_schema.sql script doesn't have easy access to the value  
of NAMEDATALEN, nor does it have an easy way to truncate on the basis  
of resulting byte-length rather than number of characters.  
  
(There are still a couple of places that cast concatenation results to  
sql_identifier, but as far as I can see they are guaranteed not to produce  
over-length strings, at least with the normal value of NAMEDATALEN.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/information_schema.sql
M src/backend/utils/adt/name.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Fix lock level used for partition when detaching it

commit   : 7b14bcc06cc56b110118fba408f4b9b72a663387    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 20 Dec 2018 16:42:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 20 Dec 2018 16:42:13 -0300    

Click here for diff

For probably bogus reasons, we acquire only AccessShareLock on the  
partition when we try to detach it from its parent partitioned table.  
This can cause ugly things to happen if another transaction is doing  
any sort of DDL to the partition concurrently.  
  
Upgrade that lock to ShareUpdateExclusiveLock, which per discussion  
seems to be the minimum needed.  
  
Reported by Robert Haas.  
  
Discussion: https://postgr.es/m/CA+TgmoYruJQ+2qnFLtF1xQtr71pdwgfxy3Ziy-TxV28M6pEmyA@mail.gmail.com  

M src/backend/commands/tablecmds.c

Doc: fix ancient mistake in search_path documentation.

commit   : 42bdf853f664d0566c9e7af027635b48d66c0f71    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Dec 2018 13:55:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Dec 2018 13:55:11 -0500    

Click here for diff

"$user" in a search_path string is replaced by CURRENT_USER not  
SESSION_USER.  (It actually was SESSION_USER in the initial implementation,  
but we changed it shortly later, and evidently forgot to fix the docs to  
match.)  
  
Noted by [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Make bitmapset.c use 64-bit bitmap words on 64-bit machines.

commit   : 216af5eea5c8fdc9fca9d44da9eec33ac5e002d2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Dec 2018 12:19:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Dec 2018 12:19:07 -0500    

Click here for diff

Using the full width of the CPU's native word size shouldn't cost  
anything in typical cases.  When working with large bitmapsets,  
this halves the number of operations needed for many common BMS  
operations.  On the right sort of test case, a measurable improvement  
is obtained.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CAKJS1f9EGBd2h-VkXvb=51tf+X46zMX5T8h-KYgXEV_u2zmLUw@mail.gmail.com  

M src/include/nodes/bitmapset.h

DETACH PARTITION: hold locks on indexes until end of transaction

commit   : 0c2377152f2b68d46a27d5821a2327b6ca441fca    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 20 Dec 2018 10:58:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 20 Dec 2018 10:58:22 -0300    

Click here for diff

When a partition is detached from its parent, we acquire locks on all  
attached indexes to also detach them ... but we release those locks  
immediately.  This is a violation of the policy of keeping locks on user  
objects to the end of the transaction.  Bug introduced in 8b08f7d4820f.  
  
It's unclear that there are any ill effects possible, but it's clearly  
wrong nonetheless.  It's likely that bad behavior *is* possible, but  
mostly because the relation that the index is for is only locked with  
AccessShareLock, which is an older bug that shall be fixed separately.  
  
While touching that line of code, close the index opened with  
index_open() using index_close() instead of relation_close().  
No difference in practice, but let's be consistent.  
  
Unearthed by Robert Haas.  
  
Discussion: https://postgr.es/m/CA+TgmoYruJQ+2qnFLtF1xQtr71pdwgfxy3Ziy-TxV28M6pEmyA@mail.gmail.com  

M src/backend/commands/tablecmds.c

Add more tab completion for CREATE TABLE in psql

commit   : 4cba9c2a33f145f76575454b0f32a0e32dcd4335    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 20 Dec 2018 14:24:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 20 Dec 2018 14:24:42 +0900    

Click here for diff

The following completion patterns are added:  
- CREATE TABLE <name> with '(', OF or PARTITION OF.  
- CREATE TABLE <name> OF with list of composite types.  
- CREATE TABLE name (...) with PARTITION OF, WITH, TABLESPACE, ON  
COMMIT (depending on the presence of a temporary table).  
- CREATE TABLE ON COMMIT with actions (only for temporary tables).  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

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

Fix ADD IF NOT EXISTS used in conjunction with ALTER TABLE ONLY

commit   : 1075dfdaf33ad8b2a61c26b5748735005e6192b9    
  
author   : Greg Stark <[email protected]>    
date     : Wed, 19 Dec 2018 18:28:35 -0500    
  
committer: Greg Stark <[email protected]>    
date     : Wed, 19 Dec 2018 18:28:35 -0500    

Click here for diff

The flag for IF NOT EXISTS was only being passed down in the normal  
recursing case. It's been this way since originally added in 9.6 in  
commit 2cd40adb85 so backpatch back to 9.6.  

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

Add text-vs-name cross-type operators, and unify name_ops with text_ops.

commit   : 2ece7c07dc9a14667c64f107686573590b7e45c3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Dec 2018 17:46:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Dec 2018 17:46:07 -0500    

Click here for diff

Now that name comparison has effectively the same behavior as text  
comparison, we might as well merge the name_ops opfamily into text_ops,  
allowing cross-type comparisons to be processed without forcing a  
datatype coercion first.  We need do little more than add cross-type  
operators to make the opfamily complete, and fix one or two places  
in the planner that assumed text_ops was a single-datatype opfamily.  
  
I chose to unify hash name_ops into hash text_ops as well, since the  
types have compatible hashing semantics.  This allows marking the  
new cross-type equality operators as oprcanhash.  
  
(Note: this doesn't remove the name_ops opclasses, so there's no  
breakage of index definitions.  Those opclasses are just reparented  
into the text_ops opfamily.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/indxpath.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/varlena.c
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_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/test/regress/expected/opr_sanity.out
M src/test/regress/expected/regex.out
M src/test/regress/expected/select_views.out

Make type "name" collation-aware.

commit   : 586b98fdf1aaef4a27744f8b988479aad4bd9a01    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Dec 2018 17:35:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Dec 2018 17:35:12 -0500    

Click here for diff

The "name" comparison operators now all support collations, making them  
functionally equivalent to "text" comparisons, except for the different  
physical representation of the datatype.  They do, in fact, mostly share  
the varstr_cmp and varstr_sortsupport infrastructure, which has been  
slightly enlarged to handle the case.  
  
To avoid changes in the default behavior of the datatype, set name's  
typcollation to C_COLLATION_OID not DEFAULT_COLLATION_OID, so that  
by default comparisons to a name value will continue to use strcmp  
semantics.  (This would have been the case for system catalog columns  
anyway, because of commit 6b0faf723, but doing this makes it true for  
user-created name columns as well.  In particular, this avoids  
locale-dependent changes in our regression test results.)  
  
In consequence, tweak a couple of places that made assumptions about  
collatable base types always having typcollation DEFAULT_COLLATION_OID.  
I have not, however, attempted to relax the restriction that user-  
defined collatable types must have that.  Hence, "name" doesn't  
behave quite like a user-defined type; it acts more like a domain  
with COLLATE "C".  (Conceivably, if we ever get rid of the need for  
catalog name columns to be fixed-length, "name" could actually become  
such a domain over text.  But that'd be a pretty massive undertaking,  
and I'm not volunteering.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/access/nbtree/nbtcompare.c
M src/backend/bootstrap/bootstrap.c
M src/backend/commands/explain.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/indxpath.c
M src/backend/parser/parse_clause.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/utils/varlena.h
M src/pl/plpgsql/src/pl_comp.c

Remove function names from error messages

commit   : 68f6f2b7395fe3e403034bcd97a1fcfbcc68ae10    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 19 Dec 2018 14:51:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 19 Dec 2018 14:51:13 -0300    

Click here for diff

They are not necessary, and having them there gives useless work for  
translators.  

M src/backend/access/transam/xlogfuncs.c
M src/backend/commands/extension.c

Small improvements for allocation logic in ginHeapTupleFastCollect().

commit   : c6e394c1a2ae641724d285ce0b043b753406dbbd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Dec 2018 11:41:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Dec 2018 11:41:36 -0500    

Click here for diff

Avoid repetitive calls to repalloc() when the required size of the  
collector array grows more than 2x in one call.  Also ensure that the  
array size is a power of 2 (since palloc will probably consume a power  
of 2 anyway) and doesn't start out very small (which'd likely just lead  
to extra repallocs).  
  
David Rowley, tweaked a bit by me  
  
Discussion: https://postgr.es/m/CAKJS1f8vn-iSBE8PKeVHrnhvyjRNYCxguPFFY08QLYmjWG9hPQ@mail.gmail.com  

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

Doc: fix incorrect example of collecting arguments with fmgr macros.

commit   : 639924249c8a5e1929a0c74ab4ae15d18683e7fa    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Dec 2018 11:02:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Dec 2018 11:02:07 -0500    

Click here for diff

Thinko in commit f66912b0a.  Back-patch to v10, as that was.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/spi.sgml

Remove obsolete nbtree duplicate entries comment.

commit   : 61a4480a68ea44d0991d983a985ae2b2cd88cd61    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 18 Dec 2018 21:40:38 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 18 Dec 2018 21:40:38 -0800    

Click here for diff

Remove a comment from the Berkeley days claiming that nbtree must  
disambiguate duplicate keys within _bt_moveright().  There is no special  
care taken around duplicates within _bt_moveright(), at least since  
commit 9e85183bfc3 removed inscrutable _bt_moveright() code to handle  
pages full of duplicates.  

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

Correct obsolete nbtree recovery comments.

commit   : 60f3cc9553c7ea7a1cc61bcd1efe51537f31e531    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 18 Dec 2018 16:59:50 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 18 Dec 2018 16:59:50 -0800    

Click here for diff

Commit 40dae7ec537, which made the handling of interrupted nbtree page  
splits more robust, removed an nbtree-specific end-of-recovery cleanup  
step.  This meant that it was no longer possible to complete an  
interrupted page split during recovery.  However, a reference to  
recovery as a reason for using a NULL stack while inserting into a  
parent page was missed.  Remove the reference.  
  
Remove a similar obsolete reference to recovery that was introduced much  
more recently, as part of the btree fastpath optimization enhancement  
that made it into Postgres 11 (commit 2b272734, and follow-up commits).  
  
Backpatch: 11-, where the fastpath optimization was introduced.  

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

Doc: fix typo in "Generic File Access Functions" section.

commit   : 3cab54878dbf212c08699bb974b069bdc43bff61    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 19 Dec 2018 09:32:03 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 19 Dec 2018 09:32:03 +0900    

Click here for diff

Issue reported by me and fix by Tom Lane.  
Discussion: https://postgr.es/m/20181219.080458.1434575730369741406.t-ishii%40sraoss.co.jp  

M doc/src/sgml/func.sgml

Make collation-aware system catalog columns use "C" collation.

commit   : 6b0faf723647a851eaaddfed11e14861f8d0f588    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Dec 2018 12:48:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Dec 2018 12:48:15 -0500    

Click here for diff

Up to now we allowed text columns in system catalogs to use collation  
"default", but that isn't really safe because it might mean something  
different in template0 than it means in a database cloned from template0.  
In particular, this could mean that cloned pg_statistic entries for such  
columns weren't entirely valid, possibly leading to bogus planner  
estimates, though (probably) not any outright failures.  
  
In the wake of commit 5e0928005, a better solution is available: if we  
label such columns with "C" collation, then their pg_statistic entries  
will also use that collation and hence will be valid independently of  
the database collation.  
  
This also provides a cleaner solution for indexes on such columns than  
the hack added by commit 0b28ea79c: the indexes will naturally inherit  
"C" collation and don't have to be forced to use text_pattern_ops.  
  
Also, with the planned improvement of type "name" to be collation-aware,  
this policy will apply cleanly to both text and name columns.  
  
Because of the pg_statistic angle, we should also apply this policy  
to the tables in information_schema.  This patch does that by adjusting  
information_schema's textual domain types to specify "C" collation.  
That has the user-visible effect that order-sensitive comparisons to  
textual information_schema view columns will now use "C" collation  
by default.  The SQL standard says that the collation of those view  
columns is implementation-defined, so I think this is legal per spec.  
At some point this might allow for translation of such comparisons  
into indexable conditions on the underlying "name" columns, although  
additional work will be needed before that can happen.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/scankey.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/information_schema.sql
M src/backend/utils/cache/catcache.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Update sepgsql regression test results for commit ca4103025.

commit   : b2d9e17768864030fb0829b55303b8b72bfd809f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Dec 2018 11:40:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Dec 2018 11:40:10 -0500    

Click here for diff

Per buildfarm.  

M contrib/sepgsql/expected/alter.out

Fix ancient thinko in mergejoin cost estimation.

commit   : d364e88155ac895710c28efb0330b0c9594300eb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Dec 2018 11:19:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Dec 2018 11:19:38 -0500    

Click here for diff

"rescanratio" was computed as 1 + rescanned-tuples / total-inner-tuples,  
which is sensible if it's to be multiplied by total-inner-tuples or a cost  
value corresponding to scanning all the inner tuples.  But in reality it  
was (mostly) multiplied by inner_rows or a related cost, numbers that take  
into account the possibility of stopping short of scanning the whole inner  
relation thanks to a limited key range in the outer relation.  This'd  
still make sense if we could expect that stopping short would result in a  
proportional decrease in the number of tuples that have to be rescanned.  
It does not, however.  The argument that establishes the validity of our  
estimate for that number is independent of whether we scan all of the inner  
relation or stop short, and experimentation also shows that stopping short  
doesn't reduce the number of rescanned tuples.  So the correct calculation  
is 1 + rescanned-tuples / inner_rows, and we should be sure to multiply  
that by inner_rows or a corresponding cost value.  
  
Most of the time this doesn't make much difference, but if we have  
both a high rescan rate (due to lots of duplicate values) and an outer  
key range much smaller than the inner key range, then the error can  
be significant, leading to a large underestimate of the cost associated  
with rescanning.  
  
Per report from Vijaykumar Jain.  This thinko appears to go all the way  
back to the introduction of the rescan estimation logic in commit  
70fba7043, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAE7uO5hMb_TZYJcZmLAgO6iD68AkEK6qCe7i=vZUkCpoKns+EQ@mail.gmail.com  

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

Include partitioned indexes to system view pg_indexes

commit   : f94cec64476f2752e91b10d7928a2fcd105e9fc3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Dec 2018 16:37:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Dec 2018 16:37:51 +0900    

Click here for diff

pg_tables already includes partitioned tables, so for consistency  
pg_indexes should show partitioned indexes.  
  
Author: Suraj Kharage  
Reviewed-by: Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/CAF1DzPVrYo4XNTEnc=PqVp6aLJc7LFYpYR4rX=_5pV=wJ2KdZg@mail.gmail.com  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/indexing.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/indexing.sql

Tweak description comments in tests for partition functions

commit   : 3e514c1238312c56b73d956d844c67a034dead02    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Dec 2018 10:52:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Dec 2018 10:52:21 +0900    

Click here for diff

The new wording is more generic and fixes one grammar mistake and one  
typo on the way.  
  
Per discussion between Amit Langote and me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : ed6f15eb35a95bc40ad6b05e99cbf495e034249b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Dec 2018 10:02:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Dec 2018 10:02:23 +0900    

Click here for diff

The project has moved to a new place.  
  
Reported-by: Peter Neave  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/maintenance.sgml

Include ALTER INDEX SET STATISTICS in pg_dump

commit   : e4fca461ab6f08d5cc0c93942017d2fbf49000af    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Dec 2018 09:28:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Dec 2018 09:28:16 +0900    

Click here for diff

The new grammar pattern of ALTER INDEX SET STATISTICS able to use column  
numbers on top of the existing column names introduced by commit 5b6d13e  
forgot to add support for the feature in pg_dump, so defining statistics  
on index columns was missing from the dumps, potentially causing silent  
planning problems with a subsequent restore.  
  
pg_dump ought to not use column names in what it generates as these are  
automatically generated by the server and could conflict with real  
relation attributes with matching patterns.  "expr" and "exprN", N  
incremented automatically after the creation of the first one, are used  
as default attribute names for index expressions, and that could easily  
match what is defined in other relations, causing the dumps to fail if  
some of those attributes are renamed at some point.  So to avoid any  
problems, the new grammar with column numbers gets used.  
  
Reported-by: Ronan Dunklau  
Author: Michael Paquier  
Reviewed-by: Tom Lane, Adrien Nayrat, Amul Sul  
Discussion: https://postgr.es/m/CAARsnT3UQ4V=yDNW468w8RqHfYiY9mpn2r_c5UkBJ97NAApUEw@mail.gmail.com  
Backpatch-through: 11, where the new syntax has been introduced.  

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

Drop support for getting signal descriptions from sys_siglist[].

commit   : cc92cca43162c4635e6ab5e7c61f7f8728d56d9a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Dec 2018 13:50:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Dec 2018 13:50:07 -0500    

Click here for diff

It appears that all platforms that have sys_siglist[] also have  
strsignal(), making that fallback case in pg_strsignal() dead code.  
Getting rid of it allows dropping a configure test, which seems worth  
more than providing textual signal descriptions on whatever platforms  
might still hypothetically have use for the fallback case.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/port/pgstrsignal.c

Fix tablespace handling for partitioned tables

commit   : ca4103025dfe26eaaf6a500dec9170fbb176eebc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 17 Dec 2018 15:37:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 17 Dec 2018 15:37:40 -0300    

Click here for diff

When partitioned tables were introduced, we failed to realize that by  
copying the tablespace handling for other relation kinds with no  
physical storage we were causing the secondary effect that their  
partitions would not automatically inherit the tablespace setting.  This  
is surprising and unhelpful, so change it to adopt the behavior  
introduced in pg11 (commit 33e6c34c3267) for partitioned indexes: the  
parent relation remembers the tablespace specification, which is then  
used for any new partitions that don't declare one.  
  
Because this commit changes behavior of the TABLESPACE clause for  
partitioned tables (it's no longer a no-op), it is not backpatched.  
  
Author: David Rowley, Álvaro Herrera  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAKJS1f9SxVzqDrGD1teosFd6jBMM0UEaa14_8mRvcWE19Tu0hA@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/include/catalog/pg_class.h
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Clarify runtime pruning in EXPLAIN

commit   : 1e6240a3fe919e19676875927681a861e13f93c2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 17 Dec 2018 11:44:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 17 Dec 2018 11:44:36 -0300    

Click here for diff

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

M doc/src/sgml/ddl.sgml

Remove extra semicolons.

commit   : 3abb11e55b0a8408cd91fe341cda1f568774df58    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 17 Dec 2018 14:07:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 17 Dec 2018 14:07:27 +0530    

Click here for diff

Reported-by: David Rowley  
Author: David Rowley  
Reviewed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAKJS1f8EneeYyzzvdjahVZ6gbAHFkHbSFB5m_C0Y6TUJs9Dgdg@mail.gmail.com  

M src/backend/commands/trigger.c
M src/backend/executor/execTuples.c
M src/backend/optimizer/prep/prepunion.c

Fix use-after-free bug when renaming constraints

commit   : 67915fb8e51692ae92622696ad03e933be224bf2    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Dec 2018 12:43:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Dec 2018 12:43:00 +0900    

Click here for diff

This is an oversight from recent commit b13fd344.  While on it, tweak  
the previous test with a better name for the renamed primary key.  
  
Detected by buildfarm member prion which forces relation cache release  
with -DRELCACHE_FORCE_RELEASE.  Back-patch down to 9.4 as the previous  
commit.  

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

Make constraint rename issue relcache invalidation on target relation

commit   : b13fd344c5fce6a2f95b758e97b79eb00adf2731    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Dec 2018 10:34:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Dec 2018 10:34:44 +0900    

Click here for diff

When a constraint gets renamed, it may have associated with it a target  
relation (for example domain constraints don't have one).  Not  
invalidating the target relation cache when issuing the renaming can  
result in issues with subsequent commands that refer to the old  
constraint name using the relation cache, causing various failures.  One  
pattern spotted was using CREATE TABLE LIKE after a constraint  
renaming.  
  
Reported-by: Stuart <[email protected]>  
Author: Amit Langote  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Modernize our code for looking up descriptive strings for Unix signals.

commit   : a73d08319537d807a520a72bc5bd17279672c3de    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Dec 2018 19:38:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Dec 2018 19:38:57 -0500    

Click here for diff

At least as far back as the 2008 spec, POSIX has defined strsignal(3)  
for looking up descriptive strings for signal numbers.  We hadn't gotten  
the word though, and were still using the crufty old sys_siglist array,  
which is in no standard even though most Unixen provide it.  
  
Aside from not being formally standards-compliant, this was just plain  
ugly because it involved #ifdef's at every place using the code.  
  
To eliminate the #ifdef's, create a portability function pg_strsignal,  
which wraps strsignal(3) if available and otherwise falls back to  
sys_siglist[] if available.  The set of Unixen with neither API is  
probably empty these days, but on any platform with neither, you'll  
just get "unrecognized signal".  All extant callers print the numeric  
signal number too, so no need to work harder than that.  
  
Along the way, upgrade pg_basebackup's child-error-exit reporting  
to match the rest of the system.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/common/wait_error.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
M src/port/Makefile
A src/port/pgstrsignal.c
M src/test/regress/pg_regress.c

Make error handling in parallel pg_upgrade less bogus.

commit   : 16fda4b853cd5bc07c450303a465ed9d451c7b47    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Dec 2018 14:51:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Dec 2018 14:51:47 -0500    

Click here for diff

reap_child() basically ignored the possibility of either an error in  
waitpid() itself or a child process failure on signal.  We don't really  
need to do more than report and crash hard, but proceeding as though  
nothing is wrong is definitely Not Acceptable.  The error report for  
nonzero child exit status was pretty off-point, as well.  
  
Noted while fooling around with child-process failure detection  
logic elsewhere.  It's been like this a long time, so back-patch to  
all supported branches.  

M src/bin/pg_upgrade/parallel.c

Improve detection of child-process SIGPIPE failures.

commit   : ade2d61ed09c11a3d374a98c66c8a05cb82a0069    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Dec 2018 14:32:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Dec 2018 14:32:14 -0500    

Click here for diff

Commit ffa4cbd62 added logic to detect SIGPIPE failure of a COPY child  
process, but it only worked correctly if the SIGPIPE occurred in the  
immediate child process.  Depending on the shell in use and the  
complexity of the shell command string, we might instead get back  
an exit code of 128 + SIGPIPE, representing a shell error exit  
reporting SIGPIPE in the child process.  
  
We could just hack up ClosePipeToProgram() to add the extra case,  
but it seems like this is a fairly general issue deserving a more  
general and better-documented solution.  I chose to add a couple  
of functions in src/common/wait_error.c, which is a natural place  
to know about wait-result encodings, that will test for either a  
specific child-process signal type or any child-process signal failure.  
Then, adjust other places that were doing ad-hoc tests of this type  
to use the common functions.  
  
In RestoreArchivedFile, this fixes a race condition affecting whether  
the process will report an error or just silently proc_exit(1): before,  
that depended on whether the intermediate shell got SIGTERM'd itself  
or reported a child process failing on SIGTERM.  
  
Like the previous patch, back-patch to v10; we could go further  
but there seems no real need to.  
  
Per report from Erik Rijkers.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogarchive.c
M src/backend/commands/copy.c
M src/backend/postmaster/pgarch.c
M src/common/wait_error.c
M src/include/port.h

commit   : 5e09280057a4c3f5db297348ea3e044c9c5f4ef8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Dec 2018 12:52:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Dec 2018 12:52:49 -0500    

Click here for diff

When we first put in collations support, we basically punted on teaching  
pg_statistic, ANALYZE, and the planner selectivity functions about that.  
They've just used DEFAULT_COLLATION_OID independently of the actual  
collation of the data.  It's time to improve that, so:  
  
* Add columns to pg_statistic that record the specific collation associated  
with each statistics slot.  
  
* Teach ANALYZE to use the column's actual collation when comparing values  
for statistical purposes, and record this in the appropriate slot.  (Note  
that type-specific typanalyze functions are now expected to fill  
stats->stacoll with the appropriate collation, too.)  
  
* Teach assorted selectivity functions to use the actual collation of  
the stats they are looking at, instead of just assuming it's  
DEFAULT_COLLATION_OID.  
  
This should give noticeably better results in selectivity estimates for  
columns with nondefault collations, at least for query clauses that use  
that same collation (which would be the default behavior in most cases).  
It's still true that comparisons with explicit COLLATE clauses different  
from the stored data's collation won't be well-estimated, but that's no  
worse than before.  Also, this patch does make the first step towards  
doing better with that, which is that it's now theoretically possible to  
collect stats for a collation other than the column's own collation.  
  
Patch by me; thanks to Peter Eisentraut for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/commands/analyze.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mvdistinct.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/typcache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_statistic.h
M src/include/commands/vacuum.h
M src/include/statistics/extended_stats_internal.h
M src/include/utils/lsyscache.h
M src/include/utils/typcache.h

Introduce new extended routines for FDW and foreign server lookups

commit   : 8fb569e978af3995f0dd6b0033758ec571aab0c1    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Dec 2018 08:59:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Dec 2018 08:59:35 +0900    

Click here for diff

The cache lookup routines for foreign-data wrappers and foreign servers  
are extended with an extra argument to handle a set of flags.  The only  
value which can be used now is to indicate if a missing object should  
result in an error or not, and are designed to be extensible on need.  
Those new routines are added into the existing set of user-visible  
FDW APIs and documented in consequence.  They will be used for future  
patches to improve the SQL interface for object addresses.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/CAB7nPqSZxrSmdHK-rny7z8mi=EAFXJ5J-0RbzDw6aus=wB5azQ@mail.gmail.com  

M doc/src/sgml/fdwhandler.sgml
M src/backend/foreign/foreign.c
M src/include/foreign/foreign.h

Create a separate oid range for oids assigned by genbki.pl.

commit   : 09568ec3d31bbd4854b857e8d23c197ad5b25c77    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Dec 2018 14:50:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Dec 2018 14:50:57 -0800    

Click here for diff

The changes I made in 578b229718e assigned oids below  
FirstBootstrapObjectId to objects in include/catalog/*.dat files that  
did not have an oid assigned, starting at the max oid explicitly  
assigned.  Tom criticized that for mainly two reasons:  
1) It's not clear which values are manually and which explicitly  
   assigned.  
2) The space below FirstBootstrapObjectId gets pretty crowded, and  
   some PostgreSQL forks have used oids >= 9000 for their own objects,  
   to avoid conflicting.  
  
Thus create a new range for objects not assigned explicit oids, but  
assigned by genbki.pl. For now 1-9999 is for explicitly assigned oids,  
FirstGenbkiObjectId (10000) to FirstBootstrapObjectId (1200) -1 is for  
genbki.pl assigned oids, and < FirstNormalObjectId (16384) is for oids  
assigned during bootstrap.  It's possible that we'll have to adjust  
these boundaries, but there's some headroom for now.  
  
Add a note suggesting that oids in forks should be assigned in the  
9000-9999 range.  
  
Catversion bump for obvious reasons.  
  
Per complaint from Tom Lane.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/shippable.c
M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/fmgr/fmgr.c
M src/include/access/transam.h
M src/include/catalog/unused_oids
M src/include/utils/fmgrtab.h
M src/tools/msvc/Solution.pm

Fix bogus logic for skipping unnecessary partcollation dependencies.

commit   : 84d514887f9ca673ae688d00f8b544e70f1ab270    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Dec 2018 15:11:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Dec 2018 15:11:09 -0500    

Click here for diff

The idea here is to not call recordDependencyOn for the default collation,  
since we know that's pinned.  But what the code actually did was to record  
the partition key's dependency on the opclass twice, instead.  
  
Evidently introduced by sloppy coding in commit 2186b608b.  Back-patch  
to v10 where that came in.  

M src/backend/catalog/heap.c

Drop no-op CoerceToDomain nodes from expressions at planning time.

commit   : 04fe805a1734eccd8dcdd34c8cc0ddcb62c7240c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Dec 2018 13:24:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Dec 2018 13:24:43 -0500    

Click here for diff

If a domain has no constraints, then CoerceToDomain doesn't really do  
anything and can be simplified to a RelabelType.  This not only  
eliminates cycles at execution, but allows the planner to optimize better  
(for instance, match the coerced expression to an index on the underlying  
column).  However, we do have to support invalidating the plan later if  
a constraint gets added to the domain.  That's comparable to the case of  
a change to a SQL function that had been inlined into a plan, so all the  
necessary logic already exists for plans depending on functions.  We  
need only duplicate or share that logic for domains.  
  
ALTER DOMAIN ADD/DROP CONSTRAINT need to be taught to send out sinval  
messages for the domain's pg_type entry, since those operations don't  
update that row.  (ALTER DOMAIN SET/DROP NOT NULL do update that row,  
so no code change is needed for them.)  
  
Testing this revealed what's really a pre-existing bug in plpgsql:  
it caches the SQL-expression-tree expansion of type coercions and  
had no provision for invalidating entries in that cache.  Up to now  
that was only a problem if such an expression had inlined a SQL  
function that got changed, which is unlikely though not impossible.  
But failing to track changes of domain constraints breaks an existing  
regression test case and would likely cause practical problems too.  
  
We could fix that locally in plpgsql, but what seems like a better  
idea is to build some generic infrastructure in plancache.c to store  
standalone expressions and track invalidation events for them.  
(It's tempting to wonder whether plpgsql's "simple expression" stuff  
could use this code with lower overhead than its current use of the  
heavyweight plancache APIs.  But I've left that idea for later.)  
  
Other stuff fixed in passing:  
  
* Allow estimate_expression_value() to drop CoerceToDomain  
unconditionally, effectively assuming that the coercion will succeed.  
This will improve planner selectivity estimates for cases involving  
estimatable expressions that are coerced to domains.  We could have  
done this independently of everything else here, but there wasn't  
previously any need for eval_const_expressions_mutator to know about  
CoerceToDomain at all.  
  
* Use a dlist for plancache.c's list of cached plans, rather than a  
manually threaded singly-linked list.  That eliminates a potential  
performance problem in DropCachedPlan.  
  
* Fix a couple of inconsistencies in typecmds.c about whether  
operations on domains drop RowExclusiveLock on pg_type.  Our common  
practice is that DDL operations do drop catalog locks, so standardize  
on that choice.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/typecmds.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/typcache.c
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/utils/plancache.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Prevent GIN deleted pages from being reclaimed too early

commit   : 52ac6cd2d0cd70e01291e0ac4ee6d068b69bc478    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 13 Dec 2018 06:12:31 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 13 Dec 2018 06:12:31 +0300    

Click here for diff

When GIN vacuum deletes a posting tree page, it assumes that no concurrent  
searchers can access it, thanks to ginStepRight() locking two pages at once.  
However, since 9.4 searches can skip parts of posting trees descending from the  
root.  That leads to the risk that page is deleted and reclaimed before  
concurrent search can access it.  
  
This commit prevents the risk of above by waiting for every transaction, which  
might wait to reference this page, to finish.  Due to binary compatibility  
we can't change GinPageOpaqueData to store corresponding transaction id.  
Instead we reuse page header pd_prune_xid field, which is unused in index pages.  
  
Discussion: https://postgr.es/m/31a702a.14dd.166c1366ac1.Coremail.chjischj%40163.com  
Author: Andrey Borodin, Alexander Korotkov  
Reviewed-by: Alexander Korotkov  
Backpatch-through: 9.4  

M src/backend/access/gin/README
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/include/access/ginblock.h
M src/include/access/ginxlog.h

Prevent deadlock in ginRedoDeletePage()

commit   : c6ade7a8cd3135af0c5d29abf39a6a83b9f6a66a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 13 Dec 2018 06:12:25 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 13 Dec 2018 06:12:25 +0300    

Click here for diff

On standby ginRedoDeletePage() can work concurrently with read-only queries.  
Those queries can traverse posting tree in two ways.  
1) Using rightlinks by ginStepRight(), which locks the next page before  
   unlocking its left sibling.  
2) Using downlinks by ginFindLeafPage(), which locks at most one page at time.  
  
Original lock order was: page, parent, left sibling.  That lock order can  
deadlock with ginStepRight().  In order to prevent deadlock this commit changes  
lock order to: left sibling, page, parent.  Note, that position of parent in  
locking order seems insignificant, because we only lock one page at time while  
traversing downlinks.  
  
Reported-by: Chen Huajun  
Diagnosed-by: Chen Huajun, Peter Geoghegan, Andrey Borodin  
Discussion: https://postgr.es/m/31a702a.14dd.166c1366ac1.Coremail.chjischj%40163.com  
Author: Alexander Korotkov  
Backpatch-through: 9.4  

M src/backend/access/gin/ginxlog.c

Fix deadlock in GIN vacuum introduced by 218f51584d5

commit   : fd83c83d0943a6717dbe521efa10da9dce94e4cd    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 13 Dec 2018 06:12:11 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 13 Dec 2018 06:12:11 +0300    

Click here for diff

Before 218f51584d5 if posting tree page is about to be deleted, then the whole  
posting tree is locked by LockBufferForCleanup() on root preventing all the  
concurrent inserts.  218f51584d5 reduced locking to the subtree containing  
page to be deleted.  However, due to concurrent parent split, inserter doesn't  
always holds pins on all the pages constituting path from root to the target  
leaf page.  That could cause a deadlock between GIN vacuum process and GIN  
inserter.  And we didn't find non-invasive way to fix this.  
  
This commit reverts VACUUM behavior to lock the whole posting tree before  
delete any page.  However, we keep another useful change by 218f51584d5: the  
tree is locked only if there are pages to be deleted.  
  
Reported-by: Chen Huajun  
Diagnosed-by: Chen Huajun, Andrey Borodin, Peter Geoghegan  
Discussion: https://postgr.es/m/31a702a.14dd.166c1366ac1.Coremail.chjischj%40163.com  
Author: Alexander Korotkov, based on ideas from Andrey Borodin and Peter Geoghegan  
Reviewed-by: Andrey Borodin  
Backpatch-through: 10  

M src/backend/access/gin/README
M src/backend/access/gin/ginvacuum.c

Repair bogus EPQ plans generated for postgres_fdw foreign joins.

commit   : 77d4d88afbaa37773d15578d89881fa175ec38e8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Dec 2018 16:08:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Dec 2018 16:08:30 -0500    

Click here for diff

postgres_fdw's postgresGetForeignPlan() assumes without checking that the  
outer_plan it's given for a join relation must have a NestLoop, MergeJoin,  
or HashJoin node at the top.  That's been wrong at least since commit  
4bbf6edfb (which could cause insertion of a Sort node on top) and it seems  
like a pretty unsafe thing to Just Assume even without that.  
  
Through blind good fortune, this doesn't seem to have any worse  
consequences today than strange EXPLAIN output, but it's clearly trouble  
waiting to happen.  
  
To fix, test the node type explicitly before touching Join-specific  
fields, and avoid jamming the new tlist into a node type that can't  
do projection.  Export a new support function from createplan.c  
to avoid building low-level knowledge about the latter into FDWs.  
  
Back-patch to 9.6 where the faulty coding was added.  Note that the  
associated regression test cases don't show any changes before v11,  
apparently because the tests back-patched with 4bbf6edfb don't actually  
exercise the problem case before then (there's no top-level Sort  
in those plans).  
  
Discussion: https://postgr.es/m/[email protected]  

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

Repair bogus handling of multi-assignment Params in upper plan levels.

commit   : 0f7ec8d9c3aeb8964d3539561e5c8d4caef42bf6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Dec 2018 13:49:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Dec 2018 13:49:41 -0500    

Click here for diff

Our support for multiple-set-clauses in UPDATE assumes that the Params  
referencing a MULTIEXPR_SUBLINK SubPlan will appear before that SubPlan  
in the targetlist of the plan node that calculates the updated row.  
(Yeah, it's a hack...)  In some PG branches it's possible that a Result  
node gets inserted between the primary calculation of the update tlist  
and the ModifyTable node.  setrefs.c did the wrong thing in this case  
and left the upper-level Params as Params, causing a crash at runtime.  
What it should do is replace them with "outer" Vars referencing the child  
plan node's output.  That's a result of careless ordering of operations  
in fix_upper_expr_mutator, so we can fix it just by reordering the code.  
  
Fix fix_join_expr_mutator similarly for consistency, even though join  
nodes could never appear in such a context.  (In general, it seems  
likely to be a bit cheaper to use Vars than Params in such situations  
anyway, so this patch might offer a tiny performance improvement.)  
  
The hazard extends back to 9.5 where the MULTIEXPR_SUBLINK stuff  
was introduced, so back-patch that far.  However, this may be a live  
bug only in 9.6.x and 10.x, as the other branches don't seem to want  
to calculate the final tlist below the Result node.  (That plan shape  
change between branches might be a mini-bug in itself, but I'm not  
really interested in digging into the reasons for that right now.  
Still, add a regression test memorializing what we expect there,  
so we'll notice if it changes again.)  
  
Per bug report from Eduards Bezverhijs.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/setrefs.c
M src/test/regress/expected/update.out
M src/test/regress/sql/update.sql

Tweak pg_partition_tree for undefined relations and unsupported relkinds

commit   : cc53123bcc9d8786acae2885c3a0897b7be34a02    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Dec 2018 09:49:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Dec 2018 09:49:39 +0900    

Click here for diff

This fixes a crash which happened when calling the function directly  
with a relation OID referring to a non-existing object, and changes the  
behavior so as NULL is returned for unsupported relkinds instead of  
generating an error.  This puts the new function in line with many other  
system functions, and eases actions like full scans of pg_class.  
  
Author: Michael Paquier  
Reviewed-by: Amit Langote, Stephen Frost  
Discussion: https://postgr.es/m/[email protected]  

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

Fix test_rls_hooks to assign expression collations properly.

commit   : 7a28e9aa0fd966ed374d244896e397148336720a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Dec 2018 11:48:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Dec 2018 11:48:00 -0500    

Click here for diff

This module overlooked this necessary fixup step on the results of  
transformWhereClause().  It accidentally worked anyway, because the  
constructed expression involved type "name" which is not collatable,  
but it fell over while I was experimenting with changing "name" to  
be collatable.  
  
Back-patch, not because there's any live bug here in back branches,  
but because somebody might use this code as a model for some real  
application and then not understand why it doesn't work.  

M src/test/modules/test_rls_hooks/test_rls_hooks.c

Doc: improve documentation about ALTER LARGE OBJECT requirements.

commit   : d65ddb2b5674cd6cf444c4825270a12b968055ac    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Dec 2018 11:21:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Dec 2018 11:21:36 -0500    

Click here for diff

Unlike other ALTER ref pages, this one neglected to mention that  
ALTER OWNER requires being a member of the new owning role.  
Per bug #15546 from Stefan Kadow.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_large_object.sgml

Raise some timeouts to 180s, in test code.

commit   : 1db439ad49255d8fb0371cc7166cdc33f6b3fdf3    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 10 Dec 2018 20:15:42 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 10 Dec 2018 20:15:42 -0800    

Click here for diff

Slow runs of buildfarm members chipmunk, hornet and mandrill saw the  
shorter timeouts expire.  The 180s timeout in poll_query_until has been  
trouble-free since 2a0f89cd717ce6d49cdc47850577823682167e87 introduced  
it two years ago, so use 180s more widely.  Back-patch to 9.6, where the  
first of these timeouts was introduced.  
  
Reviewed by Michael Paquier.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/README
M src/test/isolation/isolationtester.c
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl

Add stack depth checks to key recursive functions in backend/nodes/*.c.

commit   : 001bb9f3ed05e7c370151f7aad3a83447c52c157    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Dec 2018 11:12:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Dec 2018 11:12:43 -0500    

Click here for diff

Although copyfuncs.c has a check_stack_depth call in its recursion,  
equalfuncs.c, outfuncs.c, and readfuncs.c lacked one.  This seems  
unwise.  
  
Likewise fix planstate_tree_walker(), in branches where that exists.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

Doc: remove obsolete reference to recursive expression evaluation.

commit   : e28649a67f56ee1f7c1a55dc3dee4a1e467430a4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Dec 2018 10:44:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Dec 2018 10:44:06 -0500    

Click here for diff

John Naylor  
  
Discussion: https://postgr.es/m/CAJVSVGUPH-0q5feP4v9b+Y8K3HGTn3bEd5KV7VbyUj-oFdSLzA@mail.gmail.com  

M doc/src/sgml/config.sgml

Make TupleDescInitBuiltinEntry throw error for unsupported types.

commit   : b7a29695f744c3140350a4f1bb8511e950acc086    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Dec 2018 10:38:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Dec 2018 10:38:48 -0500    

Click here for diff

Previously, it would just pass back a partially-uninitialized tupdesc,  
which doesn't seem like a safe or useful behavior.  
  
Backpatch to v10 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add pg_dump test for empty OP class

commit   : eeeb1dfc87fafe1cf4332c09692779662a95511e    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 10 Dec 2018 10:13:52 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 10 Dec 2018 10:13:52 -0500    

Click here for diff

This adds a pg_dump test for an empty operator class.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Add additional partition tests to pg_dump

commit   : 2d7eeb1b14925fd4ba6d2d7012636489570eaee8    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 10 Dec 2018 09:46:36 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 10 Dec 2018 09:46:36 -0500    

Click here for diff

This adds a few tests for non-inherited constraints.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/20181208001735.GT3415%40tamriel.snowman.net  

M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Remove dead code in toast_fetch_datum_slice

commit   : 96c702c1edbde8a3f5013bd0ac6c25c85710258d    
  
author   : Stephen Frost <[email protected]>    
date     : Mon, 10 Dec 2018 09:31:38 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Mon, 10 Dec 2018 09:31:38 -0500    

Click here for diff

In toast_fetch_datum_slice(), we Assert() that what is passed in isn't  
compressed, but we then later had a check to see what the length of if  
what was passed in is compressed.  That later check is rather confusing  
since toast_fetch_datum_slice() is only ever called with non-compressed  
datums and the Assert() earlier makes it clear that one shouldn't be  
passing in compressed datums.  
  
Add a comment to make it clear that toast_fetch_datum_slice() is just  
for non-compressed datums, and remove the dead code.  

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

Ensure cleanup of orphan archive status files

commit   : 6d8727f95e7043d52ea8f6d62f7bcf81fdeaa658    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 10 Dec 2018 15:00:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 10 Dec 2018 15:00:59 +0900    

Click here for diff

When a WAL segment is recycled, its ".ready" and ".done" status files  
get also automatically removed, however this is not done in a durable  
manner.  Hence, in a subsequent crash, it could be possible that a  
".ready" status file is still around with its corresponding segment  
already gone.  
  
If the backend reaches such a state, the archive command would most  
likely complain about a segment non-existing and would keep retrying,  
causing WAL segments to bloat pg_wal/, potentially making Postgres crash  
hard when running out of space.  
  
As status files are removed after each individual segment, using  
durable_unlink() does not completely close the window either, as a crash  
could happen between the moment the WAL segment is recycled and the  
moment its status files are removed.  This has also some performance  
impact with the additional fsync() calls needed to make the removal in a  
durable manner.  Doing the cleanup at recovery is not cost-free either  
as this makes crash recovery potentially take longer than necessary.  
  
So, instead, as per an idea of Stephen Frost, make the archiver aware of  
orphan status files and remove them on-the-fly if the corresponding  
segment goes missing.  Removal failures follow a model close to what  
happens for WAL segments, where multiple attempts are done before giving  
up temporarily, and where a successful orphan removal makes the archiver  
move immediately to the next WAL segment thought as ready to be  
archived.  
  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart, Andres Freund, Stephen Frost, Kyotaro  
Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgarch.c

Add timestamp of last received message from standby to pg_stat_replication

commit   : 7fee252f6fbf78ca5e50ee591573d59f98e75d37    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 9 Dec 2018 16:35:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 9 Dec 2018 16:35:06 +0900    

Click here for diff

The timestamp generated by the standby at message transmission has been  
included in the protocol since its introduction for both the status  
update message and hot standby feedback message, but it has never  
appeared in pg_stat_replication.  Seeing this timestamp does not matter  
much with a cluster which has a lot of activity, but on a mostly-idle  
cluster, this makes monitoring able to react faster than the configured  
timeouts.  
  
Author: MyungKyu LIM  
Reviewed-by: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/1657809367.407321.1533027417725.JavaMail.jboss@ep2ml404  

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

Doc: document that we expect CHECK constraint conditions to be immutable.

commit   : 1f66c657f2b4eb55c68593d5c14256115aa6a0ea    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 16:40:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 16:40:58 -0500    

Click here for diff

This restriction is implicit in the check-only-once implementation we use  
for table and domain constraints, but it wasn't spelled out anywhere, nor  
was there any advice about how to alter a constraint's behavior safely.  
Improve that.  
  
I was also dissatisfied with the documentation of ALTER DOMAIN VALIDATE  
CONSTRAINT, which entirely failed to explain the use of that feature; and  
thence decided that ALTER TABLE VALIDATE CONSTRAINT could be documented  
better as well.  
  
Perhaps we should back-patch this, along with the related commit 36d442a25,  
but for now I refrained.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: remove obsolete statements about system OID columns in ALTER TABLE.

commit   : 1464755fc490a9911214817fe83077a3689250ab    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 14:50:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 14:50:46 -0500    

Click here for diff

Missed in commit 578b22971.  

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

In PQprint(), write HTML table trailer before closing the output pipe.

commit   : b90e6cef12662ccad8679be24cd650c6b49feb1c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 13:11:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 13:11:30 -0500    

Click here for diff

This is an astonishingly ancient bit of silliness, dating AFAICS to  
commit edb519b14 of 27-Jul-1996 which added the pipe close stanza in  
the wrong place.  It happens to be harmless given that the code above  
this won't enable the pager if html3 output mode is selected.  Still,  
somebody might try to relax that restriction someday, and in any case  
it could confuse readers and static analysis tools, so let's fix it in  
HEAD.  
  
Per bug #15541 from Pan Bian.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix misapplication of pgstat_count_truncate to wrong relation.

commit   : 5deadfef282761aeb27b18706dcff295e9430c39    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 12:11:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 12:11:59 -0500    

Click here for diff

The stanza of ExecuteTruncate[Guts] that truncates a target table's toast  
relation re-used the loop local variable "rel" to reference the toast rel.  
This was safe enough when written, but commit d42358efb added code below  
that that supposed "rel" still pointed to the parent table.  Therefore,  
the stats counter update was applied to the wrong relcache entry (the  
toast rel not the user rel); and if we were unlucky and that relcache  
entry had been flushed during reindex_relation, very bad things could  
ensue.  
  
(I'm surprised that CLOBBER_CACHE_ALWAYS testing hasn't found this.  
I'm even more surprised that the problem wasn't detected during the  
development of d42358efb; it must not have been tested in any case  
with a toast table, as the incorrect stats counts are very obvious.)  
  
To fix, replace use of "rel" in that code branch with a more local  
variable.  Adjust test cases added by d42358efb so that some of them  
use tables with toast tables.  
  
Per bug #15540 from Pan Bian.  Back-patch to 9.5 where d42358efb came in.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Clean up sloppy coding in publicationcmds.c's OpenTableList().

commit   : 9286ef8e914c69fbf6087d6339215fd10836e25a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 11:02:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 11:02:39 -0500    

Click here for diff

Remove dead code (which would be incorrect if it weren't dead),  
per report from Pan Bian.  Add a CHECK_FOR_INTERRUPTS in the  
inner loop over child relations, because there's little point  
in having one in the outer loop if there's not one here too.  
Minor stylistic adjustments and comment improvements.  
  
Seems to be aboriginal to this code (cf commit 665d1fad9).  
Back-patch to v10 where that came in, not because any of this  
is significant, but just to keep the branches looking similar.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/publicationcmds.c

Doc: make cross-reference to format() function more specific.

commit   : eeee62d8052ccd3fb8e26be1392a93167f83d937    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 10:41:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Dec 2018 10:41:26 -0500    

Click here for diff

Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1w7Tn2M9BhK+rt8Shtz1AkU+ty7By8gj5C==z65=U4vyQ@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml

Fix some errhint and errdetail strings missing a period

commit   : 730422afcdb6784bbe20efc65de72156d470b0c4    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Dec 2018 07:47:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Dec 2018 07:47:42 +0900    

Click here for diff

As per the error message style guide of the documentation, those should  
be full sentences.  
  
Author: Daniel Gustafsson  
Reviewed-by: Michael Paquier, Álvaro Herrera  
Discussion: https://[email protected]  

M contrib/amcheck/verify_nbtree.c
M src/backend/commands/tablecmds.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/misc/guc.c
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/triggers.out

Improve our response to invalid format strings, and detect more cases.

commit   : d2b0b60e71931997455afd5da72ca29148f1ca51    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Dec 2018 15:08:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Dec 2018 15:08:44 -0500    

Click here for diff

Places that are testing for *printf failure ought to include the format  
string in their error reports, since bad-format-string is one of the  
more likely causes of such failure.  This both makes it easier to find  
and repair the mistake, and provides at least some useful info to the  
user who stumbles across such a problem.  
  
Also, tighten snprintf.c to report EINVAL for an invalid flag or  
final character in a format %-spec (including the case where the  
%-spec is missing a final character altogether).  This seems like  
better project policy, and it also allows removing an instruction  
or two from the hot code path.  
  
Back-patch the error reporting change in pvsnprintf, since it should be  
harmless and may be helpful; but not the snprintf.c change.  
  
Per discussion of bug #15511 from Ertuğrul Kahveci, which reported an  
invalid translated format string.  These changes don't fix that error,  
but they should improve matters next time we make such a mistake.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/common/psprintf.c
M src/port/snprintf.c

Improve planner stats documentation

commit   : 7a55ccc477b58863f6c73c243c7adb79c9717eda    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 6 Dec 2018 11:39:09 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 6 Dec 2018 11:39:09 -0500    

Click here for diff

It was pointed out that in the planner stats documentation under  
Extended Statistics, one of the sentences was a bit awkward.  Improve  
that by rewording it slightly.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/perform.sgml

Cleanup minor pg_dump memory leaks

commit   : 369d494a4f5c1494a46adcf5c56f5462a83ef20d    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 6 Dec 2018 11:11:21 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 6 Dec 2018 11:11:21 -0500    

Click here for diff

In dumputils, we may have successfully parsed the acls when we discover  
that we can't parse the reverse ACLs and then return- check and free  
aclitems if that happens.  
  
In dumpTableSchema, move ftoptions and srvname under the relkind !=  
RELKIND_VIEW branch (since they're only used there) and then check if  
they've been allocated and, if so, free them at the end of that block.  
  
Pointed out by Pavel Raiskup, though I didn't use those patches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dump.c

Cleanup comments in xlog compression

commit   : a243c55326686b284fbe2c7b70f06d8a022b7dcc    
  
author   : Stephen Frost <[email protected]>    
date     : Thu, 6 Dec 2018 11:05:39 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Thu, 6 Dec 2018 11:05:39 -0500    

Click here for diff

Skipping over the "hole" in full page images in the XLOG code was  
described as being a form of compression, but this got a bit confusing  
since we now have PGLZ-based compression happening, so adjust the  
wording to discuss "removing" the "hole" and keeping the talk about  
compression to where we're talking about using PGLZ-based compression of  
the full page images.  
  
Reviewed-By: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

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

Change true/false to on/off.

commit   : 228b0485f471480cf825b7b30ffa3d66bd692c57    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Thu, 6 Dec 2018 12:15:15 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Thu, 6 Dec 2018 12:15:15 +0900    

Click here for diff

We prefer to use on/off than true/false for boolean configuration  
parameters in the documentation, but there were a few places where  
true/false were still used.  
  
Dicussion: https://postgr.es/m/20181202.072508.618341295047874293.t-ishii%40sraoss.co.jp  

M doc/src/sgml/config.sgml

Don't mark partitioned indexes invalid unnecessarily

commit   : 71a05b22326088ce59c7ed12cc4160adec634940    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 5 Dec 2018 13:31:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 5 Dec 2018 13:31:51 -0300    

Click here for diff

When an indexes is created on a partitioned table using ONLY (don't  
recurse to partitions), it gets marked invalid until index partitions  
are attached for each table partition.  But there's no reason to do this  
if there are no partitions ... and moreover, there's no way to get the  
index to become valid afterwards, because all partitions that get  
created/attached get their own index partition already attached to the  
parent index, so there's no chance to do ALTER INDEX ... ATTACH PARTITION  
that would make the parent index valid.  
  
Fix by not marking the index as invalid to begin with.  
  
This is very similar to 9139aa19423b, but the pg_dump aspect does not  
appear to be relevant until we add FKs that can point to PKs on  
partitioned tables.  (I tried to cause the pg_upgrade test to break by  
leaving some of these bogus tables around, but wasn't able to.)  
  
Making this change means that an index that was supposed to be invalid  
in the insert_conflict regression test is no longer invalid; reorder the  
DDL so that the test continues to verify the behavior we want it to.  
  
Author: Álvaro Herrera  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

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

Fix invalid value of synchronous_commit in description of flush_lag

commit   : 99f9ccee510366a560df88088835e7e8d5066118    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Dec 2018 10:02:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Dec 2018 10:02:47 +0900    

Click here for diff

"remote_flush" has never been a valid user-facing value, but "on" is.  
  
Author: Maksim Milyutin  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Fix typo

commit   : f502fc88b3c8b4c619a4bcbb86c3225a699c1d45    
  
author   : Stephen Frost <[email protected]>    
date     : Tue, 4 Dec 2018 11:04:54 -0500    
  
committer: Stephen Frost <[email protected]>    
date     : Tue, 4 Dec 2018 11:04:54 -0500    

Click here for diff

Backends don't typically exist uncleanly, but they can certainly exit  
uncleanly, and it's exiting uncleanly that's being discussed here.  

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

postgres_fdw: Improve cost and size estimation for aggregate pushdown.

commit   : f8f6e44676ef38fee7a5bbe4f256a34ea7799ac1    
  
author   : Etsuro Fujita <[email protected]>    
date     : Tue, 4 Dec 2018 17:18:58 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Tue, 4 Dec 2018 17:18:58 +0900    

Click here for diff

In commit 7012b132d07c2b4ea15b0b3cb1ea9f3278801d98, which added aggregate  
pushdown to postgres_fdw, we didn't account for the evaluation cost and the  
selectivity of HAVING quals attached to ForeignPaths performing aggregate  
pushdown, as core had never accounted for that for AggPaths and GroupPaths.  
And we didn't set these values of the locally-checked quals (ie, fpinfo's  
local_conds_cost and local_conds_sel), which were initialized to zeros, but  
since estimate_path_cost_size factors in these to estimate the result size  
and the evaluation cost of such a ForeignPath when the use_remote_estimate  
option is enabled, this caused it to produce underestimated results in that  
case.  
  
By commit 7b6c07547190f056b0464098bb5a2247129d7aa2 core was changed so that  
it accounts for the evaluation cost and the selectivity of HAVING quals in  
aggregation paths, so change the postgres_fdw's aggregate pushdown code as  
well as such.  This not only fixes the underestimation issue mentioned  
above, but improves the estimation using local statistics in that function  
when that option is disabled.  
  
This would be a bug fix rather than an improvement, but apply it to HEAD  
only to avoid destabilizing existing plan choices.  
  
Author: Etsuro Fujita  
Discussion: https://postgr.es/m/5BFD3EAD.2060301%40lab.ntt.co.jp  

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

Refactor documentation about privileges to centralize the info.

commit   : afc4a78a30146a0db415c5c2bbf460e5a576d70f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Dec 2018 11:40:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Dec 2018 11:40:49 -0500    

Click here for diff

Expand section 5.6 "Privileges" to include the full definition of  
each privilege type, and an explanation of aclitem privilege displays,  
along with some helpful summary tables.  Most of this material came  
out of the GRANT reference page, although some of it is new.  
Adjust a bunch of links that were pointing to GRANT to point to 5.6.  
  
Fabien Coelho and Tom Lane, reviewed by Bradley DeJong  
  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1807311735200.20743@lancre  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/alter_default_privileges.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/revoke.sgml

Add some missing schema qualifications

commit   : ee2b37ae044f34851baba69e9ba737077326414e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Dec 2018 14:21:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Dec 2018 14:21:52 +0900    

Click here for diff

This does not improve the security and reliability of the touched areas,  
but it makes the style more consistent.  
  
Author: Michael Paquier  
Reviewed-by- Noah Misch  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/information_schema.sql
M src/bin/psql/command.c
M src/test/isolation/isolationtester.c

Add PGXS options to control TAP and isolation tests, take two

commit   : d3c09b9b1307e022883801000ae36bcb5eef71e8    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Dec 2018 09:27:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Dec 2018 09:27:35 +0900    

Click here for diff

The following options are added for extensions:  
- TAP_TESTS, to allow an extention to run TAP tests which are the ones  
present in t/*.pl.  A subset of tests can always be run with the  
existing PROVE_TESTS for developers.  
- ISOLATION, to define a list of isolation tests.  
- ISOLATION_OPTS, to pass custom options to isolation_tester.  
  
A couple of custom Makefile rules have been accumulated across the tree  
to cover the lack of facility in PGXS for a couple of releases when  
using those test suites, which are all now replaced with the new flags,  
without reducing the test coverage.  Note that tests of contrib/bloom/  
are not enabled yet, as those are proving unstable in the buildfarm.  
  
Author: Michael Paquier  
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,  
Arthur Zakirov  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/Makefile
M contrib/oid2name/Makefile
M contrib/test_decoding/Makefile
M contrib/vacuumlo/Makefile
M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk
M src/test/modules/brin/.gitignore
M src/test/modules/brin/Makefile
M src/test/modules/commit_ts/Makefile
M src/test/modules/snapshot_too_old/Makefile
M src/test/modules/test_pg_dump/Makefile

Eliminate parallel-make hazard in ecpg/preproc.

commit   : 29180e5d78e545472b1665b8d415e6917a5bf333    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Dec 2018 17:19:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Dec 2018 17:19:51 -0500    

Click here for diff

Re-making ecpglib's typename.o is dangerous because another make thread  
could be doing that at the same time.  While we've not heard field  
complaints traceable to this, it seems inevitable that it'd bite someone  
eventually.  Instead, symlink typename.c into the preproc directory and  
recompile it there.  That file is small enough that compiling it twice  
isn't much of a penalty.  Furthermore, this way we get a .o file that's  
made without shlib CFLAGS, which seems cleaner.  
  
This requires adding more stuff to the module's -I list.  The MSVC  
aspect of that is untested, but I'm sure the buildfarm will tell me  
if I got it wrong.  
  
Per a suggestion from Peter Eisentraut.  Although this is theoretically  
a bug fix, the lack of field reports makes me feel we needn't back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/.gitignore
M src/interfaces/ecpg/preproc/Makefile
M src/tools/msvc/Mkvcbuild.pm

Rename ecpg's various "extern.h" files to have distinct names.

commit   : 3295f82022ff0da95c96d8ca763e1d8902345466    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Dec 2018 16:34:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Dec 2018 16:34:00 -0500    

Click here for diff

This should reduce confusion, and in particular make it safe to  
copy typename.c into preproc/ and compile it there.  
  
This doesn't affect anything outside ecpg, and particularly not  
end users, because these files don't get installed; they just  
exist to share declarations among the .c files of each subdirectory.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
R097 src/interfaces/ecpg/ecpglib/extern.h src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/error.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/memory.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/ecpglib/sqlda.c
M src/interfaces/ecpg/ecpglib/typename.c
M src/interfaces/ecpg/pgtypeslib/common.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
R087 src/interfaces/ecpg/pgtypeslib/extern.h src/interfaces/ecpg/pgtypeslib/pgtypeslib_extern.h
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/c_keywords.c
M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg_keywords.c
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
R098 src/interfaces/ecpg/preproc/extern.h src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/variable.c

Add a --socketdir option to pg_upgrade.

commit   : 2d34ad84303181111c6f0747186857ff50106267    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Dec 2018 15:45:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Dec 2018 15:45:11 -0500    

Click here for diff

This allows control of the directory in which the postmaster sockets  
are created for the temporary postmasters started by pg_upgrade.  
The default location remains the current working directory, which is  
typically fine, but if it is deeply nested then its pathname might  
be too long to be a socket name.  
  
In passing, clean up some messiness in pg_upgrade's option handling,  
particularly the confusing and undocumented way that configuration-only  
datadirs were handled.  And fix check_required_directory's substantially  
under-baked cleanup of directory pathnames.  
  
Daniel Gustafsson, reviewed by Hironobu Suzuki, some code cleanup by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.h

Fix tablespace path TAP test of pg_verify_checksums for msys

commit   : 7d4524aed3a4720086b2914ec22f1bbbc857ac44    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 1 Dec 2018 07:53:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 1 Dec 2018 07:53:18 +0900    

Click here for diff

TAP tests on msys need to run with the DTK perl, which understands msys  
virtualized paths.  Postgres, however, does not understand such paths,  
so before a path can be used safely with CREATE TABLESPACE, it needs to  
be translated into a path on the underlying file system.  
  
Per report from buildfarm member jacana.  Suggested fix is from Andrew  
Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_verify_checksums/t/002_actions.pl

Silence compiler warning

commit   : 9dc122585551516309c9362e673effdbf3bd79bd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 30 Nov 2018 10:20:49 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 30 Nov 2018 10:20:49 -0300    

Click here for diff

My original coding was questionable anyway.  
  
Reported-by: Sergei Kornilov  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c

Fix typo.

commit   : dcfdf56e89a8d0b41874d495a44a4485e341f8c8    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 30 Nov 2018 11:50:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 30 Nov 2018 11:50:43 +0530    

Click here for diff

M src/backend/executor/execTuples.c

Fix various checksum check problems for pg_verify_checksums and base backups

commit   : 5c995139752f5d57c560a0708286b99f9ca2bddd    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Nov 2018 10:34:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Nov 2018 10:34:45 +0900    

Click here for diff

Three issues are fixed in this patch:  
- Base backups forgot to ignore files specific to EXEC_BACKEND, leading  
to spurious warnings when checksums are enabled, per analysis from me.  
- pg_verify_checksums forgot about files specific to EXEC_BACKEND,  
leading to failures of the tool on any such build, particularly Windows.  
This error was originally found by newly-introduced TAP tests in various  
buildfarm members using EXEC_BACKEND.  
- pg_verify_checksums forgot to count for temporary files and temporary  
paths, which could be valid relation files, without checksums, per  
report from Andres Freund.  More tests are added to cover this case.  
  
A new test case which emulates corruption for a file in a different  
tablespace is added, coming from from Michael Banck, while I have coded  
the main code and refactored the test code.  
  
Author: Michael Banck, Michael Paquier  
Reviewed-by: Stephen Frost, David Steele  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/basebackup.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/pg_verify_checksums/t/002_actions.pl

Switch pg_verify_checksums back to a blacklist

commit   : a1c91dd1108c2e6536935619341c79c238734f77    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Nov 2018 10:14:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Nov 2018 10:14:58 +0900    

Click here for diff

This basically reverts commit d55241af705667d4503638e3f77d3689fd6be31,  
leaving around a portion of the regression tests still adapted with  
empty relation files, and corrupted cases.  This is also proving to be  
failing to check properly relation files located in a non-default  
tablespace path.  
  
Per discussion with various folks, including Stephen Frost, David  
Steele, Andres Freund, Michael Banck and myself.  
  
Reported-by: Michael Banck  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/pg_verify_checksums/t/002_actions.pl

Document handling of invalid/ambiguous timestamp input near DST boundaries.

commit   : d328991578d9f637fd1866639bfcbdfff64aba75    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Nov 2018 18:28:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Nov 2018 18:28:10 -0500    

Click here for diff

The source code comments documented this, but the user-facing docs, not  
so much.  Add a section to Appendix B that discusses it.  
  
In passing, improve a couple other things in Appendix B --- notably,  
a long-obsolete claim that time zone abbreviations are looked up in  
a fixed table.  
  
Per bug #15527 from Michael Davidson.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datetime.sgml

Add log_statement_sample_rate parameter

commit   : 88bdbd3f746049834ae3cc972e6e650586ec3c9d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 29 Nov 2018 18:42:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 29 Nov 2018 18:42:53 -0300    

Click here for diff

This allows to set a lower log_min_duration_statement value without  
incurring excessive log traffic (which reduces performance).  This can  
be useful to analyze workloads with lots of short queries.  
  
Author: Adrien Nayrat  
Reviewed-by: David Rowley, Vik Fearing  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc.h

Ensure static libraries have correct mod time even if ranlib messes it up.

commit   : 826eff57c4c23f77314ba7151d3dc506ce0fa24c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Nov 2018 15:53:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Nov 2018 15:53:44 -0500    

Click here for diff

In at least Apple's version of ranlib, the output file is updated to have  
a mod time equal to the max of the timestamps of its components, and that  
data only has seconds precision.  On a filesystem with sub-second file  
timestamp precision --- say, APFS --- this can result in the finished  
static library appearing older than its input files, which causes useless  
rebuilds and possible outright failures in parallel makes.  
  
We've only seen this reported in the field from people using Apple's  
ranlib with a non-Apple make, because Apple's make doesn't know about  
sub-second timestamps either so it doesn't decide rebuilds are needed.  
But Apple's ranlib presumably shares code with at least some BSDen,  
so it's not that unlikely that the same problem could arise elsewhere.  
  
To fix, just "touch" the output file after ranlib finishes.  
  
We seem to need this in only one place.  There are other calls of  
ranlib in our makefiles, but they are working on intermediate files  
whose timestamps are not actually important, or else on an installed  
static library for which sub-second timestamp precision is unlikely  
to matter either.  (Also, so far as I can tell, Apple's ranlib doesn't  
mess up the file timestamp in the latter usage anyhow.)  
  
In passing, change "ranlib" to "$(RANLIB)" in one place that was  
bypassing the make macro for no good reason.  
  
Per bug #15525 from Jack Kelly (via Alyssa Ross).  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

doc: Add appendix detailing some limits of PostgreSQL

commit   : 68120427f4902c136066d10ac9da93355877e156    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Nov 2018 13:58:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Nov 2018 13:58:28 +0100    

Click here for diff

This used to be on the web site but was removed.  The documentation is  
a better place for it anyway.  
  
Author: David Rowley <[email protected]>  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAKJS1f_dKdejdKB94nKZC9S5NzB-UZRcAKkE84e=JEEecDuotg@mail.gmail.com/  

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

Add pg_partition_tree to documentation index

commit   : 44e22647f82b6e42626ee658634443635ab7fca2    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Nov 2018 18:00:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Nov 2018 18:00:08 +0900    

Click here for diff

This fixes an oversight from d5eec4ee.  
  
Author: Michael Paquier  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Add support for NO_INSTALLCHECK in MSVC scripts

commit   : 431f1599a2b7ba3e42fc06bd5b0ff5735931f556    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Nov 2018 10:31:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Nov 2018 10:31:12 +0900    

Click here for diff

When fetching a list of tests for a given extension in contrib/ or  
src/test/modules/, NO_INSTALLCHECK now gets checked first.  If present,  
an empty list of tests is returned to let the caller know that tests  
for this module need to be bypassed.  
  
This actually fixes a set of issues with MSVC with modules using  
REGRESS_OPTS, as an incorrect parsing caused the launched command  
to eat the first test listed.  The actual effect on the tree is that  
several modules listed a single test, so regressions have been running  
with no actual tests.  pg_stat_statements, test_rls_hooks and commit_ts  
were impacted by that.  Some other modules like test_decoding (or  
snapshot_too_old) don't use yet PGXS rules, but their makefiles will  
soon be refactored with an upcoming patch.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/vcregress.pl

Fix minor typo in dsa.c.

commit   : 2ac180c2869706fa42b89ef10055a88cc4a7847b    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 29 Nov 2018 14:14:26 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 29 Nov 2018 14:14:26 +1300    

Click here for diff

Author: Takeshi Ideriha  
Discussion: https://postgr.es/m/4E72940DA2BF16479384A86D54D0988A6F3BF22D%40G01JPEXMBKW04  

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

Add missing NO_INSTALLCHECK in commit_ts and test_rls_hooks

commit   : d79fb5d2370cc9166029b7afd17a26355598730a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Nov 2018 09:39:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Nov 2018 09:39:07 +0900    

Click here for diff

This bypasses installcheck if specified, which makes sense for those  
modules as they require non-default configuration, something which  
typical users don't have.  Those have been missing from the start, still  
no back-patch is done.  
  
This will be used by an upcoming patch for MSVC scripts adding support  
for NO_INSTALLCHECK as installcheck is the default mode for contrib and  
modules for performance reasons in the buildfarm.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/commit_ts/Makefile
M src/test/modules/test_rls_hooks/Makefile

Fix handling of synchronous replication for stopping WAL senders

commit   : 4c703369af3e34cd7289d99c1b6f10e3b3bbbb4d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Nov 2018 09:12:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Nov 2018 09:12:19 +0900    

Click here for diff

This fixes an oversight from c6c3334 which forgot that if a subset of  
WAL senders are stopping and in a sync state, other WAL senders could  
still be waiting for a WAL position to be synced while committing a  
transaction.  However the subset of stopping senders would not release  
waiters, potentially breaking synchronous replication guarantees.  This  
commit makes sure that even WAL senders stopping are able to release  
waiters and are tracked properly.  
  
On 9.4, this can also trigger an assertion failure when setting for  
example max_wal_senders to 1 where a WAL sender is not able to find  
itself as in synchronous state when the instance stops.  
  
Reported-by: Paul Guo  
Author: Paul Guo, Michael Paquier  
Discussion: https://postgr.es/m/CAEET0ZEv8VFqT3C-cQm6byOB4r4VYWcef1J21dOX-gcVhCSpmA@mail.gmail.com  
Backpatch-through: 9.4  

M src/backend/replication/syncrep.c

Have BufFileSize() ereport() on FileSize() failure.

commit   : 1a990b207b86967cc323c00adda21fef3b2cd63e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 28 Nov 2018 14:42:54 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 28 Nov 2018 14:42:54 -0800    

Click here for diff

Move the responsibility for checking for and reporting a failure from  
the only current BufFileSize() caller, logtape.c, to BufFileSize()  
itself.  Code within buffile.c is generally responsible for interfacing  
with fd.c to report irrecoverable failures.  This seems like a  
convention that's worth sticking to.  
  
Reorganizing things this way makes it easy to make the error message  
raised in the event of BufFileSize() failure descriptive of the  
underlying problem.  We're now clear on the distinction between  
temporary file name and BufFile name, and can show errno, confident that  
its value actually relates to the error being reported.  In passing, an  
existing, similar buffile.c ereport() + errcode_for_file_access() site  
is changed to follow the same conventions.  
  
The API of the function BufFileSize() is changed by this commit, despite  
already being in a stable release (Postgres 11).  This seems acceptable,  
since the BufFileSize() ABI was changed by commit aa551830421, which  
hasn't made it into a point release yet.  Besides, it's difficult to  
imagine a third party BufFileSize() caller not just raising an error  
anyway, since BufFile state should be considered corrupt when  
BufFileSize() fails.  
  
Per complaint from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where shared BufFiles were introduced.  

M src/backend/storage/file/buffile.c
M src/backend/utils/sort/logtape.c

Only allow one recovery target setting

commit   : f2cbffc7a6183a359b339cfed65e9d609de756f0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 28 Nov 2018 12:36:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 28 Nov 2018 12:36:49 +0100    

Click here for diff

The previous recovery.conf regime accepted multiple recovery_target*  
settings and used the last one.  This does not translate well to the  
general GUC system.  Specifically, under EXEC_BACKEND, the settings  
are written out not in any particular order, so the order in which  
they were originally set is not available to new processes.  
  
Rather than redesign the GUC system, it was decided to abandon the old  
behavior and only allow one recovery target setting.  A second setting  
will cause an error.  However, it is allowed to set the same parameter  
multiple times or unset a parameter and set a different one.  
  
Discussion: https://www.postgresql.org/message-id/flat/27802171543235530%40iva2-6ec8f0a6115e.qloud-c.yandex.net#701a59c837ad0bf8c244344aaf3ef5a4  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c
M src/test/recovery/t/003_recovery_targets.pl

C comment: remove extra '*'

commit   : eae9143d9a70116a8ac4b3195454942140e5afb5    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 28 Nov 2018 07:34:10 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 28 Nov 2018 07:34:10 -0500    

Click here for diff

Reported-by: Etsuro Fujita  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Etsuro Fujita  
  
Backpatch-through: 10  

M contrib/postgres_fdw/postgres_fdw.c

Don't set PAM_RHOST for Unix sockets.

commit   : 0f9cdd7dca694d487ab663d463b308919f591c02    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 28 Nov 2018 14:00:57 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 28 Nov 2018 14:00:57 +1300    

Click here for diff

Since commit 2f1d2b7a we have set PAM_RHOST to "[local]" for Unix  
sockets.  This caused Linux PAM's libaudit integration to make DNS  
requests for that name.  It's not exactly clear what value PAM_RHOST  
should have in that case, but it seems clear that we shouldn't set it  
to an unresolvable name, so don't do that.  
  
Back-patch to 9.6.  Bug #15520.  
  
Author: Thomas Munro  
Reviewed-by: Peter Eisentraut  
Reported-by: Albert Schabhuetl  
Discussion: https://postgr.es/m/15520-4c266f986998e1c5%40postgresql.org  

M src/backend/libpq/auth.c

Do not decode TOAST data for table rewrites

commit   : f69c959df0db311badf609bce3ad3efde2309389    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 28 Nov 2018 01:11:15 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 28 Nov 2018 01:11:15 +0100    

Click here for diff

During table rewrites (VACUUM FULL and CLUSTER), the main heap is logged  
using XLOG / FPI records, and thus (correctly) ignored in decoding.  
But the associated TOAST table is WAL-logged as plain INSERT records,  
and so was logically decoded and passed to reorder buffer.  
  
That has severe consequences with TOAST tables of non-trivial size.  
Firstly, reorder buffer has to keep all those changes, possibly spilling  
them to a file, incurring I/O costs and disk space.  
  
Secondly, ReoderBufferCommit() was stashing all those TOAST chunks into  
a hash table, which got discarded only after processing the row from the  
main heap.  But as the main heap is not decoded for rewrites, this never  
happened, so all the TOAST data accumulated in memory, resulting either  
in excessive memory consumption or OOM.  
  
The fix is simple, as commit e9edc1ba already introduced infrastructure  
(namely HEAP_INSERT_NO_LOGICAL flag) to skip logical decoding of TOAST  
tables, but it only applied it to system tables.  So simply use it for  
all TOAST data in raw_heap_insert().  
  
That would however solve only the memory consumption issue - the TOAST  
changes would still be decoded and added to the reorder buffer, and  
spilled to disk (although without TOAST tuple data, so much smaller).  
But we can solve that by tweaking DecodeInsert() to just ignore such  
INSERT records altogether, using XLH_INSERT_CONTAINS_NEW_TUPLE flag,  
instead of skipping them later in ReorderBufferCommit().  
  
Review: Masahiko Sawada  
Discussion: https://www.postgresql.org/message-id/flat/1a17c643-e9af-3dba-486b-fbe31bc1823a%402ndquadrant.com  
Backpatch: 9.4-, where logical decoding was introduced  

M src/backend/access/heap/rewriteheap.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c

Use wildcard to match parens after CREATE STATISTICS

commit   : d1ce4ed2d56e42531581bb83e769a8840c591e15    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 28 Nov 2018 00:48:51 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 28 Nov 2018 00:48:51 +0100    

Click here for diff

CREATE STATISTICS completion was checking manually for the start and end  
of the parenthesised list of types. That works, but we now have a better  
way to do that as commit 121213d9d taught word_matches() to allow '*' in  
the middle of an alternative. But it only applied that to tab completion  
for EXPLAIN, ANALYZE and VACUUM. Use it for CREATE STATISTICS too.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://www.postgresql.org/message-id/flat/d8jwooziy1s.fsf%40dalvik.ping.uio.no  

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

Don't count zero-filled buffers as 'read' in EXPLAIN.

commit   : d67dae036bd71afd2be7a2fafd7bc1ef38bfcdd1    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 28 Nov 2018 11:42:32 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 28 Nov 2018 11:42:32 +1300    

Click here for diff

If you extend a relation, it should count as a block written, not  
read (we write a zero-filled block).  If you ask for a zero-filled  
buffer, it shouldn't be counted as read or written.  
  
Later we might consider counting zero-filled buffers with a separate  
counter, if they become more common due to future work.  
  
Author: Thomas Munro  
Reviewed-by: Haribabu Kommi, Kyotaro Horiguchi, David Rowley  
Discussion: https://postgr.es/m/CAEepm%3D3JytB3KPpvSwXzkY%2Bdwc5zC8P8Lk7Nedkoci81_0E9rA%40mail.gmail.com  

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

Ensure consistent sort order of large objects in pg_dump.

commit   : 471a7af585b123a8c00416eabbec927f6701583d    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 27 Nov 2018 12:16:55 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 27 Nov 2018 12:16:55 -0800    

Click here for diff

The primary purpose of this commit is to ensure pg_upgrade tests yield  
comparable dumps pre/post upgrade, which got broken by 12a53c732 /  
578b229718, as the order in pg_largeobject_metadata is likely to  
differ pre/post upgrade.  
  
It also seems like a generally good idea to make sure such dumps are  
comparable, outside of pg_upgrade tests.  
  
LO metadata already was already dumped in an ordered manner as the  
metadata is dumped in a well defined order via  
sortDumpableObjectsByTypeName() and sortDumpableObjects(). But large  
object data is currently not tracked via that mechanism.  
  
As Tom points out it seems possible that at some point dumpBlobs() was  
assumed to dump out objects in a well defined order, due to the use of  
DISTINCT, which at that time only was done using sorting.  
  
Per complaint from Andrew Dunstan and discussion with him and Tom  
Lane.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Fix jit compilation bug on wide tables.

commit   : b238527664ec6f6c9d00dba4cc2f3dab1c8b8b04    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 27 Nov 2018 10:07:03 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 27 Nov 2018 10:07:03 -0800    

Click here for diff

The function generated to perform JIT compiled tuple deforming failed  
when HeapTupleHeader's t_hoff was bigger than a signed int8. I'd  
failed to realize that LLVM's getelementptr would treat an int8 index  
argument as signed, rather than unsigned.  That means that a hoff  
larger than 127 would result in a negative offset being applied.  Fix  
that by widening the index to 32bit.  
  
Add a testcase with a wide table. Don't drop it, as it seems useful to  
verify other tools deal properly with wide tables.  
  
Thanks to Justin Pryzby for both reporting a bug and then reducing it  
to a reproducible testcase!  
  
Reported-By: Justin Pryzby  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11, just as jit compilation was  

M src/backend/jit/llvm/llvmjit_deform.c
M src/test/regress/expected/create_table.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/create_table.sql

Update ssl test certificates and keys

commit   : f17889b2214194d7bd33900509bf08959d5a7efa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 27 Nov 2018 15:16:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 27 Nov 2018 15:16:14 +0100    

Click here for diff

Debian testing and newer now require that RSA and DHE keys are at  
least 2048 bit long and no longer allow SHA-1 for signatures in  
certificates.  This is currently causing the ssl tests to fail there  
because the test certificates and keys have been created in violation  
of those conditions.  
  
Update the parameters to create the test files and create a new set of  
test files.  
  
Author: Kyotaro HORIGUCHI <[email protected]>  
Reported-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20180917131340.GE31460%40paquier.xyz  

M src/test/ssl/Makefile
M src/test/ssl/cas.config
M src/test/ssl/ssl/both-cas-1.crt
M src/test/ssl/ssl/both-cas-2.crt
M src/test/ssl/ssl/client+client_ca.crt
M src/test/ssl/ssl/client-revoked.crt
M src/test/ssl/ssl/client-revoked.key
M src/test/ssl/ssl/client.crl
M src/test/ssl/ssl/client.crt
M src/test/ssl/ssl/client.key
M src/test/ssl/ssl/client_ca.crt
M src/test/ssl/ssl/client_ca.key
M src/test/ssl/ssl/root+client.crl
M src/test/ssl/ssl/root+client_ca.crt
M src/test/ssl/ssl/root+server.crl
M src/test/ssl/ssl/root+server_ca.crt
M src/test/ssl/ssl/root.crl
M src/test/ssl/ssl/root_ca.crt
M src/test/ssl/ssl/root_ca.key
M src/test/ssl/ssl/server-cn-and-alt-names.crt
M src/test/ssl/ssl/server-cn-and-alt-names.key
M src/test/ssl/ssl/server-cn-only.crt
M src/test/ssl/ssl/server-cn-only.key
M src/test/ssl/ssl/server-multiple-alt-names.crt
M src/test/ssl/ssl/server-multiple-alt-names.key
M src/test/ssl/ssl/server-no-names.crt
M src/test/ssl/ssl/server-no-names.key
M src/test/ssl/ssl/server-password.key
M src/test/ssl/ssl/server-revoked.crt
M src/test/ssl/ssl/server-revoked.key
M src/test/ssl/ssl/server-single-alt-name.crt
M src/test/ssl/ssl/server-single-alt-name.key
M src/test/ssl/ssl/server-ss.crt
M src/test/ssl/ssl/server-ss.key
M src/test/ssl/ssl/server.crl
M src/test/ssl/ssl/server_ca.crt
M src/test/ssl/ssl/server_ca.key

Fix ac218aa4f6 to work on versions before 9.5.

commit   : 4c8750a9cc3402e4d8ec0b47901c2f9ca416b718    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Nov 2018 23:26:05 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Nov 2018 23:26:05 -0800    

Click here for diff

Unfortunately ac218aa4f6 missed the fact that a reference to  
'pg_catalog.regnamespace'::regclass wouldn't work before that type is  
known. Fix that, by replacing the regtype usage with a join to  
pg_type.  
  
Reported-By: Tom Lane  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-, like ac218aa4f6  

M src/bin/pg_upgrade/check.c

Update pg_upgrade test for reg* to include regrole and regnamespace.

commit   : ac218aa4f6dff6dfb4bf2675b2d9f2f23da6a7c5    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Nov 2018 17:00:43 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Nov 2018 17:00:43 -0800    

Click here for diff

When the regrole (0c90f6769) and regnamespace (cb9fa802b) types were  
added in 9.5, pg_upgrade's check for reg* types wasn't updated. While  
regrole currently is safe, regnamespace is not.  
  
It seems unlikely that anybody uses regnamespace inside catalog tables  
across a pg_upgrade, but the tests should be correct nevertheless.  
  
While at it, reorder the types checked in the query to be  
alphabetical. Otherwise it's annoying to compare existing and tested  
for types.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.5-, as regrole/regnamespace  

M src/bin/pg_upgrade/check.c

doc: fix wording for plpgsql, add "and"

commit   : 7a9d6779d91f68d68bcd9a3a36aadbdba09b172c    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 26 Nov 2018 19:41:19 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 26 Nov 2018 19:41:19 -0500    

Click here for diff

Reported-by: Anthony Greene  
  
Discussion: https://postgr.es/m/CAPRNmnsSZ4QL75FUjcS8ND_oV+WjgyPbZ4ch2RUwmW6PWzF38w@mail.gmail.com  
  
Backpatch-through: 9.4  

M doc/src/sgml/plpgsql.sgml

Fix typo introduced in 578b229718.

commit   : 54bb22f66af9bf4279812b4e71493d164fc38fd8    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Nov 2018 15:27:34 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Nov 2018 15:27:34 -0800    

Click here for diff

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

M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml

Fix pg_upgrade for oid removal.

commit   : 12a53c732cedf83f70106b5605a5003c2000d7f4    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Nov 2018 14:20:36 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Nov 2018 14:20:36 -0800    

Click here for diff

pg_upgrade previously copied pg_largeobject_metadata over from the old  
cluster. That doesn't work, because the table has oids before  
578b229718. I missed that.  
  
As most pieces of metadata for large objects already were dumped as  
DDL (except for comments overwritten by pg_upgrade, due to the copy of  
pg_largeobject_metadata) it seems reasonable to just also dump grants  
for large objects.  If we ever consider this a relevant performance  
problem, we'd need to fix the rest of the already emitted DDL  
too.  
  
There's still an open discussion about whether we'll want to force a  
specific ordering for the dumped objects, as currently  
pg_largeobjects_metadata potentially has a different ordering  
before/after pg_upgrade, which can make automated testing a bit  
harder.  
  
Reported-By: Andrew Dunstan  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Fix translation of special characters in psql's LaTeX output modes.

commit   : 70d7e507ef9d380bd46345e984f069207de5e24e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 17:32:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 17:32:51 -0500    

Click here for diff

latex_escaped_print() mistranslated \ and failed to provide any translation  
for # ^ and ~, all of which would typically lead to LaTeX document syntax  
errors.  In addition it didn't translate < > and |, which would typically  
render as unexpected characters.  
  
To some extent this represents shortcomings in ancient versions of LaTeX,  
which if memory serves had no easy way to render these control characters  
as ASCII text.  But that's been fixed for, um, decades.  In any case there  
is no value in emitting guaranteed-to-fail output for these characters.  
  
Noted while fooling with test cases added by commit 9a98984f4.  Back-patch  
the code change to all supported versions.  

M src/fe_utils/print.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Avoid locale-dependent output in numericlocale check.

commit   : 95dcb8fc0580c7b1c5f480b3ecaf81c5fc9801ba    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 15:30:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 15:30:11 -0500    

Click here for diff

I'd forgotten that in the buildfarm, parts of the regression tests  
may run with psql exposed to a non-default LC_NUMERIC setting.  
Hence we can't assume that C locale prevails, nor is there any  
accessible way to force the setting for this single test step.  
Lobotomize the test case added by commit 9a98984f4 so that it covers as  
much as we can of print.c without having any locale-varying output.  

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

Fix sample output for hash_metapage_info query

commit   : 67ed3b9d73abf7d151fe5dcf9e552564b35f2c54    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Nov 2018 16:58:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Nov 2018 16:58:02 -0300    

Click here for diff

One output column was duplicated.  Couldn't resist fixing the version  
number while at it.  
  
Reported-by: Gianni Ciolli  

M doc/src/sgml/pageinspect.sgml

Add CSV table output mode in psql.

commit   : aa2ba50c2c13dd35a95a91638aa0a2b88c6df1eb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 15:18:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 15:18:55 -0500    

Click here for diff

"\pset format csv", or --csv, selects comma-separated values table format.  
This is compliant with RFC 4180, except that we aren't too picky about  
whether the record separator is LF or CRLF; also, the user may choose a  
field separator other than comma.  
  
This output format is directly compatible with the server's COPY CSV  
format, and will also be useful as input to other programs.  It's  
considerably safer for that purpose than the old recommendation to  
use "unaligned" format, since the latter couldn't handle data  
containing the field separator character.  
  
Daniel Vérité, reviewed by Fabien Coelho and David Fetter, some  
tweaking by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/tab-complete.c
M src/fe_utils/print.c
M src/include/fe_utils/print.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Improve regression test coverage for psql output formats.

commit   : 9a98984f4999b80435bcdcddf90bf9f3e5fc9df0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 12:41:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 12:41:42 -0500    

Click here for diff

As penance for the "\pset format latex" silliness, add some regression  
test coverage for the off-the-beaten-path output formats, which formerly  
had exactly no coverage, except for some poorly-thought-out (unreadable,  
repetitive, and incomplete) tests for asciidoc format.  
  
I make no claims for the behavior exposed here actually being correct;  
these test cases are just designed to ensure full code coverage in  
fe_utils/print.c.  This brings the line coverage for that file up  
from ~60% to ~93%.  

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

Fix breakage of "\pset format latex".

commit   : a7eece4fc9a416129aa692271972be5a30daa68c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 12:31:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Nov 2018 12:31:20 -0500    

Click here for diff

Commit eaf746a5b unintentionally made psql's "latex" output format  
inaccessible, since not only "latex" but all abbreviations of it  
were considered ambiguous against "latex-longtable".  Let's go  
back to the longstanding behavior that all shortened versions  
mean "latex", and you have to write at least "latex-" to get  
"latex-longtable".  This leaves the only difference from pre-v12  
behavior being that "\pset format a" is considered ambiguous.  
  
The fact that the regression tests didn't expose this is pretty bad,  
but fixing it is material for a separate commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

Clarify that cross-row constraints are unsupported

commit   : 36d442a25a1aed39d2c7c3fb24c22640a9a6545d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Nov 2018 12:27:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Nov 2018 12:27:07 -0300    

Click here for diff

Maybe we'll implement them later, or maybe not, but let's make the statu  
quo clear for now.  
  
Author: Lætitia Avrot, Patrick Francelle  
Reviewers: too many to list  
Discussion: https://postgr.es/m/CAB_COdhUuzNFOJfc7SNNso5rOuVA3ui93KMVunEM8Yih+K5A6A@mail.gmail.com  

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

Revert "Fix typo in documentation of toast storage"

commit   : 664f01b61326eebc0d7b4ce9c89b99d3f18c3b76    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 16:43:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 16:43:19 +0900    

Click here for diff

This reverts commit 058ef3a, per complains from Magnus Hagander and Vik  
Fearing.  

M doc/src/sgml/storage.sgml

Fix typo in documentation of toast storage

commit   : 058ef3a1a8469bbaae6b0e6647cd031b9ca71b2d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 15:49:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 15:49:23 +0900    

Click here for diff

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

M doc/src/sgml/storage.sgml

Revert all new recent changes to add PGXS options for TAP and isolation

commit   : 1d7dd18686d0373289a3bf2b3669edae20875cbc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 11:12:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 11:12:11 +0900    

Click here for diff

A set of failures in buildfarm machines are proving that this is not  
quite ready yet because of another set of issues:  
- MSVC scripts assume that REGRESS_OPTS can only use top_builddir.  Some  
test suites actually finish by using top_srcdir, like pg_stat_statements  
which cause the regression tests to never run.  
- Trying to enforce top_builddir does not work either when using VPATH  
as this is not recognized properly.  
- TAP tests of bloom are unstable on various platforms, causing various  
failures.  

M contrib/bloom/Makefile
M contrib/oid2name/Makefile
M contrib/test_decoding/Makefile
M contrib/vacuumlo/Makefile
M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk
M src/test/modules/brin/.gitignore
M src/test/modules/brin/Makefile
M src/test/modules/commit_ts/Makefile
M src/test/modules/snapshot_too_old/Makefile
M src/test/modules/test_pg_dump/Makefile

Fix regression test handling of test_decoding with MSVC

commit   : 3955cae0c5241f5a67b15a3da2cd524c3839f8c9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 10:49:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 10:49:49 +0900    

Click here for diff

The set of scripts in charge of running the regression tests for MSVC  
run currently under the assumption that only $(top_builddir) can used in  
option values defined in REGRESS_OPTS, and those options need to have a  
specific format as well to be correctly parsed, so fix the Makefile  
values so as those are correctly set.  
  
Per complains from buildfarm member dory and whelk, with some extra  
testing done on my side with MSVC to check this patch.  

M contrib/test_decoding/Makefile

Disable temporarily TAP tests for contrib/bloom/

commit   : b0b1f4183aa416d30afe35c5bef83d3e21f9b574    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 09:42:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 09:42:21 +0900    

Click here for diff

The recent commit 03faa4a8 has enabled those tests, however several  
buildfarm members are complaining about their stability on Windows and  
macOS.  This will keep the buildfarm green, while investigating the  
root problem.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/Makefile

Add PGXS options to control TAP and isolation tests

commit   : 03faa4a8ddf04334850bf9631f305bda7a02f260    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 08:39:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Nov 2018 08:39:19 +0900    

Click here for diff

The following options are added for extensions:  
- TAP_TESTS, to allow an extention to run TAP tests which are the ones  
present in t/*.pl.  A subset of tests can always be run with the  
existing PROVE_TESTS for developers.  
- ISOLATION, to define a list of isolation tests.  
- ISOLATION_OPTS, to pass custom options to isolation_tester.  
  
A couple of custom Makefile targets have been accumulated across the  
tree to cover the lack of facility in PGXS for a couple of releases when  
using those test suites, which are all now replaced with the new flags,  
without reducing the test coverage.  This also fixes an issue with  
contrib/bloom/, which had a custom target to trigger its TAP tests of  
its own not part of the main check runs.  
  
Author: Michael Paquier  
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,  
Arthur Zakirov  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/Makefile
M contrib/oid2name/Makefile
M contrib/test_decoding/Makefile
M contrib/vacuumlo/Makefile
M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk
M src/test/modules/brin/.gitignore
M src/test/modules/brin/Makefile
M src/test/modules/commit_ts/Makefile
M src/test/modules/snapshot_too_old/Makefile
M src/test/modules/test_pg_dump/Makefile

Integrate recovery.conf into postgresql.conf

commit   : 2dedf4d9a899b36d1a8ed29be5efbd1b31a8fe85    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 25 Nov 2018 16:31:16 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 25 Nov 2018 16:31:16 +0100    

Click here for diff

recovery.conf settings are now set in postgresql.conf (or other GUC  
sources).  Currently, all the affected settings are PGC_POSTMASTER;  
this could be refined in the future case by case.  
  
Recovery is now initiated by a file recovery.signal.  Standby mode is  
initiated by a file standby.signal.  The standby_mode setting is  
gone.  If a recovery.conf file is found, an error is issued.  
  
The trigger_file setting has been renamed to promote_trigger_file as  
part of the move.  
  
The documentation chapter "Recovery Configuration" has been integrated  
into "Server Configuration".  
  
pg_basebackup -R now appends settings to postgresql.auto.conf and  
creates a standby.signal file.  
  
Author: Fujii Masao <[email protected]>  
Author: Simon Riggs <[email protected]>  
Author: Abhijit Menon-Sen <[email protected]>  
Author: Sergei Kornilov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

M contrib/pg_standby/pg_standby.c
M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/pgstandby.sgml
M doc/src/sgml/postgres.sgml
D doc/src/sgml/recovery-config.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release.sgml
M src/backend/Makefile
D src/backend/access/transam/recovery.conf.sample
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/commands/extension.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_rewind/RewindTest.pm
M src/include/access/xlog.h
M src/include/utils/guc_tables.h
M src/port/quotes.c
M src/test/perl/PostgresNode.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl

Fix assertion failure for SSL connections.

commit   : ab69ea9feeb9a02c6299b5c1b786005552343f22    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 25 Nov 2018 16:21:41 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 25 Nov 2018 16:21:41 +1300    

Click here for diff

Commit cfdf4dc4 added an assertion that every WaitLatch() or similar  
handles postmaster death.  One place did not, but was missed in  
review and testing due to the need for an SSL connection.  Fix, by  
asking for WL_EXIT_ON_PM_DEATH.  
  
Reported-by: Christoph Berg  
Discussion: https://postgr.es/m/20181124143845.GA15039%40msg.df7cb.de  

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

Fix hstore hash function for empty hstores upgraded from 8.4.

commit   : d5890f49da6a77b1325a3f5822c6b092a2cd41ae    
  
author   : Andrew Gierth <[email protected]>    
date     : Sat, 24 Nov 2018 09:59:49 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Sat, 24 Nov 2018 09:59:49 +0000    

Click here for diff

Hstore data generated on pg 8.4 and pg_upgraded to current versions  
remains in its original on-disk format unless modified. The same goes  
for values generated by the addon hstore-new module on pre-9.0  
versions. (The hstoreUpgrade function converts old values on the fly  
when read in, but the on-disk value is not modified by this.)  
  
Since old-format empty hstores (and hstore-new hstores) have  
representations compatible with the new format, hstoreUpgrade thought  
it could get away without modifying such values; but this breaks  
hstore_hash (and the new hstore_hash_extended) which assumes  
bit-perfect matching between semantically identical hstore values.  
Only one bit actually differs (the "new version" flag in the count  
field) but that of course is enough to break the hash.  
  
Fix by making hstoreUpgrade unconditionally convert all old values to  
new format.  
  
Backpatch all the way, even though this changes a hash value in some  
cases, because in those cases the hash value is already failing - for  
example, a hash join between old- and new-format empty hstores will be  
failing to match, or a hash index on an hstore column containing an  
old-format empty value will be failing to find the value since it will  
be searching for a hash derived from a new-format datum. (There are no  
known field reports of this happening, probably because hashing of  
hstores has only been useful in limited circumstances and there  
probably isn't much upgraded data being used this way.)  
  
Per concerns arising from discussion of commit eb6f29141be. Original  
bug is my fault.  
  
Discussion: https://postgr.es/m/60b1fd3b-7332-40f0-7e7f-f2f04f777747%402ndquadrant.com  

M contrib/hstore/hstore_compat.c

Avoid crashes in contrib/intarray gist__int_ops (bug #15518)

commit   : 757c5182f2c42af528386c0419c60c111c678cab    
  
author   : Andrew Gierth <[email protected]>    
date     : Fri, 23 Nov 2018 23:56:39 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Fri, 23 Nov 2018 23:56:39 +0000    

Click here for diff

1. Integer overflow in internal_size could result in memory corruption  
in decompression since a zero-length array would be allocated and then  
written to. This leads to crashes or corruption when traversing an  
index which has been populated with sufficiently sparse values. Fix by  
using int64 for computations and checking for overflow.  
  
2. Integer overflow in g_int_compress could cause pessimal merge  
choices, resulting in unnecessarily large ranges (which would in turn  
trigger issue 1 above). Fix by using int64 again.  
  
3. Even without overflow, array sizes could become large enough to  
cause unexplained memory allocation errors. Fix by capping the sizes  
to a safe limit and report actual errors pointing at gist__intbig_ops  
as needed.  
  
4. Large inputs to the compression function always consist of large  
runs of consecutive integers, and the compression loop was processing  
these one at a time in an O(N^2) manner with a lot of overhead. The  
expected runtime of this function could easily exceed 6 months for a  
single call as a result. Fix by performing a linear-time first pass,  
which reduces the worst case to something on the order of seconds.  
  
Backpatch all the way, since this has been wrong forever.  
  
Per bug #15518 from report from irc user "dymk", analysis and patch by  
me.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/intarray/_int_gist.c
M contrib/intarray/_int_tool.c

Adjust new test case for more portability.

commit   : 452b637d4b02e4aa09d45a34d7a048d3f70116bb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 23:49:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 23:49:25 -0500    

Click here for diff

Early returns from the buildfarm say that most critters are good with  
commit cbdb8b4c0, but gaur gives unexpected results with the test case  
involving a float8 that's one-ULP-less-than-2^63.  It appears that that  
platform's version of rint() rounds that value up to 2^63 instead of  
leaving it be.  This is possibly a bug, and it's also possible that no  
other platform anybody is using anywhere behaves likewise.  Still, the  
point of the test is not to insist that everybody's rint() behaves exactly  
the same.  Let's use two-ULPs-less-than-2^63 instead, which I've tested  
to act the same on gaur as on more modern hardware.  
  
(This is, more or less, exactly the portability issue I'd feared might  
arise...)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/float8-small-is-zero.out
M src/test/regress/expected/float8.out
M src/test/regress/sql/float8.sql

Fix float-to-integer coercions to handle edge cases correctly.

commit   : cbdb8b4c0155b2d9679ecd79b886c29c2730b85d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 20:57:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 20:57:11 -0500    

Click here for diff

ftoi4 and its sibling coercion functions did their overflow checks in  
a way that looked superficially plausible, but actually depended on an  
assumption that the MIN and MAX comparison constants can be represented  
exactly in the float4 or float8 domain.  That fails in ftoi4, ftoi8,  
and dtoi8, resulting in a possibility that values near the MAX limit will  
be wrongly converted (to negative values) when they need to be rejected.  
  
Also, because we compared before rounding off the fractional part,  
the other three functions threw errors for values that really ought  
to get rounded to the min or max integer value.  
  
Fix by doing rint() first (requiring an assumption that it handles  
NaN and Inf correctly; but dtoi8 and ftoi8 were assuming that already),  
and by comparing to values that should coerce to float exactly, namely  
INTxx_MIN and -INTxx_MIN.  Also remove some random cosmetic discrepancies  
between these six functions.  
  
Per bug #15519 from Victor Petrovykh.  This should get back-patched,  
but first let's see what the buildfarm thinks of it --- I'm not too  
sure about portability of some of the regression test cases.  
  
Patch by me; thanks to Andrew Gierth for analysis and discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/int8.c
M src/test/regress/expected/float4.out
M src/test/regress/expected/float8-small-is-zero.out
M src/test/regress/expected/float8.out
M src/test/regress/sql/float4.sql
M src/test/regress/sql/float8.sql

Add a 64-bit hash function for type hstore.

commit   : eb6f29141bed9dc95cb473614c30f470ef980705    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 13:37:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 13:37:34 -0500    

Click here for diff

There's some question about the correctness of the hash function, but  
if it's wrong, the 32-bit version is also wrong.  
  
Amul Sul, reviewed by Hironobu Suzuki  
  
Discussion: https://postgr.es/m/CAAJ_b947JjnNr9Cp45iNjSqKf6PA5mCTmKsRwPjows93YwQrmw@mail.gmail.com  

M contrib/hstore/Makefile
M contrib/hstore/expected/hstore.out
A contrib/hstore/hstore–1.5–1.6.sql
M contrib/hstore/hstore.control
M contrib/hstore/hstore_op.c
M contrib/hstore/sql/hstore.sql

Add a 64-bit hash function for type citext.

commit   : 48c41fa97480756b70ad095fe8d59199df9b12c7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 13:24:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 13:24:45 -0500    

Click here for diff

Amul Sul, reviewed by Hironobu Suzuki  
  
Discussion: https://postgr.es/m/CAAJ_b947JjnNr9Cp45iNjSqKf6PA5mCTmKsRwPjows93YwQrmw@mail.gmail.com  

M contrib/citext/Makefile
A contrib/citext/citext–1.5–1.6.sql
M contrib/citext/citext.c
M contrib/citext/citext.control
M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql

Clamp semijoin selectivity to be not more than inner-join selectivity.

commit   : a314c34079cf06d05265623dd7c056f8fa9d577f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 12:48:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 12:48:49 -0500    

Click here for diff

We should never estimate the output of a semijoin to be more rows than  
we estimate for an inner join with the same input rels and join condition;  
it's obviously impossible for that to happen.  However, given the  
relatively poor quality of our semijoin selectivity estimates ---  
particularly, but not only, in cases where we punt and return a default  
estimate --- we did often deliver such estimates.  To improve matters,  
calculate both estimates inside eqjoinsel() and take the smaller one.  
  
The bulk of this patch is just mechanical refactoring to avoid repetitive  
information lookup when we call both eqjoinsel_semi and eqjoinsel_inner.  
The actual new behavior is just  
  
	selec = Min(selec, inner_rel->rows * selec_inner);  
  
which looks a bit odd but is correct because of our different definitions  
for inner and semi join selectivity.  
  
There is one ensuing plan change in the regression tests, but it looks  
reasonable enough (and checking the actual row counts shows that the  
estimate moved closer to reality, not further away).  
  
Per bug #15160 from Alexey Ermakov.  Although this is arguably a bug fix,  
I won't risk destabilizing plan choices in stable branches by  
back-patching.  
  
Tom Lane, reviewed by Melanie Plageman  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/partition_join.out

Silence compiler warnings

commit   : 3be5fe2b107fae24e03c9d29d7bd7c7ad5345787    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Nov 2018 13:01:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Nov 2018 13:01:05 -0300    

Click here for diff

Commit cfdf4dc4fc96 left a few unnecessary assignments, one of which  
caused compiler warnings, as reported by Erik Rijkers.  Remove them all.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/postmaster/bgwriter.c
M src/test/modules/worker_spi/worker_spi.c

Remove bogus file.

commit   : 0f75a466ac41a19214d22de73cceeb5dc792411a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 10:20:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Nov 2018 10:20:52 -0500    

Click here for diff

D -

Don't allow partitioned indexes in pg_global tablespace

commit   : de38ce1b831eef0c1eddcb2d1439f134cd9cd02c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Nov 2018 08:44:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Nov 2018 08:44:15 -0300    

Click here for diff

Missing in dfa608141982.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f-M3NMTCpv=vDfkoqHbMPFf=3-Z1ud=+1DHH00tC+zLaQ@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

doc: Fix typo

commit   : a80dcac60cdc4b96a296d33288afa74a80f42cca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Nov 2018 11:41:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Nov 2018 11:41:27 +0100    

Click here for diff

M doc/src/sgml/protocol.sgml

Add WL_EXIT_ON_PM_DEATH pseudo-event.

commit   : cfdf4dc4fc9635ac8bf6eaaa5dbbcd364ab29f0c    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 23 Nov 2018 20:16:41 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 23 Nov 2018 20:16:41 +1300    

Click here for diff

Users of the WaitEventSet and WaitLatch() APIs can now choose between  
asking for WL_POSTMASTER_DEATH and then handling it explicitly, or asking  
for WL_EXIT_ON_PM_DEATH to trigger immediate exit on postmaster death.  
This reduces code duplication, since almost all callers want the latter.  
  
Repair all code that was previously ignoring postmaster death completely,  
or requesting the event but ignoring it, or requesting the event but then  
doing an unconditional PostmasterIsAlive() call every time through its  
event loop (which is an expensive syscall on platforms for which we don't  
have USE_POSTMASTER_DEATH_SIGNAL support).  
  
Assert that callers of WaitLatchXXX() under the postmaster remember to  
ask for either WL_POSTMASTER_DEATH or WL_EXIT_ON_PM_DEATH, to prevent  
future bugs.  
  
The only process that doesn't handle postmaster death is syslogger.  It  
waits until all backends holding the write end of the syslog pipe  
(including the postmaster) have closed it by exiting, to be sure to  
capture any parting messages.  By using the WaitEventSet API directly  
it avoids the new assertion, and as a by-product it may be slightly  
more efficient on platforms that have epoll().  
  
Author: Thomas Munro  
Reviewed-by: Kyotaro Horiguchi, Heikki Linnakangas, Tom Lane  
Discussion: https://postgr.es/m/CAEepm%3D1TCviRykkUb69ppWLr_V697rzd1j3eZsRMmbXvETfqbQ%40mail.gmail.com,  
            https://postgr.es/m/CAEepm=2LqHzizbe7muD7-2yHUbTOoF7Q+qkSD5Q41kuhttRTwA@mail.gmail.com  

A -
M contrib/pg_prewarm/autoprewarm.c
M contrib/postgres_fdw/connection.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/executor/nodeGather.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/pqmq.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/basebackup.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/misc.c
M src/include/storage/latch.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/worker_spi/worker_spi.c

Clarify documentation about PASSWORD in CREATE/ALTER ROLE

commit   : d392e9bdea957964e1fa6a5481e5adb5904d759a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 23 Nov 2018 09:10:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 23 Nov 2018 09:10:24 +0900    

Click here for diff

The documentation of CREATE/ALTER ROLE has been missing two things  
related to PASSWORD:  
- The password value provided needs to be quoted, some places of the  
documentation marked the field with quotes, but not others, which led to  
confusion.  
- PASSWORD NULL was not provided consistently, with ENCRYPTED being not  
compatible with it.  
  
Reported-by: Steven Winfield  
Author: Michael Paquier  
Reviewed-by: David G. Johnston  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/create_user.sgml

Fix another crash in json{b}_populate_recordset and json{b}_to_recordset.

commit   : eba2ce17121f198316d050e71d8bd049a43783ba    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Nov 2018 15:14:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Nov 2018 15:14:01 -0500    

Click here for diff

populate_recordset_worker() failed to consider the possibility that the  
supplied JSON data contains no rows, so that update_cached_tupdesc never  
got called.  This led to a null-pointer dereference since commit 9a5e8ed28;  
before that it led to a bogus "set-valued function called in context that  
cannot accept a set" error.  Fix by forcing the update to happen.  
  
Per bug #15514.  Back-patch to v11 as 9a5e8ed28 was.  (If we were excited  
about the bogus error, we could perhaps go back further, but it'd take more  
work to figure out how to fix it in older branches.  Given the lack of  
field complaints about that aspect, I'm not excited.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Doc: rework introductory documentation about covering indexes.

commit   : fe375d33a184b98510d08f45f55da1338cde974a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 22 Nov 2018 13:24:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 22 Nov 2018 13:24:57 -0500    

Click here for diff

Documenting INCLUDE in the section about unique indexes is confusing,  
as complained of by Emilio Platzer.  Furthermore, it entirely failed  
to explain why you might want to use the feature.  The section about  
index-only scans is really the right place; it already talked about  
making such things the hard way.  Rewrite that text to describe INCLUDE  
as the normal way to make a covering index.  
  
Also, move that section up a couple of places, as it now seems more  
important than some of the stuff we had before it.  It still has to  
be after expression and partial indexes, since otherwise some of it  
would involve forward references.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/indices.sgml

Fix typo in description of ExecFindPartition

commit   : 25c026c284de5ffb1ea5b007afc10158bfab64cb    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Nov 2018 13:23:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Nov 2018 13:23:54 +0900    

Click here for diff

Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqHg0=UL+Dhh3gpiwYNA=ufk9Lb7GQ2c=5rs=ZmVTP7xAw@mail.gmail.com  

M src/backend/executor/execPartition.c

doc: adjust time zone names text, v2

commit   : 9cf5d3c4867aaa6804be8fdf5a29bf28d0096320    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 21 Nov 2018 17:20:15 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 21 Nov 2018 17:20:15 -0500    

Click here for diff

Removed one too many words.  Fix for  
7906de847f229f391b9e6b5892b4b4a89f29edb4.  
  
Reported-by: Thomas Munro  
  
Backpatch-through: 9.4  

M doc/src/sgml/datatype.sgml

doc: adjust time zone names text

commit   : 7906de847f229f391b9e6b5892b4b4a89f29edb4    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 21 Nov 2018 16:55:40 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 21 Nov 2018 16:55:40 -0500    

Click here for diff

Reported-by: Kevin <[email protected]>  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

M doc/src/sgml/datatype.sgml

Rework the pgbench state machine code for clarity

commit   : 3bac77c48f166b9024a5ead984df73347466ae12    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Nov 2018 13:09:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Nov 2018 13:09:50 -0300    

Click here for diff

This commit continues the code improvements started by commit  
12788ae49e19.  With this commit, state machine transitions are better  
contained in the routine that was called doCustom() and is now called  
advanceConnectionState -- the resulting code is easier to reason about,  
since there are no state changes occuring in the outer layer.  
  
This change is prompted by future patches to add more features to  
pgbench, which will need to effect some more surgery to this code.  
  
Fabien's original had all the machine state changes inside one routine,  
but I (Álvaro) thought that a subroutine to handle command execution is  
more straightforward to review, so this commit does not match Fabien's  
submission closely.  If something is broken, it's probably my fault.  
  
Author: Fabien Coelho, Álvaro Herrera  
Reviewed-by: Kirk Jamison  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1808111104320.1705@lancre  

M src/bin/pgbench/pgbench.c

Fix typo in commit 6f7d02aa60b7

commit   : 03e10b962f3ada1953cf5bfc93b04459502e0993    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Nov 2018 15:35:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Nov 2018 15:35:40 -0300    

Click here for diff

Per pink buildfarm.  

M src/backend/executor/instrument.c

Fix PartitionDispatchData vertical whitespace

commit   : ee07e38c14a06a8479d2605406345c4a868465ae    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Nov 2018 15:21:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Nov 2018 15:21:00 -0300    

Click here for diff

Per David Rowley  
Discussion: https://postgr.es/m/CAKJS1f-MstvBWdkOzACsOHyBgj2oXcBM8kfv+NhVe-Ux-wq9Sg@mail.gmail.com  

M src/backend/executor/execPartition.c

instr_time.h: add INSTR_TIME_SET_CURRENT_LAZY

commit   : 6f7d02aa60b711c2a61d12b2f2f7ff4c5d5d6df4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Nov 2018 15:02:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Nov 2018 15:02:37 -0300    

Click here for diff

Sets the timestamp to current if not already set.  Will acquire more  
callers momentarily.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1808111104320.1705@lancre  

M src/backend/executor/instrument.c
M src/include/portability/instr_time.h

Blind attempt at fixing sepgsql output for 578b22.

commit   : 7306d5e920deb16f781797640715bf03f8d50d8c    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Nov 2018 21:02:38 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Nov 2018 21:02:38 -0800    

Click here for diff

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

Fix sepgsql compile error caused by oid removal.

commit   : 937e4e509998de93d5e1c04d312f1b13ef153210    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Nov 2018 20:03:46 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Nov 2018 20:03:46 -0800    

Click here for diff

Per buildfarm animal rhinoceros. I (Andres) missed replacing a few  
uses of ObjectIdAttributeNumber in sepgsql.  
  
It's quite probable that the sepgsql test output will need more  
adapting than done in 578b22...  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CAEepm=2Sk+66HJV8FLDfm_sKTn22j7cWTY_Y1Rok3RxeWL_Y0w@mail.gmail.com  

M contrib/sepgsql/database.c
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c

Remove WITH OIDS support, change oid catalog column visibility.

commit   : 578b229718e8f15fa779e20f086c4b6bb3776106    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 20 Nov 2018 15:36:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 20 Nov 2018 15:36:57 -0800    

Click here for diff

Previously tables declared WITH OIDS, including a significant fraction  
of the catalog tables, stored the oid column not as a normal column,  
but as part of the tuple header.  
  
This special column was not shown by default, which was somewhat odd,  
as it's often (consider e.g. pg_class.oid) one of the more important  
parts of a row.  Neither pg_dump nor COPY included the contents of the  
oid column by default.  
  
The fact that the oid column was not an ordinary column necessitated a  
significant amount of special case code to support oid columns. That  
already was painful for the existing, but upcoming work aiming to make  
table storage pluggable, would have required expanding and duplicating  
that "specialness" significantly.  
  
WITH OIDS has been deprecated since 2005 (commit ff02d0a05280e0).  
Remove it.  
  
Removing includes:  
- CREATE TABLE and ALTER TABLE syntax for declaring the table to be  
  WITH OIDS has been removed (WITH (oids[ = true]) will error out)  
- pg_dump does not support dumping tables declared WITH OIDS and will  
  issue a warning when dumping one (and ignore the oid column).  
- restoring an pg_dump archive with pg_restore will warn when  
  restoring a table with oid contents (and ignore the oid column)  
- COPY will refuse to load binary dump that includes oids.  
- pg_upgrade will error out when encountering tables declared WITH  
  OIDS, they have to be altered to remove the oid column first.  
- Functionality to access the oid of the last inserted row (like  
  plpgsql's RESULT_OID, spi's SPI_lastoid, ...) has been removed.  
  
The syntax for declaring a table WITHOUT OIDS (or WITH (oids = false)  
for CREATE TABLE) is still supported. While that requires a bit of  
support code, it seems unnecessary to break applications / dumps that  
do not use oids, and are explicit about not using them.  
  
The biggest user of WITH OID columns was postgres' catalog. This  
commit changes all 'magic' oid columns to be columns that are normally  
declared and stored. To reduce unnecessary query breakage all the  
newly added columns are still named 'oid', even if a table's column  
naming scheme would indicate 'reloid' or such.  This obviously  
requires adapting a lot code, mostly replacing oid access via  
HeapTupleGetOid() with access to the underlying Form_pg_*->oid column.  
  
The bootstrap process now assigns oids for all oid columns in  
genbki.pl that do not have an explicit value (starting at the largest  
oid previously used), only oids assigned later by oids will be above  
FirstBootstrapObjectId. As the oid column now is a normal column the  
special bootstrap syntax for oids has been removed.  
  
Oids are not automatically assigned during insertion anymore, all  
backend code explicitly assigns oids with GetNewOidWithIndex(). For  
the rare case that insertions into the catalog via SQL are called for  
the new pg_nextoid() function can be used (which only works on catalog  
tables).  
  
The fact that oid columns on system tables are now normal columns  
means that they will be included in the set of columns expanded  
by * (i.e. SELECT * FROM pg_class will now include the table's oid,  
previously it did not). It'd not technically be hard to hide oid  
column by default, but that'd mean confusing behavior would either  
have to be carried forward forever, or it'd cause breakage down the  
line.  
  
While it's not unlikely that further adjustments are needed, the  
scope/invasiveness of the patch makes it worthwhile to get merge this  
now. It's painful to maintain externally, too complicated to commit  
after the code code freeze, and a dependency of a number of other  
patches.  
  
Catversion bump, for obvious reasons.  
  
Author: Andres Freund, with contributions by John Naylor  
Discussion: https://postgr.es/m/[email protected]  

M contrib/adminpack/adminpack.c
M contrib/btree_gist/expected/cash.out
M contrib/btree_gist/expected/oid.out
M contrib/btree_gist/sql/cash.sql
M contrib/btree_gist/sql/oid.sql
M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_visibility/pg_visibility.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out
M contrib/sepgsql/label.c
M contrib/sepgsql/sql/alter.sql
M contrib/sepgsql/sql/ddl.sql
M contrib/test_decoding/test_decoding.c
M contrib/unaccent/unaccent.c
M doc/src/sgml/bki.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/file-fdw.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/copy.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/pg_dump.sgml
M doc/src/sgml/ref/select_into.sgml
M doc/src/sgml/release-9.1.sgml
M doc/src/sgml/release-9.2.sgml
M doc/src/sgml/release-9.3.sgml
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gistscan.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/tuptoaster.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/toasting.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumlazy.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execExpr.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execSRF.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/spi.c
M src/backend/foreign/foreign.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/large_object/inv_api.c
M src/backend/tcop/pquery.c
M src/backend/tsearch/wparser.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/postgresql.conf.sample
M src/backend/utils/mmgr/portalmem.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_upgrade/check.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/access/heapam.h
M src/include/access/htup_details.h
M src/include/access/reloptions.h
M src/include/access/sysattr.h
M src/include/access/tupdesc.h
M src/include/bootstrap/bootstrap.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/indexing.h
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_pltemplate.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/commands/copy.h
M src/include/commands/event_trigger.h
M src/include/executor/executor.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_clause.h
M src/include/utils/guc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/syscache.h
M src/interfaces/ecpg/preproc/ecpg.addons
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/plpgsql.h
M src/pl/tcl/expected/pltcl_queries.out
M src/pl/tcl/expected/pltcl_setup.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_queries.sql
M src/pl/tcl/sql/pltcl_setup.sql
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/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_predtest/test_predtest.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/enum.out
M src/test/regress/expected/errors.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/misc_sanity.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/prepare.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/reloptions.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/roleattributes.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/triggers.out
D src/test/regress/expected/without_oid.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/copy2.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/create_table_like.sql
M src/test/regress/sql/errors.sql
M src/test/regress/sql/foreign_data.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/misc_sanity.sql
M src/test/regress/sql/prepare.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/reloptions.sql
M src/test/regress/sql/replica_identity.sql
M src/test/regress/sql/roleattributes.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rowtypes.sql
M src/test/regress/sql/sanity_check.sql
M src/test/regress/sql/triggers.sql
D src/test/regress/sql/without_oid.sql
M src/tools/findoidjoins/findoidjoins.c

Improve description of buffer used to store records in WAL reader

commit   : 0999ac479292c12a7c373e612b15e1ff47077990    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 21 Nov 2018 08:43:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 21 Nov 2018 08:43:32 +0900    

Click here for diff

The dedicated private buffer to store records is used only for these  
crossing a page boundary since 285bd0ac, but its description did not  
match completely the reality.  
  
Reported-by: Andrey Lepikhov  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/xlogreader.h

Make detection of SSL_CTX_set_min_proto_version more portable

commit   : ea8bc349bd1d92a882d636b535723b36366d9fbe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Nov 2018 22:59:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Nov 2018 22:59:36 +0100    

Click here for diff

As already explained in configure.in, using the OpenSSL version number  
to detect presence of functions doesn't work, because LibreSSL reports  
incompatible version numbers.  Fortunately, the functions we need here  
are actually macros, so we can just test for them directly.  

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

Add settings to control SSL/TLS protocol version

commit   : e73e67c719593c1c16139cc6c516d8379f22f182    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Nov 2018 21:49:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Nov 2018 21:49:01 +0100    

Click here for diff

For example:  
  
    ssl_min_protocol_version = 'TLSv1.1'  
    ssl_max_protocol_version = 'TLSv1.2'  
  
Reviewed-by: Steve Singer <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/libpq.h

Make WAL description output more consistent

commit   : 2d9140ed266d702b305adeaf916086e1a586affe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Nov 2018 13:30:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Nov 2018 13:30:01 +0100    

Click here for diff

The output for record types XLOG_DBASE_CREATE and XLOG_DBASE_DROP used  
the order dbid/tablespaceid, whereas elsewhere the order is  
tablespaceid/dbid[/relfilenodeid].  Flip the order for those two types  
to make it consistent.  
  
Author: Jean-Christophe Arnu <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAHZmTm18Ln62KW-G8NYvO1wbBL3QU1E76Zep=DuHmg-zS2XFAg@mail.gmail.com/  

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

doc: Clarify CREATE TYPE ENUM documentation

commit   : 69bae23727253ca8b7616226020e241b8e923f4d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Nov 2018 10:42:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Nov 2018 10:42:43 +0100    

Click here for diff

The documentation claimed that an enum type requires "one or more"  
labels, but since 1fd9883ff49, zero labels are also allowed.  
  
Reported-by: Lukas Eder <[email protected]>  
Bug: #15356  

M doc/src/sgml/ref/create_type.sgml

Refine some guc.c help texts

commit   : a568cadaff2cfa0ec2a138ff4c5630050b03906b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Nov 2018 06:35:22 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Nov 2018 06:35:22 +0100    

Click here for diff

These settings apply to communication with the sending server, which  
is not necessarily a primary.  
  
Author: Sergei Kornilov <[email protected]>  

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

Fix issues with TAP tests of pg_verify_checksums

commit   : 9685d7383ab48ebe6a6213530f64e4dc67776583    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Nov 2018 10:20:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Nov 2018 10:20:52 +0900    

Click here for diff

Two issues have been spotted and get fixed here:  
- When checking for corrupted files, make sure that pg_verify_checksums  
complains about the correct file.  In order to make the logic more  
robust, all files created are immediately removed once checks on them  
are done.  The error message generated by pg_verify_checksums also now  
includes the file name it sees as corrupted.  
- Before running corruption-related tests, empty files are generated  
which used names mapping with the corrupted files, potentially leading  
to conflicts.  So use different set of names for both.  
  
Author: Michael Banck  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_verify_checksums/t/002_actions.pl

Add needed #include.

commit   : cb09903fe63132a35e4b217bc394882b05c0c6f3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 17:28:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 17:28:04 -0500    

Click here for diff

Per POSIX, WIFSIGNALED and related macros are provided by <sys/wait.h>.  
Apparently on Linux they're also pulled in by some other inclusions,  
but BSD-ish systems are pickier.  Fixes portability issue in ffa4cbd62.  
  
Per buildfarm.  

M src/backend/commands/copy.c

Handle EPIPE more sanely when we close a pipe reading from a program.

commit   : ffa4cbd623dd69f9fa99e5e92426928a5782cf1a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 17:02:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 17:02:25 -0500    

Click here for diff

Previously, any program launched by COPY TO/FROM PROGRAM inherited the  
server's setting of SIGPIPE handling, i.e. SIG_IGN.  Hence, if we were  
doing COPY FROM PROGRAM and closed the pipe early, the child process  
would see EPIPE on its output file and typically would treat that as  
a fatal error, in turn causing the COPY to report error.  Similarly,  
one could get a failure report from a query that didn't read all of  
the output from a contrib/file_fdw foreign table that uses file_fdw's  
PROGRAM option.  
  
To fix, ensure that child programs inherit SIG_DFL not SIG_IGN processing  
of SIGPIPE.  This seems like an all-around better situation since if  
the called program wants some non-default treatment of SIGPIPE, it would  
expect to have to set that up for itself.  Then in COPY, if it's COPY  
FROM PROGRAM and we stop reading short of detecting EOF, treat a SIGPIPE  
exit from the called program as a non-error condition.  This still allows  
us to report an error for any case where the called program gets SIGPIPE  
on some other file descriptor.  
  
As coded, we won't report a SIGPIPE if we stop reading as a result of  
seeing an in-band EOF marker (e.g. COPY BINARY EOF marker).  It's  
somewhat debatable whether we should complain if the called program  
continues to transmit data after an EOF marker.  However, it seems like  
we should avoid throwing error in any questionable cases, especially in a  
back-patched fix, and anyway it would take additional code to make such  
an error get reported consistently.  
  
Back-patch to v10.  We could go further back, since COPY FROM PROGRAM  
has been around awhile, but AFAICS the only way to reach this situation  
using core or contrib is via file_fdw, which has only supported PROGRAM  
sources since v10.  The COPY statement per se has no feature whereby  
it'd stop reading without having hit EOF or an error already.  Therefore,  
I don't see any upside to back-patching further that'd outweigh the  
risk of complaints about behavioral change.  
  
Per bug #15449 from Eric Cyr.  
  
Patch by me, review by Etsuro Fujita and Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/[email protected]  

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

psql: Describe partitioned tables/indexes as such

commit   : d56e0fde828b95497ce9acfb4ce18bab64803c82    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Nov 2018 16:54:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Nov 2018 16:54:26 -0300    

Click here for diff

In \d and \z, instead of conflating partitioned tables and indexes with  
plain ones, set the "type" column and table title differently to make  
the distinction obvious.  A simple ease-of-use improvement.  
  
Author: Pavel Stehule, Michaël Paquier, Álvaro Herrera  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/CAFj8pRDMWPgijpt_vPj1t702PgLG4Ls2NCf+rEcb+qGPpossmg@mail.gmail.com  

M src/bin/psql/describe.c
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/rowsecurity.out

Update config/ax_pthread.m4 to latest upstream version.

commit   : df303aff6601a893cf83c26ffd6c7eb5fb6b067e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 15:05:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 15:05:33 -0500    

Click here for diff

This change doesn't fix any bugs that we've heard about, but it seems  
like a good idea on general principles to track upstream occasionally.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/ax_pthread.m4
M configure

commit   : 640a4ba052c2dd7aaf600ca13b6d3afca60adc05    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 12:43:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 12:43:05 -0500    

Click here for diff

Calling AC_CHECK_DECLS before we've finished setting up the compiler's  
CFLAGS seems like a pretty risky proposition, especially now that the  
first use of that macro will result in a test to see whether the compiler  
gives warning or error for undeclared built-in functions.  That answer  
could very easily get changed later than where PGAC_LLVM_SUPPORT is  
called; furthermore, it's hardly unlikely that flags such as -D_GNU_SOURCE  
could change visibility of declarations.  Hence, be a little less cavalier  
about where to do LLVM-related tests.  This results in v11 and HEAD doing  
the warning-or-error check at the same place in the script as older  
branches are doing it, which seems like a good thing.  
  
Per further thought about commits 0b59b0e8b and 16fbac39f.  

M config/llvm.m4
M configure
M configure.in

psql: Show IP address in \conninfo

commit   : 6e5f8d489acccdc50a35a1b7db8e72b5ad579253    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Nov 2018 14:34:12 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Nov 2018 14:34:12 -0300    

Click here for diff

When hostaddr is given, the actual IP address that psql is connected to  
can be totally unexpected for the given host.  The more verbose output  
we now generate makes things clearer.  Since the "host" and "hostaddr"  
parts of the conninfo could come from different sources (say, one of  
them is in the service specification or a URI-style conninfo and the  
other is not), this is not as silly as it may first appear.  This is  
also definitely useful if the hostname resolves to multiple addresses.  
  
Author: Fabien Coelho  
Reviewed-by: Pavel Stehule, Arthur Zakirov  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1810261532380.27686@lancre  
	https://postgr.es/m/alpine.DEB.2.21.1808201323020.13832@lancre  

M doc/src/sgml/libpq.sgml
M src/bin/psql/command.c
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h

Reduce unnecessary list construction in RelationBuildPartitionDesc.

commit   : 7ee5f88e650619ee619f7e2854ac50ff59d0b0c7    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 19 Nov 2018 12:10:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 19 Nov 2018 12:10:41 -0500    

Click here for diff

The 'partoids' list which was constructed by the previous version  
of this code was necessarily identical to 'inhoids'.  There's no  
point to duplicating the list, so avoid that.  Instead, construct  
the array representation directly from the original 'inhoids' list.  
  
Also, use an array rather than a list for 'boundspecs'.  We know  
exactly how many items we need to store, so there's really no  
reason to use a list.  Using an array instead reduces the number  
of memory allocations we perform.  
  
Patch by me, reviewed by Michael Paquier and Amit Langote, the  
latter of whom also helped with rebasing.  

M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c
M src/include/partitioning/partbounds.h

Fix configure's AC_CHECK_DECLS tests to work correctly with clang.

commit   : 16fbac39ff68a737317f6fc7be78cc93a14856af    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 12:01:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Nov 2018 12:01:47 -0500    

Click here for diff

The test case that Autoconf uses to discover whether a function has  
been declared doesn't work reliably with clang, because clang reports  
a warning not an error if the name is a known built-in function.  
On some platforms, this results in a lot of compile-time warnings about  
strlcpy and related functions not having been declared.  
  
There is a fix for this (by Noah Misch) in the upstream Autoconf sources,  
but since they've not made a release in years and show no indication of  
doing so anytime soon, let's just absorb their fix directly.  We can  
revert this when and if we update to a newer Autoconf release.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M aclocal.m4
A config/check_decls.m4
M configure
M configure.in

Disallow COPY FREEZE on partitioned tables

commit   : 5c9a5513a3967367e5fcc9237bc4146f4b24b408    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Nov 2018 11:16:28 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Nov 2018 11:16:28 -0300    

Click here for diff

This didn't actually work: COPY would fail to flush the right files, and  
instead would try to flush a non-existing file, causing the whole  
transaction to fail.  
  
Cope by raising an error as soon as the command is sent instead, to  
avoid a nasty later surprise.  Of course, it would be much better to  
make it work, but we don't have a patch for that yet, and we don't know  
if we'll want to backpatch one when we do.  
  
Reported-by: Tomas Vondra  
Author: David Rowley  
Reviewed-by: Amit Langote, Steve Singer, Tomas Vondra  

M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/test/regress/input/copy.source
M src/test/regress/output/copy.source

pg_archivecleanup: Update file header comment a bit

commit   : fc47e99a157a56a92dea679a74d546e28b253bb7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Nov 2018 08:57:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Nov 2018 08:57:03 +0100    

Click here for diff

M src/bin/pg_archivecleanup/pg_archivecleanup.c

PANIC on fsync() failure.

commit   : 9ccdd7f66e3324d2b6d3dec282cfa9ff084083f1    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 19 Nov 2018 13:31:10 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 19 Nov 2018 13:31:10 +1300    

Click here for diff

On some operating systems, it doesn't make sense to retry fsync(),  
because dirty data cached by the kernel may have been dropped on  
write-back failure.  In that case the only remaining copy of the  
data is in the WAL.  A subsequent fsync() could appear to succeed,  
but not have flushed the data.  That means that a future checkpoint  
could apparently complete successfully but have lost data.  
  
Therefore, violently prevent any future checkpoint attempts by  
panicking on the first fsync() failure.  Note that we already  
did the same for WAL data; this change extends that behavior to  
non-temporary data files.  
  
Provide a GUC data_sync_retry to control this new behavior, for  
users of operating systems that don't eject dirty data, and possibly  
forensic/testing uses.  If it is set to on and the write-back error  
was transient, a later checkpoint might genuinely succeed (on a  
system that does not throw away buffers on failure); if the error is  
permanent, later checkpoints will continue to fail.  The GUC defaults  
to off, meaning that we panic.  
  
Back-patch to all supported releases.  
  
There is still a narrow window for error-loss on some operating  
systems: if the file is closed and later reopened and a write-back  
error occurs in the intervening time, but the inode has the bad  
luck to be evicted due to memory pressure before we reopen, we could  
miss the error.  A later patch will address that with a scheme  
for keeping files with dirty data open at all times, but we judge  
that to be too complicated to back-patch.  
  
Author: Craig Ringer, with some adjustments by Thomas Munro  
Reported-by: Craig Ringer  
Reviewed-by: Robert Haas, Thomas Munro, Andres Freund  
Discussion: https://postgr.es/m/20180427222842.in2e4mibx45zdth5%40alap3.anarazel.de  

M doc/src/sgml/config.sgml
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c
M src/backend/replication/logical/snapbuild.c
M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/storage/fd.h

Don't forget about failed fsync() requests.

commit   : 1556cb2fc5c774c3f7390dd6fb19190ee0c73f8b    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 19 Nov 2018 13:30:58 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 19 Nov 2018 13:30:58 +1300    

Click here for diff

If fsync() fails, md.c must keep the request in its bitmap, so that  
future attempts will try again.  
  
Back-patch to all supported releases.  
  
Author: Thomas Munro  
Reviewed-by: Amit Kapila  
Reported-by: Andrew Gierth  
Discussion: https://postgr.es/m/87y3i1ia4w.fsf%40news-spur.riddles.org.uk  

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

Rework documentation of pg_promote

commit   : 74171f8c12e68408f1fa895fdee36fdc8b0a9f79    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Nov 2018 13:20:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Nov 2018 13:20:22 +0900    

Click here for diff

This clarifies the behavior of how the "wait" flag works, which is  
something that the previous version of the documentation failed to do.  
  
Author: Ian Barwick  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Remove unnecessary memcpy when reading WAL record fitting on page

commit   : 285bd0ac4a7c0538d544c40aa725682e11cb71a9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Nov 2018 10:25:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Nov 2018 10:25:48 +0900    

Click here for diff

When reading a WAL record, its contents are copied into an intermediate  
buffer.  However, doing so is not necessary if the record fits fully  
into the current page, saving one memcpy for each such record.  The  
allocation handling of the intermediate buffer is also now done only  
when a record crosses a page boundary, shaving some extra cycles when  
reading a WAL record.  
  
Author: Andrey Lepikhov  
Reviewed-by: Kyotaro Horiguchi, Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

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

fix typo

commit   : 79376e07128fbf3c92f4e1fb457be435afa2e6a6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 18 Nov 2018 12:43:03 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 18 Nov 2018 12:43:03 -0500    

Click here for diff

M src/pl/plperl/plperl.h

Silence MSVC warnings about redefinition of isnan

commit   : d5d7f7f3b78e00009ee87ad01d1fb87b28968f65    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 18 Nov 2018 12:36:31 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 18 Nov 2018 12:36:31 -0500    

Click here for diff

Some versions of perl.h define isnan when the compiler is MSVC. To avoid  
warnings about this, undefine the symbol before including perl.h and  
re-add the definition afterwards if it wasn't recreated.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plperl/plperl.h

Fix AC_REQUIRES breakage in LLVM autoconf tests.

commit   : 0b59b0e8bcc9e85bad6fffa7828344db1a36f20a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Nov 2018 23:16:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Nov 2018 23:16:00 -0500    

Click here for diff

Any Autoconf macro that uses AC_REQUIRES -- directly or indirectly --  
must not be inside a plain shell "if" test; if it is, whatever code  
gets pulled in by the AC_REQUIRES will also be inside that "if".  
Instead of "if" we can use AS_IF, which knows how to get this right  
(cf commit 01051a987).  
  
The only immediate problem from getting this wrong was that AC_PROG_AWK  
had to be run twice, once inside the "if llvm" block and once in the  
main line.  However, it broke a different patch I'm about to submit  
more thoroughly.  

M configure
M configure.in

Add valgrind suppressions for wcsrtombs optimizations

commit   : d3bbc4b96a5b4d055cf636596c6865913a099929    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 17 Nov 2018 23:50:21 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 17 Nov 2018 23:50:21 +0100    

Click here for diff

wcsrtombs (called through wchar2char from common functions like lower,  
upper, etc.) uses various optimizations that may look like access to  
uninitialized data, triggering valgrind reports.  
  
For example AVX2 instructions load data in 256-bit chunks, and  gconv  
does something similar with 32-bit chunks.  This is faster than accessing  
the bytes one by one, and the uninitialized part of the buffer is not  
actually used. So suppress the bogus reports.  
  
The exact stack depends on possible optimizations - it might be AVX, SSE  
(as in the report by Aleksander Alekseev) or something else. Hence the  
last frame is wildcarded, to deal with this.  
  
Backpatch all the way back to 9.4.  
  
Author: Tomas Vondra  
Discussion: https://www.postgresql.org/message-id/flat/90ac0452-e907-e7a4-b3c8-15bd33780e62%402ndquadrant.com  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/tools/valgrind.supp

Avoid defining SIGTTIN/SIGTTOU on Windows.

commit   : 37afc079abe1986b4af94aa8ec28cefd663aaae6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Nov 2018 16:31:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Nov 2018 16:31:07 -0500    

Click here for diff

Setting them to SIG_IGN seems unlikely to have any beneficial effect  
on that platform, and given the signal numbering collision with SIGABRT,  
it could easily have bad effects.  
  
Given the lack of field complaints that can be traced to this, I don't  
presently feel a need to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c
M src/include/port/win32_port.h

Leave SIGTTIN/SIGTTOU signal handling alone in postmaster child processes.

commit   : 125f551c8be101ec36ec5fed5befc8fbf7370e0a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Nov 2018 16:23:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Nov 2018 16:23:55 -0500    

Click here for diff

For reasons lost in the mists of time, most postmaster child processes  
reset SIGTTIN/SIGTTOU signal handling to SIG_DFL, with the major exception  
that backend sessions do not.  It seems like a pretty bad idea for any  
postmaster children to do that: if stderr is connected to the terminal,  
and the user has put the postmaster in background, any log output would  
result in the child process freezing up.  Hence, switch them all to  
doing what backends do, ie, nothing.  This allows them to inherit the  
postmaster's SIG_IGN setting.  On the other hand, manually-launched  
processes such as standalone backends will have default processing,  
which seems fine.  
  
In passing, also remove useless resets of SIGCONT and SIGWINCH signal  
processing.  Perhaps the postmaster once changed those to something  
besides SIG_DFL, but it doesn't now, so these are just wasted (and  
confusing) syscalls.  
  
Basically, this propagates the changes made in commit 8e2998d8a from  
backends to other postmaster children.  Probably the only reason these  
calls now exist elsewhere is that I missed changing pgstat.c along with  
postgres.c at the time.  
  
Given the lack of field complaints that can be traced to this, I don't  
presently feel a need to back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c

Fix some spurious new compiler warnings in MSVC.

commit   : 73616126b4dcd01c833b06d4572959734f38b163    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 17 Nov 2018 11:41:14 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 17 Nov 2018 11:41:14 -0800    

Click here for diff

Per buildfarm animal bowerbird.  
  
Discussion: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2018-11-17%2002%3A30%3A20  

M src/backend/executor/execTuples.c

Make TupleTableSlots extensible, finish split of existing slot type.

commit   : 4da597edf1bae0cf0453b5ed6fc4347b6334dfe1    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Nov 2018 16:35:11 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Nov 2018 16:35:11 -0800    

Click here for diff

This commit completes the work prepared in 1a0586de36, splitting the  
old TupleTableSlot implementation (which could store buffer, heap,  
minimal and virtual slots) into four different slot types.  As  
described in the aforementioned commit, this is done with the goal of  
making tuple table slots extensible, to allow for pluggable table  
access methods.  
  
To achieve runtime extensibility for TupleTableSlots, operations on  
slots that can differ between types of slots are performed using the  
TupleTableSlotOps struct provided at slot creation time.  That  
includes information from the size of TupleTableSlot struct to be  
allocated, initialization, deforming etc.  See the struct's definition  
for more detailed information about callbacks TupleTableSlotOps.  
  
I decided to rename TTSOpsBufferTuple to TTSOpsBufferHeapTuple and  
ExecCopySlotTuple to ExecCopySlotHeapTuple, as that seems more  
consistent with other naming introduced in recent patches.  
  
There's plenty optimization potential in the slot implementation, but  
according to benchmarking the state after this commit has similar  
performance characteristics to before this set of changes, which seems  
sufficient.  
  
There's a few changes in execReplication.c that currently need to poke  
through the slot abstraction, that'll be repaired once the pluggable  
storage patchset provides the necessary infrastructure.  
  
Author: Andres Freund and  Ashutosh Bapat, with changes by Amit Khandekar  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/backend/catalog/index.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execReplication.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/spi.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/access/htup_details.h
M src/include/executor/tuptable.h
M src/include/jit/llvmjit.h

Avoid re-typedef'ing PartitionTupleRouting

commit   : 0201d79a5549e3375ea5e5aee351378399453f15    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Nov 2018 16:55:44 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Nov 2018 16:55:44 -0300    

Click here for diff

Apparently, gcc on macOS (?) doesn't like it.  
  
Per buildfarm.  

M src/backend/executor/execPartition.c

pgbench: introduce a RandomState struct

commit   : 409231919443984635b7ae9b7e2e261ab984eb1e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Nov 2018 15:43:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Nov 2018 15:43:40 -0300    

Click here for diff

This becomes useful when used to retry a transaction after a  
serialization error or deadlock abort.  (We don't yet have that feature,  
but this is preparation for it.)  
  
While at it, use separate random state for thread administratrivia such  
as deciding which script to run, how long to delay for throttling, or  
whether to log a message when sampling; this not only makes these tasks  
independent of each other, but makes the actual thread run  
deterministic.  
  
Author: Marina Polyakova  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Inline hot path of slot_getsomeattrs().

commit   : a7aa608e0f5910f9c73a530a66142c08e3d9043a    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Nov 2018 10:25:34 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Nov 2018 10:25:34 -0800    

Click here for diff

This yields a minor speedup, which roughly balances the loss from the  
upcoming introduction of callbacks to do some operations on slots.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/executor/execTuples.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/executor/tuptable.h
M src/include/jit/llvmjit.h

Redesign initialization of partition routing structures

commit   : 3f2393edefa5ef2b6970a5a2fa2c7e9c55cc10cf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Nov 2018 14:54:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Nov 2018 14:54:15 -0300    

Click here for diff

This speeds up write operations (INSERT, UPDATE, DELETE, COPY, as well  
as the future MERGE) on partitioned tables.  
  
This changes the setup for tuple routing so that it does far less work  
during the initial setup and pushes more work out to when partitions  
receive tuples.  PartitionDispatchData structs for sub-partitioned  
tables are only created when a tuple gets routed through it.  The  
possibly large arrays in the PartitionTupleRouting struct have largely  
been removed.  The partitions[] array remains but now never contains any  
NULL gaps.  Previously the NULLs had to be skipped during  
ExecCleanupTupleRouting(), which could add a large overhead to the  
cleanup when the number of partitions was large.  The partitions[] array  
is allocated small to start with and only enlarged when we route tuples  
to enough partitions that it runs out of space. This allows us to keep  
simple single-row partition INSERTs running quickly.  Redesign  
  
The arrays in PartitionTupleRouting which stored the tuple translation maps  
have now been removed.  These have been moved out into a  
PartitionRoutingInfo struct which is an additional field in ResultRelInfo.  
  
The find_all_inheritors() call still remains by far the slowest part of  
ExecSetupPartitionTupleRouting(). This commit just removes the other slow  
parts.  
  
In passing also rename the tuple translation maps from being ParentToChild  
and ChildToParent to being RootToPartition and PartitionToRoot. The old  
names mislead you into thinking that a partition of some sub-partitioned  
table would translate to the rowtype of the sub-partitioned table rather  
than the root partitioned table.  
  
Authors: David Rowley and Amit Langote, heavily revised by Álvaro Herrera  
Testing help from Jesper Pedersen and Kato Sho.  
Discussion: https://postgr.es/m/CAKJS1f_1RJyFquuCKRFHTdcXqoPX-PYqAd7nz=GVBwvGh4a6xA@mail.gmail.com  

M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/utils/cache/partcache.c
M src/include/catalog/partition.h
M src/include/executor/execPartition.h
M src/include/nodes/execnodes.h

Fix slot type assumptions for nodeGather[Merge].

commit   : a387a3dff9001225ad571ff2755d139f5bd193b3    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 23:10:50 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 23:10:50 -0800    

Click here for diff

The assumption made in 1a0586de3657c was wrong, as evidenced by  
buildfarm failure on locust, which runs with  
force_parallel_mode=regress.  The tuples accessed in either nodes are  
in the outer slot, and we can't trivially rely on the slot type being  
known because the leader might execute the subsidiary node directly,  
or via the tuple queue on a worker. In the latter case the tuple will  
always be a heaptuple slot, but in the former, it'll be whatever the  
subsidiary node returns.  

M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c

Add dummy field to currently empty struct TupleTableSlotOps.

commit   : f92cd7392386147f6a16787c1d5c78d0e9b7cf34    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:29:50 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:29:50 -0800    

Click here for diff

Per MSVC complaint on buildfarm member dory.  

M src/include/executor/tuptable.h

Don't generate tuple deforming functions for virtual slots.

commit   : 7ef04e4d2cb287e4e28b87f24b4b36ef4e07530b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:00:30 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:00:30 -0800    

Click here for diff

Virtual tuple table slots never need tuple deforming. Therefore, if we  
know at expression compilation time, that a certain slot will always  
be virtual, there's no need to create a tuple deforming routine for  
it.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/include/jit/llvmjit.h

Verify that expected slot types match returned slot types.

commit   : 15d8f83128e15de97de61430d0b9569f5ebecc26    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:00:30 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:00:30 -0800    

Click here for diff

This is important so JIT compilation knows what kind of tuple slot the  
deforming routine can expect. There's also optimization potential for  
expression initialization without JIT compilation. It e.g. seems  
plausible to elide EEOP_*_FETCHSOME ops entirely when dealing with  
virtual slots.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c

Compute information about EEOP_*_FETCHSOME at expression init time.

commit   : 675af5c01e297262cd20d7416f7e568393c22c6e    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:00:30 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:00:30 -0800    

Click here for diff

Previously this information was computed when JIT compiling an  
expression.  But the information is useful for assertions in the  
non-JIT case too (for assertions), therefore it makes sense to move  
it.  
  
This will, in a followup commit, allow to treat different slot types  
differently. E.g. for virtual slots there's no need to generate a JIT  
function to deform the slot.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/include/executor/execExpr.h

Introduce notion of different types of slots (without implementing them).

commit   : 1a0586de3657cd35581f0639c87d5050c6197bb7    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:00:30 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 22:00:30 -0800    

Click here for diff

Upcoming work intends to allow pluggable ways to introduce new ways of  
storing table data. Accessing those table access methods from the  
executor requires TupleTableSlots to be carry tuples in the native  
format of such storage methods; otherwise there'll be a significant  
conversion overhead.  
  
Different access methods will require different data to store tuples  
efficiently (just like virtual, minimal, heap already require fields  
in TupleTableSlot). To allow that without requiring additional pointer  
indirections, we want to have different structs (embedding  
TupleTableSlot) for different types of slots.  Thus different types of  
slots are needed, which requires adapting creators of slots.  
  
The slot that most efficiently can represent a type of tuple in an  
executor node will often depend on the type of slot a child node  
uses. Therefore we need to track the type of slot is returned by  
nodes, so parent slots can create slots based on that.  
  
Relatedly, JIT compilation of tuple deforming needs to know which type  
of slot a certain expression refers to, so it can create an  
appropriate deforming function for the type of tuple in the slot.  
  
But not all nodes will only return one type of slot, e.g. an append  
node will potentially return different types of slots for each of its  
subplans.  
  
Therefore add function that allows to query the type of a node's  
result slot, and whether it'll always be the same type (whether it's  
fixed). This can be queried using ExecGetResultSlotOps().  
  
The scan, result, inner, outer type of slots are automatically  
inferred from ExecInitScanTupleSlot(), ExecInitResultSlot(),  
left/right subtrees respectively. If that's not correct for a node,  
that can be overwritten using new fields in PlanState.  
  
This commit does not introduce the actually abstracted implementation  
of different kind of TupleTableSlots, that will be left for a followup  
commit.  The different types of slots introduced will, for now, still  
use the same backing implementation.  
  
While this already partially invalidates the big comment in  
tuptable.h, it seems to make more sense to update it later, when the  
different TupleTableSlot implementations actually exist.  
  
Author: Ashutosh Bapat and Andres Freund, with changes by Amit Khandekar  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/commands/analyze.c
M src/backend/commands/constraint.c
M src/backend/commands/copy.c
M src/backend/commands/explain.c
M src/backend/commands/functioncmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execExpr.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execSRF.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/partitioning/partbounds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walsender.c
M src/backend/tcop/pquery.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/sort/tuplesort.c
M src/include/executor/executor.h
M src/include/executor/tuptable.h
M src/include/nodes/execnodes.h

Rejigger materializing and fetching a HeapTuple from a slot.

commit   : 763f2edd92095b1ca2f4476da073a28505c13820    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 14:26:14 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 14:26:14 -0800    

Click here for diff

Previously materializing a slot always returned a HeapTuple. As  
current work aims to reduce the reliance on HeapTuples (so other  
storage systems can work efficiently), that needs to change. Thus  
split the tasks of materializing a slot (i.e. making it independent  
from the underlying storage / other memory contexts) from fetching a  
HeapTuple from the slot.  For brevity, allow to fetch a HeapTuple from  
a slot and materializing the slot at the same time, controlled by a  
parameter.  
  
For now some callers of ExecFetchSlotHeapTuple, with materialize =  
true, expect that changes to the heap tuple will be reflected in the  
underlying slot.  Those places will be adapted in due course, so while  
not pretty, that's OK for now.  
  
Also rename ExecFetchSlotTuple to ExecFetchSlotHeapTupleDatum and  
ExecFetchSlotTupleDatum to ExecFetchSlotHeapTupleDatum, as it's likely  
that future storage methods will need similar methods. There already  
is ExecFetchSlotMinimalTuple, so the new names make the naming scheme  
more coherent.  
  
Author: Ashutosh Bapat and Andres Freund, with changes by Amit Khandekar  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/tqueue.c
M src/include/executor/tuptable.h

A small tweak to some comments for PartitionKeyData

commit   : 7ac0069fb880b9b64223f104058c82773321851c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Nov 2018 23:22:19 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Nov 2018 23:22:19 +0100    

Click here for diff

It was not really that obvious that there's meant to be exactly 1 item  
in the partexprs List for each zero-valued partattrs element.  Some  
incorrect code using these fields was the cause of CVE-2018-1052, so  
it's worthwhile to mention how they should be used in the comments.  
  
Author: David Rowley <[email protected]>  

M src/include/utils/partcache.h

Correct code comments for PartitionedRelPruneInfo struct

commit   : 52d8e899d0f0849f9dfc61a9f93ba857a8431216    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Nov 2018 23:04:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Nov 2018 23:04:48 +0100    

Click here for diff

The comments above the PartitionedRelPruneInfo struct incorrectly  
document how subplan_map and subpart_map are indexed.  This seems to  
have snuck in on 4e232364033.  
  
Author: David Rowley <[email protected]>  

M src/include/nodes/plannodes.h

Update executor documentation for run-time partition pruning

commit   : 86a4819f691ba08bef0eba03dcf9be7bd1ca1c89    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Nov 2018 23:02:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Nov 2018 23:02:21 +0100    

Click here for diff

With run-time partition pruning, there is no longer necessarily an  
executor node for each corresponding plan node.  
  
Author: David Rowley <[email protected]>  

M src/backend/executor/README

Rationalize expression context reset in ExecModifyTable().

commit   : c058fc2a2b8ea25015b211186c88a6a3006f5937    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 13 Nov 2018 12:18:25 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 13 Nov 2018 12:18:25 -0800    

Click here for diff

The current pattern of reseting expressions both in  
ExecProcessReturning() and ExecOnConflictUpdate() makes it harder than  
necessary to reason about memory lifetimes.  It also requires  
materializing slots unnecessarily, although this patch doesn't take  
advantage of the fact that that's not necessary anymore.  
  
Instead reset the expression context once for each input tuple.  
  
Author: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Make reformat-dat-files, reformat-dat-files VPATH safe.

commit   : 6a744413ea0c0c114348c4c010aa9f909c83d3f3    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 11:35:07 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 15 Nov 2018 11:35:07 -0800    

Click here for diff

The reformat_dat_file.pl script, added by 372728b0d49552641, supported  
all the necessary options to make it work in a VPATH build, but the  
makefile invocations didn't take VPATH into account. Fix that.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where 372728b0d49552641 was merged  

M src/include/catalog/Makefile

Improve performance of partition pruning remapping a little.

commit   : 34c9e455d0efcada8821ffaab61741c2e1153458    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Nov 2018 13:34:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Nov 2018 13:34:16 -0500    

Click here for diff

ExecFindInitialMatchingSubPlans has to update the PartitionPruneState's  
subplan mapping data to account for the removal of subplans it prunes.  
However, that's only necessary if run-time pruning will also occur,  
so we can skip it when that won't happen, which should result in not  
needing to do the remapping in many cases.  (We now need it only when  
some partitions are potentially startup-time prunable and others are  
potentially run-time prunable, which seems like an unusual case.)  
  
Also make some marginal performance improvements in the remapping  
itself.  These will mainly win if most partitions got pruned by  
the startup-time pruning, which is perhaps a debatable assumption  
in this context.  
  
Also fix some bogus comments, and rearrange code to marginally  
reduce space consumption in the executor's query-lifespan context.  
  
David Rowley, reviewed by Yoshikazu Imai  
  
Discussion: https://postgr.es/m/CAKJS1f9+m6-di-zyy4B4AGn0y1B9F8UKDRigtBbNviXOkuyOpw@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

geo_ops.c: Clarify comments and function arguments

commit   : 74514bd4a58dcf763d105e60a41a5f1b3eea6865    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Nov 2018 12:08:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Nov 2018 12:08:03 -0300    

Click here for diff

These functions were not crystal clear about what their respective APIs  
are.  Make an effort to improve that.  
  
Emre's patch was correct AFAICT, but I (Álvaro) felt the need to improve  
a few comments a bit more.  Any resulting errors are my own.  
  
Per complaint from Coverity, Ning Yu, and Tom Lane.  
  
Author: Emre Hasegeli, Álvaro Herrera  
Reviewed-by: Tomas Vondra, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Fix the omission in docs.

commit   : 621a8ac5af8cf7c7799e8b704108b83be89267dd    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 15 Nov 2018 10:56:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 15 Nov 2018 10:56:49 +0530    

Click here for diff

Commit 5373bc2a08 has added type for background workers but forgot to  
update at one place in the documentation.  
  
Reported-by: John Naylor  
Author: John Naylor  
Reviewed-by: Amit Kapila  
Backpatch-through: 11  
Discussion: https://postgr.es/m/CAJVSVGVmvgJ8Lq4WBxC3zV5wf0txdCqRSgkWVP+jaBF=HgWscA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Further adjustment to random() seed initialization.

commit   : ab8984f52d9b99234d23e6fb7b73cf4c12b3ac14    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 15 Nov 2018 17:10:43 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 15 Nov 2018 17:10:43 +1300    

Click here for diff

Per complaint from Tom Lane, don't chomp the timestamp at 32 bits, so we  
can shift in some of its higher bits.  
  
Discussion: https://postgr.es/m/14712.1542253115%40sss.pgh.pa.us  

M src/backend/postmaster/postmaster.c

Increase the number of possible random seeds per time period.

commit   : 5b0ce3ec334bb65bbab4aba78f204f986c356e80    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 15 Nov 2018 16:25:30 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 15 Nov 2018 16:25:30 +1300    

Click here for diff

Commit 197e4af9 refactored the initialization of the libc random()  
seed, but reduced the number of possible seeds values that could be  
chosen in a given time period.  This negation of the effects of  
commit 98c50656c was unintentional.  Replace with code that  
shifts the fast moving timestamp bits left, similar to the original  
algorithm (though not the previous float-tolerating coding, which  
is no longer necessary).  
  
Author: Thomas Munro  
Reported-by: Noah Misch  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20181112083358.GA1073796%40rfd.leadboat.com  

M src/backend/postmaster/postmaster.c

Use 64 bit type for BufFileSize().

commit   : aa5518304213a762b62ebe3dbb057d220d8976eb    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 15 Nov 2018 12:34:04 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 15 Nov 2018 12:34:04 +1300    

Click here for diff

BufFileSize() can't use off_t, because it's only 32 bits wide on  
some systems.  BufFile objects can have many 1GB segments so the  
total size can exceed 2^31.  The only known client of the function  
is parallel CREATE INDEX, which was reported to fail when building  
large indexes on Windows.  
  
Though this is technically an ABI break on platforms with a 32 bit  
off_t and we might normally avoid back-patching it, the function is  
brand new and thus unlikely to have been discovered by extension  
authors yet, and it's fairly thoroughly broken on those platforms  
anyway, so just fix it.  
  
Defect in 9da0cc35.  Bug #15460.  Back-patch to 11, where this  
function landed.  
  
Author: Thomas Munro  
Reported-by: Paul van der Linden, Pavel Oskin  
Reviewed-by: Peter Geoghegan  
Discussion: https://postgr.es/m/15460-b6db80de822fa0ad%40postgresql.org  
Discussion: https://postgr.es/m/CAHDGBJP_GsESbTt4P3FZA8kMUKuYxjg57XHF7NRBoKnR%3DCAR-g%40mail.gmail.com  

M src/backend/storage/file/buffile.c
M src/backend/utils/sort/logtape.c
M src/include/storage/buffile.h

Make psql's "\pset format" command reject non-unique abbreviations.

commit   : eaf746a5b85a6a794e659f0954cf0015e42213f4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Nov 2018 16:39:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Nov 2018 16:39:59 -0500    

Click here for diff

The previous behavior of preferring the oldest match had the advantage  
of not breaking existing scripts when we add a conflicting format name;  
but that behavior was undocumented and fragile (it seems just luck that  
commit add9182e5 didn't break it).  Let's go over to the less mistake-  
prone approach of complaining when there are multiple matches.  
  
Since this is a small compatibility break, no back-patch.  
  
Daniel Vérité  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

Doc: remove claim that all \pset format options are unique in 1 letter.

commit   : 51eaaafb850bc6d450cf2f63c0952078255ac4ca    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Nov 2018 16:29:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Nov 2018 16:29:57 -0500    

Click here for diff

This hasn't been correct since 9.3 added "latex-longtable".  
  
I left the phraseology "Unique abbreviations are allowed" alone.  
It's correct as far as it goes, and we are studiously refraining  
from specifying exactly what happens if you give a non-unique  
abbreviation.  (The answer in the back branches is "you get a  
backwards-compatible choice", and the answer in HEAD will shortly  
be "you get an error", but there seems no need to mention such  
details here.)  
  
Daniel Vérité  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add a timezone-specific variant of date_trunc().

commit   : 600b04d6b5ef6c9ad3ea684aad40260bd60d5872    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Nov 2018 15:41:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Nov 2018 15:41:07 -0500    

Click here for diff

date_trunc(field, timestamptz, zone_name) performs truncation using  
the named time zone as reference, rather than working in the session  
time zone as is the default behavior.  It's equivalent to  
  
date_trunc(field, timestamptz at time zone zone_name) at time zone zone_name  
  
but it's faster, easier to type, and arguably easier to understand.  
  
Vik Fearing and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

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

Second try at fixing numeric data passed through an ECPG SQLDA.

commit   : 06c723447b6b8fc7e394cd2ad23785a6e54e36da    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Nov 2018 11:27:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Nov 2018 11:27:30 -0500    

Click here for diff

In commit ecfd55795, I removed sqlda.c's checks for ndigits != 0 on the  
grounds that we should duplicate the state of the numeric value's digit  
buffer even when all the digits are zeroes.  However, that still isn't  
quite right, because another possible state of the digit buffer is  
buf == digits == NULL (this occurs for a NaN).  As the code now stands,  
it'll invoke memcpy with a NULL source address and zero bytecount,  
which we know a few platforms crash on.  Hence, reinstate the no-copy  
short-circuit, but make it test specifically for buf != NULL rather than  
some other condition.  In hindsight, the ndigits test (added by commit  
f2ae9f9c3) was almost certainly meant to fix the NaN case not the  
all-zeroes case as the associated thread alleged.  
  
As before, back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905C71161@g01jpexmbkw24  

M src/interfaces/ecpg/ecpglib/sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.stderr
M src/interfaces/ecpg/test/expected/sql-sqlda.stdout
M src/interfaces/ecpg/test/sql/sqlda.pgc

Lower lock level for renaming indexes

commit   : 1b5d797cd4f7133ff0d18e123fcf41c67a5a7b0b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Oct 2018 08:33:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Oct 2018 08:33:17 +0100    

Click here for diff

Change lock level for renaming index (either ALTER INDEX or implicitly  
via some other commands) from AccessExclusiveLock to  
ShareUpdateExclusiveLock.  
  
One reason we need a strong lock for relation renaming is that the  
name change causes a rebuild of the relcache entry.  Concurrent  
sessions that have the relation open might not be able to handle the  
relcache entry changing underneath them.  Therefore, we need to lock  
the relation in a way that no one can have the relation open  
concurrently.  But for indexes, the relcache handles reloads specially  
in RelationReloadIndexInfo() in a way that keeps changes in the  
relcache entry to a minimum.  As long as no one keeps pointers to  
rd_amcache and rd_options around across possible relcache flushes,  
which is the case, this ought to be safe.  
  
We also want to use a self-exclusive lock for correctness, so that  
concurrent DDL doesn't overwrite the rename if they start updating  
while still seeing the old version.  Therefore, we use  
ShareUpdateExclusiveLock, which is already used by other DDL commands  
that want to operate in a concurrent manner.  
  
The reason this is interesting at all is that renaming an index is a  
typical part of a concurrent reindexing workflow (CREATE INDEX  
CONCURRENTLY new + DROP INDEX CONCURRENTLY old + rename back).  And  
indeed a future built-in REINDEX CONCURRENTLY might rely on the ability  
to do concurrent renames as well.  
  
Reviewed-by: Andrey Klychkov <[email protected]>  
Reviewed-by: Fabrízio de Royes Mello <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/alter_index.sgml
M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/include/commands/tablecmds.h

Initialize TransactionState and user ID consistently at transaction start

commit   : b4721f39505b56dd7b556aef5428a0850230ca59    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Nov 2018 16:46:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Nov 2018 16:46:53 +0900    

Click here for diff

If a failure happens when a transaction is starting between the moment  
the transaction status is changed from TRANS_DEFAULT to TRANS_START and  
the moment the current user ID and security context flags are fetched  
via GetUserIdAndSecContext(), or before initializing its basic fields,  
then those may get reset to incorrect values when the transaction  
aborts, leaving the session in an inconsistent state.  
  
One problem reported is that failing a starting transaction at the first  
query of a session could cause several kinds of system crashes on the  
follow-up queries.  
  
In order to solve that, move the initialization of the transaction state  
fields and the call of GetUserIdAndSecContext() in charge of fetching  
the current user ID close to the point where the transaction status is  
switched to TRANS_START, where there cannot be any error triggered  
in-between, per an idea of Tom Lane.  This properly ensures that the  
current user ID, the security context flags and that the basic fields of  
TransactionState remain consistent even if the transaction fails while  
starting.  
  
Reported-by: Richard Guo  
Diagnosed-By: Richard Guo  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAN_9JTxECSb=pEPcb0a8d+6J+bDcOZ4=DgRo_B7Y5gRHJUM=Rw@mail.gmail.com  
Backpatch-through: 9.4  

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

Add flag values in WAL description to all heap records

commit   : 3be97b97ed37b966173f027091f21d8a7605e2a5    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Nov 2018 10:33:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Nov 2018 10:33:10 +0900    

Click here for diff

Hexadecimal is consistently used as format to not bloat too much the  
output but keep it readable.  This information is useful mainly for  
debugging purposes with for example pg_waldump.  
  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart, Dmitry Dolgov, Andres Freund, Álvaro  
Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor code creating PartitionBoundInfo

commit   : b52b7dc250bba74fbaed685af4a37b450a0e2726    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Nov 2018 10:01:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Nov 2018 10:01:49 +0900    

Click here for diff

The code building PartitionBoundInfo based on the constituent partition  
data read from catalogs has been located in partcache.c, with a specific  
set of routines dedicated to bound types, like sorting or bound data  
creation.  All this logic is moved to partbounds.c and relocates all the  
bound-specific logistic into it, with partition_bounds_create() as  
principal entry point.  
  
Author: Amit Langote  
Reviewed-by: Michael Paquier, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c
M src/include/partitioning/partbounds.h

Add INSERT ON CONFLICT test on partitioned tables with transition table

commit   : 9079fe60b2142da6e89403b9a9504e75124c085d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 13 Nov 2018 18:12:39 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 13 Nov 2018 18:12:39 -0300    

Click here for diff

This case was uncovered by existing tests, so breakage went undetected.  
Make sure it remains stable.  
  
Extracted from a larger patch by  
Author: David Rowley  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/CAKJS1f-aGCJ5H7_hiSs5PhWs6Obmj+vGARjGymqH1=o5PcrNnQ@mail.gmail.com  

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

Fix incorrect results for numeric data passed through an ECPG SQLDA.

commit   : ecfd5579561c3e720e696a42aadcd4b5b52aa581    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Nov 2018 15:46:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Nov 2018 15:46:08 -0500    

Click here for diff

Numeric values with leading zeroes were incorrectly copied into a  
SQLDA (SQL Descriptor Area), leading to wrong results in ECPG programs.  
  
Report and patch by Daisuke Higuchi.  Back-patch to all supported  
versions.  
  
Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905C71161@g01jpexmbkw24  

M src/interfaces/ecpg/ecpglib/sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c
M src/interfaces/ecpg/test/expected/sql-sqlda.stderr
M src/interfaces/ecpg/test/expected/sql-sqlda.stdout
M src/interfaces/ecpg/test/sql/sqlda.pgc

Fix realfailN lexer rules to not make assumptions about input format.

commit   : 965a3d6be0702fa88c6eaa6946fa86218704c7d2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Nov 2018 14:54:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Nov 2018 14:54:41 -0500    

Click here for diff

The realfail1 and realfail2 backup-prevention rules always returned  
token type FCONST, ignoring the possibility that what we've scanned  
is more appropriately described as ICONST.  I think that at the  
time that code was added, it might actually have been safe to not  
distinguish; but since we started allowing AS-less aliases in SELECT  
target lists, it's definitely legal to have a number immediately  
followed by an identifier.  
  
In the SELECT case, it seems there's no visible consequence because  
make_const() will change the type back to integer anyway.  But I'm  
worried that there are other contexts, or will be in future, where  
it's more important to get the constant's type right.  
  
Hence, use process_integer_literal to correctly determine which  
token type to return.  
  
Arguably this is a bug fix, but given the lack of evidence of  
user-visible problems, I'll refrain from back-patching.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l

Remove unused code in ECPG.

commit   : 4766bcd9e292befba403619c8a57b3528ad3bd4b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Nov 2018 13:04:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Nov 2018 13:04:15 -0500    

Click here for diff

scanner_init/scanner_finish weren't actually called from anywhere,  
and the scanbuf variables they set up weren't used either.  
  
Remove unused declaration for mm_realloc, too.  
  
John Naylor  
  
Discussion: https://postgr.es/m/CAJVSVGWGqY9YBs2EwtRUkbNv=hXkN8yRPOoD1wxE6COgvvrz5g@mail.gmail.com  

M src/interfaces/ecpg/preproc/extern.h
M src/interfaces/ecpg/preproc/pgc.l

Align ECPG lexer more closely with the core and psql lexers.

commit   : ec937d0805b205e5b33ed4f3cb54f40230a826e3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Nov 2018 12:57:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Nov 2018 12:57:52 -0500    

Click here for diff

Make a bunch of basically-cosmetic changes to reduce the diffs between  
the flex rules in scan.l, psqlscan.l, and pgc.l.  Reorder some code,  
adjust a lot of whitespace, sync some comments, make use of flex start  
condition scopes to do that.  
  
There are a few non-cosmetic changes in the ECPG lexer:  
  
* Bring over the decimalfail rule (and support function  
process_integer_literal) so that ECPG will lex "1..10" into  
the same tokens as the backend would.  I'm not sure this makes any  
visible difference to users, but I'm not sure it doesn't, either.  
  
* <xdc><<EOF>> gets its own rule so as to produce a more on-point  
error message.  
  
* Remove duplicate <SQL>{xdstart} rule.  
  
John Naylor, with a few additional changes by me  
  
Discussion: https://postgr.es/m/CAJVSVGWGqY9YBs2EwtRUkbNv=hXkN8yRPOoD1wxE6COgvvrz5g@mail.gmail.com  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l

doc: Fix minor whitespace issue

commit   : d20dceaf50ea093234ef6a66bb2dae485468bea2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Nov 2018 13:51:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Nov 2018 13:51:38 +0100    

Click here for diff

Reported-by: David G. Johnston <[email protected]>  

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

pg_dump: Fix dumping of WITH OIDS tables

commit   : 6178f3cb798f2ea9011c55e99973f838719c550e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Nov 2018 09:17:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Nov 2018 09:17:25 +0100    

Click here for diff

A table with OIDs that was the first in the dump output would not get  
dumped with OIDs enabled.  Fix that.  
  
The reason was that the currWithOids flag was declared to be bool but  
actually also takes a -1 value for "don't know yet".  But under  
stdbool.h semantics, that is coerced to true, so the required SET  
default_with_oids command is not output again.  Change the variable  
type to char to fix that.  
  
Reported-by: Derek Nelson <[email protected]>  

M src/bin/pg_dump/pg_backup_archiver.h

Fix const correctness warning.

commit   : b59d4d6c36e14ba4097fa8dac3d31ca86f7f507d    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 13 Nov 2018 18:32:05 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 13 Nov 2018 18:32:05 +1300    

Click here for diff

Per buildfarm.  

M src/backend/libpq/auth.c

Fix the initialization of atomic variables introduced by the group clearing mechanism.

commit   : a53bc135fb07d600869917661d65f45506165c00    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 13 Nov 2018 10:52:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 13 Nov 2018 10:52:40 +0530    

Click here for diff

Commits 0e141c0fbb and baaf272ac9 introduced initialization of atomic  
variables in InitProcess which means that it's not safe to look at those  
for backends that aren't currently in use.  Fix that by initializing them  
during postmaster startup.  
  
Reported-by: Andres Freund  
Author: Amit Kapila  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/[email protected]  

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

Fix handling of HBA ldapserver with multiple hostnames.

commit   : 257ef3cd4fec7ca1213f31b660486b492b1c7031    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 13 Nov 2018 17:39:36 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 13 Nov 2018 17:39:36 +1300    

Click here for diff

Commit 35c0754f failed to handle space-separated lists of alternative  
hostnames in ldapserver, when building a URI for ldap_initialize()  
(OpenLDAP).  Such lists need to be expanded to space-separated URIs.  
  
Repair.  Back-patch to 11, to fix bug report #15495.  
  
Author: Thomas Munro  
Reported-by: Renaud Navarro  
Discussion: https://postgr.es/m/15495-2c39fc196c95cd72%40postgresql.org  

M src/backend/libpq/auth.c
M src/test/ldap/t/001_auth.pl

Fix possible buffer overrun in hba.c.

commit   : 6a3dcd28568a04b6e4aea2bf41ea2c7e9c7b0e96    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 13 Nov 2018 16:27:13 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 13 Nov 2018 16:27:13 +1300    

Click here for diff

Coverty reports a possible buffer overrun in the code that populates the  
pg_hba_file_rules view.  It may not be a live bug due to restrictions  
on options that can be used together, but let's increase MAX_HBA_OPTIONS  
and correct a nearby misleading comment.  
  
Back-patch to 10 where this code arrived.  
  
Reported-by: Julian Hsiao  
Discussion: https://postgr.es/m/CADnGQpzbkWdKS2YHNifwAvX5VEsJ5gW49U4o-7UL5pzyTv4vTg%40mail.gmail.com  

M src/backend/libpq/hba.c

Remove CommandCounterIncrement() after processing ON COMMIT DELETE

commit   : 52b70b1c7df5929465cf3dd8f4798e6f2e204f61    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 13 Nov 2018 08:59:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 13 Nov 2018 08:59:41 +0900    

Click here for diff

This comes from f9b5b41, which is part of one the original commits that  
implemented ON COMMIT actions.  By looking at the truncation code, any  
CCI needed happens locally when rebuilding indexes, so it looks safe to  
just remove this final incrementation.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Simplify null-element handling in extension_config_remove().

commit   : 3de491482b6c815a2e735dbbb8972e0907d75188    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Nov 2018 11:50:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Nov 2018 11:50:28 -0500    

Click here for diff

There's no point in asking deconstruct_array() for a null-flags  
array when we already checked the array has no nulls, and aren't  
going to examine the output anyhow.  Not asking for this output  
should make the code marginally faster, and it's also more  
robust since if there somehow were nulls, deconstruct_array()  
would throw an error.  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/extension.c

Limit the number of index clauses considered in choose_bitmap_and().

commit   : e3f005d974ce32ca9f74328067efafcb1217c87f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Nov 2018 11:19:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Nov 2018 11:19:04 -0500    

Click here for diff

classify_index_clause_usage() is O(N^2) in the number of distinct index  
qual clauses it considers, because of its use of a simple search list to  
store them.  For nearly all queries, that's fine because only a few clauses  
will be considered.  But Alexander Kuzmenkov reported a machine-generated  
query with 80000 (!) index qual clauses, which caused this code to take  
forever.  Somewhat remarkably, this is the only O(N^2) behavior we now  
have for such a query, so let's fix it.  
  
We can get rid of the O(N^2) runtime for cases like this without much  
damage to the functionality of choose_bitmap_and() by separating out  
paths with "too many" qual or pred clauses, and deeming them to always  
be nonredundant with other paths.  Then their clauses needn't go into  
the search list, so it doesn't get too long, but we don't lose the  
ability to consider bitmap AND plans altogether.  I set the threshold  
for "too many" to be 100 clauses per path, which should be plenty to  
ensure no change in planning behavior for normal queries.  
  
There are other things we could do to make this go faster, but it's not  
clear that it's worth any additional effort.  80000 qual clauses require  
a whole lot of work in many other places, too.  
  
The code's been like this for a long time, so back-patch to all supported  
branches.  The troublesome query only works back to 9.5 (in 9.4 it fails  
with stack overflow in the parser); so I'm not sure that fixing this in  
9.4 has any real-world benefit, but perhaps it does.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix incorrect author name in release notes

commit   : ffb68980e3c9dc453812c70449ff2d36d5a7f6af    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Nov 2018 23:00:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Nov 2018 23:00:38 +0900    

Click here for diff

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

M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml

doc: Small punctuation improvement

commit   : fc151211ef1f99934b8789591241525adfdee9d6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Nov 2018 14:47:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Nov 2018 14:47:58 +0100    

Click here for diff

M doc/src/sgml/ddl.sgml

doc: Small run-time pruning doc fix

commit   : 253b3f6760e850945a91e2d872eab3b2802ffca2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Nov 2018 14:34:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Nov 2018 14:34:28 +0100    

Click here for diff

A note in ddl.sgml used to mention that run-time pruning was only  
implemented for Append.  When we got MergeAppend support, this was  
updated to mention that MergeAppend is supported too.  This is  
slightly weird as it's not all that obvious what exactly isn't  
supported when we mention:  
  
    <para>  
     Both of these behaviors are likely to be changed in a future release  
     of <productname>PostgreSQL</productname>.  
    </para>  
  
This patch updates this to mention that ModifyTable is unsupported,  
which makes the above fragment make sense again.  
  
Author: David Rowley <[email protected]>  

M doc/src/sgml/ddl.sgml

Disable MSVC warning caused by recent snprintf.c changes

commit   : 7f284debaf1933b322ff54a643c6785362a034d3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 10 Nov 2018 20:20:54 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 10 Nov 2018 20:20:54 -0500    

Click here for diff

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

M src/port/snprintf.c

Remove volatiles from {procarray,volatile}.c and fix memory ordering issue.

commit   : 450c7defa6d5f3c9fdb6efc92cca106c7b582cb3    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 20:54:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 20:54:40 -0800    

Click here for diff

The use of volatiles in procarray.c largely originated from the time  
when postgres did not have reliable compiler and memory  
barriers. That's not the case anymore, so we can do better.  
  
Several of the functions in procarray.c can be bottlenecks, and  
removal of volatile yields mildly better code.  
  
The new state, with explicit memory barriers, is also more  
correct. The previous use of volatile did not actually deliver  
sufficient guarantees on weakly ordered machines, in particular the  
logic in GetNewTransactionId() does not look safe.  It seems unlikely  
to be a problem in practice, but worth fixing.  
  
Thomas and I independently wrote a patch for this.  
  
Reported-By: Andres Freund and Thomas Munro  
Author: Andres Freund, with cherrypicked changes from a patch by Thomas Munro  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/CAEepm=1nff0x=7i3YQO16jLA2qw-F9O39YmUew4oq-xcBQBs0g@mail.gmail.com  

M src/backend/access/transam/varsup.c
M src/backend/storage/ipc/procarray.c

Apply RI trigger skipping tests also for DELETE

commit   : 69ee2ff9308bbfe0e0a89667555e901fec5e154b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jul 2018 08:37:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jul 2018 08:37:32 +0200    

Click here for diff

The tests added in cfa0f4255bb0f5550d37a01c4d8fe2966d20040c to skip  
firing an RI trigger if any old key value is NULL can also be applied  
for DELETE.  This should give a performance gain in those cases, and it  
also saves a lot of duplicate code in the actual RI triggers.  (That  
code was already dead code for the UPDATE cases.)  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M src/backend/commands/trigger.c
M src/backend/utils/adt/ri_triggers.c

Remove dead foreign key optimization code

commit   : 34479d9a36a280afe1387146871d4c1528cf2cbf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jul 2018 08:20:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 Jul 2018 08:20:59 +0200    

Click here for diff

The ri_KeysEqual() calls in the foreign-key trigger functions to  
optimize away some updates are useless because since  
adfeef55cbcc5dc72a772777f88c1be05a70dfee those triggers are not enqueued  
at all.  (It's also not useful to keep these checks as some kind of  
backstop, since it's also semantically correct to just run the full  
check even with equal keys.)  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  

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

Combine two flag tests in GetSnapshotData().

commit   : 5fde047f2b41e71706d4ea9e8eb0a401f64192c1    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 20:43:56 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 20:43:56 -0800    

Click here for diff

Previously the code checked PROC_IN_LOGICAL_DECODING and  
PROC_IN_VACUUM separately. As the relevant variable is marked as  
volatile, the compiler cannot combine the two tests.  As  
GetSnapshotData() is pretty hot in a number of workloads, it's  
worthwhile to fix that.  
  
It'd also be a good idea to get rid of the volatiles altogether. But  
for one that's a larger patch, and for another, the code after this  
change still seems at least as easy to read as before.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

docs: Adapt wal_segment_size docs to fc49e24fa69.

commit   : 5fc1670bad9bfa138be1c790d529249e0706d38e    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 19:24:05 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 19:24:05 -0800    

Click here for diff

Before this change the docs weren't adapted to the fact that  
wal_segment_size is now measured in bytes, rather than multiples of  
wal_block_size.  
  
Author: David Steele  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, like fc49e24fa69 itself.  

M doc/src/sgml/config.sgml

Fix error-cleanup mistakes in exec_stmt_call().

commit   : f26c06a4046b62c04ab4a8ef8632a5f705b6dd2d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Nov 2018 22:04:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Nov 2018 22:04:14 -0500    

Click here for diff

Commit 15c729347 was a couple bricks shy of a load: we need to  
ensure that expr->plan gets reset to NULL on any error exit,  
if it's not supposed to be saved.  Also ensure that the  
stmt->target calculation gets redone if needed.  
  
The easy way to exhibit a problem is to set up code that  
violates the writable-argument restriction and then execute  
it twice.  But error exits out of, eg, setup_param_list()  
could also break it.  Make the existing PG_TRY block cover  
all of that code to be sure.  
  
Per report from Pavel Stehule.  
  
Discussion: https://postgr.es/m/CAFj8pRAeXNTO43W2Y0Cn0YOVFPv1WpYyOqQrrzUiN6s=dn7gCg@mail.gmail.com  

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

Fix missing role dependencies for some schema and type ACLs.

commit   : fa2952d8eb0423a02fde7b36f748f8de11aec8db    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Nov 2018 20:42:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Nov 2018 20:42:03 -0500    

Click here for diff

This patch fixes several related cases in which pg_shdepend entries were  
never made, or were lost, for references to roles appearing in the ACLs of  
schemas and/or types.  While that did no immediate harm, if a referenced  
role were later dropped, the drop would be allowed and would leave a  
dangling reference in the object's ACL.  That still wasn't a big problem  
for normal database usage, but it would cause obscure failures in  
subsequent dump/reload or pg_upgrade attempts, taking the form of  
attempts to grant privileges to all-numeric role names.  (I think I've  
seen field reports matching that symptom, but can't find any right now.)  
  
Several cases are fixed here:  
  
1. ALTER DOMAIN SET/DROP DEFAULT would lose the dependencies for any  
existing ACL entries for the domain.  This case is ancient, dating  
back as far as we've had pg_shdepend tracking at all.  
  
2. If a default type privilege applies, CREATE TYPE recorded the  
ACL properly but forgot to install dependency entries for it.  
This dates to the addition of default privileges for types in 9.2.  
  
3. If a default schema privilege applies, CREATE SCHEMA recorded the  
ACL properly but forgot to install dependency entries for it.  
This dates to the addition of default privileges for schemas in v10  
(commit ab89e465c).  
  
Another somewhat-related problem is that when creating a relation  
rowtype or implicit array type, TypeCreate would apply any available  
default type privileges to that type, which we don't really want  
since such an object isn't supposed to have privileges of its own.  
(You can't, for example, drop such privileges once they've been added  
to an array type.)  
  
ab89e465c is also to blame for a race condition in the regression tests:  
privileges.sql transiently installed globally-applicable default  
privileges on schemas, which sometimes got absorbed into the ACLs of  
schemas created by concurrent test scripts.  This should have resulted  
in failures when privileges.sql tried to drop the role holding such  
privileges; but thanks to the bug fixed here, it instead led to dangling  
ACLs in the final state of the regression database.  We'd managed not to  
notice that, but it became obvious in the wake of commit da906766c, which  
allowed the race condition to occur in pg_upgrade tests.  
  
To fix, add a function recordDependencyOnNewAcl to encapsulate what  
callers of get_user_default_acl need to do; while the original call  
sites got that right via ad-hoc code, none of the later-added ones  
have.  Also change GenerateTypeDependencies to generate these  
dependencies, which requires adding the typacl to its parameter list.  
(That might be annoying if there are any extensions calling that  
function directly; but if there are, they're most likely buggy in the  
same way as the core callers were, so they need work anyway.)  While  
I was at it, I changed GenerateTypeDependencies to accept most of its  
parameters in the form of a Form_pg_type pointer, making its parameter  
list a bit less unwieldy and mistake-prone.  
  
The test race condition is fixed just by wrapping the addition and  
removal of default privileges into a single transaction, so that that  
state is never visible externally.  We might eventually prefer to  
separate out tests of default privileges into a script that runs by  
itself, but that would be a bigger change and would make the tests  
run slower overall.  
  
Back-patch relevant parts to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/aclchk.c
M src/backend/catalog/heap.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_type.c
M src/backend/commands/typecmds.c
M src/include/catalog/pg_type.h
M src/include/utils/acl.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Remove ineffective check against dropped columns from slot_getattr().

commit   : c670d0faace6184216c349a4cf830aa415c58068    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 17:40:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 17:40:40 -0800    

Click here for diff

Before this commit slot_getattr() checked for dropped  
columns (returning NULL in that case), but only after checking for  
previously deformed columns. As slot_deform_tuple() does not contain  
such a check, the check in slot_getattr() would often not have been  
reached, depending on previous use of the slot.  
  
These days locking and plan invalidation ought to ensure that dropped  
columns are not accessed in query plans. Therefore this commit just  
drops the insufficient check in slot_getattr().  It's possible that  
we'll find some holes againt use of dropped columns, but if so, those  
need to be addressed independent of slot_getattr(), as most accesses  
don't go through that function anyway.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c

Don't require return slots for nodes without projection.

commit   : 1ef6bd2954c4ec63ff8a2c9c4ebc38251d7ef5c5    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 17:19:39 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 9 Nov 2018 17:19:39 -0800    

Click here for diff

In a lot of nodes the return slot is not required. That can either be  
because the node doesn't do any projection (say an Append node), or  
because the node does perform projections but the projection is  
optimized away because the projection would yield an identical row.  
  
Slots aren't that small, especially for wide rows, so it's worthwhile  
to avoid creating them.  It's not possible to just skip creating the  
slot - it's currently used to determine the tuple descriptor returned  
by ExecGetResultType().  So separate the determination of the result  
type from the slot creation.  The work previously done internally  
ExecInitResultTupleSlotTL() can now also be done separately with  
ExecInitResultTypeTL() and ExecInitResultSlot().  That way nodes that  
aren't guaranteed to need a result slot, can use  
ExecInitResultTypeTL() to determine the result type of the node, and  
ExecAssignScanProjectionInfo() (via  
ExecConditionalAssignProjectionInfo()) determines that a result slot  
is needed, it is created with ExecInitResultSlot().  
  
Besides the advantage of avoiding to create slots that then are  
unused, this is necessary preparation for later patches around tuple  
table slot abstraction. In particular separating the return descriptor  
and slot is a prerequisite to allow JITing of tuple deforming with  
knowledge of the underlying tuple format, and to avoid unnecessarily  
creating JITed tuple deforming for virtual slots.  
  
This commit removes a redundant argument from  
ExecInitResultTupleSlotTL(). While this commit touches a lot of the  
relevant lines anyway, it'd normally still not worthwhile to cause  
breakage, except that aforementioned later commits will touch *all*  
ExecInitResultTupleSlotTL() callers anyway (but fits worse  
thematically).  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h

Fix incorrect routine name in xlog_heapam.h

commit   : 3ce12018948b2c4ead9a47df7ae0b5ffa2fe06d0    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 10 Nov 2018 08:58:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 10 Nov 2018 08:58:55 +0900    

Click here for diff

s/xl_heap_delete/xl_heap_truncate/ in a comment block referring to flags  
for truncation.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/heapam_xlog.h

Indicate session name in isolationtester notices

commit   : a28e10e82e540d45e448bc404af76df8a54008f1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Nov 2018 13:08:00 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Nov 2018 13:08:00 -0300    

Click here for diff

When a session under isolationtester produces printable notices (NOTICE,  
WARNING) we were just printing them unadorned, which can be confusing  
when debugging.  Prefix them with the session name, which makes things  
clearer.  
  
Author: Álvaro Herrera  
Reviewed-by: Hari Babu Kommi  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/vacuum-concurrent-drop.out
M src/test/isolation/expected/vacuum-conflict.out
M src/test/isolation/expected/vacuum-skip-locked.out
M src/test/isolation/isolationtester.c

Fix dependency handling of partitions and inheritance for ON COMMIT

commit   : 319a8101804f3b62512fdce1a3af1c839344b593    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Nov 2018 10:03:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Nov 2018 10:03:22 +0900    

Click here for diff

This commit fixes a set of issues with ON COMMIT actions when used on  
partitioned tables and tables with inheritance children:  
- Applying ON COMMIT DROP on a partitioned table with partitions or on a  
table with inheritance children caused a failure at commit time, with  
complains about the children being already dropped as all relations are  
dropped one at the same time.  
- Applying ON COMMIT DELETE on a partition relying on a partitioned  
table which uses ON COMMIT DROP would cause the partition truncation to  
fail as the parent is removed first.  
  
The solution to the first problem is to handle the removal of all the  
dependencies in one go instead of dropping relations one-by-one, based  
on a suggestion from Álvaro Herrera.  So instead all the relation OIDs  
to remove are gathered and then processed in one round of multiple  
deletions.  
  
The solution to the second problem is to reorder the actions, with  
truncation happening first and relation drop done after.  Even if it  
means that a partition could be first truncated, then immediately  
dropped if its partitioned table is dropped, this has the merit to keep  
the code simple as there is no need to do existence checks on the  
relations to drop.  
  
Contrary to a manual TRUNCATE on a partitioned table, ON COMMIT DELETE  
does not cascade to its partitions.  The ON COMMIT action defined on  
each partition gets the priority.  
  
Author: Michael Paquier  
Reviewed-by: Amit Langote, Álvaro Herrera, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

Disallow setting client_min_messages higher than ERROR.

commit   : 3d360e20c9ae48a8139b4dd84f5a8bacc392d8e9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 8 Nov 2018 17:33:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 8 Nov 2018 17:33:25 -0500    

Click here for diff

Previously it was possible to set client_min_messages to FATAL or PANIC,  
which had the effect of suppressing transmission of regular ERROR messages  
to the client.  Perhaps that seemed like a useful option in the past, but  
the trouble with it is that it breaks guarantees that are explicitly made  
in our FE/BE protocol spec about how a query cycle can end.  While libpq  
and psql manage to cope with the omission, that's mostly because they  
are not very bright; client libraries that have more semantic knowledge  
are likely to get confused.  Notably, pgODBC doesn't behave very sanely.  
Let's fix this by getting rid of the ability to set client_min_messages  
above ERROR.  
  
In HEAD, just remove the FATAL and PANIC options from the set of allowed  
enum values for client_min_messages.  (This change also affects  
trace_recovery_messages, but that's OK since these aren't useful values  
for that variable either.)  
  
In the back branches, there was concern that rejecting these values might  
break applications that are explicitly setting things that way.  I'm  
pretty skeptical of that argument, but accommodate it by accepting these  
values and then internally setting the variable to ERROR anyway.  
  
In all branches, this allows a couple of tiny simplifications in the  
logic in elog.c, so do that.  
  
Also respond to the point that was made that client_min_messages has  
exactly nothing to do with the server's logging behavior, and therefore  
does not belong in the "When To Log" subsection of the documentation.  
The "Statement Behavior" subsection is a better match, so move it there.  
  
Jonah Harris and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Revise attribute handling code on partition creation

commit   : 705d433fd5e29ac173ef46a5acd4a2d7336f5573    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 8 Nov 2018 16:22:09 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 8 Nov 2018 16:22:09 -0300    

Click here for diff

The original code to propagate NOT NULL and default expressions  
specified when creating a partition was mostly copy-pasted from  
typed-tables creation, but not being a great match it contained some  
duplicity, inefficiency and bugs.  
  
This commit fixes the bug that NOT NULL constraints declared in the  
parent table would not be honored in the partition.  One reported issue  
that is not fixed is that a DEFAULT declared in the child is not used  
when inserting through the parent.  That would amount to a behavioral  
change that's better not back-patched.  
  
This rewrite makes the code simpler:  
  
1. instead of checking for duplicate column names in its own block,  
reuse the original one that already did that;  
  
2. instead of concatenating the list of columns from parent and the one  
declared in the partition and scanning the result to (incorrectly)  
propagate defaults and not-null constraints, just scan the latter  
searching the former for a match, and merging sensibly.  This works  
because we know the list in the parent is already correct and there can  
only be one parent.  
  
This rewrite makes ColumnDef->is_from_parent unused, so it's removed  
on branch master; on released branches, it's kept as an unused field in  
order not to cause ABI incompatibilities.  
  
This commit also adds a test case for creating partitions with  
collations mismatching that on the parent table, something that is  
closely related to the code being patched.  No code change is introduced  
though, since that'd be a behavior change that could break some (broken)  
working applications.  
  
Amit Langote wrote a less invasive fix for the original  
NOT NULL/defaults bug, but while I kept the tests he added, I ended up  
not using his original code.  Ashutosh Bapat reviewed Amit's fix.  Amit  
reviewed mine.  
  
Author: Álvaro Herrera, Amit Langote  
Reviewed-by: Ashutosh Bapat, Amit Langote  
Reported-by: Jürgen Strobel (bug #15212)  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/sequence.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/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Adjust valgrind fix in commit 517b0d0b5f

commit   : 12d5f39b15c31c0adc6c7ed06979af340e494fb9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 8 Nov 2018 08:38:46 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 8 Nov 2018 08:38:46 -0500    

Click here for diff

lousyjack still wasn't happy. I have tested this modification and it  
worked.  

M src/tools/valgrind.supp

Fix incorrect routine name reference in partprune.c

commit   : 170dccc69ddb5eb379ebb5282d699738177d4543    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 8 Nov 2018 20:14:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 8 Nov 2018 20:14:16 +0900    

Click here for diff

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

M src/backend/partitioning/partprune.c

Fixup for b84a6dafbf triggering assert failure in LLVM debug builds.

commit   : c14a8ff27e26155345e554a9636bab8236500bb9    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 7 Nov 2018 13:58:52 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 7 Nov 2018 13:58:52 -0800    

Click here for diff

Author: Andres Freund  

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

Fix inadequate autoconfiscation of copyfile() usage.

commit   : c3e6d5d38699812e047270a711be1926b7f6f396    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Nov 2018 16:41:42 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Nov 2018 16:41:42 -0500    

Click here for diff

Per buildfarm, HAVE_COPYFILE is not the same thing as HAVE_COPYFILE_H.  
Add the extra configure test.  

M configure
M configure.in
M src/bin/pg_upgrade/file.c
M src/include/pg_config.h.in

Use parallel installcheck in vcregress.pl's upgrade test

commit   : 54ad7282fe7ad80a15533546d3b0a2be2e19e3f6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 7 Nov 2018 14:15:19 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 7 Nov 2018 14:15:19 -0500    

Click here for diff

This is to keep the test in sync with what's done in test.sh, which  
acquired this change in commit da906766c.  

M src/tools/msvc/vcregress.pl

Move EEOP_*_SYSVAR evaluation out of line.

commit   : b84a6dafbf2bb921baee53c0c1aba7719ee38817    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 7 Nov 2018 11:08:45 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 7 Nov 2018 11:08:45 -0800    

Click here for diff

This mainly de-duplicates code. As evaluating a system variable isn't  
the hottest path and the current inline implementation ends up calling  
out to an external function anyway, this is OK from a performance POV.  
  
The main motivation for de-duplicating is the upcoming slot  
abstraction work, after which there's not guaranteed to be a HeapTuple  
backing the slot.  
  
Author: Andres Freund, Amit Khandekar  
Discussion: https://postgr.es/m/[email protected]  

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

Quiet valgrind complaints following pread/pwrite changes

commit   : 517b0d0b5f38c92c1807a40d71ca4bf6428ca7d5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 7 Nov 2018 12:54:24 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 7 Nov 2018 12:54:24 -0500    

Click here for diff

Per complaints from buildfarm and elsewhere  
Patch from Jasper Pedersen  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/valgrind.supp

pg_upgrade: Allow use of file cloning

commit   : 3a769d8239afdc003c91a56d2d8d5adfadacda5d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 7 Nov 2018 18:05:54 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 7 Nov 2018 18:05:54 +0100    

Click here for diff

Add another transfer mode --clone to pg_upgrade (besides the existing  
--link and the default copy), using special file cloning calls.  This  
makes the file transfer faster and more space efficient, achieving  
speed similar to --link mode without the associated drawbacks.  
  
On Linux, file cloning is supported on Btrfs and XFS (if formatted with  
reflink support).  On macOS, file cloning is supported on APFS.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M configure
M configure.in
M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/include/pg_config.h.in

Build HashState's hashkeys expression with the correct parent.

commit   : 5f32b29c18195299e90c1fb6c8945e9a46d772d2    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 7 Nov 2018 09:25:54 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 7 Nov 2018 09:25:54 -0800    

Click here for diff

Previously the expressions were built with the HashJoinState as a  
parent. That's incorrect.  
  
Currently this does not appear to be harmful, but for the upcoming  
'slot abstraction' work this proves to be problematic, as the  
underlying slot types can differ between Hash and HashJoin.  It's  
possible that this already causes a problem, but I've not been able to  
come up with a scenario.  Therefore don't backpatch at this point.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeHashjoin.c

Use installcheck-parallel in pg_upgrade's testsuite.

commit   : da906766cd3bef8290db25bd5c8776c03689f3d5    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 7 Nov 2018 09:22:48 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 7 Nov 2018 09:22:48 -0800    

Click here for diff

The installcheck run takes a sizable fraction of test.sh to run. Using  
a parallel schedule reduces that noticably.  
  
It's possible that we want to backpatch this at some point, to reduce  
buildfarm times, but for now lets just see if this upsets the  
buildfarm.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Postpone calculating total_table_pages until after pruning/exclusion.

commit   : c6e4133fae1fde93769197379ffcc2b379845113    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Nov 2018 12:12:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Nov 2018 12:12:56 -0500    

Click here for diff

The planner doesn't make any use of root->total_table_pages until it  
estimates costs of indexscans, so we don't need to compute it as  
early as that's currently done.  By doing the calculation between  
set_base_rel_sizes and set_base_rel_pathlists, we can omit relations  
that get removed from the query by partition pruning or constraint  
exclusion, which seems like a more accurate basis for costing.  
  
(Historical note: I think at the time this code was written, there  
was not a separation between the "set sizes" and "set pathlists"  
steps, so that this approach would have been impossible at the time.  
But now that we have that separation, this is clearly the better way  
to do things.)  
  
David Rowley, reviewed by Edmund Horner  
  
Discussion: https://postgr.es/m/CAKJS1f-NG1mRM0VOtkAG7=ZLQWihoqees9R4ki3CKBB0-fRfCA@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/util/plancat.c
M src/include/nodes/relation.h

Last-minute updates for release notes.

commit   : 77366d90f44a4e1c15d36e51061ffbc17f0dd12d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Nov 2018 18:56:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Nov 2018 18:56:26 -0500    

Click here for diff

Add entries for v11 changes that went in post-stamping, but before  
the final wrap.  

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

Disable recheck_on_update optimization to avoid crashes.

commit   : 5d28c9bd73e29890cccd3f6b188b86f81031f671    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Nov 2018 18:33:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Nov 2018 18:33:15 -0500    

Click here for diff

The code added by commit c203d6cf8 causes a crash in at least one case,  
where a potentially-optimizable expression index has a storage type  
different from the input data type.  A cursory code review turned up  
numerous other problems that seem impractical to fix on short notice.  
  
Andres argued for revert of that patch some time ago, and if additional  
senior committers had been paying attention, that's likely what would  
have happened, but we were not :-(  
  
At this point we can't just revert, at least not in v11, because that would  
mean an ABI break for code touching relcache entries.  And we should not  
remove the (also buggy) support for the recheck_on_update index reloption,  
since it might already be used in some databases in the field.  So this  
patch just does the as-little-invasive-as-possible measure of disabling  
the feature as though recheck_on_update were forced off for all indexes.  
I also removed the related regression tests (which would otherwise fail)  
and the user-facing documentation of the reloption.  
  
We should undertake a more thorough code cleanup if the patch can't be  
fixed, but not under the extreme time pressure of being already overdue  
for 11.1 release.  
  
Per report from Ondřej Bouda and subsequent private discussion among  
pgsql-release.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/release-11.sgml
M src/backend/utils/cache/relcache.c
D src/test/regress/expected/func_index.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
D src/test/regress/sql/func_index.sql

Remove set-but-unused variable.

commit   : c4f0876fb8d8f84fc0a6fb6aee91de120718664c    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 7 Nov 2018 11:45:49 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 7 Nov 2018 11:45:49 +1300    

Click here for diff

Clean-up for commit c24dcd0c.  
  
Reported-by: Andrew Dunstan  
Discussion: https://postgr.es/m/2d52ff4a-5440-f6f1-7806-423b0e6370cb%402ndQuadrant.com  

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

Optimize nested ConvertRowtypeExpr nodes.

commit   : 5613da4cc7910f4b686b818dd1ee68703d62192f    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 6 Nov 2018 14:19:40 +0000    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 6 Nov 2018 14:19:40 +0000    

Click here for diff

A ConvertRowtypeExpr is used to translate a whole-row reference of a  
child to that of a parent. The planner produces nested  
ConvertRowtypeExpr while translating whole-row reference of a leaf  
partition in a multi-level partition hierarchy. Executor then  
translates the whole-row reference from the leaf partition into all  
the intermediate parent's whole-row references before arriving at the  
final whole-row reference. It could instead translate the whole-row  
reference from the leaf partition directly to the top-most parent's  
whole-row reference skipping any intermediate translations.  
  
Ashutosh Bapat, with tests by Kyotaro Horiguchi and some  
editorialization by me. Reviewed by Andres Freund, Pavel Stehule,  
Kyotaro Horiguchi, Dmitry Dolgov, Tom Lane.  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Use pg_pread() and pg_pwrite() for data files and WAL.

commit   : c24dcd0cfd949bdf245814c4c2b3df828ee7db36    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 7 Nov 2018 09:51:50 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 7 Nov 2018 09:51:50 +1300    

Click here for diff

Cut down on system calls by doing random I/O using offset-based OS  
routines where available.  Remove the code for tracking the 'virtual'  
seek position.  The only reason left to call FileSeek() was to get  
the file's size, so provide a new function FileSize() instead.  
  
Author: Oskari Saarenmaa, Thomas Munro  
Reviewed-by: Thomas Munro, Jesper Pedersen, Tom Lane, Alvaro Herrera  
Discussion: https://postgr.es/m/CAEepm=02rapCpPR3ZGF2vW=SBHSdFYO_bz_f-wwWJonmA3APgw@mail.gmail.com  
Discussion: https://postgr.es/m/b8748d39-0b19-0514-a1b9-4e5a28e6a208%40gmail.com  
Discussion: https://postgr.es/m/a86bd200-ebbe-d829-e3ca-0c4474b2fcb7%40ohmu.fi  

M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/xlog.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/include/storage/fd.h

Provide pg_pread() and pg_pwrite() for random I/O.

commit   : 3fd2a7932ef0708dda57369bb20c0499d905cc82    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 7 Nov 2018 09:50:01 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 7 Nov 2018 09:50:01 +1300    

Click here for diff

Forward to POSIX pread() and pwrite(), or emulate them if unavailable.  
The emulation is not perfect as the file position is changed, so  
we'll put pg_ prefixes on the names to minimize the risk of confusion  
in future patches that might inadvertently try to mix pread() and read()  
on the same file descriptor.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane, Jesper Pedersen  
Discussion: https://postgr.es/m/CAEepm=02rapCpPR3ZGF2vW=SBHSdFYO_bz_f-wwWJonmA3APgw@mail.gmail.com  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
A src/port/pread.c
A src/port/pwrite.c
M src/tools/msvc/Mkvcbuild.pm

GUC: adjust effective_cache_size SQL descriptions

commit   : b43df566b372650a9b9e2a0dd9e695c1f16da14f    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 6 Nov 2018 13:40:03 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 6 Nov 2018 13:40:03 -0500    

Click here for diff

Follow on patch for commit 3e0f1a4741f564c1a2fa6e944729d6967355d8c7.  
  
Reported-by: Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.4  

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

Rename rbtree.c functions to use "rbt" prefix not "rb" prefix.

commit   : 003c68a3b45d0d135b874acfe04cf3fb79a6f172    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Nov 2018 13:25:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Nov 2018 13:25:24 -0500    

Click here for diff

The "rb" prefix is used by Ruby, so that our existing code results  
in name collisions that break plruby.  We discussed ways to prevent  
that by adjusting dynamic linker options, but it seems that at best  
we'd move the pain to other cases.  Renaming to avoid the collision  
is the only portable fix anyway.  Fortunately, our rbtree code is  
not (yet?) widely used --- in core, there's only a single usage  
in GIN --- so it seems likely that we can get away with a rename.  
  
I chose to do this basically as s/rb/rbt/g, except for places where  
there already was a "t" after "rb".  The patch could have been made  
smaller by only touching linker-visible symbols, but it would have  
resulted in oddly inconsistent-looking code.  Better to make it look  
like "rbt" was the plan all along.  
  
Back-patch to v10.  The rbtree.c code exists back to 9.5, but  
rb_iterate() which is the actual immediate source of pain was added  
in v10, so it seems like changing the names before that would have  
more risk than benefit.  
  
Per report from Pavel Raiskup.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gin/ginbulk.c
M src/backend/lib/rbtree.c
M src/include/access/gin_private.h
M src/include/lib/rbtree.h
M src/test/modules/test_rbtree/test_rbtree.c

Remove useless symbol from Makefile.global.

commit   : 8f623bedfb4fee5a125b25720e5451379cf26ff9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Nov 2018 10:57:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Nov 2018 10:57:51 -0500    

Click here for diff

I added HAVE_IPV6 to Makefile.global way back in commit 7703e55c3  
so that we could transmit its value to the shell-script version of  
initdb.  Since initdb was rewritten in C, it's been finding that  
out from pg_config.h instead, so this is useless.  Keeping it here  
just wastes configure and make cycles, plus it's a potential  
two-sources-of-truth problem.  

M configure
M configure.in
M src/Makefile.global.in

Remove some remaining traces of dsm_resize().

commit   : 9e12fb02b7ec27ff3707a0a7c31f2421ba62c9df    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 6 Nov 2018 21:20:58 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 6 Nov 2018 21:20:58 +1300    

Click here for diff

A couple of obsolete comments and unreachable blocks remained after  
commit 3c60d0fa.  
  
Discussion: https://postgr.es/m/CAA4eK1%2B%3DyAFUvpFoHXFi_gm8YqmXN-TtkFH%2BVYjvDLS6-SFq-Q%40mail.gmail.com  

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

Reorganize format options of psql in alphabetical order

commit   : add9182e59084faf57bb264fefcd39fbc93fb116    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Nov 2018 15:04:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Nov 2018 15:04:40 +0900    

Click here for diff

This makes the addition of new formats easier, and documentation lookups  
easier.  
  
Author: Daniel Vérité  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.20.1803081004241.2916@lancre  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/tab-complete.c
M src/include/fe_utils/print.h

Switch pg_promote to be parallel-safe

commit   : 8f045e242b2308473f5de532590454294e3d5683    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Nov 2018 14:11:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Nov 2018 14:11:21 +0900    

Click here for diff

pg_promote uses nothing relying on a global state, so it is fine to mark  
it as parallel-safe, conclusion based on a detailed analysis from Robert  
Haas.  This also fixes an inconsistency where pg_proc.dat missed to mark  
the function with its previous value for proparallel, update which does  
not matter now as the default is used.  
  
Based on a discussion between multiple folks: Laurenz Albe, Robert Haas,  
Amit Kapila, Tom Lane and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h

Remove dsm_resize() and dsm_remap().

commit   : 3c60d0fa231f7699af5dd83345919d0423305973    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 6 Nov 2018 16:11:12 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 6 Nov 2018 16:11:12 +1300    

Click here for diff

These interfaces were never used in core, didn't handle failure of  
posix_fallocate() correctly and weren't supported on all platforms.  
We agreed to remove them in 12.  
  
Author: Thomas Munro  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/CAA4eK1%2B%3DyAFUvpFoHXFi_gm8YqmXN-TtkFH%2BVYjvDLS6-SFq-Q%40mail.gmail.com  

M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h

Last-minute updates for release notes.

commit   : b0a1ff8a6a01163f830490e6c542ff852d240690    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Nov 2018 16:07:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Nov 2018 16:07:06 -0500    

Click here for diff

I removed the item about the pg_stat_statements change from  
release-11.sgml, as part of a sweep to delete items already committed  
in 11.0; but actually we'd best keep it to ensure that people who've  
pg_upgraded their databases will take the requisite action.  Also make  
said action more visible by making it into its own para.  Noted by  
Jonathan Katz.  

M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-11.sgml

Fix copy-paste error in errhint() introduced in 691d79a07933.

commit   : a3fb382e9c166e398763e3bbf706b6c92a647fe1    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 5 Nov 2018 12:02:25 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 5 Nov 2018 12:02:25 -0800    

Click here for diff

Reported-By: Petr Jelinek  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, like the previous commit  

M src/backend/replication/slot.c

Remove unreferenced pg_opfamily entry.

commit   : 55f3d1029676ad53621716fd15faed5848c9f4cd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Nov 2018 12:02:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Nov 2018 12:02:27 -0500    

Click here for diff

The entry with OID 4035, for GIST jsonb_ops, is unused; apparently  
it was added in preparation for index support that never materialized.  
Remove it, and add a regression test case to detect future mistakes  
of the same kind.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h
M src/include/catalog/pg_opfamily.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql

Last-minute updates for release notes.

commit   : 1eaeb02a30b307bad4d6a9cc2d596273a5a38a7a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Nov 2018 10:48:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Nov 2018 10:48:23 -0500    

Click here for diff

Security: CVE-2018-16850  

M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-11.sgml

Block creation of partitions with open references to its parent

commit   : dc3e436b191a8f8d6f35fad952dd3dc314ccabf9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Nov 2018 11:04:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Nov 2018 11:04:02 +0900    

Click here for diff

When a partition is created as part of a trigger processing, it is  
possible that the partition which just gets created changes the  
properties of the table the executor of the ongoing command relies on,  
causing a subsequent crash.  This has been found possible when for  
example using a BEFORE INSERT which creates a new partition for a  
partitioned table being inserted to.  
  
Any attempt to do so is blocked when working on a partition, with  
regression tests added for both CREATE TABLE PARTITION OF and ALTER  
TABLE ATTACH PARTITION.  
  
Reported-by: Dmitry Shalashov  
Author: Amit Langote  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

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

Ignore partitioned tables when processing ON COMMIT DELETE ROWS

commit   : 4bc772e2afa55f26734ff3fbdf27601db030b7e5    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Nov 2018 09:14:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Nov 2018 09:14:33 +0900    

Click here for diff

Those tables have no physical storage, making this option unusable with  
partition trees as at commit time an actual truncation was attempted.  
There are still issues with the way ON COMMIT actions are done when  
mixing several action types, however this impacts as well inheritance  
trees, so this issue will be dealt with later.  
  
Reported-by: Rajkumar Raghuwanshi  
Author: Amit Langote  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/CAKcux6mhgcjSiB_egqEAEFgX462QZtncU8QCAJ2HZwM-wWGVew@mail.gmail.com  

M src/backend/catalog/heap.c
M src/test/regress/expected/temp.out
M src/test/regress/sql/temp.sql

Release notes for 11.1, 10.6, 9.6.11, 9.5.15, 9.4.20, 9.3.25.

commit   : fa534b411c86d2e7441852282ea9f1a491a090a6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Nov 2018 16:57:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Nov 2018 16:57:14 -0500    

Click here for diff

M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-11.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml

Fix ExecuteCallStmt to not scribble on the passed-in parse tree.

commit   : 9b6fb9fbb48dda828dcca47adc418632ddb36202    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Nov 2018 14:50:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Nov 2018 14:50:55 -0500    

Click here for diff

Modifying the parse tree at execution time is, or at least ought to be,  
verboten.  It seems quite difficult to actually cause a crash this way  
in v11 (although you can exhibit it pretty easily in HEAD by messing  
with plan_cache_mode).  Nonetheless, it's risky, so fix and back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/functioncmds.c

Fix bugs in plpgsql's handling of CALL argument lists.

commit   : 15c7293477a6de03234f58898da7fb29f3ab5b94    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Nov 2018 13:25:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Nov 2018 13:25:39 -0500    

Click here for diff

exec_stmt_call() tried to extract information out of a CALL statement's  
argument list without using expand_function_arguments(), apparently in  
the hope of saving a few nanoseconds by not processing defaulted  
arguments.  It got that quite wrong though, leading to crashes with  
named arguments, as well as failure to enforce writability of the  
argument for a defaulted INOUT parameter.  Fix and simplify the logic  
by using expand_function_arguments() before examining the list.  
  
Also, move the argument-examination to just after producing the CALL  
command's plan, before invoking the called procedure.  This ensures  
that we'll track possible changes in the procedure's argument list  
correctly, and avoids a hazard of the plan cache being flushed while  
the procedure executes.  
  
Also fix assorted falsehoods and omissions in associated documentation.  
  
Per bug #15477 from Alexey Stepanov.  
  
Patch by me, with some help from Pavel Stehule.  Back-patch to v11.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAFj8pRA6UsujpTs9Sdwmk-R6yQykPx46wgjj+YZ7zxm4onrDyw@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/call.sgml
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_call.sql

Fix unused-variable warning.

commit   : 3e0b05a75673f0ad73d5487efe814485a9fcf68f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 4 Nov 2018 11:20:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 4 Nov 2018 11:20:59 -0500    

Click here for diff

Discussion: https://postgr.es/m/CAMkU=1xTHkS6d0iptCWykHc1Xrh3LBic_gZDo3JzDYru815fLQ@mail.gmail.com  

M src/backend/executor/execExpr.c

Prevent generating EEOP_AGG_STRICT_INPUT_CHECK operations when nargs == 0.

commit   : 793beab37e8f7ec6a4ef39395c6c866d7e4c7af5    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Nov 2018 15:55:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Nov 2018 15:55:23 -0700    

Click here for diff

This only became a problem with 4c640f4f38, which didn't synchronize  
the value agg_strict_input_check.nargs is set to, with the guard  
condition for emitting the operation.  
  
Besides such instructions being unnecessary overhead, currently the  
LLVM JIT provider doesn't support them. It seems more sensible to  
avoid generating such instruction than supporting them. Add assertions  
to make it easier to debug a potential further occurance.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, like 4c640f4f38.  

M src/backend/executor/execExpr.c
M src/backend/jit/llvm/llvmjit_expr.c

Fix STRICT check for strict aggregates with NULL ORDER BY columns.

commit   : 4c640f4f38d5d68cbe33ddfabbdc56eea8f1e173    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Nov 2018 14:35:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Nov 2018 14:35:23 -0700    

Click here for diff

I (Andres) broke this unintentionally in 69c3936a14, by checking  
strictness for all input expressions computed for an aggregate, rather  
than just the input for the aggregate transition function.  
  
Reported-By: Ondřej Bouda  
Bisected-By: Tom Lane  
Diagnosed-By: Andrew Gierth  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, like 69c3936a14  

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

Make ts_locale.c's character-type functions cope with UTF-16.

commit   : 981dc2baa8e08483bfe4b20f9e5ab3cad711ba98    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Nov 2018 13:56:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Nov 2018 13:56:10 -0400    

Click here for diff

On Windows, in UTF8 database encoding, what char2wchar() produces is  
UTF16 not UTF32, ie, characters above U+FFFF will be represented by  
surrogate pairs.  t_isdigit() and siblings did not account for this  
and failed to provide a large enough result buffer.  That in turn  
led to bogus "invalid multibyte character for locale" errors, because  
contrary to what you might think from char2wchar()'s documentation,  
its Windows code path doesn't cope sanely with buffer overflow.  
  
The solution for t_isdigit() and siblings is pretty clear: provide  
a 3-wchar_t result buffer not 2.  
  
char2wchar() also needs some work to provide more consistent, and more  
accurately documented, buffer overrun behavior.  But that's a bigger job  
and it doesn't actually have any immediate payoff, so leave it for later.  
  
Per bug #15476 from Kenji Uno, who deserves credit for identifying the  
cause of the problem.  Back-patch to all active branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tsearch/ts_locale.c

Fix tablespace handling for partitioned indexes

commit   : dfa6081419829ef60d6bc02691616337eeb7f988    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 3 Nov 2018 13:23:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 3 Nov 2018 13:23:40 -0300    

Click here for diff

When creating partitioned indexes, the tablespace was not being saved  
for the parent index. This meant that subsequently created partitions  
would not use the right tablespace for their indexes.  
  
ALTER INDEX SET TABLESPACE and ALTER INDEX ALL IN TABLESPACE raised  
errors when tried; fix them too.  This requires bespoke code for  
ATExecCmd() that applies to the special case when the tablespace move is  
just a catalog change.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Remove extra word from create sub docs

commit   : ceadcbe8ffe50f7fb9e1fa5aed652a33aab908a5    
  
author   : Stephen Frost <[email protected]>    
date     : Sat, 3 Nov 2018 12:21:54 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Sat, 3 Nov 2018 12:21:54 -0400    

Click here for diff

Improve the documentation in the CREATE SUBSCRIPTION command a bit by  
removing an extraneous word and spelling out 'information'.  

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

First-draft release notes for 11.1.

commit   : 65a82a7649860f8010db581a0d1f12aa92f5969b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Nov 2018 20:11:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Nov 2018 20:11:11 -0400    

Click here for diff

As usual, the release notes for other branches will be made by cutting  
these down, but put them up for community review first.  Note that a  
fair percentage of the entries apply only to prior branches because  
their issue was already fixed in 11.0.  

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

Yet further rethinking of build changes for macOS Mojave.

commit   : 1440c461f7ea665b7e743aa636aa6adafa5c6fc6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Nov 2018 18:54:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Nov 2018 18:54:00 -0400    

Click here for diff

The solution arrived at in commit e74dd00f5 presumes that the compiler  
has a suitable default -isysroot setting ... but further experience  
shows that in many combinations of macOS version, XCode version, Xcode  
command line tools version, and phase of the moon, Apple's compiler  
will *not* supply a default -isysroot value.  
  
We could potentially go back to the approach used in commit 68fc227dd,  
but I don't have a lot of faith in the reliability or life expectancy of  
that either.  Let's just revert to the approach already shipped in 11.0,  
namely specifying an -isysroot switch globally.  As a partial response to  
the concerns raised by Jakob Egger, adjust the contents of Makefile.global  
to look like  
  
CPPFLAGS = -isysroot $(PG_SYSROOT) ...  
PG_SYSROOT = /path/to/sysroot  
  
This allows overriding the sysroot path at build time in a relatively  
painless way.  
  
Add documentation to installation.sgml about how to use the PG_SYSROOT  
option.  I also took the opportunity to document how to work around  
macOS's "System Integrity Protection" feature.  
  
As before, back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M doc/src/sgml/installation.sgml
M src/Makefile.global.in
M src/template/darwin

Fix NULL handling in multi-batch Parallel Hash Left Join.

commit   : 1ce4a807e25bcd726e34b8d3ba0338e9299f9a87    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 3 Nov 2018 11:05:35 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 3 Nov 2018 11:05:35 +1300    

Click here for diff

NULL keys in left joins were skipped when building batch files.  
Repair, by making the keep_nulls argument to ExecHashGetHashValue()  
depend on whether this is a left outer join, as we do in other  
paths.  
  
Bug #15475.  Thinko in 1804284042e.  Back-patch to 11.  
  
Reported-by: Paul Schaap  
Diagnosed-by: Andrew Gierth  
Dicussion: https://postgr.es/m/15475-11a7a783fed72a36%40postgresql.org  

M src/backend/executor/nodeHashjoin.c

docs: adjust simpler language for NULL return from ANY/ALL

commit   : a4634b96cc419523b2aa699d0c9129331a6cc079    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Nov 2018 13:05:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Nov 2018 13:05:30 -0400    

Click here for diff

Adjustment to commit 8610c973ddf1cbf0befc1369d2cf0d56c0efcd0a.  
  
Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/func.sgml

GUC: adjust effective_cache_size docs and SQL description

commit   : 3e0f1a4741f564c1a2fa6e944729d6967355d8c7    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Nov 2018 09:11:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Nov 2018 09:11:00 -0400    

Click here for diff

Clarify that effective_cache_size is both kernel buffers and shared  
buffers.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

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

Fix some spelling errors in the documentation

commit   : 0083a824333874570ec34b23c9acd445d1183036    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 2 Nov 2018 13:55:57 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 2 Nov 2018 13:55:57 +0100    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

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

Fix spelling errors and typos in comments

commit   : fbec7459aa39da864ad1d578f044a21c3b3b057c    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 2 Nov 2018 13:56:16 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 2 Nov 2018 13:56:16 +0100    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/transam/xact.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execPartition.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/optimizer/plan/createplan.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/latch.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/typcache.c
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/include/replication/worker_internal.h
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/test/examples/testlibpq.c
M src/test/examples/testlibpq2.c
M src/test/examples/testlibpq3.c
M src/test/examples/testlibpq4.c
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/foreign_key.sql
M src/test/regress/sql/privileges.sql
M src/test/subscription/t/004_sync.pl
M src/tools/msvc/Mkvcbuild.pm

doc: use simpler language for NULL return from ANY/ALL

commit   : 8610c973ddf1cbf0befc1369d2cf0d56c0efcd0a    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Nov 2018 08:54:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Nov 2018 08:54:34 -0400    

Click here for diff

Previously the combination of "does not return" and "any row" caused  
ambiguity.  
  
Reported-by: KES <[email protected]>  
  
Discussion: https://postgr.es/m/[email protected]  
  
Reviewed-by: David G. Johnston  
  
Backpatch-through: 9.3  

M doc/src/sgml/func.sgml

Lower error level from PANIC to FATAL when restoring slots at startup

commit   : 6286efb5240f4ce4f1cd51bc11f49d367b7e7f62    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 2 Nov 2018 07:59:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 2 Nov 2018 07:59:24 +0900    

Click here for diff

When restoring slot information from disk at startup and filling in  
shared memory information, the startup process would issue a PANIC  
message if more slots are found than what max_replication_slots allows,  
and then Postgres generates a core dump, recommending to increase  
max_replication_slots.  This gives users a switch to crash Postgres at  
will by creating slots, lower the configuration to not support it, and  
then restart it.  
  
Making Postgres crash hard in this case is overdoing it just to give a  
recommendation to users.  So instead use a FATAL, which makes Postgres  
fail to start without crashing, still giving the recommendation.  This  
is more consistent with what happens for prepared transactions for  
example.  
  
Author: Michael Paquier  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c

Remove obsolete pg_constraint.consrc column

commit   : 96b00c433cd615144a34ff1a79d691d8b297120d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Oct 2018 11:45:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Oct 2018 11:45:50 +0100    

Click here for diff

This has been deprecated and effectively unused for a long time.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Remove obsolete pg_attrdef.adsrc column

commit   : fe5038236c6b99d48c2faa2247b5cec9703add2a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 27 Oct 2018 11:25:20 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 27 Oct 2018 11:25:20 +0100    

Click here for diff

This has been deprecated and effectively unused for a long time.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/heap.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_attrdef.h

Fix error message typo introduced 691d79a07933.

commit   : 8a99f8a82775cee3fd35abb21a29b5b2dfc31cf5    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 1 Nov 2018 10:44:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 1 Nov 2018 10:44:29 -0700    

Click here for diff

Reported-By: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, like the previous commit  

M src/backend/replication/slot.c

Adjust trace_sort log messages.

commit   : cb6f8a9a7243d398c76f9299a1b601270834d303    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 1 Nov 2018 09:18:57 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 1 Nov 2018 09:18:57 -0700    

Click here for diff

The project message style guide dictates: "When citing the name of an  
object, state what kind of object it is".  The parallel CREATE INDEX  
patch added a worker number to most of the trace_sort messages within  
tuplesort.c without specifying the object type.  Bring these messages  
into compliance with the style guide.  
  
We're still treating a leader or serial Tuplesortstate as having worker  
number -1.  trace_sort is a developer option, and these two cases are  
highly comparable, so this seems appropriate.  
  
Per complaint from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where parallel CREATE INDEX was introduced.  

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

Disallow starting server with insufficient wal_level for existing slot.

commit   : 691d79a0793328a45b01348675ba677aa7623bec    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 31 Oct 2018 14:47:41 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 31 Oct 2018 14:47:41 -0700    

Click here for diff

Previously it was possible to create a slot, change wal_level, and  
restart, even if the new wal_level was insufficient for the  
slot. That's a problem for both logical and physical slots, because  
the necessary WAL records are not generated.  
  
This removes a few tests in newer versions that, somewhat  
inexplicably, whether restarting with a too low wal_level worked (a  
buggy behaviour!).  
  
Reported-By: Joshua D. Drake  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, where replication slots where introduced  

M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/test/recovery/t/006_logical_decoding.pl

Fix memory leak in repeated SPGIST index scans.

commit   : 696b0c5fd0a8765fe6dfd075a30be06b448fd615    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Oct 2018 17:04:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Oct 2018 17:04:42 -0400    

Click here for diff

spgendscan neglected to pfree all the memory allocated by spgbeginscan.  
It's possible to get away with that in most normal queries, since the  
memory is allocated in the executor's per-query context which is about  
to get deleted anyway; but it causes severe memory leakage during  
creation or filling of large exclusion-constraint indexes.  
  
Also, document that amendscan is supposed to free what ambeginscan  
allocates.  The docs' lack of clarity on that point probably caused this  
bug to begin with.  (There is discussion of changing that API spec going  
forward, but I don't think it'd be appropriate for the back branches.)  
  
Per report from Bruno Wolff.  It's been like this since the beginning,  
so back-patch to all active branches.  
  
In HEAD, also fix an independent leak caused by commit 2a6368343  
(allocating memory during spgrescan instead of spgbeginscan, which  
might be all right if it got cleaned up, but it didn't).  And do a bit  
of code beautification on that commit, too.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/indexam.sgml
M src/backend/access/spgist/spgscan.c

Fix typo in xlog.c.

commit   : c4ab62f9acc0389697042cb642aa74beabdc8cc7    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 31 Oct 2018 07:50:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 31 Oct 2018 07:50:32 -0700    

Click here for diff

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

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

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

commit   : 10bfda06176739faedf909c9aba9823cdd21165d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Oct 2018 09:47:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Oct 2018 09:47:53 -0400    

Click here for diff

This patch absorbs an upstream fix to "zic" for a recently-introduced  
bug that made it output data that some 32-bit clients couldn't read.  
Given the current source data, the bug only manifests in zones with  
leap seconds, which we don't generate, so that there's no actual  
change in our installed timezone data files from this.  Still, in  
case somebody uses our copy of "zic" to do something else, it seems  
best to apply the fix promptly.  
  
Also, update the README's notes about converting upstream code to  
our conventions.  

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

Update time zone data files to tzdata release 2018g.

commit   : 5c2e0ca5f0be780c5fa9c85f4cd4b1106ff747ab    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Oct 2018 08:35:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Oct 2018 08:35:50 -0400    

Click here for diff

DST law changes in Morocco (with, effectively, zero notice).  
Historical corrections for Hawaii.  

M src/timezone/data/tzdata.zi

Fix interaction of CASE and ArrayCoerceExpr.

commit   : 14a158f9bff132f26873c08f9f13946379d42994    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Oct 2018 15:26:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Oct 2018 15:26:11 -0400    

Click here for diff

An array-type coercion appearing within a CASE that has a constant  
(after const-folding) test expression was mangled by the planner, causing  
all the elements of the resulting array to be equal to the coerced value  
of the CASE's test expression.  This is my oversight in commit c12d570fa:  
that changed ArrayCoerceExpr to use a subexpression involving a  
CaseTestExpr, and I didn't notice that eval_const_expressions needed an  
adjustment to keep from folding such a CaseTestExpr to a constant when  
it's inside a suitable CASE.  
  
This is another in what's getting to be a depressingly long line of bugs  
associated with misidentification of the referent of a CaseTestExpr.  
We're overdue to redesign that mechanism; but any such fix is unlikely  
to be back-patchable into v11.  As a stopgap, fix eval_const_expressions  
to do what it must here.  Also add a bunch of comments pointing out the  
restrictions and assumptions that are needed to make this work at all.  
  
Also fix a related oversight: contain_context_dependent_node() was not  
aware of the relationship of ArrayCoerceExpr to CaseTestExpr.  That was  
somewhat fail-soft, in that the outcome of a wrong answer would be to  
prevent optimizations that could have been made, but let's fix it while  
we're at it.  
  
Per bug #15471 from Matt Williams.  Back-patch to v11 where the faulty  
logic came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_target.c
M src/include/nodes/primnodes.h
M src/test/regress/expected/case.out
M src/test/regress/sql/case.sql

pg_rewind: Remove unused macro

commit   : c2c7c263af00a94bbc1a15461215f29280a9ddf0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Oct 2018 13:22:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Oct 2018 13:22:11 +0100    

Click here for diff

This has never been used while pg_rewind was in the tree (possibly  
once copied from pg_upgrade).  

M src/bin/pg_rewind/logging.c

Consolidate cross-option checks in pg_restore

commit   : c34bca9ea55e1d7c207ebc30691a8d2b421100eb    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 30 Oct 2018 11:38:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 30 Oct 2018 11:38:35 +0900    

Click here for diff

This moves one check for conflicting options from the archive restore  
code to the main function where other similar checks are performed.  
Also reword the error message to be consistent with other messages.  
  
The only option combination impacted is --create specified with  
--single-transaction, and informing the caller at an early step saves  
from opening the archive worked on.  A TAP test is added for this  
combination.  
  
Author: Daniel Gustafsson  
Reviewed-by: Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl

Add pg_partition_tree to display information about partitions

commit   : d5eec4eefde70414c9929b32c411cb4f0900a2a9    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 30 Oct 2018 10:25:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 30 Oct 2018 10:25:06 +0900    

Click here for diff

This new function is useful to display a full tree of partitions with a  
partitioned table given in output, and avoids the need of any complex  
WITH RECURSIVE query when looking at partition trees which are  
deep multiple levels.  
  
It returns a set of records, one for each partition, containing the  
partition's name, its immediate parent's name, a boolean value telling  
if the relation is a leaf in the tree and an integer telling its level  
in the partition tree with given table considered as root, beginning at  
zero for the root, and incrementing by one each time the scan goes one  
level down.  
  
Author: Amit Langote  
Reviewed-by: Jesper Pedersen, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/partitionfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
A src/test/regress/expected/partition_info.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
A src/test/regress/sql/partition_info.sql

Fix missing whitespace in pg_dump ref page

commit   : 56c0484b2ef10cacdfc3f35e017e8049ecc0800b    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 29 Oct 2018 12:34:49 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 29 Oct 2018 12:34:49 +0100    

Click here for diff

Author: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/ref/pg_dump.sgml

Exclude temporary directories from pgindent

commit   : a9e5f8e7810b46113c5322155411198484695dba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Oct 2018 11:39:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Oct 2018 11:39:44 +0100    

Click here for diff

Exclude tmp_check and tmp_install from pgindent.  In a fully-built  
tree, pgindent would spend a lot of time digging through these  
directories and ends up re-indenting installed header files.  

M src/tools/pgindent/exclude_file_patterns

pg_restore: Augment documentation for -N option

commit   : 2fe42baf7c1ad96b5f9eb898161e258315298351    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Oct 2018 11:31:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Oct 2018 11:31:43 +0100    

Click here for diff

This was forgotten when the option was added.  
  
Author: Michael Banck <[email protected]>  

M src/bin/pg_dump/pg_restore.c

Improve description of pg_attrdef in documentation

commit   : 0993b8ada53395a8c8a59401a7b4cfb501f6aaef    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Oct 2018 16:38:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Oct 2018 16:38:54 +0900    

Click here for diff

The reference to pg_attribute is switched to a link, which is more  
useful for the html documentation.  The conditions under which a default  
value is defined for a given column are made more general.  
  
Author: Daniel Gustafsson  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml

Remove incorrect comment in dshash.c.

commit   : 051a1494bd31fbb743c23d39299da6933847afb5    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 29 Oct 2018 12:57:55 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 29 Oct 2018 12:57:55 +1300    

Click here for diff

Back-patch to 11.  
  
Author: Antonin Houska  
Discussion: https://postgr.es/m/8726.1540553521%40localhost  

M src/backend/lib/dshash.c

Fix perl searchpath for modern perl for MSVC tools

commit   : 1df92eeafefac471b8bcb00244452c645e4e14fd    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 28 Oct 2018 12:22:32 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 28 Oct 2018 12:22:32 -0400    

Click here for diff

Modern versions of perl no longer include the current directory in the  
perl searchpath, as it's insecure. Instead of adding the current  
directory, we get around the problem by adding the directory where the  
script lives.  
  
Problem noted by Victor Wagner.  
  
Solution adapted from buildfarm client code.  
  
Backpatch to all live versions.  

M src/tools/msvc/install.pl
M src/tools/msvc/mkvcbuild.pl
M src/tools/msvc/vcregress.pl

Improve tab completion of CREATE EVENT TRIGGER in psql

commit   : 5953c99697621174f50aa219a3cd457212968268    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 26 Oct 2018 13:46:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 26 Oct 2018 13:46:20 +0900    

Click here for diff

This adds tab completion of the clauses WHEN and EXECUTE  
FUNCTION|PROCEDURE clauses to CREATE EVENT TRIGGER, similar to CREATE  
TRIGGER in the previous commit.  This has version-dependent logic so as  
FUNCTION is chosen over PROCEDURE for 11 and newer versions.  
  
Author: Dagfinn Ilmari Mannsåker  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Add tab completion of EXECUTE FUNCTION for CREATE TRIGGER in psql

commit   : 292ef6e2778afb3ecea250fc50326587543ae144    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 26 Oct 2018 09:30:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 26 Oct 2018 09:30:43 +0900    

Click here for diff

The change to accept EXECUTE FUNCTION as well as EXECUTE PROCEDURE in  
CREATE TRIGGER (added by 0a63f99) forgot to tell psql's tab completion  
system about this.  In passing, add tab completion of EXECUTE  
FUNCTION/PROCEDURE after a complete WHEN ( … ) clause.  
  
This change is version-aware, with FUNCTION being selected automatically  
instead of PROCEDURE depending on the backend version, PROCEDURE being  
an historical grammar kept for compatibility and considered as  
deprecated in v11.  
  
Author: Dagfinn Ilmari Mannsåker  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Add pg_promote function

commit   : 10074651e3355e2405015f6253602be8344bc829    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 25 Oct 2018 09:46:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 25 Oct 2018 09:46:00 +0900    

Click here for diff

This function is able to promote a standby with this new SQL-callable  
function.  Execution access can be granted to non-superusers so that  
failover tools can observe the principle of least privilege.  
  
Catalog version is bumped.  
  
Author: Laurenz Albe  
Reviewed-by: Michael Paquier, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/recovery-config.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_views.sql
M src/backend/postmaster/pgstat.c
M src/include/access/xlog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/recovery/t/004_timeline_switch.pl

Apply unconstify() in more places

commit   : 0a8590b2a09e7a9e10612bc38d5e872b0c234eca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Oct 2018 00:42:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Oct 2018 00:42:57 +0100    

Click here for diff

Discussion: https://www.postgresql.org/message-id/08adbe4e-38f8-2c73-55f0-591392371687%402ndquadrant.com  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/varlena.c
M src/port/win32setlocale.c

Improve unconstify() documentation

commit   : f2898de98a5407a8b78f49866ef4931813505ca2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Oct 2018 00:47:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Oct 2018 00:47:59 +0100    

Click here for diff

Refer to expression instead of variable when appropriate.  
  
Discussion: https://www.postgresql.org/message-id/08adbe4e-38f8-2c73-55f0-591392371687%402ndquadrant.com  

M src/include/c.h

Fix typo in regression test comment

commit   : 4beea5508e80a65a90f3fa857ea34ec71b9d6db2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 24 Oct 2018 19:39:50 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 24 Oct 2018 19:39:50 -0400    

Click here for diff

per Michael Banck  

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

Correctly set t_self for heap tuples in expand_tuple

commit   : 040a1df6149f852c3b8de96d9d13258af8a39e23    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 24 Oct 2018 10:45:34 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 24 Oct 2018 10:45:34 -0400    

Click here for diff

Commit 16828d5c0 incorrectly set an invalid pointer for t_self for heap  
tuples. This patch correctly copies it from the source tuple, and  
includes a regression test that relies on it being set correctly.  
  
Backpatch to release 11.  
  
Fixes bug #15448 reported by Tillmann Schulz  
  
Diagnosis and test case by Amit Langote  

M src/backend/access/common/heaptuple.c
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

List wait events in alphabetical order

commit   : 5ef037cf0b9e130120c5a788f1f1048f6242b076    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Oct 2018 17:02:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Oct 2018 17:02:37 +0900    

Click here for diff

This changes the documentation, and the related structures so as  
everything is consistent.  
  
Some wait events were not listed alphabetically since their  
introduction, others have been added rather randomly.  Keeping all those  
entries in order helps in maintenance, and helps the user looking at the  
documentation.  
  
Author: Michael Paquier, Kuntal Ghosh  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10, only for the documentation part to avoid an ABI  
breakage.  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Remove get_attidentity()

commit   : 5d7c703a44101f0d686fb66f4ff671429f46a84c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Oct 2018 14:45:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Oct 2018 14:45:29 +0200    

Click here for diff

All existing uses can get this information more easily from the  
relation descriptor, so the detour through the syscache is not  
necessary.  
  
Reviewed-by: Michael Paquier <[email protected]>  

M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h

Remove get_atttypmod()

commit   : c903bb7b1c3ce82e21d6bd1af1dc45a58cd88455    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Oct 2018 19:28:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Oct 2018 19:28:28 +0200    

Click here for diff

This has been unused since 2004.  get_atttypetypmodcoll() is often a  
better alternative.  
  
Reviewed-by: Michael Paquier <[email protected]>  

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

Drop const cast from dlsym() calls

commit   : e6f5d1accd3ae170a0baa632bfe3396bdd9b6e92    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Oct 2018 14:35:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Oct 2018 14:35:59 +0200    

Click here for diff

This workaround might be obsolete.  We'll see if those "older  
platforms" mentioned in the comment are still around.  
  
Discussion: https://www.postgresql.org/message-id/08adbe4e-38f8-2c73-55f0-591392371687%402ndquadrant.com  

M src/backend/utils/fmgr/dfmgr.c

Sprinkle some const decorations

commit   : 807e4bc828cff0645d2a776604dc7cdc733b2fd3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Oct 2018 12:17:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Oct 2018 12:17:16 +0200    

Click here for diff

These mainly help understanding the function signatures better.  

M src/backend/parser/parse_coerce.c
M src/include/parser/parse_coerce.h

Clarify descriptions of relhassubclass and relispartition in pg_class

commit   : 55853d666ce5d0024c50dc3d223346df28abfa70    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Oct 2018 15:26:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Oct 2018 15:26:28 +0900    

Click here for diff

Three places are fixed, one for each author.  
  
Reported-by: Tom Lane  
Author: Tom Lane, Amit Langote, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/include/catalog/pg_class.h

Set pg_class.relhassubclass for partitioned indexes

commit   : 17f206fbc824d2b4b14480199ca9ff7dea417eda    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Oct 2018 11:04:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Oct 2018 11:04:48 +0900    

Click here for diff

Like for relations, switching this parameter is optimistic by turning it  
on each time a partitioned index gains a partition.  So seeing this  
parameter set to true means that the partitioned index has or has had  
partitions.  The flag cannot be reset yet for partitioned indexes, which  
is something not obvious anyway as partitioned relations exist to have  
partitions.  
  
This allows to track more conveniently partition trees for indexes,  
which will come in use with an upcoming patch helping in listing  
partition trees with an SQL-callable function.  
  
Author: Amit Langote  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Fix some grammar errors in bloom.sgml

commit   : 31ff51adc855e3ffe8e3c20e479b8d1a4508feb8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 22 Oct 2018 00:23:26 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 22 Oct 2018 00:23:26 +0300    

Click here for diff

Discussion: https://postgr.es/m/CAEepm%3D3sijpGr8tXdyz-7EJJZfhQHABPKEQ29gpnb7-XSy%2B%3D5A%40mail.gmail.com  
Reported-by: Thomas Munro  
Backpatch-through: 9.6  

M doc/src/sgml/bloom.sgml

Don't try to test files named with a trailing dot on Windows

commit   : c468bd5c087051e2edc573118a42d73a8ae3c3a4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 21 Oct 2018 09:00:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 21 Oct 2018 09:00:13 -0400    

Click here for diff

The pg_verify_checksums test tries to create files with corrupt data  
named "123." and "123_." But on Windows a file name with a trailing dot  
is the same as a file without the trailing dot. In the first case this  
will create a file with a "valid" name, which causes the test to fail in  
an unexpected way, and in the secongd case this will be redandant as the  
test already creates a file named "123_".  
  
Bug discovered by buildfarm animal bowerbird.  

M src/bin/pg_verify_checksums/t/002_actions.pl

Lower privilege level of programs calling regression_main

commit   : ce5d3424d6411f7a7228fd4463242cb382af3e0c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 20 Oct 2018 09:02:36 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 20 Oct 2018 09:02:36 -0400    

Click here for diff

On Windows this mean that the regression tests can now safely and  
successfully run as Administrator, which is useful in situations like  
Appveyor. Elsewhere it's a no-op.  
  
Backpatch to 9.5 - this is harder in earlier branches and not worth the  
trouble.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Client-side fixes for delayed NOTIFY receipt.

commit   : 4247db62522fafd1d4c045c5a432f50f2f05c0e0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 22:22:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 22:22:57 -0400    

Click here for diff

PQnotifies() is defined to just process already-read data, not try to read  
any more from the socket.  (This is a debatable decision, perhaps, but I'm  
hesitant to change longstanding library behavior.)  The documentation has  
long recommended calling PQconsumeInput() before PQnotifies() to ensure  
that any already-arrived message would get absorbed and processed.  
However, psql did not get that memo, which explains why it's not very  
reliable about reporting notifications promptly.  
  
Also, most (not quite all) callers called PQconsumeInput() just once before  
a PQnotifies() loop.  Taking this recommendation seriously implies that we  
should do PQconsumeInput() before each call.  This is more important now  
that we have "payload" strings in notification messages than it was before;  
that increases the probability of having more than one packet's worth  
of notify messages.  Hence, adjust code as well as documentation examples  
to do it like that.  
  
Back-patch to 9.5 to match related server fixes.  In principle we could  
probably go back further with these changes, but given lack of field  
complaints I doubt it's worthwhile.  
  
Discussion: https://postgr.es/m/CAOYf6ec-TmRYjKBXLLaGaB-jrd=mjG1Hzn1a1wufUAR39PQYhw@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/bin/psql/common.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/libpq/fe-exec.c
M src/test/examples/testlibpq2.c

Server-side fix for delayed NOTIFY and SIGTERM processing.

commit   : 2ddb9149d14de9a2e7ac9ec6accf3ad442702b24    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 21:39:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 21:39:21 -0400    

Click here for diff

Commit 4f85fde8e introduced some code that was meant to ensure that we'd  
process cancel, die, sinval catchup, and notify interrupts while waiting  
for client input.  But there was a flaw: it supposed that the process  
latch would be set upon arrival at secure_read() if any such interrupt  
was pending.  In reality, we might well have cleared the process latch  
at some earlier point while those flags remained set -- particularly  
notifyInterruptPending, which can't be handled as long as we're within  
a transaction.  
  
To fix the NOTIFY case, also attempt to process signals (except  
ProcDiePending) before trying to read.  
  
Also, if we see that ProcDiePending is set before we read, forcibly set the  
process latch to ensure that we will handle that signal promptly if no data  
is available.  I also made it set the process latch on the way out, in case  
there is similar logic elsewhere.  (It remains true that we won't service  
ProcDiePending here unless we need to wait for input.)  
  
The code for handling ProcDiePending during a write needs those changes,  
too.  
  
Also be a little more careful about when to reset whereToSendOutput,  
and improve related comments.  
  
Back-patch to 9.5 where this code was added.  I'm not entirely convinced  
that older branches don't have similar issues, but the complaint at hand  
is just about the >= 9.5 code.  
  
Jeff Janes and Tom Lane  
  
Discussion: https://postgr.es/m/CAOYf6ec-TmRYjKBXLLaGaB-jrd=mjG1Hzn1a1wufUAR39PQYhw@mail.gmail.com  

M src/backend/libpq/be-secure.c
M src/backend/tcop/postgres.c

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

commit   : 12bfb778ce688fc662a6cb35f6298734fcf4856f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 19:36:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 19:36:34 -0400    

Click here for diff

About half of this is purely cosmetic changes to reduce the diff between  
our code and theirs, like inserting "const" markers where they have them.  
  
The other half is tracking actual code changes in zic.c and localtime.c.  
I don't think any of these represent near-term compatibility hazards, but  
it seems best to stay up to date.  
  
I also fixed longstanding bugs in our code for producing the  
known_abbrevs.txt list, which by chance hadn't been exposed before,  
but which resulted in some garbage output after applying the upstream  
changes in zic.c.  Notably, because upstream removed their old phony  
transitions at the Big Bang, it's now necessary to cope with TZif files  
containing no DST transition times at all.  

M src/timezone/README
M src/timezone/localtime.c
M src/timezone/pgtz.h
M src/timezone/private.h
M src/timezone/strftime.c
M src/timezone/tzfile.h
M src/timezone/zic.c

Update time zone data files to tzdata release 2018f.

commit   : 13877d30f2ec93f6043937f76af207dcc614a4e7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 17:01:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 17:01:34 -0400    

Click here for diff

DST law changes in Chile, Fiji, and Russia (Volgograd).  
Historical corrections for China, Japan, Macau, and North Korea.  
  
Note: like the previous tzdata update, this involves a depressingly  
large amount of semantically-meaningless churn in tzdata.zi.  That  
is a consequence of upstream's data compression method assigning  
unstable abbreviations to DST rulesets.  I complained about that  
to them last time, and this version now uses an assignment method  
that pays some heed to not changing abbreviations unnecessarily.  
So hopefully, that'll be better going forward.  

M src/timezone/data/tzdata.zi
M src/timezone/known_abbrevs.txt
M src/timezone/tznames/America.txt
M src/timezone/tznames/Asia.txt
M src/timezone/tznames/Default
M src/timezone/tznames/Pacific.txt

Silence perlcritic warning about missing return.

commit   : e65e8f8218e3b99534f01bd5e67b1e6ec99e6f7e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 14:00:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 14:00:17 -0400    

Click here for diff

Per buildfarm member crake.  

M src/bin/pg_verify_checksums/t/002_actions.pl

Use whitelist to choose files scanned with pg_verify_checksums

commit   : d55241af705667d4503638e3f77d3689fd6be31d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Oct 2018 22:44:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Oct 2018 22:44:12 +0900    

Click here for diff

The original implementation of pg_verify_checksums used a blacklist to  
decide which files should be skipped for scanning as they do not include  
data checksums, like pg_internal.init or pg_control.  However, this  
missed two things:  
- Some files are created within builds of EXEC_BACKEND and these were  
not listed, causing failures on Windows.  
- Extensions may create custom files in data folders, causing the tool  
to equally fail.  
  
This commit switches to a whitelist-like method instead by checking if  
the files to scan are authorized relation files.  This is close to a  
reverse-engineering of what is defined in relpath.c in charge of  
building the relation paths, and we could consider refactoring what this  
patch does so as all routines are in a single place.  This is left for  
later.  
  
This is based on a suggestion from Andres Freund.  TAP tests are updated  
so as multiple file patterns are tested.  The bug has been spotted by  
various buildfarm members as a result of b34e84f which has introduced  
the TAP tests of pg_verify_checksums.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan, Michael Banck  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/pg_verify_checksums/t/002_actions.pl

Add missing quote_identifier calls for CREATE TRIGGER ... REFERENCING.

commit   : 350410be459ccda7eeeea35b56b5f2d24391f90c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 00:50:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Oct 2018 00:50:16 -0400    

Click here for diff

Mixed-case names for transition tables weren't dumped correctly.  
Oversight in commit 8c48375e5, per bug #15440 from Karl Czajkowski.  
  
In passing, I couldn't resist a bit of code beautification.  
  
Back-patch to v10 where this was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor pid, random seed and start time initialization.

commit   : 197e4af9d5da180190a0f2be851b095dba57d9cd    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 19 Oct 2018 13:59:14 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 19 Oct 2018 13:59:14 +1300    

Click here for diff

Background workers, including parallel workers, were generating  
the same sequence of numbers in random().  This showed up as DSM  
handle collisions when Parallel Hash created multiple segments,  
but any code that calls random() in background workers could be  
affected if it cares about different backends generating different  
numbers.  
  
Repair by making sure that all new processes initialize the seed  
at the same time as they set MyProcPid and MyStartTime in a new  
function InitProcessGlobals(), called by the postmaster, its  
children and also standalone processes.  Also add a new high  
resolution MyStartTimestamp as a potentially useful by-product,  
and remove SessionStartTime from struct Port as it is now  
redundant.  
  
No back-patch for now, as the known consequences so far are just  
a bunch of harmless shm_open(O_EXCL) collisions.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAEepm%3D2eJj_6%3DB%2B2tEpGu2nf1BjthCf9nXXUouYvJJ4C5WSwhg%40mail.gmail.com  

M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/include/postmaster/postmaster.h

Still further rethinking of build changes for macOS Mojave.

commit   : e74dd00f53cd6dc1887f76b9672e5f6dcf0fd8a2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Oct 2018 14:55:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Oct 2018 14:55:23 -0400    

Click here for diff

To avoid the sorts of problems complained of by Jakob Egger, it'd be  
best if configure didn't emit any references to the sysroot path at all.  
In the case of PL/Tcl, we can do that just by keeping our hands off the  
TCL_INCLUDE_SPEC string altogether.  In the case of PL/Perl, we need to  
substitute -iwithsysroot for -I in the compile commands, which is easily  
handled if we change to using a configure output variable that includes  
the switch not only the directory name.  Since PL/Tcl and PL/Python  
already do it like that, this seems like good consistency cleanup anyway.  
  
Hence, this replaces the advice given to Perl-related extensions in commit  
5e2217131; instead of writing "-I$(perl_archlibexp)/CORE", they should  
just write "$(perl_includespec)".  (The old way continues to work, but not  
on recent macOS.)  
  
It's still the case that configure needs to be aware of the sysroot  
path internally, but that's cleaner than what we had before.  
  
As before, back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M contrib/hstore_plperl/Makefile
M contrib/jsonb_plperl/Makefile
M src/Makefile.global.in
M src/pl/plperl/GNUmakefile
M src/template/darwin

commit   : 26cb82030fa83e222f5744fb8254ec9073162273    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 16:41:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 16:41:00 -0400    

Click here for diff

es_leaf_result_relations doesn't exist; perhaps this was an old name  
for es_tuple_routing_result_relations, or maybe this comment has gone  
unmaintained through multiple rounds of whacking the code around.  
  
Related comment in execnodes.h was both obsolete and ungrammatical.  

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

Const-ify a few more large static tables.

commit   : 48d818ede15b3e43546e8d49dc19a3021bc773cf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 15:32:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 15:32:47 -0400    

Click here for diff

Per research by Andres.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/datetime.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/sjis.map
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c

Fix minor bug in isolationtester.

commit   : 9958b2b2a8cc25e8d791fc965fff3f0496163be6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 15:06:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 15:06:38 -0400    

Click here for diff

If the lock wait query failed, isolationtester would report the  
PQerrorMessage from some other connection, meaning there would be  
no message or an unrelated one.  This seems like a pretty unlikely  
occurrence, but if it did happen, this bug could make it really  
difficult/confusing to figure out what happened.  That seems to  
justify patching all the way back.  
  
In passing, clean up another place where the "wrong" conn was used  
for an error report.  That one's not actually buggy because it's  
a different alias for the same connection, but it's still confusing  
to the reader.  

M src/test/isolation/isolationtester.c

Fix crash in multi-insert COPY

commit   : a7a1b44516e7db89104c06440f759c2831fcb0ff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 Oct 2018 20:31:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 Oct 2018 20:31:20 +0200    

Click here for diff

A bug introduced in 0d5f05cde011512e605bb2688d9b1fbb5b3ae152  
considered the *previous* partition's triggers when deciding whether  
multi-insert can be used.  Rearrange the code so that the current  
partition is considered.  
  
Author: Ashutosh Sharma <[email protected]>  

M src/backend/commands/copy.c
M src/test/regress/input/copy.source
M src/test/regress/output/copy.source

Minor additional improvements for ecpglib/prepare.c.

commit   : d8cc1616b5547d49d899be7b68713272ce334708    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 14:22:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 14:22:33 -0400    

Click here for diff

Avoid allocating never-used entries in stmtCacheEntries[], other than the  
intentionally-unused zero'th entry.  Tie the array size directly to the  
bucket count and size, rather than having undocumented dependencies between  
three magic constants.  Fix the hash calculation to be platform-independent  
--- notably, it was sensitive to the signed'ness of "char" before, not to  
mention having an unnecessary hard-wired dependency on the existence and  
size of type "long long".  (The lack of complaints says it's been a long  
time since anybody tried to build PG on a compiler without "long long",  
and certainly with the requirement for C99 this isn't a live bug anymore.  
But it's still not per project coding style.)  Fix ecpg_auto_prepare's  
new-cache-entry path so that it increments the exec count for the new  
cache entry not the dummy zero'th entry.  
  
The last of those is an actual bug, though one of little consequence;  
the rest is mostly future-proofing and neatnik-ism.  Doesn't seem  
necessary to back-patch.  

M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/test/expected/preproc-autoprep.stderr

Improve tzparse's handling of TZDEFRULES ("posixrules") zone data.

commit   : e7eb07f7095185e64d7b9c8ff5f3e1588d6e508a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 12:26:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 12:26:48 -0400    

Click here for diff

In the IANA timezone code, tzparse() always tries to load the zone  
file named by TZDEFRULES ("posixrules").  Previously, we'd hacked  
that logic to skip the load in the "lastditch" code path, which we use  
only to initialize the default "GMT" zone during GUC initialization.  
That's critical for a couple of reasons: since we do not support leap  
seconds, we *must not* allow "GMT" to have leap seconds, and since this  
case runs before the GUC subsystem is fully alive, we'd really rather  
not take the risk of pg_open_tzfile throwing any errors.  
  
However, that still left the code reading TZDEFRULES on every other  
call, something we'd noticed to the extent of having added code to cache  
the result so it was only done once per process not a lot of times.  
Andres Freund complained about the static data space used up for the  
cache; but as long as the logic was like this, there was no point in  
trying to get rid of that space.  
  
We can improve matters by looking a bit more closely at what the IANA  
code actually needs the TZDEFRULES data for.  One thing it does is  
that if "posixrules" is a leap-second-aware zone, the leap-second  
behavior will be absorbed into every POSIX-style zone specification.  
However, that's a behavior we'd really prefer to do without, since  
for our purposes the end effect is to render every POSIX-style zone  
name unsupported.  Otherwise, the TZDEFRULES data is used only if  
the POSIX zone name specifies DST but doesn't include a transition  
date rule (e.g., "EST5EDT" rather than "EST5EDT,M3.2.0,M11.1.0").  
That is a minority case for our purposes --- in particular, it  
never happens when tzload() invokes tzparse() to interpret a  
transition date rule string found in a tzdata zone file.  
  
Hence, if we legislate that we're going to ignore leap-second data  
from "posixrules", we can postpone the TZDEFRULES load into the path  
where we actually need to substitute for a missing date rule string.  
That means it will never happen at all in common scenarios, making it  
reasonable to dynamically allocate the cache space when it does happen.  
Even when the data is already loaded, this saves some cycles in the  
common code path since we avoid a memcpy of 23KB or so.  And, IMO at  
least, this is a less ugly hack on the IANA logic than what we had  
before, since it's not messing with the lastditch-vs-regular code paths.  
  
Back-patch to all supported branches, not so much because this is a  
critical change as that I want to keep all our copies of the IANA  
timezone code in sync.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid statically allocating statement cache in ecpglib/prepare.c.

commit   : e15aae829e3eb686bdf03dea9022a61f8039a7ef    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 00:04:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Oct 2018 00:04:48 -0400    

Click here for diff

This removes a megabyte of storage that isn't used at all in ecpglib's  
default operating mode --- you have to enable auto-prepare to get any  
use out of it.  Seems well worth the trouble to allocate on demand.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Formatting cleanup in ecpglib/prepare.c.

commit   : 92dff341160ae896dcfff2dac59fd0c860892f26    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 23:43:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 23:43:15 -0400    

Click here for diff

Looking at this code made my head hurt.  Format the comments more  
like the way it's done elsewhere, break a few overly long lines.  
No actual code changes in this commit.  

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

Reorder FmgrBuiltin members, saving 25% in size.

commit   : 28d750c0cd5b3cea0dfbc84cce24e30f5c2eb966    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 16 Oct 2018 14:51:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 16 Oct 2018 14:51:18 -0700    

Click here for diff

That's worth it, as fmgr_builtins is frequently accessed, and as  
fmgr_builtins is one of the biggest constant variables in a backend.  
  
On most 64bit systems this will change the size of the struct from  
32byte to 24bytes. While that could make indexing into the array  
marginally more expensive, the higher cache hit ratio is worth more,  
especially because these days fmgr_builtins isn't searched with a  
binary search anymore (c.f. 212e6f34d5).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/Gen_fmgrtab.pl
M src/include/utils/fmgrtab.h

Back off using -isysroot on Darwin.

commit   : 68fc227dd0737f38295f3dee0c10268ad11a5150    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 16:27:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 16:27:15 -0400    

Click here for diff

Rethink the solution applied in commit 5e2217131 to get PL/Tcl to  
build on macOS Mojave.  I feared that adding -isysroot globally might  
have undesirable consequences, and sure enough Jakob Egger reported  
one: it complicates building extensions with a different Xcode version  
than was used for the core server.  (I find that a risky proposition  
in general, but apparently it works most of the time, so we shouldn't  
break it if we don't have to.)  
  
We'd already adopted the solution for PL/Perl of inserting the sysroot  
path directly into the -I switches used to find Perl's headers, and we  
can do the same thing for PL/Tcl by changing the -iwithsysroot switch  
that Apple's tclConfig.sh reports.  This restricts the risks to PL/Perl  
and PL/Tcl themselves and directly-dependent extensions, which is a lot  
more pleasing in general than a global -isysroot switch.  
  
Along the way, tighten the test to see if we need to inject the sysroot  
path into $perl_includedir, as I'd speculated about upthread but not  
gotten round to doing.  
  
As before, back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/template/darwin

Mark constantly allocated dest receiver as const.

commit   : 93ca02e00560ad6553fbd8ebabb7d5349e98ade8    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 16 Oct 2018 12:05:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 16 Oct 2018 12:05:50 -0700    

Click here for diff

This allows the compiler / linker to mark affected pages as read-only.  
  
Doing so requires casting constness away, as CreateDestReceiver()  
returns both constant and non-constant dest receivers. That's fine  
though, as any modification of the statically allocated receivers  
would already have been a bug (and would now be caught on some  
platforms).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/dest.c

Add macro to cast away const without allowing changes to underlying type.

commit   : d1211c63f010c4e0c22d6070872e80b8c8b4df82    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 16 Oct 2018 12:05:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 16 Oct 2018 12:05:50 -0700    

Click here for diff

The new unconsitify(underlying_type, var) macro allows to cast  
constness away from a variable, but doesn't allow changing the  
underlying type.  Enforcement of the latter currently only works for  
gcc like compilers.  
  
Please note IT IS NOT SAFE to cast constness away if the variable will ever  
be modified (it would be undefined behaviour). Doing so anyway can cause  
compiler misoptimizations or runtime crashes (modifying readonly memory).  
It is only safe to use when the the variable will not be modified, but API  
design or language restrictions prevent you from declaring that  
(e.g. because a function returns both const and non-const variables).  
  
This'll be used in an upcoming change, but seems like it's independent  
infrastructure.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h

Be smarter about age-counter overflow in formatting.c caches.

commit   : 2c300c680767a45450bf7afa4075095f40502dc4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 14:57:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 14:57:14 -0400    

Click here for diff

The previous code here simply threw away whatever it knew about cache  
entry ages whenever a counter overflow occurred.  Since the counter  
is int width and will be bumped once per format function execution,  
overflows are not really so rare as to not be worth thinking about.  
Instead, let's deal with the situation by halving all the age values,  
essentially rescaling the age metric.  In that way, we retain a  
pretty accurate (if not quite perfect) idea of which entries are oldest.  

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

Avoid rare race condition in privileges.sql regression test.

commit   : f7a953c2d870185499faaabd06983526a83eb387    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 13:56:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 13:56:58 -0400    

Click here for diff

We created a temp table, then switched to a new session, leaving  
the old session to clean up its temp objects in background.  If that  
took long enough, the eventual attempt to drop the user that owns  
the temp table could fail, as exhibited today by sidewinder.  
Fix by dropping the temp table explicitly when we're done with it.  
  
It's been like this for quite some time, so back-patch to all  
supported branches.  
  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sidewinder&dt=2018-10-16%2014%3A45%3A00  

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

Avoid statically allocating formatting.c's format string caches.

commit   : fd85e9f78d44f0f36776e644380ada077451c992    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 13:11:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 13:11:05 -0400    

Click here for diff

This eliminates circa 120KB of static data from Postgres' memory  
footprint.  In some usage patterns that space will get allocated  
anyway, but in many processes it never will be allocated.  
  
We can improve matters further by allocating only as many cache  
entries as we actually use, rather than allocating the whole array  
on first use.  However, to avoid wasting lots of space due to  
palloc's habit of rounding requests up to power-of-2 sizes, tweak  
the maximum cacheable format string length to make the struct sizes  
be powers of 2 or just less.  The sizes I chose make the maximums  
a little bit less than they were before, but I doubt it matters much.  
  
While at it, rearrange struct FormatNode to avoid wasting quite so  
much padding space.  This change actually halves the size of that  
struct on 64-bit machines.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Correct constness of system attributes in heap.c & prerequisites.

commit   : 02a30a09f9e57a29f7bda82f5f4bfc214eed3980    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 16 Oct 2018 09:44:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 16 Oct 2018 09:44:43 -0700    

Click here for diff

This allows the compiler / linker to mark affected pages as read-only.  
  
There's a fair number of pre-requisite changes, to allow the const  
properly be propagated. Most of consts were already required for  
correctness anyway, just not represented on the type-level.  Arguably  
we could be more aggressive in using consts in related code, but..  
  
This requires using a few of the types underlying typedefs that  
removes pointers (e.g. const NameData *) as declaring the typedefed  
type constant doesn't have the same meaning (it makes the variable  
const, not what it points to).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/executor/spi.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/name.c
M src/include/catalog/heap.h
M src/include/parser/parse_relation.h
M src/include/utils/builtins.h

Make PostgresNode.pm's poll_query_until() more chatty about failures.

commit   : c015ccb306ec81bca3023818c9cf0113cae25be1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 12:27:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 12:27:14 -0400    

Click here for diff

Reporting only the stderr is unhelpful when the problem is that the  
server output we're getting doesn't match what was expected.  So we  
should report the query output too; and just for good measure, let's  
print the query we used and the output we expected.  
  
Back-patch to 9.5 where poll_query_until was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgresNode.pm

Improve stability of recently-added regression test case.

commit   : 17d6a8fb764c95536c08742a7f94705e9774db05    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 12:01:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 12:01:18 -0400    

Click here for diff

Commit b5febc1d1 added a contrib/btree_gist test case that has been  
observed to fail in the buildfarm as a result of background auto-analyze  
updating stats and changing the selected plan.  Forestall that by  
forcibly analyzing in foreground, instead.  The new plan choice is  
just as good for our purposes, since we really only care that an  
index-only plan does not get selected.  
  
Back-patch to 9.5, like the previous patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/expected/inet.out
M contrib/btree_gist/sql/inet.sql

Avoid statically allocating gmtsub()'s timezone workspace.

commit   : 3dfef0c519de40a196dc26b76604151347bf5454    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 11:50:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 16 Oct 2018 11:50:18 -0400    

Click here for diff

localtime.c's "struct state" is a rather large object, ~23KB.  We were  
statically allocating one for gmtsub() to use to represent the GMT  
timezone, even though that function is not at all heavily used and is  
never reached in most backends.  Let's malloc it on-demand, instead.  
  
This does pose the question of how to handle a malloc failure, but  
there's already a well-defined error report convention here, ie  
set errno and return NULL.  
  
We have but one caller of pg_gmtime in HEAD, and two in back branches,  
neither of which were troubling to check for error.  Make them do so.  
The possible errors are sufficiently unlikely (out-of-range timestamp,  
and now malloc failure) that I think elog() is adequate.  
  
Back-patch to all supported branches to keep our copies of the IANA  
timezone code in sync.  This particular change is in a stanza that  
already differs from upstream, so it's a wash for maintenance purposes  
--- but only as long as we keep the branches the same.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/timestamp.c
M src/timezone/localtime.c

Correct constness of a few variables.

commit   : 62649bad831fb69b5d9644470acc413a35cddea6    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 15 Oct 2018 20:45:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 15 Oct 2018 20:45:30 -0700    

Click here for diff

This allows the compiler / linker to mark affected pages as read-only.  
  
There's other cases, but they're a bit more invasive, and should go  
through some review. These are easy.  
  
They were found with  
objdump -j .data -t src/backend/postgres|awk '{print $4, $5, $6}'|sort -r|less  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/event_trigger.c
M src/backend/foreign/foreign.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqmq.c
M src/backend/replication/basebackup.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/utils/adt/cash.c
M src/include/libpq/libpq.h
M src/include/storage/lwlock.h

Move TupleTableSlots boolean member into one flag variable.

commit   : c5257345ef61922468cd9abd887c3cb6c38792cb    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 15 Oct 2018 15:24:33 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 15 Oct 2018 15:24:33 -0700    

Click here for diff

There's several reasons for this change:  
1) It reduces the total size of TupleTableSlot / reduces alignment  
   padding, making the commonly accessed members fit into a single  
   cacheline (but we currently do not force proper alignment, so  
   that's not yet guaranteed to be helpful)  
2) Combining the booleans into a flag allows to combine read/writes  
   from memory.  
3) With the upcoming slot abstraction changes, it allows to have core  
   and extended flags, in a memory efficient way.  
  
Author: Ashutosh Bapat and Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeModifyTable.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/include/executor/executor.h
M src/include/executor/tuptable.h

Move generic slot support functions from heaptuple.c into execTuples.c.

commit   : 9d906f1119de893a4ca533c5e7b97207a3aa963b    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 14 Oct 2018 15:18:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 14 Oct 2018 15:18:16 -0700    

Click here for diff

heaptuple.c was never a particular good fit for slot_getattr(),  
slot_getsomeattrs() and slot_getmissingattrs(), but in upcoming  
changes slots will be made more abstract (allowing slots that contain  
different types of tuples), making it clearly the wrong place.  
  
Note that slot_deform_tuple() remains in it's current place, as it  
clearly deals with a HeapTuple.  getmissingattrs() also remains, but  
it's less clear that that's correct - but execTuples.c wouldn't be the  
right place.  
  
Author: Ashutosh Bapat.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/backend/executor/execTuples.c
M src/include/access/htup_details.h
M src/include/executor/tuptable.h

Move the replication lag tracker into heap memory.

commit   : e73ca79fc78db4eb13b7f513f16b7164c7b05ba7    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 16 Oct 2018 11:04:41 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 16 Oct 2018 11:04:41 +1300    

Click here for diff

Andres Freund complained about the 128KB of .bss occupied by LagTracker.  
It's only needed in the walsender process, so allocate it in heap  
memory there.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya%40alap3.anarazel.de  

M src/backend/replication/walsender.c

Check for stack overrun in standard_ProcessUtility().

commit   : d48da369ab22a8326d4d3d2b05b574d581057193    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Oct 2018 14:01:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Oct 2018 14:01:38 -0400    

Click here for diff

ProcessUtility can recurse, and indeed can be driven to infinite  
recursion, so it ought to have a check_stack_depth() call.  This  
covers the reported bug (portal trying to execute itself) and a bunch  
of other cases that could perhaps arise somewhere.  
  
Per bug #15428 from Malthe Borch.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/utility.c

pgbench: Report errors during run better

commit   : 5b75a4f8266a4f187a47929fed0582ee778c703f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Oct 2018 12:04:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Oct 2018 12:04:04 +0200    

Click here for diff

When an error occurs during a benchmark run, exit with a nonzero exit  
code and write a message at the end.  Previously, it would just print  
the error message when it happened but then proceed to print the run  
summary normally and exit with status 0.  To still allow  
distinguishing setup from run-time errors, we use exit status 2 for  
the new state, whereas existing errors during pgbench initialization  
use exit status 1.  
  
Reviewed-by: Fabien COELHO <[email protected]>  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Make spelling of "acknowledgment" consistent

commit   : 35584fd05f9b104f057c700360985991f111a847    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Oct 2018 10:06:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Oct 2018 10:06:45 +0200    

Click here for diff

I used the preferred U.S. spelling, as we do in other cases.  

M doc/src/sgml/high-availability.sgml
M doc/src/sgml/release-10.sgml
M src/backend/replication/syncrep.c
M src/common/pg_lzcompress.c

Fixes for "Glyph not available" warnings from FOP

commit   : 9274c577f7351c5af8e4c85f4a6031db11c93992    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 15 Oct 2018 09:48:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 15 Oct 2018 09:48:49 +0200    

Click here for diff

With the PostgreSQL 11 release notes acknowledgments list, FOP reported  
  
WARNING: Glyph "?" (0x144, nacute) not available in font "Times-Roman".  
WARNING: Glyph "?" (0x15e, Scedilla) not available in font "Times-Roman".  
WARNING: Glyph "?" (0x15f, scedilla) not available in font "Times-Roman".  
WARNING: Glyph "?" (0x131, dotlessi) not available in font "Times-Roman".  
  
This is because we have some new contributors whose names use letters  
that we haven't used before, and apparently FOP can't handle them out  
of the box.  
  
For now, just fix this by "unaccenting" those names.  In the future,  
maybe this can be fixed better with a different font configuration.  
  
There is also another warning  
  
WARNING: Glyph "?" (0x3c0, pi) not available in font "Times-Roman".  
  
but that existed in previous releases and is not touched here.  

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

Add missed tag in bloom.sgml

commit   : 981b64f840ba81adf47ea0c34694ea416134817e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 15 Oct 2018 01:11:33 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 15 Oct 2018 01:11:33 +0300    

Click here for diff

Backpatch commits don't contain this error.  

M doc/src/sgml/bloom.sgml

contrib/bloom documentation improvement

commit   : 98afb839059b2708ee4b541d0186581493a2713b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 15 Oct 2018 00:40:17 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 15 Oct 2018 00:40:17 +0300    

Click here for diff

This commit documents rounding of "length" parameter and absence of support  
for unique indexes and NULLs searching.  Backpatch to 9.6 where contrib/bloom  
was introduced.  
  
Discussion: https://postgr.es/m/CAF4Au4wPQQ7EHVSnzcLjsbY3oLSzVk6UemZLD1Sbmwysy3R61g%40mail.gmail.com  
Author: Oleg Bartunov with minor editorialization by me  
Backpatch-through: 9.6  

M doc/src/sgml/bloom.sgml

Make some subquery-using test cases a bit more robust.

commit   : b403ea43e40aae3ebb03cf3844cf84b43ab34b8a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Oct 2018 14:02:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Oct 2018 14:02:59 -0400    

Click here for diff

These test cases could be adversely affected by an upcoming change  
to allow pullup of FROM-less subqueries.  Tweak them to ensure that  
they'll continue to test what they did before.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/select.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select.sql
M src/test/regress/sql/select_parallel.sql

Use PlaceHolderVars within the quals of a FULL JOIN.

commit   : 7d4a10e260083bc571ea05592884084eabcc7afa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Oct 2018 13:07:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Oct 2018 13:07:29 -0400    

Click here for diff

This prevents failures in cases where we pull up a constant or var-free  
expression from a subquery and put it into a full join's qual.  That can  
result in not recognizing the qual as containing a mergejoin-able or  
hashjoin-able condition.  A PHV prevents the problem because it is still  
recognized as belonging to the side of the join the subquery is in.  
  
I'm not very sure about the net effect of this change on plan quality.  
In "typical" cases where the join keys are Vars, nothing changes.  
In an affected case, the PHV-wrapped expression is less likely to be seen  
as equal to PHV-less instances below the join, but more likely to be seen  
as equal to similar expressions above the join, so it may end up being a  
wash.  In the one existing case where there's any visible change in a  
regression-test plan, it amounts to referencing a lower computation of a  
COALESCE result instead of recomputing it, which seems like a win.  
  
Given my uncertainty about that and the lack of field complaints,  
no back-patch, even though this is a very ancient problem.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Clean up/tighten up coercibility checks in opr_sanity regression test.

commit   : e9f42d529f990f94e1b7bdcec4a1111465c85326    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Oct 2018 12:11:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Oct 2018 12:11:16 -0400    

Click here for diff

With the removal of the old abstime type, there are no longer any cases  
in this test where we need to use the weaker castcontext-ignoring form  
of binary coercibility check.  (The other major source of such headaches,  
apparently-incompatible hash functions, is now hashvalidate()'s problem  
not this test script's problem.)  Hence, just use binary_coercible()  
everywhere, and remove the comments explaining why we don't do so ---  
which were broken anyway by cda6a8d01.  
  
I left physically_coercible() in place but renamed it to better  
match what it's actually testing, and added some comments.  
  
Also, in test queries that have an assumption about the maximum number  
of function arguments they need to handle, add a clause to make them fail  
if someday there's a relevant function with more arguments.  Otherwise  
we're likely not to notice that we need to extend the queries.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid duplicate XIDs at recovery when building initial snapshot

commit   : 1df21ddb19c6e764fc9378c900515a5d642ad820    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 14 Oct 2018 22:23:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 14 Oct 2018 22:23:21 +0900    

Click here for diff

On a primary, sets of XLOG_RUNNING_XACTS records are generated on a  
periodic basis to allow recovery to build the initial state of  
transactions for a hot standby.  The set of transaction IDs is created  
by scanning all the entries in ProcArray.  However it happens that its  
logic never counted on the fact that two-phase transactions finishing to  
prepare can put ProcArray in a state where there are two entries with  
the same transaction ID, one for the initial transaction which gets  
cleared when prepare finishes, and a second, dummy, entry to track that  
the transaction is still running after prepare finishes.  This way  
ensures a continuous presence of the transaction so as callers of for  
example TransactionIdIsInProgress() are always able to see it as alive.  
  
So, if a XLOG_RUNNING_XACTS takes a standby snapshot while a two-phase  
transaction finishes to prepare, the record can finish with duplicated  
XIDs, which is a state expected by design.  If this record gets applied  
on a standby to initial its recovery state, then it would simply fail,  
so the odds of facing this failure are very low in practice.  It would  
be tempting to change the generation of XLOG_RUNNING_XACTS so as  
duplicates are removed on the source, but this requires to hold on  
ProcArrayLock for longer and this would impact all workloads,  
particularly those using heavily two-phase transactions.  
  
XLOG_RUNNING_XACTS is also actually used only to initialize the standby  
state at recovery, so instead the solution is taken to discard  
duplicates when applying the initial snapshot.  
  
Diagnosed-by: Konstantin Knizhnik  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

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

Doc: still further copy-editing for v11 release notes.

commit   : 8f850f2cad2df69a14fd1ad1b360cf004f17e8db    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 21:39:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 21:39:20 -0400    

Click here for diff

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

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

Doc: further copy-editing for v11 release notes.

commit   : d3ef93f0ebc8bc831b436b1d473d7e80e73a3b1e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 17:29:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 17:29:12 -0400    

Click here for diff

Justin Pryzby, Jonathan S. Katz, and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: copy-editing for CREATE INDEX reference page.

commit   : 002791514328372b9682453f7692b032f9d0fb2f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 16:42:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 16:42:58 -0400    

Click here for diff

Justin Pryzby, Jonathan S. Katz, and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_index.sgml

Make an editing pass over v11 release notes.

commit   : 5e9d7b226e04e11429ae644b5f7743503cd4d56b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 16:31:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Oct 2018 16:31:09 -0400    

Click here for diff

Set the release date.  Do a bunch of copy-editing and markup improvement,  
rearrange some stuff into what seemed a more sensible order, move some  
things that did not seem to be in the right section.  

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

Another round of portability hacking on ECPG regression tests.

commit   : 240cd6bc8366c9848bc2511c623743326e5a187b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 18:08:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 18:08:47 -0400    

Click here for diff

Removing the separate Windows expected-files in commit f1885386f  
turns out to have been too optimistic: on most (but not all!) of our  
Windows buildfarm members, the tests still print floats with three  
exponent digits, because they're invoking the native printf()  
not snprintf.c.  
  
But rather than put back the extra expected-files, let's hack  
the three tests in question so that they adjust float formatting  
the same way snprintf.c does.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/test/Makefile.regress
M src/interfaces/ecpg/test/compat_informix/dec_test.pgc
M src/interfaces/ecpg/test/expected/compat_informix-dec_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
M src/interfaces/ecpg/test/pgtypeslib/num_test.pgc
M src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc
A src/interfaces/ecpg/test/printf_hack.h

Simplify use of AllocSetContextCreate() wrapper macro.

commit   : 13cd7209f794d9dff8084c9748a78a0a5bf0464a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 14:26:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 14:26:56 -0400    

Click here for diff

We can allow this macro to accept either abbreviated or non-abbreviated  
allocation parameters by making use of __VA_ARGS__.  As noted by Andres  
Freund, it's unlikely that any compiler would have __builtin_constant_p  
but not __VA_ARGS__, so this gives up little or no error checking, and  
it avoids a minor but annoying API break for extensions.  
  
With this change, there is no reason for anybody to call  
AllocSetContextCreateExtended directly, so in HEAD I renamed it to  
AllocSetContextCreateInternal.  It's probably too late for an ABI  
break like that in 11, though.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/mcxt.c
M src/include/utils/memutils.h

Remove dead reference to ecpg resultmap file.

commit   : 24a2c436a5ce1912373a6c9561cbabd09495552d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 11:42:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 11:42:15 -0400    

Click here for diff

I missed this in my prior commit because it doesn't matter in non-VPATH  
builds.  
  
Per buildfarm.  

M src/interfaces/ecpg/test/Makefile

Correct attach/detach logic for FKs in partitions

commit   : c7d43c4d8a5b7215ea0a32d95260188b5d3ae3f4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Oct 2018 12:36:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Oct 2018 12:36:26 -0300    

Click here for diff

There was no code to handle foreign key constraints on partitioned  
tables in the case of ALTER TABLE DETACH; and if you happened to ATTACH  
a partition that already had an equivalent constraint, that one was  
ignored and a new constraint was created.  Adding this to the fact that  
foreign key cloning reuses the constraint name on the partition instead  
of generating a new name (as it probably should, to cater to SQL  
standard rules about constraint naming within schemas), the result was a  
pretty poor user experience -- the most visible failure was that just  
detaching a partition and re-attaching it failed with an error such as  
  
  ERROR:  duplicate key value violates unique constraint "pg_constraint_conrelid_contypid_conname_index"  
  DETAIL:  Key (conrelid, contypid, conname)=(26702, 0, test_result_asset_id_fkey) already exists.  
  
because it would try to create an identically-named constraint in the  
partition.  To make matters worse, if you tried to drop the constraint  
in the now-independent partition, that would fail because the constraint  
was still seen as dependent on the constraint in its former parent  
partitioned table:  
  ERROR:  cannot drop inherited constraint "test_result_asset_id_fkey" of relation "test_result_cbsystem_0001_0050_monthly_2018_09"  
  
This fix attacks the problem from two angles: first, when the partition  
is detached, the constraint is also marked as independent, so the drop  
now works.  Second, when the partition is re-attached, we scan existing  
constraints searching for one matching the FK in the parent, and if one  
exists, we link that one to the parent constraint.  So we don't end up  
with a duplicate -- and better yet, we don't need to scan the referenced  
table to verify that the constraint holds.  
  
To implement this I made a small change to previously planner-only  
struct ForeignKeyCacheInfo to contain the constraint OID; also relcache  
now maintains the list of FKs for partitioned tables too.  
  
Backpatch to 11.  
  
Reported-by: Michael Vitale (bug #15425)  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/utils/cache/relcache.c
M src/include/utils/rel.h
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Make float exponent output on Windows look the same as elsewhere.

commit   : f1885386f6246ac7b6f8d3f0aef247988f48ee7a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 11:14:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Oct 2018 11:14:27 -0400    

Click here for diff

Windows, alone among our supported platforms, likes to emit three-digit  
exponent fields even when two digits would do.  Adjust such results to  
look like the way everyone else does it.  Eliminate a bunch of variant  
expected-output files that were needed only because of this quirk.  
  
Discussion: https://postgr.es/m/[email protected]  

D contrib/cube/expected/cube_sci_1.out
D contrib/seg/expected/seg_1.out
D src/interfaces/ecpg/test/expected/compat_informix-dec_test-MinGW32.stdout
D src/interfaces/ecpg/test/expected/pgtypeslib-num_test-MinGW32.stdout
D src/interfaces/ecpg/test/expected/pgtypeslib-num_test2-MinGW32.stdout
D src/interfaces/ecpg/test/resultmap
M src/port/snprintf.c
D src/test/regress/expected/float4-exp-three-digits.out
D src/test/regress/expected/float8-exp-three-digits-win32.out
D src/test/regress/expected/geometry_1.out
D src/test/regress/expected/int8-exp-three-digits.out
M src/test/regress/resultmap

Add TAP tests for pg_verify_checksums

commit   : b34e84f160a47d9070b304bfc1baf17596d71865    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Oct 2018 09:12:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Oct 2018 09:12:31 +0900    

Click here for diff

All options available in the utility get coverage:  
- Tests with disabled page checksums.  
- Tests with enabled test checksums.  
- Emulation of corruption and broken checksums with a full scan and  
single relfilenode scan.  
  
This patch has been contributed mainly by Michael Banck and Magnus  
Hagander with things presented on various threads, and I have gathered  
all the contents into a single patch.  
  
Author: Michael Banck, Magnus Hagander, Michael Paquier  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_verify_checksums/.gitignore
M src/bin/pg_verify_checksums/Makefile
A src/bin/pg_verify_checksums/t/001_basic.pl
A src/bin/pg_verify_checksums/t/002_actions.pl

Remove deprecated abstime, reltime, tinterval datatypes.

commit   : cda6a8d01d391eab45c4b3e0043a1b2b31072f5f    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 28 Sep 2018 15:21:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 28 Sep 2018 15:21:48 -0700    

Click here for diff

These types have been deprecated for a *long* time.  
  
Catversion bump, for obvious reasons.  
  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/access/hash/hashvalidate.c
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/date.c
M src/backend/utils/adt/formatting.c
D src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/selfuncs.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
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
M src/include/utils/datetime.h
D src/include/utils/nabstime.h
M src/interfaces/ecpg/ecpglib/execute.c
D src/test/regress/expected/abstime.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/horology.out
M src/test/regress/expected/opr_sanity.out
D src/test/regress/expected/reltime.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
D src/test/regress/expected/tinterval.out
M src/test/regress/parallel_schedule
M src/test/regress/serial_schedule
D src/test/regress/sql/abstime.sql
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/horology.sql
M src/test/regress/sql/opr_sanity.sql
D src/test/regress/sql/reltime.sql
D src/test/regress/sql/tinterval.sql

Remove timetravel extension.

commit   : 2d10defa7771931295ee804cf096fb9388472a7b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 28 Sep 2018 15:13:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 28 Sep 2018 15:13:42 -0700    

Click here for diff

The extension depended on old types which are about to be removed. As  
the code additionally was pretty crufty and didn't provide much in the  
way of functionality, removing the extension seems to be the best way  
forward.  It's fairly trivial to write functionality in plpgsql that  
more than covers what timetravel did.  
  
Author: Andres Freund  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/[email protected]  

M contrib/spi/Makefile
D contrib/spi/timetravel–1.0.sql
D contrib/spi/timetravel–unpackaged–1.0.sql
D contrib/spi/timetravel.c
D contrib/spi/timetravel.control
D contrib/spi/timetravel.example
M doc/src/sgml/contrib-spi.sgml
M src/tools/msvc/Install.pm

Move timeofday() implementation out of nabstime.c.

commit   : 86896be60ef7ace74b7b6858588ec7fae030fefd    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 11 Oct 2018 11:30:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 11 Oct 2018 11:30:59 -0700    

Click here for diff

nabstime.c is about to be removed, but timeofday() isn't related to  
the rest of the functionality therein, and some find it useful. Move  
to timestamp.c.  
  
Discussion:  
    https://postgr.es/m/[email protected]  
    https://postgr.es/m/20180928223240.kgwc4czzzekrpsid%40alap3.anarazel.de  

M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/timestamp.c

Fix logical decoding error when system table w/ toast is repeatedly rewritten.

commit   : e9edc1ba0be21278de8f04a068c2fb3504dc03fc    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 10 Oct 2018 13:53:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 10 Oct 2018 13:53:02 -0700    

Click here for diff

Repeatedly rewriting a mapped catalog table with VACUUM FULL or  
CLUSTER could cause logical decoding to fail with:  
ERROR, "could not map filenode \"%s\" to relation OID"  
  
To trigger the problem the rewritten catalog had to have live tuples  
with toasted columns.  
  
The problem was triggered as during catalog table rewrites the  
heap_insert() check that prevents logical decoding information to be  
emitted for system catalogs, failed to treat the new heap's toast table  
as a system catalog (because the new heap is not recognized as a  
catalog table via RelationIsLogicallyLogged()). The relmapper, in  
contrast to the normal catalog contents, does not contain historical  
information. After a single rewrite of a mapped table the new relation  
is known to the relmapper, but if the table is rewritten twice before  
logical decoding occurs, the relfilenode cannot be mapped to a  
relation anymore.  Which then leads us to error out.   This only  
happens for toast tables, because the main table contents aren't  
re-inserted with heap_insert().  
  
The fix is simple, add a new heap_insert() flag that prevents logical  
decoding information from being emitted, and accept during decoding  
that there might not be tuple data for toast tables.  
  
Unfortunately that does not fix pre-existing logical decoding  
errors. Doing so would require not throwing an error when a filenode  
cannot be mapped to a relation during decoding, and that seems too  
likely to hide bugs.  If it's crucial to fix decoding for an existing  
slot, temporarily changing the ERROR in ReorderBufferCommit() to a  
WARNING appears to be the best fix.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, where logical decoding was introduced  

M contrib/test_decoding/expected/rewrite.out
M contrib/test_decoding/sql/rewrite.sql
M src/backend/access/heap/heapam.c
M src/backend/access/heap/rewriteheap.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/access/heapam.h

Force synchronous commit to be enabled for all test_decoding tests.

commit   : ef493055b67d30393a71c59d6fcbc2bd406528c2    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 10 Oct 2018 13:53:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 10 Oct 2018 13:53:02 -0700    

Click here for diff

Without that the tests fail when forced to be run against a cluster  
with synchronous_commit = off (as the WAL might not yet be flushed to  
disk by the point logical decoding gets called, and thus the expected  
output breaks). Most tests already do that, add it to a few newer tests.  
  
Author: Andres Freund  

M contrib/test_decoding/expected/truncate.out
M contrib/test_decoding/specs/oldest_xmin.spec
M contrib/test_decoding/specs/snapshot_transfer.spec
M contrib/test_decoding/sql/truncate.sql

Slightly correct context check for event triggers

commit   : f82d4d666ff501382b92dfd80eaf1d459e6e84a3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 15:20:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 15:20:32 +0200    

Click here for diff

The previous check for a "complete query" omitted the new  
PROCESS_UTILITY_QUERY_NONATOMIC value.  This didn't actually make a  
difference in practice, because only CALL and SET from PL/pgSQL run in  
this state, but it's more correct to include it anyway.  
  
Discussion: https://www.postgresql.org/message-id/4566041d-2567-74d2-d135-19ff6a20fe51%402ndquadrant.com  

M src/backend/tcop/utility.c

Test that event triggers work in functions and procedures

commit   : ae307861d89767991b71e97faa6e1812e5ab83f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 15:20:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 15:20:01 +0200    

Click here for diff

This ensures that we have coverage of all the ProcessUtilityContext  
variants.  

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

Turn transaction_isolation into GUC enum

commit   : f8c10f616fa5081999ac48a0b6621057db806851    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Oct 2018 21:21:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Oct 2018 21:21:57 +0200    

Click here for diff

It was previously a string setting that was converted into an enum by  
custom code, but using the GUC enum facility seems much simpler and  
doesn't change any functionality, except that  
  
    set transaction_isolation='default';  
  
no longer works, but that was never documented and doesn't work with  
any other transaction characteristics.  (Note that this is not the  
same as RESET or SET TO DEFAULT, which still work.)  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/variable.c
M src/backend/utils/misc/guc.c
M src/include/commands/variable.h

Make src/common/exec.c's error logging less ugly.

commit   : b6b297d20df9f738be20a450f80bade535819220    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Oct 2018 13:36:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Oct 2018 13:36:16 -0400    

Click here for diff

This code used elog where it really ought to use ereport, mainly so that  
it can report a SQLSTATE different from ERRCODE_INTERNAL_ERROR.  There  
were some other random deviations from typical error report practice too.  
  
In addition, we can make some cleanups that were impractical six months  
ago:  
  
* Use one variadic macro, instead of several with different numbers  
of arguments, reducing the temptation to force-fit messages into  
particular numbers of arguments;  
  
* Use %m, even in the frontend case, simplifying the code.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/exec.c

Add "B" suffix for bytes to docs

commit   : 36e9d413a1d6928cd809d302d495fd6880a44b1e    
  
author   : Greg Stark <[email protected]>    
date     : Sat, 6 Oct 2018 13:03:43 -0400    
  
committer: Greg Stark <[email protected]>    
date     : Sat, 6 Oct 2018 13:03:43 -0400    

Click here for diff

6e7baa3227 and b06d8e58b5 added "B" as a valid suffix for  
GUC_UNIT_BYTES but neglected to add it to the docs.  

M doc/src/sgml/config.sgml

Remove no-longer-needed variant expected regression result files.

commit   : 6eb4378d53b58658c91e4a31d2511a15e6fbf088    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Oct 2018 11:31:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Oct 2018 11:31:30 -0400    

Click here for diff

numerology_1.out and float8-small-is-zero_1.out differ from their  
base files only in showing plain zero rather than minus zero for  
some results.  I believe that in the wake of commit 6eb3eb577,  
we will print minus zero as such on all IEEE-float platforms  
(and non-IEEE floats are going to cause many more regression diffs  
than this, anyway).  Hence we should be able to remove these and  
eliminate a bit of maintenance pain.  Let's see if the buildfarm  
agrees.  
  
Discussion: https://postgr.es/m/[email protected]  

D src/test/regress/expected/float8-small-is-zero_1.out
D src/test/regress/expected/numerology_1.out

Select appropriate PG_PRINTF_ATTRIBUTE for recent NetBSD.

commit   : aed9fa0bd8973fd967724003e641a5b7054d6a80    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Oct 2018 11:10:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Oct 2018 11:10:07 -0400    

Click here for diff

NetBSD-current generates a large number of warnings about "%m" not  
being appropriate to use with *printf functions.  While that's true  
for their native printf, it's surely not true for snprintf.c, so I  
think they have misunderstood gcc's definition of the "gnu_printf"  
archetype.  Nonetheless, choosing "__syslog__" instead silences the  
warnings; so teach configure about that.  
  
Since this is only a cosmetic warning issue (and anyway it depends  
on previous hacking to be self-consistent), no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M src/include/pg_config.h.in

Add pg_ls_archive_statusdir function

commit   : c48101620151f78ee184e5f81766cbac347d9a11    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 9 Oct 2018 22:29:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 9 Oct 2018 22:29:09 +0900    

Click here for diff

This function lists the contents of the WAL archive status directory,  
and is intended to be used by monitoring tools.  Unlike pg_ls_dir(),  
access to it can be granted to non-superusers so that those monitoring  
tools can observe the principle of least privilege.  Access is also  
given by default to members of pg_monitor.  
  
Author:  Christoph Moench-Tegeder  
Reviewed-by: Aya Iwata  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/genfile.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Convert some long lists in configure.in to one-line-per-entry style.

commit   : bfa6c5a0c974b14601b689efa4e52f6a372aee0c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Oct 2018 00:04:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Oct 2018 00:04:27 -0400    

Click here for diff

The idea here is that patches that add items to these lists will often  
be easier to rebase over other additions to the same lists, because  
they won't be trying to touch the very same line of configure.in.  
  
There will still be merge conflicts in the configure script, but that  
can be fixed just by re-running autoconf (or by leaving configure out  
of the submitted patch to begin with ...)  
  
Implementation note: use of m4_normalize() is necessary to get rid of  
the newlines, else incorrect shell syntax will be emitted.  But with  
that hack, the generated configure script is identical to what it  
was before.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure.in

Relax transactional restrictions on ALTER TYPE ... ADD VALUE (redux).

commit   : 212fab9926b2f0f04b0187568e7124b70e8deee5    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 9 Oct 2018 12:51:01 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 9 Oct 2018 12:51:01 +1300    

Click here for diff

Originally committed as 15bc038f (plus some follow-ups), this was  
reverted in 28e07270 due to a problem discovered in parallel  
workers.  This new version corrects that problem by sending the  
list of uncommitted enum values to parallel workers.  
  
Here follows the original commit message describing the change:  
  
To prevent possibly breaking indexes on enum columns, we must keep  
uncommitted enum values from getting stored in tables, unless we  
can be sure that any such column is new in the current transaction.  
  
Formerly, we enforced this by disallowing ALTER TYPE ... ADD VALUE  
from being executed at all in a transaction block, unless the target  
enum type had been created in the current transaction.  This patch  
removes that restriction, and instead insists that an uncommitted enum  
value can't be referenced unless it belongs to an enum type created  
in the same transaction as the value.  Per discussion, this should be  
a bit less onerous.  It does require each function that could possibly  
return a new enum value to SQL operations to check this restriction,  
but there aren't so many of those that this seems unmaintainable.  
  
Author: Andrew Dunstan and Tom Lane, with parallel query fix by Thomas Munro  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAEepm%3D0Ei7g6PaNTbcmAh9tCRahQrk%3Dr5ZWLD-jr7hXweYX3yg%40mail.gmail.com  
Discussion: https://postgr.es/m/4075.1459088427%40sss.pgh.pa.us  

M doc/src/sgml/ref/alter_type.sgml
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/backend/catalog/pg_enum.c
M src/backend/commands/typecmds.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/enum.c
M src/backend/utils/errcodes.txt
M src/include/catalog/pg_enum.h
M src/include/commands/typecmds.h
M src/test/regress/expected/enum.out
M src/test/regress/sql/enum.sql

Fix omissions in snprintf.c's coverage of standard *printf functions.

commit   : 7767aadd94cd252a12fa00f6122ad4dd10455791    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 19:15:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 19:15:55 -0400    

Click here for diff

A warning on a NetBSD box revealed to me that pg_waldump/compat.c  
is using vprintf(), which snprintf.c did not provide coverage for.  
This is not good if we want to have uniform *printf behavior, and  
it's pretty silly to omit when it's a one-line function.  
  
I also noted that snprintf.c has pg_vsprintf() but for some reason  
it was not exposed to the outside world, creating another way in  
which code might accidentally invoke the platform *printf family.  
  
Let's just make sure that we replace all eight of the POSIX-standard  
printf family.  
  
Also, upgrade plperl.h and plpython.h to make sure that they do  
their undefine/redefine rain dance for all eight, not some random  
maybe-sufficient subset thereof.  

M src/include/port.h
M src/pl/plperl/plperl.h
M src/pl/plpython/plpython.h
M src/port/snprintf.c

Advance transaction timestamp for intra-procedure transactions.

commit   : 82ff0cc91d9840d1c56ca1beed58bedfde3da9a3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 16:16:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 16:16:36 -0400    

Click here for diff

Per discussion, this behavior seems less astonishing than not doing so.  
  
Peter Eisentraut and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/executor/spi.c
M src/include/executor/spi.h
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Improve snprintf.c's handling of NaN, Infinity, and minus zero.

commit   : 6eb3eb577d76b3f58a98f78232af9e86624ce5eb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 12:19:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 12:19:20 -0400    

Click here for diff

Up to now, float4out/float8out handled NaN and Infinity cases explicitly,  
and invoked psprintf only for ordinary float values.  This was done because  
platform implementations of snprintf produce varying representations of  
these special cases.  But now that we use snprintf.c always, it's better  
to give it the responsibility to produce a uniform representation of  
these cases, so that we have uniformity across the board not only in  
float4out/float8out.  Hence, move that work into fmtfloat().  
  
Also, teach fmtfloat() to recognize IEEE minus zero and handle it  
correctly.  The previous coding worked only accidentally, and would  
fail for e.g. "%+f" format (it'd print "+-0.00000").  Now that we're  
using snprintf.c everywhere, it's not acceptable for it to do weird  
things in corner cases.  (This incidentally avoids a portability  
problem we've seen on some really ancient platforms, that native  
sprintf does the wrong thing with minus zero.)  
  
Also, introduce a new entry point in snprintf.c to allow float[48]out  
to bypass the work of interpreting a well-known format spec, as well  
as bypassing the overhead of the psprintf layer.  I modeled this API  
loosely on strfromd().  In my testing, this brings float[48]out back  
to approximately the same speed they had when using native snprintf,  
fixing one of the main performance issues caused by using snprintf.c.  
  
(There is some talk of more aggressive work to improve the speed of  
floating-point output conversion, but these changes seem to provide  
a better starting point for such work anyway.)  
  
Getting rid of the previous ad-hoc hack for Infinity/NaN in fmtfloat()  
allows removing <ctype.h> from snprintf.c's #includes.  I also removed  
a few other #includes that I think are historical, though the buildfarm  
may expose that as wrong.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/float.c
M src/include/port.h
M src/port/snprintf.c

Avoid O(N^2) cost in ExecFindRowMark().

commit   : f9eb7c14b08d2cc5eda62ffaf37a356c05e89b93    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 10:41:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Oct 2018 10:41:34 -0400    

Click here for diff

If there are many ExecRowMark structs, we spent O(N^2) time in  
ExecFindRowMark during executor startup.  Once upon a time this was  
not of great concern, but the addition of native partitioning has  
squeezed out enough other costs that this can become the dominant  
overhead in some use-cases for tables with many partitions.  
  
To fix, simply replace that List data structure with an array.  
  
This adds a little bit of cost to execCurrentOf(), but not much,  
and anyway that code path is neither of large importance nor very  
efficient now.  If we ever decide it is a bottleneck, constructing a  
hash table for lookup-by-tableoid would likely be the thing to do.  
  
Per complaint from Amit Langote, though this is different from  
his fix proposal.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Silence compiler warning in Assert()

commit   : eee01d606eb40f760799320e75d45c84022353d8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 8 Oct 2018 10:37:21 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 8 Oct 2018 10:37:21 -0300    

Click here for diff

gcc 6.3 does not whine about this mistake I made in 39808e8868c8 but  
evidently lots of other compilers do, according to Michael Paquier,  
Peter Eisentraut, Arthur Zakirov, Tomas Vondra.  
  
Discussion: too many to list  

M src/backend/commands/event_trigger.c

Track procedure calls in pg_stat_user_functions

commit   : 634b4b79cbc7638feb459a1b76eae7af47af4606    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 14:14:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 14:14:03 +0200    

Click here for diff

This was forgotten when procedures were implemented.  
  
Reported-by: Lukas Fittl <[email protected]>  

M src/backend/commands/functioncmds.c

commit   : 9c2a970d1fa4d30dc41d30d0b2ad557f40510549    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Oct 2018 17:56:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Oct 2018 17:56:13 +0900    

Click here for diff

Error messages for creating a foreign key on a partitioned table using  
ONLY or NOT VALID were wrong in mentioning the objects they worked on.  
This commit adds on the way some regression tests missing for those  
cases.  
  
Author: Laurenz Albe  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Fix speling error

commit   : a9da329be0bec586589cefc78da03ddb3fc13cbb    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 8 Oct 2018 08:57:24 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 8 Oct 2018 08:57:24 +0200    

Click here for diff

Reported by Alexander Lakhin in bug #15423  

M src/bin/pg_basebackup/pg_basebackup.c

Remove some unnecessary fields from Plan trees.

commit   : 52ed730d511b7b1147f2851a7295ef1fb5273776    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Oct 2018 14:33:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Oct 2018 14:33:17 -0400    

Click here for diff

In the wake of commit f2343653f, we no longer need some fields that  
were used before to control executor lock acquisitions:  
  
* PlannedStmt.nonleafResultRelations can go away entirely.  
  
* partitioned_rels can go away from Append, MergeAppend, and ModifyTable.  
However, ModifyTable still needs to know the RT index of the partition  
root table if any, which was formerly kept in the first entry of that  
list.  Add a new field "rootRelation" to remember that.  rootRelation is  
partly redundant with nominalRelation, in that if it's set it will have  
the same value as nominalRelation.  However, the latter field has a  
different purpose so it seems best to keep them distinct.  
  
Amit Langote, reviewed by David Rowley and Jesper Pedersen,  
and whacked around a bit more by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/plannodes.h
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h

Fix catalog insertion order for ATTACH PARTITION

commit   : 39808e8868c8fac383b33aa103ab57539b0e2a69    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 6 Oct 2018 22:13:19 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 6 Oct 2018 22:13:19 -0300    

Click here for diff

Commit 2fbdf1b38bc changed the order in which we inserted catalog rows  
when creating partitions, so that we could remove an unsightly hack  
required for untimely relcache invalidations.  However, that commit only  
changed the ordering for CREATE TABLE PARTITION OF, and left ALTER TABLE  
ATTACH PARTITION unchanged, so the latter can be affected when catalog  
invalidations occur, for instance when the partition key involves an SQL  
function.  
  
Reported-by: Rajkumar Raghuwanshi  
Author: Amit Langote  
Reviewed-by: Michaël Paquier  
Discussion: https://postgr.es/m/CAKcux6=nTz9KSfTr_6Z2mpzLJ_09JN-rK6=dWic6gGyTSWueyQ@mail.gmail.com  

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

Fix event triggers for partitioned tables

commit   : ad08006ba03797fed431af87de6e66c6c0985b7a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 6 Oct 2018 19:17:46 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 6 Oct 2018 19:17:46 -0300    

Click here for diff

Index DDL cascading on partitioned tables introduced a way for ALTER  
TABLE to be called reentrantly.  This caused an an important deficiency  
in event trigger support to be exposed: on exiting the reentrant call,  
the alter table state object was clobbered, causing a crash when the  
outer alter table tries to finalize its processing.  Fix the crash by  
creating a stack of event trigger state objects.  There are still ways  
to cause things to misbehave (and probably other crashers) with more  
elaborate tricks, but at least it now doesn't crash in the obvious  
scenario.  
  
Backpatch to 9.5, where DDL deparsing of event triggers was introduced.  
  
Reported-by: Marco Slot  
Authors: Michaël Paquier, Álvaro Herrera  
Discussion: https://postgr.es/m/CANNhMLCpi+HQ7M36uPfGbJZEQLyTy7XvX=5EFkpR-b1bo0uJew@mail.gmail.com  

M src/backend/catalog/index.c
M src/backend/commands/event_trigger.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/include/catalog/index.h
M src/include/tcop/deparse_utility.h
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Restore sane locking behavior during parallel query.

commit   : 29ef2b310da9892fda075ff9ee12da7f92d5da6e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 15:49:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 15:49:37 -0400    

Click here for diff

Commit 9a3cebeaa changed things so that parallel workers didn't obtain  
any lock of their own on tables they access.  That was clearly a bad  
idea, but I'd mistakenly supposed that it was the intended end result  
of the series of patches for simplifying the executor's lock management.  
Undo that change in relation_open(), and adjust ExecOpenScanRelation()  
so that it gets the correct lock if inside a parallel worker.  
  
In passing, clean up some more obsolete comments about when locks  
are acquired.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeTidscan.c

Remove more redundant relation locking during executor startup.

commit   : f2343653f5b2aecfc759f36dbb3fd2a61f36853e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 15:12:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 15:12:51 -0400    

Click here for diff

We already have appropriate locks on every relation listed in the  
query's rangetable before we reach the executor.  Take the next step  
in exploiting that knowledge by removing code that worries about  
taking locks on non-leaf result relations in a partitioned table.  
  
In particular, get rid of ExecLockNonLeafAppendTables and a stanza in  
InitPlan that asserts we already have locks on certain such tables.  
  
In passing, clean up some now-obsolete comments in InitPlan.  
  
Amit Langote, reviewed by David Rowley and Jesper Pedersen,  
and whacked around a bit more by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/include/executor/executor.h

Don't use is_infinite() where isinf() will do.

commit   : 0209f0285d9b1c60bf74cc9f5f0133d7bdd887c3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 13:18:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 13:18:38 -0400    

Click here for diff

Places that aren't testing for sign should not use the more expensive  
function; it's just wasteful, not to mention being a cognitive load  
for readers who may know what isinf() is but not is_infinite().  
  
As things stand, we actually don't need is_infinite() anyplace except  
float4out/float8out, which means it could potentially go away altogether  
after the changes I proposed in <[email protected]>.  

M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/rangetypes_selfuncs.c

Propagate xactStartTimestamp and stmtStartTimestamp to parallel workers.

commit   : 07ee62ce9e507c14632c0517aeeae4e60b0d1997    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 12:00:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Oct 2018 12:00:09 -0400    

Click here for diff

Previously, a worker process would establish values for these based on  
its own start time.  In v10 and up, this can trivially be shown to cause  
misbehavior of transaction_timestamp(), timestamp_in(), and related  
functions which are (perhaps unwisely?) marked parallel-safe.  It seems  
likely that other behaviors might diverge from what happens in the parent  
as well.  
  
It's not as trivial to demonstrate problems in 9.6 or 9.5, but I'm sure  
it's still possible, so back-patch to all branches containing parallel  
worker infrastructure.  
  
In HEAD only, mark now() and statement_timestamp() as parallel-safe  
(other affected functions already were).  While in theory we could  
still squeeze that change into v11, it doesn't seem important enough  
to force a last-minute catversion bump.  
  
Konstantin Knizhnik, whacked around a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/include/access/xact.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Improve the accuracy of floating point statistical aggregates.

commit   : e954a727f0c8872bf5203186ad0f5312f6183746    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 6 Oct 2018 11:20:09 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 6 Oct 2018 11:20:09 +0100    

Click here for diff

When computing statistical aggregates like variance, the common  
schoolbook algorithm which computes the sum of the squares of the  
values and subtracts the square of the mean can lead to a large loss  
of precision when using floating point arithmetic, because the  
difference between the two terms is often very small relative to the  
terms themselves.  
  
To avoid this, re-work these aggregates to use the Youngs-Cramer  
algorithm, which is a proven, numerically stable algorithm that  
directly aggregates the sum of the squares of the differences of the  
values from the mean in a single pass over the data.  
  
While at it, improve the test coverage to test the aggregate combine  
functions used during parallel aggregation.  
  
Per report and suggested algorithm from Erich Schubert.  
  
Patch by me, reviewed by Madeleine Thompson.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Assign constraint name when cloning FK definition for partitions

commit   : 38921d1416c62bb743f6cc5439d0462efefdb286    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 6 Oct 2018 14:59:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 6 Oct 2018 14:59:36 +0900    

Click here for diff

This is for example used when attaching a partition to a partitioned  
table which includes foreign keys, and in this case the constraint name  
has been missing in the data cloned.  This could lead to hard crashes,  
as when validating the foreign key constraint, the constraint name is  
always expected.  Particularly, when using log_min_messages >= DEBUG1, a  
log message would be generated with this unassigned constraint name,  
leading to an assertion failure on HEAD.  
  
While on it, rename a variable in ATExecAttachPartition which was  
declared twice with the same name.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c

doc: update PG 11 release notes

commit   : 6eb612fea9d080f2ae77ecb7091e73dc9f298c97    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 5 Oct 2018 17:20:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 5 Oct 2018 17:20:24 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Author: Jonathan S. Katz  
  
Backpatch-through: 11  

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

Allow btree comparison functions to return INT_MIN.

commit   : c87cb5f7a67962f4bdfb897139fff91b7d8e0d90    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Oct 2018 16:01:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Oct 2018 16:01:29 -0400    

Click here for diff

Historically we forbade datatype-specific comparison functions from  
returning INT_MIN, so that it would be safe to invert the sort order  
just by negating the comparison result.  However, this was never  
really safe for comparison functions that directly return the result  
of memcmp(), strcmp(), etc, as POSIX doesn't place any such restriction  
on those library functions.  Buildfarm results show that at least on  
recent Linux on s390x, memcmp() actually does return INT_MIN sometimes,  
causing sort failures.  
  
The agreed-on answer is to remove this restriction and fix relevant  
call sites to not make such an assumption; code such as "res = -res"  
should be replaced by "INVERT_COMPARE_RESULT(res)".  The same is needed  
in a few places that just directly negated the result of memcmp or  
strcmp.  
  
To help find places having this problem, I've also added a compile option  
to nbtcompare.c that causes some of the commonly used comparators to  
return INT_MIN/INT_MAX instead of their usual -1/+1.  It'd likely be  
a good idea to have at least one buildfarm member running with  
"-DSTRESS_SORT_INT_MIN".  That's far from a complete test of course,  
but it should help to prevent fresh introductions of such bugs.  
  
This is a longstanding portability hazard, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/ltree/ltree_op.c
M contrib/pgcrypto/imath.c
M doc/src/sgml/btree.sgml
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMergeAppend.c
M src/bin/pg_rewind/filemap.c
M src/include/access/nbtree.h
M src/include/c.h
M src/include/utils/sortsupport.h

Ensure that PLPGSQL_DTYPE_ROW variables have valid refname fields.

commit   : 113a659914daa8e8c9ced55ca82bfbd5bdcedbd4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Oct 2018 12:45:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Oct 2018 12:45:37 -0400    

Click here for diff

Without this, the syntax-tree-dumping functions in pl_funcs.c crash,  
and there are other places that might be at risk too.  Per report  
from Pavel Stehule.  
  
Looks like I broke this in commit f9263006d, so back-patch to v11.  
  
Discussion: https://postgr.es/m/CAFj8pRA+3f5n4642q2g8BXCKjbTd7yU9JMYAgDyHgozk6cQ-VA@mail.gmail.com  

M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h

Remove redundant allocation

commit   : b5f03dc7657e4cc62b975f3bc07b217916324a54    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 17:10:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Oct 2018 17:10:19 +0200    

Click here for diff

Author: Nikita Glukhov <[email protected]>  

M contrib/jsonb_plpython/jsonb_plpython.c

Add pg_ls_tmpdir function

commit   : 9cd92d1a33699f86aa53d44ab04cc3eb50c18d11    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Oct 2018 09:21:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Oct 2018 09:21:48 +0900    

Click here for diff

This lists the contents of a temporary directory associated to a given  
tablespace, useful to get information about on-disk consumption caused  
by temporary files used by a session query.  By default, pg_default is  
scanned, and a tablespace can be specified as argument.  
  
This function is intended to be used by monitoring tools, and, unlike  
pg_ls_dir(), access to them can be granted to non-superusers so that  
those monitoring tools can observe the principle of least privilege.  
Access is also given by default to members of pg_monitor.  
  
Author: Nathan Bossart  
Reviewed-by: Laurenz Albe  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/genfile.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

In the executor, use an array of pointers to access the rangetable.

commit   : d73f4c74dd34b19c19839f7ae09fb96442728509    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Oct 2018 15:48:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Oct 2018 15:48:17 -0400    

Click here for diff

Instead of doing a lot of list_nth() accesses to es_range_table,  
create a flattened pointer array during executor startup and index  
into that to get at individual RangeTblEntrys.  
  
This eliminates one source of O(N^2) behavior with lots of partitions.  
(I'm not exactly convinced that it's the most important source, but  
it's an easy one to fix.)  
  
Amit Langote and David Rowley  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeLockRows.c
M src/backend/replication/logical/worker.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/parser/parsetree.h

Centralize executor's opening/closing of Relations for rangetable entries.

commit   : 9ddef36278a9f676c07d0b4d9f33fa22e48ce3b5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Oct 2018 14:03:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Oct 2018 14:03:37 -0400    

Click here for diff

Create an array estate->es_relations[] paralleling the es_range_table,  
and store references to Relations (relcache entries) there, so that any  
given RT entry is opened and closed just once per executor run.  Scan  
nodes typically still call ExecOpenScanRelation, but ExecCloseScanRelation  
is no more; relation closing is now done centrally in ExecEndPlan.  
  
This is slightly more complex than one would expect because of the  
interactions with relcache references held in ResultRelInfo nodes.  
The general convention is now that ResultRelInfo->ri_RelationDesc does  
not represent a separate relcache reference and so does not need to be  
explicitly closed; but there is an exception for ResultRelInfos in the  
es_trig_target_relations list, which are manufactured by  
ExecGetTriggerResultRel and have to be cleaned up by  
ExecCleanUpTriggerState.  (That much was true all along, but these  
ResultRelInfos are now more different from others than they used to be.)  
  
To allow the partition pruning logic to make use of es_relations[] rather  
than having its own relcache references, adjust PartitionedRelPruneInfo  
to store an RT index rather than a relation OID.  
  
Amit Langote, reviewed by David Rowley and Jesper Pedersen,  
some mods by me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/catalog/indexing.c
M src/backend/commands/copy.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeTidscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/partitioning/partprune.c
M src/backend/replication/logical/worker.c
M src/include/executor/execPartition.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/partitioning/partprune.h

Fix duplicate primary keys in partitions

commit   : fb9e93a2c5cf99e59a7e9362afd462f29e71bc1e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 4 Oct 2018 11:37:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 4 Oct 2018 11:37:20 -0300    

Click here for diff

When using the CREATE TABLE .. PARTITION OF syntax, it's possible to  
cause a partition to get two primary keys if the parent already has one.  
Tighten the check to disallow that.  
  
Reported-by: Rajkumar Raghuwanshi  
Author: Amul Sul  
Discussion: https://postgr.es/m/CAKcux6=OnSV3-qd8Gb6W=KPPwcCz6Fe_O_MQYjTa24__Xn8XxA@mail.gmail.com  

M src/backend/catalog/index.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Refactor user-facing SQL functions signalling backends

commit   : 09921f397b84bdae8406f3dc6f473ead730a6dd3    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Oct 2018 18:27:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Oct 2018 18:27:25 +0900    

Click here for diff

This moves the system administration functions for signalling backends  
from backend/utils/adt/misc.c into a separate file dedicated to backend  
signalling.  No new functionality is introduced in this commit.  
  
Author: Daniel Gustafsson  
Reviewed-by: Michael Paquier, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/Makefile
A src/backend/storage/ipc/signalfuncs.c
M src/backend/utils/adt/misc.c

Add option SKIP_LOCKED to VACUUM and ANALYZE

commit   : 803b1301e8c9aac478abeec62824a5d09664ffff    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Oct 2018 09:00:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Oct 2018 09:00:33 +0900    

Click here for diff

When specified, this option allows VACUUM to skip the work on a relation  
if there is a conflicting lock on it when trying to open it at the  
beginning of its processing.  
  
Similarly to autovacuum, this comes with a couple of limitations while  
the relation is processed which can cause the process to still block:  
- when opening the relation indexes.  
- when acquiring row samples for table inheritance trees, partition trees  
or certain types of foreign tables, and that a lock is taken on some  
leaves of such trees.  
  
Author: Nathan Bossart  
Reviewed-by: Michael Paquier, Andres Freund, Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuum.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
A src/test/isolation/expected/vacuum-skip-locked.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/vacuum-skip-locked.spec
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Replace uint64 use introduced in 4868e446859 in light of 595a0eab7f42.

commit   : d173652797cf0cf456ac2c38eca898159a7c19fc    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 3 Oct 2018 13:28:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 3 Oct 2018 13:28:14 -0700    

Click here for diff

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

M src/port/snprintf.c

Ensure that snprintf.c's fmtint() doesn't overflow when printing INT64_MIN.

commit   : 4868e4468590bc32f9c3afed4ec795d6a7732c9d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 3 Oct 2018 13:02:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 3 Oct 2018 13:02:25 -0700    

Click here for diff

This isn't actually a live bug, as the output happens to be the  
same.  But it upsets tools like UBSan, which makes it worthwhile to  
fix.  
  
As it's an issue without practical consequences, don't backpatch.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

Change executor to just Assert that table locks were already obtained.

commit   : 9a3cebeaa7fdc1b0485475eb18121eb06968dc5d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Oct 2018 16:05:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Oct 2018 16:05:05 -0400    

Click here for diff

Instead of locking tables during executor startup, just Assert that  
suitable locks were obtained already during the parse/plan pipeline  
(or re-obtained by the plan cache).  This must be so, else we have a  
hazard that concurrent DDL has invalidated the plan.  
  
This is pretty inefficient as well as undercommented, but it's all going  
to go away shortly, so I didn't try hard.  This commit is just another  
attempt to use the buildfarm to see if we've missed anything in the plan  
to simplify the executor's table management.  
  
Note that the change needed here in relation_open() exposes that  
parallel workers now really are accessing tables without holding any  
lock of their own, whereas they were not doing that before this commit.  
This does not give me a warm fuzzy feeling about that aspect of parallel  
query; it does not seem like a good design, and we now know that it's  
had exactly no actual testing.  I think that we should modify parallel  
query so that that change can be reverted.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c

Fix issues around EXPLAIN with JIT.

commit   : c03c1449c0925637d382bd16197796e6c5cab31d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 3 Oct 2018 12:48:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 3 Oct 2018 12:48:37 -0700    

Click here for diff

I (Andres) was more than a bit hasty in committing 33001fd7a7072d48327  
after last minute changes, leading to a number of problems (jit output  
was only shown for JIT in parallel workers, and just EXPLAIN without  
ANALYZE didn't work).  Lukas luckily found these issues quickly.  
  
Instead of combining instrumentation in in standard_ExecutorEnd(), do  
so on demand in the new ExplainPrintJITSummary().  
  
Also update a documentation example of the JIT output, changed in  
52050ad8ebec8d831.  
  
Author: Lukas Fittl, with minor changes by me  
Discussion: https://postgr.es/m/CAP53PkxmgJht69pabxBXJBM+0oc6kf3KHMborLP7H2ouJ0CCtQ@mail.gmail.com  
Backpatch: 11, where JIT compilation was introduced  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/jit.sgml
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/include/commands/explain.h
M src/include/nodes/execnodes.h

Rationalize snprintf.c's handling of "ll" formats.

commit   : 595a0eab7f425e3484639fae1f7e221fe9c2651a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Oct 2018 14:33:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Oct 2018 14:33:13 -0400    

Click here for diff

Although all known platforms define "long long" as 64 bits, it still feels  
a bit shaky to be using "va_arg(args, int64)" to pull out an argument that  
the caller thought was declared "long long".  The reason it was coded like  
this, way back in commit 3311c7669, was to work around the possibility that  
the compiler had no type named "long long" --- and, at the time, that it  
maybe didn't have 64-bit ints at all.  Now that we're requiring compilers  
to support C99, those concerns are moot.  Let's make the code clearer and  
more bulletproof by writing "long long" where we mean "long long".  
  
This does introduce a hazard that we'd inefficiently use 128-bit arithmetic  
to convert plain old integers.  The way to tackle that would be to provide  
two versions of fmtint(), one for "long long" and one for narrower types.  
Since, as of today, no platforms require that, we won't bother with the  
extra code for now.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

Provide fast path in snprintf.c for conversion specs that are just "%s".

commit   : 6d842be6c11887930a0f4128fd6aa4de427cfd2a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Oct 2018 13:05:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Oct 2018 13:05:01 -0400    

Click here for diff

This case occurs often enough (around 45% of conversion specs executed  
in our regression tests are just "%s") that it's worth an extra test  
per conversion spec to allow skipping all the logic associated with  
field widths and padding when it happens.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

Make assorted performance improvements in snprintf.c.

commit   : abd9ca377d669a6e0560e854d7e987438d0e612e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Oct 2018 10:18:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Oct 2018 10:18:15 -0400    

Click here for diff

In combination, these changes make our version of snprintf as fast  
or faster than most platforms' native snprintf, except for cases  
involving floating-point conversion (which we still delegate to  
the native sprintf).  The speed penalty for a float conversion  
is down to around 10% though, much better than before.  
  
Notable changes:  
  
* Rather than always parsing the format twice to see if it contains  
instances of %n$, do the extra scan only if we actually find a $.  
This obviously wins for non-localized formats, and even when there  
is use of %n$, we can avoid scanning text before the first % twice.  
  
* Use strchrnul() if available to find the next %, and emit the  
literal text between % escapes as strings rather than char-by-char.  
  
* Create a bespoke function (dopr_outchmulti) for the common case  
of emitting N copies of the same character, in place of writing  
loops around dopr_outch.  
  
* Simplify construction of the format string for invocations of sprintf  
for floats.  
  
* Const-ify some internal functions, and avoid unnecessary use of  
pass-by-reference arguments.  
  
Patch by me, reviewed by Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/port/snprintf.c

MAXALIGN the target address where we store flattened value.

commit   : 9bc9f72b28fe4d2c22244f3443af8f1b98b56474    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 3 Oct 2018 09:04:54 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 3 Oct 2018 09:04:54 +0530    

Click here for diff

The API (EOH_flatten_into) that flattens the expanded value representation  
expects the target address to be maxaligned.  All it's usage adhere to that  
principle except when serializing datums for parallel query.  Fix that  
usage.  
  
Diagnosed-by: Tom Lane  
Author: Tom Lane and Amit Kapila  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/[email protected]  

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

Don't build static libraries on Cygwin

commit   : a33245a8537f8ecbd2cd50c67b2b234f65e8fe14    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 2 Oct 2018 16:46:57 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 2 Oct 2018 16:46:57 -0400    

Click here for diff

Cygwin has been building and linking against static libraries. Although  
a bug this has been relatively harmless until now, when this has caused  
errors due to changes in the way we build certain libraries. So this  
patch makes things work the way we always intended, namely that we would  
link against the dynamic libraries (cygpq.dll etc.) and just not build  
the static libraries. The downstream packagers have been doing this for  
some time, so this just aligns with their practice.  
  
Extracted from a patch by Marco Atzeri, with a suggestion from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

Change rewriter/planner/executor/plancache to depend on RTE rellockmode.

commit   : 6e35939febf83069430fedda6f89ab1fbe0f9e10    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 14:43:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 14:43:01 -0400    

Click here for diff

Instead of recomputing the required lock levels in all these places,  
just use what commit fdba460a2 made the parser store in the RTE fields.  
This already simplifies the code measurably in these places, and  
follow-on changes will remove a bunch of no-longer-needed infrastructure.  
  
In a few cases, this change causes us to acquire a higher lock level  
than we did before.  This is OK primarily because said higher lock level  
should've been acquired already at query parse time; thus, we're saving  
a useless extra trip through the shared lock manager to acquire a lesser  
lock alongside the original lock.  The only known exception to this is  
that re-execution of a previously planned SELECT FOR UPDATE/SHARE query,  
for a table that uses ROW_MARK_REFERENCE or ROW_MARK_COPY methods, might  
have gotten only AccessShareLock before.  Now it will get RowShareLock  
like the first execution did, which seems fine.  
  
While there's more to do, push it in this state anyway, to let the  
buildfarm help verify that nothing bad happened.  
  
Amit Langote, reviewed by David Rowley and Jesper Pedersen,  
and whacked around a bit more by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/cache/plancache.c

Use slots more widely in tuple mapping code and make naming more consistent.

commit   : cc2905e963e950d01cd2cb6c860638ce9506c63d    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 2 Oct 2018 11:14:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 2 Oct 2018 11:14:26 -0700    

Click here for diff

It's inefficient to use a single slot for mapping between tuple  
descriptors for multiple tuples, as previously done when using  
ConvertPartitionTupleSlot(), as that means the slot's tuple descriptors  
change for every tuple.  
  
Previously we also, via ConvertPartitionTupleSlot(), built new tuples  
after the mapping even in cases where we, immediately afterwards,  
access individual columns again.  
  
Refactor the code so one slot, on demand, is used for each  
partition. That avoids having to change the descriptor (and allows to  
use the more efficient "fixed" tuple slots). Then use slot->slot  
mapping, to avoid unnecessarily forming a tuple.  
  
As the naming between the tuple and slot mapping functions wasn't  
consistent, rename them to execute_attr_map_{tuple,slot}.  It's likely  
that we'll also rename convert_tuples_by_* to denote that these  
functions "only" build a map, but that's left for later.  
  
Author: Amit Khandekar and Amit Langote, editorialized by me  
Reviewed-By: Amit Langote, Amit Khandekar, Andres Freund  
Discussion:  
    https://postgr.es/m/CAJ3gD9fR0wRNeAE8VqffNTyONS_UfFPRpqxhnD9Q42vZB+Jvpg@mail.gmail.com  
    https://postgr.es/m/e4f9d743-cd4b-efb0-7574-da21d86a7f36%40lab.ntt.co.jp  
Backpatch: -  

M src/backend/access/common/tupconvert.c
M src/backend/commands/analyze.c
M src/backend/commands/copy.c
M src/backend/commands/trigger.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/tupconvert.h
M src/include/executor/execPartition.h
M src/pl/plpgsql/src/pl_exec.c

Set snprintf.c's maximum number of NL arguments to be 31.

commit   : 625b38ea0e98cb596b393c70e5eaba67c6f4279e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 12:41:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 12:41:28 -0400    

Click here for diff

Previously, we used the platform's NL_ARGMAX if any, otherwise 16.  
The trouble with this is that the platform value is hugely variable,  
ranging from the POSIX-minimum 9 to as much as 64K on recent FreeBSD.  
Values of more than a dozen or two have no practical use and slow down  
the initialization of the argtypes array.  Worse, they cause snprintf.c  
to consume far more stack space than was the design intention, possibly  
resulting in stack-overflow crashes.  
  
Standardize on 31, which is comfortably more than we need (it looks like  
no existing translatable message has more than about 10 parameters).  
I chose that, not 32, to make the array sizes powers of 2, for some  
possible small gain in speed of the memset.  
  
The lack of reported crashes suggests that the set of platforms we  
use snprintf.c on (in released branches) may have no overlap with  
the set where NL_ARGMAX has unreasonably large values.  But that's  
not entirely clear, so back-patch to all supported branches.  
  
Per report from Mateusz Guzik (via Thomas Munro).  
  
Discussion: https://postgr.es/m/CAEepm=3VF=PUp2f8gU8fgZB22yPE_KBS0+e1AHAtQ=09schTHg@mail.gmail.com  

M src/port/snprintf.c

Fix corner-case failures in has_foo_privilege() family of functions.

commit   : 3d0f68dd30612db8d8cf6529455a369ad121c521    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 11:54:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Oct 2018 11:54:12 -0400    

Click here for diff

The variants of these functions that take numeric inputs (OIDs or  
column numbers) are supposed to return NULL rather than failing  
on bad input; this rule reduces problems with snapshot skew when  
queries apply the functions to all rows of a catalog.  
  
has_column_privilege() had careless handling of the case where the  
table OID didn't exist.  You might get something like this:  
	select has_column_privilege(9999,'nosuchcol','select');  
	ERROR:  column "nosuchcol" of relation "(null)" does not exist  
or you might get a crash, depending on the platform's printf's response  
to a null string pointer.  
  
In addition, while applying the column-number variant to a dropped  
column returned NULL as desired, applying the column-name variant  
did not:  
	select has_column_privilege('mytable','........pg.dropped.2........','select');  
	ERROR:  column "........pg.dropped.2........" of relation "mytable" does not exist  
It seems better to make this case return NULL as well.  
  
Also, the OID-accepting variants of has_foreign_data_wrapper_privilege,  
has_server_privilege, and has_tablespace_privilege didn't follow the  
principle of returning NULL for nonexistent OIDs.  Superusers got TRUE,  
everybody else got an error.  
  
Per investigation of Jaime Casanova's report of a new crash in HEAD.  
These behaviors have been like this for a long time, so back-patch to  
all supported branches.  
  
Patch by me; thanks to Stephen Frost for discussion and review  
  
Discussion: https://postgr.es/m/CAJGNTeP=-6Gyqq5TN9OvYEydi7Fv1oGyYj650LGTnW44oAzYCg@mail.gmail.com  

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

Fix documentation of pgrowlocks using "lock_type" instead of "modes"

commit   : 80810ca629c159191387f677b368a0551bbf2351    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Oct 2018 16:34:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Oct 2018 16:34:41 +0900    

Click here for diff

The example used in the documentation is outdated as well.  This is an  
oversight from 0ac5ad5, which bumped up pgrowlocks but forgot some bits  
of the documentation.  
  
Reported-by: Chris Wilson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

M doc/src/sgml/pgrowlocks.sgml

Test passing expanded-value representations to workers.

commit   : 0fd6a8a7d0ce6dcf0edb8330fe7e6d6fde8f40db    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Oct 2018 11:01:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Oct 2018 11:01:33 +0530    

Click here for diff

Currently, we don't have an explicit test to pass expanded-value  
representations to workers, so we don't know whether it works on all kind  
of platforms.  We suspect that the current code won't work on  
alignment-sensitive hardware.  This commit will test that aspect and can  
lead to failure on some of the buildfarm machines which we will fix in the  
later commit.  
  
Author: Tom Lane and Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor relation opening for VACUUM and ANALYZE

commit   : e3a25ab9ea56ac540dc683cdf6f6a4b923bd22be    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Oct 2018 08:53:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Oct 2018 08:53:38 +0900    

Click here for diff

VACUUM and ANALYZE share similar logic when it comes to opening a  
relation to work on in terms of how the relation is opened, in which  
order locks are tried and how logs should be generated when something  
does not work as expected.  
  
This commit refactors things so as both use the same code path to handle  
the way a relation is opened, so as the integration of new options  
becomes easier.  
  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

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

Change PROCEDURE to FUNCTION in CREATE EVENT TRIGGER syntax

commit   : cf3dfea45b13662b3c23d7c481a9f77d67e77c45    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Oct 2018 23:02:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Oct 2018 23:02:55 +0200    

Click here for diff

This was claimed to have been done in  
0a63f996e018ac508c858e87fa39cc254a5db49f, but that actually only  
changed the documentation and not the grammar.  (That commit did fully  
change it for CREATE TRIGGER.)  

M src/backend/parser/gram.y
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Add assertions that we hold some relevant lock during relation open.

commit   : b04aeb0a053e7cf7faad89f7d47844d8ba0dc839    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 12:43:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 12:43:21 -0400    

Click here for diff

Opening a relation with no lock at all is unsafe; there's no guarantee  
that we'll see a consistent state of the relevant catalog entries.  
While use of MVCC scans to read the catalogs partially addresses that  
complaint, it's still possible to switch to a new catalog snapshot  
partway through loading the relcache entry.  Moreover, whether or not  
you trust the reasoning behind sometimes using less than  
AccessExclusiveLock for ALTER TABLE, that reasoning is certainly not  
valid if concurrent users of the table don't hold a lock corresponding  
to the operation they want to perform.  
  
Hence, add some assertion-build-only checks that require any caller  
of relation_open(x, NoLock) to hold at least AccessShareLock.  This  
isn't a full solution, since we can't verify that the lock level is  
semantically appropriate for the action --- but it's definitely of  
some use, because it's already caught two bugs.  
  
We can also assert that callers of addRangeTableEntryForRelation()  
hold at least the lock level specified for the new RTE.  
  
Amit Langote and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/parser/parse_relation.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h

Fix tuple_data_split() to not open a relation without any lock.

commit   : b66827ca7c5a4c9e31b1a1eced677f8677efc0cf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 11:51:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 11:51:07 -0400    

Click here for diff

contrib/pageinspect's tuple_data_split() function thought it could get  
away with opening the referenced relation with NoLock.  In practice  
there's no guarantee that the current session holds any lock on that  
rel (even if we just read a page from it), so that this is unsafe.  
  
Switch to using AccessShareLock.  Also, postpone closing the relation,  
so that we needn't copy its tupdesc.  Also, fix unsafe use of  
att_isnull() for attributes past the end of the tuple.  
  
Per testing with a patch that complains if we open a relation without  
holding any lock on it.  I don't plan to back-patch that patch, but we  
should close the holes it identifies in all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/heapfuncs.c

Fix ALTER COLUMN TYPE to not open a relation without any lock.

commit   : e27453bd839f3d0f55f94afa554be7066a841ab3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 11:39:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Oct 2018 11:39:13 -0400    

Click here for diff

If the column being modified is referenced by a foreign key constraint  
of another table, ALTER TABLE would open the other table (to re-parse  
the constraint's definition) without having first obtained a lock on it.  
This was evidently intentional, but that doesn't mean it's really safe.  
It's especially not safe in 9.3, which pre-dates use of MVCC scans for  
catalog reads, but even in current releases it doesn't seem like a good  
idea.  
  
We know we'll need AccessExclusiveLock shortly to drop the obsoleted  
constraint, so just get that a little sooner to close the hole.  
  
Per testing with a patch that complains if we open a relation without  
holding any lock on it.  I don't plan to back-patch that patch, but we  
should close the holes it identifies in all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

doc: Clarify CREATE TABLESPACE documentation

commit   : a6949ca34d3aca018870815cf6cb690024aeea04    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 24 Sep 2018 14:47:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 24 Sep 2018 14:47:09 +0200    

Click here for diff

Be more specific about when and how to create the directory and what  
permissions it should have.  
  
Discussion: https://www.postgresql.org/message-id/flat/5ca60e1a-26f9-89fd-e912-021dd2b8afe2%40gmail.com  

M doc/src/sgml/ref/create_tablespace.sgml

Create an RTE field to record the query's lock mode for each relation.

commit   : fdba460a26af919c0b366755d119f384706e670a    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Sep 2018 13:55:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Sep 2018 13:55:51 -0400    

Click here for diff

Add RangeTblEntry.rellockmode, which records the appropriate lock mode for  
each RTE_RELATION rangetable entry (either AccessShareLock, RowShareLock,  
or RowExclusiveLock depending on the RTE's role in the query).  
  
This patch creates the field and makes all creators of RTE nodes fill it  
in reasonably, but for the moment nothing much is done with it.  The plan  
is to replace assorted post-parser logic that re-determines the right  
lockmode to use with simple uses of rte->rellockmode.  For now, just add  
Asserts in each of those places that the rellockmode matches what they are  
computing today.  (In some cases the match isn't perfect, so the Asserts  
are weaker than you might expect; but this seems OK, as per discussion.)  
  
This passes check-world for me, but it seems worth pushing in this state  
to see if the buildfarm finds any problems in cases I failed to test.  
  
catversion bump due to change of stored rules.  
  
Amit Langote, reviewed by David Rowley and Jesper Pedersen,  
and whacked around a bit more by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/commands/copy.c
M src/backend/commands/createas.c
M src/backend/commands/policy.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/view.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.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/planner.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_utilcmd.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/plancache.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_relation.h
M src/test/modules/test_rls_hooks/test_rls_hooks.c

Add application_name to connection authorized msg

commit   : 8bddc864000f56d396621d4ad0f13e8e1872ddf5    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 28 Sep 2018 19:04:50 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 28 Sep 2018 19:04:50 -0400    

Click here for diff

The connection authorized message has quite a bit of useful information  
in it, but didn't include the application_name (when provided), so let's  
add that as it can be very useful.  
  
Note that at the point where we're emitting the connection authorized  
message, we haven't processed GUCs, so it's not possible to get this by  
using log_line_prefix (which pulls from the GUC).  There's also  
something to be said for having this included in the connection  
authorized message and then not needing to repeat it for every line, as  
having it in log_line_prefix would do.  
  
The GUC cleans the application name to pure-ascii, so do that here too,  
but pull out the logic for cleaning up a string into its own function  
in common and re-use it from those places, and check_cluster_name which  
was doing the same thing.  
  
Author: Don Seiler <[email protected]>  
Discussion: https://postgr.es/m/CAHJZqBB_Pxv8HRfoh%2BAB4KxSQQuPVvtYCzMg7woNR3r7dfmopw%40mail.gmail.com  

M src/backend/postmaster/postmaster.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/common/string.c
M src/include/common/string.h
M src/include/libpq/libpq-be.h

Improve error reporting for unsupported effective_io_concurrency setting.

commit   : 2b04dfc4724970231ac338aa71e529c823fc5ff6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 16:12:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 16:12:13 -0400    

Click here for diff

Give a specific error complaining about lack of posix_fadvise() when  
someone tries to set effective_io_concurrency > 0 on platforms  
without that.  
  
This probably isn't worth extensive back-patching, but I (tgl) felt  
cramming it into v11 was reasonable.  
  
James Robinson  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/include/pg_config_manual.h

Tweak MSVC build system to match changes in 7143b3e82.

commit   : 61f14cc8c85b5e6186c3b86c2c929821d7b33589    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 15:49:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 15:49:05 -0400    

Click here for diff

Looks like we need to pull in $libpgcommon in a couple more  
places than before.  
  
Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Tweak MSVC build system to match changes in 7143b3e82.

commit   : 97c6852ff7c54d5b44426ceae9e3215d13157c10    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 15:17:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 15:17:07 -0400    

Click here for diff

Also try to make the comment suggesting that this might be needed  
more intelligible.  
  
Per buildfarm.  

M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Build src/common files as a library with -fPIC.

commit   : 7143b3e82136d2941b3394168940d895a29b4f36    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 14:28:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 14:28:19 -0400    

Click here for diff

Build a third version of libpgcommon.a, with -fPIC and -DFRONTEND,  
as commit ea53100d5 did for src/port.  Use that in libpq to avoid  
symlinking+rebuilding source files retail.  
  
Also adjust ecpg to use the new src/port and src/common libraries.  
  
Arrange to install these libraries, too, to simplify out-of-tree  
builds of shared libraries that need any of these modules.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/common/Makefile
M src/interfaces/ecpg/compatlib/.gitignore
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/.gitignore
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/.gitignore
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
M src/port/Makefile

Remove pqsignal() from libpq's official exports list.

commit   : f7ab802855200df5529a6e1e7b748d7926acace8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 12:38:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 28 Sep 2018 12:38:10 -0400    

Click here for diff

Client applications should get this function, if they need it, from  
libpgport.  
  
The fact that it's exported from libpq is a hack left over from before  
we set up libpgport.  It's never been documented, and there's no good  
reason for non-PG code to be calling it anyway, so hopefully this won't  
cause any problems.  Moreover, with the previous setup it was not real  
clear whether our clients that use the function were getting it from  
libpgport or libpq, so this might actually prevent problems.  
  
The reason for changing it now is that in the wake of commit ea53100d5,  
some linkers won't export the symbol, apparently because it's coming from  
a .a library instead of a .o file.  We could get around that by continuing  
to symlink pqsignal.c into libpq as before; but unless somebody complains  
very hard, I don't want to adopt such a kluge.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/exports.txt

Fix assertion failure when updating full_page_writes for checkpointer.

commit   : a86bf6057edf7bc344f1ab6ba7824b561ed9068a    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 28 Sep 2018 11:50:17 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 28 Sep 2018 11:50:17 +0530    

Click here for diff

When the checkpointer receives a SIGHUP signal to update its configuration,  
it may need to update the shared memory for full_page_writes and need to  
write a WAL record for it.  Now, it is quite possible that the XLOG  
machinery has not been initialized by that time and it will lead to  
assertion failure while doing that.  Fix is to allow the initialization of  
the XLOG machinery outside critical section.  
  
This bug has been introduced by the commit 2c03216d83 which added the XLOG  
machinery initialization in RecoveryInProgress code path.  
  
Reported-by: Dilip Kumar  
Author: Dilip Kumar  
Reviewed-by: Michael Paquier and Amit Kapila  
Backpatch-through: 9.5  
Discussion: https://postgr.es/m/CAFiTN-u4BA8KXcQUWDPNgaKAjDXC=C2whnzBM8TAcv=stckYUw@mail.gmail.com  

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

Correct overflow handling in pgbench.

commit   : 92a0342a90b38b0b007f079d33286f9aefabfe40    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 27 Sep 2018 21:48:47 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 27 Sep 2018 21:48:47 -0700    

Click here for diff

This patch attempts, although it's quite possible there are a few  
holes, to properly detect and reported signed integer overflows in  
pgbench.  
  
Author: Fabien Coelho  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl

Fix WAL recycling on standbys depending on archive_mode

commit   : 78ea8b5daab9237fd42d7a8a836c1c451765499f    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 28 Sep 2018 11:54:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 28 Sep 2018 11:54:38 +0900    

Click here for diff

A restart point or a checkpoint recycling WAL segments treats segments  
marked with neither ".done" (archiving is done) or ".ready" (segment is  
ready to be archived) in archive_status the same way for archive_mode  
being "on" or "always".  While for a primary this is fine, a standby  
running a restart point with archive_mode = on would try to mark such a  
segment as ready for archiving, which is something that will never  
happen except after the standby is promoted.  
  
Note that this problem applies only to WAL segments coming from the  
local pg_wal the first time archive recovery is run.  Segments part of a  
self-contained base backup are the most common case where this could  
happen, however even in this case normally the .done markers would be  
most likely part of the backup.  Segments recovered from an archive are  
marked as .ready or .done by the startup process, and segments finished  
streaming are marked as such by the WAL receiver, so they are handled  
already.  
  
Reported-by: Haruka Takatsuka  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5, where archive_mode = always has been added.  

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

Fix assorted bugs in pg_get_partition_constraintdef().

commit   : aaf10f32a308bc5f53772c773edf3f345f59bb74    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Sep 2018 18:15:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Sep 2018 18:15:06 -0400    

Click here for diff

It failed if passed a nonexistent relation OID, or one that was a non-heap  
relation, because of blindly applying heap_open to a user-supplied OID.  
This is not OK behavior for a SQL-exposed function; we have a project  
policy that we should return NULL in such cases.  Moreover, since  
pg_get_partition_constraintdef ought now to work on indexes, restricting  
it to heaps is flat wrong anyway.  
  
The underlying function generate_partition_qual() wasn't on board with  
indexes having partition quals either, nor for that matter with rels  
having relispartition set but yet null relpartbound.  (One wonders  
whether the person who wrote the function comment blocks claiming that  
these functions allow a missing relpartbound had ever tested it.)  
  
Fix by testing relispartition before opening the rel, and by using  
relation_open not heap_open.  (If any other relkinds ever grow the  
ability to have relispartition set, the code will work with them  
automatically.)  Also, don't reject null relpartbound in  
generate_partition_qual.  
  
Back-patch to v11, and all but the null-relpartbound change to v10.  
(It's not really necessary to change generate_partition_qual at all  
in v10, but I thought s/heap_open/relation_open/ would be a good  
idea anyway just to keep the code in sync with later branches.)  
  
Per report from Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

Minor formatting cleanup for 2a6368343f

commit   : 4ec90f53f10141867d8b86f58d72990a13ff267b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 27 Sep 2018 23:29:50 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 27 Sep 2018 23:29:50 +0300    

Click here for diff

M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgquadtreeproc.c

Remove extra usage of BoxPGetDatum() macro

commit   : 0f6459589494a4b4ff6c707594f8d308b9da88f8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 27 Sep 2018 23:25:22 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 27 Sep 2018 23:25:22 +0300    

Click here for diff

Author: Mark Dilger  
Discussion: https://postgr.es/m/B2AEFCD0-836D-4654-9D59-3DF616E0A6F3%40gmail.com  

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

Clean up in the wake of TupleDescGetSlot() removal / 10763358c3f.

commit   : 27e082b0c6e564facfbf54b56090fdcc4bf44cca    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 27 Sep 2018 11:24:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 27 Sep 2018 11:24:49 -0700    

Click here for diff

The previous commit wasn't careful enough to remove all traces of  
TupleDescGetSlot().  
  
Besides fixing the oversight of not removing TupleDescGetSlot()'s  
declaration, this also removes FuncCallContext->slot. That was  
documented to be for use in combination with TupleDescGetSlot(), a  
cursory search over extensions finds no users, and there doesn't seem  
to be convincing reasons to keep it around. If we later in the v12  
release cycle find users, we can re-consider this part of the commit.  
  
Reported-By: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml
M src/backend/utils/fmgr/funcapi.c
M src/include/funcapi.h

Build src/port files as a library with -fPIC, and use that in libpq.

commit   : ea53100d5671b5b243f77898b0b04d23c38b2820    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Sep 2018 11:23:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Sep 2018 11:23:43 -0400    

Click here for diff

libpq and ecpg need shared-library-friendly versions of assorted src/port/  
and src/common/ modules.  Up to now, they got those by symlinking the  
individual source files and compiling them locally.  That's baroque, and a  
pain to maintain, and it results in some amount of duplicated compile work.  
It might've made sense when only a couple of files were needed, but the  
list has grown and grown and grown :-(  
  
It makes more sense to have the originating directory build a third variant  
of libpgport.a/libpgcommon.a containing modules built with $(CFLAGS_SL),  
and just link that into the shared library.  Unused files won't get linked,  
so the end result should be the same.  
  
This patch makes a down payment on that idea by having src/port/ build  
such a library and making libpq use it.  If the buildfarm doesn't expose  
fatal problems with the approach, I'll extend it to the other cases.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
M src/port/.gitignore
M src/port/Makefile

Fix another portability issue from commit 758ce9b77.

commit   : ce4887bd025b95c7b455fefd817a418844c6aad3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 19:03:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 19:03:33 -0400    

Click here for diff

strerror.c now requires strlcpy() in some cases, and a couple of the  
ecpg libraries did not have that at hand.  Pull it in from src/port/  
following the usual recipe.  Per buildfarm.  

M src/interfaces/ecpg/compatlib/.gitignore
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/pgtypeslib/.gitignore
M src/interfaces/ecpg/pgtypeslib/Makefile

Switch flags tracking pending interrupts to sig_atomic_t

commit   : ba16aade337b16028d1e9e156d83417097c13817    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Sep 2018 07:47:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Sep 2018 07:47:20 +0900    

Click here for diff

Those previously used bool, which should be safe on any modern  
platforms, however the C standard is clear that it is better to use  
sig_atomic_t for variables manipulated in signal handlers.  This commit  
adds at the same time PGDLLIMPORT to ClientConnectionLost.  
  
Author: Michael Paquier  
Reviewed-by: Tom Lane, Chris Travers, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/init/globals.c
M src/include/miscadmin.h

Try another way to detect the result type of strerror_r().

commit   : 751f532b9766fb5d3c334758abea95b7bb085c5a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 18:23:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 18:23:13 -0400    

Click here for diff

The method we've traditionally used, of redeclaring strerror_r() to  
see if the compiler complains of inconsistent declarations, turns out  
not to work reliably because some compilers only report a warning,  
not an error.  Amazingly, this has gone undetected for years, even  
though it certainly breaks our detection of whether strerror_r  
succeeded.  
  
Let's instead test whether the compiler will take the result of  
strerror_r() as a switch() argument.  It's possible this won't  
work universally either, but it's the best idea I could come up with  
on the spur of the moment.  
  
We should probably back-patch this once the dust settles, but  
first let's see what the buildfarm thinks of it.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-library.m4
M configure
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Clean up *printf macros to avoid conflict with format archetypes.

commit   : 8b91d258844afa58e856ac354f9ba9745ff9ffb2    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 17:35:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 17:35:01 -0400    

Click here for diff

We must define the macro "printf" with arguments, else it can mess  
up format archetype attributes in builds where PG_PRINTF_ATTRIBUTE  
is just "printf".  Fortunately, that's easy to do now that we're  
requiring C99; we can use __VA_ARGS__.  
  
On the other hand, it's better not to use __VA_ARGS__ for the rest  
of the *printf crew, so that one can take the addresses of those  
functions without surprises.  
  
I'd proposed doing this some time ago, but forgot to make it happen;  
buildfarm failures subsequent to 96bf88d52 reminded me.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port.h
M src/pl/plperl/plperl.h
M src/pl/plpython/plpython.h

commit   : a6b88d682cbec73474a73c9782fb7096e9440a8b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 16:47:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 16:47:44 -0400    

Click here for diff

snprintf.c requires isnan(), which requires -lm on some platforms.  
libpq never bothered with -lm before, but now it needs it.  
  
strerror.c tries to translate a string or two, which requires -lintl.  
We'd managed never to need that anywhere in ecpg/pgtypeslib/ before,  
but now we do.  
  
Per buildfarm and a report from Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/Makefile

Recurse to sequences on ownership change for all relkinds

commit   : 0320ddaf3c08ea17d616549d0e7f45239592fc76    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 14 Jun 2018 23:22:14 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 14 Jun 2018 23:22:14 -0400    

Click here for diff

When a table ownership is changed, we must apply that also to any owned  
sequences.  (Otherwise, it would result in a situation that cannot be  
restored, because linked sequences must have the same owner as the  
table.)  But this was previously only applied to regular tables and  
materialized views.  But it should also apply to at least foreign  
tables.  This patch removes the relkind check altogether, because it  
doesn't save very much and just introduces the possibility of similar  
omissions.  
  
Bug: #15238  
Reported-by: Christoph Berg <[email protected]>  

M src/backend/commands/tablecmds.c

Implement %m in src/port/snprintf.c, and teach elog.c to rely on that.

commit   : d6c55de1f99a9028540516316b95321a7b12a540    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 13:31:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 13:31:56 -0400    

Click here for diff

I started out with the idea that we needed to detect use of %m format specs  
in contexts other than elog/ereport calls, because we couldn't rely on that  
working in *printf calls.  But a better answer is to fix things so that it  
does work.  Now that we're using snprintf.c all the time, we can implement  
%m in that and we've fixed the problem.  
  
This requires also adjusting our various printf-wrapping functions so that  
they ensure "errno" is preserved when they call snprintf.c.  
  
Remove elog.c's handmade implementation of %m, and let it rely on  
snprintf to support the feature.  That should provide some performance  
gain, though I've not attempted to measure it.  
  
There are a lot of places where we could now simplify 'printf("%s",  
strerror(errno))' into 'printf("%m")', but I'm not in any big hurry  
to make that happen.  
  
Patch by me, reviewed by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/lib/stringinfo.c
M src/backend/utils/error/elog.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_tar.c
M src/common/psprintf.c
M src/interfaces/libpq/pqexpbuffer.c
M src/pl/plpython/plpy_elog.c
M src/port/snprintf.c

Always use our own versions of *printf().

commit   : 96bf88d52711ad3a0a4cc2d1d9cb0e2acab85e63    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 13:13:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 13:13:57 -0400    

Click here for diff

We've spent an awful lot of effort over the years in coping with  
platform-specific vagaries of the *printf family of functions.  Let's just  
forget all that mess and standardize on always using src/port/snprintf.c.  
This gets rid of a lot of configure logic, and it will allow a saner  
approach to dealing with %m (though actually changing that is left for  
a follow-on patch).  
  
Preliminary performance testing suggests that as it stands, snprintf.c is  
faster than the native printf functions for some tasks on some platforms,  
and slower for other cases.  A pending patch will improve that, though  
cases with floating-point conversions will doubtless remain slower unless  
we want to put a *lot* of effort into that.  Still, we've not observed  
that *printf is really a performance bottleneck for most workloads, so  
I doubt this matters much.  
  
Patch by me, reviewed by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M config/c-library.m4
M configure
M configure.in
M src/include/c.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/Makefile
M src/pl/plperl/plperl.h
M src/pl/plpython/plpython.h
M src/port/Makefile
M src/port/README

Incorporate strerror_r() into src/port/snprintf.c, too.

commit   : 758ce9b7794845f95473c569155d29fcf0e2751b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 12:35:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 12:35:57 -0400    

Click here for diff

This provides the features that used to exist in useful_strerror()  
for users of strerror_r(), too.  Also, standardize on the GNU convention  
that strerror_r returns a char pointer that may not be NULL.  
  
I notice that libpq's win32.c contains a variant version of strerror_r  
that probably ought to be folded into strerror.c.  But lacking a  
Windows environment, I should leave that to somebody else.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port.h
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-int.h
M src/port/strerror.c
M src/port/thread.c
M src/test/thread/thread_test.c

Convert elog.c's useful_strerror() into a globally-used strerror wrapper.

commit   : 26e9d4d4ef16b5e2be96319f89ea6ba7f63a4d73    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 11:06:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 26 Sep 2018 11:06:42 -0400    

Click here for diff

elog.c has long had a private strerror wrapper that handles assorted  
possible failures or deficiencies of the platform's strerror.  On Windows,  
it also knows how to translate Winsock error codes, which the native  
strerror does not.  Move all this code into src/port/strerror.c and  
define strerror() as a macro that invokes it, so that both our frontend  
and backend code will have all of this behavior.  
  
I believe this constitutes an actual bug fix on Windows, since AFAICS  
our frontend code did not report Winsock error codes properly before this.  
However, the main point is to lay the groundwork for implementing %m  
in src/port/snprintf.c: the behavior we want %m to have is this one,  
not the native strerror's.  
  
Note that this throws away the prior use of src/port/strerror.c,  
which was to implement strerror() on platforms lacking it.  That's  
been dead code for nigh twenty years now, since strerror() was  
already required by C89.  
  
We should likewise cause strerror_r to use this behavior, but  
I'll tackle that separately.  
  
Patch by me, reviewed by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/port/win32/socket.c
M src/backend/utils/error/elog.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
M src/include/port/win32_port.h
M src/interfaces/ecpg/compatlib/.gitignore
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/.gitignore
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/.gitignore
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/libpq/Makefile
M src/pl/plpython/plpython.h
M src/port/Makefile
M src/port/strerror.c
M src/tools/msvc/Mkvcbuild.pm

Update dummy CREATE ASSERTION grammar

commit   : a49ceda6a044c2fc104b3d1397fe0bef8679d1aa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 26 Sep 2018 13:26:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 26 Sep 2018 13:26:24 +0200    

Click here for diff

While we are probably still far away from fully implementing  
assertions, all patch proposals appear to take issue with the existing  
dummy grammar CREATE/DROP ASSERTION productions, so update those a  
little bit.  Rename the rule, use any_name instead of name, and remove  
some unused code.  Also remove the production for DROP ASSERTION,  
since that would most likely be handled via the generic DROP support.  
  
extracted from a patch by Joe Wildish  

M src/backend/parser/gram.y

Improve test coverage of geometric types

commit   : a3d2844852dc664718320b15cbc6d6bfa264e66e    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 26 Sep 2018 10:45:21 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 26 Sep 2018 10:45:21 +0200    

Click here for diff

This commit significantly increases test coverage of geo_ops.c, adding  
tests for various issues addressed by 2e2a392de3 (which went undetected  
for a long time, at least partially due to not being covered).  
  
This also removes alternative results expecting -0 on some platforms.  
Instead the functions are should return the same results everywhere,  
transforming -0 to 0 if needed.  
  
The tests are added to geometric.sql file, sorted by the left hand side  
of the operators. There are many cross datatype operators, so this seems  
like the best solution.  
  
Author: Emre Hasegeli  
Reviewed-by: Tomas Vondra  
  
Discussion: https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com  

M src/test/regress/expected/box.out
M src/test/regress/expected/circle.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/geometry.out
M src/test/regress/expected/geometry_1.out
D src/test/regress/expected/geometry_2.out
M src/test/regress/expected/line.out
M src/test/regress/expected/lseg.out
M src/test/regress/expected/path.out
M src/test/regress/expected/point.out
M src/test/regress/expected/polygon.out
M src/test/regress/sql/box.sql
M src/test/regress/sql/circle.sql
M src/test/regress/sql/geometry.sql
M src/test/regress/sql/line.sql
M src/test/regress/sql/lseg.sql
M src/test/regress/sql/path.sql
M src/test/regress/sql/point.sql
M src/test/regress/sql/polygon.sql

Fix problems in handling the line data type

commit   : 2e2a392de391a9f4ef4221fccbd00c43ba5c9b40    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 26 Sep 2018 10:25:24 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 26 Sep 2018 10:25:24 +0200    

Click here for diff

According to the source history, the internal format of line data type  
has changed, but various functions working with it did were not updated  
and thus were producing wrong results.  
  
This patch addresses various such issues, in particular:  
  
* Reject invalid specification A=B=0 on receive  
* Reject same points on line_construct_pp()  
* Fix perpendicular operator when negative values are involved  
* Avoid division by zero on perpendicular operator  
* Fix intersection and distance operators when neither A nor B are 1  
* Return NULL for closest point when objects are parallel  
* Check whether closest point of line segments is the intersection point  
* Fix closest point of line segments being on the wrong segment  
  
Aside from handling those issues, the patch also aims to make operators  
more symmetric and less sen to precision loss.  The EPSILON interferes  
with even minor changes, but the least we can do is applying it to both  
sides of the operators equally.  
  
Author: Emre Hasegeli  
Reviewed-by: Tomas Vondra  
  
Discussion: https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com  

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

Add basic regression tests for default monitoring roles

commit   : f535d5f0c13cb48d85565017e7d56f2075c59978    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Sep 2018 15:26:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Sep 2018 15:26:45 +0900    

Click here for diff

The following default roles gain some coverage:  
- pg_read_all_stats  
- pg_read_all_settings  
  
Author: Alexandra Ryzhevich  
Discussion: https://postgr.es/m/CAOt4E5S5WJmDc9YpS1BfyAMQ5C1NEmiYynD6nUz42qVxphqkpA@mail.gmail.com  

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

Rework activation of commit timestamps during recovery

commit   : 8d28bf500f6536e295e9c3d7b85cdfec1c4dc913    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 26 Sep 2018 10:25:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 26 Sep 2018 10:25:54 +0900    

Click here for diff

The activation and deactivation of commit timestamp tracking has not  
been handled consistently for a primary or standbys at recovery.  The  
facility can be activated at three different moments of recovery:  
- The beginning, where a primary would use the GUC value for the  
decision-making, and where a standby relies on the contents of the  
control file.  
- When replaying a XLOG_PARAMETER_CHANGE record at redo.  
- The end, where both primary and standby rely on the GUC value.  
  
Using the GUC value for a primary at the beginning of recovery causes  
problems with commit timestamp access when doing crash recovery.  
Particularly, when replaying transaction commits, it could be possible  
that an attempt to read commit timestamps is done for a transaction  
which committed at a moment when track_commit_timestamp was disabled.  
  
A test case is added to reproduce the failure.  The test works down to  
v11 as it takes advantage of transaction commits within procedures.  
  
Reported-by: Hailong Li  
Author: Masahiko Sawasa, Michael Paquier  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.5, where commit timestamps have been introduced.  

M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xlog.c
M src/test/modules/commit_ts/t/004_restart.pl

Remove absolete function TupleDescGetSlot().

commit   : 10763358c3f0df48d2ae39b49b0c93be149cceab    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 16:28:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 16:28:57 -0700    

Click here for diff

TupleDescGetSlot() was kept around for backward compatibility for  
user-written SRFs. With the TupleTableSlot abstraction work, that code  
will need to be version specific anyway, so there's no point in  
keeping the function around any longer.  
  
Author: Ashutosh Bapat  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c

Split ExecStoreTuple into ExecStoreHeapTuple and ExecStoreBufferHeapTuple.

commit   : 29c94e03c7d05d2b29afa1de32795ce178531246    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 16:27:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 16:27:48 -0700    

Click here for diff

Upcoming changes introduce further types of tuple table slots, in  
preparation of making table storage pluggable. New storage methods  
will have different representation of tuples, therefore the slot  
accessor should refer explicitly to heap tuples.  
  
Instead of just renaming the functions, split it into one function  
that accepts heap tuples not residing in buffers, and one accepting  
ones in buffers.  Previously one function was used for both, but that  
was a bit awkward already, and splitting will allow us to represent  
slot types for tuples in buffers and normal memory separately.  
  
This is split out from the patch introducing abstract slots, as this  
largely consists out of mechanical changes.  
  
Author: Ashutosh Bapat  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/heap/heapam.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/commands/analyze.c
M src/backend/commands/constraint.c
M src/backend/commands/copy.c
M src/backend/commands/functioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeTidscan.c
M src/backend/partitioning/partbounds.c
M src/backend/replication/logical/worker.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/sort/tuplesort.c
M src/include/executor/tuptable.h

Remove function list from prologue of execTuples.c.

commit   : bbdfbb9154fccf5b58ecbbdf4e8989e2fed206f8    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 16:27:48 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 16:27:48 -0700    

Click here for diff

That section is never in sync with the actual routines available and  
their functionality.  
  
Author: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execTuples.c

Change TupleTableSlot->tts_nvalid to type AttrNumber.

commit   : a598708ffa8eb72a22eeee4e6f30bc26e4984acd    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 15:59:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 15:59:46 -0700    

Click here for diff

Previously it was an int / 4 bytes. The maximum number of attributes  
in a tuple is restricted by the maximum value Var->varattno, which is  
an AttrNumber/int16. Hence use the same data type for  
TupleTableSlot->tts_nvalid.  
  
Author: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/include/executor/tuptable.h

Remove obsolete comment

commit   : 5913b9bbf351b421141b300e37752e9ab8d85163    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 25 Sep 2018 17:55:22 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 25 Sep 2018 17:55:22 -0300    

Click here for diff

The documented shortcoming was actually fixed in 4c728f3829  
so the comment is not true anymore.  

M src/backend/executor/execParallel.c

Remove fmgr.h inclusion from partition.h

commit   : 62e533d3f129b59794c256eabad44011c9d2b951    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 25 Sep 2018 17:52:07 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 25 Sep 2018 17:52:07 -0300    

Click here for diff

It's not needed anymore.  

M src/include/catalog/partition.h

Collect JIT instrumentation from workers.

commit   : 33001fd7a7072d483272115a9376478fdc007fb9    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 12:54:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 25 Sep 2018 12:54:29 -0700    

Click here for diff

Previously, when using parallel query, EXPLAIN (ANALYZE)'s JIT  
compilation timings did not include the overhead from doing so on the  
workers.  Fix that.  
  
We do so by simply aggregating the cost of doing JIT compilation on  
workers and the leader together. Arguably that's not quite accurate,  
because the total time spend doing so is spent in parallel - but it's  
hard to do much better.  For additional detail, when VERBOSE is  
specified, the stats for workers are displayed separately.  
  
Author: Amit Khandekar and Andres Freund  
Discussion: https://postgr.es/m/CAJ3gD9eLrz51RK_gTkod+71iDcjpB_N8eC6vU2AW-VicsAERpQ@mail.gmail.com  
Backpatch: 11-  

M contrib/auto_explain/auto_explain.c
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/include/commands/explain.h
M src/include/executor/execParallel.h
M src/include/jit/jit.h
M src/include/nodes/execnodes.h

Make some fixes to allow building Postgres on macOS 10.14 ("Mojave").

commit   : 5e22171310f8d7c82219a6b978440e5144e88683    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Sep 2018 13:23:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Sep 2018 13:23:29 -0400    

Click here for diff

Apple's latest rearrangements of the system-supplied headers have broken  
building of PL/Perl and PL/Tcl.  The only practical way to fix PL/Tcl is to  
start using the "-isysroot" compiler flag to point to SDK-supplied headers,  
as Apple expects.  We must also start distinguishing where to find Perl's  
headers from where to find its shared library; but that seems like good  
cleanup anyway.  
  
Extensions that formerly did something like -I$(perl_archlibexp)/CORE  
should now do -I$(perl_includedir)/CORE instead.  perl_archlibexp  
is still the place to look for libperl.so, though.  
  
If for some reason you don't like the default -isysroot setting, you can  
override that by setting PG_SYSROOT in configure's arguments.  I don't  
currently think people would need to do so, unless maybe for cross-version  
build purposes.  
  
In addition, teach configure where to find tclConfig.sh.  Our traditional  
method of searching $auto_path hasn't worked for the last couple of macOS  
releases, and it now seems clear that Apple's not going to change that.  
The workaround of manually specifying --with-tclconfig was annoying  
already, but Mojave's made it a lot more so because the sysroot path now  
has to be included as well.  Let's just wire the knowledge into configure  
instead.  To avoid breaking builds against non-default Tcl installations  
(e.g. MacPorts) wherein the $auto_path method probably still works,  
arrange to try the additional case only after all else has failed.  
  
Back-patch to all supported versions, since at least the buildfarm  
cares about that.  The changes are set up to not do anything on macOS  
releases that are old enough to not have functional sysroot trees.  

M config/tcl.m4
M configure
M configure.in
M contrib/hstore_plperl/Makefile
M contrib/jsonb_plperl/Makefile
M src/Makefile.global.in
M src/pl/plperl/GNUmakefile
M src/template/darwin

Avoid unnecessary precision loss for pgbench's --rate target.

commit   : 5b7e036707ccd93506731da82a56b07023d13e30    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Sep 2018 11:09:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Sep 2018 11:09:18 -0400    

Click here for diff

It's fairly silly to truncate the throttle_delay to integer when the only  
math we ever do with it requires converting back to double.  Furthermore,  
given that people are starting to complain about restrictions like only  
supporting 1K client connections, I don't think we're very far away from  
situations where the precision loss matters.  As the code stood, for  
example, there's no difference between --rate 100001 and --rate 111111;  
both get converted to throttle_delay = 9.  Somebody trying to run 100  
threads and have each one dispatch around 1K TPS would find this lack of  
precision rather surprising, especially since the required per-thread  
delays are around 1ms, well within the timing precision of modern systems.  

M src/bin/pgbench/pgbench.c

Constify dsa_size_class_map and use a better type.

commit   : 64171b32069adcce7f57840143eaca9fbe28ba7e    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 25 Sep 2018 14:51:01 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 25 Sep 2018 14:51:01 +1200    

Click here for diff

Author: Mark G  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAEeOP_Zy_FvVwcAU0UX9nkOhnoR5KN%3D0B6LWX_kv0ZuSc4wbGw%40mail.gmail.com  

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

Ignore publication tables when --no-publications is used

commit   : 08c9917e24683e36dca35201723e47cdc3fa62db    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Sep 2018 11:03:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Sep 2018 11:03:56 +0900    

Click here for diff

96e1cb4 has added support for --no-publications in pg_dump, pg_dumpall  
and pg_restore, but forgot the fact that publication tables also need to  
be ignored when this option is used.  
  
Author: Gilles Darold  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10, where publications have been added.  

M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c

Revoke pg_stat_statements_reset() permissions

commit   : edb9797660541b217d23ae7c02b96b496d34fec4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Sep 2018 09:55:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Sep 2018 09:55:44 +0900    

Click here for diff

Commit 25fff40 has granted execute permission of the function  
pg_stat_statements_reset() to default role "pg_read_all_stats", but this  
role is meant to read statistics, and not to reset them.  The  
permissions on this function are revoked from "pg_read_all_stats".  The  
version of pg_stat_statements is bumped up in consequence.  
  
Author: Haribabu Kommi  
Reviewed-by: Michael Paquier, Amit Kapila  
Discussion: https://postgr.es/m/CAJrrPGf5fCnKqXObpwGN9nMyD--tzOf-7LFCJiz59Z1wJ5qj9A@mail.gmail.com  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/pg_stat_statements–1.5–1.6.sql
M contrib/pg_stat_statements/pg_stat_statements.control

Sync our Snowball stemmer dictionaries with current upstream.

commit   : fd582317e10e26083b8c720598bfcdbf89787112    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Sep 2018 17:29:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Sep 2018 17:29:08 -0400    

Click here for diff

We haven't touched these since text search functionality landed in core  
in 2007 :-(.  While the upstream project isn't a beehive of activity,  
they do make additions and bug fixes from time to time.  Update our  
copies of these files.  
  
Also update our documentation about how to keep things in sync, since  
they're not making distribution tarballs these days.  Fortunately,  
their source code turns out to be a breeze to build.  
  
Notable changes:  
  
* The non-UTF8 version of the hungarian stemmer now works in LATIN2  
not LATIN1.  
  
* New stemmers have appeared for arabic, indonesian, irish, lithuanian,  
nepali, and tamil.  These all work in UTF8, and the indonesian and  
irish ones also work in LATIN1.  
  
(There are some new stemmers that I did not incorporate, mainly because  
their names don't match the underlying languages, suggesting that they're  
not to be considered mainstream.)  
  
Worth noting: the upstream Nepali dictionary was contributed by  
Arthur Zakirov.  
  
initdb forced because the contents of snowball_create.sql have  
changed.  
  
Still TODO: see about updating the stopword lists.  
  
Arthur Zakirov, minor mods and doc work by me  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/textsearch.sgml
M src/backend/snowball/Makefile
M src/backend/snowball/README
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c
A src/backend/snowball/libstemmer/stem_ISO_8859_1_indonesian.c
A src/backend/snowball/libstemmer/stem_ISO_8859_1_irish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_norwegian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_spanish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_swedish.c
R054 src/backend/snowball/libstemmer/stem_ISO_8859_1_hungarian.c src/backend/snowball/libstemmer/stem_ISO_8859_2_hungarian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_2_romanian.c
M src/backend/snowball/libstemmer/stem_KOI8_R_russian.c
A src/backend/snowball/libstemmer/stem_UTF_8_arabic.c
M src/backend/snowball/libstemmer/stem_UTF_8_danish.c
M src/backend/snowball/libstemmer/stem_UTF_8_dutch.c
M src/backend/snowball/libstemmer/stem_UTF_8_english.c
M src/backend/snowball/libstemmer/stem_UTF_8_finnish.c
M src/backend/snowball/libstemmer/stem_UTF_8_french.c
M src/backend/snowball/libstemmer/stem_UTF_8_german.c
M src/backend/snowball/libstemmer/stem_UTF_8_hungarian.c
A src/backend/snowball/libstemmer/stem_UTF_8_indonesian.c
A src/backend/snowball/libstemmer/stem_UTF_8_irish.c
M src/backend/snowball/libstemmer/stem_UTF_8_italian.c
A src/backend/snowball/libstemmer/stem_UTF_8_lithuanian.c
A src/backend/snowball/libstemmer/stem_UTF_8_nepali.c
M src/backend/snowball/libstemmer/stem_UTF_8_norwegian.c
M src/backend/snowball/libstemmer/stem_UTF_8_porter.c
M src/backend/snowball/libstemmer/stem_UTF_8_portuguese.c
M src/backend/snowball/libstemmer/stem_UTF_8_romanian.c
M src/backend/snowball/libstemmer/stem_UTF_8_russian.c
M src/backend/snowball/libstemmer/stem_UTF_8_spanish.c
M src/backend/snowball/libstemmer/stem_UTF_8_swedish.c
A src/backend/snowball/libstemmer/stem_UTF_8_tamil.c
M src/backend/snowball/libstemmer/stem_UTF_8_turkish.c
M src/backend/snowball/libstemmer/utilities.c
A src/backend/snowball/stopwords/nepali.stop
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/snowball/libstemmer/header.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_danish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_dutch.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_english.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_finnish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_french.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_german.h
D src/include/snowball/libstemmer/stem_ISO_8859_1_hungarian.h
A src/include/snowball/libstemmer/stem_ISO_8859_1_indonesian.h
A src/include/snowball/libstemmer/stem_ISO_8859_1_irish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_italian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_norwegian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_porter.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_portuguese.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_spanish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_swedish.h
A src/include/snowball/libstemmer/stem_ISO_8859_2_hungarian.h
M src/include/snowball/libstemmer/stem_ISO_8859_2_romanian.h
M src/include/snowball/libstemmer/stem_KOI8_R_russian.h
A src/include/snowball/libstemmer/stem_UTF_8_arabic.h
M src/include/snowball/libstemmer/stem_UTF_8_danish.h
M src/include/snowball/libstemmer/stem_UTF_8_dutch.h
M src/include/snowball/libstemmer/stem_UTF_8_english.h
M src/include/snowball/libstemmer/stem_UTF_8_finnish.h
M src/include/snowball/libstemmer/stem_UTF_8_french.h
M src/include/snowball/libstemmer/stem_UTF_8_german.h
M src/include/snowball/libstemmer/stem_UTF_8_hungarian.h
A src/include/snowball/libstemmer/stem_UTF_8_indonesian.h
A src/include/snowball/libstemmer/stem_UTF_8_irish.h
M src/include/snowball/libstemmer/stem_UTF_8_italian.h
A src/include/snowball/libstemmer/stem_UTF_8_lithuanian.h
A src/include/snowball/libstemmer/stem_UTF_8_nepali.h
M src/include/snowball/libstemmer/stem_UTF_8_norwegian.h
M src/include/snowball/libstemmer/stem_UTF_8_porter.h
M src/include/snowball/libstemmer/stem_UTF_8_portuguese.h
M src/include/snowball/libstemmer/stem_UTF_8_romanian.h
M src/include/snowball/libstemmer/stem_UTF_8_russian.h
M src/include/snowball/libstemmer/stem_UTF_8_spanish.h
M src/include/snowball/libstemmer/stem_UTF_8_swedish.h
A src/include/snowball/libstemmer/stem_UTF_8_tamil.h
M src/include/snowball/libstemmer/stem_UTF_8_turkish.h

auto_explain: Include JIT information if applicable.

commit   : b076eb7669d7279d0f446305c2e12dffd6bc3347    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 24 Sep 2018 13:40:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 24 Sep 2018 13:40:57 -0700    

Click here for diff

Due to my (Andres') omission auto_explain did not include information  
about JIT compilation. Fix that.  
  
Author: Lukas Fittl  
Discussion:  
https://postgr.es/m/CAP53PkzgSyoTCau0-5FNaM484B=uO8nLzma7L1ncWLb1=oVJQA@mail.gmail.com  
Backpatch: 11-, where JIT compilation was introduced  

M contrib/auto_explain/auto_explain.c

Make EXPLAIN output for JIT compilation more dense.

commit   : 52050ad8ebec8d831902f587314aa4f6aaa6d2c5    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 24 Sep 2018 13:27:08 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 24 Sep 2018 13:27:08 -0700    

Click here for diff

A discussion about also reporting JIT compilation overhead on workers  
brought unhappiness with the verbosity of the current explain format  
to light.  Make the text format more dense, and restructure the  
structured output to mirror that more closely.  
  
As we're re-jiggering the output format anyway: The denser format  
allows us to report all flags for JIT compilation (now also reporting  
PGJIT_EXPR and PGJIT_DEFORM), and report the total time in addition to  
the individual times.  
  
Per complaint from Tom Lane.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where JIT compilation was introduced  

M src/backend/commands/explain.c

Fast default trigger and expand_tuple fixes

commit   : 7636e5c60fea83a9f3cd2ad278c0819b98941c74    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 24 Sep 2018 16:11:24 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 24 Sep 2018 16:11:24 -0400    

Click here for diff

Ensure that triggers get properly filled in tuples for the OLD value.  
Also fix the logic of detecting missing null values. The previous logic  
failed to detect a missing null column before the first missing column  
with a default. Fixing this has simplified the logic a bit.  
  
Regression tests are added to test changes. This should ensure better  
coverage of expand_tuple().  
  
Original bug reports, and some code and test scripts from Tomas Vondra  
  
Backpatch to release 11.  

M src/backend/access/common/heaptuple.c
M src/backend/commands/trigger.c
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Use ppoll(2), if available, to wait for input in pgbench.

commit   : 60e612b602999e670f2d57a01e52799eaa903ca9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Sep 2018 14:40:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Sep 2018 14:40:58 -0400    

Click here for diff

Previously, pgbench always used select(2) for this purpose, but that's  
problematic for very high client counts, because select() can't deal  
with file descriptor numbers larger than FD_SETSIZE.  It's pretty common  
for that to be only 1024 or so, whereas modern OSes can allow many more  
open files than that.  Using poll(2) would surmount that problem, but it  
creates another one: poll()'s timeout resolution is only 1ms, which is  
poor enough to cause problems with --rate specifications approaching or  
exceeding 1K TPS.  
  
On platforms that have ppoll(2), which includes Linux and recent  
FreeBSD, we can use that to avoid the FD_SETSIZE problem without any  
loss of timeout resolution.  Hence, add configure logic to test for  
ppoll(), and use it if available.  
  
This patch introduces an abstraction layer into pgbench that could  
be extended to support other kernel event-wait APIs such as kevents.  
But actually adding such support is a matter for some future patch.  
  
Doug Rady, reviewed by Robert Haas and Fabien Coelho, and whacked around  
a good bit more by me  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/bin/pgbench/pgbench.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/template/linux

Fix over-allocation of space for array_out()'s result string.

commit   : 87d9bbca13f9c6b8f6ee986f0e399cb83bd731d4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Sep 2018 11:30:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Sep 2018 11:30:51 -0400    

Click here for diff

array_out overestimated the space needed for its output, possibly by  
a very substantial amount if the array is multi-dimensional, because  
of wrong order of operations in the loop that counts the number of  
curly-brace pairs needed.  While the output string is normally  
short-lived, this could still cause problems in extreme cases.  
  
An additional minor error was that it counted one more delimiter than  
is actually needed.  
  
Repair those errors, add an Assert that the space is now correctly  
calculated, and make some minor improvements in the comments.  
  
I also failed to resist the temptation to get rid of an integer  
modulus operation per array element; a simple comparison is sufficient.  
  
This bug dates clear back to Berkeley days, so back-patch to all  
supported versions.  
  
Keiichi Hirobe, minor additional work by me  
  
Discussion: https://postgr.es/m/CAH=EFxE9W0tRvQkixR2XJRRCToUYUEDkJZk6tnADXugPBRdcdg@mail.gmail.com  

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

Document aclitem functions and operators

commit   : c62dd80cdf149e2792b13c13777a539f5abb0370    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 24 Sep 2018 10:14:57 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 24 Sep 2018 10:14:57 -0400    

Click here for diff

aclitem functions and operators have been heretofore undocumented.  
Fix that. While at it, ensure the non-operator aclitem functions have  
pg_description strings.  
  
Does not seem worthwhile to back-patch.  
  
Author: Fabien Coelho, with pg_description from John Naylor, and significant  
refactoring and editorialization by me.  
Reviewed by: Tom Lane  
Discussion: https://postgr.es/m/flat/alpine.DEB.2.21.1808010825490.18204%40lancre  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/acl.c
M src/include/catalog/pg_proc.dat

Initialize random() in bootstrap/stand-alone postgres and in initdb.

commit   : d18f6674bd60e923bcdbf0fd916685b0a250c60f    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 23 Sep 2018 22:56:39 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 23 Sep 2018 22:56:39 -0700    

Click here for diff

This removes a difference between the standard IsUnderPostmaster  
execution environment and that of --boot and --single.  In a stand-alone  
backend, "SELECT random()" always started at the same seed.  
  
On a system capable of using posix shared memory, initdb could still  
conclude "selecting dynamic shared memory implementation ... sysv".  
Crashed --boot or --single postgres processes orphaned shared memory  
objects having names that collided with the not-actually-random names  
that initdb probed.  The sysv fallback appeared after ten crashes of  
--boot or --single postgres.  Since --boot and --single are rare in  
production use, systems used for PostgreSQL development are the  
principal candidate to notice this symptom.  
  
Back-patch to 9.3 (all supported versions).  PostgreSQL 9.4 introduced  
dynamic shared memory, but 9.3 does share the "SELECT random()" problem.  
  
Reviewed by Tom Lane and Kyotaro HORIGUCHI.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/init/miscinit.c
M src/bin/initdb/initdb.c

Doc: warn against using parallel restore with --load-via-partition-root.

commit   : 73a60051379b35a0bec399edfe369c59e50cc775    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Sep 2018 18:34:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Sep 2018 18:34:18 -0400    

Click here for diff

This isn't terribly safe, and making it so doesn't seem like a small  
project, so for the moment just warn against it.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml

Fix failure in WHERE CURRENT OF after rewinding the referenced cursor.

commit   : 89b280e139c463c98eb33592216a123e89052d08    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Sep 2018 16:05:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Sep 2018 16:05:45 -0400    

Click here for diff

In a case where we have multiple relation-scan nodes in a cursor plan,  
such as a scan of an inheritance tree, it's possible to fetch from a  
given scan node, then rewind the cursor and fetch some row from an  
earlier scan node.  In such a case, execCurrent.c mistakenly thought  
that the later scan node was still active, because ExecReScan hadn't  
done anything to make it look not-active.  We'd get some sort of  
failure in the case of a SeqScan node, because the node's scan tuple  
slot would be pointing at a HeapTuple whose t_self gets reset to  
invalid by heapam.c.  But it seems possible that for other relation  
scan node types we'd actually return a valid tuple TID to the caller,  
resulting in updating or deleting a tuple that shouldn't have been  
considered current.  To fix, forcibly clear the ScanTupleSlot in  
ExecScanReScan.  
  
Another issue here, which seems only latent at the moment but could  
easily become a live bug in future, is that rewinding a cursor does  
not necessarily lead to *immediately* applying ExecReScan to every  
scan-level node in the plan tree.  Upper-level nodes will think that  
they can postpone that call if their child node is already marked  
with chgParam flags.  I don't see a way for that to happen today in  
a plan tree that's simple enough for execCurrent.c's search_plan_tree  
to understand, but that's one heck of a fragile assumption.  So, add  
some logic in search_plan_tree to detect chgParam flags being set on  
nodes that it descended to/through, and assume that that means we  
should consider lower scan nodes to be logically reset even if their  
ReScan call hasn't actually happened yet.  
  
Per bug #15395 from Matvey Arye.  This has been broken for a long time,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execCurrent.c
M src/backend/executor/execScan.c
M src/test/regress/expected/portals.out
M src/test/regress/sql/portals.sql

Replace CAS loop with single TAS in ProcArrayGroupClearXid()

commit   : 2f39106a209e647d7b1895331fca115f9bb6ec8d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 22 Sep 2018 16:22:30 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 22 Sep 2018 16:22:30 +0300    

Click here for diff

Single pg_atomic_exchange_u32() is expected to be faster than loop of  
pg_atomic_compare_exchange_u32().  Also, it would be consistent with  
clog group update code.  
  
Discussion: https://postgr.es/m/CAPpHfdtxLsC-bqfxFcHswZ91OxXcZVNDBBVfg9tAWU0jvn1tQA%40mail.gmail.com  
Reviewed-by: Amit Kapila  

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

Make GUC wal_sender_timeout user-settable

commit   : db361db2fce7491303f49243f652c75c084f5a19    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 22 Sep 2018 15:23:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 22 Sep 2018 15:23:59 +0900    

Click here for diff

Being able to use a value that can be changed on a connection basis is  
useful with clusters distributed geographically, and makes failure  
detection more flexible.  A note is added in the documentation about the  
use of "options" in primary_conninfo, which can be hard to grasp for  
newcomers with the need of two single quotes when listing a set of  
parameters.  
  
Author: Tsunakawa Takayuki  
Reviewed-by: Masahiko Sawada, Michael Paquier  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1FAAD3AE@G01JPEXMBYT05  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/utils/misc/guc.c

Get rid of explicit argument-count markings in tab-complete.c.

commit   : 4f3b38fe2bde72d59b7eab593ff72e0cebd9ecc6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 20:50:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 20:50:18 -0400    

Click here for diff

This replaces the "TailMatchesN" macros with just "TailMatches",  
and likewise "HeadMatchesN" becomes "HeadMatches" and "MatchesN"  
becomes "Matches".  The various COMPLETE_WITH_LISTn macros are  
reduced to COMPLETE_WITH, and the single-item COMPLETE_WITH_CONST  
also gets folded into that.  This eliminates a lot of minor  
annoyance in writing tab-completion rules.  Usefully, the compiled  
code also gets a bit smaller (10% or so, on my machine).  
  
The implementation depends on variadic macros, so we couldn't have  
done this before we required C99.  
  
Andres Freund and Thomas Munro; some cosmetic cleanup by me.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc: JIT is enabled by default in PG 12

commit   : 1f7fc7670c7e0051b47bb4a4d6b41ff9e8af53fa    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 21 Sep 2018 20:28:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 21 Sep 2018 20:28:55 -0400    

Click here for diff

JIT was disabled by default in a PG 11 in a separate commit that will  
normally not appear in the PG 12 git logs.  Therefore, create a PG 12  
document and mention the fact that JIT is enabled by default in this  
release.  (A similar change in parallelism was missed in a prior  
release.)  
  
Reported-by: Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: head  

M doc/src/sgml/filelist.sgml
A doc/src/sgml/release-12.sgml
M doc/src/sgml/release.sgml

docs: remove use of escape strings and use bytea hex output

commit   : f77de4b0c0ad8c351223929b6fb3ee5c300a9979    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 21 Sep 2018 19:55:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 21 Sep 2018 19:55:07 -0400    

Click here for diff

standard_conforming_strings defaulted to 'on' in PG 9.1.  
bytea_output defaulted to 'hex' in PG 9.0.  
  
Reported-by: André Hänsel  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/array.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/rowtypes.sgml

Fix bogus tab-completion rule for CREATE PUBLICATION.

commit   : e8fe426baa9c242d8dbd4eab1d963e952c9172f4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 15:58:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 15:58:37 -0400    

Click here for diff

You can't use "FOR TABLE" as a single Matches argument, because readline  
will consider that input to be two words not one.  It's necessary to make  
the pattern contain two arguments.  
  
The case accidentally worked anyway because the words_after_create  
test fired ... but only for the first such table name.  
  
Noted by Edmund Horner, though this isn't exactly his proposed fix.  
Backpatch to v10 where the faulty code came in.  
  
Discussion: https://postgr.es/m/CAMyN-kDe=gBmHgxWwUUaXuwK+p+7g1vChR7foPHRDLE592nJPQ@mail.gmail.com  

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

Improve tab completion for ANALYZE, EXPLAIN, and VACUUM.

commit   : 121213d9d8527f880f153e4a032ee1a4cd43833f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 15:22:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 15:22:26 -0400    

Click here for diff

Previously, we made no attempt to provide tab completion in these  
statements' optional parenthesized options lists.  This patch teaches  
psql to do so.  
  
To prevent the option completions from being offered after we've already  
seen a complete parenthesized option list, it's necessary to improve  
word_matches() so that it allows a wildcard '*' in the middle of an  
alternative, not only at the end as formerly.  That requires only a  
little more code than before, and it allows us to test for "incomplete  
parenthesized options" with a test like  
  
    else if (HeadMatches2("EXPLAIN", "(*") &&  
             !HeadMatches2("EXPLAIN", "(*)"))  
  
In addition, add some logic to offer column names in the context of  
"ANALYZE tablename ( ...", and likewise for VACUUM.  This isn't real  
complete; it won't offer column names again after a comma.  But it's  
better than before, and it doesn't take much code.  
  
Justin Pryzby, reviewed at various times by Álvaro Herrera, Arthur  
Zakirov, and Edmund Horner; some additional fixups by me  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rationalize Query_for_list_of_[relations] query names in tab-complete.c.

commit   : e3b7a6d165d42b59b2432c415d7e4a284a645e89    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 12:41:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Sep 2018 12:41:00 -0400    

Click here for diff

The previous convention was to use names based on the set of relkinds being  
selected for, which was not at all helpful for maintenance, especially  
since people had been quite inconsistent about whether to change the names  
when they changed the relkinds being selected for.  Instead, use names  
based on the functionality we need the relation to have, following the  
model established by Query_for_list_of_updatables.  
  
While at it, sort the list of Query constants a bit better; it had the  
distinct air of code-assembled-by-dartboard before.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Use size_t consistently in dsa.{ch}.

commit   : f025bd2ddd07a46560a5fbe8dd4790f153ead705    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 22 Sep 2018 00:40:13 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 22 Sep 2018 00:40:13 +1200    

Click here for diff

Takeshi Ideriha complained that there is a mixture of Size and size_t  
in dsa.c and corresponding header.  Let's use size_t.  Back-patch to 10  
where dsa.c landed, to make future back-patching easy.  
  
Discussion: https://postgr.es/m/4E72940DA2BF16479384A86D54D0988A6F19ABD9%40G01JPEXMBKW04  

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

Document lock taken on referenced table when adding a foreign key

commit   : ce9cf8e7e6c436e13a729e2369c2c7ca1eae064d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Sep 2018 15:03:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Sep 2018 15:03:37 +0900    

Click here for diff

This can happen for CREATE TABLE and ALTER TABLE, so a mention is added  
to both of them in the concerned subsections.  
  
Author: Adrien Nayrat  
Discussion: https://postgr.es/m/[email protected]  

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

Error out for clang on x86-32 without SSE2 support, no -fexcess-precision.

commit   : bd1463e348fcf3a6e832092ccdeaecda2db9c117    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Sep 2018 14:18:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Sep 2018 14:18:43 -0700    

Click here for diff

As clang currently doesn't support -fexcess-precision=standard,  
compiling x86-32 code with SSE2 disabled, can lead to problems with  
floating point overflow checks and the like.  
  
This issue was noticed because clang, on at least some BSDs, defaults  
to i386 compatibility, whereas it defaults to pentium4 on Linux.  Our  
forced usage of __builtin_isinf() lead to some overflow checks not  
triggering when compiling for i386, e.g. when the result of the  
calculation didn't overflow in 80bit registers, but did so in 64bit.  
  
While we could just fall back to a non-builtin isinf, it seems likely  
that the use of 80bit registers leads to other problems (which is why  
we force the flag for GCC already).  Therefore error out when  
detecting clang in that situation.  
  
Reported-By: Victor Wagner  
Analyzed-By: Andrew Gierth and Andres Freund  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.3-, all supported versions are affected  

M configure
M configure.in

Remove special handling for open() in initdb for Windows

commit   : 925673f27b1df2d9582f66b33519771137b1df7f    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Sep 2018 06:41:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Sep 2018 06:41:44 +0900    

Click here for diff

40cfe86 enforces the translation mode to text for all frontends, so this  
special handling in initdb is not needed anymore.  

M src/bin/initdb/initdb.c

Fix psql's tab completion for TABLE.

commit   : c9a8a401f169ec793b1a89b71b0340dd2cfe8bd7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 17:21:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 17:21:14 -0400    

Click here for diff

This should offer the same relation types that SELECT ... FROM would.  
You can't select from an index for instance, so offering it here is  
unhelpful.  Noted while testing ilmari's recent patch.  

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

Fix psql's tab completion for ALTER DATABASE ... SET TABLESPACE.

commit   : a7c4dad1a770c1c4256aa87e01a85172e1549aad    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 17:16:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 17:16:06 -0400    

Click here for diff

We have the infrastructure to offer a list of tablespace names, but  
it wasn't being used here; instead you got "FROM", "CURRENT", and "TO"  
which aren't actually legal in this syntax.  
  
Dagfinn Ilmari Mannsåker, reviewed by Arthur Zakirov  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add a "return" statement to pacify perlcritic.

commit   : 1dba1b61c2fbe0164453963d51e7b0f6c49d8fca    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 16:10:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 16:10:23 -0400    

Click here for diff

Per buildfarm member crake.  

M src/backend/catalog/Catalog.pm

Add missing pg_description strings for pg_type entries.

commit   : b09a64d602a19c9a3cc69e4bb0f8986a6f5facf4    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 16:06:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 16:06:18 -0400    

Click here for diff

I noticed that all non-composite, non-array entries in pg_type.dat  
had descr strings, except for "json" and the pseudo-types.  The  
lack for json seems certainly an oversight, and there's surely  
little reason to not have entries for the pseudo-types either.  
So add some.  
  
"make reformat-dat-files" turned up some formatting issues in  
pg_amop.dat, too, so fix those in passing.  
  
No catversion bump since the backend doesn't care too much what is  
in pg_description.  

M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_type.dat
M src/tools/pgindent/README

Teach genbki.pl to auto-generate pg_type entries for array types.

commit   : 3dc820c43e427371b66d217f2bd5481fc9ef2e2d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 15:14:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Sep 2018 15:14:46 -0400    

Click here for diff

This eliminates some more tedium in adding new catalog entries,  
specifically the need to set up an array type when adding a new  
built-in data type.  Now it's sufficient to assign an OID for the  
array type and write it in an "array_type_oid" metadata field.  
You don't have to fill the base type's typarray link explicitly, either.  
  
No catversion bump since the contents of pg_type aren't changed.  
(Well, their order might be different, but that doesn't matter.)  
  
John Naylor, reviewed and whacked around a bit by  
Dagfinn Ilmari Mannsåker, and some more by me.  
  
Discussion: https://postgr.es/m/CAJVSVGVTb6m9pJF49b3SuA8J+T-THO9c0hxOmoyv-yGKh-FbNg@mail.gmail.com  

M doc/src/sgml/bki.sgml
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/include/catalog/genbki.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/reformat_dat_file.pl

Fix handling of format string text characters in to_timestamp()/to_date()

commit   : 09e99ce86e3dfb4716618b1dda4074b45ba56a09    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 20 Sep 2018 15:48:04 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 20 Sep 2018 15:48:04 +0300    

Click here for diff

cf984672 introduced improvement of handling of spaces and separators in  
to_timestamp()/to_date() functions.  In particular, now we're skipping spaces  
both before and after fields.  That may cause format string text character to  
consume part of field in the situations, when it didn't happen before cf984672.  
This commit cause format string text character consume input string characters  
only when since previous field (or string beginning) number of skipped input  
string characters is not greater than number of corresponding format string  
characters (that is we didn't skip any extra characters in input string).  

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

Fix segment_bins corruption in dsa.c.

commit   : 38763d67784c6563d08dbea5c9f913fa174779b8    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 20 Sep 2018 15:52:39 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 20 Sep 2018 15:52:39 +1200    

Click here for diff

If a segment has been freed by dsa.c because it is entirely empty, other  
backends must make sure to unmap it before following links to new  
segments that might happen to have the same index number, or they could  
finish up looking at a defunct segment and then corrupt the segment_bins  
lists.  The correct protocol requires checking freed_segment_counter  
after acquiring the area lock and before resolving any index number to a  
segment.  Add the missing checks and an assertion.  
  
Back-patch to 10, where dsa.c first arrived.  
  
Author: Thomas Munro  
Reported-by: Tomas Vondra  
Discussion: https://postgr.es/m/CAEepm%3D0thg%2Bja5zGVa7jBy-uqyHrTqTm8HGhEOtMmigGrAqTbw%40mail.gmail.com  

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

Defer restoration of libraries in parallel workers.

commit   : 6c3c9d418918373a9535ad3d3bd357f652a367e3    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 20 Sep 2018 14:02:40 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 20 Sep 2018 14:02:40 +1200    

Click here for diff

Several users of extensions complained of crashes in parallel workers  
that turned out to be due to syscache access from their _PG_init()  
functions.  Reorder the initialization of parallel workers so that  
libraries are restored after the caches are initialized, and inside a  
transaction.  
  
This was reported in bug #15350 and elsewhere.  We don't consider it  
to be a bug: extensions shouldn't do that, because then they can't be  
used in shared_preload_libraries.  However, it's a fairly obscure  
hazard and these extensions worked in practice before parallel query  
came along.  So let's make it work.  Later commits might add a warning  
message and eventually an error.  
  
Back-patch to 9.6, where parallel query landed.  
  
Author: Thomas Munro  
Reviewed-by: Amit Kapila  
Reported-by: Kieran McCusker, Jimmy  
Discussion: https://postgr.es/m/153512195228.1489.8545997741965926448%40wrigleys.postgresql.org  

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

Enforce translation mode for Windows frontends to text with open/fopen

commit   : 40cfe86068f4c385517a8423cb8b3001e2f6a2fd    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 20 Sep 2018 08:54:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 20 Sep 2018 08:54:37 +0900    

Click here for diff

Allowing frontends to use concurrent-safe open() and fopen() via 0ba06e0  
has the side-effect of switching the default translation mode from text  
to binary, so the switch can cause breakages for frontend tools when the  
caller of those new versions specifies neither binary and text.  This  
commit makes sure to maintain strict compatibility with past versions,  
so as no frontends should see a difference when upgrading.  
  
Author: Laurenz Albe  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/port/open.c

Fix minor error message style guide violation.

commit   : 0d38e4ebb7a136a4376536c7989bf8f61f052688    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Sep 2018 17:06:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Sep 2018 17:06:40 -0400    

Click here for diff

No periods at the ends of primary error messages, please.  
  
Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

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

Don't ignore locktable-full failures in StandbyAcquireAccessExclusiveLock.

commit   : 8f0de712c389df37d4db1fd439ede40189d75f60    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Sep 2018 12:43:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Sep 2018 12:43:51 -0400    

Click here for diff

Commit 37c54863c removed the code in StandbyAcquireAccessExclusiveLock  
that checked the return value of LockAcquireExtended.  That created a  
bug, because it's still passing reportMemoryError = false to  
LockAcquireExtended, meaning that LOCKACQUIRE_NOT_AVAIL will be returned  
if we're out of shared memory for the lock table.  
  
In such a situation, the startup process would believe it had acquired an  
exclusive lock even though it hadn't, with potentially dire consequences.  
  
To fix, just drop the use of reportMemoryError = false, which allows us  
to simplify the call into a plain LockAcquire().  It's unclear that the  
locktable-full situation arises often enough that it's worth having a  
better recovery method than crash-and-restart.  (I strongly suspect that  
the only reason the code path existed at all was that it was relatively  
simple to do in the pre-37c54863c implementation.  But now it's not.)  
  
LockAcquireExtended's reportMemoryError parameter is now dead code and  
could be removed.  I refrained from doing so, however, because there  
was some interest in resurrecting the behavior if we do get reports of  
locktable-full failures in the field.  Also, it seems unwise to remove  
the parameter concurrently with shipping commit f868a8143, which added a  
parameter; if there are any third-party callers of LockAcquireExtended,  
we want them to get a wrong-number-of-parameters compile error rather  
than a possibly-silent misinterpretation of its last parameter.  
  
Back-patch to 9.6 where the bug was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add support for nearest-neighbor (KNN) searches to SP-GiST

commit   : 2a6368343ff43743ddd90d0f4c2d0ac03e18aa85    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 19 Sep 2018 01:54:10 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 19 Sep 2018 01:54:10 +0300    

Click here for diff

Currently, KNN searches were supported only by GiST.  SP-GiST also capable to  
support them.  This commit implements that support.  SP-GiST scan stack is  
replaced with queue, which serves as stack if no ordering is specified.  KNN  
support is provided for three SP-GIST opclasses: quad_point_ops, kd_point_ops  
and poly_ops (catversion is bumped).  Some common parts between GiST and SP-GiST  
KNNs are extracted into separate functions.  
  
Discussion: https://postgr.es/m/570825e8-47d0-4732-2bf6-88d67d2d51c8%40postgrespro.ru  
Author: Nikita Glukhov, Alexander Korotkov based on GSoC work by Vlad Sterzhanov  
Review: Andrey Borodin, Alexander Korotkov  

M doc/src/sgml/indices.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/index/indexam.c
M src/backend/access/spgist/Makefile
M src/backend/access/spgist/README
M src/backend/access/spgist/spgkdtreeproc.c
A src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/cache/lsyscache.c
M src/include/access/genam.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amop.dat
M src/include/utils/lsyscache.h
M src/test/regress/expected/amutils.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/polygon.out
M src/test/regress/sql/amutils.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/polygon.sql

Add a debugging option to stress-test outfuncs.c and readfuncs.c.

commit   : d0cfc3d6a44af1756ca5be8cb2414da7b8bf20d5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 17:11:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 17:11:54 -0400    

Click here for diff

In the normal course of operation, query trees will be serialized only if  
they are stored as views or rules; and plan trees will be serialized only  
if they get passed to parallel-query workers.  This leaves an awful lot of  
opportunity for bugs/oversights to not get detected, as indeed we've just  
been reminded of the hard way.  
  
To improve matters, this patch adds a new compile option  
WRITE_READ_PARSE_PLAN_TREES, which is modeled on the longstanding option  
COPY_PARSE_PLAN_TREES; but instead of passing all parse and plan trees  
through copyObject, it passes them through nodeToString + stringToNode.  
Enabling this option in a buildfarm animal or two will catch problems  
at least for cases that are exercised by the regression tests.  
  
A small problem with this idea is that readfuncs.c historically has  
discarded location fields, on the reasonable grounds that parse  
locations in a retrieved view are not relevant to the current query.  
But doing that in WRITE_READ_PARSE_PLAN_TREES breaks pg_stat_statements,  
and it could cause problems for future improvements that might try to  
report error locations at runtime.  To fix that, provide a variant  
behavior in readfuncs.c that makes it restore location fields when  
told to.  
  
In passing, const-ify the string arguments of stringToNode and its  
subsidiary functions, just because it annoyed me that they weren't  
const already.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/parse_relation.c
M src/backend/tcop/postgres.c
M src/include/nodes/nodes.h
M src/include/nodes/readfuncs.h
M src/include/pg_config_manual.h

Fix some minor issues exposed by outfuncs/readfuncs testing.

commit   : db1071d4ee9f0e348ab646e7c13184d480d40516    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 15:08:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 15:08:28 -0400    

Click here for diff

A test patch to pass parse and plan trees through outfuncs + readfuncs  
exposed several issues that need to be fixed to get clean matches:  
  
Query.withCheckOptions failed to get copied; it's intentionally ignored  
by outfuncs/readfuncs on the grounds that it'd always be NIL anyway in  
stored rules.  This seems less than future-proof, and it's not even  
saving very much, so just undo the decision and treat the field like  
all others.  
  
Several places that convert a view RTE into a subquery RTE, or similar  
manipulations, failed to clear out fields that were specific to the  
original RTE type and should be zero in a subquery RTE.  Since readfuncs.c  
will leave such fields as zero, equalfuncs.c thinks the nodes are different  
leading to a reported mismatch.  It seems like a good idea to clear out the  
no-longer-needed fields, even though in principle nothing should look at  
them; the node ought to be indistinguishable from how it would look if  
we'd built a new node instead of scribbling on the old one.  
  
BuildOnConflictExcludedTargetlist randomly set the resname of some  
TargetEntries to "" not NULL.  outfuncs/readfuncs don't distinguish those  
cases, and so the string will read back in as NULL ... but equalfuncs.c  
does distinguish.  Perhaps we ought to try to make things more consistent  
in this area --- but it's just useless extra code space for  
BuildOnConflictExcludedTargetlist to not use NULL here, so I fixed it for  
now by making it do that.  
  
catversion bumped because the change in handling of Query.withCheckOptions  
affects stored rules.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/parser/analyze.c
M src/backend/rewrite/rewriteHandler.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h

Fix some probably-minor oversights in readfuncs.c.

commit   : 09991e5a475bc7ed17168cbc8dd5673de4366463    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 13:02:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Sep 2018 13:02:27 -0400    

Click here for diff

The system expects TABLEFUNC RTEs to have coltypes, coltypmods, and  
colcollations lists, but outfuncs doesn't dump them and readfuncs doesn't  
restore them.  This doesn't cause obvious failures, because the only things  
that look at those fields are expandRTE() and get_rte_attribute_type(),  
which are mostly used during parse analysis, before anything would've  
passed the parsetree through outfuncs/readfuncs.  But expandRTE() is used  
in build_physical_tlist(), which means that that function will return a  
wrong answer for a TABLEFUNC RTE that came from a view.  Very accidentally,  
this doesn't cause serious problems, because what it will return is NIL  
which callers will interpret as "couldn't build a physical tlist because  
of dropped columns".  So you still get a plan that works, though it's  
marginally less efficient than it could be.  There are also some other  
expandRTE() calls associated with transformation of whole-row Vars in  
the planner.  I have been unable to exhibit misbehavior from that, and  
it may be unreachable in any case that anyone would care about ... but  
I'm not entirely convinced, so this seems like something we should back-  
patch a fix for.  Fortunately, we can fix it without forcing a change  
of stored rules and a catversion bump, because we can just copy these  
lists from the subsidiary TableFunc object.  
  
readfuncs.c was also missing support for NamedTuplestoreScan plan nodes.  
This accidentally fails to break parallel query because a query using  
a named tuplestore would never be considered parallel-safe anyway.  
However, project policy since parallel query came in is that all plan  
node types should have outfuncs/readfuncs support, so this is clearly  
an oversight that should be repaired.  
  
Noted while fooling around with a patch to test outfuncs/readfuncs more  
thoroughly.  That exposed some other issues too, but these are the only  
ones that seem worth back-patching.  
  
Back-patch to v10 where both of these features came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/readfuncs.c
M src/include/nodes/parsenodes.h

Allow DSM allocation to be interrupted.

commit   : 422952ee78220c49812b7697c7855c6230840e35    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 18 Sep 2018 22:56:36 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 18 Sep 2018 22:56:36 +1200    

Click here for diff

Chris Travers reported that the startup process can repeatedly try to  
cancel a backend that is in a posix_fallocate()/EINTR loop and cause it  
to loop forever.  Teach the retry loop to give up if an interrupt is  
pending.  Don't actually check for interrupts in that loop though,  
because a non-local exit would skip some clean-up code in the caller.  
  
Back-patch to 9.4 where DSM was added (and posix_fallocate() was later  
back-patched).  
  
Author: Chris Travers  
Reviewed-by: Ildar Musin, Murat Kabilov, Oleksii Kliukin  
Tested-by: Oleksii Kliukin  
Discussion: https://postgr.es/m/CAN-RpxB-oeZve_J3SM_6%3DHXPmvEG%3DHX%2B9V9pi8g2YR7YW0rBBg%40mail.gmail.com  

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

Refactor routines for subscription and publication lookups

commit   : 1d6fbc38d9ed03dc7fd297119d7949b6531aed5a    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Sep 2018 12:00:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Sep 2018 12:00:18 +0900    

Click here for diff

Those routines gain a missing_ok argument, allowing a caller to get a  
NULL result instead of an error if set to true.  This is part of a  
larger refactoring effort for objectaddress.c where trying to check for  
non-existing objects does not result in cache lookup failures.  
  
Author: Michael Paquier  
Reviewed-by: Aleksander Alekseev, Álvaro Herrera  
Discussion: https://postgr.es/m/CAB7nPqSZxrSmdHK-rny7z8mi=EAFXJ5J-0RbzDw6aus=wB5azQ@mail.gmail.com  

M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_subscription.c
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_subscription.h

Fix parsetree representation of XMLTABLE(XMLNAMESPACES(DEFAULT ...)).

commit   : 07a3af0ff81d8ac6d2e787e13ca10de36313aa51    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 13:16:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 13:16:32 -0400    

Click here for diff

The original coding for XMLTABLE thought it could represent a default  
namespace by a T_String Value node with a null string pointer.  That's  
not okay, though; in particular outfuncs.c/readfuncs.c are not on board  
with such a representation, meaning you'll get a null pointer crash  
if you try to store a view or rule containing this construct.  
  
To fix, change the parsetree representation so that we have a NULL  
list element, instead of a bogus Value node.  
  
This isn't really a functional limitation since default XML namespaces  
aren't yet implemented in the executor; you'd just get "DEFAULT  
namespace is not supported" anyway.  But crashes are not nice, so  
back-patch to v10 where this syntax was added.  Ordinarily we'd consider  
a parsetree representation change to be un-backpatchable; but since  
existing releases would crash on the way to storing such constructs,  
there can't be any existing views/rules to be incompatible with.  
  
Per report from Andrey Lepikhov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeTableFuncscan.c
M src/backend/parser/parse_clause.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/execnodes.h
M src/include/nodes/primnodes.h

Remove dead code from pop_next_work_item().

commit   : 789ba5029a8aea8256d20780410cfa2872637f15    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 12:43:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 12:43:07 -0400    

Click here for diff

The pref_non_data heuristic has been dead code for nearly ten years,  
and as far as I can tell was dead code even when it was first committed.  
I'm tired of silencing Coverity complaints about it, so get rid of it.  
If anyone is ever interested in pursuing the concept, they can get the  
code out of our git history.  

M src/bin/pg_dump/pg_backup_archiver.c

Fix pgbench lexer's "continuation" rule to cope with Windows newlines.

commit   : db37ab2c60b877b977f531bcd680848ee4511537    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 12:11:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Sep 2018 12:11:43 -0400    

Click here for diff

Our general practice in frontend code is to accept input with either  
Unix-style newlines (\n) or DOS-style (\r\n).  pgbench was mostly down  
with that, but its rule for line continuations (backslash-newline) was  
not.  This had been masked on Windows buildfarm machines before commit  
0ba06e0bf by use of Windows text mode to read files.  We could have fixed  
it by forcing text mode again, but it's better to fix the parsing code  
so that Windows-style text files on Unix systems don't cause problems.  
  
Back-patch to v10 where pgbench grew line continuations.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/exprscan.l

Add list of acknowledgments to release notes

commit   : f9907c6ac2e9817baffe37c9087bedc8df3e9625    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 16 Sep 2018 22:06:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 16 Sep 2018 22:06:42 +0200    

Click here for diff

This contains all individuals mentioned in the commit messages during  
PostgreSQL 11 development.  
  
current through 7a2f70f0e5e83871d091ee479abea4b8f850dd29  

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

Fix out-of-tree build for transform modules.

commit   : 60f6756f92251d7325d58a048f7e9a81881f8d41    
  
author   : Andrew Gierth <[email protected]>    
date     : Sun, 16 Sep 2018 18:46:45 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Sun, 16 Sep 2018 18:46:45 +0100    

Click here for diff

Neither plperl nor plpython installed sufficient header files to  
permit transform modules to be built out-of-tree using PGXS. Fix that  
by installing all plperl and plpython header files (other than those  
with special purposes such as generated data tables), and also install  
plpython's special .mk file for mangling regression tests.  
  
(This commit does not fix the windows install, which does not  
currently install _any_ plperl or plpython headers.)  
  
Also fix the existing transform modules for hstore and ltree so that  
their cross-module #include directives work as anticipated by commit  
df163230b9 et seq. This allows them to serve as working examples of  
how to reference other modules when doing separate out-of-tree builds.  
  
Discussion: https://postgr.es/m/87o9ej8bgl.fsf%40news-spur.riddles.org.uk  

M contrib/hstore_plperl/Makefile
M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/Makefile
M contrib/hstore_plpython/hstore_plpython.c
M contrib/ltree_plpython/Makefile
M contrib/ltree_plpython/ltree_plpython.c
M src/pl/plperl/GNUmakefile
M src/pl/plpython/Makefile
M src/tools/msvc/Mkvcbuild.pm

Add outfuncs.c support for RawStmt nodes.

commit   : 3844adbf3c2521c0956064c1c27096c96ca92201    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Sep 2018 13:02:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Sep 2018 13:02:47 -0400    

Click here for diff

I noticed while poking at a report from Andrey Lepikhov that the  
recent addition of RawStmt nodes at the top of raw parse trees  
makes it impossible to print any raw parse trees whatsoever,  
because outfuncs.c doesn't know RawStmt and hence fails to descend  
into it.  
  
While we generally lack outfuncs.c support for utility statements,  
there is reasonably complete support for what you can find in a  
raw SELECT statement.  It was not my intention to make that all  
dead code ... so let's add support for RawStmt.  
  
Back-patch to v10 where RawStmt appeared.  

M src/backend/nodes/outfuncs.c

doc: clarify pg_basebackup's -C/--create-slot description

commit   : da1db404358ebc2d4f1abcee712405cd888148de    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 16 Sep 2018 11:35:34 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 16 Sep 2018 11:35:34 -0400    

Click here for diff

The previous text was overly complex.  
  
Backpatch-through: 11  

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

In v11, disable JIT by default (it's still enabled by default in HEAD).

commit   : 8f32bacc006692e63f137924d5849b3cb9f2d4d3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Sep 2018 17:24:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Sep 2018 17:24:35 -0400    

Click here for diff

Per discussion, JIT isn't quite mature enough to ship enabled-by-default.  
  
I failed to resist the temptation to do a bunch of copy-editing on the  
related documentation.  Also, clean up some inconsistencies in which  
section of config.sgml the JIT GUCs are documented in vs. what guc.c  
and postgresql.config.sample had.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/jit.sgml
M doc/src/sgml/release-11.sgml
M src/backend/jit/jit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample

Fix failure with initplans used conditionally during EvalPlanQual rechecks.

commit   : 1f4a920b7309499d2d0c4ceda5e6356e10bc51da    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Sep 2018 13:42:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Sep 2018 13:42:33 -0400    

Click here for diff

The EvalPlanQual machinery assumes that any initplans (that is,  
uncorrelated sub-selects) used during an EPQ recheck would have already  
been evaluated during the main query; this is implicit in the fact that  
execPlan pointers are not copied into the EPQ estate's es_param_exec_vals.  
But it's possible for that assumption to fail, if the initplan is only  
reached conditionally.  For example, a sub-select inside a CASE expression  
could be reached during a recheck when it had not been previously, if the  
CASE test depends on a column that was just updated.  
  
This bug is old, appearing to date back to my rewrite of EvalPlanQual in  
commit 9f2ee8f28, but was not detected until Kyle Samson reported a case.  
  
To fix, force all not-yet-evaluated initplans used within the EPQ plan  
subtree to be evaluated at the start of the recheck, before entering the  
EPQ environment.  This could be inefficient, if such an initplan is  
expensive and goes unused again during the recheck --- but that's piling  
one layer of improbability atop another.  It doesn't seem worth adding  
more complexity to prevent that, at least not in the back branches.  
  
It was convenient to use the new-in-v11 ExecEvalParamExecParams function  
to implement this, but I didn't like either its name or the specifics of  
its API, so revise that.  
  
Back-patch all the way.  Rather than rewrite the patch to avoid depending  
on bms_next_member() in the oldest branches, I chose to back-patch that  
function into 9.4 and 9.3.  (This isn't the first time back-patches have  
needed that, and it exhausted my patience.)  I also chose to back-patch  
some test cases added by commits 71404af2a and 342a1ffa2 into 9.4 and 9.3,  
so that the 9.x versions of eval-plan-qual.spec are all the same.  
  
Andrew Gierth diagnosed the problem and contributed the added test cases,  
though the actual code changes are by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeSubplan.c
M src/include/executor/execExpr.h
M src/include/executor/nodeSubplan.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Move PartitionDispatchData struct definition to execPartition.c

commit   : 6b78231d918bba1b99d15e0bf19753bd8f826222    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Sep 2018 19:06:57 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Sep 2018 19:06:57 -0300    

Click here for diff

There's no reason to expose the struct definition, so don't.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Improve parallel scheduling logic in pg_dump/pg_restore.

commit   : 548e50976ce721b5e927d42a105c2f05b51b52a6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Sep 2018 17:31:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Sep 2018 17:31:51 -0400    

Click here for diff

Previously, the way this worked was that a parallel pg_dump would  
re-order the TABLE_DATA items in the dump's TOC into decreasing size  
order, and separately re-order (some of) the INDEX items into decreasing  
size order.  Then pg_dump would dump the items in that order.  Later,  
parallel pg_restore just followed the TOC order.  This method had lots  
of deficiencies:  
  
* TOC ordering randomly differed between parallel and non-parallel  
dumps, and was hard to predict in the former case, causing problems  
for building stable pg_dump test cases.  
  
* Parallel restore only followed a well-chosen order if the dump had  
been done in parallel; in particular, this never happened for restore  
from custom-format dumps.  
  
* The best order for restore isn't necessarily the same as for dump,  
and it's not really static either because of locking considerations.  
  
* TABLE_DATA and INDEX items aren't the only things that might take a lot  
of work during restore.  Scheduling was particularly stupid for the BLOBS  
item, which might require lots of work during dump as well as restore,  
but was left to the end in either case.  
  
This patch removes the logic that changed the TOC order, fixing the  
test instability problem.  Instead, we sort the parallelizable items  
just before processing them during a parallel dump.  Independently  
of that, parallel restore prioritizes the ready-to-execute tasks  
based on the size of the underlying table.  In the case of dependent  
tasks such as index, constraint, or foreign key creation, the largest  
relevant table is used as the metric for estimating the task length.  
(This is pretty crude, but it should be enough to avoid the case we  
want to avoid, which is ending the run with just a few large tasks  
such that we can't make use of all N workers.)  
  
Patch by me, responding to a complaint from Peter Eisentraut,  
who also reviewed the patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c

Fix ALTER/TYPE on columns referenced by FKs in partitioned tables

commit   : 20bef2c3110af295501919bac463b87ac58876de    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 14 Sep 2018 13:41:20 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 14 Sep 2018 13:41:20 -0300    

Click here for diff

When ALTER TABLE ... SET DATA TYPE affects a column referenced by  
constraints and indexes, it drop those constraints and indexes and  
recreates them afterwards, so that the definitions match the new data  
type.  The original code did this by dropping one object at a time  
(commit 077db40fa1f3 of May 2004), which worked fine because the  
dependencies between the objects were pretty straightforward, and  
ordering the objects in a specific way was enough to make this work.  
However, when there are foreign key constraints in partitioned tables,  
the dependencies are no longer so straightforward, and we were getting  
errors when attempted:  
  ERROR:  cache lookup failed for constraint 16398  
  
This can be fixed by doing all the drops in one pass instead, using  
performMultipleDeletions (introduced by df18c51f2955 of Aug 2006).  With  
this change we can also remove the code to carefully order the list of  
objects to be deleted.  
  
Reported-by: Rajkumar Raghuwanshi <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAKcux6nWS_m+s=1Udk_U9B+QY7pA-Ac58qR5BdUfOyrwnWHDew@mail.gmail.com  

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

Order active window clauses for greater reuse of Sort nodes.

commit   : 728202b63cdcd7fb73fdba114903ed235eb02f3a    
  
author   : Andrew Gierth <[email protected]>    
date     : Fri, 14 Sep 2018 17:35:42 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Fri, 14 Sep 2018 17:35:42 +0100    

Click here for diff

By sorting the active window list lexicographically by the sort clause  
list but putting longer clauses before shorter prefixes, we generate  
more chances to elide Sort nodes when building the path.  
  
Author: Daniel Gustafsson (with some editorialization by me)  
Reviewed-by: Alexander Kuzmenkov, Masahiko Sawada, Tom Lane  
Discussion: https://postgr.es/m/124A7F69-84CD-435B-BA0E-2695BE21E5C2%40yesql.se  

M src/backend/nodes/list.c
M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Don't allow LIMIT/OFFSET clause within sub-selects to be pushed to workers.

commit   : 75f9c4ca5a8047d7a9cfbc7d51a610933d04dc7f    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 14 Sep 2018 09:36:30 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 14 Sep 2018 09:36:30 +0530    

Click here for diff

Allowing sub-select containing LIMIT/OFFSET in workers can lead to  
inconsistent results at the top-level as there is no guarantee that the  
row order will be fully deterministic.  The fix is to prohibit pushing  
LIMIT/OFFSET within sub-selects to workers.  
  
Reported-by: Andrew Fletcher  
Bug: 15324  
Author: Amit Kapila  
Reviewed-by: Dilip Kumar  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planner.c
M src/include/optimizer/planner.h
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Allow concurrent-safe open() and fopen() in frontend code for Windows

commit   : 0ba06e0bfb8cfd24ff17aca92aa72245ddd6c4d7    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Sep 2018 10:04:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Sep 2018 10:04:14 +0900    

Click here for diff

PostgreSQL uses a custom wrapper for open() and fopen() which is  
concurrent-safe, allowing multiple processes to open and work on the  
same file.  This has a couple of advantages:  
- pg_test_fsync does not handle O_DSYNC correctly otherwise, leading to  
false claims that disks are unsafe.  
- TAP tests can run into race conditions when a postmaster and pg_ctl  
open postmaster.pid, fixing some random failures in the buildfam.  
  
pg_upgrade is one frontend tool using workarounds to bypass file locking  
issues with the log files it generates, however the interactions with  
pg_ctl are proving to be tedious to get rid of, so this is left for  
later.  
  
Author: Laurenz Albe  
Reviewed-by: Michael Paquier, Kuntal Ghosh  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/common/file_utils.c
M src/include/port.h

Improve autovacuum logging for aggressive and anti-wraparound runs

commit   : 28a8fa984c63fd525ab03c469f293e957619654b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Sep 2018 07:35:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Sep 2018 07:35:39 +0900    

Click here for diff

A log message was being generated when log_min_duration is reached for  
autovacuum on a given relation to indicate if it was an aggressive run,  
and missed the point of mentioning if it is doing an anti-wrapround  
run.  The log message generated is improved so as one, both or no extra  
details are added depending on the option set.  
  
Author: Sergei Kornilov  
Reviewed-by: Masahiko Sawada, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuumlazy.c

Message style improvements

commit   : f48fa2bc8b6252ae8fccc69729a3bddb6863b8f1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Sep 2018 23:35:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Sep 2018 23:35:43 +0200    

Click here for diff

Fix one untranslatable string concatenation in pg_rewind.  
  
Fix one message in pg_verify_checksums to use a style use elsewhere  
and avoid plural issues.  
  
Fix one gratuitous abbreviation in psql.  

M src/bin/pg_rewind/filemap.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/psql/help.c

Detect LLVM 7 without specifying binaries explicitly.

commit   : 240d40db88ec0e6f98ac547759bac8e331f3ba89    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Sep 2018 10:41:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Sep 2018 10:41:39 -0700    

Click here for diff

Before this commit LLVM 7 was supported, but only if one explicitly  
provided LLVM_CONFIG= and CLANG= paths.  As LLVM 7 is the first  
version that includes our upstreamed debugging and profiling features,  
and as debian is planning to default to 7 due to wider architecture  
support, it seems good to support auto-detecting that version.  
  
Author: Christoph Berg  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11, where LLVM was introduced  

M config/llvm.m4
M configure

Attempt to identify system timezone by reading /etc/localtime symlink.

commit   : 23bd3cec6eb1ffb80ed2601c13f89d89e658fcc1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Sep 2018 12:36:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Sep 2018 12:36:21 -0400    

Click here for diff

On many modern platforms, /etc/localtime is a symlink to a file within the  
IANA database.  Reading the symlink lets us find out the name of the system  
timezone directly, without going through the brute-force search embodied in  
scan_available_timezones().  This shortens the runtime of initdb by some  
tens of ms, which is helpful for the buildfarm, and it also allows us to  
reliably select the same zone name the system was actually configured for,  
rather than possibly choosing one of IANA's many zone aliases.  (For  
example, in a system configured for "Asia/Tokyo", the brute-force search  
would not choose that name but its alias "Japan", on the grounds of the  
latter string being shorter.  More surprisingly, "Navajo" is preferred  
to either "America/Denver" or "US/Mountain", as seen in an old complaint  
from Josh Berkus.)  
  
If /etc/localtime doesn't exist, or isn't a symlink, or we can't make  
sense of its contents, or the contents match a zone we know but that  
zone doesn't match the observed behavior of localtime(), fall back to  
the brute-force search.  
  
Also, tweak initdb so that it prints the zone name it selected.  
  
In passing, replace the last few references to the "Olson" database in  
code comments with "IANA", as that's been our preferred term since  
commit b2cbced9e.  
  
Patch by me, per a suggestion from Robert Haas; review by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c

Attach FPI to the first record after full_page_writes is turned on.

commit   : bc153c941d2ec4e605b1e79be9478abc3d166a18    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 13 Sep 2018 15:30:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 13 Sep 2018 15:30:26 +0530    

Click here for diff

XLogInsert fails to attach a required FPI to the first record after  
full_page_writes is turned on by the last checkpoint.  This bug got  
introduced in 9.5 due to code rearrangement in commits 2c03216d83 and  
2076db2aea.  Fix it by ensuring that XLogInsertRecord performs a  
recomputation when the given record is generated with FPW as off but  
found that the flag has been turned on while actually inserting the  
record.  
  
Reported-by: Kyotaro Horiguchi  
Author: Kyotaro Horiguchi  
Reviewed-by: Amit Kapila  
Backpatch-through: 9.5 where this problem was introduced  
Discussion: https://postgr.es/m/[email protected]  

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

Simplify static function in extension.c

commit   : 514a731ddcd8449d8a7bfb96f138c72c694a7ef8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 13 Sep 2018 16:56:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 13 Sep 2018 16:56:57 +0900    

Click here for diff

An extra argument for the filename defining the extension script  
location was present, aimed at being used for error reporting, but has  
never been used.  This was around since extensions have been added in  
d9572c4.  
  
Author: Yugo Nagata  
Reviewed-by: Tatsuo Ishii  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/extension.c

Simplify index tuple descriptor initialization

commit   : e5f1bb92cfa724ba50f5b42a9cd3f8ab544b960a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Aug 2018 15:50:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Aug 2018 15:50:50 +0200    

Click here for diff

We have two code paths for initializing the tuple descriptor for a new  
index: For a normal index, we copy the tuple descriptor from the table  
and reset a number of fields that are not applicable to indexes.  For an  
expression index, we make a blank tuple descriptor and fill in the  
needed fields based on the provided expressions.  As pg_attribute has  
grown over time, the number of fields that we need to reset in the first  
case is now bigger than the number of fields we actually want to copy,  
so it's sensible to do it the other way around: Make a blank descriptor  
and copy just the fields we need.  This also allows more code sharing  
between the two branches, and it avoids having to touch this code for  
almost every unrelated change to the pg_attribute structure.  
  
Reviewed-by: Arthur Zakirov <[email protected]>  

M src/backend/catalog/index.c

Minor fixes for psql tab completion.

commit   : 7046d30246057b65dd7ad735fd89058684e782cd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Sep 2018 15:24:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Sep 2018 15:24:56 -0400    

Click here for diff

* Include partitioned tables in what's offered after ANALYZE.  
  
* Include toast_tuple_target in what's offered after ALTER TABLE ... SET|RESET.  
  
* Include HASH in what's offered after PARTITION BY.  
  
This is extracted from a larger patch; these bits seem like  
uncontroversial bug fixes for v11 features, so back-patch them into v11.  
  
Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

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

Repair bug in regexp split performance improvements.

commit   : b7f6bcbffcc0b41d783c0c9c61766428159969ff    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 12 Sep 2018 19:31:06 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 12 Sep 2018 19:31:06 +0100    

Click here for diff

Commit c8ea87e4b introduced a temporary conversion buffer for  
substrings extracted during regexp splits. Unfortunately the code that  
sized it was failing to ignore the effects of ignored degenerate  
regexp matches, so for regexp_split_* calls it could under-size the  
buffer in such cases.  
  
Fix, and add some regression test cases (though those will only catch  
the bug if run in a multibyte encoding).  
  
Backpatch to 9.3 as the faulty code was.  
  
Thanks to the PostGIS project, Regina Obe and Paul Ramsey for the  
report (via IRC) and assistance in analysis. Patch by me.  

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

ecpg: Change --version output to common style

commit   : ba37349cff781120f61b2778257f594f0d10253c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Sep 2018 14:33:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Sep 2018 14:33:15 +0200    

Click here for diff

When we removed the ecpg-specific versions, we also removed the  
"(PostgreSQL)" from the --version output, which we show in other  
programs.  
  
Reported-by: Ioseph Kim <[email protected]>  

M src/interfaces/ecpg/preproc/ecpg.c

Add PQresultMemorySize function to report allocated size of a PGresult.

commit   : 2970afa6cf1057107c998bf3cdd1fbf6dc78cf6c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Sep 2018 18:45:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Sep 2018 18:45:02 -0400    

Click here for diff

This number can be useful for application memory management, and the  
overhead to track it seems pretty trivial.  
  
Lars Kanis, reviewed by Pavel Stehule, some mods by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h

Parse more strictly integer parameters from connection strings in libpq

commit   : e7a2217978d9cbb2149bfcb4ef1e45716cfcbefb    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Sep 2018 06:46:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Sep 2018 06:46:01 +0900    

Click here for diff

The following parameters have been parsed in lossy ways when specified  
in a connection string processed by libpq:  
- connect_timeout  
- keepalives  
- keepalives_count  
- keepalives_idle  
- keepalives_interval  
- port  
  
Overflowing values or the presence of incorrect characters were not  
properly checked, leading to libpq trying to use such values and fail  
with unhelpful error messages.  This commit hardens the parsing of those  
parameters so as it is possible to find easily incorrect values.  
  
Author: Fabien Coelho  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1808171206180.20841@lancre  

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

doc: adjust PG 11 release notes

commit   : 0d45cd96fd0f3387d1bcf7e6f873c73c4f251df8    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 11 Sep 2018 17:01:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 11 Sep 2018 17:01:51 -0400    

Click here for diff

Fixes for channel binding, SQL procedures, and pg_trgm.  
  
Backpatch-through: 11  

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

Remove ruleutils.c's special case for BIT [VARYING] literals.

commit   : fedc97cdfd834a2137d9c5aa8e7f89e39546fc6b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Sep 2018 16:32:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Sep 2018 16:32:12 -0400    

Click here for diff

Up to now, get_const_expr() insisted on prefixing BIT and VARBIT  
literals with 'B'.  That's not really necessary, because we always  
append explicit-cast syntax to identify the constant's type.  
Moreover, it's subtly wrong for VARBIT, because the parser will  
interpret B'...' as '...'::"bit"; see make_const() which explicitly  
assigns type BITOID for a T_BitString literal.  So what had been  
a simple VARBIT literal is reconstructed as ('...'::"bit")::varbit,  
which is not the same thing, at least not before constant folding.  
This results in odd differences after dump/restore, as complained  
of by the patch submitter, and it could result in actual failures in  
partitioning or inheritance DDL operations (see commit 542320c2b,  
which repaired similar misbehaviors for some other data types).  
  
Fixing it is pretty easy: just remove the special case and let the  
default code path handle these types.  We could have kept the special  
case for BIT only, but there seems little point in that.  
  
Like the previous patch, I judge that back-patching this into stable  
branches wouldn't be a good idea.  However, it seems not quite too  
late for v11, so let's fix it there.  
  
Paul Guo, reviewed by Davy Machado and John Naylor, minor adjustments  
by me  
  
Discussion: https://postgr.es/m/CABQrizdTra=2JEqA6+Ms1D1k1Kqw+aiBBhC9TreuZRX2JzxLAA@mail.gmail.com  

M contrib/btree_gist/expected/bit.out
M contrib/btree_gist/expected/varbit.out
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/bit.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/bit.sql

Repair double-free in SP-GIST rescan (bug #15378)

commit   : 500d49794f1f61cb20f485bd5c5052c122e58cf9    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 11 Sep 2018 18:14:19 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 11 Sep 2018 18:14:19 +0100    

Click here for diff

spgrescan would first reset traversalCxt, and then traverse a  
potentially non-empty stack containing pointers to traversalValues  
which had been allocated in those contexts, freeing them a second  
time. This bug originates in commit ccd6eb49a where traversalValue was  
introduced.  
  
Repair by traversing the stack before the context reset; this isn't  
ideal, since it means doing retail pfree in a context that's about to  
be reset, but the freeing of a stack entry is also done in other  
places in the code during the scan so it's not worth trying to  
refactor it further. Regression test added.  
  
Backpatch to 9.6 where the problem was introduced.  
  
Per bug #15378; analysis and patch by me, originally from a report on  
IRC by user velix; see also PostGIS ticket #4174; review by Alexander  
Korotkov.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/spgist/spgscan.c
M src/test/regress/expected/spgist.out
M src/test/regress/sql/spgist.sql

Use -Bsymbolic for shared libraries on HP-UX and Solaris.

commit   : 4fa3741d1cfb3898c3ff7b01fa873383108e1fe3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Sep 2018 22:22:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Sep 2018 22:22:12 -0400    

Click here for diff

These platforms are also subject to the mis-linking problem addressed  
in commit e3d77ea6b.  It's not clear whether we could solve it with  
a solution equivalent to GNU ld's version scripts, but -Bsymbolic  
appears to fix it, so let's use that.  
  
Like the previous commit, back-patch as far as v10.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

Hide a static inline from FRONTEND code.

commit   : 14ea36520389dbb1b48524223cf09389154a0f2e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Sep 2018 12:47:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Sep 2018 12:47:02 -0400    

Click here for diff

For some reason pg_waldump is including tuptable.h, and the recent  
addition of a static inline function to it is causing problems on  
older buildfarm members that fail to optimize such functions away  
completely.  I wonder if this situation doesn't mean that some header  
refactoring is called for ... but as a band-aid, wrap the static  
function in "#ifndef FRONTEND".  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/executor/tuptable.h

Prevent mis-linking of src/port and src/common functions on *BSD.

commit   : e3d77ea6b4e425093db23be492f236896dd7b501    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Sep 2018 15:16:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Sep 2018 15:16:51 -0400    

Click here for diff

On ELF-based platforms (and maybe others?) it's possible for a shared  
library, when dynamically loaded into the backend, to call the backend  
versions of src/port and src/common functions rather than the frontend  
versions that are actually linked into the shlib.  This is the cause  
of bug #15367 from Jeremy Evans, and is likely to lead to more problems  
in future; it's accidental that we've failed to notice any bad effects  
up to now.  
  
The recommended way to fix this on ELF-based platforms is to use a  
linker "version script" that makes the shlib's versions of the functions  
local.  (Apparently, -Bsymbolic would fix it as well, but with other  
side effects that we don't want.)  Doing so has the additional benefit  
that we can make sure the shlib only exposes the symbols that are meant  
to be part of its API, and not ones that are just for cross-file  
references within the shlib.  So we'd already been using a version  
script for libpq on popular platforms, but it's now apparent that it's  
necessary for correctness on every ELF-based platform.  
  
Hence, add appropriate logic to the openbsd, freebsd, and netbsd stanzas  
of Makefile.shlib; this is just a copy-and-paste from the linux stanza.  
There may be additional work to do if commit ed0cdf0e0 reveals that the  
problem exists elsewhere, but this is all that is known to be needed  
right now.  
  
Back-patch to v10 where SCRAM support came in.  The problem is ancient,  
but analysis suggests that there were no really severe consequences  
in older branches.  Hence, I won't take the risk of such a large change  
in the build process for older branches.  
  
In passing, remove a rather opaque comment about -Bsymbolic; I don't  
think it's very on-point about why we don't use that, if indeed that's  
what it's talking about at all.  
  
Patch by me; thanks to Andrew Gierth for helping to diagnose the problem,  
and for additional testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.shlib

Improve behavior of to_timestamp()/to_date() functions

commit   : cf984672427ebc4446213fe8f71d8899452802b6    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 9 Sep 2018 21:19:51 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 9 Sep 2018 21:19:51 +0300    

Click here for diff

to_timestamp()/to_date() functions were introduced mainly for Oracle  
compatibility, and became very popular among PostgreSQL users.  However, some  
behavior of to_timestamp()/to_date() functions are both incompatible with Oracle  
and confusing for our users.  This behavior is related to handling of spaces and  
separators in non FX (fixed format) mode.  This commit reworks this behavior  
making less confusing, better documented and more compatible with Oracle.  
  
Nevertheless, there are still following incompatibilities with Oracle.  
1) We don't insist that there are no format string patterns unmatched to  
   input string.  
2) In FX mode we don't insist space and separators in format string to exactly  
   match input string.  
3) When format string patterns are divided by mix of spaces and separators, we  
   don't distinguish them, while Oracle takes into account only last group of  
   spaces/separators.  
  
Discussion: https://postgr.es/m/1873520224.1784572.1465833145330.JavaMail.yahoo%40mail.yahoo.com  
Author: Artur Zakirov, Alexander Korotkov, Liudmila Mantrova  
Review: Amul Sul, Robert Haas, Tom Lane, Dmitry Dolgov, David G. Johnston  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/formatting.c
M src/test/regress/expected/horology.out
M src/test/regress/sql/horology.sql

Fix past pd_upper write in ginRedoRecompress()

commit   : 5f08accdad2b03e0107bdc73d48783a01fe51c8c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 9 Sep 2018 21:19:29 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 9 Sep 2018 21:19:29 +0300    

Click here for diff

ginRedoRecompress() replays actions over compressed segments of posting list  
in-place.  However, it might lead to write past pg_upper, because intermediate  
state during playing the changes can take more space than both original state  
and final state.  This commit fixes that by refuse from in-place modification.  
Instead page tail is copied once modification is started, and then it's used  
as the source of original segments.  Backpatch to 9.4 where posting list  
compression was introduced.  
  
Reported-by: Sivasubramanian Ramasubramanian  
Discussion: https://postgr.es/m/1536091151804.6588%40amazon.com  
Author: Alexander Korotkov based on patch from and ideas by Sivasubramanian Ramasubramanian  
Review: Sivasubramanian Ramasubramanian  
Backpatch-through: 9.4  

M src/backend/access/gin/ginxlog.c

Work around stdbool problem in dfmgr.c.

commit   : ff47d4bf1f208227a2e087ef7269e88285fa257e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Sep 2018 12:41:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Sep 2018 12:41:27 -0400    

Click here for diff

Commit 842cb9fa6 refactored things so that dfmgr.c includes <dlfcn.h>,  
which before that had only been directly included in platform-specific  
stub files.  It turns out that on macOS, <dlfcn.h> includes <stdbool.h>,  
and that causes problems on platforms where _Bool is not char-sized ...  
which happens to include the PPC versions of macOS.  Work around it  
much as we have in plperl.h, by #undef'ing bool after including the  
problematic file, but only if we're not using stdbool-style booleans.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/fmgr/dfmgr.c

Install a check for mis-linking of src/port and src/common functions.

commit   : ed0cdf0e05134d1084b01bf8a77e9e1dc5081f91    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Sep 2018 12:23:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Sep 2018 12:23:23 -0400    

Click here for diff

On ELF-based platforms (and maybe others?) it's possible for a shared  
library, when dynamically loaded into the backend, to call the backend  
versions of src/port and src/common functions rather than the frontend  
versions that are actually linked into the shlib.  This is definitely  
not what we want, because the frontend versions often behave slightly  
differently.  Up to now it's been "slight" enough that nobody noticed;  
but with the addition of SCRAM support functions in src/common, we're  
observing crashes due to the difference between palloc and malloc  
memory allocation rules, as reported in bug #15367 from Jeremy Evans.  
  
The purpose of this patch is to create a direct test for this type of  
mis-linking, so that we know whether any given platform requires extra  
measures to prevent using the wrong functions.  If the test fails, it  
will lead to connection failures in the contrib/postgres_fdw regression  
test.  At the moment, *BSD platforms using ELF format are known to have  
the problem and can be expected to fail; but we need to know whether  
anything else does, and we need a reliable ongoing check for future  
platforms.  
  
Actually fixing the problem will be the subject of later commit(s).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/common/Makefile
A src/common/link-canary.c
A src/include/common/link-canary.h
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-connect.c
M src/tools/msvc/Mkvcbuild.pm

Allow ENOENT in check_mode_recursive().

commit   : c85ad9cc63e1487758f3969e20826cac0e944a27    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 8 Sep 2018 18:26:10 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 8 Sep 2018 18:26:10 -0700    

Click here for diff

Buildfarm member tern failed src/bin/pg_ctl/t/001_start_stop.pl when a  
check_mode_recursive() call overlapped a server's startup-time deletion  
of pg_stat/global.stat.  Just warn.  Also, include errno in the message.  
Back-patch to v11, where check_mode_recursive() first appeared.  

M src/test/perl/TestLib.pm

Fix logical subscriber wait in test.

commit   : 076a3c2112b127b3b36346dbc64659f9a165f60f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 8 Sep 2018 16:20:50 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 8 Sep 2018 16:20:50 -0700    

Click here for diff

Buildfarm members sungazer and tern revealed this deficit.  Back-patch  
to v10, like commit 4f10e7ea7b2231f453bb18b6e710ac333eaf121b, which  
introduced the test.  

M src/test/subscription/t/002_types.pl

Minor cleanup/future-proofing for pg_saslprep().

commit   : f47f3148011f1cb5dc34396382fc2f434844d247    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Sep 2018 18:20:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Sep 2018 18:20:36 -0400    

Click here for diff

Ensure that pg_saslprep() initializes its output argument to NULL in  
all failure paths, and then remove the redundant initialization that  
some (not all) of its callers did.  This does not fix any live bug,  
but it reduces the odds of future bugs of omission.  
  
Also add a comment about why the existing failure-path coding is  
adequate.  
  
Back-patch so as to keep the function's API consistent across branches,  
again to forestall future bug introduction.  
  
Patch by me, reviewed by Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth-scram.c
M src/common/saslprep.c
M src/interfaces/libpq/fe-auth-scram.c

Remove duplicated words split across lines in comments

commit   : 9226a3b89b004b3472d963442856206f0c249a53    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 8 Sep 2018 12:24:19 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 8 Sep 2018 12:24:19 -0700    

Click here for diff

This has been detected using some interesting tricks with sed, and the  
method used is mentioned in details in the discussion below.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gin/ginbtree.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlogarchive.c
M src/backend/commands/analyze.c
M src/backend/commands/seclabel.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/partitioning/partprune.c
M src/backend/storage/ipc/barrier.c
M src/backend/utils/adt/datetime.c

Save/restore SPI's global variables in SPI_connect() and SPI_finish().

commit   : 361844fe561f6898d90a10382705ad968929a4b2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 20:09:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 20:09:57 -0400    

Click here for diff

This patch removes two sources of interference between nominally  
independent functions when one SPI-using function calls another,  
perhaps without knowing that it does so.  
  
Chapman Flack pointed out that xml.c's query_to_xml_internal() expects  
SPI_tuptable and SPI_processed to stay valid across datatype output  
function calls; but it's possible that such a call could involve  
re-entrant use of SPI.  It seems likely that there are similar hazards  
elsewhere, if not in the core code then in third-party SPI users.  
Previously SPI_finish() reset SPI's API globals to zeroes/nulls, which  
would typically make for a crash in such a situation.  Restoring them  
to the values they had at SPI_connect() seems like a considerably more  
useful behavior, and it still meets the design goal of not leaving any  
dangling pointers to tuple tables of the function being exited.  
  
Also, cause SPI_connect() to reset these variables to zeroes/nulls after  
saving them.  This prevents interference in the opposite direction: it's  
possible that a SPI-using function that's only ever been tested standalone  
contains assumptions that these variables start out as zeroes.  That was  
the case as long as you were the outermost SPI user, but not so much for  
an inner user.  Now it's consistent.  
  
Report and fix suggestion by Chapman Flack, actual patch by me.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/spi.c
M src/include/executor/spi_priv.h

Limit depth of forced recursion for CLOBBER_CACHE_RECURSIVELY.

commit   : f510412df3510e244fb3f9570ba5d2b4d27e773a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 18:13:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 18:13:29 -0400    

Click here for diff

It's somewhat surprising that we got away with this before.  (Actually,  
since nobody tests this routinely AFAIK, it might've been broken for  
awhile.  But it's definitely broken in the wake of commit f868a8143.)  
It seems sufficient to limit the forced recursion to a small number  
of levels.  
  
Back-patch to all supported branches, like the preceding patch.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix longstanding recursion hazard in sinval message processing.

commit   : f868a8143a98c4172e3faaf415d9352179d5760b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 18:04:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Sep 2018 18:04:37 -0400    

Click here for diff

LockRelationOid and sibling routines supposed that, if our session already  
holds the lock they were asked to acquire, they could skip calling  
AcceptInvalidationMessages on the grounds that we must have already read  
any remote sinval messages issued against the relation being locked.  
This is normally true, but there's a critical special case where it's not:  
processing inside AcceptInvalidationMessages might attempt to access system  
relations, resulting in a recursive call to acquire a relation lock.  
  
Hence, if the outer call had acquired that same system catalog lock, we'd  
fall through, despite the possibility that there's an as-yet-unread sinval  
message for that system catalog.  This could, for example, result in  
failure to access a system catalog or index that had just been processed  
by VACUUM FULL.  This is the explanation for buildfarm failures we've been  
seeing intermittently for the past three months.  The bug is far older  
than that, but commits a54e1f158 et al added a new recursion case within  
AcceptInvalidationMessages that is apparently easier to hit than any  
previous case.  
  
To fix this, we must not skip calling AcceptInvalidationMessages until  
we have *finished* a call to it since acquiring a relation lock, not  
merely acquired the lock.  (There's already adequate logic inside  
AcceptInvalidationMessages to deal with being called recursively.)  
Fortunately, we can implement that at trivial cost, by adding a flag  
to LOCALLOCK hashtable entries that tracks whether we know we have  
completed such a call.  
  
There is an API hazard added by this patch for external callers of  
LockAcquire: if anything is testing for LOCKACQUIRE_ALREADY_HELD,  
it might be fooled by the new return code LOCKACQUIRE_ALREADY_CLEAR  
into thinking the lock wasn't already held.  This should be a fail-soft  
condition, though, unless something very bizarre is being done in  
response to the test.  
  
Also, I added an additional output argument to LockAcquireExtended,  
assuming that that probably isn't called by any outside code given  
the very limited usefulness of its additional functionality.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/include/storage/lock.h

Improve handling of corrupted two-phase state files at recovery

commit   : 8582b4d044b05d3fe4bcdf6e039fde8e753934ae    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Sep 2018 11:00:16 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Sep 2018 11:00:16 -0700    

Click here for diff

When a corrupted two-phase state file is found by WAL replay, be it for  
crash recovery or archive recovery, then the file is simply skipped and  
a WARNING is logged to the user, causing the transaction to be silently  
lost.  Facing an on-disk WAL file which is corrupted is as likely to  
happen as what is stored in WAL records, but WAL records are already  
able to fail hard if there is a CRC mismatch.  On-disk two-phase state  
files, on the contrary, are simply ignored if corrupted.  Note that when  
restoring the initial two-phase data state at recovery, files newer than  
the horizon XID are discarded hence no files present in pg_twophase/  
should be torned and have been made durable by a previous checkpoint, so  
recovery should never see any corrupted two-phase state file by design.  
  
The situation got better since 978b2f6 which has added two-phase state  
information directly in WAL instead of using on-disk files, so the risk  
is limited to two-phase transactions which live across at least one  
checkpoint for long periods.  Backups having legit two-phase state files  
on-disk could also lose silently transactions when restored if things  
get corrupted.  
  
This behavior exists since two-phase commit has been introduced, no  
back-patch is done for now per the lack of complaints about this  
problem.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Refactor installation of extension headers.

commit   : 7b6b167fa3bd2f968ad885ca7b024be4122a85f1    
  
author   : Andrew Gierth <[email protected]>    
date     : Fri, 7 Sep 2018 13:51:30 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Fri, 7 Sep 2018 13:51:30 +0100    

Click here for diff

Commit be54b3777 failed on gmake 3.80 due to a chained conditional,  
which on closer examination could be removed entirely with some  
refactoring elsewhere for a net simplification and more robustness  
against empty expansions. Along the way, add some more comments.  
  
Also make explicit in the documentation and comments that built  
headers are not removed by 'make clean', since we don't typically want  
that for headers generated by a separate ./configure step, and it's  
much easier to add your own 'distclean' rule or use EXTRA_CLEAN than  
to try and override a deletion rule in pgxs.mk.  
  
Per buildfarm member prariedog and comments by Michael Paquier, though  
all the actual changes are my fault.  

M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk

libpq: Change "options" dispchar to normal

commit   : 1fea1e325492b10f645809204631426bb6abbe6e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Sep 2018 15:01:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Sep 2018 15:01:25 +0200    

Click here for diff

libpq connection options as returned by PQconndefaults() have a  
"dispchar" field that determines (among other things) whether an option  
is a "debug" option, which shouldn't be shown by default to clients.  
postgres_fdw makes use of that to control which connection options to  
accept from a foreign server configuration.  
  
Curiously, the "options" option, which allows passing configuration  
settings to the backend server, was listed as a debug option, which  
prevented it from being used by postgres_fdw.  Maybe it was once meant  
for debugging, but it's clearly in general use nowadays.  
  
So change the dispchar for it to be the normal non-debug case.  Also  
remove the "debug" reference from its label field.  
  
Reported-by: Shinoda, Noriyoshi <[email protected]>  

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

Use C99 designated initializers for some structs

commit   : 98afa68d935215e8ab2c7de7fb45972a03e3da26    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Aug 2018 08:36:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Aug 2018 08:36:30 +0200    

Click here for diff

These are just a few particularly egregious cases that were hard to read  
and write, and error prone because of many similar adjacent types.  
  
Discussion: https://www.postgresql.org/message-id/flat/4c9f01be-9245-2148-b569-61a8562ef190%402ndquadrant.com  

M src/backend/access/transam/xact.c
M src/backend/catalog/heap.c
M src/bin/psql/tab-complete.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_planobject.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_resultobject.c
M src/pl/plpython/plpy_subxactobject.c

Fix inconsistent argument naming.

commit   : 75f7855369ec56d4a8e7d6eae98aff1182b85cac    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Sep 2018 11:14:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Sep 2018 11:14:22 -0400    

Click here for diff

Typo in commit 842cb9fa6.  

M src/port/dlopen.c

Make contrib/unaccent's unaccent() function work when not in search path.

commit   : a5322ca10fa16bed01e3e3d6c49c0f49c68b5593    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Sep 2018 10:49:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Sep 2018 10:49:45 -0400    

Click here for diff

Since the fixes for CVE-2018-1058, we've advised people to schema-qualify  
function references in order to fix failures in code that executes under  
a minimal search_path setting.  However, that's insufficient to make the  
single-argument form of unaccent() work, because it looks up the "unaccent"  
text search dictionary using the search path.  
  
The most expedient answer seems to be to remove the search_path dependency  
by making it look in the same schema that the unaccent() function itself  
is declared in.  This will definitely work for the normal usage of this  
function with the unaccent dictionary provided by the extension.  
It's barely possible that there are people who were relying on the  
search-path-dependent behavior to select other dictionaries with the same  
name; but if there are any such people at all, they can still get that  
behavior by writing unaccent('unaccent', ...), or possibly  
unaccent('unaccent'::text::regdictionary, ...) if the lookup has to be  
postponed to runtime.  
  
Per complaint from Gunnlaugur Thor Briem.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/CAPs+M8LCex6d=DeneofdsoJVijaG59m9V0ggbb3pOH7hZO4+cQ@mail.gmail.com  

M contrib/unaccent/unaccent.c
M doc/src/sgml/unaccent.sgml

Refactor dlopen() support

commit   : 842cb9fa62fc99598086166bdeec9d6ae6e3c50f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Sep 2018 10:07:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Sep 2018 10:07:24 +0200    

Click here for diff

Nowadays, all platforms except Windows and older HP-UX have standard  
dlopen() support.  So having a separate implementation per platform  
under src/backend/port/dynloader/ is a bit excessive.  Instead, treat  
dlopen() like other library functions that happen to be missing  
sometimes and put a replacement implementation under src/port/.  
  
Discussion: https://www.postgresql.org/message-id/flat/e11a49cb-570a-60b7-707d-7084c8de0e61%402ndquadrant.com#54e735ae37476a121abb4e33c2549b03  

M configure
M configure.in
M src/backend/Makefile
M src/backend/port/.gitignore
M src/backend/port/Makefile
D src/backend/port/dynloader/aix.c
D src/backend/port/dynloader/aix.h
D src/backend/port/dynloader/cygwin.c
D src/backend/port/dynloader/cygwin.h
D src/backend/port/dynloader/darwin.c
D src/backend/port/dynloader/darwin.h
D src/backend/port/dynloader/freebsd.c
D src/backend/port/dynloader/freebsd.h
D src/backend/port/dynloader/hpux.c
D src/backend/port/dynloader/hpux.h
D src/backend/port/dynloader/linux.c
D src/backend/port/dynloader/linux.h
D src/backend/port/dynloader/netbsd.c
D src/backend/port/dynloader/netbsd.h
D src/backend/port/dynloader/openbsd.c
D src/backend/port/dynloader/openbsd.h
D src/backend/port/dynloader/solaris.c
D src/backend/port/dynloader/solaris.h
D src/backend/port/dynloader/win32.h
M src/backend/postmaster/postmaster.c
M src/backend/utils/fmgr/dfmgr.c
M src/include/.gitignore
M src/include/Makefile
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/port.h
D src/include/utils/dynamic_loader.h
R051 src/backend/port/dynloader/win32.c src/port/dlopen.c
M src/tools/msvc/Install.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/clean.bat

Fix the overrun in hash index metapage for smaller block sizes.

commit   : ac27c74def5d8544530b13d5901308a342f072ac    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 6 Sep 2018 09:27:19 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 6 Sep 2018 09:27:19 +0530    

Click here for diff

The commit 620b49a1 changed the value of HASH_MAX_BITMAPS with the intent  
to allow many non-unique values in hash indexes without worrying to reach  
the limit of the number of overflow pages.  At that time, this didn't  
occur to us that it can overrun the block for smaller block sizes.  
  
Choose the value of HASH_MAX_BITMAPS based on BLCKSZ such that it gives  
the same answer as now for the cases where the overrun doesn't occur, and  
some other sufficiently-value for the cases where an overrun currently  
does occur.  This allows us not to change the behavior in any case that  
currently works, so there's really no reason for a HASH_VERSION bump.  
  
Author: Dilip Kumar  
Reviewed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAA4eK1LtF4VmU4mx_+i72ff1MdNZ8XaJMGkt2HV8+uSWcn8t4A@mail.gmail.com  

M src/include/access/hash.h

Allow extensions to install built as well as unbuilt headers.

commit   : be54b3777ff189e79661d8746d3f25b0564393d2    
  
author   : Andrew Gierth <[email protected]>    
date     : Wed, 5 Sep 2018 22:01:21 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Wed, 5 Sep 2018 22:01:21 +0100    

Click here for diff

Commit df163230b overlooked the case that an out-of-tree extension  
might need to build its header files (e.g. via ./configure). If it is  
also doing a VPATH build, the HEADERS_* rules in the original commit  
would then fail to find the files, since they would be looking only  
under $(srcdir) and not in the build directory.  
  
Fix by adding HEADERS_built and HEADERS_built_$(MODULE) which behave  
like DATA_built in that they look in the build dir rather than the  
source dir (and also make the files dependencies of the "all" target).  
  
No Windows support appears to be needed for this, since it is only  
relevant to out-of-tree builds (no support exists in Mkvcbuild.pm to  
build extension header files in any case).  

M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk

Remove no-longer-used variable.

commit   : 54b01b9293830d82d5b6c827771c683ff52ffb0b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Sep 2018 14:29:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Sep 2018 14:29:58 -0400    

Click here for diff

Oversight in 2fbdf1b38.  Per buildfarm.  

M src/backend/commands/tablecmds.c

Make argument names of pg_get_object_address consistent, and fix docs.

commit   : ae5205c8a8eff6745fccd39b679ab9ee9c0d13c4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Sep 2018 13:47:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Sep 2018 13:47:15 -0400    

Click here for diff

pg_get_object_address and pg_identify_object_as_address are supposed  
to be inverses, but they disagreed as to the names of the arguments  
representing the textual form of an object address.  Moreover, the  
documented argument names didn't agree with reality at all, either  
for these functions or pg_identify_object.  
  
In HEAD and v11, I think we can get away with renaming the input  
arguments of pg_get_object_address to match the outputs of  
pg_identify_object_as_address.  In theory that might break queries  
using named-argument notation to call pg_get_object_address, but  
it seems really unlikely that anybody is doing that, or that they'd  
have much trouble adjusting if they were.  In older branches, we'll  
just live with the lack of consistency.  
  
Aside from fixing the documentation of these functions to match reality,  
I couldn't resist the temptation to do some copy-editing.  
  
Per complaint from Jean-Pierre Pelletier.  Back-patch to 9.5 where these  
functions were introduced.  (Before v11, this is a documentation change  
only.)  
  
Discussion: https://postgr.es/m/CANGqjDnWH8wsTY_GzDUxbt4i=y-85SJreZin4Hm8uOqv1vzRQA@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Simplify partitioned table creation vs. relcache

commit   : 2fbdf1b38bc54b297e0f885ca97e0c8f5c922e72    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 5 Sep 2018 14:36:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 5 Sep 2018 14:36:13 -0300    

Click here for diff

In the original code, we were storing the pg_inherits row for a  
partitioned table too early: enough that we had a hack for relcache to  
avoid falling flat on its face while reading such a partial entry.  If  
we finish the pg_class creation first and *then* store the pg_inherits  
entry, we don't need that hack.  
  
Also recognize that pg_class.relpartbound is not marked NOT NULL and  
therefore it's entirely possible to read null values, so having only  
Assert() protection isn't enough.  Change those to if/elog tests  
instead.  This qualifies as a robustness fix, so backpatch to pg11.  
  
In passing, remove one access that wasn't actually needed, and reword  
one message to be like all the others that check for the same thing.  
  
Reviewed-by: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c

PL/Python: Remove use of simple slicing API

commit   : f5a6509bb1ec5222a707205941a40f280f3e6e15    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Aug 2018 11:10:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Aug 2018 11:10:17 +0200    

Click here for diff

The simple slicing API (sq_slice, sq_ass_slice) has been deprecated  
since Python 2.0 and has been removed altogether in Python 3, so remove  
those functions from the PLyResult class.  Instead, the non-slice  
mapping functions mp_subscript and mp_ass_subscript can take slice  
objects as an index.  Since we just pass the index through to the  
underlying list object, we already support that.  Test coverage was  
already in place.  

M src/pl/plpython/plpy_resultobject.c

docs: improve AT TIME ZONE description

commit   : dd6073f22a6b5dd6181d8324465dd3c0bf1851e8    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 4 Sep 2018 22:34:07 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 4 Sep 2018 22:34:07 -0400    

Click here for diff

The previous description was unclear.  Also add a third example, change  
use of time zone acronyms to more verbose descriptions, and add a  
mention that using 'time' with AT TIME ZONE uses the current time zone  
rules.  
  
Backpatch-through: 9.3  

M doc/src/sgml/func.sgml

Improve some error message strings and errcodes

commit   : d6e98ebe375e115c29028f9bd090f0f7e07e2527    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Sep 2018 11:06:04 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Sep 2018 11:06:04 -0700    

Click here for diff

This makes a bit less work for translators, by unifying error strings a  
bit more with what the rest of the code does, this time for three error  
strings in autoprewarm and one in base backup code.  
  
After some code review of slot.c, some file-access errcodes are reported  
but lead to an incorrect internal error, while corrupted data makes the  
most sense, similarly to the previous work done in e41d0a1.  Also,  
after calling rmtree(), a WARNING gets reported, which is a duplicate of  
what the internal call report, so make the code more consistent with all  
other code paths calling this function.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/replication/basebackup.c
M src/backend/replication/slot.c

Fully enforce uniqueness of constraint names.

commit   : 17b7c302b5fc92bd0241c452599019e18df074dc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Sep 2018 13:45:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Sep 2018 13:45:35 -0400    

Click here for diff

It's been true for a long time that we expect names of table and domain  
constraints to be unique among the constraints of that table or domain.  
However, the enforcement of that has been pretty haphazard, and it missed  
some corner cases such as creating a CHECK constraint and then an index  
constraint of the same name (as per recent report from André Hänsel).  
Also, due to the lack of an actual unique index enforcing this, duplicates  
could be created through race conditions.  
  
Moreover, the code that searches pg_constraint has been quite inconsistent  
about how to handle duplicate names if one did occur: some places checked  
and threw errors if there was more than one match, while others just  
processed the first match they came to.  
  
To fix, create a unique index on (conrelid, contypid, conname).  Since  
either conrelid or contypid is zero, this will separately enforce  
uniqueness of constraint names among constraints of any one table and any  
one domain.  (If we ever implement SQL assertions, and put them into this  
catalog, more thought might be needed.  But it'd be at least as reasonable  
to put them into a new catalog; having overloaded this one catalog with  
two kinds of constraints was a mistake already IMO.)  This index can replace  
the existing non-unique index on conrelid, though we need to keep the one  
on contypid for query performance reasons.  
  
Having done that, we can simplify the logic in various places that either  
coped with duplicates or neglected to, as well as potentially improve  
lookup performance when searching for a constraint by name.  
  
Also, as per our usual practice, install a preliminary check so that you  
get something more friendly than a unique-index violation report in the  
case complained of by André.  And teach ChooseIndexName to avoid choosing  
autogenerated names that would draw such a failure.  
  
While it's not possible to make such a change in the back branches,  
it doesn't seem quite too late to put this into v11, so do so.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_index.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/catversion.h
M src/include/catalog/indexing.h
M src/include/catalog/pg_constraint.h
M src/include/commands/defrem.h
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Clean up after TAP tests in oid2name and vacuumlo.

commit   : f30c6f523f9caa73c9ba6ebd82c8d29fe45866a3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Sep 2018 10:52:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Sep 2018 10:52:01 -0400    

Click here for diff

Oversights in commits 1aaf532de and bfea331a5.  Unlike the case for  
traditional-style REGRESS tests, pgxs.mk doesn't have any builtin support  
for TAP tests, so it doesn't realize it should remove tmp_check/.  
Maybe we should build some actual pgxs infrastructure for TAP tests ...  
but for the moment, just remove explicitly.  

M contrib/oid2name/Makefile
M contrib/vacuumlo/Makefile

Prohibit pushing subqueries containing window function calculation to workers.

commit   : 14e9b2a752efaa427ce1b400b9aaa5a636898a04    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 4 Sep 2018 10:06:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 4 Sep 2018 10:06:09 +0530    

Click here for diff

Allowing window function calculation in workers leads to inconsistent  
results because if the input row ordering is not fully deterministic, the  
output of window functions might vary across workers.  The fix is to treat  
them as parallel-restricted.  
  
In the passing, improve the coding pattern in max_parallel_hazard_walker  
so that it has a chain of mutually-exclusive if ... else if ... else if  
... else if ... IsA tests.  
  
Reported-by: Marko Tiikkaja  
Bug: 15324  
Author: Amit Kapila  
Reviewed-by: Tom Lane  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/CAL9smLAnfPJCDUUG4ckX2iznj53V7VSMsYefzZieN93YxTNOcw@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

During the split, set checksum on an empty hash index page.

commit   : 7c9e19ca9a4de6eb98582548ec6dd0d83fc5ac2d    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 4 Sep 2018 08:13:35 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 4 Sep 2018 08:13:35 +0530    

Click here for diff

On a split, we allocate a new splitpoint's worth of bucket pages wherein  
we initialize the last page with zeros which is fine, but we forgot to set  
the checksum for that last page.  
  
We decided to back-patch this fix till 10 because we don't have an easy  
way to test it in prior versions.  Another reason is that the hash-index  
code is changed heavily in 10, so it is not advisable to push the fix  
without testing it in prior versions.  
  
Author: Amit Kapila  
Reviewed-by: Yugo Nagata  
Backpatch-through: 10  
Discussion: https://postgr.es/m/[email protected]  

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

Remove pg_constraint.conincluding

commit   : c076f3d74af6e4836206142446bdcc2f93e149d6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 3 Sep 2018 12:58:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 3 Sep 2018 12:58:42 -0300    

Click here for diff

This column was added in commit 8224de4f42cc ("Indexes with INCLUDE  
columns and their support in B-tree") to ease writing the ruleutils.c  
supporting code for that feature, but it turns out to be unnecessary --  
we can do the same thing with just one more syscache lookup.  
  
Even the documentation for the new column being removed in this commit  
is awkward.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_constraint.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/index_including.out
M src/test/regress/sql/index_including.sql

Fix memory leak in TRUNCATE decoding

commit   : 4ddd8f5f55a0a1967fc787e42182745ca1e3a995    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 3 Sep 2018 02:10:24 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 3 Sep 2018 02:10:24 +0200    

Click here for diff

When decoding a TRUNCATE record, the relids array was being allocated in  
the main ReorderBuffer memory context, but not released with the change  
resulting in a memory leak.  
  
The array was also ignored when serializing/deserializing the change,  
assuming all the information is stored in the change itself.  So when  
spilling the change to disk, we've only we have serialized only the  
pointer to the relids array.  Thanks to never releasing the array,  
the pointer however remained valid even after loading the change back  
to memory, preventing an actual crash.  
  
This fixes both the memory leak and (de)serialization.  The relids array  
is still allocated in the main ReorderBuffer memory context (none of the  
existing ones seems like a good match, and adding an extra context seems  
like an overkill).  The allocation is wrapped in a new ReorderBuffer API  
functions, to keep the details within reorderbuffer.c, just like the  
other ReorderBufferGet methods do.  
  
Author: Tomas Vondra  
Discussion: https://www.postgresql.org/message-id/flat/66175a41-9342-2845-652f-1bd4c3ee50aa%402ndquadrant.com  
Backpatch: 11, where decoding of TRUNCATE was introduced  

M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/replication/reorderbuffer.h

Fix initial sync of slot parent directory when restoring status

commit   : caa0c6ceba1fd6ec7b027532d68cecf5dfbbb2db    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 2 Sep 2018 12:40:30 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 2 Sep 2018 12:40:30 -0700    

Click here for diff

At the beginning of recovery, information from replication slots is  
recovered from disk to memory.  In order to ensure the durability of the  
information, the status file as well as its parent directory are  
synced.  It happens that the sync on the parent directory was done  
directly using the status file path, which is logically incorrect, and  
the current code has been doing a sync on the same object twice in a  
row.  
  
Reported-by: Konstantin Knizhnik  
Diagnosed-by: Konstantin Knizhnik  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.4-  

M src/backend/replication/slot.c

Doc: fix oversights in "Client/Server Character Set Conversions" table.

commit   : 4299c32316addaad2255e6363b26ba1eec5c3999    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Sep 2018 16:02:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Sep 2018 16:02:47 -0400    

Click here for diff

This table claimed that JOHAB could be used as a server encoding, which  
was true originally but hasn't been true since 8.3.  It also lacked  
entries for EUC_JIS_2004 and SHIFT_JIS_2004.  
  
JOHAB problem noted by Lars Kanis, the others by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml

Avoid using potentially-under-aligned page buffers.

commit   : 44cac9346479d4b0cc9195b0267fd13eb4e7442c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Sep 2018 15:27:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Sep 2018 15:27:12 -0400    

Click here for diff

There's a project policy against using plain "char buf[BLCKSZ]" local  
or static variables as page buffers; preferred style is to palloc or  
malloc each buffer to ensure it is MAXALIGN'd.  However, that policy's  
been ignored in an increasing number of places.  We've apparently got  
away with it so far, probably because (a) relatively few people use  
platforms on which misalignment causes core dumps and/or (b) the  
variables chance to be sufficiently aligned anyway.  But this is not  
something to rely on.  Moreover, even if we don't get a core dump,  
we might be paying a lot of cycles for misaligned accesses.  
  
To fix, invent new union types PGAlignedBlock and PGAlignedXLogBlock  
that the compiler must allocate with sufficient alignment, and use  
those in place of plain char arrays.  
  
I used these types even for variables where there's no risk of a  
misaligned access, since ensuring proper alignment should make  
kernel data transfers faster.  I also changed some places where  
we had been palloc'ing short-lived buffers, for coding style  
uniformity and to save palloc/pfree overhead.  
  
Since this seems to be a live portability hazard (despite the lack  
of field reports), back-patch to all supported versions.  
  
Patch by me; thanks to Michael Paquier for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/blinsert.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_standby/pg_standby.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/tablecmds.c
M src/backend/replication/walsender.c
M src/backend/storage/file/buffile.c
M src/backend/storage/freespace/freespace.c
M src/backend/utils/sort/logtape.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/copy_fetch.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_verify_checksums/pg_verify_checksums.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/c.h

Add Greek characters to unaccent.rules.

commit   : 5e8d670c313531c0dca245943fb84c94a477ddc4    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 2 Sep 2018 07:12:24 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 2 Sep 2018 07:12:24 +1200    

Click here for diff

Author: Tasos Maschalidis  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/153495048900.1368.11566580687623014380%40wrigleys.postgresql.org  
Discussion: https://postgr.es/m/VI1PR01MB38537EBD529FE5EE3FE9A5FEB5370%40VI1PR01MB3853.eurprd01.prod.exchangelabs.com  

M contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/unaccent.rules

Implement "pg_ctl logrotate" command

commit   : ec74369931687885cfb6ce9dac55deefdb410086    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 1 Sep 2018 19:46:49 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 1 Sep 2018 19:46:49 +0300    

Click here for diff

Currently there are two ways to trigger log rotation in logging collector  
process: call pg_rotate_logfile() SQL-function or send SIGUSR1 signal directly  
to logging collector process.  However, it's nice to have more suitable way  
for external tools to do that, which wouldn't require SQL connection or  
knowledge of logging collector pid.  This commit implements triggering log  
rotation by "pg_ctl logrotate" command.  
  
Discussion: https://postgr.es/m/20180416.115435.28153375.horiguchi.kyotaro%40lab.ntt.co.jp  
Author: Kyotaro Horiguchi, Alexander Kuzmenkov, Alexander Korotkov  

M doc/src/sgml/maintenance.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/bin/pg_ctl/pg_ctl.c
A src/bin/pg_ctl/t/004_logrotate.pl
M src/include/postmaster/syslogger.h
M src/test/perl/PostgresNode.pm

Ignore server-side delays when enforcing wal_sender_timeout.

commit   : ab0ed6153a58294143d6d66ec5f3471477c59d57    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 31 Aug 2018 22:59:58 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 31 Aug 2018 22:59:58 -0700    

Click here for diff

Healthy clients of servers having poor I/O performance, such as  
buildfarm members hamster and tern, saw unexpected timeouts.  That  
disagreed with documentation.  This fix adds one gettimeofday() call  
whenever ProcessRepliesIfAny() finds no client reply messages.  
Back-patch to 9.4; the bug's symptom is rare and mild, and the code all  
moved between 9.3 and 9.4.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c

Fix 8a934d677 for libc++ and make more include order resistant.

commit   : 5758685c9f1a51b0a77ae8f415a57670941f2c4b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 31 Aug 2018 16:56:11 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 31 Aug 2018 16:56:11 -0700    

Click here for diff

The previous definition was used in C++ mode, which causes problems  
when using clang with libc++ (rather than libstdc++), due to bugs  
therein.  So just avoid in C++ mode.  
  
A second problem is that depending on include order and implicit  
includes the previous definition did not guarantee that the current  
hack was effective by the time isinf was used, fix that by forcing  
math.h to be included.  This can cause clang using builds, or gcc  
using ones with JIT enabled, to slow down noticably.  
  
It's likely that we at some point want a better solution for the  
performance problem, but while it's there it should better work.  
  
Reported-By: Steven Winfield  
Bug: #15270  
Discussion: https://postgr.es/m/[email protected]  
Author: Andres Freund  
Backpatch: 11, like the previous commit.  

M src/include/port.h

Fix psql's \dC command to annotate I/O conversion casts as such.

commit   : 115bf1e79af0114c18d7d5675f4ba7e8bd6e11e9    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 16:45:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 16:45:33 -0400    

Click here for diff

A cast declared WITH INOUT was described as '(binary coercible)',  
which seems pretty inaccurate; let's print '(with inout)' instead.  
Per complaint from Jean-Pierre Pelletier.  
  
This definitely seems like a bug fix, but given that it's been wrong  
since 8.4 and nobody complained before, I'm hesitant to back-patch a  
behavior change into stable branches.  It doesn't seem too late for  
v11 though.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Ensure correct minimum consistent point on standbys

commit   : c186ba135ecafe987842920829629ef466ce6ce1    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 31 Aug 2018 11:03:40 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 31 Aug 2018 11:03:40 -0700    

Click here for diff

Startup process has improved its calculation of incorrect minimum  
consistent point in 8d68ee6, which ensures that all WAL available gets  
replayed when doing crash recovery, and has introduced an incorrect  
calculation of the minimum recovery point for non-startup processes,  
which can cause incorrect page references on a standby when for example  
the background writer flushed a couple of pages on-disk but was not  
updating the control file to let a subsequent crash recovery replay to  
where it should have.  
  
The only case where this has been reported to be a problem is when a  
standby needs to calculate the latest removed xid when replaying a btree  
deletion record, so one would need connections on a standby that happen  
just after recovery has thought it reached a consistent point.  Using a  
background worker which is started after the consistent point is reached  
would be the easiest way to get into problems if it connects to a  
database.  Having clients which attempt to connect periodically could  
also be a problem, but the odds of seeing this problem are much lower.  
  
The fix used is pretty simple, as the idea is to give access to the  
minimum recovery point written in the control file to non-startup  
processes so as they use a reference, while the startup process still  
initializes its own references of the minimum consistent point so as the  
original problem with incorrect page references happening post-promotion  
with a crash do not show up.  
  
Reported-by: Alexander Kukushkin  
Diagnosed-by: Alexander Kukushkin  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, Alexander Kukushkin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

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

Code review for pg_verify_checksums.c.

commit   : d9c366f9e8017306201fe12d27212d8720395c04    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 13:42:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 13:42:18 -0400    

Click here for diff

Use postgres_fe.h, since this is frontend code.  Pretend that we've heard  
of project style guidelines for, eg, #include order.  Use BlockNumber not  
int arithmetic for block numbers, to avoid misbehavior with relations  
exceeding 2^31 blocks.  Avoid an unnecessary strict-aliasing warning  
(per report from Michael Banck).  Const-ify assorted stuff.  Avoid  
scribbling on the output of readdir() -- perhaps that's safe in practice,  
but POSIX forbids it, and this code has so far earned exactly zero  
credibility portability-wise.  Editorialize on an ambiguously-worded  
message.  
  
I did not touch the problem of the "buf" local variable being possibly  
insufficiently aligned; that's not specific to this code, and seems like  
it should be fixed as part of a different, larger patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_verify_checksums/pg_verify_checksums.c

Enforce cube dimension limit in all cube construction functions

commit   : f919c165ebdc2f85e4584e959e002705a5a0a774    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 30 Aug 2018 14:18:53 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 30 Aug 2018 14:18:53 +0300    

Click here for diff

contrib/cube has a limit to 100 dimensions for cube datatype.  However, it's  
not enforced everywhere, and one can actually construct cube with more than  
100 dimensions having then trouble with dump/restore.  This commit add checks  
for dimensions limit in all functions responsible for cube construction.  
Backpatch to all supported versions.  
  
Reported-by: Andrew Gierth  
Discussion: https://postgr.es/m/87va7uybt4.fsf%40news-spur.riddles.org.uk  
Author: Andrey Borodin with small additions by me  
Review: Tom Lane  
Backpatch-through: 9.3  

M contrib/cube/cube.c
M contrib/cube/expected/cube.out
M contrib/cube/sql/cube.sql

Split contrib/cube platform-depended checks into separate test

commit   : 38970ce862b906d3b6e3745bff8c75edad378de3    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 30 Aug 2018 14:09:25 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 30 Aug 2018 14:09:25 +0300    

Click here for diff

We're currently maintaining two outputs for cube regression test.  But that  
appears to be unsuitable, because these outputs are different in out few checks  
involving scientific notation.  So, split checks involving scientific notation  
into separate test, making contrib/cube easier to maintain.  Backpatch to all  
supported versions in order to make further backpatching easier.  
  
Discussion: https://postgr.es/m/CAPpHfdvJgWjxHsJTtT%2Bo1tz3OR8EFHcLQjhp-d3%2BUcmJLh-fQA%40mail.gmail.com  
Author: Alexander Korotkov  
Backpatch-through: 9.3  

M contrib/cube/Makefile
M contrib/cube/expected/cube.out
D contrib/cube/expected/cube_2.out
A contrib/cube/expected/cube_sci.out
A contrib/cube/expected/cube_sci_1.out
M contrib/cube/sql/cube.sql
A contrib/cube/sql/cube_sci.sql

Make checksum_impl.h safe to compile with -fstrict-aliasing.

commit   : 8c62d9d16f014565d5f427506878812219a01604    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 12:26:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Aug 2018 12:26:20 -0400    

Click here for diff

In general, Postgres requires -fno-strict-aliasing with compilers that  
implement C99 strict aliasing rules.  There's little hope of getting  
rid of that overall.  But it seems like it would be a good idea if  
storage/checksum_impl.h in particular didn't depend on it, because  
that header is explicitly intended to be included by external programs.  
We don't have a lot of control over the compiler switches that an  
external program might use, as shown by Michael Banck's report of  
failure in a privately-modified version of pg_verify_checksums.  
  
Hence, switch to using a union in place of willy-nilly pointer casting  
inside this file.  I think this makes the code a bit more readable  
anyway.  
  
checksum_impl.h hasn't changed since it was introduced in 9.3,  
so back-patch all the way.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/checksum_impl.h

Disable support for partitionwise joins in problematic cases.

commit   : 7cfdc77023ad50731723e85c215a4127436ed09c    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 31 Aug 2018 20:34:06 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 31 Aug 2018 20:34:06 +0900    

Click here for diff

Commit f49842d, which added support for partitionwise joins, built the  
child's tlist by applying adjust_appendrel_attrs() to the parent's.  So in  
the case where the parent's included a whole-row Var for the parent, the  
child's contained a ConvertRowtypeExpr.  To cope with that, that commit  
added code to the planner, such as setrefs.c, but some code paths still  
assumed that the tlist for a scan (or join) rel would only include Vars  
and PlaceHolderVars, which was true before that commit, causing errors:  
  
* When creating an explicit sort node for an input path for a mergejoin  
  path for a child join, prepare_sort_from_pathkeys() threw the 'could not  
  find pathkey item to sort' error.  
* When deparsing a relation participating in a pushed down child join as a  
  subquery in contrib/postgres_fdw, get_relation_column_alias_ids() threw  
  the 'unexpected expression in subquery output' error.  
* When performing set_plan_references() on a local join plan generated by  
  contrib/postgres_fdw for EvalPlanQual support for a pushed down child  
  join, fix_join_expr() threw the 'variable not found in subplan target  
  lists' error.  
  
To fix these, two approaches have been proposed: one by Ashutosh Bapat and  
one by me.  While the former keeps building the child's tlist with a  
ConvertRowtypeExpr, the latter builds it with a whole-row Var for the  
child not to violate the planner assumption, and tries to fix it up later,  
But both approaches need more work, so refuse to generate partitionwise  
join paths when whole-row Vars are involved, instead.  We don't need to  
handle ConvertRowtypeExprs in the child's tlists for now, so this commit  
also removes the changes to the planner.  
  
Previously, partitionwise join computed attr_needed data for each child  
separately, and built the child join's tlist using that data, which also  
required an extra step for adding PlaceHolderVars to that tlist, but it  
would be more efficient to build it from the parent join's tlist through  
the adjust_appendrel_attrs() transformation.  So this commit builds that  
list that way, and simplifies build_joinrel_tlist() and placeholder.c as  
well as part of set_append_rel_size() to basically what they were before  
partitionwise join went in.  
  
Back-patch to PG11 where partitionwise join was introduced.  
  
Report by Rajkumar Raghuwanshi.  Analysis by Ashutosh Bapat, who also  
provided some of regression tests.  Patch by me, reviewed by Robert Haas.  
  
Discussion: https://postgr.es/m/CAKcux6ktu-8tefLWtQuuZBYFaZA83vUzuRd7c1YHC-yEWyYFpg@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/relation.h
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_aggregate.sql
M src/test/regress/sql/partition_join.sql

Fix pg_verify_checksums on Windows.

commit   : bb60f2cb6ed8361fbf18b92d312776046d9b0103    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 31 Aug 2018 15:25:42 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 31 Aug 2018 15:25:42 +0530    

Click here for diff

To verify the checksums, we open the file in text mode which doesn't work  
on Windows as WIN32 treats Control-Z as EOF in files opened in text mode.  
This leads to "short read of block .." error in some cases.  
  
Fix it by opening the files in the binary mode.  
  
Author: Amit Kapila  
Reviewed-by: Magnus Hagander  
Backpatch-through: 11  
Discussion: https://postgr.es/m/CAA4eK1+LOnzod+h85FGmyjWzXKy-XV1FYwEyP-Tky2WpD5cxwA@mail.gmail.com  

M src/bin/pg_verify_checksums/pg_verify_checksums.c

Remove extra word from src/backend/optimizer/README

commit   : 2e39f69b6621bd3d67f650a5647fd0412819712d    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 31 Aug 2018 16:40:17 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 31 Aug 2018 16:40:17 +0900    

Click here for diff

M src/backend/optimizer/README

Add semicolons to end of internally run queries

commit   : 7061e03319d9a31f02d3777ca856b6c33e7a0967    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 30 Aug 2018 19:23:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 30 Aug 2018 19:23:22 +0200    

Click here for diff

This ensures that the --echo output of various tools (under scripts) is  
valid multiline SQL.  
  
Author: Tatsuro Yamada <[email protected]>  

M src/bin/scripts/common.c
M src/include/fe_utils/connect.h

pg_dump: Reorganize getTableAttrs()

commit   : daa9fe8a5264a3f192efa5ddee8fb011ad9da365    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Aug 2018 16:45:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Aug 2018 16:45:32 +0200    

Click here for diff

Instead of repeating the almost same large query in each version branch,  
use one query and add a few columns to the SELECT list depending on the  
version.  This saves a lot of duplication.  
  
Reviewed-by: Tom Lane <[email protected]>  

M src/bin/pg_dump/pg_dump.c

pg_verify_checksums: rename -d to --verbose

commit   : a846e6d0239d24fe9a95c7b12e1905e20f8fdcf0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Aug 2018 06:31:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Aug 2018 06:31:05 -0300    

Click here for diff

Using -d is odd, because we normally reserve that for a database  
argument, so rename it to -v and add long version --verbose.  
  
Also, reduce it to emit one line per file checked rather than one line  
per block.  
  
Per a complaint from Michael Banck.  
  
Author: Yugo Nagata <[email protected]>  
Reviewed-by: Michael Banck <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Mention change of width of values generated by SERIAL sequences

commit   : 4db226b756529ea4d357a4af507c6ed2c31415c0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Aug 2018 05:39:56 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Aug 2018 05:39:56 -0300    

Click here for diff

This changed during pg10 development, but had not been documented.  
  
Co-authored-by: Jonathan S. Katz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Error position support for partition specifications

commit   : 1e5e4efd02b614908cae62d9452528462d307224    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Aug 2018 08:46:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Aug 2018 08:46:58 +0200    

Click here for diff

Add support for error position reporting for partition specifications.  
  
Reviewed-by: Fabien COELHO <[email protected]>  

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

Error position support for defaults and check constraints

commit   : a4a232b1e70229a6ba0e592f6775c019bb171d9a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Aug 2018 08:42:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Aug 2018 08:42:49 +0200    

Click here for diff

Add support for error position reporting for the expressions contained  
in defaults and check constraint definitions.  This currently works only  
for CREATE TABLE, not ALTER TABLE, because the latter is not set up to  
pass around the original query string.  
  
Reviewed-by: Fabien COELHO <[email protected]>  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/include/catalog/heap.h
M src/test/regress/output/constraints.source

Fix IndexInfo comments.

commit   : 4b035841a1bcaadbe4f9e0e174aef773a4fa41f6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Aug 2018 09:08:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 30 Aug 2018 09:08:33 +0300    

Click here for diff

Recently, ii_KeyAttrNumbers was renamed to ii_IndexAttrNumbers, and ii_Am  
field was added, but the comments were not updated.  
  
Author: Yugo Nagata  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/nodes/execnodes.h

Stop bgworkers during fast shutdown with postmaster in startup phase

commit   : 55875b6d2aa0946226e9261ee691cb519d92f8c1    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 29 Aug 2018 17:10:02 -0700    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 29 Aug 2018 17:10:02 -0700    

Click here for diff

When a postmaster gets into its phase PM_STARTUP, it would start  
background workers using BgWorkerStart_PostmasterStart mode immediately,  
which would cause problems for a fast shutdown as the postmaster forgets  
to send SIGTERM to already-started background workers.  With smart and  
immediate shutdowns, this correctly happened, and fast shutdown is the  
only mode missing the shot.  
  
Author: Alexander Kukushkin  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAFh8B=mvnD8+DZUfzpi50DoaDfZRDfd7S=gwj5vU9GYn8UvHkA@mail.gmail.com  
Backpatch-through: 9.5  

M src/backend/postmaster/postmaster.c

Make pg_restore's identify_locking_dependencies() more bulletproof.

commit   : e0a0cc28d0829bea5d339fc2db6ac26ea13d5ab4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 19:46:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 19:46:59 -0400    

Click here for diff

This function had a blacklist of dump object types that it believed  
needed exclusive lock ... but we hadn't maintained that, so that it  
was missing ROW SECURITY, POLICY, and INDEX ATTACH items, all of  
which need (or should be treated as needing) exclusive lock.  
  
Since the same oversight seems likely in future, let's reverse the  
sense of the test so that the code has a whitelist of safe object  
types; better to wrongly assume a command can't be run in parallel  
than the opposite.  Currently the only POST_DATA object type that's  
safe is CREATE INDEX ... and that list hasn't changed in a long time.  
  
Back-patch to 9.5 where RLS came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup_archiver.c

Code review for pg_dump's handling of ALTER INDEX ATTACH PARTITION.

commit   : 8cff4f5348d075e063100071013f00a900c32b0f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 19:33:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 19:33:04 -0400    

Click here for diff

Ensure the TOC entry is marked with the correct schema, so that its  
name is as unique as the index's is.  
  
Fix the dependencies: we want dependencies from this TOC entry to the  
two indexes it depends on, and we don't care (at least not for this  
purpose) what order the indexes are created in.  Also, add dependencies  
on the indexes' underlying tables.  Those might seem pointless given  
the index dependencies, but they are helpful to cue parallel restore  
to avoid running the ATTACH PARTITION in parallel with other DDL on  
the same tables.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Include contrib modules in the temp installation even without REGRESS.

commit   : 42e61c7748eb36b75a05bd0a9a35c370c70a86c8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 17:26:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Aug 2018 17:26:09 -0400    

Click here for diff

Now that we have TAP tests, a contrib module may have something useful  
to do in "make check" even if it has no pg_regress-style regression  
scripts, and hence no REGRESS setting.  But the TAP tests will fail,  
or else test the wrong installed files, unless we install the contrib  
module into the temp installation.  So move the bit about adding to  
EXTRA_INSTALL so that it applies regardless.  
  
We might want this in back branches in future, but for the moment  
I only risked adding it to v11.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/makefiles/pgxs.mk

postgres_fdw: don't push ORDER BY with no vars (bug #15352)

commit   : bf2d0462cd735f76bcf6eb8b399723674b2221ef    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 28 Aug 2018 14:43:51 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 28 Aug 2018 14:43:51 +0100    

Click here for diff

Commit aa09cd242 changed a condition in find_em_expr_for_rel from  
being a bms_equal comparison of relids to bms_is_subset, in order to  
support order by clauses on foreign joins. But this also allows  
through the degenerate case of expressions with no Vars at all (and  
hence empty relids), including integer constants which will be parsed  
unexpectedly on the remote (viz. "ERROR: ORDER BY position 0 is not in  
select list" as in the bug report).  
  
Repair by adding an additional !bms_is_empty test.  
  
Backpatch through to 9.6 where the aforementioned change was made.  
  
Per bug #15352 from Maksym Boguk; analysis and patch by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c

Rework option set of vacuumlo

commit   : bfea331a5e1b993d22071fc1696e6e8811d2d0d4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Aug 2018 21:42:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Aug 2018 21:42:45 +0900    

Click here for diff

Like oid2name, vacuumlo has been lacking consistency with other  
utilities for its options:  
- Connection options gain long aliases.  
- Document environment variables which could be used: PGHOST, PGPORT and  
PGUSER.  
  
Documentation and code is reordered to be more consistent. A basic set  
of TAP tests has been added while on it.  
  
Author: Tatsuro Yamada  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/vacuumlo/.gitignore
M contrib/vacuumlo/Makefile
A contrib/vacuumlo/t/001_basic.pl
M contrib/vacuumlo/vacuumlo.c
M doc/src/sgml/vacuumlo.sgml

Rework option set of oid2name

commit   : 1aaf532deabfa356c99abc80fc78d988ad1f1355    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 28 Aug 2018 21:33:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 28 Aug 2018 21:33:32 +0900    

Click here for diff

oid2name has done little effort to keep an interface consistent with  
other binary utilities:  
- -H was used instead of -h/-host.  This option is now marked as  
deprecated, still its output is accepted to be backward-compatible.  
- -P has been removed from the code, and was still documented.  
- All options gain long aliases, making connection options more similar  
to other binaries.  
- Document environment variables which could be used: PGHOST, PGPORT and  
PGUSER.  
  
A basic set of TAP tests is added on the way, and documentation is  
cleaned up to be more consistent with other things.  
  
Author: Tatsuro Yamada  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/oid2name/.gitignore
M contrib/oid2name/Makefile
M contrib/oid2name/oid2name.c
A contrib/oid2name/t/001_basic.pl
M doc/src/sgml/oid2name.sgml

Avoid quadratic slowdown in regexp match/split functions.

commit   : c8ea87e4bd950572cba4575e9a62284cebf85ac5    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 28 Aug 2018 09:52:25 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 28 Aug 2018 09:52:25 +0100    

Click here for diff

regexp_matches, regexp_split_to_table and regexp_split_to_array all  
work by compiling a list of match positions as character offsets (NOT  
byte positions) in the source string.  
  
Formerly, they then used text_substr to extract the matched text; but  
in a multi-byte encoding, that counts the characters in the string,  
and the characters needed to reach the starting byte position, on  
every call. Accordingly, the performance degraded as the product of  
the input string length and the number of match positions, such that  
splitting a string of a few hundred kbytes could take many minutes.  
  
Repair by keeping the wide-character copy of the input string  
available (only in the case where encoding_max_length is not 1) after  
performing the match operation, and extracting substrings from that  
instead. This reduces the complexity to being linear in the number of  
result bytes, discounting the actual regexp match itself (which is not  
affected by this patch).  
  
In passing, remove cleanup using retail pfree() which was obsoleted by  
commit ff428cded (Feb 2008) which made cleanup of SRF multi-call  
contexts automatic. Also increase (to ~134 million) the maximum number  
of matches and provide an error message when it is reached.  
  
Backpatch all the way because this has been wrong forever.  
  
Analysis and patch by me; review by Kaiting Chen.  
  
Discussion: https://postgr.es/m/[email protected]  
  
see also https://postgr.es/m/[email protected]  

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

pg_verify_checksums: Message style improvements and NLS support

commit   : 3e2ceb231ef0bbd04bb98aa3d3b58ebcac88c00a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Aug 2018 11:49:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Aug 2018 11:49:11 +0200    

Click here for diff

The source code was already set up for NLS support, so just a nls.mk  
file needed to be added.  Also, fix the old problem of putting the int64  
format specifier right into the string, which breaks NLS.  

A src/bin/pg_verify_checksums/nls.mk
M src/bin/pg_verify_checksums/pg_verify_checksums.c

Code review for simplehash.h.

commit   : ee0e2745c2f2c8ac47250dde718ac712686a79aa    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 28 Aug 2018 12:32:22 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 28 Aug 2018 12:32:22 +1200    

Click here for diff

Fix reference to non-existent file in comment.  
  
Add SH_ prefix to the EMPTY and IN_USE tokens, to reduce likelihood of  
collisions with unrelated macros.  
  
Add include guards around the function definitions that are not  
"parameterized", so the header can be used again in the same translation  
unit.  
  
Undefine SH_EQUAL macro where other "parameter" macros are undefined, for  
the same reason.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAEepm%3D1LdXZ3mMTM8tHt_b%3DK1kREit%3Dp8sikesak%3DkzHHM07Nw%40mail.gmail.com  

M src/include/lib/simplehash.h

Fix snapshot leak warning for some procedures

commit   : 7a3b7bbfded3142aaa8edae2dbc88999568cc1cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 15:13:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 15:13:48 +0200    

Click here for diff

The problem arises with the combination of CALL with output parameters  
and doing a COMMIT inside the procedure.  When a CALL has output  
parameters, the portal uses the strategy PORTAL_UTIL_SELECT instead of  
PORTAL_MULTI_QUERY.  Using PORTAL_UTIL_SELECT causes the portal's  
snapshot to be registered with the current resource  
owner (portal->holdSnapshot); see  
9ee1cf04ab6bcefe03a11837b53f29ca9dc24c7a for the reason.  
  
Normally, PortalDrop() unregisters the snapshot.  If not, then  
ResourceOwnerRelease() will print a warning about a snapshot leak on  
transaction commit.  A transaction commit normally drops all  
portals (PreCommit_Portals()), except the active portal.  So in case of  
the active portal, we need to manually release the snapshot to avoid the  
warning.  
  
Reported-by: Prabhat Sahu <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  

M src/backend/utils/mmgr/portalmem.c
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Fix missing dependency for pg_dump's ENABLE ROW LEVEL SECURITY items.

commit   : cbdca00bef59ee204313fe8f0e4f36bc804a38aa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Aug 2018 15:11:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Aug 2018 15:11:12 -0400    

Click here for diff

The archive should show a dependency on the item's table, but it failed  
to include one.  This could cause failures in parallel restore due to  
emitting ALTER TABLE ... ENABLE ROW LEVEL SECURITY before restoring  
the table's data.  In practice the odds of a problem seem low, since  
you would typically need to have set FORCE ROW LEVEL SECURITY as well,  
and you'd also need a very high --jobs count to have any chance of this  
happening.  That probably explains the lack of field reports.  
  
Still, it's a bug, so back-patch to 9.5 where RLS was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Add some not null constraints to catalogs

commit   : 9b39b799db781642dd0c1424c28e827d19663e20    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Aug 2018 16:21:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Aug 2018 16:21:23 +0200    

Click here for diff

Use BKI_FORCE_NOT_NULL on some catalog field declarations that are never  
null (according to the source code that accesses them).  

M src/include/catalog/catversion.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_rewrite.h

Improve VACUUM and ANALYZE by avoiding early lock queue

commit   : a556549d7e6dce15fe216bd4130ea64239f4d83f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Aug 2018 09:11:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Aug 2018 09:11:12 +0900    

Click here for diff

A caller of VACUUM can perform early lookup obtention which can cause  
other sessions to block on the request done, causing potentially DOS  
attacks as even a non-privileged user can attempt a vacuum fill of a  
critical catalog table to block even all incoming connection attempts.  
  
Contrary to TRUNCATE, a client could attempt a system-wide VACUUM after  
building the list of relations to VACUUM, which can cause vacuum_rel()  
or analyze_rel() to try to lock the relation but the operation would  
just block.  When the client specifies a list of relations and the  
relation needs to be skipped, ownership checks are done when building  
the list of relations to work on, preventing a later lock attempt.  
  
vacuum_rel() already had the sanity checks needed, except that those  
were applied too late.  This commit refactors the code so as relation  
skips are checked beforehand, making it safer to avoid too early locks,  
for both manual VACUUM with and without a list of relations specified.  
  
An isolation test is added emulating the fact that early locks do not  
happen anymore, issuing a WARNING message earlier if the user calling  
VACUUM is not a relation owner.  
  
When a partitioned table is listed in a manual VACUUM or ANALYZE  
command, its full list of partitions is fetched, all partitions get  
added to the list to work on, and then each one of them is processed one  
by one, with ownership checks happening at the later phase of  
vacuum_rel() or analyze_rel().  Trying to do early ownership checks for  
each partition is proving to be tedious as this would result in deadlock  
risks with lock upgrades, and skipping all partitions if the listed  
partitioned table is not owned would result in a behavior change  
compared to how Postgres 10 has implemented vacuum for partitioned  
tables.  The original problem reported related to early lock queue for  
critical relations is fixed anyway, so priority is given to avoiding a  
backward-incompatible behavior.  
  
Reported-by: Lloyd Albin, Jeremy Schneider  
Author: Michael Paquier  
Reviewed by: Nathan Bossart, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h
A src/test/isolation/expected/vacuum-conflict.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/vacuum-conflict.spec

Fix typos.

commit   : 18e586741b41713bec31effbde96ccd6da0a4361    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 27 Aug 2018 09:32:59 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 27 Aug 2018 09:32:59 +1200    

Click here for diff

Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f8du35u5DprpykWvgNEScxapbWYJdHq%2Bz06Wj3Y2KFPbw%40mail.gmail.com  

M src/backend/partitioning/partprune.c
M src/backend/statistics/dependencies.c
M src/backend/utils/adt/geo_spgist.c

Make syslogger more robust against failures in opening CSV log files.

commit   : bff84a547d71cd466c21f9c4625e64340aab7dd2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Aug 2018 14:21:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Aug 2018 14:21:55 -0400    

Click here for diff

The previous coding figured it'd be good enough to postpone opening  
the first CSV log file until we got a message we needed to write there.  
This is unsafe, though, because if the open fails we end up in infinite  
recursion trying to report the failure.  Instead make the CSV log file  
management code look as nearly as possible like the longstanding logic  
for the stderr log file.  In particular, open it immediately at postmaster  
startup (if enabled), or when we get a SIGHUP in which we find that  
log_destination has been changed to enable CSV logging.  
  
It seems OK to fail if a postmaster-start-time open attempt fails, as  
we've long done for the stderr log file.  But we can't die if we fail  
to open a CSV log file during SIGHUP, so we're still left with a problem.  
In that case, write any output meant for the CSV log file to the stderr  
log file.  (This will also cover race-condition cases in which backends  
send CSV log data before or after we have the CSV log file open.)  
  
This patch also fixes an ancient oversight that, if CSV logging was  
turned off during a SIGHUP, we never actually closed the last CSV  
log file.  
  
In passing, remember to reset whereToSendOutput = DestNone during syslogger  
start, since (unlike all other postmaster children) it's forked before the  
postmaster has done that.  This made for a platform-dependent difference  
in error reporting behavior between the syslogger and other children:  
except on Windows, it'd report problems to the original postmaster stderr  
as well as the normal error log file(s).  It's barely possible that that  
was intentional at some point; but it doesn't seem likely to be desirable  
in production, and the platform dependency definitely isn't desirable.  
  
Per report from Alexander Kukushkin.  It's been like this for a long time,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAFh8B==iLUD_gqC-dAENS0V+kVrCeGiKujtKqSQ7++S-caaChw@mail.gmail.com  

M src/backend/postmaster/syslogger.c

Reconsider new file extension in commit 91f26d5f.

commit   : ba9d35b8eb8466cf445c732a2e15ca5790cbc6c6    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 25 Aug 2018 22:45:59 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 25 Aug 2018 22:45:59 -0700    

Click here for diff

Andres and Tom objected to the choice of the ".tmp"  
extension. Changing to Andres's suggestion of ".spill".  
  
Discussion: https://postgr.es/m/88092095-3348-49D8-8746-EB574B1D30EA%40anarazel.de  

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

doc: "Latest checkpoint location" will not match in pg_upgrade

commit   : cc2e457fe8a3f685b4f9b9dce05b0c027b39459f    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 13:35:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 13:35:14 -0400    

Click here for diff

Mention that "Latest checkpoint location" will not match in pg_upgrade  
if the standby server is still running during the upgrade, which is  
possible.  "Match" text first appeared in PG 9.5.  
  
Reported-by: Paul Bonaud  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.5  

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

commit   : dcb2efdbdd8fe46be35069ea58acebbc4ff2723a    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 13:01:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 13:01:24 -0400    

Click here for diff

Reported-by: Ashutosh Sharma  
  
Discussion: https://postgr.es/m/CAE9k0PnhnL6MNDLuvkk8USzOa_DpzDzFQPAM_uaGuXbh9HMKYw@mail.gmail.com  
  
Author: Ashutosh Sharma  
  
Backpatch-through: 9.3  

M doc/src/sgml/information_schema.sgml

Change extension of spilled ReorderBufferChange data to ".tmp".

commit   : 91f26d5fe47e3b06e878f2f1949cbd35e9576c16    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 25 Aug 2018 09:19:21 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 25 Aug 2018 09:19:21 -0700    

Click here for diff

The previous extension, ".snap", was chosen for historical reasons and  
became confusing.  
  
Discussion: https://postgr.es/m/CAMp0ubd_P8vBGx8=MfDXQJZxHA5D_Zarw5cCkDxJ_63+pWRJ9w@mail.gmail.com  

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

Comment fix for rewriteheap.h.

commit   : e75733d46c8444c0f5c9578bdf576b29039aac1f    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 25 Aug 2018 08:53:33 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 25 Aug 2018 08:53:33 -0700    

Click here for diff

The description of the filename for mapping files did not match the  
code.  

M src/include/access/rewriteheap.h

docs: Clarify pg_ctl initdb option text to match options proto.

commit   : 7abf8ee1e841684cd51472a7476b3f6b9441e70f    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 12:01:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 12:01:53 -0400    

Click here for diff

The options string appeared in PG 10.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

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

docs: clarify plpython SD and GD dictionary behavior

commit   : a6ca9c2a1bd0d57e8f359504e91ee0208f65ed58    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 11:52:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 Aug 2018 11:52:30 -0400    

Click here for diff

Reported-by: Adam Bielański  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/plpython.sgml

Remove test for VA_ARGS, implied by C99.

commit   : 8ecdefc261abbd35d6280cdd8fd749e83c3fd199    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 24 Aug 2018 10:41:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 24 Aug 2018 10:41:45 -0700    

Click here for diff

This simplifies logic / reduces duplication in a few headers.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.in
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/utils/elog.h
M src/pl/plpython/plpy_elog.h

LLVMJIT: LLVMGetHostCPUFeatures now is upstream, use LLMV version if available.

commit   : cb92520563834577d3afbbedcc0df4ee0aac3445    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 24 Aug 2018 10:20:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 24 Aug 2018 10:20:55 -0700    

Click here for diff

Noticed thanks to buildfarm animal seawasp.  
  
Author: Andres Freund  
Backpatch: v11-, where LLVM based JIT compliation was introduced.  

M config/llvm.m4
M configure
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/include/jit/llvmjit.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Suppress uninitialized-variable warning in new SCRAM code.

commit   : b0c5da615ec45bcd24b97a1d55b1f489b9830a4b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 24 Aug 2018 10:51:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 24 Aug 2018 10:51:10 -0400    

Click here for diff

While we generally don't sweat too much about "may be used uninitialized"  
warnings from older compilers, I noticed that there's a fair number of  
buildfarm animals that are producing such a warning *only* for this  
variable.  So it seems worth silencing.  

M src/backend/libpq/auth.c

Fix documentation for run-time partition pruning

commit   : db72302b0a846b0790ddc487c109d7c0880d4bcc    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 Aug 2018 22:54:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 Aug 2018 22:54:07 +0900    

Click here for diff

Since 5220bb7, not only Append, but also MergeAppend support the  
operation.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Introduce minimal C99 usage to verify compiler support.

commit   : 143290efd0795b61ed2c8358fc1767e799140047    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Aug 2018 18:36:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Aug 2018 18:36:07 -0700    

Click here for diff

This just converts a few for loops in postgres.c to declare variables  
in the loop initializer, and uses designated initializers in smgr.c's  
definition of smgr callbacks.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Require C99 (and thus MSCV 2013 upwards).

commit   : d9dd406fe281d22d5238d3c26a7182543c711e74    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Aug 2018 18:33:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Aug 2018 18:33:40 -0700    

Click here for diff

In 86d78ef50e01 I enabled configure to check for C99 support, with the  
goal of checking which platforms support C99.  While there are a few  
machines without C99 support among our buildfarm animals,  
de-supporting them for v12 was deemed acceptable.  
  
While not tested in aforementioned commit, the biggest increase in  
minimum compiler version comes from MSVC, which gained C99 support  
fairly late. The subset in MSVC 2013 is sufficient for our needs, at  
this point. While that is a significant increase in minimum version,  
the existing windows binaries are already built with a new enough  
version.  
  
Make configure error out if C99 support could not be detected. For  
MSVC builds, increase the minimum version to 2013.  
  
The increase to MSVC 2013 allows us to get rid of VCBuildProject.pm,  
as that was only required for MSVC 2005/2008.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/sources.sgml
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/README
M src/tools/msvc/Solution.pm
D src/tools/msvc/VCBuildProject.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/build.pl

Add more tests for VACUUM skips with partitioned tables

commit   : a569eea6998a26689409ff6eb5fce2c1eab0f5e1    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 Aug 2018 09:15:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 Aug 2018 09:15:08 +0900    

Click here for diff

A VACUUM or ANALYZE command listing directly a partitioned table expands  
it to its partitions, causing all elements of a tree to be processed  
with individual ownership checks done.  This results in different  
relation skips depending on the ownership policy of a tree, which may  
not be consistent for a partition tree.  This commit adds more tests to  
ensure that any future refactoring allows to keep a consistent behavior,  
or at least that any changes done are easily identified and checked.  
The current behavior of VACUUM with partitioned tables is present since  
10.  
  
Author: Nathan Bossart  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Deduplicate code between slot_getallattrs() and slot_getsomeattrs().

commit   : 88ebd62fcc2ea7c55c0858f6dd4800d51383529f    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 23 Aug 2018 16:58:53 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 23 Aug 2018 16:58:53 -0700    

Click here for diff

Code in slot_getallattrs() is the same as if slot_getsomeattrs() is  
called with number of attributes specified in the tuple  
descriptor. Implement it that way instead of duplicating the code  
between those two functions.  
  
This is part of a patchseries abstracting TupleTableSlots so they can  
store arbitrary forms of tuples, but is a nice enough cleanup on its  
own.  
  
Author: Ashutosh Bapat  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/heaptuple.c
M src/include/executor/tuptable.h

Fix lexing of standard multi-character operators in edge cases.

commit   : a40631a920accbcca1a49a909d380308d95b4674    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 23 Aug 2018 18:29:18 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 23 Aug 2018 18:29:18 +0100    

Click here for diff

Commits c6b3c939b (which fixed the precedence of >=, <=, <> operators)  
and 865f14a2d (which added support for the standard => notation for  
named arguments) created a class of lexer tokens which look like  
multi-character operators but which have their own token IDs distinct  
from Op. However, longest-match rules meant that following any of  
these tokens with another operator character, as in (1<>-1), would  
cause them to be incorrectly returned as Op.  
  
The error here isn't immediately obvious, because the parser would  
usually still find the correct operator via the Op token, but there  
were more subtle problems:  
  
1. If immediately followed by a comment or +-, >= <= <> would be given  
   the old precedence of Op rather than the correct new precedence;  
  
2. If followed by a comment, != would be returned as Op rather than as  
   NOT_EQUAL, causing it not to be found at all;  
  
3. If followed by a comment or +-, the => token for named arguments  
   would be lexed as Op, causing the argument to be mis-parsed as a  
   simple expression, usually causing an error.  
  
Fix by explicitly checking for the operators in the {operator} code  
block in addition to all the existing special cases there.  
  
Backpatch to 9.5 where the problem was introduced.  
  
Analysis and patch by me; review by Tom Lane.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/test/regress/expected/create_operator.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/sql/create_operator.sql
M src/test/regress/sql/polymorphism.sql

Reduce an unnecessary O(N^3) loop in lexer.

commit   : d4a63f829702cf28adb5db7e2ed44d2d9d893451    
  
author   : Andrew Gierth <[email protected]>    
date     : Thu, 23 Aug 2018 16:35:33 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Thu, 23 Aug 2018 16:35:33 +0100    

Click here for diff

The lexer's handling of operators contained an O(N^3) hazard when  
dealing with long strings of + or - characters; it seems hard to  
prevent this case from being O(N^2), but the additional N multiplier  
was not needed.  
  
Backpatch all the way since this has been there since 7.x, and it  
presents at least a mild hazard in that trying to do Bind, PREPARE or  
EXPLAIN on a hostile query could take excessive time (without  
honouring cancels or timeouts) even if the query was never executed.  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l

In libpq, don't look up all the hostnames at once.

commit   : 5ca00774194dc179d02867d536b73eb85fffd227    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 Aug 2018 16:39:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 Aug 2018 16:39:19 -0400    

Click here for diff

Historically, we looked up the target hostname in connectDBStart, so that  
PQconnectPoll did not need to do DNS name resolution.  The patches that  
added multiple-target-host support to libpq preserved this division of  
labor; but it's really nonsensical now, because it means that if any one  
of the target hosts fails to resolve in DNS, the connection fails.  That  
negates the no-single-point-of-failure goal of the feature.  Additionally,  
DNS lookups aren't exactly cheap, but the code did them all even if the  
first connection attempt succeeds.  
  
Hence, rearrange so that PQconnectPoll does the lookups, and only looks  
up a hostname when it's time to try that host.  This does mean that  
PQconnectPoll could block on a DNS lookup --- but if you wanted to avoid  
that, you should be using hostaddr, as the documentation has always  
specified.  It seems fairly unlikely that any applications would really  
care whether the lookup occurs inside PQconnectStart or PQconnectPoll.  
  
In addition to calling out that fact explicitly, do some other minor  
wordsmithing in the docs around the multiple-target-host feature.  
  
Since this seems like a bug in the multiple-target-host feature,  
backpatch to v10 where that was introduced.  In the back branches,  
avoid moving any existing fields of struct pg_conn, just in case  
any third-party code is looking into that struct.  
  
Tom Lane, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

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

Copy-editing of pg_verify_checksums help and ref page

commit   : 2d41d914ab70cfd45f89bc1fdf682144efa001b2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 20:32:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 20:32:56 +0200    

Click here for diff

Reformat synopsis, put options into better order, make the desciption  
line a bit shorter, and put more details into the description.  

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

PL/pgSQL: Extend test case

commit   : d2cc897b3da9358f850dd9fa5a1a6c7ebc7bd0cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 17:20:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Aug 2018 17:20:47 +0200    

Click here for diff

This test was supposed to check the interaction of INOUT and default  
parameters in a procedure call, but it only checked the case where the  
parameter was not supplied.  Now it also checks the case where the  
parameter was supplied.  It was already working correctly, so no code  
changes required.  

M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/sql/plpgsql_call.sql

Return type of txid_status is text, not txid_status

commit   : d10f7741650de3199033702c3fe98a6896fd32a9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 23 Aug 2018 11:40:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 23 Aug 2018 11:40:30 -0300    

Click here for diff

Thinko in commit 857ee8e39.  
  
Discovered-by: Gianni Ciolli  

M doc/src/sgml/func.sgml

doc: Clarify some wording in PL/pgSQL about transactions

commit   : 7ceb6fb84c8cfd49c5ba92dda1c1669ba8fa687f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Aug 2018 15:42:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Aug 2018 15:42:22 +0200    

Click here for diff

Some text was still claiming that committing transactions was not  
possible in PL/pgSQL.  

M doc/src/sgml/plpgsql.sgml

Change PROCEDURE to FUNCTION in CREATE TRIGGER syntax

commit   : 0a63f996e018ac508c858e87fa39cc254a5db49f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 23:08:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 23:08:34 +0200    

Click here for diff

Since procedures are now a different thing from functions, change the  
CREATE TRIGGER and CREATE EVENT TRIGGER syntax to use FUNCTION in the  
clause that specifies the function.  PROCEDURE is still accepted for  
compatibility.  
  
pg_dump and ruleutils.c output is not changed yet, because that would  
require a change in information_schema.sql and thus a catversion change.  
  
Reported-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/lo.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/create_event_trigger.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/tcn.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/trigger.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Change PROCEDURE to FUNCTION in CREATE OPERATOR syntax

commit   : d12782898eb5979bef3c6dd0d80b93d1aaf53cac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 18:05:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 18:05:46 +0200    

Click here for diff

Since procedures are now a different thing from functions, change the  
CREATE OPERATOR syntax to use FUNCTION in the clause that specifies the  
function.  PROCEDURE is still accepted for compatibility.  
  
Reported-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  

M doc/src/sgml/extend.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/xoper.sgml
M src/backend/commands/operatorcmds.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/create_operator.out
M src/test/regress/sql/create_operator.sql

doc: Update uses of the word "procedure"

commit   : b19495772e48ecd32de9a906ddf8c25e16007575    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 17:01:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Aug 2018 17:01:39 +0200    

Click here for diff

Historically, the term procedure was used as a synonym for function in  
Postgres/PostgreSQL.  Now we have procedures as separate objects from  
functions, so we need to clean up the documentation to not mix those  
terms.  
  
In particular, mentions of "trigger procedures" are changed to "trigger  
functions", and access method "support procedures" are changed to  
"support functions".  (The latter already used FUNCTION in the SQL  
syntax anyway.)  Also, the terminology in the SPI chapter has been  
cleaned up.  
  
A few tests, examples, and code comments are also adjusted to be  
consistent with documentation changes, but not everything.  
  
Reported-by: Peter Geoghegan <[email protected]>  
Reviewed-by: Jonathan S. Katz <[email protected]>  

M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/ref/alter_opfamily.sgml
M doc/src/sgml/ref/create_language.sgml
M doc/src/sgml/ref/create_opclass.sgml
M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/spi.sgml
M doc/src/sgml/xindex.sgml
M doc/src/sgml/xplang.sgml
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/commands/opclasscmds.c
M src/bin/psql/describe.c
M src/include/access/hash.h
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/create_operator.out
M src/test/regress/sql/create_operator.sql

Wrap long line in postgresql.conf.sample.

commit   : af63926cf577f4c30e43b7651e93e3a5eaa262e0    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 22 Aug 2018 21:28:39 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 22 Aug 2018 21:28:39 +1200    

Click here for diff

Per complaint from Michael Paquier.  

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

Provide plan_cache_mode options in postgresql.conf.sample.

commit   : f9fe269ca21808c1f6a3d0d23936fa4eaf2b3839    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 22 Aug 2018 18:19:39 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 22 Aug 2018 18:19:39 +1200    

Click here for diff

Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f8YkwojSTSg8YjNYCLCXzx0fR7wBR3Gf%2BrA9_52eoPZKg%40mail.gmail.com  

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

Do not dump identity sequences with excluded parent table

commit   : b965f2617184032687037547204e1db1c1e1a56c    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Aug 2018 14:21:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Aug 2018 14:21:49 +0900    

Click here for diff

This commit prevents a crash of pg_dump caused by the exclusion of a  
table which has identity columns, as the table would be correctly  
excluded but not its identity sequence.  In order to fix that, identity  
sequences are excluded if the parent table is defined as such.  Knowing  
about such sequences has no meaning without their parent table anyway.  
  
Reported-by: Andy Abelisto  
Author: David Rowley  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/bin/pg_dump/pg_dump.c

Add regression tests for VACUUM and ANALYZE with relation skips

commit   : 98abc738027e866f89b0ecf6f6a30b16e000e804    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Aug 2018 09:41:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Aug 2018 09:41:37 +0900    

Click here for diff

When a user does not have ownership on a relation, then specific log  
messages are generated.  This new test suite adds coverage for all the  
possible log messages generated, which will be useful to check the  
consistency of any refactoring related to ownership checks for relations  
vacuumed or analyzed.  
  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

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

Fix typo

commit   : 55a0154efdf05ccca676455f7c51965d8eaf1d76    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:16:10 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:16:10 -0300    

Click here for diff

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

fix typo

commit   : 083651da17a712f8febd05264a339a8fce310515    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:03:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:03:35 -0300    

Click here for diff

M src/backend/access/hash/README

Fix typo

commit   : 69c7890441d2ababf7fd71ad8d9b75fd08b015de    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:00:54 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Aug 2018 17:00:54 -0300    

Click here for diff

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

Fix set of NLS translation issues

commit   : 72be8c29a18812975fcc8765a122faf0e4d0c755    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 15:17:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 15:17:13 +0900    

Click here for diff

While monitoring the code, a couple of issues related to string  
translation has showed up:  
- Some routines for auto-updatable views return an error string, which  
sometimes missed the shot.  A comment regarding string translation is  
added for each routine to help with future features.  
- GSSAPI authentication missed two translations.  
- vacuumdb handles non-translated strings.  
- GetConfigOptionByNum should translate strings.  This part is not  
back-patched as after a minor upgrade this could be surprising for  
users.  
  
Reported-by: Kyotaro Horiguchi  
Author: Kyotaro Horiguchi  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/backend/libpq/auth.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/misc/guc.c
M src/bin/scripts/vacuumdb.c

Fix typo in description of enable_parallel_hash

commit   : d8c83800c3ed2f0d677eb6620a9e9dc7b81a678b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 12:13:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 12:13:16 +0900    

Click here for diff

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

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

Clarify comment about assignment and reset of temp namespace ID in MyProc

commit   : 1339fcc896173407d6930dffbc185fe08f1ae86b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 08:32:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Aug 2018 08:32:18 +0900    

Click here for diff

The new wording comes from Álvaro, which I modified a bit.  
  
Reported-by: Andres Freund, Álvaro Herrera  
Author: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/backend/catalog/namespace.c

MSVC: Finish clean.bat tmp_check coverage.

commit   : f3efef434fb107dfec8b7e225779479e39a5a360    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 19 Aug 2018 01:12:22 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 19 Aug 2018 01:12:22 -0700    

Click here for diff

Use wildcards, so one can add a TAP test suite without updating this  
file.  Back-patch to v11, which omitted multiple new suites.  

M src/tools/msvc/clean.bat

MSVC: Remove any tmp_check directory before running a TAP test suite.

commit   : a53f0edd64d0b11abc4a87681ba85669ae90ce1f    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 19 Aug 2018 01:12:22 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 19 Aug 2018 01:12:22 -0700    

Click here for diff

Back-patch to v11, where commit 90627cf98a8e7d0531789391fd798c9bfcc3bc1a  
made the GNU make build system do likewise.  Without this, when a  
typical PostgresNode-using test failed, subsequent runs bailed out with  
a "File exists" error.  

M src/tools/msvc/vcregress.pl

Improve error messages for CREATE OR REPLACE PROCEDURE

commit   : d83423db869900ffa2470826de5f8255d45ff9c6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Aug 2018 20:39:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Aug 2018 20:39:26 +0200    

Click here for diff

Change the hint to recommend DROP PROCEDURE instead of FUNCTION.  Also  
make the error message when changing the return type more specific to  
the case of procedures.  
  
Reported-by: Jeremy Evans <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  

M src/backend/catalog/pg_proc.c

Doc: remove obsolete advice about manually inserting snprintf into build.

commit   : 47183265ed745d9ee7e0ac0798a5c88660436d4e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Aug 2018 14:02:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Aug 2018 14:02:35 -0400    

Click here for diff

This para is obsolete, first because nobody is using Solaris 7 anymore,  
and second because if someone was, configure should catch the snprintf  
buffer overrun problem automatically (since commit 9bed827b1), and third  
because this is incorrect advice about how to manually force use of  
snprintf.c anyway, and has been so at least since commit 3bc6bdf32.  
The lack of complaints about it reinforces the conclusion that Solaris 7  
no longer exists in the wild; so I don't feel a need to insert correct  
advice instead.  

M doc/src/sgml/installation.sgml

Ensure schema qualification in pg_restore DISABLE/ENABLE TRIGGER commands.

commit   : 6771c932cf5a8bbb8219461066987ad3b11688ff    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Aug 2018 17:12:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Aug 2018 17:12:21 -0400    

Click here for diff

Previously, this code blindly followed the common coding pattern of  
passing PQserverVersion(AH->connection) as the server-version parameter  
of fmtQualifiedId.  That works as long as we have a connection; but in  
pg_restore with text output, we don't.  Instead we got a zero from  
PQserverVersion, which fmtQualifiedId interpreted as "server is too old to  
have schemas", and so the name went unqualified.  That still accidentally  
managed to work in many cases, which is probably why this ancient bug went  
undetected for so long.  It only became obvious in the wake of the changes  
to force dump/restore to execute with restricted search_path.  
  
In HEAD/v11, let's deal with this by ripping out fmtQualifiedId's server-  
version behavioral dependency, and just making it schema-qualify all the  
time.  We no longer support pg_dump from servers old enough to need the  
ability to omit schema name, let alone restoring to them.  (Also, the few  
callers outside pg_dump already didn't work with pre-schema servers.)  
  
In older branches, that's not an acceptable solution, so instead just  
tweak the DISABLE/ENABLE TRIGGER logic to ensure it will schema-qualify  
its output regardless of server version.  
  
Per bug #15338 from Oleg somebody.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/scripts/common.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h

InsertPgAttributeTuple() to set attcacheoff

commit   : e4597ee65d683e11a57a4b7f597807ebf44b6cf1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jul 2018 09:48:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 17 Jul 2018 09:48:29 +0200    

Click here for diff

InsertPgAttributeTuple() is the interface between in-memory tuple  
descriptors and on-disk pg_attribute, so it makes sense to give it the  
job of resetting attcacheoff.  This avoids having all the callers having  
to do so.  
  
Reviewed-by: Tom Lane <[email protected]>  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/tablecmds.c

Set scan direction appropriately for SubPlans (bug #15336)

commit   : 520acab171244b55d816c70b9a89280b09937925    
  
author   : Andrew Gierth <[email protected]>    
date     : Fri, 17 Aug 2018 15:04:26 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Fri, 17 Aug 2018 15:04:26 +0100    

Click here for diff

When executing a SubPlan in an expression, the EState's direction  
field was left alone, resulting in an attempt to execute the subplan  
backwards if it was encountered during a backwards scan of a cursor.  
Also, though much less likely, it was possible to reach the execution  
of an InitPlan while in backwards-scan state.  
  
Repair by saving/restoring estate->es_direction and forcing forward  
scan mode in the relevant places.  
  
Backpatch all the way, since this has been broken since 8.3 (prior to  
commit c7ff7663e, SubPlans had their own EStates rather than sharing  
the parent plan's, so there was no confusion over scan direction).  
  
Per bug #15336 reported by Vladimir Baranoff; analysis and patch by  
me, review by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeSubplan.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Fix configure's snprintf test so it exposes HP-UX bug.

commit   : 9bed827b18cc4f27fb7cd7c02ad301519eca6d29    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Aug 2018 10:37:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Aug 2018 10:37:59 -0400    

Click here for diff

Since commit e1d19c902, buildfarm member gharial has been failing with  
symptoms indicating that snprintf sometimes returns -1 for buffer  
overrun, even though it passes the added configure check.  Some  
google research suggests that this happens only in limited cases,  
such as when the overrun happens partway through a %d item.  Adjust  
the configure check to exercise it that way.  Since I'm now feeling  
more paranoid than I was before, also make the test explicitly verify  
that the buffer doesn't get physically overrun.  

M config/c-library.m4
M configure

pg_upgrade: issue helpful error message for use on standbys

commit   : b94f7b5350e97ef0587c0c64aed6eb940d964c06    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 17 Aug 2018 10:25:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 17 Aug 2018 10:25:48 -0400    

Click here for diff

Commit 777e6ddf1723306bd2bf8fe6f804863f459b0323 checked for a shut down  
message from a standby and allowed it to continue.  This patch reports a  
helpful error message in these cases, suggesting to use rsync as  
documented.  
  
Diagnosed-by: Martín Marqués  
  
Discussion: https://postgr.es/m/CAPdiE1xYCow-reLjrhJ9DqrMu-ppNq0ChUUEvVdxhdjGRD5_eA@mail.gmail.com  
  
Backpatch-through: 9.3  

M src/bin/pg_upgrade/controldata.c

Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

commit   : ee80124811908ef1d4679296c46e36bd8a32b9de    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Aug 2018 11:29:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Aug 2018 11:29:15 +0900    

Click here for diff

Author: Dian Fay  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.3  

M doc/src/sgml/ref/refresh_materialized_view.sgml

Proof-reading for documentation.

commit   : 96e98fa2606b2b12805db99196f468152312af14    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 17 Aug 2018 11:32:55 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 17 Aug 2018 11:32:55 +1200    

Click here for diff

Somebody accidentally a word.  Back-patch to 9.6.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20180816195431.GA23707%40telsasoft.com  

M doc/src/sgml/parallel.sgml

Remove unused configure test for ldopen()

commit   : 9d0aa4f4d22a4feddbf7c05308fe32b32d14c13f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Aug 2018 17:10:18 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Aug 2018 17:10:18 +0200    

Click here for diff

unused since f2cc453dd7e87e800a62a173dea0353bf106668d  

M configure
M configure.in

Use the built-in float datatypes to implement geometric types

commit   : c4c34008854654279ec30067d72fc5d174d2f42f    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 16 Aug 2018 19:56:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 16 Aug 2018 19:56:11 +0200    

Click here for diff

This patch makes the geometric operators and functions use the exported  
function of the float4/float8 datatypes.  The main reason of doing so is  
to check for underflow and overflow, and to handle NaNs consciously.  
  
The float datatypes consider NaNs values to be equal and greater than  
all non-NaN values.  This change considers NaNs equal only for equality  
operators.  The placement operators, contains, overlaps, left/right of  
etc. continue to return false when NaNs are involved.  We don't need  
to worry about them being considered greater than any-NaN because there  
aren't any basic comparison operators like less/greater than for the  
geometric datatypes.  
  
The changes may be summarised as:  
  
* Check for underflow, overflow and division by zero  
* Consider NaN values to be equal  
* Return NULL when the distance is NaN for all closest point operators  
* Favour not-NaN over NaN where it makes sense  
  
The patch also replaces all occurrences of "double" as "float8".  They  
are the same, but were used inconsistently in the same file.  
  
Author: Emre Hasegeli  
Reviewed-by: Kyotaro Horiguchi, Tomas Vondra  
  
Discussion: https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com  

M src/backend/access/gist/gistproc.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_spgist.c
M src/include/utils/geo_decls.h

Remove remaining GEODEBUG references from geo_ops.c

commit   : a082aed0723c737ec65222730ccede5db5251b4d    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 16 Aug 2018 19:55:43 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 16 Aug 2018 19:55:43 +0200    

Click here for diff

Commit a7dc63d904a6044d299aebdf59ad3199b6a9e99d removed most of the  
GEODEBUG occurrences, but there were a couple remaining. So remove  
them too, to get rid of the macro entirely.  
  
Author: Emre Hasegeli  
  
Discussion: https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com  

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

commit   : e1d19c902e59ad739cb4b6267ee2073a61e86cd3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Aug 2018 13:01:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Aug 2018 13:01:09 -0400    

Click here for diff

Since our substitute snprintf now returns a C99-compliant result,  
there's no need anymore to have complicated code to cope with pre-C99  
behavior.  We can just make configure substitute snprintf.c if it finds  
that the system snprintf() is pre-C99.  (Note: I do not believe that  
there are any platforms where this test will trigger that weren't  
already being rejected due to our other C99-ish feature requirements for  
snprintf.  But let's add the check for paranoia's sake.)  Then, simplify  
the call sites that had logic to cope with the pre-C99 definition.  
  
I also dropped some stuff that was being paranoid about the possibility  
of snprintf overrunning the given buffer.  The only reports we've ever  
heard of that being a problem were for Solaris 7, which is long dead,  
and we've sure not heard any reports of these assertions triggering in  
a long time.  So let's drop that complexity too.  
  
Likewise, drop some code that wasn't trusting snprintf to set errno  
when it returns -1.  That would be not-per-spec, and again there's  
no real reason to believe it is a live issue, especially not for  
snprintfs that pass all of configure's feature checks.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-library.m4
M configure
M configure.in
M src/backend/utils/misc/guc.c
M src/common/psprintf.c
M src/interfaces/libpq/pqexpbuffer.c

Fix executor prune failure when plan already pruned

commit   : 1eb9221585c25cad1a563bc3414f697dae3fbc8b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 16 Aug 2018 12:43:04 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 16 Aug 2018 12:43:04 -0300    

Click here for diff

In a multi-layer partitioning setup, if at plan time all the  
sub-partitions are pruned but the intermediate one remains, the executor  
later throws a spurious error that there's nothing to prune.  That is  
correct, but there's no reason to throw an error.  Therefore, don't.  
  
Reported-by: Andreas Seltenreich <[email protected]>  
Author: David Rowley <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Close the file descriptor in ApplyLogicalMappingFile

commit   : fa73b377ee11ced0c051fb42c29a87b5c71b79e3    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 16 Aug 2018 16:49:10 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 16 Aug 2018 16:49:10 +0200    

Click here for diff

The function was forgetting to close the file descriptor, resulting  
in failures like this:  
  
  ERROR:  53000: exceeded maxAllocatedDescs (492) while trying to open  
  file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"  
  LOCATION:  OpenTransientFile, fd.c:2161  
  
Simply close the file at the end, and backpatch to 9.4 (where logical  
decoding was introduced). While at it, fix a nearby typo.  
  
Discussion: https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com  

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

Try to enable C99 in configure, but do not rely on it (yet).

commit   : 86d78ef50e0195f8181f2b0bd9540f4ddfb73480    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Aug 2018 01:32:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Aug 2018 01:32:05 -0700    

Click here for diff

Based on recent discussion it seems possible that we might start to  
rely on more of C99. A prerequisite for that is enabling support for  
that on used compilers.  
  
Let's see on which buildfarm members autoconf's AC_PROG_CC_C99() is  
sufficient to do so. There's probably at least one member where the  
compiler is too old, but that'd probably be OK.  
  
If we go for this permanently we'd likely want to clean out / up a few  
other configure tests.  
  
Note this does not touch the msvc build infrastructure, which'd need  
separate treatment.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in

Update comment in header of errcodes.txt

commit   : 3593579bcdc77a70e0f987dca6d47f0bf1337f76    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Aug 2018 09:47:59 +0200    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Aug 2018 09:47:59 +0200    

Click here for diff

This file mentions all the files generated from it, but missed that  
errcodes-list.sgml is no more, while errcodes-table.sgml is.  
  
Author: Noriyoshi Shinoda  
Discussion: https://postgr.es/m/TU4PR8401MB0430855D6B971E49EB55F328EE3E0@TU4PR8401MB0430.NAMPRD84.PROD.OUTLOOK.COM  

M src/backend/utils/errcodes.txt

Improve comment in GetNewObjectId().

commit   : ca1e64febaf57eb5f3f24340c5bcce5430cad7a5    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 16 Aug 2018 17:17:30 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 16 Aug 2018 17:17:30 +1200    

Click here for diff

The previous comment gave the impression that skipping OIDs before  
FirstNormalObjectId was merely an optimization to avoid likely collisions.  
In fact other parts of the system have been relying on this threshold to  
detect system-created objects since commit 8e18d04d4da, so adjust the  
wording.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAEepm%3D33JASACeOayr_W3%3DCSjy2jiPxM-k89axu0akFbHdjnjA%40mail.gmail.com  

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

Update FSM on WAL replay of page all-visible/frozen

commit   : ab7dbd681c54d993fc8ebf8a413668fd75a4be0b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 15 Aug 2018 18:09:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 15 Aug 2018 18:09:29 -0300    

Click here for diff

We aren't very strict about keeping FSM up to date on WAL replay,  
because per-page freespace values aren't critical in replicas (can't  
write to heap in a replica; and if the replica is promoted, the values  
would be updated by VACUUM anyway).  However, VACUUM since 9.6 can skip  
processing pages marked all-visible or all-frozen, and if such pages are  
recorded in FSM with wrong values, those values are blindly propagated  
to FSM's upper layers by VACUUM's FreeSpaceMapVacuum.  (This rationale  
assumes that crashes are not very frequent, because those would cause  
outdated FSM to occur in the primary.)  
  
Even when the FSM is outdated in standby, things are not too bad  
normally, because, most per-page FSM values will be zero (other than  
those propagated with the base-backup that created the standby); only  
once the remaining free space is less than 0.2*BLCKSZ the per-page value  
is maintained by WAL replay of heap ins/upd/del.  However, if  
wal_log_hints=on causes complete FSM pages to be propagated to a standby  
via full-page images, many too-optimistic per-page values can end up  
being registered in the standby.  
  
Incorrect per-page values aren't critical in most cases, since an  
inserter that is given a page that doesn't actually contain the claimed  
free space will update FSM with the correct value, and retry until it  
finds a usable page.  However, if there are many such updates to do, an  
inserter can spend a long time doing them before a usable page is found;  
in a heavily trafficked insert-only table with many concurrent inserters  
this has been observed to cause several second stalls, causing visible  
application malfunction.  
  
To fix this problem, it seems sufficient to have heap_xlog_visible  
(replay of setting all-visible and all-frozen VM bits for a heap page)  
update the FSM value for the page being processed.  This fixes the  
per-page counters together with making the page skippable to vacuum, so  
when vacuum does FreeSpaceMapVacuum, the values propagated to FSM upper  
layers are the correct ones, avoiding the problem.  
  
While at it, apply the same fix to heap_xlog_clean (replay of tuple  
removal by HOT pruning and vacuum).  This makes any space freed by the  
cleaning available earlier than the next vacuum in the promoted replica.  
  
Backpatch to 9.6, where this problem was diagnosed on an insert-only  
table with all-frozen pages, which were introduced as a concept in that  
release.  Theoretically it could apply with all-visible pages to older  
branches, but there's been no report of that and it doesn't backpatch  
cleanly anyway.  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Clean up assorted misuses of snprintf()'s result value.

commit   : cc4f6b77861803be99dfc17a38052035a0af5ae6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Aug 2018 16:29:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Aug 2018 16:29:31 -0400    

Click here for diff

Fix a small number of places that were testing the result of snprintf()  
but doing so incorrectly.  The right test for buffer overrun, per C99,  
is "result >= bufsize" not "result > bufsize".  Some places were also  
checking for failure with "result == -1", but the standard only says  
that a negative value is delivered on failure.  
  
(Note that this only makes these places correct if snprintf() delivers  
C99-compliant results.  But at least now these places are consistent  
with all the other places where we assume that.)  
  
Also, make psql_start_test() and isolation_start_test() check for  
buffer overrun while constructing their shell commands.  There seems  
like a higher risk of overrun, with more severe consequences, here  
than there is for the individual file paths that are made elsewhere  
in the same functions, so this seemed like a worthwhile change.  
  
Also fix guc.c's do_serialize() to initialize errno = 0 before  
calling vsnprintf.  In principle, this should be unnecessary because  
vsnprintf should have set errno if it returns a failure indication ...  
but the other two places this coding pattern is cribbed from don't  
assume that, so let's be consistent.  
  
These errors are all very old, so back-patch as appropriate.  I think  
that only the shell command overrun cases are even theoretically  
reachable in practice, but there's not much point in erroneous error  
checks.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/utils/misc/guc.c
M src/common/ip.c
M src/interfaces/ecpg/pgtypeslib/common.c
M src/port/getaddrinfo.c
M src/test/isolation/isolation_main.c
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress_main.c

Make snprintf.c follow the C99 standard for snprintf's result value.

commit   : 805889d7d23fbecf5925443deb334aaeb6beaeb0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Aug 2018 13:21:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Aug 2018 13:21:05 -0400    

Click here for diff

C99 says that the result should be the number of bytes that would have  
been emitted given a large enough buffer, not the number we actually  
were able to put in the buffer.  It's time to make our substitute  
implementation comply with that.  Not doing so results in inefficiency  
in buffer-enlargement cases, and also poses a portability hazard for  
third-party code that might expect C99-compliant snprintf behavior  
within Postgres.  
  
In passing, remove useless tests for str == NULL; neither C99 nor  
predecessor standards ever allowed that except when count == 0,  
so I see no reason to expend cycles on making that a non-crash case  
for this implementation.  Also, don't waste a byte in pg_vfprintf's  
local I/O buffer; this might have performance benefits by allowing  
aligned writes during flushbuffer calls.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

pg_upgrade: fix shutdown check for standby servers

commit   : 777e6ddf1723306bd2bf8fe6f804863f459b0323    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 Aug 2018 17:19:02 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 Aug 2018 17:19:02 -0400    

Click here for diff

Commit 244142d32afd02e7408a2ef1f249b00393983822 only tested for the  
pg_controldata output for primary servers, but standby servers have  
different "Database cluster state" output, so check for that too.  
  
Diagnosed-by: Michael Paquier  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M src/bin/pg_upgrade/controldata.c

doc: Update broken links

commit   : 6f1591955db0a30f701ab10ea40cefeca6ff9b3f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Aug 2018 22:54:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Aug 2018 22:54:52 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/153044458767.13254.16049977382403131287%40wrigleys.postgresql.org  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/runtime.sgml

Remove duplicate function declarations.

commit   : 02dc7466baed074f7833bd6fd1067e23e1bfa1dd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Aug 2018 14:25:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Aug 2018 14:25:14 -0400    

Click here for diff

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

M src/include/libpq/pqformat.h

Remove obsolete netbsd dynloader code

commit   : b68ff3ea672c066b7eee6ca777618025b40abfd4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 16:07:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 16:07:10 +0200    

Click here for diff

dlopen() has been documented since NetBSD 1.1 (1995).  

M src/backend/port/dynloader/netbsd.c
M src/backend/port/dynloader/netbsd.h

Remove obsolete openbsd dynloader code

commit   : 29351a06af5b14b8f5efca18f5ec58f56eb33f2b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 16:04:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 16:04:03 +0200    

Click here for diff

dlopen() has been documented since OpenBSD 2.0 (1996).  

M src/backend/port/dynloader/openbsd.c
M src/backend/port/dynloader/openbsd.h

Remove obsolete freebsd dynloader code

commit   : 2db1905fdde019115e7c536dd98e1adeb8a0fa3a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 15:59:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 15:59:25 +0200    

Click here for diff

dlopen() has been documented since FreeBSD 3.0 (1989).  

M src/backend/port/dynloader/freebsd.c
M src/backend/port/dynloader/freebsd.h

Remove obsolete linux dynloader code

commit   : 351855fc4ebc2b5e62565f63ddbedbcada80e532    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 15:50:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 15:50:28 +0200    

Click here for diff

This has been obsolete probably since the late 1990s.  

M configure
M configure.in
M src/backend/port/dynloader/linux.c
M src/backend/port/dynloader/linux.h
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

Remove obsolete darwin dynloader code

commit   : b5d29299ccad9b2385236f2b82a0c4e1365b9add    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 15:48:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 15:48:24 +0200    

Click here for diff

not needed since macOS 10.3 (2003)  

M src/backend/port/dynloader/darwin.c

Remove obsolete comment

commit   : 3ebdd21b794b49fde2010ff3d39071e02d27b404    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 13 Aug 2018 21:07:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 13 Aug 2018 21:07:31 +0200    

Click here for diff

The sequence name is no longer stored in the sequence relation, since  
1753b1b027035029c2a2a1649065762fafbf63f3.  

M src/backend/commands/tablecmds.c

Fix libpq's implementation of per-host connection timeouts.

commit   : 1e6e98f7638904b2aa4df0bd87064239ce9d8fcf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Aug 2018 13:07:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Aug 2018 13:07:52 -0400    

Click here for diff

Commit 5f374fe7a attempted to turn the connect_timeout from an overall  
maximum time limit into a per-host limit, but it didn't do a great job of  
that.  The timer would only get restarted if we actually detected timeout  
within connectDBComplete(), not if we changed our attention to a new host  
for some other reason.  In that case the old timeout continued to run,  
possibly causing a premature timeout failure for the new host.  
  
Fix that, and also tweak the logic so that if we do get a timeout,  
we advance to the next available IP address, not to the next host name.  
There doesn't seem to be a good reason to assume that all the IP  
addresses supplied for a given host name will necessarily fail the  
same way as the current one.  Moreover, this conforms better to the  
admittedly-vague documentation statement that the timeout is "per  
connection attempt".  I changed that to "per host name or IP address"  
to be clearer.  (Note that reconnections to the same server, such as for  
switching protocol version or SSL status, don't get their own separate  
timeout; that was true before and remains so.)  
  
Also clarify documentation about the interpretation of connect_timeout  
values less than 2.  
  
This seems like a bug, so back-patch to v10 where this logic came in.  
  
Tom Lane, reviewed by Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

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

Make autovacuum more aggressive to remove orphaned temp tables

commit   : 246a6c8f7b237cc1943efbbb8a7417da9288f5c4    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Aug 2018 11:49:04 +0200    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Aug 2018 11:49:04 +0200    

Click here for diff

Commit dafa084, added in 10, made the removal of temporary orphaned  
tables more aggressive.  This commit makes an extra step into the  
aggressiveness by adding a flag in each backend's MyProc which tracks  
down any temporary namespace currently in use.  The flag is set when the  
namespace gets created and can be reset if the temporary namespace has  
been created in a transaction or sub-transaction which is aborted.  The  
flag value assignment is assumed to be atomic, so this can be done in a  
lock-less fashion like other flags already present in PGPROC like  
databaseId or backendId, still the fact that the temporary namespace and  
table created are still locked until the transaction creating those  
commits acts as a barrier for other backends.  
  
This new flag gets used by autovacuum to discard more aggressively  
orphaned tables by additionally checking for the database a backend is  
connected to as well as its temporary namespace in-use, removing  
orphaned temporary relations even if a backend reuses the same slot as  
one which created temporary relations in a past session.  
  
The base idea of this patch comes from Robert Haas, has been written in  
its first version by Tsunakawa Takayuki, then heavily reviewed by me.  
  
Author: Tsunakawa Takayuki  
Reviewed-by: Michael Paquier, Kyotaro Horiguchi, Andres Freund  
Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8A4DC6@G01JPEXMBYT05  
Backpatch: 11-, as PGPROC gains a new flag and we don't want silent ABI  
breakages on already released versions.  

M src/backend/access/transam/twophase.c
M src/backend/catalog/namespace.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/lmgr/proc.c
M src/include/catalog/namespace.h
M src/include/storage/proc.h

Adjust comment atop ExecShutdownNode.

commit   : 4f9a97e417ca3c162c2c83918873e3ac2cf0ace4    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Aug 2018 10:04:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Aug 2018 10:04:39 +0530    

Click here for diff

After commits a315b967cc and b805b63ac2, part of the comment atop  
ExecShutdownNode is redundant.  Adjust it.  
  
Author: Amit Kapila  
Backpatch-through: 10 where both the mentioned commits are present.  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execProcnode.c

Prohibit shutting down resources if there is a possibility of back up.

commit   : 2cd0acfdade82f3cab362fd9129d453f81cc2745    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Aug 2018 08:22:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Aug 2018 08:22:18 +0530    

Click here for diff

Currently, we release the asynchronous resources as soon as it is evident  
that no more rows will be needed e.g. when a Limit is filled.  This can be  
problematic especially for custom and foreign scans where we can scan  
backward.  Fix that by disallowing the shutting down of resources in such  
cases.  
  
Reported-by: Robert Haas  
Analysed-by: Robert Haas and Amit Kapila  
Author: Amit Kapila  
Reviewed-by: Robert Haas  
Backpatch-through: 9.6 where this code was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execMain.c
M src/backend/executor/nodeLimit.c

Avoid query-lifetime memory leaks in XMLTABLE (bug #15321)

commit   : 07172d5aff8f43cd6ce09f57a0b56a535d7eaf45    
  
author   : Andrew Gierth <[email protected]>    
date     : Mon, 13 Aug 2018 01:45:35 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Mon, 13 Aug 2018 01:45:35 +0100    

Click here for diff

Multiple calls to XMLTABLE in a query (e.g. laterally applying it to a  
table with an xml column, an important use-case) were leaking large  
amounts of memory into the per-query context, blowing up memory usage.  
  
Repair by reorganizing memory context usage in nodeTableFuncscan; use  
the usual per-tuple context for row-by-row evaluations instead of  
perValueCxt, and use the explicitly created context -- renamed from  
perValueCxt to perTableCxt -- for arguments and state for each  
individual table-generation operation.  
  
Backpatch to PG10 where this code was introduced.  
  
Original report by IRC user begriffs; analysis and patch by me.  
Reviewed by Tom Lane and Pavel Stehule.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Revert "Distinguish printf-like functions that support %m from those that don't."

commit   : 46b5e7c4b5befbf6ac86d827a3a58f1f02c7338e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Aug 2018 18:46:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Aug 2018 18:46:01 -0400    

Click here for diff

This reverts commit 3a60c8ff892a8242b907f44702bfd9f1ff877d45.  Buildfarm  
results show that that caused a whole bunch of new warnings on platforms  
where gcc believes the local printf to be non-POSIX-compliant.  This  
problem outweighs the hypothetical-anyway possibility of getting warnings  
for misuse of %m.  We could use gnu_printf archetype when we've substituted  
src/port/snprintf.c, but that brings us right back to the problem of not  
getting warnings for %m.  
  
A possible answer is to attack it in the other direction by insisting  
that %m support be included in printf's feature set, but that will take  
more investigation.  In the meantime, revert the previous change, and  
update the comment for PGAC_C_PRINTF_ARCHETYPE to more fully explain  
what's going on.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M src/include/c.h
M src/include/pg_config.h.in
M src/include/utils/elog.h

Fix bogus loop logic in 013_crash_restart test's pump_until subroutine.

commit   : d11eae09e48694ad6b4139bbb7d7b112833301f5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 12 Aug 2018 18:05:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 12 Aug 2018 18:05:49 -0400    

Click here for diff

The pump_nb() step might've already received the desired data, so we must  
check for that at the top of the loop not the bottom.  Otherwise, the  
call to pump() will sit with nothing to do until the timeout elapses.  
pump_until then falls out with apparent success ... but the timeout has  
been used up, causing the next call of pump_until to report a timeout  
failure.  I believe this explains the intermittent timeout failures  
we've seen in the buildfarm ever since this test went in.  I was able  
to reproduce the problem on gaur semi-repeatably, and this appears to  
fix it.  
  
In passing, remove a duplicate assignment, fix one stdin-assignment to  
look like the rest, and document the test's dependency on test_decoding.  

M src/test/recovery/README
M src/test/recovery/t/013_crash_restart.pl

Fix wrong order of operations in inheritance_planner.

commit   : 4a2994f055be9405a254b22de6cd2107a0f46563    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Aug 2018 15:53:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Aug 2018 15:53:20 -0400    

Click here for diff

When considering a partitioning parent rel, we should stop processing that  
subroot as soon as we've done adjust_appendrel_attrs and any securityQuals  
updates.  The rest of this is unnecessary, and indeed adding duplicate  
subquery RTEs to the subroot is *wrong*.  As the code stood, the children  
of that partition ended up with two sets of copied subquery RTEs, confusing  
matters greatly.  Even more hilarity ensued if all of the children got  
excluded by constraint exclusion, so that the extra RTEs didn't make it  
back into the parent rtable.  
  
Per fuzz testing by Andreas Seltenreich.  Back-patch to v11 where this  
got broken (by commit 0a480502b, it looks like).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Produce compiler errors if errno is referenced inside elog/ereport calls.

commit   : a2a8acd15217b1e355c083a41da4dc5c7f35b30b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Aug 2018 11:23:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Aug 2018 11:23:41 -0400    

Click here for diff

It's often unsafe to reference errno within an elog/ereport call, because  
there are a lot of sub-functions involved and they might not all preserve  
errno.  (This is why we support the %m format spec: it works off a value  
of errno captured before we execute any potentially-unsafe functions in  
the arguments.)  Therefore, we have a project policy not to use errno  
there.  
  
This patch adds a hack to cause an (admittedly obscure) compiler error  
for such unsafe usages.  With the current code, the error will only be seen  
on Linux, macOS, and FreeBSD, but that should certainly be enough to catch  
mistakes in the buildfarm if they somehow get missed earlier.  
  
In addition, fix some places in src/common/exec.c that trip the error.  
I think these places are actually all safe, but it's simple enough to  
avoid the error by capturing errno manually, and doing so is good  
future-proofing in case these call sites get any more complicated.  
  
Thomas Munro (exec.c fixes by me)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/exec.c
M src/include/utils/elog.h

Distinguish printf-like functions that support %m from those that don't.

commit   : 3a60c8ff892a8242b907f44702bfd9f1ff877d45    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Aug 2018 11:11:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Aug 2018 11:11:05 -0400    

Click here for diff

The elog/ereport family of functions certainly support the %m format spec,  
because they implement it "by hand".  But elsewhere we have printf wrappers  
that might or might not allow it depending on whether the platform's printf  
does.  (Most non-glibc versions don't, and notably, src/port/snprintf.c  
doesn't.)  Hence, rather than using the gnu_printf format archetype  
interchangeably for all these functions, use it only for elog/ereport.  
This will allow us to get compiler warnings for mistakes like the ones  
fixed in commit a13b47a59, at least on platforms where printf doesn't  
take %m and gcc is correctly configured to know it.  (Unfortunately,  
that won't happen on Linux, nor on macOS according to my testing.  
It remains to be seen what the buildfarm's gcc-on-Windows animals will  
think of this, but we may well have to rely on less-popular platforms  
to warn us about unportable code of this kind.)  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M src/include/c.h
M src/include/pg_config.h.in
M src/include/utils/elog.h

Revert changes in execMain.c from commit 16828d5c0273b

commit   : 5c047fd709ae274d5d543b250c70cc2b15e4fe65    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 10 Aug 2018 16:05:54 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 10 Aug 2018 16:05:54 -0400    

Click here for diff

These changes were put in at some stage of the development process, but  
are unnecessary and should not have made it into the final patch. Mea  
culpa.  
  
Per gripe from Andreas Freund  
  
Backpatch to REL_11_STABLE  

M src/backend/executor/execMain.c

Handle parallel index builds on mapped relations.

commit   : 4974d7f87e62a58e80c6524e49677cb25cc10e12    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 10 Aug 2018 13:01:34 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 10 Aug 2018 13:01:34 -0700    

Click here for diff

Commit 9da0cc35284, which introduced parallel CREATE INDEX, failed to  
propagate relmapper.c backend local cache state to parallel worker  
processes.  This could result in parallel index builds against mapped  
catalog relations where the leader process (participating as a worker)  
scans the new, pristine relfilenode, while worker processes scan the  
obsolescent relfilenode.  When this happened, the final index structure  
was typically not consistent with the owning table's structure.  The  
final index structure could contain entries formed from both heap  
relfilenodes.  Only rebuilds on mapped catalog relations that occur as  
part of a VACUUM FULL or CLUSTER could become corrupt in practice, since  
their mapped relation relfilenode swap is what allows the inconsistency  
to arise.  
  
On master, fix the problem by propagating the required relmapper.c  
backend state as part of standard parallel initialization (Cf. commit  
29d58fd3).  On v11, simply disallow builds against mapped catalog  
relations by deeming them parallel unsafe.  
  
Author: Peter Geoghegan  
Reported-By: "death lock"  
Reviewed-By: Tom Lane, Amit Kapila  
Bug: #15309  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where parallel CREATE INDEX was introduced.  

M src/backend/access/transam/README.parallel
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/backend/utils/cache/relmapper.c
M src/include/utils/relmapper.h

Cosmetic cleanups in initdb.c.

commit   : d4a900458e505092a8013eb77c9631d58c3c2a0a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Aug 2018 14:14:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Aug 2018 14:14:27 -0400    

Click here for diff

Commit bcbd94080 didn't bother to fix up a comment it had falsified.  
  
Also, const-ify choose_dsm_implementation(), since what it's returning  
is always a constant string; pickier compilers would warn about this.  

M src/bin/initdb/initdb.c

Improve TRUNCATE by avoiding early lock queue

commit   : f841ceb26d701e7f5f48190bf7290c400cba30a2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 10 Aug 2018 18:26:59 +0200    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 10 Aug 2018 18:26:59 +0200    

Click here for diff

A caller of TRUNCATE could previously queue for an access exclusive lock  
on a relation it may not have permission to truncate, potentially  
interfering with users authorized to work on it.  This can be very  
intrusive depending on the lock attempted to be taken.  For example,  
pg_authid could be blocked, preventing any authentication attempt to  
happen on a PostgreSQL instance.  
  
This commit fixes the case of TRUNCATE so as RangeVarGetRelidExtended is  
used with a callback doing the necessary ACL checks at an earlier stage,  
avoiding lock queuing issues, so as an immediate failure happens for  
unprivileged users instead of waiting on a lock that would not be  
taken.  
  
This is rather similar to the type of work done in cbe24a6 for CLUSTER,  
and the code of TRUNCATE is this time refactored so as there is no  
user-facing changes.  As the commit for CLUSTER, no back-patch is done.  
  
Reported-by: Lloyd Albin, Jeremy Schneider  
Author: Michael Paquier  
Reviewed by: Nathan Bossart, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
A src/test/isolation/expected/truncate-conflict.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/truncate-conflict.spec

Fix typo in SP-GiST error message

commit   : 2b13702d5c7e879bdd0587a80d5cfaeb5206f4ea    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 17:28:48 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 17:28:48 +0300    

Click here for diff

Error message didn't match the actual check.  Fix that.  Compression of leaf  
SP-GiST values was introduced in 11.  So, backpatch.  
  
Discussion: https://postgr.es/m/20180810.100742.15469435.horiguchi.kyotaro%40lab.ntt.co.jp  
Author: Kyotaro Horiguchi  
Backpatch-through: 11  

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

Add missing documentation for argument of amcostestimate()

commit   : e01d3477e7486b0bbc6591be67675962218245b2    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 14:14:36 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 14:14:36 +0300    

Click here for diff

5262f7a4fc44 have introduced parallel index scan.  In order to estimate the  
number of parallel workers, it adds extra argument to amcostestimate() index  
access method API function.  However, this extra argument was missed in the  
documentation.  This commit fixes that.  
  
Discussion: https://postgr.es/m/4128fdb4-8b63-2e05-38f6-3125f8c27263%40lab.ntt.co.jp  
Author: Tatsuro Yamada, Alexander Korotkov  
Backpatch-through: 10  

M doc/src/sgml/indexam.sgml

Fix misspelled pg_trgm contrib name in PostgreSQL 11 release notes

commit   : 3abc5a67edfdc568ef1b68845b29c3aa5c03b852    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 12:58:57 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 10 Aug 2018 12:58:57 +0300    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoD0Eii9y9f3cQV9AsaUF%3DMmOrQuZLHqoobFp%3DmSKEx1CA%40mail.gmail.com  

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

Add RECURSIVE to documentation index

commit   : a5db27418e222a930cd39f48907e58a13837b331    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 9 Aug 2018 16:19:32 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 9 Aug 2018 16:19:32 -0400    

Click here for diff

Author: Daniel Vérité <[email protected]>  
Reviewed-by: Fabien COELHO <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/create_view.sgml

Document need to clear MAKELEVEL when invoking PG build from a makefile.

commit   : 8694a1ce406d58873e7332fa725baeeff18f57b2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Aug 2018 15:21:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Aug 2018 15:21:09 -0400    

Click here for diff

Since commit 3b8f6e75f, failure to do this would lead to  
submake-generated-headers not doing anything, so that references to  
generated or symlinked headers would fail.  Previous to that, the  
omission only led to temp-install not doing anything, which apparently  
affects many fewer people (doesn't anybody use "make check" in their  
build rules??).  Hence, backpatch to v11 but not further.  
  
Per complaints from Christoph Berg, Jakob Egger, and others.  

M doc/src/sgml/installation.sgml

docs: Only first instance of a PREPARE parameter sets data type

commit   : b284262e40424daa1c546ad76f365b31304d7944    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 Aug 2018 10:13:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 Aug 2018 10:13:15 -0400    

Click here for diff

If the first reference to $1 is "($1 = col) or ($1 is null)", the data  
type can be determined, but not for "($1 is null) or ($1 = col)".  This  
change documents this.  
  
Reported-by: Morgan Owens  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.3  

M doc/src/sgml/ref/prepare.sgml

Spell "partitionwise" consistently.

commit   : 31380bc7c204e7cfa9c9e1c62947909e2b38577c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Aug 2018 10:41:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 9 Aug 2018 10:41:28 +0300    

Click here for diff

I'm not sure which spelling is better, "partitionwise" or "partition-wise",  
but everywhere else we spell it "partitionwise", so be consistent.  
  
Tatsuro Yamada reported the one in README, I found the other one with grep.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/README

Restrict access to reindex of shared catalogs for non-privileged users

commit   : 661dd23950f2e64646404605e99315d2379de0e5    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Aug 2018 09:40:15 +0200    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Aug 2018 09:40:15 +0200    

Click here for diff

A database owner running a database-level REINDEX has the possibility to  
also do the operation on shared system catalogs without being an owner  
of them, which allows him to block resources it should not have access  
to.  The same goes for a schema owner.  For example, PostgreSQL would go  
unresponsive and even block authentication if a lock is waited for  
pg_authid.  This commit makes sure that a user running a REINDEX SYSTEM,  
DATABASE or SCHEMA only works on the following relations:  
- The user is a superuser  
- The user is the table owner  
- The user is the database/schema owner, only if the relation worked on  
is not shared.  
  
Robert has worded most the documentation changes, and I have coded the  
core part.  
  
Reported-by: Lloyd Albin, Jeremy Schneider  
Author: Michael Paquier, Robert Haas  
Reviewed by: Nathan Bossart, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11- as the current behavior has been around for a  
very long time and could be disruptive for already released branches.  

M doc/src/sgml/ref/reindex.sgml
M src/backend/commands/indexcmds.c

Remove bogus Assert in make_partitionedrel_pruneinfo().

commit   : 59ef49d26d2f8724d0788fea0774f786a22ca63d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 20:02:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 20:02:10 -0400    

Click here for diff

This Assert thought that a given rel couldn't be both leaf and  
non-leaf, but it turns out that in some unusual plan trees  
that's wrong, so remove it.  
  
The lack of testing for cases like that is quite concerning ---  
there is little reason for confidence that there aren't other  
bugs in the area.  But developing a stable test case seems  
rather difficult, and in any case we don't need this Assert.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CAJGNTeOkdk=UVuMugmKL7M=owgt4nNr1wjxMg1F+mHsXyLCzFA@mail.gmail.com  

M src/backend/partitioning/partprune.c

Doc: Correct description of amcheck example query.

commit   : 313cbdc7f666a5af2c977463faf8a0eb06011b98    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 8 Aug 2018 12:56:11 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 8 Aug 2018 12:56:11 -0700    

Click here for diff

The amcheck documentation incorrectly claimed that its example query  
verifies every catalog index in the database.  In fact, the query only  
verifies the 10 largest indexes (as determined by pg_class.relpages).  
Adjust the description accordingly.  
  
Backpatch: 10-, where contrib/amcheck was introduced.  

M doc/src/sgml/amcheck.sgml

Remove unwanted "garbage cleanup" logic in Makefiles.

commit   : 1eee8d4994fe0b93ac02c613c1e955680e3a5ce3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 14:32:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 14:32:29 -0400    

Click here for diff

GNUmakefile.in defined a macro "garbage" that seems to have been meant  
as a suitable target for automatic "rm -rf" treatment, but it isn't  
actually used anywhere (and indeed never was, AFAICT).  
  
Moreover, we have concluded that the Makefiles shouldn't take it upon  
themselves to remove files that aren't expected by-products of building,  
so that doing anything like that would be against project policy anyway.  
Hence, just remove the macro.  
  
Grepping around finds another violation of that policy in ecpg/preproc,  
so clean that up too.  
  
Daniel Gustafsson (ecpg change by me)  
  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M src/interfaces/ecpg/preproc/Makefile

Don't run atexit callbacks in quickdie signal handlers.

commit   : 8e19a82640d3fa2350db146ec72916856dd02f0a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Aug 2018 19:08:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 8 Aug 2018 19:08:10 +0300    

Click here for diff

exit() is not async-signal safe. Even if the libc implementation is, 3rd  
party libraries might have installed unsafe atexit() callbacks. After  
receiving SIGQUIT, we really just want to exit as quickly as possible, so  
we don't really want to run the atexit() callbacks anyway.  
  
The original report by Jimmy Yih was a self-deadlock in startup_die().  
However, this patch doesn't address that scenario; the signal handling  
while waiting for the startup packet is more complicated. But at least this  
alleviates similar problems in the SIGQUIT handlers, like that reported  
by Asim R P later in the same thread.  
  
Backpatch to 9.3 (all supported versions).  
  
Discussion: https://www.postgresql.org/message-id/CAOMx_OAuRUHiAuCg2YgicZLzPVv5d9_H4KrL_OFsFP%3DVPekigA%40mail.gmail.com  

M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walreceiver.c
M src/backend/tcop/postgres.c

Match RelOptInfos by relids not pointer equality.

commit   : 11e22e486d8da6cef4d954c6f2952097df276fa7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 11:44:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Aug 2018 11:44:50 -0400    

Click here for diff

Commit 1c2cb2744 added some code that tried to detect whether two  
RelOptInfos were the "same" rel by pointer comparison; but it turns  
out that inheritance_planner breaks that, through its shenanigans  
with copying some relations forward into new subproblems.  Compare  
relid sets instead.  Add a regression test case to exercise this  
area.  
  
Problem reported by Rushabh Lathia; diagnosis and fix by Amit Langote,  
modified a bit by me.  
  
Discussion: https://postgr.es/m/CAGPqQf3anJGj65bqAQ9edDr8gF7qig6_avRgwMT9MsZ19COUPw@mail.gmail.com  

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

Don't record FDW user mappings as members of extensions.

commit   : 9b7c56d6cba9d23318d98af58f0c1adc85869bbf    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 16:32:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 16:32:50 -0400    

Click here for diff

CreateUserMapping has a recordDependencyOnCurrentExtension call that's  
been there since extensions were introduced (very possibly my fault).  
However, there's no support anywhere else for user mappings as members  
of extensions, nor are they listed as a possible member object type in  
the documentation.  Nor does it really seem like a good idea for user  
mappings to belong to extensions when roles don't.  Hence, remove the  
bogus call.  
  
(As we saw in bug #15310, the lack of any pg_dump support for this case  
ensures that any such membership record would silently disappear during  
pg_upgrade.  So there's probably no need for us to do anything else  
about cleaning up after this mistake.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/foreigncmds.c

Fix incorrect initialization of BackendActivityBuffer.

commit   : 41db97399d6b5492cb4538680531f81f4711b0f4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 16:00:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 16:00:44 -0400    

Click here for diff

Since commit c8e8b5a6e, this has been zeroed out using the wrong length.  
In practice the length would always be too small, leading to not zeroing  
the whole buffer rather than clobbering additional memory; and that's  
pretty harmless, both because shmem would likely start out as zeroes  
and because we'd reinitialize any given entry before use.  Still,  
it's bogus, so fix it.  
  
Reported by Petru-Florin Mihancea (bug #15312)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

Fix pg_upgrade to handle event triggers in extensions correctly.

commit   : 03838b804905e3fd26ec648c7df1505cf0d8e413    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 15:43:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 15:43:48 -0400    

Click here for diff

pg_dump with --binary-upgrade must emit ALTER EXTENSION ADD commands  
for all objects that are members of extensions.  It forgot to do so for  
event triggers, as per bug #15310 from Nick Barnes.  Back-patch to 9.3  
where event triggers were introduced.  
  
Haribabu Kommi  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Ensure pg_dump_sort.c sorts null vs non-null namespace consistently.

commit   : 5b5ed4756c9b3efff787f4921659a9d4d51726e5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 13:13:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Aug 2018 13:13:42 -0400    

Click here for diff

The original coding here (which is, I believe, my fault) supposed that  
it didn't need to concern itself with the possibility that one object  
of a given type-priority has a namespace while another doesn't.  But  
that's not reliably true anymore, if it ever was; and if it does happen  
then it's possible that DOTypeNameCompare returns self-inconsistent  
comparison results.  That leads to unspecified behavior in qsort()  
and a resultant weird output order from pg_dump.  
  
This should end up being only a cosmetic problem, because any ordering  
constraints that actually matter should be enforced by the later  
dependency-based sort.  Still, it's a bug, so back-patch.  
  
Report and fix by Jacob Champion, though I editorialized on his  
patch to the extent of making NULL sort after non-NULL, for consistency  
with our usual sorting definitions.  
  
Discussion: https://postgr.es/m/CABAq_6Hw+V-Kj7PNfD5tgOaWT_-qaYkc+SRmJkPLeUjYXLdxwQ@mail.gmail.com  

M src/bin/pg_dump/pg_dump_sort.c

Last-minute updates for release notes.

commit   : e0ee93053998b159e395deed7c42e02b1f921552    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 13:13:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 13:13:40 -0400    

Click here for diff

Security: CVE-2018-10915, CVE-2018-10925  

M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml

Fix failure to reset libpq's state fully between connection attempts.

commit   : d1c6a14bacfa5fe7690e2c71b1626dbc87a57355    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 10:53:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Aug 2018 10:53:35 -0400    

Click here for diff

The logic in PQconnectPoll() did not take care to ensure that all of  
a PGconn's internal state variables were reset before trying a new  
connection attempt.  If we got far enough in the connection sequence  
to have changed any of these variables, and then decided to try a new  
server address or server name, the new connection might be completed  
with some state that really only applied to the failed connection.  
  
While this has assorted bad consequences, the only one that is clearly  
a security issue is that password_needed didn't get reset, so that  
if the first server asked for a password and the second didn't,  
PQconnectionUsedPassword() would return an incorrect result.  This  
could be leveraged by unprivileged users of dblink or postgres_fdw  
to allow them to use server-side login credentials that they should  
not be able to use.  
  
Other notable problems include the possibility of forcing a v2-protocol  
connection to a server capable of supporting v3, or overriding  
"sslmode=prefer" to cause a non-encrypted connection to a server that  
would have accepted an encrypted one.  Those are certainly bugs but  
it's harder to paint them as security problems in themselves.  However,  
forcing a v2-protocol connection could result in libpq having a wrong  
idea of the server's standard_conforming_strings setting, which opens  
the door to SQL-injection attacks.  The extent to which that's actually  
a problem, given the prerequisite that the attacker needs control of  
the client's connection parameters, is unclear.  
  
These problems have existed for a long time, but became more easily  
exploitable in v10, both because it introduced easy ways to force libpq  
to abandon a connection attempt at a late stage and then try another one  
(rather than just giving up), and because it provided an easy way to  
specify multiple target hosts.  
  
Fix by rearranging PQconnectPoll's state machine to provide centralized  
places to reset state properly when moving to a new target host or when  
dropping and retrying a connection to the same host.  
  
Tom Lane, reviewed by Noah Misch.  Our thanks to Andrew Krasichkov  
for finding and reporting the problem.  
  
Security: CVE-2018-10915  

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

Release notes for 10.5, 9.6.10, 9.5.14, 9.4.19, 9.3.24.

commit   : aa291a4cf70a180669a298f912a4e4f7869ce9ab    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Aug 2018 16:38:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Aug 2018 16:38:42 -0400    

Click here for diff

M doc/src/sgml/release-10.sgml
M doc/src/sgml/release-9.3.sgml
M doc/src/sgml/release-9.4.sgml
M doc/src/sgml/release-9.5.sgml
M doc/src/sgml/release-9.6.sgml

Doc: fix incorrectly stated argument list for pgcrypto's hmac() function.

commit   : a3274e0d28871f25c4c76e335b39766d7e5be07c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 5 Aug 2018 13:03:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 5 Aug 2018 13:03:42 -0400    

Click here for diff

The bytea variant takes (bytea, bytea, text).  
Per unsigned report.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgcrypto.sgml

Remove now unused check for HAVE_X509_GET_SIGNATURE_NID in test.

commit   : 6b9eb503d28b1e6d94961d2aee833c931a887ee6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 5 Aug 2018 17:16:12 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 5 Aug 2018 17:16:12 +0300    

Click here for diff

I removed the code that used this in the previous commit.  
  
Spotted by Michael Paquier.  

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

Remove support for tls-unique channel binding.

commit   : 77291139c7c1dffac61e8db88cef98933677db18    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 5 Aug 2018 13:44:21 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 5 Aug 2018 13:44:21 +0300    

Click here for diff

There are some problems with the tls-unique channel binding type. It's not  
supported by all SSL libraries, and strictly speaking it's not defined for  
TLS 1.3 at all, even though at least in OpenSSL, the functions used for it  
still seem to work with TLS 1.3 connections. And since we had no  
mechanism to negotiate what channel binding type to use, there would be  
awkward interoperability issues if a server only supported some channel  
binding types. tls-server-end-point seems feasible to support with any SSL  
library, so let's just stick to that.  
  
This removes the scram_channel_binding libpq option altogether, since there  
is now only one supported channel binding type.  
  
This also removes all the channel binding tests from the SSL test suite.  
They were really just testing the scram_channel_binding option, which  
is now gone. Channel binding is used if both client and server support it,  
so it is used in the existing tests. It would be good to have some tests  
specifically for channel binding, to make sure it really is used, and the  
different combinations of a client and a server that support or doesn't  
support it. The current set of settings we have make it hard to write such  
tests, but I did test those things manually, by disabling  
HAVE_BE_TLS_GET_CERTIFICATE_HASH and/or  
HAVE_PGTLS_GET_PEER_CERTIFICATE_HASH.  
  
I also removed the SCRAM_CHANNEL_BINDING_TLS_END_POINT constant. This is a  
matter of taste, but IMO it's more readable to just use the  
"tls-server-end-point" string.  
  
Refactor the checks on whether the SSL library supports the functions  
needed for tls-server-end-point channel binding. Now the server won't  
advertise, and the client won't choose, the SCRAM-SHA-256-PLUS variant, if  
compiled with an OpenSSL version too old to support it.  
  
In the passing, add some sanity checks to check that the chosen SASL  
mechanism, SCRAM-SHA-256 or SCRAM-SHA-256-PLUS, matches whether the SCRAM  
exchange used channel binding or not. For example, if the client selects  
the non-channel-binding variant SCRAM-SHA-256, but in the SCRAM message  
uses channel binding anyway. It's harmless from a security point of view,  
I believe, and I'm not sure if there are some other conditions that would  
cause the connection to fail, but it seems better to be strict about these  
things and check explicitly.  
  
Discussion: https://www.postgresql.org/message-id/ec787074-2305-c6f4-86aa-6902f98485a4%40iki.fi  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/release-11.sgml
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/include/common/scram-common.h
M src/include/libpq/libpq-be.h
M src/include/libpq/scram.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/test/ssl/t/002_scram.pl

Update version 11 release notes.

commit   : 7a46068f47a2e407d80d9d552727dc102188bec2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Aug 2018 23:49:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Aug 2018 23:49:53 -0400    

Click here for diff

Remove description of commit 1944cdc98, which has now been back-patched  
so it's not relevant to v11 any longer.  Add descriptions of other  
recent commits that seemed worth mentioning.  
  
I marked the update as stopping at 2018-07-30, because it's unclear  
whether d06eebce5 will be allowed to stay in v11, and I didn't feel like  
putting effort into writing a description of it yet.  If it does stay,  
I think it will deserve mention in the Source Code section.  

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

Fix INSERT ON CONFLICT UPDATE through a view that isn't just SELECT *.

commit   : b8a1247a34e234be6becf7f70b9f1e8e9369db64    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Aug 2018 19:38:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Aug 2018 19:38:58 -0400    

Click here for diff

When expanding an updatable view that is an INSERT's target, the rewriter  
failed to rewrite Vars in the ON CONFLICT UPDATE clause.  This accidentally  
worked if the view was just "SELECT * FROM ...", as the transformation  
would be a no-op in that case.  With more complicated view targetlists,  
this omission would often lead to "attribute ... has the wrong type" errors  
or even crashes, as reported by Mario De Frutos Dieguez.  
  
Fix by adding code to rewriteTargetView to fix up the data structure  
correctly.  The easiest way to update the exclRelTlist list is to rebuild  
it from scratch looking at the new target relation, so factor the code  
for that out of transformOnConflictClause to make it sharable.  
  
In passing, avoid duplicate permissions checks against the EXCLUDED  
pseudo-relation, and prevent useless view expansion of that relation's  
dummy RTE.  The latter is only known to happen (after this patch) in cases  
where the query would fail later due to not having any INSTEAD OF triggers  
for the view.  But by exactly that token, it would create an unintended  
and very poorly tested state of the query data structure, so it seems like  
a good idea to prevent it from happening at all.  
  
This has been broken since ON CONFLICT was introduced, so back-patch  
to 9.5.  
  
Dean Rasheed, based on an earlier patch by Amit Langote;  
comment-kibitzing and back-patching by me  
  
Discussion: https://postgr.es/m/CAFYwGJ0xfzy8jaK80hVN2eUWr6huce0RU8AgU04MGD00igqkTg@mail.gmail.com  

M src/backend/parser/analyze.c
M src/backend/rewrite/rewriteHandler.c
M src/include/parser/analyze.h
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

Reset properly errno before calling write()

commit   : 5a23c74b63ec9f63c648f79b13a900c37332ee55    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 5 Aug 2018 05:31:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 5 Aug 2018 05:31:18 +0900    

Click here for diff

6cb3372 enforces errno to ENOSPC when less bytes than what is expected  
have been written when it is unset, though it forgot to properly reset  
errno before doing a system call to write(), causing errno to  
potentially come from a previous system call.  
  
Reported-by: Tom Lane  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/twophase.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/bin/pg_basebackup/walmethods.c

Make "kerberos" test suite independent of "localhost" name resolution.

commit   : e61f21b921aebc0870d3ac47f77fc17e75e2fefb    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 3 Aug 2018 20:53:25 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 3 Aug 2018 20:53:25 -0700    

Click here for diff

This suite malfunctioned if the canonical name of "localhost" was  
something other than "localhost", such as "localhost.localdomain".  Use  
hostaddr=127.0.0.1 and a fictitious host=, so the resolver's answers for  
"localhost" don't affect the outcome.  Back-patch to v11, which  
introduced this test suite.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add table relcache invalidation to index builds.

commit   : b3f919da07540d7c968e8495482336304badcef7    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 3 Aug 2018 14:45:11 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 3 Aug 2018 14:45:11 -0700    

Click here for diff

It's necessary to make sure that owning tables have a relcache  
invalidation prior to advancing the command counter to make  
newly-entered catalog tuples for the index visible.  inval.c must be  
able to maintain the consistency of the local caches in the event of  
transaction abort.  There is usually only a problem when CREATE INDEX  
transactions abort, since there is a generic invalidation once we reach  
index_update_stats().  
  
This bug is of long standing.  Problems were made much more likely by  
the addition of parallel CREATE INDEX (commit 9da0cc35284), but it is  
strongly suspected that similar problems can be triggered without  
involving plan_create_index_workers().  (plan_create_index_workers()  
triggers a relcache build or rebuild, which previously only happened in  
rare edge cases.)  
  
Author: Peter Geoghegan  
Reported-By: Luca Ferrari  
Diagnosed-By: Andres Freund  
Reviewed-By: Andres Freund  
Discussion: https://postgr.es/m/CAKoxK+5fVodiCtMsXKV_1YAKXbzwSfp7DgDqUmcUAzeAhf=HEQ@mail.gmail.com  
Backpatch: 9.3-  

M src/backend/catalog/index.c

First-draft release notes for 10.5.

commit   : c1455de2af2eb06ee493f9982f060ac7e571f656    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 18:08:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 18:08:57 -0400    

Click here for diff

As usual, the release notes for other branches will be made by cutting  
these down, but put them up for community review first.  

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

Add 'n' to list of possible values to pg_default_acl.defaclobjtype

commit   : f6f8d55c4b47454f0e22bbabdc6a5711848b4931    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Aug 2018 16:45:08 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Aug 2018 16:45:08 -0400    

Click here for diff

This was missed in commit ab89e465cb20; backpatch to v10.  
  
Author: Fabien Coelho <[email protected]>  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1807302243001.13230@lancre  

M doc/src/sgml/catalogs.sgml

Fix pg_replication_slot example output

commit   : 416db2412bdae1cfb6bd18203a15fb6617935690    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 3 Aug 2018 16:34:59 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 3 Aug 2018 16:34:59 -0400    

Click here for diff

The example output of pg_replication_slot is wrong.  Correct it and make  
the output stable by explicitly listing columns to output.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Remove no-longer-appropriate special case in psql's \conninfo code.

commit   : c7a8f786775e073a3fa785ed2842cc24f9eb6ae8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 12:20:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 12:20:47 -0400    

Click here for diff

\conninfo prints the results of PQhost() and some other libpq functions.  
It used to override the PQhost() result with the hostaddr parameter if  
that'd been given, but that's unhelpful when multiple hosts were listed  
in the connection string.  Furthermore, it seems unnecessary in the wake  
of commit 1944cdc98, since PQhost does any useful substitution itself.  
So let's just remove the extra code and print PQhost()'s result without  
any editorialization.  
  
Back-patch to v10, as 1944cdc98 (just) was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

Change libpq's internal uses of PQhost() to inspect host field directly.

commit   : 24986c95520e0761dbb3551196fda2305228557c    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 12:12:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Aug 2018 12:12:10 -0400    

Click here for diff

Commit 1944cdc98 changed PQhost() to return the hostaddr value when that  
is specified and host isn't.  This is a good idea in general, but  
fe-auth.c and related files contain PQhost() calls for which it isn't.  
Specifically, when we compare SSL certificates or other server identity  
information to the host field, we do not want to use hostaddr instead;  
that's not what's documented, that's not what happened pre-v10, and  
it doesn't seem like a good idea.  
  
Instead, we can just look at connhost[].host directly.  This does what  
we want in v10 and up; in particular, if neither host nor hostaddr  
were given, the host field will be replaced with the default host name.  
That seems useful, and it's likely the reason that these places were  
coded to call PQhost() originally (since pre-v10, the stored field was  
not replaced with the default).  
  
Back-patch to v10, as 1944cdc98 (just) was.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix buffer usage stats for parallel nodes.

commit   : 85c9d3475e4f680dbca7c04fe096af018f3b8760    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 3 Aug 2018 11:02:02 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 3 Aug 2018 11:02:02 +0530    

Click here for diff

The buffer usage stats is accounted only for the execution phase of the  
node.  For Gather and Gather Merge nodes, such stats are accumulated at  
the time of shutdown of workers which is done after execution of node due  
to which we missed to account them for such nodes.  Fix it by treating  
nodes as running while we shut down them.  
  
We can also miss accounting for a Limit node when Gather or Gather Merge  
is beneath it, because it can finish the execution before shutting down  
such nodes.  So we allow a Limit node to shut down the resources before it  
completes the execution.  
  
In the passing fix the gather node code to allow workers to shut down as  
soon as we find that all the tuples from the workers have been retrieved.  
The original code use to do that, but is accidently removed by commit  
01edb5c7fc.  
  
Reported-by: Adrien Nayrat  
Author: Amit Kapila and Robert Haas  
Reviewed-by: Robert Haas and Andres Freund  
Backpatch-through: 9.6 where this code was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execProcnode.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeLimit.c

Match the buffer usage tracking for leader and worker backends.

commit   : ccc84a956b00bdd4c162ca8951dd1ff7890cb51f    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 3 Aug 2018 09:11:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 3 Aug 2018 09:11:37 +0530    

Click here for diff

In the leader backend, we don't track the buffer usage for ExecutorStart  
phase whereas in worker backend we track it for ExecutorStart phase as  
well.  This leads to different value for buffer usage stats for the  
parallel and non-parallel query.  Change the code so that worker backend  
also starts tracking buffer usage after ExecutorStart.  
  
Author: Amit Kapila and Robert Haas  
Reviewed-by: Robert Haas and Andres Freund  
Backpatch-through: 9.6 where this code was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execParallel.c

Add missing header include to pmsignal.h.

commit   : 579b985b22928ef2aecacb679ac65e6a48b00113    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 2 Aug 2018 11:25:31 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 2 Aug 2018 11:25:31 +1200    

Click here for diff

pmsignal.h uses sig_atomic_t in some builds, but relied on signal.h  
having been included already.  We could include it conditionally  
but evidently that wouldn't save anything in practice and would  
add more ugly macros, so let's just include signal.h always.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/4166.1533154074%40sss.pgh.pa.us  

M src/include/storage/pmsignal.h

Fix run-time partition pruning for appends with multiple source rels.

commit   : 1c2cb2744bf3d8ad751cd5cf3b347f10f48492b3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Aug 2018 19:42:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Aug 2018 19:42:46 -0400    

Click here for diff

The previous coding here supposed that if run-time partitioning applied to  
a particular Append/MergeAppend plan, then all child plans of that node  
must be members of a single partitioning hierarchy.  This is totally wrong,  
since an Append could be formed from a UNION ALL: we could have multiple  
hierarchies sharing the same Append, or child plans that aren't part of any  
hierarchy.  
  
To fix, restructure the related plan-time and execution-time data  
structures so that we can have a separate list or array for each  
partitioning hierarchy.  Also track subplans that are not part of any  
hierarchy, and make sure they don't get pruned.  
  
Per reports from Phil Florent and others.  Back-patch to v11, since  
the bug originated there.  
  
David Rowley, with a lot of cosmetic adjustments by me; thanks also  
to Amit Langote for review.  
  
Discussion: https://postgr.es/m/HE1PR03MB17068BB27404C90B5B788BCABA7B0@HE1PR03MB1706.eurprd03.prod.outlook.com  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.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/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/nodes/nodes.h
M src/include/nodes/plannodes.h
M src/include/partitioning/partprune.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Fix logical replication slot initialization

commit   : c40489e449ea08e154cd62fa055785873f7bdac8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 17:39:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 17:39:07 -0400    

Click here for diff

This was broken in commit 9c7d06d60680, which inadvertently gave the  
wrong value to fast_forward in one StartupDecodingContext call.  Fix by  
flipping the value.  Add a test for the obvious error, namely trying to  
initialize a replication slot with an nonexistent output plugin.  
  
While at it, move the CreateDecodingContext call earlier, so that any  
errors are reported before sending the CopyBoth message.  
  
Author: Dave Cramer <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CADK3HHLVkeRe1v4P02-5hj55H3_yJg3AEtpXyEY5T3wuzO2jSg@mail.gmail.com  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M src/backend/replication/logical/logical.c
M src/backend/replication/walsender.c

Fix unnoticed variable shadowing in previous commit

commit   : 91bc213d90c5a8f2b2e162d4ecf09b9301027ceb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 17:04:57 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 17:04:57 -0400    

Click here for diff

Per buildfarm.  

M src/backend/executor/execPartition.c

Fix per-tuple memory leak in partition tuple routing

commit   : 1c9bb02d8ec1d5b1b319e4fed70439a403c245b1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 15:06:47 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 1 Aug 2018 15:06:47 -0400    

Click here for diff

Some operations were being done in a longer-lived memory context,  
causing intra-query leaks.  It's not noticeable unless you're doing a  
large COPY, but if you are, it eats enough memory to cause a problem.  
  
Co-authored-by: Kohei KaiGai <[email protected]>  
Co-authored-by: Amit Langote <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CAOP8fzYtVFWZADq4c=KoTAqgDrHWfng+AnEPEZccyxqxPVbbWQ@mail.gmail.com  

M src/backend/executor/execPartition.c

Fix libpq's code for searching .pgpass; rationalize empty-list-item cases.

commit   : e3f99e03e2ec65e7ddb1f3056b545f2afa57b2d0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Aug 2018 12:30:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Aug 2018 12:30:36 -0400    

Click here for diff

Before v10, we always searched ~/.pgpass using the host parameter,  
and nothing else, to match to the "hostname" field of ~/.pgpass.  
(However, null host or host matching DEFAULT_PGSOCKET_DIR was replaced by  
"localhost".)  In v10, this got broken by commit 274bb2b38, repaired by  
commit bdac9836d, and broken again by commit 7b02ba62e; in the code  
actually shipped, we'd search with hostaddr if both that and host were  
specified --- though oddly, *not* if only hostaddr were specified.  
Since this is directly contrary to the documentation, and not  
backwards-compatible, it's clearly a bug.  
  
However, the change wasn't totally without justification, even though it  
wasn't done quite right, because the pre-v10 behavior has arguably been  
buggy since we added hostaddr.  If hostaddr is specified and host isn't,  
the pre-v10 code will search ~/.pgpass for "localhost", and ship that  
password off to a server that most likely isn't local at all.  That's  
unhelpful at best, and could be a security breach at worst.  
  
Therefore, rather than just revert to that old behavior, let's define  
the behavior as "search with host if provided, else with hostaddr if  
provided, else search for localhost".  (As before, a host name matching  
DEFAULT_PGSOCKET_DIR is replaced by localhost.)  This matches the  
behavior of the actual connection code, so that we don't pick up an  
inappropriate password; and it allows useful searches to happen when  
only hostaddr is given.  
  
While we're messing around here, ensure that empty elements within a  
host or hostaddr list select the same behavior as a totally-empty  
field would; for instance "host=a,,b" is equivalent to "host=a,/tmp,b"  
if DEFAULT_PGSOCKET_DIR is /tmp.  Things worked that way in some cases  
already, but not consistently so, which contributed to the confusion  
about what key ~/.pgpass would get searched with.  
  
Update documentation accordingly, and also clarify some nearby text.  
  
Back-patch to v10 where the host/hostaddr list functionality was  
introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update parallel.sgml for Parallel Append

commit   : e80f2b335ecd410b76f7812f728aa4d585ef6f28    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 1 Aug 2018 08:14:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 1 Aug 2018 08:14:05 -0400    

Click here for diff

Patch by me, reviewed by Thomas Munro, in response to a complaint  
from Adrien Nayrat.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/parallel.sgml

Allow multi-inserts during COPY into a partitioned table

commit   : 0d5f05cde011512e605bb2688d9b1fbb5b3ae152    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Aug 2018 10:23:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Aug 2018 10:23:09 +0200    

Click here for diff

CopyFrom allows multi-inserts to be used for non-partitioned tables, but  
this was disabled for partitioned tables.  The reason for this appeared  
to be that the tuple may not belong to the same partition as the  
previous tuple did.  Not allowing multi-inserts here greatly slowed down  
imports into partitioned tables.  These could take twice as long as a  
copy to an equivalent non-partitioned table.  It seems wise to do  
something about this, so this change allows the multi-inserts by  
flushing the so-far inserted tuples to the partition when the next tuple  
does not belong to the same partition, or when the buffer fills.  This  
improves performance when the next tuple in the stream commonly belongs  
to the same partition as the previous tuple.  
  
In cases where the target partition changes on every tuple, using  
multi-inserts slightly slows the performance.  To get around this we  
track the average size of the batches that have been inserted and  
adaptively enable or disable multi-inserts based on the size of the  
batch.  Some testing was done and the regression only seems to exist  
when the average size of the insert batch is close to 1, so let's just  
enable multi-inserts when the average size is at least 1.3.  More  
performance testing might reveal a better number for, this, but since  
the slowdown was only 1-2% it does not seem critical enough to spend too  
much time calculating it.  In any case it may depend on other factors  
rather than just the size of the batch.  
  
Allowing multi-inserts for partitions required a bit of work around the  
per-tuple memory contexts as we must flush the tuples when the next  
tuple does not belong the same partition.  In which case there is no  
good time to reset the per-tuple context, as we've already built the new  
tuple by this time.  In order to work around this we maintain two  
per-tuple contexts and just switch between them every time the partition  
changes and reset the old one.  This does mean that the first of each  
batch of tuples is not allocated in the same memory context as the  
others, but that does not matter since we only reset the context once  
the previous batch has been inserted.  
  
Author: David Rowley <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  

M src/backend/commands/copy.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/execPartition.h
M src/test/regress/input/copy.source
M src/test/regress/output/copy.source

pg_upgrade: fix --check for live source server checks

commit   : b6d6488a3a7077fb2305c360c241a0789d7b657e    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 31 Jul 2018 18:10:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 31 Jul 2018 18:10:06 -0400    

Click here for diff

Fix for commit 244142d32afd02e7408a2ef1f249b00393983822.  
  
Backpatch-through: 9.3  

M src/bin/pg_upgrade/controldata.c

Provide for contrib and pgxs modules to install include files.

commit   : df163230b92b79468c241e9480e7fb85b7614440    
  
author   : Andrew Gierth <[email protected]>    
date     : Tue, 31 Jul 2018 19:58:39 +0100    
  
committer: Andrew Gierth <[email protected]>    
date     : Tue, 31 Jul 2018 19:58:39 +0100    

Click here for diff

This allows out-of-tree PLs and similar code to get access to  
definitions needed to work with extension data types.  
  
The following existing modules now install headers: contrib/cube,  
contrib/hstore, contrib/isn, contrib/ltree, contrib/seg.  
  
Discussion: https://postgr.es/m/87y3euomjh.fsf%40news-spur.riddles.org.uk  

M contrib/cube/Makefile
M contrib/hstore/Makefile
M contrib/isn/Makefile
M contrib/ltree/Makefile
M contrib/seg/Makefile
M doc/src/sgml/extend.sgml
M src/makefiles/pgxs.mk
M src/tools/msvc/Install.pm

Further fixes for quoted-list GUC values in pg_dump and ruleutils.c.

commit   : f3eb76b399efb88882b2984fccdefcea540b2749    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Jul 2018 13:00:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Jul 2018 13:00:07 -0400    

Click here for diff

Commits 742869946 et al turn out to be a couple bricks shy of a load.  
We were dumping the stored values of GUC_LIST_QUOTE variables as they  
appear in proconfig or setconfig catalog columns.  However, although that  
quoting rule looks a lot like SQL-identifier double quotes, there are two  
critical differences: empty strings ("") are legal, and depending on which  
variable you're considering, values longer than NAMEDATALEN might be valid  
too.  So the current technique fails altogether on empty-string list  
entries (as reported by Steven Winfield in bug #15248) and it also risks  
truncating file pathnames during dump/reload of GUC values that are lists  
of pathnames.  
  
To fix, split the stored value without any downcasing or truncation,  
and then emit each element as a SQL string literal.  
  
This is a tad annoying, because we now have three copies of the  
comma-separated-string splitting logic in varlena.c as well as a fourth  
one in dumputils.c.  (Not to mention the randomly-different-from-those  
splitting logic in libpq...)  I looked at unifying these, but it would  
be rather a mess unless we're willing to tweak the API definitions of  
SplitIdentifierString, SplitDirectoriesString, or both.  That might be  
worth doing in future; but it seems pretty unsafe for a back-patched  
bug fix, so for now accept the duplication.  
  
Back-patch to all supported branches, as the previous fix was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/varlena.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_dump.c
M src/include/utils/varlena.h
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

commit   : 23ca82d7ef6c386f2995b812d93426a349e17438    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 31 Jul 2018 11:50:28 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 31 Jul 2018 11:50:28 -0400    

Click here for diff

M src/include/utils/float.h

Remove SGMLism from commit 2d36a5e9dab6

commit   : ed0cfde2e7fca2c129e560491bbb15331f2ff2f4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 31 Jul 2018 08:16:30 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 31 Jul 2018 08:16:30 -0400    

Click here for diff

M doc/src/sgml/auto-explain.sgml

Provide a log_level setting for auto_explain

commit   : 2d36a5e9dab6eda817b3d72a2d0f42c3d0cd922c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 31 Jul 2018 08:03:57 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 31 Jul 2018 08:03:57 -0400    

Click here for diff

Up to now the log level has been hardcoded at LOG. A new  
auto_explain.log_level setting allows that to be modified.  
  
Discussion: https://postgr.es/m/CAPPfruyZh+snR2AdmutrA0B_caj=yWZkLqxUTZYNjJCaQ_wKQg@mail.gmail.com  
  
Tom Dunstan and Andrew Dunstan  
Reviewed by Daniel Gustafsson  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/auto-explain.sgml

Remove dead code left behind by 1b6801051.

commit   : 6574f19127ea539408267c1891ccc12ca5ebeca2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 19:11:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 19:11:02 -0400    

Click here for diff

M src/backend/nodes/bitmapset.c

Verify range bounds to bms_add_range when necessary

commit   : d25d45e4d9221948e6b0d80ce22ce559e99c2f48    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 17:03:19 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 17:03:19 -0400    

Click here for diff

Now that the bms_add_range boundary protections are gone, some  
alternative ones are needed in a few places.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/partitioning/partprune.c

Change bms_add_range to be a no-op for empty ranges

commit   : 1b68010518c9d2ede24e6c721a9c0dc82c358fb1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 17:18:42 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 17:18:42 -0400    

Click here for diff

In commit 84940644de93, bms_add_range was added with an API to fail with  
an error if an empty range was specified.  This seems arbitrary and  
unhelpful, so turn that case into a no-op instead.  Callers that require  
further verification on the arguments or result can apply them by  
themselves.  
  
This fixes the bug that partition pruning throws an API error for a case  
involving the default partition of a default partition, as in the  
included test case.  
  
Reported-by: Rajkumar Raghuwanshi <[email protected]>  
Diagnosed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/bitmapset.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Ensure we build generated headers at the start of some more cases.

commit   : 7dc5a96aa21816ef1223be9c23e10a88db857d8f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 18:04:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 18:04:39 -0400    

Click here for diff

"make installcheck" and some related cases, when invoked from the toplevel  
directory, start out by doing "make all" in src/test/regress.  Since that's  
one make recursion level down, the submake-generated-headers target will  
do nothing, causing us to fail to create/update generated headers before  
building pg_regress.  This is, I believe, a new failure mode induced by  
commit 3b8f6e75f, so let's fix it.  To do so, we have to invoke  
submake-generated-headers at the top level.  
  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M src/Makefile.global.in

Set ActiveSnapshot when logically replaying inserts

commit   : 4f10e7ea7b2231f453bb18b6e710ac333eaf121b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 16:30:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Jul 2018 16:30:07 -0400    

Click here for diff

Input functions for the inserted tuples may require a snapshot, when  
they are replayed by native logical replication.  An example is a domain  
with a constraint using a SQL-language function, which prior to this  
commit failed to apply on the subscriber side.  
  
Reported-by: Mai Peng <[email protected]>  
Co-authored-by: Minh-Quan TRAN <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/worker.c
M src/test/subscription/t/002_types.pl

doc: Improve CREATE COLLATION locking documentation

commit   : 70de0abdb7c6dce24dd5c0e276708ca7c534f99f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 Jul 2018 22:01:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 Jul 2018 22:01:04 +0200    

Click here for diff

Move out of the concurrency control chapter, where mostly only user  
table locks are discussed, and move to CREATE COLLATION reference page.  
  
Author: Amit Langote <[email protected]>  
Author: Kyotaro HORIGUCHI <[email protected]>  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/create_collation.sgml

Fix pg_dump's failure to dump REPLICA IDENTITY for constraint indexes.

commit   : c0a552921b0f5f22ac982b5ad24f1df4fd8ca1b1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 12:35:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 12:35:49 -0400    

Click here for diff

pg_dump knew about printing ALTER TABLE ... REPLICA IDENTITY USING INDEX  
for indexes declared as indexes, but it failed to print that for indexes  
declared as unique or primary-key constraints.  Per report from Achilleas  
Mantzios.  
  
This has been broken since the feature was introduced, AFAICS.  
Back-patch to 9.4.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Doc: fix oversimplified example for CREATE POLICY.

commit   : 9295d7cf50fbcf1f2be19f835c9b2b1f0186fd9b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 11:54:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 Jul 2018 11:54:41 -0400    

Click here for diff

As written, this policy constrained only the post-image not the pre-image  
of rows, meaning that users could delete other users' rows or take  
ownership of such rows, contrary to what the docs claimed would happen.  
We need two separate policies to achieve the documented effect.  
  
While at it, try to explain what's happening a bit more fully.  
  
Per report from Олег Самойлов.  Back-patch to 9.5 where this was added.  
Thanks to Stephen Frost for off-list discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Add ssl_library preset parameter

commit   : 98efa76fe313f62f84b94cd1f46c913c221b41fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jun 2018 10:19:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 26 Jun 2018 10:19:35 +0200    

Click here for diff

This allows querying the SSL implementation used on the server side.  
It's analogous to using PQsslAttribute(conn, "library") in libpq.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  

M doc/src/sgml/config.sgml
M src/backend/libpq/be-secure.c
M src/backend/utils/misc/guc.c
M src/include/libpq/libpq.h
M src/test/ssl/t/001_ssltests.pl

Mark variable used only in assertion with PG_USED_FOR_ASSERTS_ONLY

commit   : ab87b8fedce3fa77ca0d684a42ecc055f189eb33    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 29 Jul 2018 23:08:00 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 29 Jul 2018 23:08:00 +0200    

Click here for diff

Perpendicular lines always intersect, so the line_interpt_line() return  
value in line_closept_point() was used only in an assertion, triggering  
compiler warnings in non-assert builds.  

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

Restore handling of -0 in the C field of lines in line_construct().

commit   : 74294c7301340eeb477343dd26d98d2f3e33bd20    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 29 Jul 2018 20:35:18 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 29 Jul 2018 20:35:18 +0200    

Click here for diff

Commit a7dc63d904 inadvertedly removed this bit originally introduced  
by 43fe90f66a, causing regression test failures on some platforms,  
due to producing {1,-1,-0} instead of {1,-1,0}.  

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

Fix earthdistance test suite function name typo.

commit   : fb17eabf1b513614946bfc37125c83db197d2c68    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 29 Jul 2018 12:02:07 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 29 Jul 2018 12:02:07 -0700    

Click here for diff

Affected test queries have been testing the wrong thing since their  
introduction in commit 4c1383efd132e4f532213c8a8cc63a455f55e344.  
Back-patch to 9.3 (all supported versions).  

M contrib/earthdistance/expected/earthdistance.out
M contrib/earthdistance/sql/earthdistance.sql

Make error message of pageinspect more consistent for raw page inputs

commit   : 59eb12c9c5a5aa980ed89363d143edad712d2c1d    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 29 Jul 2018 23:50:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 29 Jul 2018 23:50:35 +0900    

Click here for diff

There is a copy-paste error from bt_page_items() which got into  
bt_page_items_bytea().  A second message in get_raw_page_internal() was  
inconsistent with all the other sub-modules.  
  
Author: Ashutosh Sharma  
Discussion: https://postgr.es/m/CAE9k0PnZuZ3PVXSyQY91-53E8JKFcaSyknFqqU43r9MabKSYZA@mail.gmail.com  

M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/rawpage.c

Fix two oversights from 9ebe0572 which refactored cluster_rel

commit   : 9f7ba88aa447a0a35006d877eec897b917d1c6c3    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 29 Jul 2018 22:00:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 29 Jul 2018 22:00:42 +0900    

Click here for diff

The recheck option became a no-op as ClusterOption failed to set proper  
values for each element.  There was a second code path where local  
options got overwritten.  
  
Both issues have been spotted by Coverity.  

M src/backend/commands/vacuum.c
M src/include/nodes/parsenodes.h

Document security implications of qualified names.

commit   : e09144e6ce2b3ec120d0405ead2b062183f26c6b    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 28 Jul 2018 20:08:01 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 28 Jul 2018 20:08:01 -0700    

Click here for diff

Commit 5770172cb0c9df9e6ce27c507b449557e5b45124 documented secure schema  
usage, and that advice suffices for using unqualified names securely.  
Document, in typeconv-func primarily, the additional issues that arise  
with qualified names.  Back-patch to 9.3 (all supported versions).  
  
Reviewed by Jonathan S. Katz.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/typeconv.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/utils/adt/ruleutils.c

Provide separate header file for built-in float types

commit   : 6bf0bc842bd75877e31727eb559c6a69e237f831    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 29 Jul 2018 03:30:48 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 29 Jul 2018 03:30:48 +0200    

Click here for diff

Some data types under adt/ have separate header files, but most simple  
ones do not, and their public functions are defined in builtins.h.  As  
the patches improving geometric types will require making additional  
functions public, this seems like a good opportunity to create a header  
for floats types.  
  
Commit 1acf757255 made _cmp functions public to solve NaN issues locally  
for GiST indexes.  This patch reworks it in favour of a more widely  
applicable API.  The API uses inline functions, as they are easier to  
use compared to macros, and avoid double-evaluation hazards.  
  
Author: Emre Hasegeli  
Reviewed-by: Kyotaro Horiguchi  
  
Discussion: https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com  

M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_ts.c
M contrib/cube/cube.c
M contrib/cube/cubeparse.y
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistutil.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/misc/guc.c
M src/include/utils/builtins.h
A src/include/utils/float.h

Refactor geometric functions and operators

commit   : a7dc63d904a6044d299aebdf59ad3199b6a9e99d    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 29 Jul 2018 02:02:48 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 29 Jul 2018 02:02:48 +0200    

Click here for diff

The primary goal of this patch is to eliminate duplicate code and share  
code between different geometric data types more often, to prepare the  
ground for additional patches.  Until now the code reuse was limited,  
probably because the simpler types (line and point) were implemented  
after the more complex ones.  
  
The changes are quite extensive and can be summarised as:  
  
* Eliminate SQL-level function calls.  
* Re-use more functions to implement others.  
* Unify internal function names and signatures.  
* Remove private functions from geo_decls.h.  
* Replace should-not-happen checks with assertions.  
* Add comments describe for various functions.  
* Remove some unreachable code.  
* Define delimiter symbols of line datatype like the other ones.  
* Remove the GEODEBUG macro and printf() calls.  
* Unify code style of a few oddly formatted lines.  
  
While the goal was to cause minimal user-visible changes, it was not  
possible to keep the original behavior in all cases - for example when  
handling NaN values, or when reusing code makes the functions return  
consistent results.  
  
Author: Emre Hasegeli  
Reviewed-by: Kyotaro Horiguchi, me  
  
Discussion: https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com  

M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_spgist.c
M src/include/utils/geo_decls.h
M src/test/regress/regress.c

Add verbosity to pg_basebackup for sync

commit   : fa7d5b704a3786be0f3e3334dd506fe8a46b02bc    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 29 Jul 2018 07:53:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 29 Jul 2018 07:53:11 +0900    

Click here for diff

This is useful to know when the data copy has been finished.  The  
current situation can be confusing for users as the last message is  
"waiting for background process to finish streaming", so it looks like  
this is taking time but the final sync is instead.  
  
Author: Jeff Janes  
Discussion: https://postgr.es/m/CAMkU=1ypeoMJ=tFBG8vP13sxEtXd4Pm_x1SqsJdW_RvzpcvN=A@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

pgtest: run clean, build, and check stages separately

commit   : e2c0df7828b9e91963a05f5151a7d6eead014132    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 15:34:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 15:34:06 -0400    

Click here for diff

This allows for cleaner error reporting.  
  
Backpatch-through: 9.5  

M src/tools/pgtest

pg_upgrade: check for clean server shutdowns

commit   : 244142d32afd02e7408a2ef1f249b00393983822    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 15:01:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 15:01:55 -0400    

Click here for diff

Previously pg_upgrade checked for the pid file and started/stopped the  
server to force a clean shutdown.  However, "pg_ctl -m immediate"  
removes the pid file but doesn't do a clean shutdown, so check  
pg_controldata for a clean shutdown too.  
  
Diagnosed-by: Vimalraj A  
  
Discussion: https://postgr.es/m/CAFKBAK5e4Q-oTUuPPJ56EU_d2Rzodq6GWKS3ncAk3xo7hAsOZg@mail.gmail.com  
  
Backpatch-through: 9.3  

M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/pg_upgrade.c

pg_upgrade: report database names with missing extension libs

commit   : 60e3bd1d7f92430b24b710ecf0559656eb8ed499    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 12:33:54 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 12:33:54 -0400    

Click here for diff

Previously only the missing library name was reported, forcing users to  
look in all databases to find the library entries.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Daniel Gustafsson, me  

M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/pg_upgrade.h

pgtest: grab possible warnings from install.log

commit   : 96313bff295ca2c4f7cb144b1feca825db17da23    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 11:35:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 28 Jul 2018 11:35:53 -0400    

Click here for diff

Since PG 9.5, 'make check' records the build output in install.log, so  
look in there for warnings too.  
  
Backpatch-through: 9.5  

M src/tools/pgtest

Reduce path length for locking leaf B-tree pages during insertion

commit   : d2086b08b023c0749a53d617ff3fe0f052646254    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 28 Jul 2018 00:31:40 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 28 Jul 2018 00:31:40 +0300    

Click here for diff

In our B-tree implementation appropriate leaf page for new tuple  
insertion is acquired using _bt_search() function.  This function always  
returns leaf page locked in shared mode.  In order to obtain exclusive  
lock, caller have to relock the page.  
  
This commit makes _bt_search() function lock leaf page immediately in  
exclusive mode when needed.  That removes unnecessary relock and, in  
turn reduces lock contention for B-tree leaf pages.  Our experiments  
on multi-core systems showed acceleration up to 4.5 times in corner  
case.  
  
Discussion: https://postgr.es/m/CAPpHfduAMDFMNYTCN7VMBsFg_hsf0GqiqXnt%2BbSeaJworwFoig%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Yoshikazu Imai, Simon Riggs, Peter Geoghegan  

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

Fix grammar in README.tuplock

commit   : 8a9b72c3ea40c1ca1094bdcfd21a5263aee806f2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 27 Jul 2018 10:56:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 27 Jul 2018 10:56:30 -0400    

Click here for diff

Author: Brad DeJong  
Discussion: https://postgr.es/m/CAJnrtnxrA4FqZi0Z6kGPQKMiZkWv2xxgSDQ+hv1jDrf8WCKjjw@mail.gmail.com  

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

Use key and partdesc from PartitionDispatch where possible.

commit   : 3e32109049142d3b6adb3b45afd0bb0dea24c23a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 27 Jul 2018 09:34:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 27 Jul 2018 09:34:57 -0400    

Click here for diff

Instead of repeatedly fishing the data out of the relcache entry,  
let's use the version that we cached in the PartitionDispatch.  We  
could alternatively rip out the PartitionDispatch fields altogether,  
but it doesn't make much sense to have them and not use them; before  
this patch, partdesc was set but altogether unused.  Amit Langote and  
I both thought using them was a litle better than removing them, so  
this patch takes that approach.  
  
Discussion: http://postgr.es/m/CA+TgmobFnxcaW-Co-XO8=yhJ5pJXoNkCj6Z7jm9Mwj9FGv-D7w@mail.gmail.com  

M src/backend/executor/execPartition.c

Fix the buffer release order for parallel index scans.

commit   : 8ce29bb4f0df0806cf1995594b6390e9a9997665    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 27 Jul 2018 10:53:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 27 Jul 2018 10:53:00 +0530    

Click here for diff

During parallel index scans, if the current page to be read is deleted, we  
skip it and try to get the next page for a scan without releasing the buffer  
lock on the current page.  To get the next page, sometimes it needs to wait  
for another process to complete its scan and advance it to the next page.  
Now, it is quite possible that the master backend has errored out before  
advancing the scan and issued a termination signal for all workers.  The  
workers failed to notice the termination request during wait because the  
interrupts are held due to buffer lock on the previous page.  This lead to  
all workers being stuck.  
  
The fix is to release the buffer lock on current page before trying to get  
the next page.  We are already doing same in backward scans, but missed  
it for forward scans.  
  
Reported-by: Victor Yegorov  
Bug: 15290  
Diagnosed-by: Thomas Munro and Amit Kapila  
Author: Amit Kapila  
Reviewed-by: Thomas Munro  
Tested-By: Thomas Munro and Victor Yegorov  
Backpatch-through: 10 where parallel index scans were introduced  
Discussion: https://postgr.es/m/[email protected]  

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

Fix handling of pgbench's hash when no argument is provided

commit   : 39d51fe87dae843574fa2349128679800bfe7ccd    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 27 Jul 2018 13:40:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 27 Jul 2018 13:40:24 +0900    

Click here for diff

Depending on the platform used, this can cause a crash in the worst  
case, or an unhelpful error message, so fail gracefully.  
  
Author: Fabien Coelho  
Discussion: https://postgr.es/m/alpine.DEB.2.21.1807262302550.29874@lancre  
Backpatch: 11-, where hash() has been added in pgbench.  

M src/bin/pgbench/exprparse.y
M src/bin/pgbench/t/002_pgbench_no_server.pl

Provide plpgsql tests for cases involving record field changes.

commit   : 9f77ad2672f1be0c475428db7bf52b572af3c65f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jul 2018 18:18:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jul 2018 18:18:37 -0400    

Click here for diff

We suppressed one of these test cases in commit feb1cc559 because  
it was failing to produce the expected results on CLOBBER_CACHE_ALWAYS  
buildfarm members.  But now we need another test with similar behavior,  
so let's set up a test file that is expected to vary between regular and  
CLOBBER_CACHE_ALWAYS cases, and provide variant expected files.  
  
Someday we should fix plpgsql's failure for change-of-field-type, and  
then the discrepancy will go away and we can fold these tests back  
into plpgsql_record.sql.  But today is not that day.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_cache.out
A src/pl/plpgsql/src/expected/plpgsql_cache_1.out
M src/pl/plpgsql/src/expected/plpgsql_record.out
A src/pl/plpgsql/src/sql/plpgsql_cache.sql
M src/pl/plpgsql/src/sql/plpgsql_record.sql

Avoid crash in eval_const_expressions if a Param's type changes.

commit   : 662d12aea1d697adc4896ff7e5d5cf398c0cd267    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 Jul 2018 16:08:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 Jul 2018 16:08:45 -0400    

Click here for diff

Since commit 6719b238e it's been possible for the values of plpgsql  
record field variables to be exposed to the planner as Params.  
(Before that, plpgsql never supplied values for such variables during  
planning, so that the problematic code wasn't reached.)  Other places  
that touch potentially-type-mutable Params either cope gracefully or  
do runtime-test-and-ereport checks that the type is what they expect.  
But eval_const_expressions() just had an Assert, meaning that it either  
failed the assertion or risked crashes due to using an incompatible  
value.  
  
In this case, rather than throwing an ereport immediately, we can just  
not perform a const-substitution in case of a mismatch.  This seems  
important for the same reason that the Param fetch was speculative:  
we might not actually reach this part of the expression at runtime.  
  
Test case will follow in a separate commit.  
  
Patch by me, pursuant to bug report from Andrew Gierth.  
Back-patch to v11 where the previous commit appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/clauses.c

LLVMJIT: Release JIT context after running ExprContext shutdown callbacks.

commit   : 3acc4acd9bcbefbfaf789762950726c6208daf1b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 25 Jul 2018 16:31:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 25 Jul 2018 16:31:49 -0700    

Click here for diff

Due to inlining it previously was possible that an ExprContext's  
shutdown callback pointed to a JITed function. As the JIT context  
previously was shut down before the shutdown callbacks were called,  
that could lead to segfaults.  Fix the ordering.  
  
Reported-By: Dmitry Dolgov  
Author: Andres Freund  
Discussion: https://postgr.es/m/CA+q6zcWO7CeAJtHBxgcHn_hj+PenM=tvG0RJ93X1uEJ86+76Ug@mail.gmail.com  
Backpatch: 11-, where JIT compilation was added  

M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c

LLVMJIT: Check for 'noinline' attribute in recursively inlined functions.

commit   : bcafa263ec408ae8e383e389832b2a623900a55c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 25 Jul 2018 16:23:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 25 Jul 2018 16:23:59 -0700    

Click here for diff

Previously the attribute was only checked for external functions  
inlined, not "static" functions that had to be inlined as  
dependencies.  
  
This isn't really a bug, but makes debugging a bit harder. The new  
behaviour also makes more sense. Therefore backpatch.  
  
Author: Andres Freund  
Backpatch: 11-, where JIT compilation was added  

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

Add strict_multi_assignment and too_many_rows plpgsql checks

commit   : 167075be3ab1547e186096bb8e6e448cd8eea5af    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 25 Jul 2018 01:09:03 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 25 Jul 2018 01:09:03 +0200    

Click here for diff

Until now shadowed_variables was the only plpgsql check supported by  
plpgsql.extra_warnings and plpgsql.extra_errors.  This patch introduces  
two new checks - strict_multi_assignment and too_many_rows.  Unlike  
shadowed_variables, these new checks are enforced at run-time.  
  
strict_multi_assignment checks that commands allowing multi-assignment  
(for example SELECT INTO) have the same number of sources and targets.  
too_many_rows checks that queries with an INTO clause return one row  
exactly.  
  
These checks are aimed at cases that are technically valid and allowed,  
but are often a sign of a bug.  Therefore those checks are expected to  
be enabled primarily in development and testing environments.  
  
Author: Pavel Stehule  
Reviewed-by: Stephen Frost, Tomas Vondra  
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRA2kKRDKpUNwLY0GeG1OqOp+tLS2yQA1V41gzuSz-hCng@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Pad semaphores to avoid false sharing.

commit   : 2d3067595299d2ac1f29bbc26a83a99d59b33d4e    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 25 Jul 2018 10:57:52 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 25 Jul 2018 10:57:52 +1200    

Click here for diff

In a USE_UNNAMED_SEMAPHORES build, the default on Linux and FreeBSD  
since commit ecb0d20a, we have an array of sem_t objects.  This  
turned out to reduce performance compared to the previous default  
USE_SYSV_SEMAPHORES on an 8 socket system.  Testing showed that the  
lost performance could be regained by padding the array elements so  
that they have their own cache lines.  This matches what we do for  
similar hot arrays (see LWLockPadded, WALInsertLockPadded).  
  
Back-patch to 10, where unnamed semaphores were adopted as the default  
semaphore interface on those operating systems.  
  
Author: Thomas Munro  
Reviewed-by: Andres Freund  
Reported-by: Mithun Cy  
Tested-by: Mithun Cy, Tom Lane, Thomas Munro  
Discussion: https://postgr.es/m/CAD__OugYDM3O%2BdyZnnZSbJprSfsGFJcQ1R%3De59T3hcLmDug4_w%40mail.gmail.com  

M src/backend/port/posix_sema.c

doc: Fix reference to "decoder" to instead be the correct "output plugin".

commit   : 487bcc6ea6757a563fff188a9551e011d85b6caa    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 24 Jul 2018 10:42:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 24 Jul 2018 10:42:59 -0700    

Click here for diff

Author: Jonathan Katz  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-, where logical decoding was added  

M doc/src/sgml/test-decoding.sgml

Defend against some potential spurious compiler warnings in 86eaf208e.

commit   : b2bb3dc0e0d9825640654b9ae0b82c1a747d42ea    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 24 Jul 2018 08:59:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 24 Jul 2018 08:59:36 -0700    

Click here for diff

Author: David Rowley  
Discussion: https://postgr.es/m/CAKJS1f-AbCFeFU92GZZYqNOVRnPtUwczSYmR2NHCyf9uHUnNiw@mail.gmail.com  

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

psql: Add option for procedures to \df

commit   : fb421231daaa5228542ef6644cdee505fbc31dba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 14 Jul 2018 12:17:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 14 Jul 2018 12:17:49 +0200    

Click here for diff

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

Refactor cluster_rel() to handle more options

commit   : 9ebe0572ceab69c57811746ead2d3418daea8673    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 24 Jul 2018 11:37:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 24 Jul 2018 11:37:32 +0900    

Click here for diff

This extends cluster_rel() in such a way that more options can be added  
in the future, which will reduce the amount of chunk code for an  
upcoming SKIP_LOCKED aimed for VACUUM.  As VACUUM FULL is a different  
flavor of CLUSTER, we want to make that extensible to ease integration.  
  
This only reworks the API and its callers, without providing anything  
user-facing.  Two options are present now: verbose mode and relation  
recheck when doing the cluster command work across multiple  
transactions.  This could be used as well as a base to extend the  
grammar of CLUSTER later on.  
  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/commands/cluster.h
M src/include/nodes/parsenodes.h
M src/tools/pgindent/typedefs.list

Fix calculation for WAL segment recycling and removal

commit   : d9fadbf13103d46c0c6b4b92c62ee13f57524896    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 24 Jul 2018 10:32:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 24 Jul 2018 10:32:56 +0900    

Click here for diff

Commit 4b0d28de06 has removed the prior checkpoint and related  
facilities but has left WAL recycling based on the LSN of the prior  
checkpoint, which causes incorrect calculations for WAL removal and  
recycling for max_wal_size and min_wal_size.  This commit changes things  
so as the base calculation point is the last checkpoint generated.  
  
Reported-by: Kyotaro Horiguchi  
Author: Kyotaro Horiguchi  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where the prior checkpoint has been removed.  

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

Use setproctitle_fast() to update the ps status, if available.

commit   : 1bc180cd2acc55e31b61c4cc9ab4b07670a2566e    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 24 Jul 2018 13:09:22 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 24 Jul 2018 13:09:22 +1200    

Click here for diff

FreeBSD has introduced a faster variant of setproctitle().  Use it,  
where available.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/CAEepm=1wKMTi81uodJ=1KbJAz5WedOg=cr8ewEXrUFeaxWEgww@mail.gmail.com  

M configure
M configure.in
M src/backend/utils/misc/ps_status.c
M src/include/pg_config.h.in

pgbench: Remove duplicate entries from table of builtin functions.

commit   : 3214463228f45df033c14ed3925a318a99d72ce2    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 23 Jul 2018 11:48:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 23 Jul 2018 11:48:38 -0400    

Click here for diff

Fabien Coelho  
  
Discussion: http://postgr.es/m/alpine.DEB.2.21.1807221822320.19939@lancre  

M src/bin/pgbench/exprparse.y

LLVMJIT: Adapt to API changes in gdb and perf support.

commit   : e9a9843e1380c42a22fe5a89229afa98f1668ef3    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 21:13:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 21:13:20 -0700    

Click here for diff

During the work of upstreaming my previous patches for gdb and perf  
support the API changed. Adapt.  Normally this wouldn't necessarily be  
something to backpatch, but the previous API wasn't upstream, and at  
least the gdb support is quite useful for debugging.  
  
Author: Andres Freund  
Backpatch: 11, where LLVM based JIT support was added.  

M config/llvm.m4
M configure
M src/backend/jit/llvm/llvmjit.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32

LLVMJIT: Fix LLVM build for LLVM > 7.

commit   : a38b833a7ca41c9f68fbaebc93762627ea527c26    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 21:05:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 21:05:06 -0700    

Click here for diff

The location of LLVMAddPromoteMemoryToRegisterPass moved.  
  
Author: Andres Freund  
Backpatch: 11, where LLVM based JIT support was added.  

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

Reset context at the tail end of JITed EEOP_AGG_PLAIN_TRANS.

commit   : 1307bc3d45c1a8a72c7483f2a81e72725116f007    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 20:31:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 20:31:22 -0700    

Click here for diff

While no negative consequences are currently known, it's clearly wrong  
to not reset the context in one of the branches.  
  
Reported-By: Dmitry Dolgov  
Author: Dmitry Dolgov  
Discussion: https://postgr.es/m/CAGPqQf165-=+Drw3Voim7M5EjHT1zwPF9BQRjLFQzCzYnNZEiQ@mail.gmail.com  
Backpatch: 11-, where JIT compilation support was added  

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

Mop-up for 3522d0eaba5, which missed some alternative output files.

commit   : 013f320dc390e501a766f89c5a8f650f4574d70f    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 17:27:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 17:27:05 -0700    

Click here for diff

M doc/src/sgml/sources.sgml
M src/pl/plpython/expected/plpython_subtransaction_0.out
M src/pl/plpython/expected/plpython_subtransaction_5.out
M src/pl/plpython/expected/plpython_types_3.out
M src/test/regress/expected/int8-exp-three-digits.out

Add proper errcodes to new error messages for read() failures

commit   : e41d0a1090b75fed4c033c2e404643382348f88e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Jul 2018 09:37:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Jul 2018 09:37:36 +0900    

Click here for diff

Those would use the default ERRCODE_INTERNAL_ERROR, but for foreseeable  
failures an errcode ought to be set, ERRCODE_DATA_CORRUPTED making the  
most sense here.  
  
While on the way, fix one errcode_for_file_access missing in origin.c  
since the code has been created, and remove one assignment of errno to 0  
before calling read(), as this was around to fit with what was present  
before 811b6e36 where errno would not be set when not enough bytes are  
read.  I have noticed the first one, and Tom has pinged me about the  
second one.  
  
Author: Michael Paquier  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/utils/cache/relmapper.c
M src/common/controldata_utils.c

commit   : 56df07bb9e50a3ca4d148c537524f00bccc6650e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Jul 2018 09:19:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Jul 2018 09:19:12 +0900    

Click here for diff

Some error messages which report something about a file operation use  
as well context which is already provided within the path being worked  
on, making things rather duplicated.  This creates more work for  
translators, and does not actually bring clarity.  
  
More could be done, however in a lot of cases the context used is  
actually useful, still that patch gets down things with a good cut.  
  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/transam/xlog.c
M src/bin/pg_basebackup/pg_recvlogical.c

Fix JITed EEOP_AGG_INIT_TRANS, which missed some state.

commit   : 6b4d860311e99621681f25db5db82f88348d8ea6    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 16:47:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 16:47:00 -0700    

Click here for diff

The JIT compiled implementation missed maintaining  
AggState->{current_set,curaggcontext}. That could lead to trouble  
because the transition value could be allocated in the wrong context.  
  
Reported-By: Rushabh Lathia  
Diagnosed-By: Dmitry Dolgov  
Author: Dmitry Dolgov, with minor changes by me  
Discussion: https://postgr.es/m/CAGPqQf165-=+Drw3Voim7M5EjHT1zwPF9BQRjLFQzCzYnNZEiQ@mail.gmail.com  
Backpatch: 11-, where JIT compilation support was added  

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

Hand code string to integer conversion for performance.

commit   : 86eaf208ea048936df6be77276a246d3f92e9620    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 14:58:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 14:58:01 -0700    

Click here for diff

As benchmarks show, using libc's string-to-integer conversion is  
pretty slow. At least part of the reason for that is that strtol[l]  
have to be more generic than what largely is required inside pg.  
  
This patch considerably speeds up int2/int4 input (int8 already was  
already using hand-rolled code).  
  
Most of the existing pg_atoi callers have been converted. But as one  
requires pg_atoi's custom delimiter functionality, and as it seems  
likely that there's external pg_atoi users, it seems sensible to just  
keep pg_atoi around.  
  
Author: Andres Freund  
Reviewed-By: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M contrib/spi/refint.c
M doc/src/sgml/sources.sgml
M src/backend/libpq/pqmq.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/varlena.c
M src/include/utils/builtins.h
M src/test/regress/expected/int2.out
M src/test/regress/expected/select_parallel.out

Deduplicate "invalid input syntax" messages for various types.

commit   : 3522d0eaba5a976f09a48810dd25dff6ab3565df    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 14:58:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 Jul 2018 14:58:01 -0700    

Click here for diff

Previously a lot of the error messages referenced the type in the  
error message itself. That requires that the message is translated  
separately for each type.  
  
Note that currently a few smallint cases continue to reference the  
integer, rather than smallint, type. A later patch will create a  
separate routine for 16bit input.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/expected/dblink.out
M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/xtypes.sgml
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/timestamp.c
M src/pl/plpython/expected/plpython_subtransaction.out
M src/pl/plpython/expected/plpython_types.out
M src/pl/tcl/expected/pltcl_subxact.out
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/copy2.out
M src/test/regress/expected/int2.out
M src/test/regress/expected/int4.out
M src/test/regress/expected/int8.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/regress.c
M src/tutorial/complex.c

Further portability hacking in pg_upgrade's test script.

commit   : 04269320aed30d3e37c10ae77775954eae234d45    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Jul 2018 15:40:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Jul 2018 15:40:51 -0400    

Click here for diff

I blew the dust off a Bourne shell (file date 1996, yea verily) and  
tried to run test.sh with it.  It mostly worked, but I found that the  
temp-directory creation code introduced by commit be76a6d39 was not  
compatible, for a couple of reasons: this shell thinks "set -e" should  
force an exit if a command within backticks fails, and it also thinks code  
within braces should be executed by a sub-shell, meaning that variable  
settings don't propagate back up to the parent shell.  In view of Victor  
Wagner's report that Solaris is still using pre-POSIX shells, seems like  
we oughta make this case work.  It's not like the code is any less  
idiomatic this way; the prior coding technique appeared nowhere else.  
  
(There is a remaining bash-ism here, which is that $RANDOM doesn't do  
what the code hopes in non-bash shells.  But the use of $$ elsewhere in  
that path should be enough to ensure uniqueness and some amount of  
randomness, so I think it's okay as-is.)  
  
Back-patch to all supported branches, as the previous commit was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Be more paranoid about quoting in pg_upgrade's test script.

commit   : 0c0908d926cc65c5a10f9507580be3aacce08cf1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Jul 2018 12:05:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Jul 2018 12:05:25 -0400    

Click here for diff

Double-quote $PGDATA in "find" commands introduced by commit da9b580d8,  
in case that path contains spaces or other special characters.  
  
Adjust a few other places so that quoting is done more consistently.  
None of the others are actual bugs AFAICS, but it's confusing to readers  
if the same thing is done differently in different places.  
  
Noted by Tels.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Avoid unportable shell syntax in pg_upgrade's test script.

commit   : 986127e3db6858c461dae00f23c1fbaf9302d8cb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Jul 2018 13:59:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Jul 2018 13:59:27 -0400    

Click here for diff

Most of test.sh uses traditional backtick syntax for command substitution,  
but commit da9b580d8 introduced two uses of $(...) syntax, which is not  
recognized by very old shells.  Bring those into line with the rest.  
  
Victor Wagner  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/test.sh

Guard against rare RAND_bytes() failures in pg_strong_random().

commit   : 8f6ce7fb090a674f18b72e89a2b868fe1343fe8f    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 20 Jul 2018 08:55:44 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 20 Jul 2018 08:55:44 +0100    

Click here for diff

When built using OpenSSL, pg_strong_random() uses RAND_bytes() to  
generate the random number. On very rare occasions that can fail, if  
its PRNG has not been seeded with enough data. Additionally, once it  
does fail, all subsequent calls will also fail until more seed data is  
added. Since this is required during backend startup, this can result  
in all new backends failing to start until a postmaster restart.  
  
Guard against that by checking the state of OpenSSL's PRNG using  
RAND_status(), and if necessary (very rarely), seeding it using  
RAND_poll().  
  
Back-patch to v10, where pg_strong_random() was introduced.  
  
Dean Rasheed and Michael Paquier.  
  
Discussion: https://postgr.es/m/CAEZATCXMtxbzSAvyKKk5uCRf9pNt4UV%2BF_5v%3DgLfJUuPxU4Ytg%40mail.gmail.com  

M src/port/pg_strong_random.c

Bump catalog version for recent toast table additions

commit   : f2b1316a94796b69eed6773cfb38267947ea19ac    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 20 Jul 2018 09:28:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 20 Jul 2018 09:28:19 +0900    

Click here for diff

This has been forgotten in 96cdeae.  

M src/include/catalog/catversion.h

Add toast tables to most system catalogs

commit   : 96cdeae07f93556df73112456b795d6d35998a0e    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 20 Jul 2018 07:43:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 20 Jul 2018 07:43:41 +0900    

Click here for diff

It has been project policy to create toast tables only for those catalogs  
that might reasonably need one.  Since this judgment call can change over  
time, just create one for every catalog, as this can be useful when  
creating rather-long entries in catalogs, with recent examples being in  
the shape of policy expressions or customly-formatted SCRAM verifiers.  
  
To prevent circular dependencies and to avoid adding complexity to VACUUM  
FULL logic, exclude pg_class, pg_attribute, and pg_index.  Also, to  
prevent pg_upgrade from seeing a non-empty new cluster, exclude  
pg_largeobject and pg_largeobject_metadata from the set as large object  
data is handled as user data.  Those relations have no reason to use a  
toast table anyway.  
  
Author: Joe Conway, John Naylor  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/catalog.c
M src/include/catalog/toasting.h
M src/test/regress/expected/misc_sanity.out
M src/test/regress/sql/misc_sanity.sql

Remove undocumented restriction against duplicate partition key columns.

commit   : 24097167558bafbc1ea32f67ea5840e5650ad4e7    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 15:41:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 15:41:46 -0400    

Click here for diff

transformPartitionSpec rejected duplicate simple partition columns  
(e.g., "PARTITION BY RANGE (x,x)") but paid no attention to expression  
columns, resulting in inconsistent behavior.  Worse, cases like  
"PARTITION BY RANGE (x,(x))") were accepted but would then result in  
dump/reload failures, since the expression (x) would get simplified  
to a plain column later.  
  
There seems no better reason for this restriction than there was for  
the one against duplicate included index columns (cf commit 701fd0bbc),  
so let's just remove it.  
  
Back-patch to v10 where this code was added.  
  
Report and patch by Yugo Nagata.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Improve psql's \d command to show whether index columns are key columns.

commit   : 90371a24a5367c357d7b046383dad8ee352b938b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 14:53:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 14:53:41 -0400    

Click here for diff

This is essential information when looking at an index that has  
"included" columns.  Per discussion, follow the style used in \dC  
and some other places: column header is "Key?" and values are "yes"  
or "no" (all translatable).  
  
While at it, revise describeOneTableDetails to be a bit more maintainable:  
avoid hard-wired column numbers and multiple repetitions of what needs  
to be identical test logic.  This also results in the emitted catalog  
query corresponding more closely to what we print, which should be a  
benefit to users of ECHO_HIDDEN mode, and perhaps a bit faster too  
(the old logic sometimes asked for values it would not print, even  
ones that are fairly expensive to get).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/index_including.out
M src/test/regress/output/tablespace.source

Fix pg_get_indexdef()'s behavior for included index columns.

commit   : 028e3da2949482fa56f3ffdbda840782f2953b0b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 13:48:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Jul 2018 13:48:05 -0400    

Click here for diff

The multi-argument form of pg_get_indexdef() failed to print anything when  
asked to print a single index column that is an included column rather than  
a key column.  This seems an unintentional result of someone having tried  
to take a short-cut and use the attrsOnly flag for two different purposes.  
To fix, split said flag into two flags, attrsOnly which suppresses  
non-attribute info, and keysOnly which suppresses included columns.  
Add a test case using psql's \d command, which relies on that function.  
  
(It's mighty tempting at this point to replace pg_get_indexdef_worker's  
mess of boolean flag arguments with a single bitmask-of-flags argument,  
which would allow making the call sites much more self-documenting.  
But I refrained for the moment.)  
  
Discussion: https://postgr.es/m/[email protected]  

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

Rewrite comments in replication slot advance implementation

commit   : 1573995f55994ee04dd0d69481de17d662ad8e88    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jul 2018 14:15:44 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 Jul 2018 14:15:44 -0400    

Click here for diff

The code added by 9c7d06d60680 was a bit obscure; clarify that by  
rewriting the comments.  Lack of clarity has already caused bugs, so  
it's a worthy goal.  
  
Co-authored-by: Arseny Sher <[email protected]>  
Co-authored-by: Michaël Paquier <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Petr Jelínek <[email protected]>  
Discussion: https://postgr.es/m/87y3fgoyrn.fsf@ars-thinkpad  

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

Fix handling of empty uncompressed posting list pages in GIN

commit   : 309765fa1e317597bfd341fa99dfa97ea5722890    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 19 Jul 2018 21:04:17 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 19 Jul 2018 21:04:17 +0300    

Click here for diff

PostgreSQL 9.4 introduces posting list compression in GIN.  This feature  
supports online upgrade, so that after pg_upgrade uncompressed posting  
lists are compressed on-the-fly.  Underlying code appears to always  
expect at least one item on uncompressed posting list page.  But there  
could be completely empty pages, because VACUUM never deletes leftmost  
and rightmost pages from posting trees.  This commit fixes that.  
  
Reported-by: Sivasubramanian Ramasubramanian  
Discussion: https://postgr.es/m/1531867212836.63354%40amazon.com  
Author: Sivasubramanian Ramasubramanian, Alexander Korotkov  
Backpatch-through: 9.4  

M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginxlog.c

Fix error message when a hostaddr cannot be parsed.

commit   : b90d97e081415768468295cc4d10d7ee21881964    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 20:24:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 20:24:29 +0300    

Click here for diff

We were incorrectly passing hostname, not hostaddr, in the error message,  
and because of that, you got:  
  
$ psql 'hostaddr=foo'  
psql: could not parse network address "(null)": Name or service not known  
  
Backpatch to v10, where this was broken (by commit 7b02ba62e9).  
  
Report and fix by Robert Haas.  
  
Discussion: https://www.postgresql.org/message-id/CA+TgmoapFQA30NomGKEaZCu3iN7mF7fux8fbbk9SouVOT2JP7w@mail.gmail.com  

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

Rephrase a few comments for clarity.

commit   : 99fdebaf2da9160ec49a80854dc99e46722a9a03    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 16:08:09 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 16:08:09 +0300    

Click here for diff

I was confused by what "intended to be parallel serially" meant, until  
Robert Haas and David G. Johnston explained it. Rephrase the comment to  
make it more clear, using David's suggested wording.  
  
Discussion: https://www.postgresql.org/message-id/1fec9022-41e8-e484-70ce-2179b08c2092%40iki.fi  

M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSeqscan.c

Fix comment.

commit   : 405cb356d6104eccf34acc2e4944d711b0961c7d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 15:39:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 15:39:06 +0300    

Click here for diff

This comment was copy-pasted from nodeAppend.c to nodeMergeAppend.c, but  
while committing 5220bb7533, I modified wrong copy of it.  
  
Spotted by David Rowley  

M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c

Expand run-time partition pruning to work with MergeAppend

commit   : 5220bb7533f9891b1e071da6461d5c387e8f7b09    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 13:49:43 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 19 Jul 2018 13:49:43 +0300    

Click here for diff

This expands the support for the run-time partition pruning which was added  
for Append in 499be013de to also allow unneeded subnodes of a MergeAppend  
to be removed.  
  
Author: David Rowley  
Discussion: https://www.postgresql.org/message-id/CAKJS1f_F_V8D7Wu-HVdnH7zCUxhoGK8XhLLtd%3DCu85qDZzXrgg%40mail.gmail.com  

M doc/src/sgml/perform.sgml
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Fix print of Path nodes when using OPTIMIZER_DEBUG

commit   : b33ef397a1698ddd06f325d0f92a6643ec55577f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Jul 2018 09:54:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Jul 2018 09:54:39 +0900    

Click here for diff

GatherMergePath (introduced in 10) and CustomPath (introduced in 9.5)  
have gone missing.  The order of the Path nodes was inconsistent with  
what is listed in nodes.h, so make the order consistent at the same time  
to ease future checks and additions.  
  
Author: Sawada Masahiko  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/CAD21AoBQMLoc=ohH-oocuAPsELrmk8_EsRJjOyR8FQLZkbE0wA@mail.gmail.com  

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

Fix re-parameterize of MergeAppendPath

commit   : c6598b8b0514bcb9b4c99f2412927368a7514180    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Jul 2018 09:01:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Jul 2018 09:01:57 +0900    

Click here for diff

Instead of MergeAppendPath, MergeAppend nodes were considered.  This  
code is not covered by any tests now, which should be addressed at some  
point.  
  
This is an oversight from f49842d, which introduced partition-wise joins  
in v11, so back-patch down to that.  
  
Author: Michael Paquier  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/pathnode.c

Remove race-prone hot_standby_feedback test cases in 001_stream_rep.pl.

commit   : a360f952ff028f8b85029334c54c025c716eb68e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 17:39:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 17:39:27 -0400    

Click here for diff

This script supposed that if it turned hot_standby_feedback on and then  
shut down the standby server, at least one feedback message would be  
guaranteed to be sent before the standby stops.  But there is no such  
guarantee, if the standby's walreceiver process is slow enough --- and  
we've seen multiple failures in the buildfarm showing that that does  
happen in practice.  While we could rearrange the walreceiver logic to  
make it less likely, it seems probably impossible to create a really  
bulletproof guarantee of that sort; and if we tried, we might create  
situations where the walreceiver wouldn't react in a timely manner to  
shutdown commands.  It seems better instead to remove the script's  
assumption that feedback will occur before shutdown.  
  
But once we do that, these last few tests seem quite redundant with  
the earlier tests in the script.  So let's just drop them altogether  
and save some buildfarm cycles.  
  
Backpatch to v10 where these tests were added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/001_stream_rep.pl

Drop the rule against included index columns duplicating key columns.

commit   : 701fd0bbc98fe8211d36e96f90753985104cd295    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 14:43:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 14:43:03 -0400    

Click here for diff

The initial version of the included-index-column feature stated that  
included columns couldn't be the same as any key column of the index.  
While it'd be pretty silly to do that, since the included column would be  
entirely redundant, we've never prohibited redundant index columns before  
so it's not very consistent to do so here.  Moreover, the prohibition  
was itself badly implemented, so that it failed to reject columns that  
were effectively identical but not spelled quite alike, as reported by  
Aditya Toshniwal.  
  
(Moreover, it's not hard to imagine that for some non-btree index types,  
such cases would be non-silly anyhow: the index might use a lossy  
representation for key columns but be able to support retrieval of the  
original form of included columns.)  
  
Hence, let's just drop the prohibition.  
  
In passing, do some copy-editing on the documentation for the  
included-column feature.  
  
Yugo Nagata; documentation and test corrections by me  
  
Discussion: https://postgr.es/m/CAM9w-_mhBCys4fQNfaiQKTRrVWtoFrZ-wXmDuE9Nj5y-Y7aDKQ@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/indexcmds.c
M src/test/regress/expected/index_including.out
M src/test/regress/sql/index_including.sql

Use a ResourceOwner to track buffer pins in all cases.

commit   : 3cb646264e8ced9f25557ce271284da512d92043    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 12:15:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Jul 2018 12:15:16 -0400    

Click here for diff

Historically, we've allowed auxiliary processes to take buffer pins without  
tracking them in a ResourceOwner.  However, that creates problems for error  
recovery.  In particular, we've seen multiple reports of assertion crashes  
in the startup process when it gets an error while holding a buffer pin,  
as for example if it gets ENOSPC during a write.  In a non-assert build,  
the process would simply exit without releasing the pin at all.  We've  
gotten away with that so far just because a failure exit of the startup  
process translates to a database crash anyhow; but any similar behavior  
in other aux processes could result in stuck pins and subsequent problems  
in vacuum.  
  
To improve this, institute a policy that we must *always* have a resowner  
backing any attempt to pin a buffer, which we can enforce just by removing  
the previous special-case code in resowner.c.  Add infrastructure to make  
it easy to create a process-lifespan AuxProcessResourceOwner and clear  
out its contents at appropriate times.  Replace existing ad-hoc resowner  
management in bgwriter.c and other aux processes with that.  (Thus, while  
the startup process gains a resowner where it had none at all before, some  
other aux process types are replacing an ad-hoc resowner with this code.)  
Also use the AuxProcessResourceOwner to manage buffer pins taken during  
StartupXLOG and ShutdownXLOG, even when those are being run in a bootstrap  
process or a standalone backend rather than a true auxiliary process.  
  
In passing, remove some other ad-hoc resource owner creations that had  
gotten cargo-culted into various other places.  As far as I can tell  
that was all unnecessary, and if it had been necessary it was incomplete,  
due to lacking any provision for clearing those resowners later.  
(Also worth noting in this connection is that a process that hasn't called  
InitBufferPoolBackend has no business accessing buffers; so there's more  
to do than just add the resowner if we want to touch buffers in processes  
not covered by this patch.)  
  
Although this fixes a very old bug, no back-patch, because there's no  
evidence of any significant problem in non-assert builds.  
  
Patch by me, pursuant to a report from Justin Pryzby.  Thanks to  
Robert Haas and Kyotaro Horiguchi for reviews.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/worker.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/utils/init/postinit.c
M src/backend/utils/resowner/resowner.c
M src/include/utils/resowner.h
M src/test/modules/test_shm_mq/worker.c

Fix misc typos, mostly in comments.

commit   : 6b387179baab8d0e5da6570678eefbe61f3acc79    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Jul 2018 16:10:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 9 Jul 2018 16:10:44 +0300    

Click here for diff

A collection of typos I happened to spot while reading code, as well as  
grepping for common mistakes.  
  
Backpatch to all supported versions, as applicable, to avoid conflicts  
when backporting other commits in the future.  

M contrib/bloom/blscan.c
M doc/src/sgml/protocol.sgml
M doc/src/sgml/spi.sgml
M src/backend/access/transam/multixact.c
M src/backend/commands/cluster.c
M src/backend/commands/explain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/planner.c
M src/backend/parser/parse_func.c
M src/backend/replication/logical/origin.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_upgrade/tablespace.c
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/port/pg_bswap.h
M src/include/storage/latch.h
M src/include/utils/rel.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/preproc/parse.pl
M src/pl/tcl/pltcl.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql

Fix more portability issues with casts to Size when using off_t

commit   : 94019c879a138454af723fa8bfc346d4a44ecd47    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Jul 2018 09:51:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Jul 2018 09:51:53 +0900    

Click here for diff

This should tame the beast, as there are no other places where off_t is  
used in the new error messages.  
  
Reported again by longfin, which complained about walsender.c while I  
spotted the other two ones while double-checking.  

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

Fix casting in error message for two-phase file

commit   : 8bd064f0c7d61c40a8a1179e9d24997fc0a20689    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Jul 2018 09:11:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Jul 2018 09:11:34 +0900    

Click here for diff

This error from from 811b6e3, which causes compilation warnings with OSX  
10.3 and clang.  
  
Reported by Tom Lane, via buildfarm member longfin.  

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

Rework error messages around file handling

commit   : 811b6e36a9e21a4d9eb78410976c88ce601cea0c    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 Jul 2018 08:01:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 Jul 2018 08:01:23 +0900    

Click here for diff

Some error messages related to file handling are using the code path  
context to define their state.  For example, 2PC-related errors are  
referring to "two-phase status files", or "relation mapping file" is  
used for catalog-to-filenode mapping, however those prove to be  
difficult to translate, and are not more helpful than just referring to  
the path of the file being worked on.  So simplify all those error  
messages by just referring to files with their path used.  In some  
cases, like the manipulation of WAL segments, the context is actually  
helpful so those are kept.  
  
Calls to the system function read() have also been rather inconsistent  
with their error handling sometimes not reporting the number of bytes  
read, and some other code paths trying to use an errno which has not  
been set.  The in-core functions are using a more consistent pattern  
with this patch, which checks for both errno if set or if an  
inconsistent read is happening.  
  
So as to care about pluralization when reading an unexpected number of  
byte(s), "could not read: read %d of %zu" is used as error message, with  
%d field being the output result of read() and %zu the expected size.  
This simplifies the work of translators with less variations of the same  
message.  
  
Author: Michael Paquier  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/utils/cache/relmapper.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/common/controldata_utils.c

doc: move PARTITION OF stanza to just below PARTITION BY

commit   : c6736ff76046521f56c50deb31da218bc1b29533    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jul 2018 00:54:34 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 17 Jul 2018 00:54:34 -0400    

Click here for diff

It's more logical this way, since the new ordering matches the way the  
tables are created; but in any case, the previous location of PARTITION OF  
did not appear carefully chosen anyway (since it didn't match the  
location in which it appears in the synopsys either, which is what we  
normally do.)  
  
In the PARTITION BY stanza, add a link to the partitioning section in  
the DDL chapter, too.  
  
Suggested-by: David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwY4Ld7ecxL_KAmaxwt0FUu5VcPPN2L4dh+3BeYbrdBa5g@mail.gmail.com  

M doc/src/sgml/ref/create_table.sgml

Revise BuildIndexValueDescription to simplify it

commit   : 1c04d4beea8a7f0f5fb667512025aada14c5be67    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 19:54:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 19:54:29 -0400    

Click here for diff

Getting a pg_index tuple from syscache when the open index relation is  
available is pointless -- just use the one from relcache.  
  
Noticed while reviewing code for cb9db2ab0674.  
  
No backpatch.  

M src/backend/access/index/genam.c

Fix ALTER TABLE...SET STATS error message for included columns

commit   : cb9db2ab0674381b92559e011738f19e2bd0f6f2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 20:00:24 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 20:00:24 -0400    

Click here for diff

The existing error message was complaining that the column is not an  
expression, which is not correct.  Introduce a suitable wording  
variation and a test.  
  
Co-authored-by: Yugo Nagata <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Álvaro Herrera <[email protected]>  

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

Fix partition pruning with IS [NOT] NULL clauses

commit   : e353389d24da48c708f72379f87e9b518baac521    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 18:38:09 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Jul 2018 18:38:09 -0400    

Click here for diff

The original code was unable to prune partitions that could not possibly  
contain NULL values, when the query specified less than all columns in a  
multicolumn partition key.  Reorder the if-tests so that it is, and add  
more commentary and regression tests.  
  
Reported-by: Ashutosh Bapat <[email protected]>  
Co-authored-by: Dilip Kumar <[email protected]>  
Co-authored-by: Amit Langote <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Reviewed-by: amul sul <[email protected]>  
Discussion: https://postgr.es/m/CAFjFpRc7qjLUfXLVBBC_HAnx644sjTYM=qVoT3TJ840HPbsTXw@mail.gmail.com  

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

Add subtransaction handling for table synchronization workers.

commit   : 32df1c9afa5a11e37b154fe50df7a4f016f289e4    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 16 Jul 2018 17:33:22 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 16 Jul 2018 17:33:22 -0400    

Click here for diff

Since the old logic was completely unaware of subtransactions, a  
change made in a subsequently-aborted subtransaction would still cause  
workers to be stopped at toplevel transaction commit.  Fix that by  
managing a stack of worker lists rather than just one.  
  
Amit Khandekar and Robert Haas  
  
Discussion: http://postgr.es/m/CAJ3gD9eaG_mWqiOTA2LfAug-VRNn1hrhf50Xi1YroxL37QkZNg@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/replication/logical/launcher.c
M src/include/replication/logicallauncher.h
M src/tools/pgindent/typedefs.list

Add plan_cache_mode setting

commit   : f7cb2842bf47715133b40e4a503f35dbe60d1b72    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jul 2018 13:35:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jul 2018 13:35:41 +0200    

Click here for diff

This allows overriding the choice of custom or generic plan.  
  
Author: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRAGLaiEm8ur5DWEBo7qHRWTk9HxkuUAz00CZZtJj-LkCA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/utils/cache/plancache.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/plancache.h
M src/test/regress/expected/plancache.out
M src/test/regress/sql/plancache.sql

doc: Update redirecting links

commit   : a06e56b247feb2812bad5cf60fd9c0128d81f5c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jul 2018 10:44:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 Jul 2018 10:44:06 +0200    

Click here for diff

Update links that resulted in redirects.  Most are changes from http to  
https, but there are also some other minor edits.  (There are still some  
redirects where the target URL looks less elegant than the one we  
currently have.  I have left those as is.)  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/bloom.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/docguide.sgml
M doc/src/sgml/external-projects.sgml
M doc/src/sgml/history.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/nls.sgml
M doc/src/sgml/passwordcheck.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/problems.sgml
M doc/src/sgml/release.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/wal.sgml
M src/backend/lib/bipartite_match.c
M src/backend/utils/adt/numeric.c
M src/bin/pgbench/pgbench.c

Fix hashjoin costing mistake introduced with inner_unique optimization.

commit   : 1007b0a126c608b530fd2914825f1e6d133cb649    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 14 Jul 2018 11:59:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 14 Jul 2018 11:59:12 -0400    

Click here for diff

In final_cost_hashjoin(), commit 9c7f5229a allowed inner_unique cases  
to follow a code path previously used only for SEMI/ANTI joins; but it  
neglected to fix an if-test within that path that assumed SEMI and ANTI  
were the only possible cases.  This resulted in a wrong value for  
hashjointuples, and an ensuing bad cost estimate, for inner_unique normal  
joins.  Fortunately, for inner_unique normal joins we can assume the number  
of joined tuples is the same as for a SEMI join; so there's no need for  
more code, we just have to invert the test to check for ANTI not SEMI.  
  
It turns out that in two contrib tests in which commit 9c7f5229a  
changed the plan expected for a query, the change was actually wrong  
and induced by this estimation error, not by any real improvement.  
Hence this patch also reverts those changes.  
  
Per report from RK Korlapati.  Backpatch to v10 where the error was  
introduced.  
  
David Rowley  
  
Discussion: https://postgr.es/m/CA+SNy03bhq0fodsfOkeWDCreNjJVjsdHwUsb7AG=jpe0PtZc_g@mail.gmail.com  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/path/costsize.c

Fix crash in contrib/ltree's lca() function for empty input array.

commit   : 28a1ae5342fe39b7c4057d3f872cb6057f5f33bf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 18:45:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 18:45:30 -0400    

Click here for diff

lca_inner() wasn't prepared for the possibility of getting no inputs.  
Fix that, and make some cosmetic improvements to the code while at it.  
  
Also, I thought the documentation of this function as returning the  
"longest common prefix" of the paths was entirely misleading; it really  
returns a path one shorter than the longest common prefix, for the typical  
definition of "prefix".  Don't use that term in the docs, and adjust the  
examples to clarify what really happens.  
  
This has been broken since its beginning, so back-patch to all supported  
branches.  
  
Per report from Hailong Li.  Thanks to Pierre Ducroquet for diagnosing  
and for the initial patch, though I whacked it around some and added  
test cases.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Update documentation editor setup instructions

commit   : 333224c99ed107a4e73dc7768879c2a37c6f99ab    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jul 2018 21:23:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jul 2018 21:23:41 +0200    

Click here for diff

Now that the documentation sources are in XML rather than SGML, some of  
the documentation about the editor, or more specifically Emacs, setup  
needs updating.  The updated instructions recommend using nxml-mode,  
which works mostly out of the box, with some small tweaks in  
emacs.samples and .dir-locals.el.  
  
Also remove some obsolete stuff in .dir-locals.el.  I did, however,  
leave the sgml-mode settings in there so that someone using Emacs  
without emacs.samples gets those settings when editing a *.sgml file.  

M .dir-locals.el
M doc/src/sgml/docguide.sgml
M src/tools/editors/emacs.samples

Fix crash in json{b}_populate_recordset() and json{b}_to_recordset().

commit   : 4984784f836a061985b356c52253b5d83a0cbe65    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 14:16:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 14:16:47 -0400    

Click here for diff

As of commit 37a795a60, populate_recordset_worker() tried to pass back  
(as rsi.setDesc) a tupdesc that it also had cached in its fn_extra.  
But the core executor would free the passed-back tupdesc, risking a  
crash if the function were called again in the same query.  The safest  
and least invasive way to fix that is to make an extra tupdesc copy  
to pass back.  
  
While at it, I failed to resist the temptation to get rid of unnecessary  
get_fn_expr_argtype() calls here and in populate_record_worker().  
  
Per report from Dmitry Dolgov; thanks to Michael Paquier and  
Andrew Gierth for investigation and discussion.  
  
Discussion: https://postgr.es/m/CA+q6zcWzN9ztCfR47ZwgTr1KLnuO6BAY6FurxXhovP4hxr+yOQ@mail.gmail.com  

M src/backend/utils/adt/jsonfuncs.c
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/json.sql
M src/test/regress/sql/jsonb.sql

Dump foreign keys on partitioned tables

commit   : 93ad00c968ae93e93f4ff238068a92625f41b6ff    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 Jul 2018 13:13:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 Jul 2018 13:13:26 -0400    

Click here for diff

The patch that ended up as commit 3de241dba86f ("Foreign keys on  
partitioned tables") lacked pg_dump tests, so the pg_dump code that was  
there to support it inadvertently stopped working when in later  
development I modified the backend code not to emit pg_trigger rows for  
the partitioned table itself.  
  
Bug analysis and code fix is by Michaël.  I (Álvaro) added the test.  
  
Reported-by: amul sul <[email protected]>  
Co-authored-by: Michaël Paquier <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CAAJ_b94n=UsNVhgs97vCaWEZAMe-tGDRVuZ73oePQH=eaJKGSA@mail.gmail.com  

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

Improve performance of tuple conversion map generation

commit   : 42f70cd9c3dbfcdfbeea4e24d5921173d0eaab66    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Jul 2018 19:54:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 13 Jul 2018 19:54:05 +0300    

Click here for diff

Previously convert_tuples_by_name_map naively performed a search of each  
outdesc column starting at the first column in indesc and searched each  
indesc column until a match was found.  When partitioned tables had many  
columns this could result in slow generation of the tuple conversion maps.  
For INSERT and UPDATE statements that touched few rows, this could mean a  
very large overhead indeed.  
  
We can do a bit better with this loop.  It's quite likely that the columns  
in partitioned tables and their partitions are in the same order, so it  
makes sense to start searching for each column outer column at the inner  
column position 1 after where the previous match was found (per idea from  
Alexander Kuzmenkov). This makes the best case search O(N) instead of  
O(N^2).  The worst case is still O(N^2), but it seems unlikely that would  
happen.  
  
Likewise, in the planner, make_inh_translation_list's search for the  
matching column could often end up falling back on an O(N^2) type search.  
This commit also improves that by first checking the column that follows  
the previous match, instead of the column with the same attnum.  If we  
fail to match here we fallback on the syscache's hashtable lookup.  
  
Author: David Rowley  
Reviewed-by: Alexander Kuzmenkov  
Discussion: https://www.postgresql.org/message-id/CAKJS1f9-wijVgMdRp6_qDMEQDJJ%2BA_n%3DxzZuTmLx5Fz6cwf%2B8A%40mail.gmail.com  

M src/backend/access/common/tupconvert.c
M src/backend/optimizer/prep/prepunion.c

Fix inadequate buffer locking in FSM and VM page re-initialization.

commit   : 130beba36d6dd46b8c527646f9f2433347cbfb11    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 11:52:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Jul 2018 11:52:50 -0400    

Click here for diff

When reading an existing FSM or VM page that was found to be corrupt by the  
buffer manager, the code applied PageInit() to reinitialize the page, but  
did so without any locking.  There is thus a hazard that two backends might  
concurrently do PageInit, which in itself would still be OK, but the slower  
one might then zero over subsequent data changes applied by the faster one.  
Even that is unlikely to be fatal; but it's not desirable, so add locking  
to prevent it.  
  
This does not add any locking overhead in the normal code path where the  
page is OK.  It's not immediately obvious that that's safe, but I believe  
it is, for reasons explained in the added comments.  
  
Problem noted by R P Asim.  It's been like this for a long time, so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CANXE4Te4G0TGq6cr0-TvwP0H4BNiK_-hB5gHe8mF+nz0mcYfMQ@mail.gmail.com  

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

docs: Remove "New" description of the libpqxx interface

commit   : 394811501cbef1259a544f8957160ca7153013ec    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 13 Jul 2018 11:16:56 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 13 Jul 2018 11:16:56 -0400    

Click here for diff

Backpatch-through: 9.3  

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

Prohibit transaction commands in security definer procedures

commit   : 3884072329bd1ad7d41bf7582c5d60e969365634    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 09:26:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 09:26:19 +0200    

Click here for diff

Starting and aborting transactions in security definer procedures  
doesn't work.  StartTransaction() insists that the security context  
stack is empty, so this would currently cause a crash, and  
AbortTransaction() resets it.  This could be made to work by  
reorganizing the code, but right now we just prohibit it.  
  
Reported-by: amul sul <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAJ_b96Gupt_LFL7uNyy3c50-wbhA68NUjiK5%3DrF6_w%3Dpq_T%3DQ%40mail.gmail.com  

M doc/src/sgml/ref/create_procedure.sgml
M src/backend/commands/functioncmds.c
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Remove obsolete documentation build tools for Windows

commit   : 1f4ec8945967a75f711d721860752985624a0957    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jul 2018 10:01:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Jul 2018 10:01:04 +0200    

Click here for diff

The scripts and instructions have been nonfunctional at least since  
PostgreSQL 10 (commit 510074f9f0131a04322d6a3d2a51c87e6db243f9) and  
nobody has stepped up to fix them.  So right now just remove them until  
someone wants to resurrect them.  
  
Discussion: https://www.postgresql.org/message-id/flat/B74C0219-6BA9-46E1-A524-5B9E8CD3BDB3%40yesql.se  

M doc/src/sgml/install-windows.sgml
M src/tools/msvc/README
D src/tools/msvc/builddoc.bat
D src/tools/msvc/builddoc.pl

Accept invalidation messages in InitializeSessionUserId().

commit   : e8d9caa436db2931613d7cb4a4a8b3933d5f6ded    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 13 Jul 2018 16:12:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 13 Jul 2018 16:12:03 +1200    

Click here for diff

If the authentication method modified the system catalogs through a  
separate database connection (say, to create a new role on the fly),  
make sure syscache sees the changes before we try to find the user.  
  
Author: Thomas Munro  
Reviewed-by: Tom Lane, Andres Freund  
Discussion: https://postgr.es/m/CAEepm%3D3_h0_cgmz5PMyab4xk_OFrg6G5VCN%3DnF4chFXM9iFOqA%40mail.gmail.com  

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

Add pg_dump --on-conflict-do-nothing option.

commit   : 387a5cfb94f041ffe18d03ccc4063c626bb4b73e    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 13 Jul 2018 13:57:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 13 Jul 2018 13:57:03 +1200    

Click here for diff

When dumping INSERT statements, optionally add ON CONFLICT DO NOTHING.  
  
Author: Surafel Temesgen  
Reviewed-by: Takeshi Ideriha, Nico Williams, Dilip Kumar  
Discussion: https://postgr.es/m/CALAY4q-PQ9cOEzs2%2BQHK5ObfF_4QbmBaYXbZx6BGGN66Q-n8FA%40mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl

Fix argument of pg_create_logical_replication_slot for slot name

commit   : ce89ad0fa07d98e20380867811a5269ee36d45c7    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 Jul 2018 09:32:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 Jul 2018 09:32:12 +0900    

Click here for diff

All attributes and arguments using a slot name map to the data type  
"name", but this function has been using "text".  This is cosmetic, as  
even if text is used then the slot name would be truncated to 64  
characters anyway and stored as such.  The documentation already said  
so and the function already assumed that the argument was of this type  
when fetching its value.  
  
Bump catalog version.  
  
Author: Sawada Masahiko  
Discussion: https://postgr.es/m/CAD21AoADYz_-eAqH5AVFaCaojcRgwpo9PW=u8kgTMys63oB8Cw@mail.gmail.com  

M src/backend/catalog/system_views.sql
M src/backend/replication/slotfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Clean up temporary WAL segments after an instance crash

commit   : 5fc1008e8a8b9e96ac75b4db5dd9ad2b99a9c8b2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 Jul 2018 06:43:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 Jul 2018 06:43:20 +0900    

Click here for diff

Temporary WAL segments are created in pg_wal and named as xlogtemp.pid  
before being renamed to the real deal when creating a new segment.  If  
an instance crashes after the temporary segment is created and before  
the rename is done, then the server would finish with unremovable data.  
  
After an instance crash, scan pg_wal and remove any such segments.  With  
repetitive unlucky crashes this would contribute to disk bloat and  
presents risks of ENOSPC especially with max_wal_size close to the  
maximum allowed.  
  
Author: Michael Paquier  
Reviewed-by: Yugo Nagata, Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

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

Reset shmem_exit_inprogress after shmem_exit()

commit   : 5e6e2c8773dd8e3037d9195452dc5e423367e1b0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jul 2018 20:22:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jul 2018 20:22:17 +0200    

Click here for diff

In ad9a274778d2d88c46b90309212b92ee7fdf9afe, shmem_exit_inprogress was  
introduced.  But we need to reset it after shmem_exit(), because unlike  
the similar proc_exit(), shmem_exit() can also be called for cleanup  
when the process will not exit.  
  
Reported-by: Andrew Gierth <[email protected]>  

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

Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

commit   : 632b4ae92dc6fb92149e94290760b50744e0bd35    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 12:28:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 12:28:43 -0400    

Click here for diff

Explain that you can use any integer expression for the "count" in  
pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only  
allow a constant.  
  
Remove the duplicate version of this para under MOVE.  I don't see  
a good reason to maintain two identical paras when we just said that  
MOVE works exactly like FETCH.  
  
Per Pavel Stehule, though I didn't use his text.  
  
Discussion: https://postgr.es/m/CAFj8pRAcvSXcNdUGx43bOK1e3NNPbQny7neoTLN42af+8MYWEA@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/fetch.sgml

Fix FK checks of TRUNCATE involving partitioned tables

commit   : cd073d8f7043d047c024f0f213c0e9c31b9c0505    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 12 Jul 2018 12:09:08 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 12 Jul 2018 12:09:08 -0400    

Click here for diff

When truncating a table that is referenced by foreign keys in  
partitioned tables, the check to ensure the referencing table are also  
truncated spuriously failed.  This is because it was relying on  
relhastriggers as a proxy for the table having FKs, and that's wrong for  
partitioned tables.  Fix it to consider such tables separately.  There  
may be a better way ... but this code is pretty inefficient already.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Michael Paquiër <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/truncate.out
M src/test/regress/sql/truncate.sql

Doc: clarify release note text about v11's new window function features.

commit   : 11a3aeeb5e174a3681f674e7e5ec9bbbc6430394    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 11:13:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 11:13:41 -0400    

Click here for diff

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

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

Doc: update documentation for requirement of ORDER BY in GROUPS mode.

commit   : e0cd0ea4f93c3644f09f7723206d8d003a97ee4a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 11:10:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 Jul 2018 11:10:24 -0400    

Click here for diff

Commit ff4f88916 adjusted the code to enforce the SQL spec's requirement  
that a window using GROUPS mode must have an ORDER BY clause.  But I missed  
that the documentation explicitly said you didn't have to have one.  
  
Also minor wordsmithing in the window-function section of select.sgml.  
  
Per Masahiko Sawada, though I didn't use his patch.  

M doc/src/sgml/ref/select.sgml
M doc/src/sgml/syntax.sgml

Improve two error messages

commit   : 8e599897ca20fe31cb58fad0b401d7e317235024    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 18 May 2018 17:17:57 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 18 May 2018 17:17:57 -0400    

Click here for diff

M src/backend/parser/parse_utilcmd.c
M src/bin/pg_upgrade/check.c

Add regression test for system catalog toast tables

commit   : ecd6b4342ad9f867e62979e85efa8fdb5fc904e5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jul 2018 12:31:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 12 Jul 2018 12:31:49 +0200    

Click here for diff

For the moment, this just records which system catalogs have toast  
tables right now.  Future patches will possibly change that set.  
  
from Tom Lane via Joe Conway  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]/  

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

Allow using the updated tuple while moving it to a different partition.

commit   : 40ca70ebcc9d0bc1c02937b27c44b2766617e790    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 12 Jul 2018 12:51:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 12 Jul 2018 12:51:39 +0530    

Click here for diff

An update that causes the tuple to be moved to a different partition was  
missing out on re-constructing the to-be-updated tuple, based on the latest  
tuple in the update chain.  Instead, it's simply deleting the latest tuple  
and inserting a new tuple in the new partition based on the old tuple.  
Commit 2f17844104 didn't consider this case, so some of the updates were  
getting lost.  
  
In passing, change the argument order for output parameter in ExecDelete  
and add some commentary about it.  
  
Reported-by: Pavan Deolasee  
Author: Amit Khandekar, with minor changes by me  
Reviewed-by: Dilip Kumar, Amit Kapila and Alvaro Herrera  
Backpatch-through: 11  
Discussion: https://postgr.es/m/CAJ3gD9fRbEzDqdeDq1jxqZUb47kJn+tQ7=Bcgjc8quqKsDViKQ@mail.gmail.com  

M src/backend/commands/trigger.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/commands/trigger.h
A src/test/isolation/expected/partition-key-update-4.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-key-update-4.spec

Rename VACOPT_NOWAIT to VACOPT_SKIP_LOCKED

commit   : edc6b41bd4a80ea6aebacbd86ebe7c3a01939789    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Jul 2018 14:28:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Jul 2018 14:28:28 +0900    

Click here for diff

When it comes to SELECT ... FOR or LOCK, NOWAIT means to not wait for  
something to happen, and issue an error.  SKIP LOCKED means to not wait  
for something to happen but to move on without issuing an error.  The  
internal option of autovacuum and autoanalyze mentioned above, used only  
when wraparound is not involved was named NOWAIT, but behaves like SKIP  
LOCKED which is confusing.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

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

Add assertion in expand_vacuum_rel() for non-autovacuum path

commit   : 6551f3daa2567ea9b2ded9b467aa9d876cc4e77f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Jul 2018 13:50:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Jul 2018 13:50:17 +0900    

Click here for diff

The code path where the assertion is added helps to check that  
autovacuum always includes a relation OID when doing a vacuum on it.  
Extracted from a larger patch set to add support for SKIP LOCKED with  
manual VACUUM commands.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuum.c

Make logical WAL sender report streaming state appropriately

commit   : 9a7b7adc130a197e5c993a99e6aaa981f9341a35    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Jul 2018 10:19:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Jul 2018 10:19:35 +0900    

Click here for diff

WAL senders sending logically-decoded data fail to properly report in  
"streaming" state when starting up, hence as long as one extra record is  
not replayed, such WAL senders would remain in a "catchup" state, which  
is inconsistent with the physical cousin.  
  
This can be easily reproduced by for example using pg_recvlogical and  
restarting the upstream server.  The TAP tests have been slightly  
modified to detect the failure and strengthened so as future tests also  
make sure that a node is in streaming state when waiting for its  
catchup.  
  
Backpatch down to 9.4 where this code has been introduced.  
  
Reported-by: Sawada Masahiko  
Author: Simon Riggs, Sawada Masahiko  
Reviewed-by: Petr Jelinek, Michael Paquier, Vaishnavi Prabakaran  
Discussion: https://postgr.es/m/CAD21AoB2ZbCCqOx=bgKMcLrAvs1V0ZMqzs7wBTuDySezTGtMZA@mail.gmail.com  

M src/backend/replication/walsender.c
M src/test/perl/PostgresNode.pm
M src/test/subscription/t/001_rep_changes.pl

Mark built-in btree comparison functions as leakproof where it's safe.

commit   : 39a96512b3ed72de7b24b2667d9575d7e9fcb326    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 18:47:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 18:47:31 -0400    

Click here for diff

Generally, if the comparison operators for a datatype or pair of datatypes  
are leakproof, the corresponding btree comparison support function can be  
considered so as well.  But we had not originally worried about marking  
support functions as leakproof, reasoning that they'd not likely be used in  
queries so the marking wouldn't matter.  It turns out there's at least one  
place where it does matter: calc_arraycontsel() finds the target datatype's  
default btree comparison function and tries to use that to estimate  
selectivity, but it will be blocked in some cases if the function isn't  
leakproof.  This leads to unnecessarily poor selectivity estimates and bad  
plans, as seen in bug #15251.  
  
Hence, run around and apply proleakproof markings where the corresponding  
btree comparison operators are leakproof.  (I did eyeball each function  
to verify that it wasn't doing anything surprising, too.)  
  
This isn't a full solution to bug #15251, and it's not back-patchable  
because of the need for a catversion bump.  A more useful response probably  
is to consider whether we can check permissions on the parent table instead  
of the child.  However, this change will help in some cases where that  
won't, and it's easy enough to do in HEAD, so let's do so.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/opr_sanity.out

Fix create_scan_plan's handling of sortgrouprefs for physical tlists.

commit   : 57cd2b6e6dc571cf65983d2aa86065d6d006f152    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 15:25:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 15:25:28 -0400    

Click here for diff

We should only run apply_pathtarget_labeling_to_tlist if CP_LABEL_TLIST  
was specified, because only in that case has use_physical_tlist checked  
that the labeling will succeed; otherwise we may get an "ORDER/GROUP BY  
expression not found in targetlist" error.  (This subsumes the previous  
test about gating_clauses, because we reset "flags" to zero earlier  
if there are gating clauses to apply.)  
  
The only known case in which a failure can occur is with a ProjectSet  
path directly atop a table scan path, although it seems likely that there  
are other cases or will be such in future.  This means that the failure  
is currently only visible in the v10 branch: 9.6 didn't have ProjectSet,  
while in v11 and HEAD, apply_scanjoin_target_to_paths for some weird  
reason is using create_projection_path not apply_projection_to_path,  
masking the problem because there's a ProjectionPath in between.  
  
Nonetheless this code is clearly wrong on its own terms, so back-patch  
to 9.6 where this logic was introduced.  
  
Per report from Regina Obe.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/createplan.c
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/tsrf.sql

Fix bugs with degenerate window ORDER BY clauses in GROUPS/RANGE mode.

commit   : ff4f8891648c804c7c126fdf438257b1e9dc7ca4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 12:07:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 11 Jul 2018 12:07:20 -0400    

Click here for diff

nodeWindowAgg.c failed to cope with the possibility that no ordering  
columns are defined in the window frame for GROUPS mode or RANGE OFFSET  
mode, leading to assertion failures or odd errors, as reported by Masahiko  
Sawada and Lukas Eder.  In RANGE OFFSET mode, an ordering column is really  
required, so add an Assert about that.  In GROUPS mode, the code would  
work, except that the node initialization code wasn't in sync with the  
execution code about when to set up tuplestore read pointers and spare  
slots.  Fix the latter for consistency's sake (even though I think the  
changes described below make the out-of-sync cases unreachable for now).  
  
Per SQL spec, a single ordering column is required for RANGE OFFSET mode,  
and at least one ordering column is required for GROUPS mode.  The parser  
enforced the former but not the latter; add a check for that.  
  
We were able to reach the no-ordering-column cases even with fully spec  
compliant queries, though, because the planner would drop partitioning  
and ordering columns from the generated plan if they were redundant with  
earlier columns according to the redundant-pathkey logic, for instance  
"PARTITION BY x ORDER BY y" in the presence of a "WHERE x=y" qual.  
While in principle that's an optimization that could save some pointless  
comparisons at runtime, it seems unlikely to be meaningful in the real  
world.  I think this behavior was not so much an intentional optimization  
as a side-effect of an ancient decision to construct the plan node's  
ordering-column info by reverse-engineering the PathKeys of the input  
path.  If we give up redundant-column removal then it takes very little  
code to generate the plan node info directly from the WindowClause,  
ensuring that we have the expected number of ordering columns in all  
cases.  (If anyone does complain about this, the planner could perhaps  
be taught to remove redundant columns only when it's safe to do so,  
ie *not* in RANGE OFFSET mode.  But I doubt anyone ever will.)  
  
With these changes, the WindowAggPath.winpathkeys field is not used for  
anything anymore, so remove it.  
  
The test cases added here are not actually very interesting given the  
removal of the redundant-column-removal logic, but they would represent  
important corner cases if anyone ever tries to put that back.  
  
Tom Lane and Masahiko Sawada.  Back-patch to v11 where RANGE OFFSET  
and GROUPS modes were added.  
  
Discussion: https://postgr.es/m/CAD21AoDrWqycq-w_+Bx1cjc+YUhZ11XTj9rfxNiNDojjBx8Fjw@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeWindowAgg.c
M src/backend/nodes/outfuncs.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/parse_clause.c
M src/include/nodes/relation.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Fix more wrong paths in header comments

commit   : edf59c40dd6f477ca867c8958d9665ab1bff0265    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 11 Jul 2018 17:57:04 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 11 Jul 2018 17:57:04 +0300    

Click here for diff

It appears that there are more files, whose header comment paths are  
wrong.  So, fix those paths.  No backpatching per proposal of Tom Lane.  
  
Discussion: https://postgr.es/m/CAPpHfdsJyYbOj59MOQL%2B4XxdcomLSLfLqBtAvwR%2BpsCqj3ELdQ%40mail.gmail.com  

M src/backend/access/common/bufmask.c
M src/backend/commands/dropcmds.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/sort/sharedtuplestore.c
M src/common/file_perm.c
M src/common/unicode/norm_test.c
M src/include/storage/sharedfileset.h
M src/include/utils/evtcache.h
M src/interfaces/ecpg/include/sqlda-compat.h

Rethink how to get float.h in old Windows API for isnan/isinf

commit   : f2c587067a8eb9cf1c8f009262381a6576ba3dd0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 11 Jul 2018 09:09:59 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 11 Jul 2018 09:09:59 -0400    

Click here for diff

We include <float.h> in every place that needs isnan(), because MSVC  
used to require it.  However, since MSVC 2013 that's no longer necessary  
(cf. commit cec8394b5ccd), so we can retire the inclusion to a  
version-specific stanza in win32_port.h, where it doesn't need to  
pollute random .c files.  The header is of course still needed in a few  
places for other reasons.  
  
I (Álvaro) removed float.h from a few more files than in Emre's original  
patch.  This doesn't break the build in my system, but we'll see what  
the buildfarm has to say about it all.  
  
Author: Emre Hasegeli  
Discussion: https://postgr.es/m/CAE2gYzyc0+5uG+Cd9-BSL7NKC8LSHLNg1Aq2=8ubjnUwut4_iw@mail.gmail.com  

M contrib/cube/cube.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/tsm_system_time/tsm_system_time.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistutil.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/optimizer/path/costsize.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/nabstime.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/misc/help_config.c
M src/include/port/win32_port.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/port/rint.c
M src/port/snprintf.c
M src/test/regress/regress.c

Fix wrong file path in header comment

commit   : a01d0fa1d889cc2003e1941e8b98707c4d701ba9    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 11 Jul 2018 13:16:46 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 11 Jul 2018 13:16:46 +0300    

Click here for diff

Header comment of shm_mq.c was mistakenly specifying path to shm_mq.h.  
It was introduced in ec9037df.  So, theoretically it could be  
backpatched to 9.4, but it doesn't seem to worth it.  

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

Use signals for postmaster death on FreeBSD.

commit   : f98b8476cd4a19dfc602ab95642ce08e53877d65    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 11 Jul 2018 12:47:42 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 11 Jul 2018 12:47:42 +1200    

Click here for diff

Use FreeBSD 11.2's new support for detecting parent process death to  
make PostmasterIsAlive() very cheap, as was done for Linux in an  
earlier commit.  
  
Author: Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.in
M src/backend/storage/ipc/pmsignal.c
M src/include/pg_config.h.in
M src/include/storage/pmsignal.h

Use signals for postmaster death on Linux.

commit   : 9f09529952ac41a10e5874cba745c1c24e67ac79    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 11 Jul 2018 12:40:58 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 11 Jul 2018 12:40:58 +1200    

Click here for diff

Linux provides a way to ask for a signal when your parent process dies.  
Use that to make PostmasterIsAlive() very cheap.  
  
Based on a suggestion from Andres Freund.  
  
Author: Thomas Munro, Heikki Linnakangas  
Reviewed-By: Michael Paquier  
Discussion: https://postgr.es/m/7261eb39-0369-f2f4-1bb5-62f3b6083b5e%40iki.fi  
Discussion: https://postgr.es/m/20180411002643.6buofht4ranhei7k%40alap3.anarazel.de  

M configure
M configure.in
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/utils/init/miscinit.c
M src/include/pg_config.h.in
M src/include/pg_config.h.win32
M src/include/storage/pmsignal.h

Block replication slot advance for these not yet reserving WAL

commit   : 56a714721343e6f52c0b1b911c0f160592348e84    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 Jul 2018 08:56:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 Jul 2018 08:56:24 +0900    

Click here for diff

Such replication slots are physical slots freshly created without WAL  
being reserved, which is the default behavior, which have not been used  
yet as WAL consumption resources to retain WAL.  This prevents advancing  
a slot to a position older than any WAL available, which could falsify  
calculations for WAL segment recycling.  
  
This also cleans up a bit the code, as ReplicationSlotRelease() would be  
called on ERROR, and improves error messages.  
  
Reported-by: Kyotaro Horiguchi  
Author: Michael Paquier  
Reviewed-by: Andres Freund, Álvaro Herrera, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/catalogs.sgml
M src/backend/replication/slotfuncs.c

Better handle pseudotypes as partition keys

commit   : b6e3a3a492dbf2043e4b149221007716ba9e364e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 10 Jul 2018 15:19:40 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 10 Jul 2018 15:19:40 -0400    

Click here for diff

We fail to handle polymorphic types properly when they are used as  
partition keys: we were unnecessarily adding a RelabelType node on top,  
which confuses code examining the nodes.  In particular, this makes  
predtest.c-based partition pruning not to work, and ruleutils.c to emit  
expressions that are uglier than needed.  Fix it by not adding RelabelType  
when not needed.  
  
In master/11 the new pruning code is separate so it doesn't suffer from  
this problem, since we already fixed it (in essentially the same way) in  
e5dcbb88a15d, which also added a few tests; back-patch those tests to  
pg10 also.  But since UPDATE/DELETE still uses predtest.c in pg11, this  
change improves partitioning for those cases too.  Add tests for this.  
The ruleutils.c behavior change is relevant in pg11/master too.  
  
Co-authored-by: Amit Langote <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Remove dynamic_shared_memory_type=none

commit   : bcbd940806a2011d6f99ae72ea5897e8a94c6093    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 17:37:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 17:37:42 +0200    

Click here for diff

PostgreSQL nowadays offers some kind of dynamic shared memory feature on  
all supported platforms.  Having the choice of "none" prevents us from  
relying on DSM in core features.  So this patch removes the choice of  
"none".  
  
Author: Kyotaro Horiguchi <[email protected]>  

M doc/src/sgml/config.sgml
M doc/src/sgml/parallel.sgml
M src/backend/access/transam/parallel.c
M src/backend/optimizer/plan/planner.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/include/storage/dsm_impl.h

Add test case for EEOP_INNER_SYSVAR/EEOP_OUTER_SYSVAR executor opcodes.

commit   : 17b715c634d451da3edb221c55c614a7d993c289    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 10 Jul 2018 16:16:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 10 Jul 2018 16:16:14 +0300    

Click here for diff

The EEOP_INNER_SYSVAR and EEOP_OUTER_SYSVAR executor opcodes are not  
exercised by normal queries, because setrefs.c will resolve the references  
to system columns in the scan nodes already. Join nodes refer to them by  
their position in the child node's target list, like user columns.  
  
The only place where those opcodes are used, is in evaluating a trigger's  
WHEN condition that references system columns. Trigger evaluation abuses  
the INNER/OUTER Vars to refer to the OLD and NEW tuples. The code to handle  
the opcodes is pretty straightforward, but it seems like a good idea to  
have some test coverage for them, anyway, so that they don't get removed or  
broken by accident.  
  
Author: Ashutosh Bapat, with some changes by me.  
Discussion: https://www.postgresql.org/message-id/CAFjFpRerUFX=T0nSnCoroXAJMoo-xah9J+pi7+xDUx86PtQmew@mail.gmail.com  

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

Fix typos

commit   : 1486f7f981c0052988891677d4e734b14317816c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 11:14:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 Jul 2018 11:14:53 +0200    

Click here for diff

M config/c-compiler.m4
M src/include/pg_config.h.in

Add pg_rewind --no-sync

commit   : 8a00b96aa994b5c2c1a03c70e7a4719c919e8798    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 Jul 2018 08:51:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 Jul 2018 08:51:10 +0900    

Click here for diff

This is an option consistent with what pg_dump and pg_basebackup provide  
which is useful for leveraging the I/O effort when testing things, not  
to be used in a production environment.  
  
Author: Michael Paquier  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/RewindTest.pm
M src/bin/pg_rewind/pg_rewind.c

Simplify logic to sync target directory at the end of pg_rewind

commit   : 9a4059d4ff1100e10d2aaadb136a04a407351249    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 Jul 2018 08:39:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 Jul 2018 08:39:27 +0900    

Click here for diff

The previous sync logic relied on looking for and then launching  
externally initdb -S, which is a simple wrapper on top of fsync_pgdata.  
There is nothing preventing pg_rewind to directly call this routine, so  
remove the dependency to initdb and just call it directly.  
  
Author: Michael Paquier  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/pg_rewind.c

Avoid emitting a bogus WAL record when recycling an all-zero btree page.

commit   : 0905fe8911ea06df17a3ba3f086e98ca5c7b560c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jul 2018 19:26:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jul 2018 19:26:19 -0400    

Click here for diff

Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for  
a page that it was about to recycle.  However, it failed to distinguish  
all-zero pages from dead pages, which is important because only the  
latter have valid btpo.xact values, or indeed any special space at all.  
Recycling an all-zero page with XLogStandbyInfoActive() enabled therefore  
led to an Assert failure, or to emission of a WAL record containing a  
bogus cutoff XID, which might lead to unnecessary query cancellations  
on hot standby servers.  
  
Per reports from Antonin Houska and 自己.  Amit Kapila was first to  
propose this fix, and Robert Haas, myself, and Kyotaro Horiguchi  
reviewed it at various times.  
  
This is an old bug, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/2628.1474272158@localhost  
Discussion: https://postgr.es/m/[email protected]  

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

Flip argument order in XLogSegNoOffsetToRecPtr

commit   : a22445ff0be2e4a008b2dd1aaa963f8f7c70cab9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 9 Jul 2018 14:28:21 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 9 Jul 2018 14:28:21 -0400    

Click here for diff

Commit fc49e24fa69a added an input argument after the existing output  
argument.  Flip those.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/replication/logical/reorderbuffer.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlog_internal.h

Fix yet more problems with incorrectly-constructed zero-length arrays.

commit   : 01783ac36de1aac9bf8d19f6c2814778188d4523    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Jul 2018 14:28:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Jul 2018 14:28:04 -0400    

Click here for diff

Commit 716ea626a attempted to fix the problem of building 1-D zero-size  
arrays once and for all.  But it turns out that contrib/intarray has some  
code that doesn't use construct_array() but just builds arrays by hand,  
so it didn't get the memo.  This appears to affect all of subarray(),  
intset_subtract(), inner_int_union(), inner_int_inter(), and  
intarray_concat_arrays().  
  
Back-patch into v11.  In the past we've not back-patched this type of  
change, but since v11 is still in beta it seems all right to include  
this fix in it.  Besides it's more consistent to make the fix in v11  
where 716ea626a appeared.  
  
Report and patch by Alexey Kryuchkov, some cosmetic adjustments by me  
  
Report: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAN85JcYphDLYt4CpMDLZjjNVqGDrFJ5eS3YF=wLAhFoDQuBsyg@mail.gmail.com  

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

rel notes: mention enabling of parallelism in PG 10

commit   : 6abad00585b7d3b9bc36e10d5937c27fb6878774    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 9 Jul 2018 11:19:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 9 Jul 2018 11:19:18 -0400    

Click here for diff

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

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

Add UtilityReturnsTuples() support for CALL

commit   : ec67b89816012ad753ebbd3489c7e7d0fe80d4ca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 Jul 2018 13:58:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 Jul 2018 13:58:08 +0200    

Click here for diff

This ensures that prepared statements for CALL can return tuples.  

M src/backend/commands/functioncmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h

Fix table format in documentation for I/O wait events

commit   : cccf81d259747f5198b55f51820b382ff5229a48    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 9 Jul 2018 10:46:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 9 Jul 2018 10:46:27 +0900    

Click here for diff

This is an oversight from c55de5e.  
  
Author: Julien Rouhaud  

M doc/src/sgml/monitoring.sgml

Rework order of end-of-recovery actions to delay timeline history write

commit   : cbc55da556bbcb649e059804009c38100ee98884    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 9 Jul 2018 10:22:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 9 Jul 2018 10:22:34 +0900    

Click here for diff

A critical failure in some of the end-of-recovery actions before the  
end-of-recovery record is written can cause PostgreSQL to react  
inconsistently with the rest of the cluster in the event of a crash  
before the final record is written.  Two such failures are for example  
an error while processing a two-phase state files or when operating on  
recovery.conf.  With this commit, the failures are still considered  
FATAL, but the write of the timeline history file is delayed as much as  
possible so as the window between the moment the file is written and the  
end-of-recovery record is generated gets minimized. This way, in the  
event of a crash or a failure, the new timeline decided at promotion  
will not seem taken by other nodes in the cluster.  It is not really  
possible to reduce to zero this window, hence one could still see  
failures if a crash happens between the history file write and the  
end-of-recovery record, so any future code should be careful when  
adding new end-of-recovery actions.  The original report from Magnus  
Hagander mentioned a renamed recovery.conf as original end-of-recovery  
failure which caused a timeline to be seen as taken but the subsequent  
processing on the now-missing recovery.conf cause the startup process to  
issue stop on FATAL, which at follow-up startup made the system  
inconsistent because of on-disk changes which already happened.  
  
Processing of two-phase state files still needs some work as corrupted  
entries are simply ignored now.  This is left as a future item and this  
commit fixes the original complain.  
  
Reported-by: Magnus Hagander  
Author: Heikki Linnakangas  
Reviewed-by: Alexander Korotkov, Michael Paquier, David Steele  
Discussion: https://postgr.es/m/CABUevEz09XY2EevA2dLjPCY-C5UO4Hq=XxmXLmF6ipNFecbShQ@mail.gmail.com  

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

Fix WITH CHECK OPTION on views referencing postgres_fdw tables.

commit   : a45adc747e271556eb9443973264bf3353c86524    
  
author   : Jeff Davis <[email protected]>    
date     : Sun, 8 Jul 2018 00:14:51 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sun, 8 Jul 2018 00:14:51 -0700    

Click here for diff

If a view references a foreign table, and the foreign table has a  
BEFORE INSERT trigger, then it's possible for a tuple inserted or  
updated through the view to be changed such that it violates the  
view's WITH CHECK OPTION constraint.  
  
Before this commit, postgres_fdw handled this case inconsistently. A  
RETURNING clause on the INSERT or UPDATE statement targeting the view  
would cause the finally-inserted tuple to be read back, and the WITH  
CHECK OPTION violation would throw an error. But without a RETURNING  
clause, postgres_fdw would not read the final tuple back, and WITH  
CHECK OPTION would not throw an error for the violation (or may throw  
an error when there is no real violation). AFTER ROW triggers on the  
foreign table had a similar effect as a RETURNING clause on the INSERT  
or UPDATE statement.  
  
To fix, this commit retrieves the attributes needed to enforce the  
WITH CHECK OPTION constraint along with the attributes needed for the  
RETURNING clause (if any) from the remote side. Thus, the WITH CHECK  
OPTION constraint is always evaluated against the final tuple after  
any triggers on the remote side.  
  
This fix may be considered inconsistent with CHECK constraints  
declared on foreign tables, which are not enforced locally at all  
(because the constraint is on a remote object). The discussion  
concluded that this difference is reasonable, because the WITH CHECK  
OPTION is a constraint on the local view (not any remote object);  
therefore it only makes sense to enforce its WITH CHECK OPTION  
constraint locally.  
  
Author: Etsuro Fujita  
Reviewed-by: Arthur Zakirov, Stephen Frost  
Discussion: https://www.postgresql.org/message-id/7eb58fab-fd3b-781b-ac33-f7cfec96021f%40lab.ntt.co.jp  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/fdwhandler.sgml

Correct obsolete unique index insertion comment.

commit   : e915fed291772d8d5fcc437ac777f7beca8c24ce    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 8 Jul 2018 10:50:13 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 8 Jul 2018 10:50:13 -0700    

Click here for diff

Commit bc292937ae6 failed to update a comment about unique index  
checking.  _bt_insertonpg() is no longer responsible for finding an  
insertion location while preventing conflicting insertions.  

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

Use access() to check file existence in GetNewRelFileNode()

commit   : 677da8c15d19c11465d78f18bfd5ceb5d6fc3af1    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 8 Jul 2018 18:53:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 8 Jul 2018 18:53:20 +0900    

Click here for diff

Previous code used BasicOpenFile() and close() just to check for a file  
collision, while there is no need to hold open a file descriptor but  
that's an overkill here.  
  
Author: Paul Guo  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/CABQrizcUtiHaquxK=d4etBX8GF9kbZB50Nt1gO9_aN-e9SptyQ@mail.gmail.com  

M src/backend/catalog/catalog.c

Add separate error message for procedure does not exist

commit   : 0903bbdad24a8f51b18a6a54a41bbb36ad2ceee4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Jul 2018 11:17:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Jul 2018 11:17:04 +0200    

Click here for diff

While we probably don't want to split up all error messages into  
function and procedure variants, this one is a very prominent one, so  
it's helpful to be more specific here.  

M src/backend/parser/parse_func.c
M src/test/regress/expected/create_procedure.out

Add note in pg_rewind documentation about read-only files

commit   : eb270b00b2d60e751545d4b808642395c901b668    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 7 Jul 2018 08:10:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 7 Jul 2018 08:10:10 +0900    

Click here for diff

When performing pg_rewind, the presence of a read-only file which is not  
accessible for writes will cause a failure while processing.  This can  
cause the control file of the target data folder to be truncated,  
causing it to not be reusable with a successive run.  
  
Also, when pg_rewind fails mid-flight, there is likely no way to be able  
to recover the target data folder anyway, in which case a new base  
backup is the best option.  A note is added in the documentation as  
well about.  
  
Reported-by: Christian H.  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/20180104200633.17004.16377%40wrigleys.postgresql.org  

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

Fix assert in nested SQL procedure call

commit   : 2e78c5b522a91c7893decd92d6f5b31fef0027bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 29 Jun 2018 13:28:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 29 Jun 2018 13:28:39 +0200    

Click here for diff

When executing CALL in PL/pgSQL, we need to set a snapshot before  
invoking the to-be-called procedure.  Otherwise, the to-be-called  
procedure might end up running without a snapshot.  For LANGUAGE SQL  
procedures, this would result in an assertion failure.  (For most other  
languages, this is usually not a problem, because those use SPI and SPI  
sets snapshots in most cases.)  Setting the snapshot restores the  
behavior of how CALL worked when it was handled as a generic SQL  
statement in PL/pgSQL (exec_stmt_execsql()).  
  
This change revealed another problem:  In SPI_commit(), we popped the  
active snapshot before committing the transaction, to avoid "snapshot %p  
still active" errors.  However, there is no particular reason why only  
at most one snapshot should be on the stack.  So change this to pop all  
active snapshots instead of only one.  

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

Allow CALL with polymorphic type arguments

commit   : e34ec136201df07a05a83825ebff7fffb9043598    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Jul 2018 22:27:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Jul 2018 22:27:42 +0200    

Click here for diff

In order to be able to resolve polymorphic types, we need to set fn_expr  
before invoking the procedure.  

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

Allow replication slots to be dropped in single-user mode

commit   : 0ce5cf2ef24f638ff05569d027135fa1c7683a71    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 6 Jul 2018 16:38:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 6 Jul 2018 16:38:30 -0400    

Click here for diff

Starting with commit 9915de6c1cb2, replication slot drop uses a  
condition variable sleep to wait until the current user of the slot goes  
away.  This is more user friendly than the previous behavior of erroring  
out if the slot is in use, but it fails with a not-for-user-consumption  
error message in single-user mode; plus, if you're using single-user  
mode because you don't want to start the server in the regular mode  
(say, disk is full and WAL won't recycle because of the slot), it's  
inconvenient.  
  
Fix by skipping the cond variable sleep in single-user mode, since  
there can't be anybody to wait for anyway.  
  
Reported-by: tushar <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c

Print DEBUG2 like that rather than as DEBUG

commit   : 8fb68aa2655762beed237ea04e2c6c490cf1ed10    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 6 Jul 2018 07:29:12 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 6 Jul 2018 07:29:12 -0400    

Click here for diff

DEBUG is an alias for DEBUG2, but we want DEBUG2 to show in the settings  
no matter how it was spelled.  
  
Takeshi Ideriha  
  
Discussion: https://postgr.es/m/4E72940DA2BF16479384A86D54D0988A5678EC03@G01JPEXMBKW04  

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

Add test for partitionwise join involving default partition.

commit   : 4513d3a4be0bb7d0141f8b7eaf669a55c08e41b0    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 5 Jul 2018 18:56:12 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 5 Jul 2018 18:56:12 -0700    

Click here for diff

Author: Rajkumar Raghuwanshi  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/CAKcux6ky5YeZAY74qSh-ayPZZEQchz092g71iXXbC0%2BE3xoscA%40mail.gmail.com  
Discussion: https://postgr.es/m/CAKcux6kOQ85Xtzxu3tM1mR7Vk%3D7Z2e4rG7dL1iMZqPgLMpxQYg%40mail.gmail.com  

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

logical decoding: beware of an unset specinsert change

commit   : 3ca966c06f91fb6ccc11d71d4094c1e297b8945d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Jul 2018 17:42:37 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Jul 2018 17:42:37 -0400    

Click here for diff

Coverity complains that there is no protection in the code (at least in  
non-assertion-enabled builds) against speculative insertion failing to  
follow the expected protocol.  Add an elog(ERROR) for the case.  

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

doc: Reword old inheritance partitioning documentation

commit   : 0c06534bd63b0bd23d7744a53f3b490a2adeea8a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Jul 2018 23:08:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Jul 2018 23:08:56 +0200    

Click here for diff

Prefer to use phrases like "child" instead of "partition" when  
describing the legacy inheritance-based partitioning.  The word  
"partition" now has a fixed meaning for the built-in partitioning, so  
keeping it out of the documentation of the old method makes things  
clearer.  
  
Author: Justin Pryzby <[email protected]>  

M doc/src/sgml/ddl.sgml

doc: Fix typos

commit   : 17411e0ffa1e2a9789756203019dce368ad4bf60    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 5 Jul 2018 22:51:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 5 Jul 2018 22:51:08 +0200    

Click here for diff

Author: Justin Pryzby <[email protected]>  

M doc/src/sgml/ddl.sgml

Reduce cost of test_decoding's new oldest_xmin test

commit   : 8d1c1ca70b012594932578a0994a5d45f29d9572    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 5 Jul 2018 16:37:32 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 5 Jul 2018 16:37:32 -0400    

Click here for diff

Change a whole-database VACUUM into doing just pg_attribute, which is  
the portion that verifies what we want it to do.  The original  
formulation wastes a lot of CPU time, which leads the test to fail when  
runtime exceeds isolationtester timeout when it's super-slow, such as  
under CLOBBER_CACHE_ALWAYS.  Per buildfarm member friarbird.  
  
It turns out that the previous shape of the test doesn't always detect  
the condition it is supposed to detect (on unpatched reorderbuffer  
code): the reason is that there is a good chance of encountering a  
xl_running_xacts record (logged every 15 seconds) before the checkpoint  
-- and because we advance the xmin when we receive that WAL record, and  
we *don't* advance the xmin twice consecutively without receiving a  
client message in between, that means the xmin is not advanced enough  
for the tuple to be pruned from pg_attribute by VACUUM.  So the test  
would spuriously pass.  
  
The reason this test deficiency wasn't detected earlier is that HOT  
pruning removes the tuple anyway, even if vacuum leaves it in place, so  
the test correctly fails (detecting the coding mistake), but for the  
wrong reason.  
  
To fix this mess, run the s0_get_changes step twice before vacuum  
instead of once: this seems to cause the xmin to be advanced reliably,  
wreaking havoc with more certainty.  
  
Author: Arseny Sher  
Discussion: https://postgr.es/m/87h8lkuxoa.fsf@ars-thinkpad  

M contrib/test_decoding/expected/oldest_xmin.out
M contrib/test_decoding/specs/oldest_xmin.spec

Fix typo

commit   : f61988d160c1af8c1ed495e5c547726e88a45036    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 22:13:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 22:13:16 +0200    

Click here for diff

M config/c-compiler.m4
M src/include/pg_config.h.in

Prevent references to invalid relation pages after fresh promotion

commit   : 3c64dcb1e35dccbfce531182fa9b9f48bec414ad    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 5 Jul 2018 10:46:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 5 Jul 2018 10:46:18 +0900    

Click here for diff

If a standby crashes after promotion before having completed its first  
post-recovery checkpoint, then the minimal recovery point which marks  
the LSN position where the cluster is able to reach consistency may be  
set to a position older than the first end-of-recovery checkpoint while  
all the WAL available should be replayed.  This leads to the instance  
thinking that it contains inconsistent pages, causing a PANIC and a hard  
instance crash even if all the WAL available has not been replayed for  
certain sets of records replayed.  When in crash recovery,  
minRecoveryPoint is expected to always be set to InvalidXLogRecPtr,  
which forces the recovery to replay all the WAL available, so this  
commit makes sure that the local copy of minRecoveryPoint from the  
control file is initialized properly and stays as it is while crash  
recovery is performed.  Once switching to archive recovery or if crash  
recovery finishes, then the local copy minRecoveryPoint can be safely  
updated.  
  
Pavan Deolasee has reported and diagnosed the failure in the first  
place, and the base fix idea to rely on the local copy of  
minRecoveryPoint comes from Kyotaro Horiguchi, which has been expanded  
into a full-fledged patch by me.  The test included in this commit has  
been written by Álvaro Herrera and Pavan Deolasee, which I have modified  
to make it faster and more reliable with sleep phases.  
  
Backpatch down to all supported versions where the bug appears, aka 9.3  
which is where the end-of-recovery checkpoint is not run by the startup  
process anymore.  The test gets easily supported down to 10, still it  
has been tested on all branches.  
  
Reported-by: Pavan Deolasee  
Diagnosed-by: Pavan Deolasee  
Reviewed-by: Pavan Deolasee, Kyotaro Horiguchi  
Author: Michael Paquier, Kyotaro Horiguchi, Pavan Deolasee, Álvaro  
Herrera  
Discussion: https://postgr.es/m/CABOikdPOewjNL=05K5CbNMxnNtXnQjhTx2F--4p4ruorCjukbA@mail.gmail.com  

M src/backend/access/transam/xlog.c
A src/test/recovery/t/015_promotion_pages.pl

Use context with correct lifetime in hypothetical_dense_rank_final.

commit   : 249126e761e13c4d8e7519569d483eaeca7dac25    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Jul 2018 17:36:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Jul 2018 17:36:01 -0700    

Click here for diff

The query lifetime expression context created in  
hypothetical_dense_rank_final() was buggily allocated in the calling  
memory context. I (Andres) broke that in bf6c614a2f2.  
  
Reported-By: Rajkumar Raghuwanshi  
Author: Amit Langote  
Discussion:  https://postgr.es/m/CAKcux6kmzWmur5HhA_aU6gYVFu0RLQdgJJ+aC9SLdcOvBSrpfA@mail.gmail.com  
Backpatch: 11-  

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

Check for interrupts inside the nbtree page deletion code.

commit   : 3a01f68e35a3584431ac5381c6ed75b1b39aaf2a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Jul 2018 14:53:30 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Jul 2018 14:53:30 -0700    

Click here for diff

When deleting pages the nbtree code has to walk through siblings of a  
tree node. When those sibling links are corrupted that can lead to  
endless loops - which are currently not interruptible.  This is  
especially problematic if autovacuum is repeatedly blocked on such  
indexes, as it can be hard to get out of that situation without  
resorting to single user mode.  
  
Thus add interrupt checks to appropriate places in such  
loops. Unfortunately in one of the cases it's it's not easy to do so.  
  
Between 9.3 and 9.4 the page deletion (and page split) code changed  
significantly. Before it was significantly less robust against  
interruptions. Therefore don't backpatch to 9.3.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.4-  

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

Improve the performance of relation deletes during recovery.

commit   : b41669118c00e25376a6c9ac991e0d074990484a    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 5 Jul 2018 02:21:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 5 Jul 2018 02:21:15 +0900    

Click here for diff

When multiple relations are deleted at the same transaction,  
the files of those relations are deleted by one call to smgrdounlinkall(),  
which leads to scan whole shared_buffers only one time. OTOH,  
previously, during recovery, smgrdounlink() (not smgrdounlinkall()) was  
called for each file to delete, which led to scan shared_buffers  
multiple times. Obviously this could cause to increase the WAL replay  
time very much especially when shared_buffers was huge.  
  
To alleviate this situation, this commit changes the recovery so that  
it also calls smgrdounlinkall() only one time to delete multiple  
relation files.  
  
This is just fix for oversight of commit 279628a0a7, not new feature.  
So, per discussion on pgsql-hackers, we concluded to backpatch this  
to all supported versions.  
  
Author: Fujii Masao  
Reviewed-by: Michael Paquier, Andres Freund, Thomas Munro, Kyotaro Horiguchi, Takayuki Tsunakawa  
Discussion: https://postgr.es/m/CAHGQGwHVQkdfDqtvGVkty+19cQakAydXn1etGND3X0PHbZ3+6w@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/storage/smgr/md.c
M src/include/storage/smgr.h

doc: Reorganize CREATE TABLE / LIKE option documentation

commit   : b46727e07a9f4b8e0c8de1f10bfd4986b02c154c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 10:40:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 Jul 2018 10:40:16 +0200    

Click here for diff

This section once started out small but has now grown quite a bit and  
needs a bit of structure.  
  
Rewrite as list, add documentation of EXCLUDING, and improve the  
documentation of INCLUDING ALL instead of just listing all the options  
again.  
  
per report from Yugo Nagata that EXCLUDING was not documented, that part  
reviewed by Daniel Gustafsson, most of the rewrite was by me  

M doc/src/sgml/ref/create_table.sgml

Remove dead code for temporary relations in partition planning

commit   : fc057b2b8fc3c3556d9f8cc0195c622aaad92c9e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 4 Jul 2018 10:37:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 4 Jul 2018 10:37:40 +0900    

Click here for diff

Since recent commit 1c7c317c, temporary relations cannot be mixed with  
permanent relations within the same partition tree, and the same counts  
for temporary relations created by other sessions, which the planner  
simply discarded.  Instead be paranoid and issue an error, as those  
should be blocked at definition time, at least for now.  
  
At the same time, a test case is added to stress what has been moved  
when expand_partitioned_rtentry gets called recursively but bumps on a  
partitioned relation with no partitions which should be handled the same  
way as the non-inheritance case.  This code may be reworked in a close  
future, and covering this code path will limit surprises.  
  
Reported-by: David Rowley  
Author: David Rowley  
Reviewed-by: Amit Langote, Robert Haas, Michael Paquier  
Discussion: https://postgr.es/m/CAKJS1f_HyV1txn_4XSdH5EOhBMYaCwsXyAj6bHXk9gOu4JKsbw@mail.gmail.com  

M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/select.out
M src/test/regress/sql/select.sql

Add $Test::Builder::Level to pgbench test functions

commit   : 2c059c86ba774930fa816278343ff30292db4e6c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jul 2018 18:23:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jul 2018 18:23:50 +0200    

Click here for diff

same as c4309f4aeeae54e4c5281d68e29288af1d0d1ed2  

M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl

Correct comment

commit   : 683707868723d2a798ff8dcb0513d89735591b66    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jul 2018 18:33:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 3 Jul 2018 18:33:30 +0200    

Click here for diff

M src/bin/pgbench/t/001_pgbench_with_server.pl

Add wait event for fsync of WAL segments

commit   : c55de5e5123ce58ee19a47c08425949599285041    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 Jul 2018 22:19:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 Jul 2018 22:19:46 +0900    

Click here for diff

This has been visibly a forgotten spot in the first implementation of  
wait events for I/O added by 249cf07, and what has been missing is a  
fsync call for WAL segments which is a wrapper reacting on the value of  
GUC wal_sync_method.  
  
Reported-by: Konstantin Knizhnik  
Author: Konstantin Knizhnik  
Reviewed-by: Craig Ringer, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Correct function name in comment of logical decoding code

commit   : c072e80337e6b1e829141c9cd8ba0bc585f5c2ab    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 Jul 2018 13:30:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 Jul 2018 13:30:12 +0900    

Click here for diff

Reported-by: Dave Cramer  
Author: Euler Taveira  
Discussion: https://postgr.es/m/CADK3HHKnPGJDLhjOFBY6+70Wd14iEH8c2GKw7UrOuUHp_GNFrA@mail.gmail.com  

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

pg_standby: Remove code for .backup files

commit   : a33969ee918aafdb9086be27d7d63b129b4bfc44    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 1 Jul 2018 15:10:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 1 Jul 2018 15:10:08 +0200    

Click here for diff

These files are no longer requested on recovery (since  
06f82b29616cd9effcaefd99c6b6e2e80697482f), so the code for handling them  
here is useless.  
  
Author: Yugo Nagata <[email protected]>  

M contrib/pg_standby/pg_standby.c

Fix libpq example programs

commit   : 7bdea6263543c0dabf4d374b3c8d2c3a1d91649e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 1 Jul 2018 14:06:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 1 Jul 2018 14:06:40 +0200    

Click here for diff

When these programs call pg_catalog.set_config, they need to check for  
PGRES_TUPLES_OK instead of PGRES_COMMAND_OK.  Fix for  
5770172cb0c9df9e6ce27c507b449557e5b45124.  
  
Reported-by: Ideriha, Takeshi <[email protected]>  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/lobj.sgml
M src/test/examples/testlibpq.c
M src/test/examples/testlibpq2.c
M src/test/examples/testlibpq4.c
M src/test/examples/testlo.c
M src/test/examples/testlo64.c

Use more modern instructions for creating a new dev cycle

commit   : 56b4da8c9d11f685f1fe2e11cf015e850913b6b8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 1 Jul 2018 07:54:51 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 1 Jul 2018 07:54:51 -0400    

Click here for diff

M src/tools/RELEASE_CHANGES

Add tests for inheritance trees mixing permanent and temporary relations

commit   : 9994013ff32cb8371aed8ba28fc262e0a8cb0b4b    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 1 Jul 2018 20:20:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 1 Jul 2018 20:20:06 +0900    

Click here for diff

While working on 1c7c317c and related things, which has clarified the  
use of partitions with temporary tables, I have noticed that there could  
be better coverage for inheritance trees mixing temporary and permanent  
relations.  A lot of cross-checks happen in MergeAttributes() which is  
not designed for this purpose, so the tests added in this commit will  
make sure that any kind of future refactoring will limit the amount of  
compatibility breakage.  
  
Author: Michael Paquier  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

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

Use $Test::Builder::Level in TAP test functions

commit   : c4309f4aeeae54e4c5281d68e29288af1d0d1ed2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 May 2018 14:25:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 May 2018 14:25:01 -0400    

Click here for diff

In TAP test functions, that is, those that produce test results, locally  
increment $Test::Builder::Level.  This has the effect that test failures  
are reported at the callers location rather than somewhere in the test  
support libraries.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  

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

Use optimized bitmap set function for membership test in postgres_fdw

commit   : 65782346a4812482bfb09f9e1117c908146e67b5    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 1 Jul 2018 15:10:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 1 Jul 2018 15:10:10 +0900    

Click here for diff

Deparsing logic in postgres_fdw for locking, FROM clause (alias) and Var  
(column qualification) does not need to know the exact number of members  
involved, which can be calculated with bms_num_members(), but just if  
there is more than one relation involved, which is what bms_membership()  
does.  The latter is more performant than the former so this shaves a  
couple of cycles.  
  
Author: Daniel Gustafsson  
Reviewed-by: Ashutosh Bapat, Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c

Stamp HEAD as 12devel

commit   : feced1387f07c3fa6c47d36a68962750e6065486    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jun 2018 12:47:59 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 30 Jun 2018 12:47:59 -0400    

Click here for diff

Let the hacking begin ...  

M configure
M configure.in
M doc/bug.template
M src/include/pg_config.h.win32
M src/interfaces/libpq/libpq.rc.in
M src/port/win32ver.rc
M src/tools/git_changelog
M src/tools/version_stamp.pl